mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
Adding uppdev....
git-svn-id: svn://ultimatepp.org/upp/trunk@328 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
dc9f782ba5
commit
4a1c627474
2823 changed files with 619073 additions and 0 deletions
12
uppdev/Bugs/LineEditScroll/Bugs/LineEditScroll.upp
Normal file
12
uppdev/Bugs/LineEditScroll/Bugs/LineEditScroll.upp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
"Bugs/LineEditScroll.h"
|
||||
, main.cpp
|
||||
|
||||
|
||||
;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
6
uppdev/Bugs/LineEditScroll/LineEditScroll.h
Normal file
6
uppdev/Bugs/LineEditScroll/LineEditScroll.h
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#ifndef _LineEditScroll_LineEditScroll_h
|
||||
#define _LineEditScroll_LineEditScroll_h
|
||||
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
#endif
|
||||
9
uppdev/Bugs/LineEditScroll/LineEditScroll.upp
Normal file
9
uppdev/Bugs/LineEditScroll/LineEditScroll.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
LineEditScroll.h,
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI";
|
||||
67
uppdev/Bugs/LineEditScroll/main.cpp
Normal file
67
uppdev/Bugs/LineEditScroll/main.cpp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
#include "LineEditScroll.h"
|
||||
|
||||
class ScrollBugWindow : public TopWindow {
|
||||
public:
|
||||
typedef ScrollBugWindow CLASSNAME;
|
||||
ScrollBugWindow();
|
||||
|
||||
private:
|
||||
void Animate();
|
||||
|
||||
private:
|
||||
LineEdit editor;
|
||||
Vector<char> matrix;
|
||||
enum { WIDTH = 80, HEIGHT = 160 };
|
||||
Point pos;
|
||||
int sync_ticks;
|
||||
TimeCallback tc_anim;
|
||||
};
|
||||
|
||||
ScrollBugWindow::ScrollBugWindow()
|
||||
{
|
||||
matrix.SetCount(WIDTH * HEIGHT, ' ');
|
||||
pos = Point(0, 0);
|
||||
sync_ticks = msecs();
|
||||
Add(editor.SizePos());
|
||||
Sizeable().Zoomable();
|
||||
Title("Line editor scrolling bug");
|
||||
tc_anim.Set(-10, THISBACK(Animate));
|
||||
}
|
||||
|
||||
void ScrollBugWindow::Animate()
|
||||
{
|
||||
String rowfmt = NFormat("Row #%d: ", pos.y + 1);
|
||||
rowfmt.Cat('*', pos.y + 1);
|
||||
rowfmt << " \\";
|
||||
matrix[pos.y * WIDTH + pos.x] = (pos.x < rowfmt.GetLength() ? rowfmt[pos.x] : ' ');
|
||||
if(pos.x & 1) {
|
||||
if(--pos.y < 0) {
|
||||
pos.y = 0;
|
||||
pos.x++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(++pos.y >= HEIGHT) {
|
||||
pos.y = HEIGHT - 1;
|
||||
pos.x++;
|
||||
}
|
||||
}
|
||||
if(pos.x >= WIDTH) {
|
||||
Fill(matrix.Begin(), matrix.End(), ' ');
|
||||
pos = Point(0, 0);
|
||||
}
|
||||
if(msecs(sync_ticks) >= 500) {
|
||||
String text;
|
||||
for(int i = 0; i < HEIGHT; i++) {
|
||||
text.Cat(matrix.GetIter(i * WIDTH), WIDTH);
|
||||
text.Cat('\n');
|
||||
}
|
||||
editor <<= text;
|
||||
sync_ticks = msecs();
|
||||
}
|
||||
}
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
ScrollBugWindow().Run();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue