mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-19 07:20:50 +00:00
[qwaq] Implement ofDontDraw
The conditional selector performance seems to work nicely, but I've found a mistake with View.window (partly, realizing why my old lib (and probably TV in the first place) had separate textContext and buffers between views and groups).
This commit is contained in:
parent
6bf2fd546d
commit
40ae7a7f19
5 changed files with 26 additions and 22 deletions
|
@ -31,6 +31,7 @@ typedef BOOL condition_func2 (id object, void *anObject, void *data);
|
|||
{
|
||||
Array *views;
|
||||
int focused;
|
||||
struct window_s *window;
|
||||
}
|
||||
-insert: (View *) view;
|
||||
-remove: (View *) view;
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
|
||||
-insert: (View *) view
|
||||
{
|
||||
[views insertObject: view atIndex: 0];
|
||||
[views addObject: view];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -109,9 +109,25 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
static BOOL
|
||||
not_dont_draw (id aView, void *aGroup)
|
||||
{
|
||||
View *view = aView;
|
||||
Group *group = (Group *) aGroup;
|
||||
if (!(view.options & ofDontDraw)) {
|
||||
if (!view.textContext) {
|
||||
view.textContext = group.window;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
-draw
|
||||
{
|
||||
[views makeObjectsPerformSelector: @selector(draw)];
|
||||
[views makeObjectsPerformSelector: @selector(draw)
|
||||
if: not_dont_draw
|
||||
with: self];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
if (!(self = [super initWithRect:getwrect (stdscr)])) {
|
||||
return nil;
|
||||
}
|
||||
window = stdscr;
|
||||
scrollok (window, 1);
|
||||
textContext = stdscr;
|
||||
scrollok (textContext, 1);
|
||||
return self;
|
||||
}
|
||||
|
||||
-setBackground: (int) ch
|
||||
{
|
||||
wbkgd (window, ch);
|
||||
wbkgd (textContext, ch);
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -43,26 +43,20 @@
|
|||
-redraw
|
||||
{
|
||||
update_panels ();
|
||||
wrefresh(window);
|
||||
wrefresh(textContext);
|
||||
doupdate ();
|
||||
return self;
|
||||
}
|
||||
|
||||
-printf: (string) fmt, ...
|
||||
{
|
||||
wvprintf (window, fmt, @args);
|
||||
wvprintf (textContext, fmt, @args);
|
||||
return self;
|
||||
}
|
||||
|
||||
-addch: (int) ch atX: (int) x Y: (int) y
|
||||
{
|
||||
mvwaddch(window, x, y, ch);
|
||||
return self;
|
||||
}
|
||||
|
||||
-setOwner: owner
|
||||
{
|
||||
self.owner = owner;
|
||||
mvwaddch(textContext, x, y, ch);
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ enum {
|
|||
Rect absRect;
|
||||
Point point; // can't be local :(
|
||||
Group *owner;
|
||||
struct window_s *window;
|
||||
struct window_s *textContext; //FIXME separate class
|
||||
int state;
|
||||
int options;
|
||||
int cursorState;
|
||||
|
@ -52,7 +52,6 @@ enum {
|
|||
}
|
||||
-initWithRect: (Rect) rect;
|
||||
- (void) dealloc;
|
||||
-(struct window_s *) getWindow;
|
||||
-setOwner: (Group *) owner;
|
||||
-(struct Rect_s *)getRect;
|
||||
-draw;
|
||||
|
|
|
@ -97,15 +97,9 @@ updateScreenCursor (View *view)
|
|||
-setOwner: (Group *) owner
|
||||
{
|
||||
self.owner = owner;
|
||||
window = [owner getWindow];
|
||||
return self;
|
||||
}
|
||||
|
||||
-(window_t) getWindow
|
||||
{
|
||||
return window;
|
||||
}
|
||||
|
||||
- (Rect *) getRect
|
||||
{
|
||||
return ▭
|
||||
|
|
Loading…
Reference in a new issue