SCI: Turned GfxWidget::print function pointer into virtual method
svn-id: r40113
This commit is contained in:
parent
7821339742
commit
dadae13545
7 changed files with 210 additions and 239 deletions
|
@ -98,7 +98,7 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
s->onscreen_console = 1;
|
s->onscreen_console = 1;
|
||||||
} else if ((e.buckybits & SCI_EVM_CTRL) && (e.data == '1')) {
|
} else if ((e.buckybits & SCI_EVM_CTRL) && (e.data == '1')) {
|
||||||
if (s->visual)
|
if (s->visual)
|
||||||
s->visual->print(s->visual, 0);
|
s->visual->print(0);
|
||||||
} else {
|
} else {
|
||||||
PUT_SEL32V(obj, type, SCI_EVT_KEYBOARD); // Keyboard event
|
PUT_SEL32V(obj, type, SCI_EVT_KEYBOARD); // Keyboard event
|
||||||
s->r_acc = make_reg(0, 1);
|
s->r_acc = make_reg(0, 1);
|
||||||
|
|
|
@ -805,7 +805,7 @@ reg_t kCanBeHere(EngineState *s, int funct_nr, int argc, reg_t * argv) {
|
||||||
|
|
||||||
if ((illegal_bits & 0x8000) // If we are vulnerable to those views at all...
|
if ((illegal_bits & 0x8000) // If we are vulnerable to those views at all...
|
||||||
&& s->dyn_views) { // ...check against all stop-updated dynviews
|
&& s->dyn_views) { // ...check against all stop-updated dynviews
|
||||||
GfxDynView *widget = (GfxDynView *) s->dyn_views->contents;
|
GfxDynView *widget = (GfxDynView *) s->dyn_views->_contents;
|
||||||
|
|
||||||
SCIkdebug(SCIkBRESEN, "Checking vs dynviews:\n");
|
SCIkdebug(SCIkBRESEN, "Checking vs dynviews:\n");
|
||||||
|
|
||||||
|
@ -1727,7 +1727,7 @@ static void draw_obj_to_control_map(EngineState *s, GfxDynView *view) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _k_view_list_do_postdraw(EngineState *s, GfxList *list) {
|
static void _k_view_list_do_postdraw(EngineState *s, GfxList *list) {
|
||||||
GfxDynView *widget = (GfxDynView *) list->contents;
|
GfxDynView *widget = (GfxDynView *) list->_contents;
|
||||||
|
|
||||||
while (widget) {
|
while (widget) {
|
||||||
reg_t obj = make_reg(widget->_ID, widget->_subID);
|
reg_t obj = make_reg(widget->_ID, widget->_subID);
|
||||||
|
@ -1782,7 +1782,7 @@ static void _k_view_list_do_postdraw(EngineState *s, GfxList *list) {
|
||||||
void _k_view_list_mark_free(EngineState *s, reg_t off) {
|
void _k_view_list_mark_free(EngineState *s, reg_t off) {
|
||||||
if (s->dyn_views) {
|
if (s->dyn_views) {
|
||||||
|
|
||||||
GfxDynView *w = (GfxDynView *) s->dyn_views->contents;
|
GfxDynView *w = (GfxDynView *)s->dyn_views->_contents;
|
||||||
|
|
||||||
while (w) {
|
while (w) {
|
||||||
if (w->_ID == off.segment
|
if (w->_ID == off.segment
|
||||||
|
@ -1790,7 +1790,7 @@ void _k_view_list_mark_free(EngineState *s, reg_t off) {
|
||||||
w->under_bitsp = NULL;
|
w->under_bitsp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
w = (GfxDynView *) w->_next;
|
w = (GfxDynView *)w->_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2016,7 +2016,7 @@ static void _k_make_view_list(EngineState *s, GfxList **widget_list, List *list,
|
||||||
node = LOOKUP_NODE(next_node); // Next node
|
node = LOOKUP_NODE(next_node); // Next node
|
||||||
}
|
}
|
||||||
|
|
||||||
widget = (GfxDynView *)(*widget_list)->contents;
|
widget = (GfxDynView *)(*widget_list)->_contents;
|
||||||
|
|
||||||
while (widget) { // Read back widget values
|
while (widget) { // Read back widget values
|
||||||
if (widget->signalp)
|
if (widget->signalp)
|
||||||
|
@ -2027,7 +2027,7 @@ static void _k_make_view_list(EngineState *s, GfxList **widget_list, List *list,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _k_prepare_view_list(EngineState *s, GfxList *list, int options) {
|
static void _k_prepare_view_list(EngineState *s, GfxList *list, int options) {
|
||||||
GfxDynView *view = (GfxDynView *) list->contents;
|
GfxDynView *view = (GfxDynView *) list->_contents;
|
||||||
while (view) {
|
while (view) {
|
||||||
reg_t obj = make_reg(view->_ID, view->_subID);
|
reg_t obj = make_reg(view->_ID, view->_subID);
|
||||||
int priority, _priority;
|
int priority, _priority;
|
||||||
|
@ -2112,7 +2112,7 @@ static void _k_prepare_view_list(EngineState *s, GfxList *list, int options) {
|
||||||
|
|
||||||
static void _k_update_signals_in_view_list(GfxList *old_list, GfxList *new_list) {
|
static void _k_update_signals_in_view_list(GfxList *old_list, GfxList *new_list) {
|
||||||
// O(n^2)... a bit painful, but much faster than the redraws it helps prevent
|
// O(n^2)... a bit painful, but much faster than the redraws it helps prevent
|
||||||
GfxDynView *old_widget = (GfxDynView *) old_list->contents;
|
GfxDynView *old_widget = (GfxDynView *) old_list->_contents;
|
||||||
|
|
||||||
/* Traverses all old widgets, updates them with signals from the new widgets.
|
/* Traverses all old widgets, updates them with signals from the new widgets.
|
||||||
** This is done to avoid evil hacks in widget.c; widgets with unique IDs are
|
** This is done to avoid evil hacks in widget.c; widgets with unique IDs are
|
||||||
|
@ -2121,7 +2121,7 @@ static void _k_update_signals_in_view_list(GfxList *old_list, GfxList *new_list)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while (old_widget) {
|
while (old_widget) {
|
||||||
GfxDynView *new_widget = (GfxDynView *) new_list->contents;
|
GfxDynView *new_widget = (GfxDynView *) new_list->_contents;
|
||||||
|
|
||||||
while (new_widget
|
while (new_widget
|
||||||
&& (new_widget->_ID != old_widget->_ID
|
&& (new_widget->_ID != old_widget->_ID
|
||||||
|
@ -2184,7 +2184,7 @@ static void _k_raise_topmost_in_view_list(EngineState *s, GfxList *list, GfxDynV
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _k_redraw_view_list(EngineState *s, GfxList *list) {
|
static void _k_redraw_view_list(EngineState *s, GfxList *list) {
|
||||||
GfxDynView *view = (GfxDynView *) list->contents;
|
GfxDynView *view = (GfxDynView *) list->_contents;
|
||||||
while (view) {
|
while (view) {
|
||||||
|
|
||||||
SCIkdebug(SCIkGRAPHICS, " dv["PREG"]: signal %04x\n", make_reg(view->_ID, view->_subID), view->signal);
|
SCIkdebug(SCIkGRAPHICS, " dv["PREG"]: signal %04x\n", make_reg(view->_ID, view->_subID), view->signal);
|
||||||
|
@ -2236,7 +2236,7 @@ static void _k_redraw_view_list(EngineState *s, GfxList *list) {
|
||||||
|
|
||||||
void _k_draw_view_list(EngineState *s, GfxList *list, int flags) {
|
void _k_draw_view_list(EngineState *s, GfxList *list, int flags) {
|
||||||
// Draws list_nr members of list to s->pic.
|
// Draws list_nr members of list to s->pic.
|
||||||
GfxDynView *widget = (GfxDynView *) list->contents;
|
GfxDynView *widget = (GfxDynView *) list->_contents;
|
||||||
|
|
||||||
if (GFXWC(s->port) != GFXWC(s->dyn_views->_parent))
|
if (GFXWC(s->port) != GFXWC(s->dyn_views->_parent))
|
||||||
return; // Return if the pictures are meant for a different port
|
return; // Return if the pictures are meant for a different port
|
||||||
|
@ -2991,7 +2991,7 @@ reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
|
|
||||||
assert_primary_widget_lists(s);
|
assert_primary_widget_lists(s);
|
||||||
|
|
||||||
if (!s->dyn_views->contents // Only reparentize empty dynview list
|
if (!s->dyn_views->_contents // Only reparentize empty dynview list
|
||||||
&& ((GFXWC(s->port) != GFXWC(s->dyn_views->_parent)) // If dynviews are on other port...
|
&& ((GFXWC(s->port) != GFXWC(s->dyn_views->_parent)) // If dynviews are on other port...
|
||||||
|| (s->dyn_views->_next))) // ... or not on top of the view list
|
|| (s->dyn_views->_next))) // ... or not on top of the view list
|
||||||
reparentize_primary_widget_lists(s, s->port);
|
reparentize_primary_widget_lists(s, s->port);
|
||||||
|
@ -3005,7 +3005,7 @@ reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
// Make sure that none of the doits() did something evil
|
// Make sure that none of the doits() did something evil
|
||||||
assert_primary_widget_lists(s);
|
assert_primary_widget_lists(s);
|
||||||
|
|
||||||
if (!s->dyn_views->contents // Only reparentize empty dynview list
|
if (!s->dyn_views->_contents // Only reparentize empty dynview list
|
||||||
&& ((GFXWC(s->port) != GFXWC(s->dyn_views->_parent)) // If dynviews are on other port...
|
&& ((GFXWC(s->port) != GFXWC(s->dyn_views->_parent)) // If dynviews are on other port...
|
||||||
|| (s->dyn_views->_next))) // ... or not on top of the view list
|
|| (s->dyn_views->_next))) // ... or not on top of the view list
|
||||||
reparentize_primary_widget_lists(s, s->port);
|
reparentize_primary_widget_lists(s, s->port);
|
||||||
|
@ -3027,7 +3027,7 @@ reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
_k_update_signals_in_view_list(s->dyn_views, templist);
|
_k_update_signals_in_view_list(s->dyn_views, templist);
|
||||||
s->dyn_views->tag(s->dyn_views);
|
s->dyn_views->tag(s->dyn_views);
|
||||||
|
|
||||||
_k_raise_topmost_in_view_list(s, s->dyn_views, (GfxDynView *)templist->contents);
|
_k_raise_topmost_in_view_list(s, s->dyn_views, (GfxDynView *)templist->_contents);
|
||||||
|
|
||||||
delete templist;
|
delete templist;
|
||||||
s->dyn_views->free_tagged(GFXWC(s->dyn_views)); // Free obsolete dynviews
|
s->dyn_views->free_tagged(GFXWC(s->dyn_views)); // Free obsolete dynviews
|
||||||
|
@ -3051,10 +3051,10 @@ reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
_k_view_list_do_postdraw(s, s->dyn_views);
|
_k_view_list_do_postdraw(s, s->dyn_views);
|
||||||
|
|
||||||
// _k_view_list_dispose_loop() returns -1 if it requested a re-start, so we do just that.
|
// _k_view_list_dispose_loop() returns -1 if it requested a re-start, so we do just that.
|
||||||
while ((retval = _k_view_list_dispose_loop(s, cast_list, (GfxDynView *) s->dyn_views->contents, funct_nr, argc, argv) < 0))
|
while ((retval = _k_view_list_dispose_loop(s, cast_list, (GfxDynView *) s->dyn_views->_contents, funct_nr, argc, argv) < 0))
|
||||||
reparentize = 1;
|
reparentize = 1;
|
||||||
|
|
||||||
if (s->drop_views->contents) {
|
if (s->drop_views->_contents) {
|
||||||
s->drop_views = gfxw_new_list(s->dyn_views->_bounds, GFXW_LIST_SORTED);
|
s->drop_views = gfxw_new_list(s->dyn_views->_bounds, GFXW_LIST_SORTED);
|
||||||
s->drop_views->_flags |= GFXW_FLAG_IMMUNE_TO_SNAPSHOTS;
|
s->drop_views->_flags |= GFXW_FLAG_IMMUNE_TO_SNAPSHOTS;
|
||||||
ADD_TO_CURRENT_PICTURE_PORT(s->drop_views);
|
ADD_TO_CURRENT_PICTURE_PORT(s->drop_views);
|
||||||
|
@ -3069,7 +3069,7 @@ reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
&& (s->dyn_views->_next)) // ... and not on top of the view list...
|
&& (s->dyn_views->_next)) // ... and not on top of the view list...
|
||||||
reparentize_primary_widget_lists(s, s->port); // ...then reparentize.
|
reparentize_primary_widget_lists(s, s->port); // ...then reparentize.
|
||||||
|
|
||||||
_k_view_list_kryptonize(s->dyn_views->contents);
|
_k_view_list_kryptonize(s->dyn_views->_contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
FULL_REDRAW();
|
FULL_REDRAW();
|
||||||
|
|
|
@ -215,7 +215,7 @@ reg_t kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
||||||
|
|
||||||
case '`':
|
case '`':
|
||||||
if (ev.buckybits & SCI_EVM_CTRL)
|
if (ev.buckybits & SCI_EVM_CTRL)
|
||||||
s->visual->print(s->visual, 0);
|
s->visual->print(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCI_K_ESC:
|
case SCI_K_ESC:
|
||||||
|
|
|
@ -1688,7 +1688,7 @@ static int c_gfx_print_port(EngineState *s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (port)
|
if (port)
|
||||||
port->print(port, 0);
|
port->print(0);
|
||||||
else
|
else
|
||||||
sciprintf("No such port.\n");
|
sciprintf("No such port.\n");
|
||||||
|
|
||||||
|
@ -1722,7 +1722,7 @@ static int c_gfx_print_visual(EngineState *s) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s->visual)
|
if (s->visual)
|
||||||
s->visual->print(s->visual, 0);
|
s->visual->print(0);
|
||||||
else
|
else
|
||||||
sciprintf("visual is uninitialized.\n");
|
sciprintf("visual is uninitialized.\n");
|
||||||
|
|
||||||
|
@ -1738,7 +1738,7 @@ static int c_gfx_print_dynviews(EngineState *s) {
|
||||||
if (!s->dyn_views)
|
if (!s->dyn_views)
|
||||||
sciprintf("No dynview list active.\n");
|
sciprintf("No dynview list active.\n");
|
||||||
else
|
else
|
||||||
s->dyn_views->print(s->dyn_views, 0);
|
s->dyn_views->print(0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1752,7 +1752,7 @@ static int c_gfx_print_dropviews(EngineState *s) {
|
||||||
if (!s->drop_views)
|
if (!s->drop_views)
|
||||||
sciprintf("No dropped dynview list active.\n");
|
sciprintf("No dropped dynview list active.\n");
|
||||||
else
|
else
|
||||||
s->drop_views->print(s->drop_views, 0);
|
s->drop_views->print(0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1796,7 +1796,7 @@ static int c_gfx_print_widget(EngineState *s) {
|
||||||
int widget_nr = cmd_params[i].val;
|
int widget_nr = cmd_params[i].val;
|
||||||
|
|
||||||
sciprintf("===== Widget #%d:\n", widget_nr);
|
sciprintf("===== Widget #%d:\n", widget_nr);
|
||||||
debug_widgets[widget_nr]->print(debug_widgets[widget_nr], 0);
|
debug_widgets[widget_nr]->print(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (debug_widget_pos > 1)
|
} else if (debug_widget_pos > 1)
|
||||||
|
|
|
@ -39,10 +39,10 @@ namespace Sci {
|
||||||
#define SCI_SPECIAL_CHAR_ARROW_DOWN 0x19
|
#define SCI_SPECIAL_CHAR_ARROW_DOWN 0x19
|
||||||
|
|
||||||
static void clear_titlebar(GfxPort *titlebar) {
|
static void clear_titlebar(GfxPort *titlebar) {
|
||||||
if (titlebar->contents) {
|
if (titlebar->_contents) {
|
||||||
delete titlebar->contents;
|
delete titlebar->_contents;
|
||||||
titlebar->contents = NULL;
|
titlebar->_contents = NULL;
|
||||||
titlebar->nextpp = &(titlebar->contents);
|
titlebar->_nextpp = &(titlebar->_contents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,10 +82,10 @@ struct GfxPort;
|
||||||
|
|
||||||
typedef int gfxw_point_op(GfxWidget *, Common::Point);
|
typedef int gfxw_point_op(GfxWidget *, Common::Point);
|
||||||
typedef int gfxw_op(GfxWidget *);
|
typedef int gfxw_op(GfxWidget *);
|
||||||
typedef int gfxw_op_int(GfxWidget *, int);
|
|
||||||
typedef int gfxw_bin_op(GfxWidget *, GfxWidget *);
|
typedef int gfxw_bin_op(GfxWidget *, GfxWidget *);
|
||||||
|
|
||||||
struct GfxWidget {
|
struct GfxWidget {
|
||||||
|
public:
|
||||||
int _magic; /* Extra check after typecasting */
|
int _magic; /* Extra check after typecasting */
|
||||||
int _serial; /* Serial number */
|
int _serial; /* Serial number */
|
||||||
int _flags; /* Widget flags */
|
int _flags; /* Widget flags */
|
||||||
|
@ -134,7 +134,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param indentation Number of double spaces to indent
|
* @param indentation Number of double spaces to indent
|
||||||
*/
|
*/
|
||||||
gfxw_op_int *print;
|
virtual void print(int indentation) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compares two comparable widgets by their screen position.
|
* Compares two comparable widgets by their screen position.
|
||||||
|
@ -191,6 +191,10 @@ public:
|
||||||
* It also makes sure that dirty rectangles are passed to parent containers.
|
* It also makes sure that dirty rectangles are passed to parent containers.
|
||||||
*/
|
*/
|
||||||
virtual int setVisual(GfxVisual *);
|
virtual int setVisual(GfxVisual *);
|
||||||
|
|
||||||
|
//protected:
|
||||||
|
void printIntern(int indentation) const;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -199,7 +203,9 @@ struct GfxBox : public GfxWidget {
|
||||||
gfx_color_t _color1, _color2;
|
gfx_color_t _color1, _color2;
|
||||||
gfx_box_shade_t _shadeType;
|
gfx_box_shade_t _shadeType;
|
||||||
|
|
||||||
|
public:
|
||||||
GfxBox(gfx_state_t *state, rect_t area, gfx_color_t color1, gfx_color_t color2, gfx_box_shade_t shade_type);
|
GfxBox(gfx_state_t *state, rect_t area, gfx_color_t color1, gfx_color_t color2, gfx_box_shade_t shade_type);
|
||||||
|
virtual void print(int indentation) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,6 +215,7 @@ struct GfxPrimitive : public GfxWidget {
|
||||||
gfx_line_mode_t _lineMode;
|
gfx_line_mode_t _lineMode;
|
||||||
gfx_line_style_t _lineStyle;
|
gfx_line_style_t _lineStyle;
|
||||||
|
|
||||||
|
public:
|
||||||
GfxPrimitive(rect_t area, gfx_color_t color, gfx_line_mode_t mode,
|
GfxPrimitive(rect_t area, gfx_color_t color, gfx_line_mode_t mode,
|
||||||
gfx_line_style_t style, gfxw_widget_type_t type);
|
gfx_line_style_t style, gfxw_widget_type_t type);
|
||||||
};
|
};
|
||||||
|
@ -223,8 +230,10 @@ struct GfxView : public GfxWidget {
|
||||||
int _view, _loop, _cel;
|
int _view, _loop, _cel;
|
||||||
int _palette;
|
int _palette;
|
||||||
|
|
||||||
|
public:
|
||||||
GfxView(gfx_state_t *state, Common::Point pos, int view_nr, int loop, int cel, int palette, int priority, int control,
|
GfxView(gfx_state_t *state, Common::Point pos, int view_nr, int loop, int cel, int palette, int priority, int control,
|
||||||
gfx_alignment_t halign, gfx_alignment_t valign, int flags);
|
gfx_alignment_t halign, gfx_alignment_t valign, int flags);
|
||||||
|
virtual void print(int indentation) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GFXW_IS_DYN_VIEW(widget) ((widget)->_type == GFXW_DYN_VIEW || (widget)->_type == GFXW_PIC_VIEW)
|
#define GFXW_IS_DYN_VIEW(widget) ((widget)->_type == GFXW_DYN_VIEW || (widget)->_type == GFXW_PIC_VIEW)
|
||||||
|
@ -237,8 +246,11 @@ struct GfxDynView : public GfxView {
|
||||||
int sequence; /* Sequence number: For sorting */
|
int sequence; /* Sequence number: For sorting */
|
||||||
int force_precedence; /* Precedence enforcement variable for sorting- defaults to 0 */
|
int force_precedence; /* Precedence enforcement variable for sorting- defaults to 0 */
|
||||||
|
|
||||||
|
public:
|
||||||
GfxDynView(gfx_state_t *state, Common::Point pos, int z, int view, int loop, int cel, int palette, int priority, int control,
|
GfxDynView(gfx_state_t *state, Common::Point pos, int z, int view, int loop, int cel, int palette, int priority, int control,
|
||||||
gfx_alignment_t halign, gfx_alignment_t valign, int sequence);
|
gfx_alignment_t halign, gfx_alignment_t valign, int sequence);
|
||||||
|
|
||||||
|
virtual void print(int indentation) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -254,10 +266,13 @@ struct GfxText : public GfxWidget {
|
||||||
int width, height; /* Real text width and height */
|
int width, height; /* Real text width and height */
|
||||||
gfx_text_handle_t *text_handle;
|
gfx_text_handle_t *text_handle;
|
||||||
|
|
||||||
|
public:
|
||||||
GfxText(gfx_state_t *state, rect_t area, int font, const char *text, gfx_alignment_t halign,
|
GfxText(gfx_state_t *state, rect_t area, int font, const char *text, gfx_alignment_t halign,
|
||||||
gfx_alignment_t valign, gfx_color_t color1, gfx_color_t color2, gfx_color_t bgcolor, int text_flags);
|
gfx_alignment_t valign, gfx_color_t color1, gfx_color_t color2, gfx_color_t bgcolor, int text_flags);
|
||||||
|
|
||||||
~GfxText();
|
~GfxText();
|
||||||
|
|
||||||
|
virtual void print(int indentation) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -270,9 +285,9 @@ typedef int gfxw_rect_op(GfxContainer *, rect_t, int);
|
||||||
|
|
||||||
struct GfxContainer : public GfxWidget {
|
struct GfxContainer : public GfxWidget {
|
||||||
rect_t zone; /* The writeable zone (absolute) for contained objects */
|
rect_t zone; /* The writeable zone (absolute) for contained objects */
|
||||||
gfx_dirty_rect_t *dirty; /* List of dirty rectangles */
|
gfx_dirty_rect_t *_dirty; /* List of dirty rectangles */
|
||||||
GfxWidget *contents;
|
GfxWidget *_contents;
|
||||||
GfxWidget **nextpp; /* Pointer to the 'next' pointer in the last entry in contents */
|
GfxWidget **_nextpp; /* Pointer to the 'next' pointer in the last entry in contents */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// TODO: Replace the following with virtual methods
|
// TODO: Replace the following with virtual methods
|
||||||
|
@ -282,10 +297,12 @@ public:
|
||||||
gfxw_rect_op *add_dirty_rel; /* Add a relative dirty rectangle */
|
gfxw_rect_op *add_dirty_rel; /* Add a relative dirty rectangle */
|
||||||
gfxw_container_op *add; /* Append widget to an appropriate position (for view and control lists) */
|
gfxw_container_op *add; /* Append widget to an appropriate position (for view and control lists) */
|
||||||
|
|
||||||
|
public:
|
||||||
// FIXME: This should be a virtual base class, mark it so somehow?
|
// FIXME: This should be a virtual base class, mark it so somehow?
|
||||||
GfxContainer(rect_t area, gfxw_widget_type_t type);
|
GfxContainer(rect_t area, gfxw_widget_type_t type);
|
||||||
~GfxContainer();
|
~GfxContainer();
|
||||||
|
|
||||||
|
virtual void print(int indentation) const;
|
||||||
virtual int setVisual(GfxVisual *);
|
virtual int setVisual(GfxVisual *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -297,7 +314,10 @@ public:
|
||||||
#define GFXW_IS_SORTED_LIST(widget) ((widget)->_type == GFXW_SORTED_LIST)
|
#define GFXW_IS_SORTED_LIST(widget) ((widget)->_type == GFXW_SORTED_LIST)
|
||||||
|
|
||||||
struct GfxList : public GfxContainer {
|
struct GfxList : public GfxContainer {
|
||||||
|
public:
|
||||||
GfxList(rect_t area, bool sorted);
|
GfxList(rect_t area, bool sorted);
|
||||||
|
|
||||||
|
virtual void print(int indentation) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GFXW_IS_VISUAL(widget) ((widget)->_type == GFXW_VISUAL)
|
#define GFXW_IS_VISUAL(widget) ((widget)->_type == GFXW_VISUAL)
|
||||||
|
@ -309,6 +329,7 @@ struct GfxVisual : public GfxContainer {
|
||||||
public:
|
public:
|
||||||
GfxVisual(gfx_state_t *state, int font);
|
GfxVisual(gfx_state_t *state, int font);
|
||||||
|
|
||||||
|
virtual void print(int indentation) const;
|
||||||
virtual int setVisual(GfxVisual *);
|
virtual int setVisual(GfxVisual *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -329,6 +350,7 @@ public:
|
||||||
GfxPort(GfxVisual *visual, rect_t area, gfx_color_t fgcolor, gfx_color_t bgcolor);
|
GfxPort(GfxVisual *visual, rect_t area, gfx_color_t fgcolor, gfx_color_t bgcolor);
|
||||||
~GfxPort();
|
~GfxPort();
|
||||||
|
|
||||||
|
virtual void print(int indentation) const;
|
||||||
virtual int setVisual(GfxVisual *);
|
virtual int setVisual(GfxVisual *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -88,45 +88,43 @@ static void indent(int indentation) {
|
||||||
sciprintf(" ");
|
sciprintf(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _gfxw_print_widget(GfxWidget *widget, int indentation) {
|
void GfxWidget::printIntern(int indentation) const {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char flags_list[] = "VOCDTMI";
|
char flags_list[] = "VOCDTMI";
|
||||||
|
|
||||||
indent(indentation);
|
indent(indentation);
|
||||||
|
|
||||||
if (widget->_magic == GFXW_MAGIC_VALID) {
|
if (_magic == GFXW_MAGIC_VALID) {
|
||||||
if (widget->_visual)
|
if (_visual)
|
||||||
sciprintf("v ");
|
sciprintf("v ");
|
||||||
else
|
else
|
||||||
sciprintf("NoVis ");
|
sciprintf("NoVis ");
|
||||||
} else if (widget->_magic == GFXW_MAGIC_INVALID)
|
} else if (_magic == GFXW_MAGIC_INVALID)
|
||||||
sciprintf("INVALID ");
|
sciprintf("INVALID ");
|
||||||
|
|
||||||
sciprintf("S%08x", widget->_serial);
|
sciprintf("S%08x", _serial);
|
||||||
|
|
||||||
if (widget->_ID != GFXW_NO_ID) {
|
if (_ID != GFXW_NO_ID) {
|
||||||
sciprintf("#%x", widget->_ID);
|
sciprintf("#%x", _ID);
|
||||||
|
|
||||||
if (widget->_subID != GFXW_NO_ID)
|
if (_subID != GFXW_NO_ID)
|
||||||
sciprintf(":%x ", widget->_subID);
|
sciprintf(":%x ", _subID);
|
||||||
else
|
else
|
||||||
sciprintf(" ");
|
sciprintf(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
sciprintf("[(%d,%d)(%dx%d)]", widget->_bounds.x, widget->_bounds.y, widget->_bounds.width, widget->_bounds.height);
|
sciprintf("[(%d,%d)(%dx%d)]", _bounds.x, _bounds.y, _bounds.width, _bounds.height);
|
||||||
|
|
||||||
for (i = 0; i < strlen(flags_list); i++)
|
for (i = 0; i < strlen(flags_list); i++)
|
||||||
if (widget->_flags & (1 << i))
|
if (_flags & (1 << i))
|
||||||
sciprintf("%c", flags_list[i]);
|
sciprintf("%c", flags_list[i]);
|
||||||
|
|
||||||
sciprintf(" ");
|
sciprintf(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_print_empty(GfxWidget *widget, int indentation) {
|
void GfxWidget::print(int indentation) const {
|
||||||
_gfxw_print_widget(widget, indentation);
|
printIntern(indentation);
|
||||||
sciprintf("<untyped #%d>", widget->_type);
|
sciprintf("<untyped #%d>", _type);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GfxWidget::GfxWidget(gfxw_widget_type_t type_) {
|
GfxWidget::GfxWidget(gfxw_widget_type_t type_) {
|
||||||
|
@ -147,7 +145,6 @@ GfxWidget::GfxWidget(gfxw_widget_type_t type_) {
|
||||||
|
|
||||||
draw = NULL;
|
draw = NULL;
|
||||||
tag = NULL;
|
tag = NULL;
|
||||||
print = _gfxwop_print_empty;
|
|
||||||
compare_to = NULL;
|
compare_to = NULL;
|
||||||
equals = NULL;
|
equals = NULL;
|
||||||
should_replace = NULL;
|
should_replace = NULL;
|
||||||
|
@ -201,13 +198,10 @@ static int verify_widget(GfxWidget *widget) {
|
||||||
sciprintf("L%d: NULL widget", __LINE__); \
|
sciprintf("L%d: NULL widget", __LINE__); \
|
||||||
return 1; \
|
return 1; \
|
||||||
} \
|
} \
|
||||||
if (!(widget)->print) { \
|
|
||||||
sciprintf("L%d: Widget of type %d does not have print function", __LINE__, (widget)->_type); \
|
|
||||||
} \
|
|
||||||
if ((widget)->_type != (exp_type)) { \
|
if ((widget)->_type != (exp_type)) { \
|
||||||
sciprintf("L%d: Error in widget: Expected type " # exp_type "(%d) but got %d\n", __LINE__, exp_type, (widget)->_type); \
|
sciprintf("L%d: Error in widget: Expected type " # exp_type "(%d) but got %d\n", __LINE__, exp_type, (widget)->_type); \
|
||||||
sciprintf("Erroneous widget: "); \
|
sciprintf("Erroneous widget: "); \
|
||||||
widget->print(widget, 4); \
|
widget->print(4); \
|
||||||
sciprintf("\n"); \
|
sciprintf("\n"); \
|
||||||
return 1; \
|
return 1; \
|
||||||
} \
|
} \
|
||||||
|
@ -216,7 +210,7 @@ static int verify_widget(GfxWidget *widget) {
|
||||||
if (!(widget->_type == GFXW_VISUAL || widget->_visual)) { \
|
if (!(widget->_type == GFXW_VISUAL || widget->_visual)) { \
|
||||||
sciprintf("L%d: Error while drawing widget: Widget has no visual\n", __LINE__); \
|
sciprintf("L%d: Error while drawing widget: Widget has no visual\n", __LINE__); \
|
||||||
sciprintf("Erroneous widget: "); \
|
sciprintf("Erroneous widget: "); \
|
||||||
widget->print(widget, 1); \
|
widget->print(1); \
|
||||||
sciprintf("\n"); \
|
sciprintf("\n"); \
|
||||||
return 1; \
|
return 1; \
|
||||||
}
|
}
|
||||||
|
@ -258,11 +252,10 @@ static int _gfxwop_basic_should_replace(GfxWidget *widget, GfxWidget *other) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _gfxw_set_ops(GfxWidget *widget, gfxw_point_op *draw, gfxw_op *tag, gfxw_op_int *print,
|
static void _gfxw_set_ops(GfxWidget *widget, gfxw_point_op *draw, gfxw_op *tag,
|
||||||
gfxw_bin_op *compare_to, gfxw_bin_op *equals, gfxw_bin_op *superarea_of) {
|
gfxw_bin_op *compare_to, gfxw_bin_op *equals, gfxw_bin_op *superarea_of) {
|
||||||
widget->draw = draw;
|
widget->draw = draw;
|
||||||
widget->tag = tag;
|
widget->tag = tag;
|
||||||
widget->print = print;
|
|
||||||
widget->compare_to = compare_to;
|
widget->compare_to = compare_to;
|
||||||
widget->equals = equals;
|
widget->equals = equals;
|
||||||
widget->superarea_of = superarea_of;
|
widget->superarea_of = superarea_of;
|
||||||
|
@ -278,7 +271,7 @@ void gfxw_remove_widget_from_container(GfxContainer *container, GfxWidget *widge
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
}
|
}
|
||||||
|
|
||||||
seekerp = &(container->contents);
|
seekerp = &(container->_contents);
|
||||||
|
|
||||||
if (GFXW_IS_LIST(widget) && GFXW_IS_PORT(container)) {
|
if (GFXW_IS_LIST(widget) && GFXW_IS_PORT(container)) {
|
||||||
GfxPort *port = (GfxPort *) container;
|
GfxPort *port = (GfxPort *) container;
|
||||||
|
@ -294,15 +287,15 @@ void gfxw_remove_widget_from_container(GfxContainer *container, GfxWidget *widge
|
||||||
if (!*seekerp) {
|
if (!*seekerp) {
|
||||||
GFXERROR("Internal error: Attempt to remove widget from container it was not contained in!\n");
|
GFXERROR("Internal error: Attempt to remove widget from container it was not contained in!\n");
|
||||||
sciprintf("Widget:");
|
sciprintf("Widget:");
|
||||||
widget->print(widget, 1);
|
widget->print(1);
|
||||||
sciprintf("Container:");
|
sciprintf("Container:");
|
||||||
widget->print(container, 1);
|
widget->print(1);
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (container->nextpp == &(widget->_next))
|
if (container->_nextpp == &(widget->_next))
|
||||||
container->nextpp = seekerp;
|
container->_nextpp = seekerp;
|
||||||
|
|
||||||
*seekerp = widget->_next; // Remove it
|
*seekerp = widget->_next; // Remove it
|
||||||
widget->_parent = NULL;
|
widget->_parent = NULL;
|
||||||
|
@ -368,10 +361,9 @@ static int _gfxwop_box_draw(GfxWidget *widget, Common::Point pos) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_box_print(GfxWidget *widget, int indentation) {
|
void GfxBox::print(int indentation) const {
|
||||||
_gfxw_print_widget(widget, indentation);
|
printIntern(indentation);
|
||||||
sciprintf("BOX");
|
sciprintf("BOX");
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_box_superarea_of(GfxWidget *widget, GfxWidget *other) {
|
static int _gfxwop_box_superarea_of(GfxWidget *widget, GfxWidget *other) {
|
||||||
|
@ -417,7 +409,7 @@ static int _gfxwop_box_equals(GfxWidget *widget, GfxWidget *other) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _gfxw_set_ops_BOX(GfxWidget *widget) {
|
void _gfxw_set_ops_BOX(GfxWidget *widget) {
|
||||||
_gfxw_set_ops(widget, _gfxwop_box_draw, _gfxwop_basic_tag, _gfxwop_box_print,
|
_gfxw_set_ops(widget, _gfxwop_box_draw, _gfxwop_basic_tag,
|
||||||
_gfxwop_basic_compare_to, _gfxwop_box_equals, _gfxwop_box_superarea_of);
|
_gfxwop_basic_compare_to, _gfxwop_box_equals, _gfxwop_box_superarea_of);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,8 +453,9 @@ GfxPrimitive::GfxPrimitive(rect_t area, gfx_color_t color_, gfx_line_mode_t mode
|
||||||
|
|
||||||
//*** Rectangles ***
|
//*** Rectangles ***
|
||||||
|
|
||||||
struct gfxw_rect_t : public GfxPrimitive {
|
struct GfxRect : public GfxPrimitive {
|
||||||
gfxw_rect_t(rect_t rect, gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style);
|
GfxRect(rect_t rect, gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style);
|
||||||
|
virtual void print(int indentation) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int _gfxwop_primitive_equals(GfxWidget *widget, GfxWidget *other) {
|
static int _gfxwop_primitive_equals(GfxWidget *widget, GfxWidget *other) {
|
||||||
|
@ -499,23 +492,21 @@ static int _gfxwop_rect_draw(GfxWidget *widget, Common::Point pos) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_rect_print(GfxWidget *rect, int indentation) {
|
void GfxRect::print(int indentation) const {
|
||||||
_gfxw_print_widget(rect, indentation);
|
printIntern(indentation);
|
||||||
sciprintf("RECT");
|
sciprintf("RECT");
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _gfxw_set_ops_RECT(GfxWidget *prim) {
|
void _gfxw_set_ops_RECT(GfxWidget *prim) {
|
||||||
_gfxw_set_ops(prim, _gfxwop_rect_draw, _gfxwop_basic_tag, _gfxwop_rect_print,
|
_gfxw_set_ops(prim, _gfxwop_rect_draw, _gfxwop_basic_tag,
|
||||||
_gfxwop_basic_compare_to, _gfxwop_primitive_equals, _gfxwop_basic_superarea_of);
|
_gfxwop_basic_compare_to, _gfxwop_primitive_equals, _gfxwop_basic_superarea_of);
|
||||||
}
|
}
|
||||||
|
|
||||||
GfxPrimitive *gfxw_new_rect(rect_t rect, gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) {
|
GfxPrimitive *gfxw_new_rect(rect_t rect, gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) {
|
||||||
return new gfxw_rect_t(rect, color, line_mode, line_style);
|
return new GfxRect(rect, color, line_mode, line_style);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxw_rect_t::gfxw_rect_t(rect_t rect, gfx_color_t color_, gfx_line_mode_t line_mode_, gfx_line_style_t line_style_)
|
GfxRect::GfxRect(rect_t rect, gfx_color_t color_, gfx_line_mode_t line_mode_, gfx_line_style_t line_style_)
|
||||||
: GfxPrimitive(rect, color_, line_mode_, line_style_, GFXW_RECT) {
|
: GfxPrimitive(rect, color_, line_mode_, line_style_, GFXW_RECT) {
|
||||||
|
|
||||||
_bounds.width++;
|
_bounds.width++;
|
||||||
|
@ -526,8 +517,9 @@ gfxw_rect_t::gfxw_rect_t(rect_t rect, gfx_color_t color_, gfx_line_mode_t line_m
|
||||||
|
|
||||||
//*** Lines ***
|
//*** Lines ***
|
||||||
|
|
||||||
struct gfxw_line_t : public GfxPrimitive {
|
struct GfxLine : public GfxPrimitive {
|
||||||
gfxw_line_t(Common::Point start, Common::Point end, gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style);
|
GfxLine(Common::Point start, Common::Point end, gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style);
|
||||||
|
virtual void print(int indentation) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int _gfxwop_line_draw(GfxWidget *widget, Common::Point pos) {
|
static int _gfxwop_line_draw(GfxWidget *widget, Common::Point pos) {
|
||||||
|
@ -545,22 +537,21 @@ static int _gfxwop_line_draw(GfxWidget *widget, Common::Point pos) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_line_print(GfxWidget *widget, int indentation) {
|
void GfxLine::print(int indentation) const {
|
||||||
_gfxw_print_widget(widget, indentation);
|
printIntern(indentation);
|
||||||
|
// sciprintf("LINE");
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _gfxw_set_ops_LINE(GfxWidget *prim) {
|
void _gfxw_set_ops_LINE(GfxWidget *prim) {
|
||||||
_gfxw_set_ops(prim, _gfxwop_line_draw, _gfxwop_basic_tag, _gfxwop_line_print,
|
_gfxw_set_ops(prim, _gfxwop_line_draw, _gfxwop_basic_tag,
|
||||||
_gfxwop_basic_compare_to, _gfxwop_primitive_equals, _gfxwop_basic_superarea_of);
|
_gfxwop_basic_compare_to, _gfxwop_primitive_equals, _gfxwop_basic_superarea_of);
|
||||||
}
|
}
|
||||||
|
|
||||||
GfxPrimitive *gfxw_new_line(Common::Point start, Common::Point end, gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) {
|
GfxPrimitive *gfxw_new_line(Common::Point start, Common::Point end, gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) {
|
||||||
return new gfxw_line_t(start, end, color, line_mode, line_style);
|
return new GfxLine(start, end, color, line_mode, line_style);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxw_line_t::gfxw_line_t(Common::Point start, Common::Point end, gfx_color_t color_, gfx_line_mode_t line_mode_, gfx_line_style_t line_style_)
|
GfxLine::GfxLine(Common::Point start, Common::Point end, gfx_color_t color_, gfx_line_mode_t line_mode_, gfx_line_style_t line_style_)
|
||||||
: GfxPrimitive(gfx_rect(start.x, start.y, end.x - start.x + 1, end.y - start.y + 1), color_, line_mode_, line_style_, GFXW_LINE) {
|
: GfxPrimitive(gfx_rect(start.x, start.y, end.x - start.x + 1, end.y - start.y + 1), color_, line_mode_, line_style_, GFXW_LINE) {
|
||||||
_gfxw_set_ops_LINE(this);
|
_gfxw_set_ops_LINE(this);
|
||||||
}
|
}
|
||||||
|
@ -629,29 +620,24 @@ static int _gfxwop_static_view_draw(GfxWidget *widget, Common::Point pos) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _w_gfxwop_view_print(GfxWidget *widget, const char *name, int indentation) {
|
void GfxView::print(int indentation) const {
|
||||||
GfxView *view = (GfxView *)widget;
|
printIntern(indentation);
|
||||||
_gfxw_print_widget(widget, indentation);
|
|
||||||
|
|
||||||
sciprintf("%s", name);
|
if (_type == GFXW_STATIC_VIEW)
|
||||||
sciprintf("(%d/%d/%d)@(%d,%d)[p:%d,c:%d]", view->_view, view->_loop, view->_cel, view->_pos.x, view->_pos.y,
|
sciprintf("STATICVIEW");
|
||||||
(view->_color.mask & GFX_MASK_PRIORITY) ? view->_color.priority : -1,
|
else if (_type == GFXW_VIEW)
|
||||||
(view->_color.mask & GFX_MASK_CONTROL) ? view->_color.control : -1);
|
sciprintf("VIEW");
|
||||||
|
else
|
||||||
|
error("GfxView::print: Invalid type %d", _type);
|
||||||
|
|
||||||
return 0;
|
sciprintf("(%d/%d/%d)@(%d,%d)[p:%d,c:%d]", _view, _loop, _cel, _pos.x, _pos.y,
|
||||||
}
|
(_color.mask & GFX_MASK_PRIORITY) ? _color.priority : -1,
|
||||||
|
(_color.mask & GFX_MASK_CONTROL) ? _color.control : -1);
|
||||||
static int _gfxwop_view_print(GfxWidget *widget, int indentation) {
|
|
||||||
return _w_gfxwop_view_print(widget, "VIEW", indentation);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _gfxwop_static_view_print(GfxWidget *widget, int indentation) {
|
|
||||||
return _w_gfxwop_view_print(widget, "PICVIEW", indentation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _gfxw_set_ops_VIEW(GfxWidget *view, char stat) {
|
void _gfxw_set_ops_VIEW(GfxWidget *view, char stat) {
|
||||||
_gfxw_set_ops(view, (stat) ? _gfxwop_static_view_draw : _gfxwop_view_draw,
|
_gfxw_set_ops(view, (stat) ? _gfxwop_static_view_draw : _gfxwop_view_draw,
|
||||||
_gfxwop_basic_tag, (stat) ? _gfxwop_static_view_print : _gfxwop_view_print,
|
_gfxwop_basic_tag,
|
||||||
_gfxwop_basic_compare_to, _gfxwop_basic_equals, _gfxwop_basic_superarea_of);
|
_gfxwop_basic_compare_to, _gfxwop_basic_equals, _gfxwop_basic_superarea_of);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -719,26 +705,20 @@ static int _gfxwop_pic_view_draw(GfxWidget *widget, Common::Point pos) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_some_view_print(GfxWidget *widget, int indentation, const char *type_string) {
|
void GfxDynView::print(int indentation) const {
|
||||||
GfxDynView *view = (GfxDynView *)widget;
|
printIntern(indentation);
|
||||||
|
|
||||||
_gfxw_print_widget(widget, indentation);
|
if (_type == GFXW_DYN_VIEW)
|
||||||
|
sciprintf("DYNVIEW");
|
||||||
|
else if (_type == GFXW_PIC_VIEW)
|
||||||
|
sciprintf("PICVIEW");
|
||||||
|
else
|
||||||
|
error("GfxDynView::print: Invalid type %d", _type);
|
||||||
|
|
||||||
sciprintf("%s", type_string);
|
sciprintf(" SORT=%d z=%d seq=%d (%d/%d/%d)@(%d,%d)[p:%d,c:%d]; sig[%04x@%p]", force_precedence, _z,
|
||||||
sciprintf(" SORT=%d z=%d seq=%d (%d/%d/%d)@(%d,%d)[p:%d,c:%d]; sig[%04x@%p]", view->force_precedence, view->_z,
|
sequence, _view, _loop, _cel, _pos.x, _pos.y,
|
||||||
view->sequence, view->_view, view->_loop, view->_cel, view->_pos.x, view->_pos.y,
|
(_color.mask & GFX_MASK_PRIORITY) ? _color.priority : -1,
|
||||||
(view->_color.mask & GFX_MASK_PRIORITY) ? view->_color.priority : -1,
|
(_color.mask & GFX_MASK_CONTROL) ? _color.control : -1, signal, signalp);
|
||||||
(view->_color.mask & GFX_MASK_CONTROL) ? view->_color.control : -1, view->signal, view->signalp);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _gfxwop_dyn_view_print(GfxWidget *widget, int indentation) {
|
|
||||||
return _gfxwop_some_view_print(widget, indentation, "DYNVIEW");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _gfxwop_pic_view_print(GfxWidget *widget, int indentation) {
|
|
||||||
return _gfxwop_some_view_print(widget, indentation, "PICVIEW");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_dyn_view_equals(GfxWidget *widget, GfxWidget *other) {
|
static int _gfxwop_dyn_view_equals(GfxWidget *widget, GfxWidget *other) {
|
||||||
|
@ -788,13 +768,12 @@ static int _gfxwop_dyn_view_compare_to(GfxWidget *widget, GfxWidget *other) {
|
||||||
|
|
||||||
void _gfxw_set_ops_DYNVIEW(GfxWidget *widget) {
|
void _gfxw_set_ops_DYNVIEW(GfxWidget *widget) {
|
||||||
_gfxw_set_ops(widget, _gfxwop_dyn_view_draw, _gfxwop_basic_tag,
|
_gfxw_set_ops(widget, _gfxwop_dyn_view_draw, _gfxwop_basic_tag,
|
||||||
_gfxwop_dyn_view_print, _gfxwop_dyn_view_compare_to, _gfxwop_dyn_view_equals, _gfxwop_basic_superarea_of);
|
_gfxwop_dyn_view_compare_to, _gfxwop_dyn_view_equals, _gfxwop_basic_superarea_of);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _gfxw_set_ops_PICVIEW(GfxWidget *widget) {
|
void _gfxw_set_ops_PICVIEW(GfxWidget *widget) {
|
||||||
_gfxw_set_ops_DYNVIEW(widget);
|
_gfxw_set_ops_DYNVIEW(widget);
|
||||||
widget->draw = _gfxwop_pic_view_draw;
|
widget->draw = _gfxwop_pic_view_draw;
|
||||||
widget->print = _gfxwop_pic_view_print;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GfxDynView *gfxw_new_dyn_view(gfx_state_t *state, Common::Point pos, int z, int view, int loop, int cel, int palette, int priority, int control,
|
GfxDynView *gfxw_new_dyn_view(gfx_state_t *state, Common::Point pos, int z, int view, int loop, int cel, int palette, int priority, int control,
|
||||||
|
@ -903,11 +882,9 @@ static int _gfxwop_text_alloc_and_draw(GfxWidget *widget, Common::Point pos) {
|
||||||
return _gfxwop_text_draw(widget, pos);
|
return _gfxwop_text_draw(widget, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_text_print(GfxWidget *widget, int indentation) {
|
void GfxText::print(int indentation) const {
|
||||||
_gfxw_print_widget(widget, indentation);
|
printIntern(indentation);
|
||||||
sciprintf("TEXT:'%s'", ((GfxText *)widget)->text);
|
sciprintf("TEXT:'%s'", text);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_text_equals(GfxWidget *widget, GfxWidget *other) {
|
static int _gfxwop_text_equals(GfxWidget *widget, GfxWidget *other) {
|
||||||
|
@ -953,7 +930,7 @@ static int _gfxwop_text_compare_to(GfxWidget *widget, GfxWidget *other) {
|
||||||
|
|
||||||
void _gfxw_set_ops_TEXT(GfxWidget *widget) {
|
void _gfxw_set_ops_TEXT(GfxWidget *widget) {
|
||||||
_gfxw_set_ops(widget, _gfxwop_text_alloc_and_draw, _gfxwop_basic_tag,
|
_gfxw_set_ops(widget, _gfxwop_text_alloc_and_draw, _gfxwop_basic_tag,
|
||||||
_gfxwop_text_print, _gfxwop_text_compare_to, _gfxwop_text_equals,
|
_gfxwop_text_compare_to, _gfxwop_text_equals,
|
||||||
_gfxwop_basic_superarea_of);
|
_gfxwop_basic_superarea_of);
|
||||||
widget->should_replace = _gfxwop_text_should_replace;
|
widget->should_replace = _gfxwop_text_should_replace;
|
||||||
}
|
}
|
||||||
|
@ -1017,11 +994,11 @@ static int _gfxwop_container_add_dirty_rel(GfxContainer *cont, rect_t rect, int
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _gfxw_set_container_ops(GfxContainer *container, gfxw_point_op *draw, gfxw_op *tag,
|
static void _gfxw_set_container_ops(GfxContainer *container, gfxw_point_op *draw, gfxw_op *tag,
|
||||||
gfxw_op_int *print, gfxw_bin_op *compare_to, gfxw_bin_op *equals,
|
gfxw_bin_op *compare_to, gfxw_bin_op *equals,
|
||||||
gfxw_bin_op *superarea_of,
|
gfxw_bin_op *superarea_of,
|
||||||
gfxw_unary_container_op *free_tagged, gfxw_unary_container_op *free_contents,
|
gfxw_unary_container_op *free_tagged, gfxw_unary_container_op *free_contents,
|
||||||
gfxw_rect_op *add_dirty, gfxw_container_op *add) {
|
gfxw_rect_op *add_dirty, gfxw_container_op *add) {
|
||||||
_gfxw_set_ops(container, draw, tag, print, compare_to, equals, superarea_of);
|
_gfxw_set_ops(container, draw, tag, compare_to, equals, superarea_of);
|
||||||
|
|
||||||
container->free_tagged = free_tagged;
|
container->free_tagged = free_tagged;
|
||||||
container->free_contents = free_contents;
|
container->free_contents = free_contents;
|
||||||
|
@ -1038,7 +1015,7 @@ static int _w_gfxwop_container_print_contents(const char *name, GfxWidget *widge
|
||||||
sciprintf("--%s:\n", name);
|
sciprintf("--%s:\n", name);
|
||||||
|
|
||||||
while (seeker) {
|
while (seeker) {
|
||||||
seeker->print(seeker, indentation + 1);
|
seeker->print(indentation + 1);
|
||||||
sciprintf("\n");
|
sciprintf("\n");
|
||||||
seeker = seeker->_next;
|
seeker = seeker->_next;
|
||||||
}
|
}
|
||||||
|
@ -1046,39 +1023,31 @@ static int _w_gfxwop_container_print_contents(const char *name, GfxWidget *widge
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _w_gfxwop_container_print(GfxWidget *widget, int indentation) {
|
void GfxContainer::print(int indentation) const {
|
||||||
gfx_dirty_rect_t *dirty;
|
gfx_dirty_rect_t *dirty;
|
||||||
GfxContainer *container = (GfxContainer *)widget;
|
|
||||||
if (!GFXW_IS_CONTAINER(widget)) {
|
|
||||||
GFXERROR("_w_gfxwop_container_print() called on type %d widget\n", widget->_type);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
sciprintf(" viszone=((%d,%d),(%dx%d))\n", container->zone.x, container->zone.y,
|
sciprintf(" viszone=((%d,%d),(%dx%d))\n", zone.x, zone.y, zone.width, zone.height);
|
||||||
container->zone.width, container->zone.height);
|
|
||||||
|
|
||||||
indent(indentation);
|
indent(indentation);
|
||||||
sciprintf("--dirty:\n");
|
sciprintf("--dirty:\n");
|
||||||
|
|
||||||
dirty = container->dirty;
|
dirty = _dirty;
|
||||||
while (dirty) {
|
while (dirty) {
|
||||||
indent(indentation + 1);
|
indent(indentation + 1);
|
||||||
sciprintf("dirty(%d,%d, (%dx%d))\n", dirty->rect.x, dirty->rect.y, dirty->rect.width, dirty->rect.height);
|
sciprintf("dirty(%d,%d, (%dx%d))\n", dirty->rect.x, dirty->rect.y, dirty->rect.width, dirty->rect.height);
|
||||||
dirty = dirty->next;
|
dirty = dirty->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
_w_gfxwop_container_print_contents("contents", container->contents, indentation);
|
_w_gfxwop_container_print_contents("contents", _contents, indentation);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GfxContainer::GfxContainer(rect_t area, gfxw_widget_type_t type_)
|
GfxContainer::GfxContainer(rect_t area, gfxw_widget_type_t type_)
|
||||||
: GfxWidget(type_) {
|
: GfxWidget(type_) {
|
||||||
_bounds = zone = area;
|
_bounds = zone = area;
|
||||||
contents = NULL;
|
_contents = NULL;
|
||||||
nextpp = &contents;
|
_nextpp = &_contents;
|
||||||
dirty = NULL;
|
_dirty = NULL;
|
||||||
|
|
||||||
free_tagged = NULL;
|
free_tagged = NULL;
|
||||||
free_contents = NULL;
|
free_contents = NULL;
|
||||||
|
@ -1105,7 +1074,7 @@ static int _gfxw_dirty_rect_overlaps_normal_rect(rect_t port_zone, rect_t bounds
|
||||||
|
|
||||||
static int _gfxwop_container_draw_contents(GfxWidget *widget, GfxWidget *contents) {
|
static int _gfxwop_container_draw_contents(GfxWidget *widget, GfxWidget *contents) {
|
||||||
GfxContainer *container = (GfxContainer *)widget;
|
GfxContainer *container = (GfxContainer *)widget;
|
||||||
gfx_dirty_rect_t *dirty = container->dirty;
|
gfx_dirty_rect_t *dirty = container->_dirty;
|
||||||
gfx_state_t *gfx_state = (widget->_visual) ? widget->_visual->_gfxState : ((GfxVisual *) widget)->_gfxState;
|
gfx_state_t *gfx_state = (widget->_visual) ? widget->_visual->_gfxState : ((GfxVisual *) widget)->_gfxState;
|
||||||
int draw_ports;
|
int draw_ports;
|
||||||
rect_t nullzone = {0, 0, 0, 0};
|
rect_t nullzone = {0, 0, 0, 0};
|
||||||
|
@ -1137,7 +1106,7 @@ static int _gfxwop_container_draw_contents(GfxWidget *widget, GfxWidget *content
|
||||||
|
|
||||||
// The draw loop is executed twice: Once for normal data, and once for ports.
|
// The draw loop is executed twice: Once for normal data, and once for ports.
|
||||||
for (draw_ports = 0; draw_ports < 2; draw_ports++) {
|
for (draw_ports = 0; draw_ports < 2; draw_ports++) {
|
||||||
dirty = container->dirty;
|
dirty = container->_dirty;
|
||||||
|
|
||||||
while (dirty) {
|
while (dirty) {
|
||||||
GfxWidget *seeker = contents;
|
GfxWidget *seeker = contents;
|
||||||
|
@ -1174,7 +1143,7 @@ static int _gfxwop_container_draw_contents(GfxWidget *widget, GfxWidget *content
|
||||||
}
|
}
|
||||||
|
|
||||||
GfxContainer::~GfxContainer() {
|
GfxContainer::~GfxContainer() {
|
||||||
GfxWidget *seeker = contents;
|
GfxWidget *seeker = _contents;
|
||||||
|
|
||||||
while (seeker) {
|
while (seeker) {
|
||||||
GfxWidget *next = seeker->_next;
|
GfxWidget *next = seeker->_next;
|
||||||
|
@ -1182,13 +1151,13 @@ GfxContainer::~GfxContainer() {
|
||||||
seeker = next;
|
seeker = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
recursively_free_dirty_rects(dirty);
|
recursively_free_dirty_rects(_dirty);
|
||||||
dirty = NULL;
|
_dirty = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_container_tag(GfxWidget *widget) {
|
static int _gfxwop_container_tag(GfxWidget *widget) {
|
||||||
GfxContainer *container = (GfxContainer *) widget;
|
GfxContainer *container = (GfxContainer *) widget;
|
||||||
GfxWidget *seeker = container->contents;
|
GfxWidget *seeker = container->_contents;
|
||||||
|
|
||||||
while (seeker) {
|
while (seeker) {
|
||||||
seeker->tag(seeker);
|
seeker->tag(seeker);
|
||||||
|
@ -1198,28 +1167,25 @@ static int _gfxwop_container_tag(GfxWidget *widget) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _w_gfxwop_container_set_visual_contents(GfxWidget *contents, GfxVisual *visual) {
|
|
||||||
while (contents) {
|
|
||||||
contents->setVisual(visual);
|
|
||||||
contents = contents->_next;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int GfxContainer::setVisual(GfxVisual *visual) {
|
int GfxContainer::setVisual(GfxVisual *visual) {
|
||||||
_visual = visual;
|
_visual = visual;
|
||||||
if (_parent) {
|
if (_parent) {
|
||||||
if (!(GFXW_IS_LIST(this) && !GFXWC(this)->contents)) {
|
if (!(GFXW_IS_LIST(this) && !_contents)) {
|
||||||
DDIRTY(stderr, "set_visual::DOWNWARDS abs(%d,%d,%d,%d, 1)\n", GFX_PRINT_RECT(_bounds));
|
DDIRTY(stderr, "set_visual::DOWNWARDS abs(%d,%d,%d,%d, 1)\n", GFX_PRINT_RECT(_bounds));
|
||||||
_parent->add_dirty_abs(_parent, _bounds, 1);
|
_parent->add_dirty_abs(_parent, _bounds, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _w_gfxwop_container_set_visual_contents(contents, visual);
|
GfxWidget *seeker = _contents;
|
||||||
|
while (seeker) {
|
||||||
|
seeker->setVisual(visual);
|
||||||
|
seeker = seeker->_next;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_container_free_tagged(GfxContainer *container) {
|
static int _gfxwop_container_free_tagged(GfxContainer *container) {
|
||||||
GfxWidget *seekerp = container->contents;
|
GfxWidget *seekerp = container->_contents;
|
||||||
|
|
||||||
while (seekerp) {
|
while (seekerp) {
|
||||||
GfxWidget *redshirt = seekerp;
|
GfxWidget *redshirt = seekerp;
|
||||||
|
@ -1235,7 +1201,7 @@ static int _gfxwop_container_free_tagged(GfxContainer *container) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_container_free_contents(GfxContainer *container) {
|
static int _gfxwop_container_free_contents(GfxContainer *container) {
|
||||||
GfxWidget *seeker = container->contents;
|
GfxWidget *seeker = container->_contents;
|
||||||
|
|
||||||
while (seeker) {
|
while (seeker) {
|
||||||
GfxWidget *next = seeker->_next;
|
GfxWidget *next = seeker->_next;
|
||||||
|
@ -1247,22 +1213,22 @@ static int _gfxwop_container_free_contents(GfxContainer *container) {
|
||||||
|
|
||||||
static void _gfxw_dirtify_container(GfxContainer *container, GfxWidget *widget) {
|
static void _gfxw_dirtify_container(GfxContainer *container, GfxWidget *widget) {
|
||||||
if (GFXW_IS_CONTAINER(widget))
|
if (GFXW_IS_CONTAINER(widget))
|
||||||
container->add_dirty_abs(GFXWC(container), widget->_bounds, 1);
|
container->add_dirty_abs(container, widget->_bounds, 1);
|
||||||
else
|
else
|
||||||
container->add_dirty_rel(GFXWC(container), widget->_bounds, 1);
|
container->add_dirty_rel(container, widget->_bounds, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _parentize_widget(GfxContainer *container, GfxWidget *widget) {
|
static int _parentize_widget(GfxContainer *container, GfxWidget *widget) {
|
||||||
if (widget->_parent) {
|
if (widget->_parent) {
|
||||||
GFXERROR("_gfxwop_container_add(): Attempt to give second parent node to widget!\nWidget:");
|
GFXERROR("_gfxwop_container_add(): Attempt to give second parent node to widget!\nWidget:");
|
||||||
widget->print(widget, 3);
|
widget->print(3);
|
||||||
sciprintf("\nContainer:");
|
sciprintf("\nContainer:");
|
||||||
container->print(container, 3);
|
container->print(3);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
widget->_parent = GFXWC(container);
|
widget->_parent = container;
|
||||||
|
|
||||||
if (GFXW_IS_VISUAL(container))
|
if (GFXW_IS_VISUAL(container))
|
||||||
widget->setVisual((GfxVisual *)container);
|
widget->setVisual((GfxVisual *)container);
|
||||||
|
@ -1273,7 +1239,7 @@ static int _parentize_widget(GfxContainer *container, GfxWidget *widget) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxw_container_id_equals(GfxContainer *container, GfxWidget *widget) {
|
static int _gfxw_container_id_equals(GfxContainer *container, GfxWidget *widget) {
|
||||||
GfxWidget **seekerp = &(container->contents);
|
GfxWidget **seekerp = &(container->_contents);
|
||||||
|
|
||||||
if (GFXW_IS_PORT(widget))
|
if (GFXW_IS_PORT(widget))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1307,7 +1273,7 @@ static int _gfxwop_container_add_dirty(GfxContainer *container, rect_t dirty, in
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DDIRTY(stderr, "Effectively adding dirty %d,%d,%d,%d %d to ID %d\n", GFX_PRINT_RECT(dirty), propagate, container->_ID);
|
DDIRTY(stderr, "Effectively adding dirty %d,%d,%d,%d %d to ID %d\n", GFX_PRINT_RECT(dirty), propagate, container->_ID);
|
||||||
container->dirty = gfxdr_add_dirty(container->dirty, dirty, GFXW_DIRTY_STRATEGY);
|
container->_dirty = gfxdr_add_dirty(container->_dirty, dirty, GFXW_DIRTY_STRATEGY);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1318,13 +1284,13 @@ static int _gfxwop_container_add(GfxContainer *container, GfxWidget *widget) {
|
||||||
if (_parentize_widget(container, widget))
|
if (_parentize_widget(container, widget))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (!(GFXW_IS_LIST(widget) && (!GFXWC(widget)->contents))) { // Don't dirtify self on empty lists
|
if (!(GFXW_IS_LIST(widget) && (!GFXWC(widget)->_contents))) { // Don't dirtify self on empty lists
|
||||||
DDIRTY(stderr, "container_add: dirtify DOWNWARDS (%d,%d,%d,%d, 1)\n", GFX_PRINT_RECT(widget->_bounds));
|
DDIRTY(stderr, "container_add: dirtify DOWNWARDS (%d,%d,%d,%d, 1)\n", GFX_PRINT_RECT(widget->_bounds));
|
||||||
_gfxw_dirtify_container(container, widget);
|
_gfxw_dirtify_container(container, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
*(container->nextpp) = widget;
|
*(container->_nextpp) = widget;
|
||||||
container->nextpp = &(widget->_next);
|
container->_nextpp = &(widget->_next);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1334,9 +1300,9 @@ static int _gfxwop_container_add(GfxContainer *container, GfxWidget *widget) {
|
||||||
static int _gfxwop_list_draw(GfxWidget *list, Common::Point pos) {
|
static int _gfxwop_list_draw(GfxWidget *list, Common::Point pos) {
|
||||||
DRAW_ASSERT(list, GFXW_LIST);
|
DRAW_ASSERT(list, GFXW_LIST);
|
||||||
|
|
||||||
_gfxwop_container_draw_contents(list, ((GfxList *)list)->contents);
|
_gfxwop_container_draw_contents(list, ((GfxList *)list)->_contents);
|
||||||
recursively_free_dirty_rects(GFXWC(list)->dirty);
|
recursively_free_dirty_rects(GFXWC(list)->_dirty);
|
||||||
GFXWC(list)->dirty = NULL;
|
GFXWC(list)->_dirty = NULL;
|
||||||
list->_flags &= ~GFXW_FLAG_DIRTY;
|
list->_flags &= ~GFXW_FLAG_DIRTY;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1345,26 +1311,24 @@ static int _gfxwop_list_draw(GfxWidget *list, Common::Point pos) {
|
||||||
static int _gfxwop_sorted_list_draw(GfxWidget *list, Common::Point pos) {
|
static int _gfxwop_sorted_list_draw(GfxWidget *list, Common::Point pos) {
|
||||||
DRAW_ASSERT(list, GFXW_SORTED_LIST);
|
DRAW_ASSERT(list, GFXW_SORTED_LIST);
|
||||||
|
|
||||||
_gfxwop_container_draw_contents(list, ((GfxList *)list)->contents);
|
_gfxwop_container_draw_contents(list, ((GfxList *)list)->_contents);
|
||||||
recursively_free_dirty_rects(GFXWC(list)->dirty);
|
recursively_free_dirty_rects(GFXWC(list)->_dirty);
|
||||||
GFXWC(list)->dirty = NULL;
|
GFXWC(list)->_dirty = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _w_gfxwop_list_print(GfxWidget *list, const char *name, int indentation) {
|
void GfxList::print(int indentation) const {
|
||||||
_gfxw_print_widget(list, indentation);
|
printIntern(indentation);
|
||||||
sciprintf("%s", name);
|
|
||||||
|
|
||||||
return _w_gfxwop_container_print(list, indentation);
|
if (_type == GFXW_LIST)
|
||||||
}
|
sciprintf("LIST");
|
||||||
|
else if (_type == GFXW_SORTED_LIST)
|
||||||
|
sciprintf("SORTED_LIST");
|
||||||
|
else
|
||||||
|
error("GfxList::print: Invalid type %d", _type);
|
||||||
|
|
||||||
static int _gfxwop_list_print(GfxWidget *list, int indentation) {
|
GfxContainer::print(indentation);
|
||||||
return _w_gfxwop_list_print(list, "LIST", indentation);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _gfxwop_sorted_list_print(GfxWidget *list, int indentation) {
|
|
||||||
return _w_gfxwop_list_print(list, "SORTED_LIST", indentation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_list_equals(GfxWidget *widget, GfxWidget *other) {
|
static int _gfxwop_list_equals(GfxWidget *widget, GfxWidget *other) {
|
||||||
|
@ -1376,7 +1340,7 @@ static int _gfxwop_list_equals(GfxWidget *widget, GfxWidget *other) {
|
||||||
|
|
||||||
if (!GFXW_IS_LIST(widget)) {
|
if (!GFXW_IS_LIST(widget)) {
|
||||||
GFXWARN("_gfxwop_list_equals(): Method called on non-list!\n");
|
GFXWARN("_gfxwop_list_equals(): Method called on non-list!\n");
|
||||||
widget->print(widget, 0);
|
widget->print(0);
|
||||||
sciprintf("\n");
|
sciprintf("\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1387,8 +1351,8 @@ static int _gfxwop_list_equals(GfxWidget *widget, GfxWidget *other) {
|
||||||
if (memcmp(&(wlist->_bounds), &(olist->_bounds), sizeof(rect_t)))
|
if (memcmp(&(wlist->_bounds), &(olist->_bounds), sizeof(rect_t)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
widget = wlist->contents;
|
widget = wlist->_contents;
|
||||||
other = olist->contents;
|
other = olist->_contents;
|
||||||
|
|
||||||
while (widget && other) {
|
while (widget && other) {
|
||||||
if (!(widget->equals(widget, other) && !widget->should_replace(widget, other)))
|
if (!(widget->equals(widget, other) && !widget->should_replace(widget, other)))
|
||||||
|
@ -1418,13 +1382,13 @@ static int _gfxwop_list_add_dirty(GfxContainer *container, rect_t dirty, int pro
|
||||||
|
|
||||||
int _gfxwop_ordered_add(GfxContainer *container, GfxWidget *widget, int compare_all) {
|
int _gfxwop_ordered_add(GfxContainer *container, GfxWidget *widget, int compare_all) {
|
||||||
// O(n)
|
// O(n)
|
||||||
GfxWidget **seekerp = &(container->contents);
|
GfxWidget **seekerp = &(container->_contents);
|
||||||
|
|
||||||
if (widget->_next) {
|
if (widget->_next) {
|
||||||
GFXERROR("_gfxwop_sorted_list_add(): Attempt to add widget to two lists!\nWidget:");
|
GFXERROR("_gfxwop_sorted_list_add(): Attempt to add widget to two lists!\nWidget:");
|
||||||
widget->print(widget, 3);
|
widget->print(3);
|
||||||
sciprintf("\nList:");
|
sciprintf("\nList:");
|
||||||
container->print(container, 3);
|
container->print(3);
|
||||||
BREAKPOINT();
|
BREAKPOINT();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1469,7 +1433,6 @@ static int _gfxwop_sorted_list_add(GfxContainer *container, GfxWidget *widget) {
|
||||||
void _gfxw_set_ops_LIST(GfxContainer *list, char sorted) {
|
void _gfxw_set_ops_LIST(GfxContainer *list, char sorted) {
|
||||||
_gfxw_set_container_ops((GfxContainer *)list, sorted ? _gfxwop_sorted_list_draw : _gfxwop_list_draw,
|
_gfxw_set_container_ops((GfxContainer *)list, sorted ? _gfxwop_sorted_list_draw : _gfxwop_list_draw,
|
||||||
_gfxwop_container_tag,
|
_gfxwop_container_tag,
|
||||||
sorted ? _gfxwop_sorted_list_print : _gfxwop_list_print,
|
|
||||||
_gfxwop_basic_compare_to, sorted ? _gfxwop_basic_equals : _gfxwop_list_equals,
|
_gfxwop_basic_compare_to, sorted ? _gfxwop_basic_equals : _gfxwop_list_equals,
|
||||||
_gfxwop_basic_superarea_of,
|
_gfxwop_basic_superarea_of,
|
||||||
_gfxwop_container_free_tagged, _gfxwop_container_free_contents,
|
_gfxwop_container_free_tagged, _gfxwop_container_free_contents,
|
||||||
|
@ -1492,7 +1455,7 @@ GfxList::GfxList(rect_t area, bool sorted)
|
||||||
|
|
||||||
static int _gfxwop_visual_draw(GfxWidget *widget, Common::Point pos) {
|
static int _gfxwop_visual_draw(GfxWidget *widget, Common::Point pos) {
|
||||||
GfxVisual *visual = (GfxVisual *) widget;
|
GfxVisual *visual = (GfxVisual *) widget;
|
||||||
gfx_dirty_rect_t *dirty = visual->dirty;
|
gfx_dirty_rect_t *dirty = visual->_dirty;
|
||||||
DRAW_ASSERT(widget, GFXW_VISUAL);
|
DRAW_ASSERT(widget, GFXW_VISUAL);
|
||||||
|
|
||||||
while (dirty) {
|
while (dirty) {
|
||||||
|
@ -1508,40 +1471,28 @@ static int _gfxwop_visual_draw(GfxWidget *widget, Common::Point pos) {
|
||||||
dirty = dirty->next;
|
dirty = dirty->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
_gfxwop_container_draw_contents(widget, visual->contents);
|
_gfxwop_container_draw_contents(widget, visual->_contents);
|
||||||
|
|
||||||
recursively_free_dirty_rects(visual->dirty);
|
recursively_free_dirty_rects(visual->_dirty);
|
||||||
visual->dirty = NULL;
|
visual->_dirty = NULL;
|
||||||
widget->_flags &= ~GFXW_FLAG_DIRTY;
|
widget->_flags &= ~GFXW_FLAG_DIRTY;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_visual_print(GfxWidget *widget, int indentation) {
|
void GfxVisual::print(int indentation) const {
|
||||||
int comma = 0;
|
printIntern(indentation);
|
||||||
GfxVisual *visual = (GfxVisual *) widget;
|
|
||||||
|
|
||||||
if (!GFXW_IS_VISUAL(visual)) {
|
|
||||||
GFXERROR("_gfxwop_visual_print() called on non-visual!Widget was: ");
|
|
||||||
widget->print(widget, 3);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
_gfxw_print_widget(widget, indentation);
|
|
||||||
sciprintf("VISUAL; ports={");
|
sciprintf("VISUAL; ports={");
|
||||||
for (uint i = 0; i < visual->_portRefs.size(); i++) {
|
for (uint i = 0; i < _portRefs.size(); i++) {
|
||||||
if (visual->_portRefs[i]) {
|
if (_portRefs[i]) {
|
||||||
if (comma)
|
if (i != 0)
|
||||||
sciprintf(",");
|
sciprintf(",");
|
||||||
else
|
|
||||||
comma = 1;
|
|
||||||
|
|
||||||
sciprintf("%d", i);
|
sciprintf("%d", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sciprintf("}\n");
|
sciprintf("}\n");
|
||||||
|
|
||||||
return _w_gfxwop_container_print(widget, indentation);
|
GfxContainer::print(indentation);
|
||||||
}
|
}
|
||||||
|
|
||||||
int GfxVisual::setVisual(GfxVisual *visual) {
|
int GfxVisual::setVisual(GfxVisual *visual) {
|
||||||
|
@ -1556,7 +1507,7 @@ int GfxVisual::setVisual(GfxVisual *visual) {
|
||||||
|
|
||||||
void _gfxw_set_ops_VISUAL(GfxContainer *visual) {
|
void _gfxw_set_ops_VISUAL(GfxContainer *visual) {
|
||||||
_gfxw_set_container_ops((GfxContainer *)visual, _gfxwop_visual_draw,
|
_gfxw_set_container_ops((GfxContainer *)visual, _gfxwop_visual_draw,
|
||||||
_gfxwop_container_tag, _gfxwop_visual_print, _gfxwop_basic_compare_to,
|
_gfxwop_container_tag, _gfxwop_basic_compare_to,
|
||||||
_gfxwop_basic_equals, _gfxwop_basic_superarea_of,
|
_gfxwop_basic_equals, _gfxwop_basic_superarea_of,
|
||||||
_gfxwop_container_free_tagged, _gfxwop_container_free_contents,
|
_gfxwop_container_free_tagged, _gfxwop_container_free_contents,
|
||||||
_gfxwop_container_add_dirty, _gfxwop_container_add);
|
_gfxwop_container_add_dirty, _gfxwop_container_add);
|
||||||
|
@ -1591,7 +1542,7 @@ static int _visual_find_free_ID(GfxVisual *visual) {
|
||||||
static int _gfxwop_add_dirty_rects(GfxContainer *dest, gfx_dirty_rect_t *src) {
|
static int _gfxwop_add_dirty_rects(GfxContainer *dest, gfx_dirty_rect_t *src) {
|
||||||
DDIRTY(stderr, "Adding multiple dirty to #%d\n", dest->_ID);
|
DDIRTY(stderr, "Adding multiple dirty to #%d\n", dest->_ID);
|
||||||
if (src) {
|
if (src) {
|
||||||
dest->dirty = gfxdr_add_dirty(dest->dirty, src->rect, GFXW_DIRTY_STRATEGY);
|
dest->_dirty = gfxdr_add_dirty(dest->_dirty, src->rect, GFXW_DIRTY_STRATEGY);
|
||||||
_gfxwop_add_dirty_rects(dest, src->next);
|
_gfxwop_add_dirty_rects(dest, src->next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1606,18 +1557,18 @@ static int _gfxwop_port_draw(GfxWidget *widget, Common::Point pos) {
|
||||||
|
|
||||||
if (port->_decorations) {
|
if (port->_decorations) {
|
||||||
DDIRTY(stderr, "Getting/applying deco dirty (multi)\n");
|
DDIRTY(stderr, "Getting/applying deco dirty (multi)\n");
|
||||||
_gfxwop_add_dirty_rects(GFXWC(port->_decorations), port->dirty);
|
_gfxwop_add_dirty_rects(GFXWC(port->_decorations), port->_dirty);
|
||||||
if (port->_decorations->draw(port->_decorations, gfxw_point_zero)) {
|
if (port->_decorations->draw(port->_decorations, gfxw_point_zero)) {
|
||||||
port->_decorations->dirty = NULL;
|
port->_decorations->_dirty = NULL;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
port->_decorations->dirty = NULL;
|
port->_decorations->_dirty = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_gfxwop_container_draw_contents(widget, port->contents);
|
_gfxwop_container_draw_contents(widget, port->_contents);
|
||||||
|
|
||||||
recursively_free_dirty_rects(port->dirty);
|
recursively_free_dirty_rects(port->_dirty);
|
||||||
port->dirty = NULL;
|
port->_dirty = NULL;
|
||||||
widget->_flags &= ~GFXW_FLAG_DIRTY;
|
widget->_flags &= ~GFXW_FLAG_DIRTY;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1639,17 +1590,15 @@ GfxPort::~GfxPort() {
|
||||||
delete _decorations;
|
delete _decorations;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_port_print(GfxWidget *widget, int indentation) {
|
void GfxPort::print(int indentation) const {
|
||||||
GfxPort *port = (GfxPort *)widget;
|
printIntern(indentation);
|
||||||
|
|
||||||
_gfxw_print_widget(widget, indentation);
|
|
||||||
sciprintf("PORT");
|
sciprintf("PORT");
|
||||||
sciprintf(" font=%d drawpos=(%d,%d)", port->_font, port->draw_pos.x, port->draw_pos.y);
|
sciprintf(" font=%d drawpos=(%d,%d)", _font, draw_pos.x, draw_pos.y);
|
||||||
if (port->gray_text)
|
if (gray_text)
|
||||||
sciprintf(" (gray)");
|
sciprintf(" (gray)");
|
||||||
_w_gfxwop_container_print(port, indentation);
|
|
||||||
|
|
||||||
return _w_gfxwop_container_print_contents("decorations", port->_decorations, indentation);
|
GfxContainer::print(indentation);
|
||||||
|
_w_gfxwop_container_print_contents("decorations", _decorations, indentation);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _gfxwop_port_superarea_of(GfxWidget *self, GfxWidget *other) {
|
static int _gfxwop_port_superarea_of(GfxWidget *self, GfxWidget *other) {
|
||||||
|
@ -1667,7 +1616,7 @@ int GfxPort::setVisual(GfxVisual *visual) {
|
||||||
if (_decorations)
|
if (_decorations)
|
||||||
if (_decorations->setVisual(visual)) {
|
if (_decorations->setVisual(visual)) {
|
||||||
GFXWARN("Setting the visual for decorations failed for port ");
|
GFXWARN("Setting the visual for decorations failed for port ");
|
||||||
this->print(this, 1);
|
this->print(1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1720,7 +1669,7 @@ static int _gfxwop_port_add(GfxContainer *container, GfxWidget *widget) {
|
||||||
|
|
||||||
void _gfxw_set_ops_PORT(GfxContainer *widget) {
|
void _gfxw_set_ops_PORT(GfxContainer *widget) {
|
||||||
_gfxw_set_container_ops((GfxContainer *)widget, _gfxwop_port_draw, _gfxwop_container_tag,
|
_gfxw_set_container_ops((GfxContainer *)widget, _gfxwop_port_draw, _gfxwop_container_tag,
|
||||||
_gfxwop_port_print, _gfxwop_basic_compare_to, _gfxwop_basic_equals, _gfxwop_port_superarea_of,
|
_gfxwop_basic_compare_to, _gfxwop_basic_equals, _gfxwop_port_superarea_of,
|
||||||
_gfxwop_container_free_tagged, _gfxwop_container_free_contents,
|
_gfxwop_container_free_tagged, _gfxwop_container_free_contents,
|
||||||
_gfxwop_port_add_dirty, _gfxwop_port_add);
|
_gfxwop_port_add_dirty, _gfxwop_port_add);
|
||||||
}
|
}
|
||||||
|
@ -1758,7 +1707,7 @@ GfxPort *gfxw_remove_port(GfxVisual *visual, GfxPort *port) {
|
||||||
VERIFY_WIDGET(visual);
|
VERIFY_WIDGET(visual);
|
||||||
VERIFY_WIDGET(port);
|
VERIFY_WIDGET(port);
|
||||||
|
|
||||||
if (!visual->contents) {
|
if (!visual->_contents) {
|
||||||
GFXWARN("Attempt to remove port from empty visual\n");
|
GFXWARN("Attempt to remove port from empty visual\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1819,7 +1768,7 @@ GfxDynView *gfxw_dyn_view_set_params(GfxDynView *widget, int under_bits, void *u
|
||||||
}
|
}
|
||||||
|
|
||||||
GfxWidget *gfxw_remove_id(GfxContainer *container, int ID, int subID) {
|
GfxWidget *gfxw_remove_id(GfxContainer *container, int ID, int subID) {
|
||||||
GfxWidget **wp = &(container->contents);
|
GfxWidget **wp = &(container->_contents);
|
||||||
|
|
||||||
while (*wp) {
|
while (*wp) {
|
||||||
if ((*wp)->_ID == ID && (subID == GFXW_NO_ID || (*wp)->_subID == subID)) {
|
if ((*wp)->_ID == ID && (subID == GFXW_NO_ID || (*wp)->_subID == subID)) {
|
||||||
|
@ -1897,7 +1846,7 @@ int gfxw_widget_matches_snapshot(gfxw_snapshot_t *snapshot, GfxWidget *widget) {
|
||||||
#define MAGIC_FREE_NUMBER -42
|
#define MAGIC_FREE_NUMBER -42
|
||||||
|
|
||||||
void _gfxw_free_contents_appropriately(GfxContainer *container, gfxw_snapshot_t *snapshot, int priority) {
|
void _gfxw_free_contents_appropriately(GfxContainer *container, gfxw_snapshot_t *snapshot, int priority) {
|
||||||
GfxWidget *widget = container->contents;
|
GfxWidget *widget = container->_contents;
|
||||||
|
|
||||||
while (widget) {
|
while (widget) {
|
||||||
GfxWidget *next = widget->_next;
|
GfxWidget *next = widget->_next;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue