Added Gustavo's damage() update - now use symbolic constants for all values!
git-svn-id: file:///fltk/svn/fltk/trunk@18 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
33ee986a7b
commit
512332670a
@ -290,4 +290,13 @@ enum Fl_Mode { // visual types and Fl_Gl_Window::mode() (values match Glut)
|
|||||||
FL_MULTISAMPLE= 128
|
FL_MULTISAMPLE= 128
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// damage masks
|
||||||
|
|
||||||
|
const uchar FL_DAMAGE_CHILD = 0x01;
|
||||||
|
const uchar FL_DAMAGE_EXPOSE = 0x02;
|
||||||
|
const uchar FL_DAMAGE_LINE = 0x02;
|
||||||
|
const uchar FL_DAMAGE_SCROLL = 0x04;
|
||||||
|
const uchar FL_DAMAGE_OVERLAY = 0x04|0x08;
|
||||||
|
const uchar FL_DAMAGE_ALL = 0x80;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -65,7 +65,7 @@ protected:
|
|||||||
void inserting(void *a,void *b); // insert a before b
|
void inserting(void *a,void *b); // insert a before b
|
||||||
int displayed(void *) const ; // true if this line is visible
|
int displayed(void *) const ; // true if this line is visible
|
||||||
void redraw_line(void *); // minimal update, no change in size
|
void redraw_line(void *); // minimal update, no change in size
|
||||||
void redraw_lines() {damage(4);} // redraw all of them
|
void redraw_lines() {damage(FL_DAMAGE_SCROLL);} // redraw all of them
|
||||||
void bbox(int&,int&,int&,int&) const;
|
void bbox(int&,int&,int&,int&) const;
|
||||||
int leftedge() const; // x position after scrollbar & border
|
int leftedge() const; // x position after scrollbar & border
|
||||||
void *find_item(int my); // item under mouse
|
void *find_item(int my); // item under mouse
|
||||||
|
@ -129,7 +129,7 @@ public:
|
|||||||
void Overlay_Window::draw() {
|
void Overlay_Window::draw() {
|
||||||
const int CHECKSIZE = 8;
|
const int CHECKSIZE = 8;
|
||||||
// see if box is clear or a frame or rounded:
|
// see if box is clear or a frame or rounded:
|
||||||
if ((damage()&128) &&
|
if ((damage()&FL_DAMAGE_ALL) &&
|
||||||
(!box() || (box()>=4&&!(box()&2)) || box()>=_FL_ROUNDED_BOX)) {
|
(!box() || (box()>=4&&!(box()&2)) || box()>=_FL_ROUNDED_BOX)) {
|
||||||
// if so, draw checkerboard so user can see what areas are clear:
|
// if so, draw checkerboard so user can see what areas are clear:
|
||||||
for (int y = 0; y < h(); y += CHECKSIZE)
|
for (int y = 0; y < h(); y += CHECKSIZE)
|
||||||
|
@ -72,9 +72,9 @@ void Fl_Browser_::resize(int X, int Y, int W, int H) {
|
|||||||
|
|
||||||
// Cause minimal update to redraw the given item:
|
// Cause minimal update to redraw the given item:
|
||||||
void Fl_Browser_::redraw_line(void* l) {
|
void Fl_Browser_::redraw_line(void* l) {
|
||||||
if (!redraw1 || redraw1 == l) {redraw1 = l; damage(2);}
|
if (!redraw1 || redraw1 == l) {redraw1 = l; damage(FL_DAMAGE_LINE);}
|
||||||
else if (!redraw2 || redraw2 == l) {redraw2 = l; damage(2);}
|
else if (!redraw2 || redraw2 == l) {redraw2 = l; damage(FL_DAMAGE_LINE);}
|
||||||
else damage(4);
|
else damage(FL_DAMAGE_SCROLL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Figure out top() based on position():
|
// Figure out top() based on position():
|
||||||
@ -127,7 +127,7 @@ void Fl_Browser_::update_top() {
|
|||||||
offset_ = y-ly;
|
offset_ = y-ly;
|
||||||
real_position_ = y;
|
real_position_ = y;
|
||||||
}
|
}
|
||||||
damage(4);
|
damage(FL_DAMAGE_SCROLL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ void Fl_Browser_::display(void* x) {
|
|||||||
// redraw, has side effect of updating top and setting scrollbar:
|
// redraw, has side effect of updating top and setting scrollbar:
|
||||||
void Fl_Browser_::draw() {
|
void Fl_Browser_::draw() {
|
||||||
int drawsquare = 0;
|
int drawsquare = 0;
|
||||||
if (damage() & 128) { // redraw the box if full redraw
|
if (damage() & FL_DAMAGE_ALL) { // redraw the box if full redraw
|
||||||
Fl_Boxtype b = box() ? box() : Fl_Input_::default_box();
|
Fl_Boxtype b = box() ? box() : Fl_Input_::default_box();
|
||||||
draw_box(b, x(), y(), w(), h(), color());
|
draw_box(b, x(), y(), w(), h(), color());
|
||||||
drawsquare = 1;
|
drawsquare = 1;
|
||||||
@ -239,11 +239,11 @@ J1:
|
|||||||
for (; l && yy < H; l = item_next(l)) {
|
for (; l && yy < H; l = item_next(l)) {
|
||||||
int hh = item_height(l);
|
int hh = item_height(l);
|
||||||
if (hh <= 0) continue;
|
if (hh <= 0) continue;
|
||||||
if ((damage()&4) || l == redraw1 || l == redraw2) {
|
if ((damage()&(FL_DAMAGE_SCROLL|FL_DAMAGE_ALL)) || l == redraw1 || l == redraw2) {
|
||||||
if (item_selected(l)) {
|
if (item_selected(l)) {
|
||||||
fl_color(selection_color());
|
fl_color(selection_color());
|
||||||
fl_rectf(X, yy+Y, W, hh);
|
fl_rectf(X, yy+Y, W, hh);
|
||||||
} else if (!(damage()&128)) {
|
} else if (!(damage()&FL_DAMAGE_ALL)) {
|
||||||
fl_color(color());
|
fl_color(color());
|
||||||
fl_rectf(X, yy+Y, W, hh);
|
fl_rectf(X, yy+Y, W, hh);
|
||||||
}
|
}
|
||||||
@ -258,7 +258,7 @@ J1:
|
|||||||
yy += hh;
|
yy += hh;
|
||||||
}
|
}
|
||||||
// erase the area below last line:
|
// erase the area below last line:
|
||||||
if (!(damage()&128) && yy < H) {
|
if (!(damage()&FL_DAMAGE_ALL) && yy < H) {
|
||||||
fl_color(color());
|
fl_color(color());
|
||||||
fl_rectf(X, yy+Y, W, H-yy);
|
fl_rectf(X, yy+Y, W, H-yy);
|
||||||
}
|
}
|
||||||
|
@ -104,10 +104,13 @@ int Fl_Color_Chooser::rgb(double r, double g, double b) {
|
|||||||
set_valuators();
|
set_valuators();
|
||||||
if (value_ != pv) {
|
if (value_ != pv) {
|
||||||
#ifdef UPDATE_HUE_BOX
|
#ifdef UPDATE_HUE_BOX
|
||||||
huebox.damage(6);
|
huebox.damage(FL_DAMAGE_EXPOSE|FL_DAMAGE_OVERLAY);
|
||||||
#endif
|
#endif
|
||||||
valuebox.damage(2);}
|
valuebox.damage(FL_DAMAGE_EXPOSE);}
|
||||||
if (hue_ != ph || saturation_ != ps) {huebox.damage(2); valuebox.damage(6);}
|
if (hue_ != ph || saturation_ != ps) {
|
||||||
|
huebox.damage(FL_DAMAGE_EXPOSE);
|
||||||
|
valuebox.damage(FL_DAMAGE_EXPOSE|FL_DAMAGE_OVERLAY);
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,10 +125,13 @@ int Fl_Color_Chooser::hsv(double h, double s, double v) {
|
|||||||
hue_ = h; saturation_ = s; value_ = v;
|
hue_ = h; saturation_ = s; value_ = v;
|
||||||
if (value_ != pv) {
|
if (value_ != pv) {
|
||||||
#ifdef UPDATE_HUE_BOX
|
#ifdef UPDATE_HUE_BOX
|
||||||
huebox.damage(6);
|
huebox.damage(FL_DAMAGE_EXPOSE|FL_DAMAGE_OVERLAY);
|
||||||
#endif
|
#endif
|
||||||
valuebox.damage(2);}
|
valuebox.damage(FL_DAMAGE_EXPOSE);}
|
||||||
if (hue_ != ph || saturation_ != ps) {huebox.damage(2); valuebox.damage(6);}
|
if (hue_ != ph || saturation_ != ps) {
|
||||||
|
huebox.damage(FL_DAMAGE_EXPOSE);
|
||||||
|
valuebox.damage(FL_DAMAGE_EXPOSE|FL_DAMAGE_OVERLAY);
|
||||||
|
}
|
||||||
hsv2rgb(h,s,v,r_,g_,b_);
|
hsv2rgb(h,s,v,r_,g_,b_);
|
||||||
set_valuators();
|
set_valuators();
|
||||||
return 1;
|
return 1;
|
||||||
@ -189,14 +195,14 @@ static void generate_image(void* vv, int X, int Y, int W, uchar* buf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Flcc_HueBox::draw() {
|
void Flcc_HueBox::draw() {
|
||||||
if (damage()&128) draw_box();
|
if (damage()&FL_DAMAGE_ALL) draw_box();
|
||||||
int x1 = x()+Fl::box_dx(box());
|
int x1 = x()+Fl::box_dx(box());
|
||||||
int y1 = y()+Fl::box_dy(box());
|
int y1 = y()+Fl::box_dy(box());
|
||||||
int w1 = w()-Fl::box_dw(box());
|
int w1 = w()-Fl::box_dw(box());
|
||||||
int h1 = h()-Fl::box_dh(box());
|
int h1 = h()-Fl::box_dh(box());
|
||||||
if (damage() == 2) fl_clip(x1+px,y1+py,6,6);
|
if (damage() == FL_DAMAGE_EXPOSE) fl_clip(x1+px,y1+py,6,6);
|
||||||
fl_draw_image(generate_image, this, x1, y1, w1, h1);
|
fl_draw_image(generate_image, this, x1, y1, w1, h1);
|
||||||
if (damage() == 2) fl_pop_clip();
|
if (damage() == FL_DAMAGE_EXPOSE) fl_pop_clip();
|
||||||
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
|
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
|
||||||
#ifdef CIRCLE
|
#ifdef CIRCLE
|
||||||
int X = int(.5*(cos(c->hue()*(M_PI/3.0))*c->saturation()+1) * (w1-6));
|
int X = int(.5*(cos(c->hue()*(M_PI/3.0))*c->saturation()+1) * (w1-6));
|
||||||
@ -244,16 +250,16 @@ static void generate_vimage(void* vv, int X, int Y, int W, uchar* buf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Flcc_ValueBox::draw() {
|
void Flcc_ValueBox::draw() {
|
||||||
if (damage()&128) draw_box();
|
if (damage()&FL_DAMAGE_ALL) draw_box();
|
||||||
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
|
Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
|
||||||
c->hsv2rgb(c->hue(),c->saturation(),1.0,tr,tg,tb);
|
c->hsv2rgb(c->hue(),c->saturation(),1.0,tr,tg,tb);
|
||||||
int x1 = x()+Fl::box_dx(box());
|
int x1 = x()+Fl::box_dx(box());
|
||||||
int y1 = y()+Fl::box_dy(box());
|
int y1 = y()+Fl::box_dy(box());
|
||||||
int w1 = w()-Fl::box_dw(box());
|
int w1 = w()-Fl::box_dw(box());
|
||||||
int h1 = h()-Fl::box_dh(box());
|
int h1 = h()-Fl::box_dh(box());
|
||||||
if (damage() == 2) fl_clip(x1,y1+py,w1,6);
|
if (damage() == FL_DAMAGE_EXPOSE) fl_clip(x1,y1+py,w1,6);
|
||||||
fl_draw_image(generate_vimage, this, x1, y1, w1, h1);
|
fl_draw_image(generate_vimage, this, x1, y1, w1, h1);
|
||||||
if (damage() == 2) fl_pop_clip();
|
if (damage() == FL_DAMAGE_EXPOSE) fl_pop_clip();
|
||||||
int Y = int((1-c->value()) * (h1-6));
|
int Y = int((1-c->value()) * (h1-6));
|
||||||
if (Y < 0) Y = 0; else if (Y > h1-6) Y = h1-6;
|
if (Y < 0) Y = 0; else if (Y > h1-6) Y = h1-6;
|
||||||
draw_box(FL_UP_BOX,x1,y1+Y,w1,6,FL_GRAY);
|
draw_box(FL_UP_BOX,x1,y1+Y,w1,6,FL_GRAY);
|
||||||
@ -331,7 +337,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void ColorChip::draw() {
|
void ColorChip::draw() {
|
||||||
if (damage()&128) draw_box();
|
if (damage()&FL_DAMAGE_ALL) draw_box();
|
||||||
fl_rectf(x()+Fl::box_dx(box()),
|
fl_rectf(x()+Fl::box_dx(box()),
|
||||||
y()+Fl::box_dy(box()),
|
y()+Fl::box_dy(box()),
|
||||||
w()-Fl::box_dw(box()),
|
w()-Fl::box_dw(box()),
|
||||||
@ -344,7 +350,7 @@ static void chooser_cb(Fl_Object* o, void* vv) {
|
|||||||
v->r = uchar(255*c->r()+.5);
|
v->r = uchar(255*c->r()+.5);
|
||||||
v->g = uchar(255*c->g()+.5);
|
v->g = uchar(255*c->g()+.5);
|
||||||
v->b = uchar(255*c->b()+.5);
|
v->b = uchar(255*c->b()+.5);
|
||||||
v->damage(2);
|
v->damage(FL_DAMAGE_EXPOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern const char* fl_ok;
|
extern const char* fl_ok;
|
||||||
|
@ -39,7 +39,7 @@ void Fl_Counter::draw() {
|
|||||||
fl_color(active_r() ? textcolor() : inactive(textcolor()));
|
fl_color(active_r() ? textcolor() : inactive(textcolor()));
|
||||||
char str[128]; format(str);
|
char str[128]; format(str);
|
||||||
fl_draw(str, xx[0], y(), ww[0], h(), FL_ALIGN_CENTER);
|
fl_draw(str, xx[0], y(), ww[0], h(), FL_ALIGN_CENTER);
|
||||||
if (!(damage()&128)) return; // only need to redraw text
|
if (!(damage()&FL_DAMAGE_ALL)) return; // only need to redraw text
|
||||||
|
|
||||||
if (type() == FL_NORMAL_COUNTER) {
|
if (type() == FL_NORMAL_COUNTER) {
|
||||||
draw_box(boxtype[1], xx[1], y(), ww[1], h(), color());
|
draw_box(boxtype[1], xx[1], y(), ww[1], h(), color());
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <FL/math.h>
|
#include <FL/math.h>
|
||||||
|
|
||||||
void Fl_Dial::draw(int x, int y, int w, int h) {
|
void Fl_Dial::draw(int x, int y, int w, int h) {
|
||||||
if (damage()&128) draw_box(box(), x, y, w, h, color());
|
if (damage()&FL_DAMAGE_ALL) draw_box(box(), x, y, w, h, color());
|
||||||
x += Fl::box_dx(box());
|
x += Fl::box_dx(box());
|
||||||
y += Fl::box_dy(box());
|
y += Fl::box_dy(box());
|
||||||
w -= Fl::box_dw(box());
|
w -= Fl::box_dw(box());
|
||||||
@ -30,7 +30,7 @@ void Fl_Dial::draw(int x, int y, int w, int h) {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!(damage()&128)) {
|
if (!(damage()&FL_DAMAGE_ALL)) {
|
||||||
fl_color(color());
|
fl_color(color());
|
||||||
fl_pie(x+1, y+1, w-2, h-2, 0, 360);
|
fl_pie(x+1, y+1, w-2, h-2, 0, 360);
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,9 @@ static int can_xdbe() {
|
|||||||
}
|
}
|
||||||
return use_xdbe;
|
return use_xdbe;
|
||||||
}
|
}
|
||||||
#define DAMAGE_TEST() (damage() && (use_xdbe || damage() != 2))
|
#define DAMAGE_TEST() (damage() && (use_xdbe || damage() != FL_DAMAGE_EXPOSE))
|
||||||
#else
|
#else
|
||||||
#define DAMAGE_TEST() (damage() & ~2)
|
#define DAMAGE_TEST() (damage() & ~FL_DAMAGE_EXPOSE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Fl_Double_Window::show() {
|
void Fl_Double_Window::show() {
|
||||||
@ -92,7 +92,7 @@ void Fl_Double_Window::flush() {
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
i->other_xid = fl_create_offscreen(w(), h());
|
i->other_xid = fl_create_offscreen(w(), h());
|
||||||
clear_damage(~0);
|
clear_damage(FL_DAMAGE_ALL);
|
||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
fl_clip_region(i->region); i->region = 0;
|
fl_clip_region(i->region); i->region = 0;
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void _Fl_Gl_Overlay::draw() {
|
void _Fl_Gl_Overlay::draw() {
|
||||||
if (damage() != 2) glClear(GL_COLOR_BUFFER_BIT);
|
if (damage() != FL_DAMAGE_EXPOSE) glClear(GL_COLOR_BUFFER_BIT);
|
||||||
Fl_Gl_Window *w = (Fl_Gl_Window *)parent();
|
Fl_Gl_Window *w = (Fl_Gl_Window *)parent();
|
||||||
uchar save_valid = w->valid_;
|
uchar save_valid = w->valid_;
|
||||||
w->valid_ = valid_;
|
w->valid_ = valid_;
|
||||||
@ -144,7 +144,7 @@ void Fl_Gl_Window::redraw_overlay() {
|
|||||||
((Fl_Gl_Window*)overlay)->redraw();
|
((Fl_Gl_Window*)overlay)->redraw();
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
damage(8);
|
damage(FL_DAMAGE_OVERLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Gl_Window::make_overlay_current() {
|
void Fl_Gl_Window::make_overlay_current() {
|
||||||
|
@ -144,7 +144,7 @@ void Fl_Gl_Window::flush() {
|
|||||||
#if HAVE_GL_OVERLAY
|
#if HAVE_GL_OVERLAY
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
uchar save_valid = valid_;
|
uchar save_valid = valid_;
|
||||||
if (overlay && overlay!= this && damage() == 8) goto DRAW_OVERLAY_ONLY;
|
if (overlay && overlay!= this && damage() == FL_DAMAGE_OVERLAY) goto DRAW_OVERLAY_ONLY;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -153,13 +153,13 @@ void Fl_Gl_Window::flush() {
|
|||||||
#if SWAP_TYPE == NODAMAGE
|
#if SWAP_TYPE == NODAMAGE
|
||||||
|
|
||||||
// don't draw if only overlay damage or expose events:
|
// don't draw if only overlay damage or expose events:
|
||||||
if ((damage()&~0xA0) || !valid()) draw();
|
if ((damage()&~(FL_DAMAGE_OVERLAY|FL_DAMAGE_EXPOSE)) || !valid()) draw();
|
||||||
swap_buffers();
|
swap_buffers();
|
||||||
|
|
||||||
#elif SWAP_TYPE == COPY
|
#elif SWAP_TYPE == COPY
|
||||||
|
|
||||||
// don't draw if only the overlay is damaged:
|
// don't draw if only the overlay is damaged:
|
||||||
if (damage() != 8 || !valid()) draw();
|
if (damage() != FL_DAMAGE_OVERLAY || !valid()) draw();
|
||||||
swap_buffers();
|
swap_buffers();
|
||||||
|
|
||||||
#else // SWAP_TYPE == SWAP || SWAP_TYPE == UNDEFINED
|
#else // SWAP_TYPE == SWAP || SWAP_TYPE == UNDEFINED
|
||||||
@ -167,7 +167,7 @@ void Fl_Gl_Window::flush() {
|
|||||||
if (overlay == this) { // Use CopyPixels to act like SWAP_TYPE == COPY
|
if (overlay == this) { // Use CopyPixels to act like SWAP_TYPE == COPY
|
||||||
|
|
||||||
// don't draw if only the overlay is damaged:
|
// don't draw if only the overlay is damaged:
|
||||||
if (damage1_ || damage() != 8 || !valid()) draw();
|
if (damage1_ || damage() != FL_DAMAGE_OVERLAY || !valid()) draw();
|
||||||
// we use a seperate context for the copy because rasterpos must be 0
|
// we use a seperate context for the copy because rasterpos must be 0
|
||||||
// and depth test needs to be off:
|
// and depth test needs to be off:
|
||||||
static GLXContext ortho_context;
|
static GLXContext ortho_context;
|
||||||
@ -216,7 +216,7 @@ void Fl_Gl_Window::flush() {
|
|||||||
|
|
||||||
// this faking of the overlay is incorrect but worked good for
|
// this faking of the overlay is incorrect but worked good for
|
||||||
// one in-house program:
|
// one in-house program:
|
||||||
if (overlay != this || damage()!=8 || !Fl::pushed()) draw();
|
if (overlay != this || damage()!=FL_DAMAGE_OVERLAY || !Fl::pushed()) draw();
|
||||||
if (overlay == this) draw_overlay();
|
if (overlay == this) draw_overlay();
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ void Fl_Group::resize(int X, int Y, int W, int H) {
|
|||||||
|
|
||||||
void Fl_Group::draw() {
|
void Fl_Group::draw() {
|
||||||
Fl_Widget*const* a = array();
|
Fl_Widget*const* a = array();
|
||||||
if (damage() & ~1) { // redraw the entire thing:
|
if (damage() & ~FL_DAMAGE_CHILD) { // redraw the entire thing:
|
||||||
draw_box();
|
draw_box();
|
||||||
draw_label();
|
draw_label();
|
||||||
for (int i=children_; i--;) {
|
for (int i=children_; i--;) {
|
||||||
@ -402,7 +402,7 @@ void Fl_Group::update_child(Fl_Widget& w) const {
|
|||||||
void Fl_Group::draw_child(Fl_Widget& w) const {
|
void Fl_Group::draw_child(Fl_Widget& w) const {
|
||||||
if (w.visible() && w.type() < FL_WINDOW &&
|
if (w.visible() && w.type() < FL_WINDOW &&
|
||||||
fl_not_clipped(w.x(), w.y(), w.w(), w.h())) {
|
fl_not_clipped(w.x(), w.y(), w.w(), w.h())) {
|
||||||
w.clear_damage(~0);
|
w.clear_damage(FL_DAMAGE_ALL);
|
||||||
w.draw();
|
w.draw();
|
||||||
w.clear_damage();
|
w.clear_damage();
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
void Fl_Input::draw() {
|
void Fl_Input::draw() {
|
||||||
if (type() == FL_HIDDEN_INPUT) return;
|
if (type() == FL_HIDDEN_INPUT) return;
|
||||||
Fl_Boxtype b = box() ? box() : default_box();
|
Fl_Boxtype b = box() ? box() : default_box();
|
||||||
if (damage() & 128) draw_box(b, color());
|
if (damage() & FL_DAMAGE_ALL) draw_box(b, color());
|
||||||
Fl_Input_::drawtext(x()+Fl::box_dx(b)+3, y()+Fl::box_dy(b),
|
Fl_Input_::drawtext(x()+Fl::box_dx(b)+3, y()+Fl::box_dy(b),
|
||||||
w()-Fl::box_dw(b)-6, h()-Fl::box_dh(b));
|
w()-Fl::box_dw(b)-6, h()-Fl::box_dh(b));
|
||||||
}
|
}
|
||||||
|
@ -84,13 +84,13 @@ double Fl_Input_::expandpos(
|
|||||||
// being erased, so they don't blink.
|
// being erased, so they don't blink.
|
||||||
|
|
||||||
void Fl_Input_::minimal_update(int p) {
|
void Fl_Input_::minimal_update(int p) {
|
||||||
if (damage() & 128) return; // don't waste time if it won't be done
|
if (damage() & FL_DAMAGE_ALL) return; // don't waste time if it won't be done
|
||||||
if (damage() & 2) {
|
if (damage() & FL_DAMAGE_EXPOSE) {
|
||||||
if (p < mu_p) mu_p = p;
|
if (p < mu_p) mu_p = p;
|
||||||
} else {
|
} else {
|
||||||
mu_p = p;
|
mu_p = p;
|
||||||
}
|
}
|
||||||
damage(2);
|
damage(FL_DAMAGE_EXPOSE);
|
||||||
erase_cursor_only = 0;
|
erase_cursor_only = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +110,7 @@ void Fl_Input_::setfont() const {
|
|||||||
|
|
||||||
void Fl_Input_::drawtext(int X, int Y, int W, int H) {
|
void Fl_Input_::drawtext(int X, int Y, int W, int H) {
|
||||||
|
|
||||||
int do_mu = !(damage()&128);
|
int do_mu = !(damage()&FL_DAMAGE_ALL);
|
||||||
if (Fl::focus()!=this && !size()) {
|
if (Fl::focus()!=this && !size()) {
|
||||||
if (do_mu) { // we have to erase it if cursor was there
|
if (do_mu) { // we have to erase it if cursor was there
|
||||||
fl_color(color());
|
fl_color(color());
|
||||||
@ -374,7 +374,7 @@ int Fl_Input_::position(int p, int m) {
|
|||||||
// new position is a cursor
|
// new position is a cursor
|
||||||
if (position_ == mark_) {
|
if (position_ == mark_) {
|
||||||
// old position was just a cursor
|
// old position was just a cursor
|
||||||
if (!(damage()&2)) {
|
if (!(damage()&FL_DAMAGE_EXPOSE)) {
|
||||||
minimal_update(position_); erase_cursor_only = 1;
|
minimal_update(position_); erase_cursor_only = 1;
|
||||||
}
|
}
|
||||||
} else { // old position was a selection
|
} else { // old position was a selection
|
||||||
@ -569,7 +569,7 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) {
|
|||||||
|
|
||||||
case FL_UNFOCUS:
|
case FL_UNFOCUS:
|
||||||
if (mark_ == position_) {
|
if (mark_ == position_) {
|
||||||
if (!(damage()&2)) {minimal_update(position_); erase_cursor_only = 1;}
|
if (!(damage()&FL_DAMAGE_EXPOSE)) {minimal_update(position_); erase_cursor_only = 1;}
|
||||||
} else if (Fl::selection_owner() != this) {
|
} else if (Fl::selection_owner() != this) {
|
||||||
minimal_update(mark_, position_);
|
minimal_update(mark_, position_);
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ void menutitle::draw() {
|
|||||||
|
|
||||||
void menuwindow::draw() {
|
void menuwindow::draw() {
|
||||||
|
|
||||||
if (damage() != 1) { // complete redraw
|
if (damage() != FL_DAMAGE_CHILD) { // complete redraw
|
||||||
if (menu) {
|
if (menu) {
|
||||||
fl_draw_box(button&&button->box() ? button->box() : FL_UP_BOX,
|
fl_draw_box(button&&button->box() ? button->box() : FL_UP_BOX,
|
||||||
0, 0, w(), h(),
|
0, 0, w(), h(),
|
||||||
@ -321,7 +321,7 @@ void menuwindow::draw() {
|
|||||||
for (m=menu, i=0; m->text; i++, m = m->next()) drawentry(m, i, 0);
|
for (m=menu, i=0; m->text; i++, m = m->next()) drawentry(m, i, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (damage() & 1 && selected!=drawn_selected) { // change selection
|
if (damage() & FL_DAMAGE_CHILD && selected!=drawn_selected) { // change selection
|
||||||
drawentry(menu->next(drawn_selected), drawn_selected, 1);
|
drawentry(menu->next(drawn_selected), drawn_selected, 1);
|
||||||
drawentry(menu->next(selected), selected, 1);
|
drawentry(menu->next(selected), selected, 1);
|
||||||
}
|
}
|
||||||
@ -330,7 +330,7 @@ void menuwindow::draw() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void menuwindow::set_selected(int i) {
|
void menuwindow::set_selected(int i) {
|
||||||
if (i != selected) {selected = i; damage(1);}
|
if (i != selected) {selected = i; damage(FL_DAMAGE_CHILD);}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
void Fl_Output::draw() {
|
void Fl_Output::draw() {
|
||||||
Fl_Boxtype b = box() ? box() : default_box();
|
Fl_Boxtype b = box() ? box() : default_box();
|
||||||
if (damage() & 128) draw_box(b, color());
|
if (damage() & FL_DAMAGE_ALL) draw_box(b, color());
|
||||||
Fl_Input_::drawtext(x()+Fl::box_dx(b)+3, y()+Fl::box_dy(b),
|
Fl_Input_::drawtext(x()+Fl::box_dx(b)+3, y()+Fl::box_dy(b),
|
||||||
w()-Fl::box_dw(b)-6, h()-Fl::box_dh(b));
|
w()-Fl::box_dw(b)-6, h()-Fl::box_dh(b));
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ void Fl_Overlay_Window::hide() {
|
|||||||
|
|
||||||
void Fl_Overlay_Window::flush() {
|
void Fl_Overlay_Window::flush() {
|
||||||
// turn off the bit set by redraw_overlay:
|
// turn off the bit set by redraw_overlay:
|
||||||
clear_damage(damage()&~8);
|
clear_damage(damage()&~FL_DAMAGE_OVERLAY);
|
||||||
// even if damage() == 0, flush() will erase the fake overlay by
|
// even if damage() == 0, flush() will erase the fake overlay by
|
||||||
// copying back buffer over it. It will also set the clip to the
|
// copying back buffer over it. It will also set the clip to the
|
||||||
// region made by all the expose events:
|
// region made by all the expose events:
|
||||||
@ -44,7 +44,7 @@ Fl_Overlay_Window::~Fl_Overlay_Window() {
|
|||||||
|
|
||||||
int Fl_Overlay_Window::can_do_overlay() {return 0;}
|
int Fl_Overlay_Window::can_do_overlay() {return 0;}
|
||||||
|
|
||||||
void Fl_Overlay_Window::redraw_overlay() {overlay_ = this; damage(8);}
|
void Fl_Overlay_Window::redraw_overlay() {overlay_ = this; damage(FL_DAMAGE_OVERLAY);}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ void _Fl_Overlay::flush() {
|
|||||||
fl_overlay = 1;
|
fl_overlay = 1;
|
||||||
Fl_Overlay_Window *w = (Fl_Overlay_Window *)parent();
|
Fl_Overlay_Window *w = (Fl_Overlay_Window *)parent();
|
||||||
Fl_X *i = Fl_X::i(this);
|
Fl_X *i = Fl_X::i(this);
|
||||||
if (damage() != 2) XClearWindow(fl_display, fl_xid(this));
|
if (damage() != FL_DAMAGE_EXPOSE) XClearWindow(fl_display, fl_xid(this));
|
||||||
fl_clip_region(i->region); i->region = 0;
|
fl_clip_region(i->region); i->region = 0;
|
||||||
w->draw_overlay();
|
w->draw_overlay();
|
||||||
fl_overlay = 0;
|
fl_overlay = 0;
|
||||||
@ -105,7 +105,7 @@ void Fl_Overlay_Window::redraw_overlay() {
|
|||||||
}
|
}
|
||||||
if (shown()) {
|
if (shown()) {
|
||||||
if (overlay_ == this)
|
if (overlay_ == this)
|
||||||
damage(8);
|
damage(FL_DAMAGE_OVERLAY);
|
||||||
else if (!overlay_->shown())
|
else if (!overlay_->shown())
|
||||||
overlay_->show();
|
overlay_->show();
|
||||||
else
|
else
|
||||||
|
@ -40,7 +40,7 @@ void Fl_Pack::draw() {
|
|||||||
H = o->h();
|
H = o->h();
|
||||||
}
|
}
|
||||||
if (spacing_ && current_position>maximum_position &&
|
if (spacing_ && current_position>maximum_position &&
|
||||||
(X != o->x() || Y != o->y() || d&128)) {
|
(X != o->x() || Y != o->y() || d&FL_DAMAGE_ALL)) {
|
||||||
fl_color(color());
|
fl_color(color());
|
||||||
if (horizontal())
|
if (horizontal())
|
||||||
fl_rectf(maximum_position, ty, spacing_, th);
|
fl_rectf(maximum_position, ty, spacing_, th);
|
||||||
@ -49,9 +49,9 @@ void Fl_Pack::draw() {
|
|||||||
}
|
}
|
||||||
if (X != o->x() || Y != o->y() || W != o->w() || H != o->h()) {
|
if (X != o->x() || Y != o->y() || W != o->w() || H != o->h()) {
|
||||||
o->resize(X,Y,W,H);
|
o->resize(X,Y,W,H);
|
||||||
o->clear_damage(~0);
|
o->clear_damage(FL_DAMAGE_ALL);
|
||||||
}
|
}
|
||||||
if (d&128) draw_child(*o); else update_child(*o);
|
if (d&FL_DAMAGE_ALL) draw_child(*o); else update_child(*o);
|
||||||
// child's draw() can change it's size, so use new size:
|
// child's draw() can change it's size, so use new size:
|
||||||
current_position += (horizontal() ? o->w() : o->h());
|
current_position += (horizontal() ? o->w() : o->h());
|
||||||
if (current_position > maximum_position)
|
if (current_position > maximum_position)
|
||||||
@ -73,6 +73,6 @@ void Fl_Pack::draw() {
|
|||||||
}
|
}
|
||||||
tw += Fl::box_dw(box()); if (tw <= 0) tw = 1;
|
tw += Fl::box_dw(box()); if (tw <= 0) tw = 1;
|
||||||
th += Fl::box_dh(box()); if (th <= 0) th = 1;
|
th += Fl::box_dh(box()); if (th <= 0) th = 1;
|
||||||
if (tw != w() || th != h()) {Fl_Widget::resize(x(),y(),tw,th); d = 128;}
|
if (tw != w() || th != h()) {Fl_Widget::resize(x(),y(),tw,th); d = FL_DAMAGE_ALL;}
|
||||||
if (d&128) draw_box();
|
if (d&FL_DAMAGE_ALL) draw_box();
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ int Fl_Roller::handle(int event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Roller::draw() {
|
void Fl_Roller::draw() {
|
||||||
if (damage()&128) draw_box();
|
if (damage()&FL_DAMAGE_ALL) draw_box();
|
||||||
int X = x()+Fl::box_dx(box());
|
int X = x()+Fl::box_dx(box());
|
||||||
int Y = y()+Fl::box_dy(box());
|
int Y = y()+Fl::box_dy(box());
|
||||||
int W = w()-Fl::box_dw(box())-1;
|
int W = w()-Fl::box_dw(box())-1;
|
||||||
|
@ -20,7 +20,7 @@ void Fl_Scroll::draw_clip(void* v,int X, int Y, int W, int H) {
|
|||||||
fl_clip(X,Y,W,H);
|
fl_clip(X,Y,W,H);
|
||||||
Fl_Scroll* s = (Fl_Scroll*)v;
|
Fl_Scroll* s = (Fl_Scroll*)v;
|
||||||
// erase background if there is a boxtype:
|
// erase background if there is a boxtype:
|
||||||
if (s->box() && !(s->damage()&128)) {
|
if (s->box() && !(s->damage()&FL_DAMAGE_ALL)) {
|
||||||
fl_color(s->color());
|
fl_color(s->color());
|
||||||
fl_rectf(X,Y,W,H);
|
fl_rectf(X,Y,W,H);
|
||||||
}
|
}
|
||||||
@ -66,14 +66,14 @@ void Fl_Scroll::draw() {
|
|||||||
|
|
||||||
uchar d = damage();
|
uchar d = damage();
|
||||||
|
|
||||||
if (d & 128) { // full redraw
|
if (d & FL_DAMAGE_ALL) { // full redraw
|
||||||
draw_box(box(),x(),y(),w(),h(),color());
|
draw_box(box(),x(),y(),w(),h(),color());
|
||||||
draw_clip(this, X, Y, W, H);
|
draw_clip(this, X, Y, W, H);
|
||||||
} else {
|
} else {
|
||||||
if (d & 2) { // scroll the contents:
|
if (d & FL_DAMAGE_EXPOSE) { // scroll the contents:
|
||||||
fl_scroll(X, Y, W, H, oldx-xposition_, oldy-yposition_, draw_clip, this);
|
fl_scroll(X, Y, W, H, oldx-xposition_, oldy-yposition_, draw_clip, this);
|
||||||
}
|
}
|
||||||
if (d & 1) { // draw damaged children
|
if (d & FL_DAMAGE_CHILD) { // draw damaged children
|
||||||
fl_clip(X, Y, W, H);
|
fl_clip(X, Y, W, H);
|
||||||
Fl_Widget*const* a = array();
|
Fl_Widget*const* a = array();
|
||||||
for (int i=children()-2; i--;) update_child(**a++);
|
for (int i=children()-2; i--;) update_child(**a++);
|
||||||
@ -98,7 +98,7 @@ void Fl_Scroll::draw() {
|
|||||||
if (!scrollbar.visible()) {
|
if (!scrollbar.visible()) {
|
||||||
scrollbar.set_visible();
|
scrollbar.set_visible();
|
||||||
W -= scrollbar.w();
|
W -= scrollbar.w();
|
||||||
d = 128;
|
d = FL_DAMAGE_ALL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (scrollbar.visible()) {
|
if (scrollbar.visible()) {
|
||||||
@ -107,14 +107,14 @@ void Fl_Scroll::draw() {
|
|||||||
scrollbar.align()&FL_ALIGN_LEFT ? X-scrollbar.w() : X+W,
|
scrollbar.align()&FL_ALIGN_LEFT ? X-scrollbar.w() : X+W,
|
||||||
Y, scrollbar.w(), H);
|
Y, scrollbar.w(), H);
|
||||||
W += scrollbar.w();
|
W += scrollbar.w();
|
||||||
d = 128;
|
d = FL_DAMAGE_ALL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((type()&HORIZONTAL) && (type()&ALWAYS_ON || l < X || r > X+W)) {
|
if ((type()&HORIZONTAL) && (type()&ALWAYS_ON || l < X || r > X+W)) {
|
||||||
if (!hscrollbar.visible()) {
|
if (!hscrollbar.visible()) {
|
||||||
hscrollbar.set_visible();
|
hscrollbar.set_visible();
|
||||||
H -= hscrollbar.h();
|
H -= hscrollbar.h();
|
||||||
d = 128;
|
d = FL_DAMAGE_ALL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (hscrollbar.visible()) {
|
if (hscrollbar.visible()) {
|
||||||
@ -123,7 +123,7 @@ void Fl_Scroll::draw() {
|
|||||||
scrollbar.align()&FL_ALIGN_TOP ? Y-hscrollbar.h() : Y+H,
|
scrollbar.align()&FL_ALIGN_TOP ? Y-hscrollbar.h() : Y+H,
|
||||||
W, hscrollbar.h());
|
W, hscrollbar.h());
|
||||||
H += hscrollbar.h();
|
H += hscrollbar.h();
|
||||||
d = 128;
|
d = FL_DAMAGE_ALL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ void Fl_Scroll::draw() {
|
|||||||
hscrollbar.value(oldx = xposition_ = X, W, l, r-l);
|
hscrollbar.value(oldx = xposition_ = X, W, l, r-l);
|
||||||
|
|
||||||
// draw the scrollbars:
|
// draw the scrollbars:
|
||||||
if (d & 128) {
|
if (d & FL_DAMAGE_ALL) {
|
||||||
draw_child(scrollbar);
|
draw_child(scrollbar);
|
||||||
draw_child(hscrollbar);
|
draw_child(hscrollbar);
|
||||||
if (scrollbar.visible() && hscrollbar.visible()) {
|
if (scrollbar.visible() && hscrollbar.visible()) {
|
||||||
@ -175,7 +175,7 @@ void Fl_Scroll::position(int X, int Y) {
|
|||||||
if (o == &hscrollbar || o == &scrollbar) continue;
|
if (o == &hscrollbar || o == &scrollbar) continue;
|
||||||
o->position(o->x()+dx, o->y()+dy);
|
o->position(o->x()+dx, o->y()+dy);
|
||||||
}
|
}
|
||||||
damage(2);
|
damage(FL_DAMAGE_EXPOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Scroll::hscrollbar_cb(Fl_Widget* o, void*) {
|
void Fl_Scroll::hscrollbar_cb(Fl_Widget* o, void*) {
|
||||||
|
@ -112,7 +112,7 @@ void Fl_Scrollbar::draw() {
|
|||||||
if (horizontal()) {
|
if (horizontal()) {
|
||||||
if (w() < 3*h()) {Fl_Slider::draw(); return;}
|
if (w() < 3*h()) {Fl_Slider::draw(); return;}
|
||||||
Fl_Slider::draw(x()+h(), y(), w()-2*h(), h());
|
Fl_Slider::draw(x()+h(), y(), w()-2*h(), h());
|
||||||
if (damage()&128) {
|
if (damage()&FL_DAMAGE_ALL) {
|
||||||
draw_box((pushed_&1) ? down(slider()) : slider(),
|
draw_box((pushed_&1) ? down(slider()) : slider(),
|
||||||
x(), y(), h(), h(), selection_color());
|
x(), y(), h(), h(), selection_color());
|
||||||
draw_box((pushed_&2) ? down(slider()) : slider(),
|
draw_box((pushed_&2) ? down(slider()) : slider(),
|
||||||
@ -129,7 +129,7 @@ void Fl_Scrollbar::draw() {
|
|||||||
} else { // vertical
|
} else { // vertical
|
||||||
if (h() < 3*w()) {Fl_Slider::draw(); return;}
|
if (h() < 3*w()) {Fl_Slider::draw(); return;}
|
||||||
Fl_Slider::draw(x(), y()+w(), w(), h()-2*w());
|
Fl_Slider::draw(x(), y()+w(), w(), h()-2*w());
|
||||||
if (damage()&128) {
|
if (damage()&FL_DAMAGE_ALL) {
|
||||||
draw_box((pushed_&1) ? down(slider()) : slider(),
|
draw_box((pushed_&1) ? down(slider()) : slider(),
|
||||||
x(), y(), w(), w(), selection_color());
|
x(), y(), w(), w(), selection_color());
|
||||||
draw_box((pushed_&2) ? down(slider()) : slider(),
|
draw_box((pushed_&2) ? down(slider()) : slider(),
|
||||||
|
@ -27,11 +27,17 @@ Fl_Slider::Fl_Slider(uchar t, int x, int y, int w, int h, const char* l)
|
|||||||
void Fl_Slider::slider_size(double v) {
|
void Fl_Slider::slider_size(double v) {
|
||||||
if (v < 0) v = 0;
|
if (v < 0) v = 0;
|
||||||
if (v > 1) v = 1;
|
if (v > 1) v = 1;
|
||||||
if (slider_size_ != float(v)) {slider_size_ = float(v); damage(2);}
|
if (slider_size_ != float(v)) {
|
||||||
|
slider_size_ = float(v);
|
||||||
|
damage(FL_DAMAGE_EXPOSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Slider::bounds(double a, double b) {
|
void Fl_Slider::bounds(double a, double b) {
|
||||||
if (minimum() != a || maximum() != b) {Fl_Valuator::bounds(a, b); damage(2);}
|
if (minimum() != a || maximum() != b) {
|
||||||
|
Fl_Valuator::bounds(a, b);
|
||||||
|
damage(FL_DAMAGE_EXPOSE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Fl_Slider::scrollvalue(int p, int w, int t, int l) {
|
int Fl_Slider::scrollvalue(int p, int w, int t, int l) {
|
||||||
@ -101,7 +107,7 @@ void Fl_Slider::draw(int x, int y, int w, int h) {
|
|||||||
wsl = w-2*BW;
|
wsl = w-2*BW;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damage()&128) { // complete redraw
|
if (damage()&FL_DAMAGE_ALL) { // complete redraw
|
||||||
draw_bg(x, y, w, h);
|
draw_bg(x, y, w, h);
|
||||||
} else { // partial redraw, clip off new position of slider
|
} else { // partial redraw, clip off new position of slider
|
||||||
if (X > BW) {
|
if (X > BW) {
|
||||||
|
@ -128,7 +128,7 @@ int Fl_Tabs::handle(int event) {
|
|||||||
|
|
||||||
int Fl_Tabs::push(Fl_Widget *o) {
|
int Fl_Tabs::push(Fl_Widget *o) {
|
||||||
if (push_ == o) return 0;
|
if (push_ == o) return 0;
|
||||||
if (push_ && push_ != value_ || o && o != value_) damage(2);
|
if (push_ && push_ != value_ || o && o != value_) damage(FL_DAMAGE_EXPOSE);
|
||||||
push_ = o;
|
push_ = o;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ enum {LEFT, RIGHT, SELECTED};
|
|||||||
void Fl_Tabs::draw() {
|
void Fl_Tabs::draw() {
|
||||||
Fl_Widget *v = value();
|
Fl_Widget *v = value();
|
||||||
int H = tab_height();
|
int H = tab_height();
|
||||||
if (damage() & ~3) { // redraw the entire thing:
|
if (damage() & ~(FL_DAMAGE_EXPOSE|FL_DAMAGE_CHILD)) { // redraw the entire thing:
|
||||||
fl_clip(x(), y()+(H>=0?H:0), w(), h()-(H>=0?H:-H));
|
fl_clip(x(), y()+(H>=0?H:0), w(), h()-(H>=0?H:-H));
|
||||||
draw_box(box(), x(), y(), w(), h(), v->color());
|
draw_box(box(), x(), y(), w(), h(), v->color());
|
||||||
fl_pop_clip();
|
fl_pop_clip();
|
||||||
@ -172,7 +172,7 @@ void Fl_Tabs::draw() {
|
|||||||
} else { // redraw the child
|
} else { // redraw the child
|
||||||
update_child(*v);
|
update_child(*v);
|
||||||
}
|
}
|
||||||
if (damage() & 2) {
|
if (damage() & (FL_DAMAGE_EXPOSE|FL_DAMAGE_ALL)) {
|
||||||
int p[128]; int w[128];
|
int p[128]; int w[128];
|
||||||
int selected = tab_positions(p,w);
|
int selected = tab_positions(p,w);
|
||||||
int i;
|
int i;
|
||||||
|
@ -32,7 +32,7 @@ void Fl_Valuator::precision(int p) {
|
|||||||
for (B = 1; p--;) B *= 10;
|
for (B = 1; p--;) B *= 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Valuator::value_damage() {damage(2);} // by default do partial-redraw
|
void Fl_Valuator::value_damage() {damage(FL_DAMAGE_EXPOSE);} // by default do partial-redraw
|
||||||
|
|
||||||
int Fl_Valuator::value(double v) {
|
int Fl_Valuator::value(double v) {
|
||||||
clear_changed();
|
clear_changed();
|
||||||
|
@ -21,7 +21,7 @@ void Fl_Value_Input::input_cb(Fl_Widget*, void* v) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Value_Input::draw() {
|
void Fl_Value_Input::draw() {
|
||||||
if (damage()&~1) input.clear_damage(~0);
|
if (damage()&~FL_DAMAGE_CHILD) input.clear_damage(FL_DAMAGE_ALL);
|
||||||
input.box(box());
|
input.box(box());
|
||||||
input.color(color(), selection_color());
|
input.color(color(), selection_color());
|
||||||
input.draw();
|
input.draw();
|
||||||
|
@ -15,7 +15,7 @@ void Fl_Value_Output::draw() {
|
|||||||
int Y = y()+Fl::box_dy(b);
|
int Y = y()+Fl::box_dy(b);
|
||||||
int W = w()-Fl::box_dw(b);
|
int W = w()-Fl::box_dw(b);
|
||||||
int H = h()-Fl::box_dh(b);
|
int H = h()-Fl::box_dh(b);
|
||||||
if (damage()&~1)
|
if (damage()&~FL_DAMAGE_CHILD)
|
||||||
draw_box(b, color());
|
draw_box(b, color());
|
||||||
else {
|
else {
|
||||||
fl_color(color());
|
fl_color(color());
|
||||||
|
@ -281,7 +281,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||||||
if (!i->region) i->region = CreateRectRgn(0,0,0,0);
|
if (!i->region) i->region = CreateRectRgn(0,0,0,0);
|
||||||
GetUpdateRgn(hWnd,i->region,0);
|
GetUpdateRgn(hWnd,i->region,0);
|
||||||
}
|
}
|
||||||
window->clear_damage(window->damage()|2);
|
window->clear_damage(window->damage()|FL_DAMAGE_EXPOSE);
|
||||||
i->flush();
|
i->flush();
|
||||||
window->clear_damage();
|
window->clear_damage();
|
||||||
// This convinces MSWindows we have painted whatever they wanted
|
// This convinces MSWindows we have painted whatever they wanted
|
||||||
@ -423,17 +423,14 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPar
|
|||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void Fl_Window::resize(int X,int Y,int W,int H) {
|
void Fl_Window::resize(int X,int Y,int W,int H) {
|
||||||
int is_a_resize = (W != w() || H != h());
|
int resize_from_program = 1;
|
||||||
int resize_from_program = (this != resize_bug_fix);
|
if (this == resize_bug_fix) {
|
||||||
if (!resize_from_program) resize_bug_fix = 0;
|
resize_from_program = 0;
|
||||||
if (X != x() || Y != y()) set_flag(FL_FORCE_POSITION);
|
resize_bug_fix = 0;
|
||||||
else if (!is_a_resize) return;
|
|
||||||
if (is_a_resize) {
|
|
||||||
Fl_Group::resize(X,Y,W,H);
|
|
||||||
if (shown()) {redraw(); i->wait_for_expose = 1;}
|
|
||||||
} else {
|
|
||||||
x(X); y(Y);
|
|
||||||
}
|
}
|
||||||
|
if (X==x() && Y==y() && W==w() && H==h()) return;
|
||||||
|
if (X != x() || Y != y()) set_flag(FL_FORCE_POSITION);
|
||||||
|
if (W != w() || H != h()) Fl_Group::resize(X,Y,W,H); else {x(X); y(Y);}
|
||||||
if (resize_from_program && shown()) {
|
if (resize_from_program && shown()) {
|
||||||
if (border() && !parent()) {
|
if (border() && !parent()) {
|
||||||
X -= GetSystemMetrics(SM_CXFRAME);
|
X -= GetSystemMetrics(SM_CXFRAME);
|
||||||
@ -442,6 +439,7 @@ void Fl_Window::resize(int X,int Y,int W,int H) {
|
|||||||
H += 2*GetSystemMetrics(SM_CYFRAME)+GetSystemMetrics(SM_CYCAPTION);
|
H += 2*GetSystemMetrics(SM_CYFRAME)+GetSystemMetrics(SM_CYCAPTION);
|
||||||
}
|
}
|
||||||
MoveWindow(i->xid, X, Y, W, H, TRUE);
|
MoveWindow(i->xid, X, Y, W, H, TRUE);
|
||||||
|
//if (!parent()) redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,19 +691,19 @@ void Fl_Widget::damage(uchar flags) {
|
|||||||
if (i->region) {DeleteObject(i->region);}
|
if (i->region) {DeleteObject(i->region);}
|
||||||
i->region = 0;
|
i->region = 0;
|
||||||
damage_ |= flags;
|
damage_ |= flags;
|
||||||
Fl::damage(1);
|
Fl::damage(FL_DAMAGE_CHILD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Widget::redraw() {damage(~0);}
|
void Fl_Widget::redraw() {damage(FL_DAMAGE_ALL);}
|
||||||
|
|
||||||
Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.C
|
Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.C
|
||||||
|
|
||||||
void Fl_Widget::damage(uchar flags, int X, int Y, int W, int H) {
|
void Fl_Widget::damage(uchar flags, int X, int Y, int W, int H) {
|
||||||
if (type() < FL_WINDOW) {
|
if (type() < FL_WINDOW) {
|
||||||
damage_ |= flags;
|
damage_ |= flags;
|
||||||
if (parent()) parent()->damage(1,X,Y,W,H);
|
if (parent()) parent()->damage(FL_DAMAGE_CHILD,X,Y,W,H);
|
||||||
} else {
|
} else {
|
||||||
// see if damage covers entire window:
|
// see if damage covers entire window:
|
||||||
if (X<=0 && Y<=0 && W>=w() && H>=h()) {damage(flags); return;}
|
if (X<=0 && Y<=0 && W>=w() && H>=h()) {damage(flags); return;}
|
||||||
@ -724,7 +722,7 @@ void Fl_Widget::damage(uchar flags, int X, int Y, int W, int H) {
|
|||||||
i->region = XRectangleRegion(X,Y,W,H);
|
i->region = XRectangleRegion(X,Y,W,H);
|
||||||
}
|
}
|
||||||
damage_ |= flags;
|
damage_ |= flags;
|
||||||
Fl::damage(1);
|
Fl::damage(FL_DAMAGE_CHILD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
43
src/Fl_x.cxx
43
src/Fl_x.cxx
@ -342,7 +342,7 @@ int fl_handle(const XEvent& xevent)
|
|||||||
if (Fl::first_window()->non_modal() && window != Fl::first_window())
|
if (Fl::first_window()->non_modal() && window != Fl::first_window())
|
||||||
Fl::first_window()->show();
|
Fl::first_window()->show();
|
||||||
#endif
|
#endif
|
||||||
window->damage(2, xevent.xexpose.x, xevent.xexpose.y,
|
window->damage(FL_DAMAGE_EXPOSE, xevent.xexpose.x, xevent.xexpose.y,
|
||||||
xevent.xexpose.width, xevent.xexpose.height);
|
xevent.xexpose.width, xevent.xexpose.height);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -463,23 +463,23 @@ int fl_handle(const XEvent& xevent)
|
|||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void Fl_Window::resize(int X,int Y,int W,int H) {
|
void Fl_Window::resize(int X,int Y,int W,int H) {
|
||||||
int is_a_resize = (W != w() || H != h());
|
if (resize_bug_fix == this)
|
||||||
int resize_from_program = (this != resize_bug_fix);
|
resize_bug_fix = 0;
|
||||||
if (!resize_from_program) resize_bug_fix = 0;
|
else if (shown()) {
|
||||||
if (X != x() || Y != y()) set_flag(FL_FORCE_POSITION);
|
// tell X window manager to change window size:
|
||||||
else if (!is_a_resize) return;
|
if (!(flags()&FL_FORCE_POSITION) && X == x() && Y == y())
|
||||||
if (is_a_resize) {
|
XResizeWindow(fl_display, i->xid, W>0 ? W : 1, H>0 ? H : 1);
|
||||||
Fl_Group::resize(X,Y,W,H);
|
else if (W != w() || H != h())
|
||||||
if (shown()) {redraw(); i->wait_for_expose = 1;}
|
|
||||||
} else {
|
|
||||||
x(X); y(Y);
|
|
||||||
}
|
|
||||||
if (resize_from_program && shown()) {
|
|
||||||
if (is_a_resize)
|
|
||||||
XMoveResizeWindow(fl_display, i->xid, X, Y, W>0 ? W : 1, H>0 ? H : 1);
|
XMoveResizeWindow(fl_display, i->xid, X, Y, W>0 ? W : 1, H>0 ? H : 1);
|
||||||
else
|
else
|
||||||
XMoveWindow(fl_display, i->xid, X, Y);
|
XMoveWindow(fl_display, i->xid, X, Y);
|
||||||
}
|
}
|
||||||
|
if (X != x() || Y != y()) set_flag(FL_FORCE_POSITION);
|
||||||
|
if (W != w() || H != h()) Fl_Group::resize(X,Y,W,H); else {x(X); y(Y);}
|
||||||
|
// Notice that this does *not* set any redraw bits. I assumme
|
||||||
|
// I will receive damage for the whole window from X. I think
|
||||||
|
// that "ForgetGravity" forces the expose event for the entire
|
||||||
|
// window, but this may not be true on some implementations.
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
@ -746,11 +746,6 @@ void Fl_Window::make_current() {
|
|||||||
|
|
||||||
#include <FL/fl_draw.H>
|
#include <FL/fl_draw.H>
|
||||||
|
|
||||||
// Current meaning of damage() bits on a window:
|
|
||||||
// 1 = a child needs redrawing
|
|
||||||
// 2 = expose events
|
|
||||||
// 128 = redraw everything
|
|
||||||
|
|
||||||
void Fl_Widget::damage(uchar flags) {
|
void Fl_Widget::damage(uchar flags) {
|
||||||
if (type() < FL_WINDOW) {
|
if (type() < FL_WINDOW) {
|
||||||
damage(flags, x(), y(), w(), h());
|
damage(flags, x(), y(), w(), h());
|
||||||
@ -759,19 +754,19 @@ void Fl_Widget::damage(uchar flags) {
|
|||||||
if (i) {
|
if (i) {
|
||||||
if (i->region) {XDestroyRegion(i->region); i->region = 0;}
|
if (i->region) {XDestroyRegion(i->region); i->region = 0;}
|
||||||
damage_ |= flags;
|
damage_ |= flags;
|
||||||
Fl::damage(1);
|
Fl::damage(FL_DAMAGE_CHILD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Widget::redraw() {damage(~0);}
|
void Fl_Widget::redraw() {damage(FL_DAMAGE_ALL);}
|
||||||
|
|
||||||
Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.C
|
Region XRectangleRegion(int x, int y, int w, int h); // in fl_rect.C
|
||||||
|
|
||||||
void Fl_Widget::damage(uchar flags, int X, int Y, int W, int H) {
|
void Fl_Widget::damage(uchar flags, int X, int Y, int W, int H) {
|
||||||
if (type() < FL_WINDOW) {
|
if (type() < FL_WINDOW) {
|
||||||
damage_ |= flags;
|
damage_ |= flags;
|
||||||
if (parent()) parent()->damage(1,X,Y,W,H);
|
if (parent()) parent()->damage(FL_DAMAGE_CHILD,X,Y,W,H);
|
||||||
} else {
|
} else {
|
||||||
// see if damage covers entire window:
|
// see if damage covers entire window:
|
||||||
if (X<=0 && Y<=0 && W>=w() && H>=h()) {damage(flags); return;}
|
if (X<=0 && Y<=0 && W>=w() && H>=h()) {damage(flags); return;}
|
||||||
@ -791,14 +786,14 @@ void Fl_Widget::damage(uchar flags, int X, int Y, int W, int H) {
|
|||||||
i->region = XRectangleRegion(X,Y,W,H);
|
i->region = XRectangleRegion(X,Y,W,H);
|
||||||
damage_ = flags;
|
damage_ = flags;
|
||||||
}
|
}
|
||||||
Fl::damage(1);
|
Fl::damage(FL_DAMAGE_CHILD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Fl_Window::flush() {
|
void Fl_Window::flush() {
|
||||||
make_current();
|
make_current();
|
||||||
//if (damage() == 2 && can_boxcheat(box())) fl_boxcheat = this;
|
//if (damage() == FL_DAMAGE_EXPOSE && can_boxcheat(box())) fl_boxcheat = this;
|
||||||
fl_clip_region(i->region); i->region = 0;
|
fl_clip_region(i->region); i->region = 0;
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ void ColorMenu::drawbox(Fl_Color c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ColorMenu::draw() {
|
void ColorMenu::draw() {
|
||||||
if (damage() != 1) {
|
if (damage() != FL_DAMAGE_CHILD) {
|
||||||
fl_draw_box(FL_UP_BOX,0,0,w(),h(),color());
|
fl_draw_box(FL_UP_BOX,0,0,w(),h(),color());
|
||||||
for (int c = 0; c < 256; c++) drawbox((Fl_Color)c);
|
for (int c = 0; c < 256; c++) drawbox((Fl_Color)c);
|
||||||
} else {
|
} else {
|
||||||
@ -87,7 +87,7 @@ int ColorMenu::handle(int e) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (c != which) {
|
if (c != which) {
|
||||||
which = (Fl_Color)c; damage(1);
|
which = (Fl_Color)c; damage(FL_DAMAGE_CHILD);
|
||||||
int bx = (c%8)*BOXSIZE+BORDER;
|
int bx = (c%8)*BOXSIZE+BORDER;
|
||||||
int by = (c/8)*BOXSIZE+BORDER;
|
int by = (c/8)*BOXSIZE+BORDER;
|
||||||
int px = x();
|
int px = x();
|
||||||
|
@ -989,8 +989,8 @@ void Board::drag_piece(int i, int dx, int dy) {
|
|||||||
dragging = b[i];
|
dragging = b[i];
|
||||||
}
|
}
|
||||||
if (dx != dragx || dy != dragy) {
|
if (dx != dragx || dy != dragy) {
|
||||||
damage(4, dragx, dragy, ISIZE, ISIZE);
|
damage(FL_DAMAGE_OVERLAY, dragx, dragy, ISIZE, ISIZE);
|
||||||
damage(4, dx, dy, ISIZE, ISIZE);
|
damage(FL_DAMAGE_OVERLAY, dx, dy, ISIZE, ISIZE);
|
||||||
}
|
}
|
||||||
dragx = dx;
|
dragx = dx;
|
||||||
dragy = dy;
|
dragy = dy;
|
||||||
@ -1004,8 +1004,8 @@ void Board::drop_piece(int i) {
|
|||||||
int x = squarex(i);
|
int x = squarex(i);
|
||||||
int y = squarey(i);
|
int y = squarey(i);
|
||||||
if (x != dragx || y != dragy) {
|
if (x != dragx || y != dragy) {
|
||||||
damage(4, dragx, dragy, ISIZE, ISIZE);
|
damage(FL_DAMAGE_OVERLAY, dragx, dragy, ISIZE, ISIZE);
|
||||||
damage(4, x, y, ISIZE, ISIZE);
|
damage(FL_DAMAGE_OVERLAY, x, y, ISIZE, ISIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user