aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2009-04-24 10:48:25 +0000
committerMax Horn2009-04-24 10:48:25 +0000
commitebcfd9b016da9969377c2847ca8033f498a13792 (patch)
tree0d0941342f8ea434e2dd8a08b398d21addbeb7f4 /engines
parent80794a6b5aa02be8a8c0e7879c5e3f48ee8a2646 (diff)
downloadscummvm-rg350-ebcfd9b016da9969377c2847ca8033f498a13792.tar.gz
scummvm-rg350-ebcfd9b016da9969377c2847ca8033f498a13792.tar.bz2
scummvm-rg350-ebcfd9b016da9969377c2847ca8033f498a13792.zip
SCI: Got rid of GFXW() macro; turned GfxWidget::widfree into destructors
svn-id: r40107
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/engine/game.cpp10
-rw-r--r--engines/sci/engine/kevent.cpp2
-rw-r--r--engines/sci/engine/kgraphics.cpp98
-rw-r--r--engines/sci/engine/kmenu.cpp13
-rw-r--r--engines/sci/engine/kpathing.cpp2
-rw-r--r--engines/sci/engine/scriptdebug.cpp14
-rw-r--r--engines/sci/gfx/gfx_gui.cpp134
-rw-r--r--engines/sci/gfx/gfx_state_internal.h12
-rw-r--r--engines/sci/gfx/gfx_widgets.cpp196
-rw-r--r--engines/sci/gfx/gfx_widgets.h14
10 files changed, 222 insertions, 273 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index 939321df92..b44b4dd271 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -179,10 +179,10 @@ int _reset_graphics_input(EngineState *s) {
s->pics_drawn_nr = 0;
- s->visual->add(GFXWC(s->visual), GFXW(s->wm_port));
- s->visual->add(GFXWC(s->visual), GFXW(s->titlebar_port));
- s->visual->add(GFXWC(s->visual), GFXW(s->picture_port));
- s->visual->add(GFXWC(s->visual), GFXW(s->iconbar_port));
+ s->visual->add(GFXWC(s->visual), s->wm_port);
+ s->visual->add(GFXWC(s->visual), s->titlebar_port);
+ s->visual->add(GFXWC(s->visual), s->picture_port);
+ s->visual->add(GFXWC(s->visual), s->iconbar_port);
// Add ports to visual
s->port = s->picture_port; // Currently using the picture port
@@ -210,7 +210,7 @@ int game_init_graphics(EngineState *s) {
static void _free_graphics_input(EngineState *s) {
sciprintf("Freeing graphics\n");
- s->visual->widfree(GFXW(s->visual));
+ delete s->visual;
s->wm_port = s->titlebar_port = s->picture_port = NULL;
s->visual = NULL;
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index 4d6fbd08c0..dcc00f8b26 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -98,7 +98,7 @@ reg_t kGetEvent(EngineState *s, int funct_nr, int argc, reg_t *argv) {
s->onscreen_console = 1;
} else if ((e.buckybits & SCI_EVM_CTRL) && (e.data == '1')) {
if (s->visual)
- s->visual->print(GFXW(s->visual), 0);
+ s->visual->print(s->visual, 0);
} else {
PUT_SEL32V(obj, type, SCI_EVT_KEYBOARD); // Keyboard event
s->r_acc = make_reg(0, 1);
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index ec086580dd..a5fc6e3f65 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -66,29 +66,29 @@ enum {
#define ADD_TO_CURRENT_PORT(widget) \
{if (s->port) \
- s->port->add(GFXWC(s->port), GFXW(widget)); \
+ s->port->add(GFXWC(s->port), widget); \
else \
- s->picture_port->add(GFXWC(s->visual), GFXW(widget));}
+ s->picture_port->add(GFXWC(s->visual), widget);}
#define ADD_TO_CURRENT_PICTURE_PORT(widget) \
{if (s->port) \
- s->port->add(GFXWC(s->port), GFXW(widget)); \
+ s->port->add(GFXWC(s->port), widget); \
else \
- s->picture_port->add(GFXWC(s->picture_port), GFXW(widget));}
+ s->picture_port->add(GFXWC(s->picture_port), widget);}
#define ADD_TO_WINDOW_PORT(widget) \
- s->wm_port->add(GFXWC(s->wm_port), GFXW(widget));
+ s->wm_port->add(GFXWC(s->wm_port), widget);
#define FULL_REDRAW()\
if (s->visual) \
- s->visual->draw(GFXW(s->visual), gfxw_point_zero); \
+ s->visual->draw(s->visual, gfxw_point_zero); \
gfxop_update(s->gfx_state);
#if 0
// Used for debugging
#define FULL_INSPECTION()\
if (s->visual) \
- s->visual->print(GFXW(s->visual), 0);
+ s->visual->print(s->visual, 0);
#endif
#define GFX_ASSERT(x) { \
@@ -142,9 +142,9 @@ static void reparentize_primary_widget_lists(EngineState *s, GfxPort *newport) {
newport = s->picture_port;
if (s->dyn_views) {
- gfxw_remove_widget_from_container(s->dyn_views->_parent, GFXW(s->dyn_views));
+ gfxw_remove_widget_from_container(s->dyn_views->_parent, s->dyn_views);
- newport->add(GFXWC(newport), GFXW(s->dyn_views));
+ newport->add(GFXWC(newport), s->dyn_views);
}
}
@@ -222,7 +222,7 @@ void graph_restore_box(EngineState *s, reg_t handle) {
return;
}
- while (port_nr > 2 && !(s->port->_flags & GFXW_FLAG_IMMUNE_TO_SNAPSHOTS) && (gfxw_widget_matches_snapshot(*ptr, GFXW(s->port)))) {
+ while (port_nr > 2 && !(s->port->_flags & GFXW_FLAG_IMMUNE_TO_SNAPSHOTS) && (gfxw_widget_matches_snapshot(*ptr, s->port))) {
// This shouldn't ever happen, actually, since windows (ports w/ ID > 2) should all be immune
GfxPort *newport = gfxw_find_port(s->visual, port_nr);
SCIkwarn(SCIkERROR, "Port %d is not immune against snapshots!\n", s->port->_ID);
@@ -231,12 +231,12 @@ void graph_restore_box(EngineState *s, reg_t handle) {
s->port = newport;
}
- if (s->dyn_views && gfxw_widget_matches_snapshot(*ptr, GFXW(s->dyn_views->_parent))) {
+ if (s->dyn_views && gfxw_widget_matches_snapshot(*ptr, s->dyn_views->_parent)) {
GfxContainer *parent = s->dyn_views->_parent;
do {
parent = parent->_parent;
- } while (parent && (gfxw_widget_matches_snapshot(*ptr, GFXW(parent))));
+ } while (parent && (gfxw_widget_matches_snapshot(*ptr, parent)));
if (!parent) {
SCIkwarn(SCIkERROR, "Attempted widget mass destruction by a snapshot\n");
@@ -404,7 +404,7 @@ reg_t kShow(EngineState *s, int funct_nr, int argc, reg_t *argv) {
if (old_map != s->pic_visible_map) {
if (s->pic_visible_map == GFX_MASK_VISUAL) // Full widget redraw
- s->visual->draw(GFXW(s->visual), Common::Point(0, 0));
+ s->visual->draw(s->visual, Common::Point(0, 0));
gfxop_update(s->gfx_state);
sciprintf("Switching visible map to %x\n", s->pic_visible_map);
@@ -465,14 +465,14 @@ void _k_graph_rebuild_port_with_color(EngineState *s, gfx_color_t newbgcolor) {
int found = 0;
GfxContainer *parent = s->dyn_views->_parent;
- while (parent && !(found |= (GFXW(parent) == GFXW(port))))
+ while (parent && !(found |= (parent == port)))
parent = parent->_parent;
s->dyn_views = NULL;
}
- port->_parent->add(GFXWC(port->_parent), GFXW(newport));
- port->widfree(GFXW(port));
+ port->_parent->add(GFXWC(port->_parent), newport);
+ delete port;
}
static int activated_icon_bar = 0;
@@ -509,8 +509,8 @@ reg_t kGraph(EngineState *s, int funct_nr, int argc, reg_t *argv) {
// have negative width/height). The actual dirty rectangle is constructed in gfxdr_add_dirty().
// FIXME/TODO: We need to change the semantics of this call, so that no fake rectangles are used. As it is, it's
// not possible change rect_t to Common::Rect, as we assume that Common::Rect forms a *valid* rectangle.
- ADD_TO_CURRENT_PICTURE_PORT(GFXW(gfxw_new_line(Common::Point(SKPV(2), SKPV(1)), Common::Point(SKPV(4), SKPV(3)),
- gfxcolor, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL)));
+ ADD_TO_CURRENT_PICTURE_PORT(gfxw_new_line(Common::Point(SKPV(2), SKPV(1)), Common::Point(SKPV(4), SKPV(3)),
+ gfxcolor, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
}
break;
@@ -557,7 +557,7 @@ reg_t kGraph(EngineState *s, int funct_nr, int argc, reg_t *argv) {
// FIXME/TODO: this is not right, as some of the dialogs are drawn *behind* some widgets. But at least it works for now
//ADD_TO_CURRENT_PICTURE_PORT(gfxw_new_box(s->gfx_state, area, color, color, GFX_BOX_SHADE_FLAT)); // old code
- s->picture_port->add(GFXWC(s->picture_port), GFXW(gfxw_new_box(s->gfx_state, area, color, color, GFX_BOX_SHADE_FLAT)));
+ s->picture_port->add(GFXWC(s->picture_port), gfxw_new_box(s->gfx_state, area, color, color, GFX_BOX_SHADE_FLAT));
}
break;
@@ -583,7 +583,7 @@ reg_t kGraph(EngineState *s, int funct_nr, int argc, reg_t *argv) {
area.y += s->port->zone.y;
if (s->dyn_views && s->dyn_views->_parent == GFXWC(s->port))
- s->dyn_views->draw(GFXW(s->dyn_views), Common::Point(0, 0));
+ s->dyn_views->draw(s->dyn_views, Common::Point(0, 0));
gfxop_update_box(s->gfx_state, area);
@@ -1029,9 +1029,9 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
GFX_ASSERT(gfxop_new_pic(s->gfx_state, pic_nr, 1, palette));
}
- s->wm_port->widfree(GFXW(s->wm_port));
- s->picture_port->widfree(GFXW(s->picture_port));
- s->iconbar_port->widfree(GFXW(s->iconbar_port));
+ delete s->wm_port;
+ delete s->picture_port;
+ delete s->iconbar_port;
s->wm_port = gfxw_new_port(s->visual, NULL, s->gfx_state->pic_port_bounds, s->ega_colors[0], transparent);
s->picture_port = gfxw_new_port(s->visual, NULL, s->gfx_state->pic_port_bounds, s->ega_colors[0], transparent);
@@ -1039,9 +1039,9 @@ reg_t kDrawPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
s->iconbar_port = gfxw_new_port(s->visual, NULL, gfx_rect(0, 0, 320, 200), s->ega_colors[0], transparent);
s->iconbar_port->_flags |= GFXW_FLAG_NO_IMPLICIT_SWITCH;
- s->visual->add(GFXWC(s->visual), GFXW(s->picture_port));
- s->visual->add(GFXWC(s->visual), GFXW(s->wm_port));
- s->visual->add(GFXWC(s->visual), GFXW(s->iconbar_port));
+ s->visual->add(GFXWC(s->visual), s->picture_port);
+ s->visual->add(GFXWC(s->visual), s->wm_port);
+ s->visual->add(GFXWC(s->visual), s->iconbar_port);
s->port = s->picture_port;
@@ -1857,12 +1857,12 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in
if (!(signal & _K_VIEW_SIG_FLAG_HIDDEN)) {
SCIkdebug(SCIkGRAPHICS, "Adding view at "PREG" to background\n", PRINT_REG(obj));
- if (!(gfxw_remove_id(widget->_parent, widget->_ID, widget->_subID) == GFXW(widget))) {
+ if (!(gfxw_remove_id(widget->_parent, widget->_ID, widget->_subID) == widget)) {
SCIkwarn(SCIkERROR, "Attempt to remove view with ID %x:%x from list failed!\n", widget->_ID, widget->_subID);
BREAKPOINT();
}
- s->drop_views->add(GFXWC(s->drop_views), GFXW(gfxw_picviewize_dynview(widget)));
+ s->drop_views->add(GFXWC(s->drop_views), gfxw_picviewize_dynview(widget));
draw_obj_to_control_map(s, widget);
widget->draw_bounds.y += s->dyn_views->_bounds.y - widget->_parent->_bounds.y;
@@ -1871,7 +1871,7 @@ int _k_view_list_dispose_loop(EngineState *s, List *list, GfxDynView *widget, in
} else {
SCIkdebug(SCIkGRAPHICS, "Deleting view at "PREG"\n", PRINT_REG(obj));
widget->_flags |= GFXW_FLAG_VISIBLE;
- gfxw_annihilate(GFXW(widget));
+ gfxw_annihilate(widget);
return -1; // restart: Done in Animate()
}
}
@@ -1955,7 +1955,7 @@ static GfxDynView *_k_make_dynview_obj(EngineState *s, reg_t obj, int options, i
widget = gfxw_new_dyn_view(s->gfx_state, pos, z, view_nr, loop, cel, palette, -1, -1, ALIGN_CENTER, ALIGN_BOTTOM, nr);
if (widget) {
- widget = (GfxDynView *) gfxw_set_id(GFXW(widget), obj.segment, obj.offset);
+ widget = (GfxDynView *) gfxw_set_id(widget, obj.segment, obj.offset);
widget = gfxw_dyn_view_set_params(widget, under_bits.segment, under_bitsp, signal, signalp);
widget->_flags |= GFXW_FLAG_IMMUNE_TO_SNAPSHOTS; // Only works the first time 'round'
@@ -2012,7 +2012,7 @@ static void _k_make_view_list(EngineState *s, GfxList **widget_list, List *list,
tempWidget = _k_make_dynview_obj(s, obj, options, sequence_nr--, funct_nr, argc, argv);
if (tempWidget)
- GFX_ASSERT((*widget_list)->add(GFXWC(*widget_list), GFXW(tempWidget)));
+ GFX_ASSERT((*widget_list)->add(GFXWC(*widget_list), tempWidget));
node = LOOKUP_NODE(next_node); // Next node
}
@@ -2171,14 +2171,14 @@ static void _k_raise_topmost_in_view_list(EngineState *s, GfxList *list, GfxDynV
}
}
- gfxw_remove_widget_from_container(view->_parent, GFXW(view));
+ gfxw_remove_widget_from_container(view->_parent, view);
if (view->signal & _K_VIEW_SIG_FLAG_HIDDEN)
- gfxw_hide_widget(GFXW(view));
+ gfxw_hide_widget(view);
else
- gfxw_show_widget(GFXW(view));
+ gfxw_show_widget(view);
- list->add(GFXWC(list), GFXW(view));
+ list->add(GFXWC(list), view);
_k_raise_topmost_in_view_list(s, list, next);
}
@@ -2250,9 +2250,9 @@ void _k_draw_view_list(EngineState *s, GfxList *list, int flags) {
uint16 signal = (flags & _K_DRAW_VIEW_LIST_USE_SIGNAL) ? ((reg_t *)(widget->signalp))->offset : 0;
if (signal & _K_VIEW_SIG_FLAG_HIDDEN)
- gfxw_hide_widget(GFXW(widget));
+ gfxw_hide_widget(widget);
else
- gfxw_show_widget(GFXW(widget));
+ gfxw_show_widget(widget);
if (!(flags & _K_DRAW_VIEW_LIST_USE_SIGNAL)
|| ((flags & _K_DRAW_VIEW_LIST_DISPOSEABLE) && (signal & _K_VIEW_SIG_FLAG_DISPOSE_ME))
@@ -2263,9 +2263,9 @@ void _k_draw_view_list(EngineState *s, GfxList *list, int flags) {
// Clear all of those flags
if (signal & _K_VIEW_SIG_FLAG_HIDDEN)
- gfxw_hide_widget(GFXW(widget));
+ gfxw_hide_widget(widget);
else
- gfxw_show_widget(GFXW(widget));
+ gfxw_show_widget(widget);
*((reg_t *)(widget->signalp)) = make_reg(0, signal); // Write the changes back
};
@@ -2297,8 +2297,8 @@ reg_t kAddToPic(EngineState *s, int funct_nr, int argc, reg_t *argv) {
priority = KP_SINT(argv[5]);
control = KP_SINT(argv[6]);
- widget = GFXW(gfxw_new_dyn_view(s->gfx_state, Common::Point(x, y), 0, view, loop, cel, 0,
- priority, -1 /* No priority */ , ALIGN_CENTER, ALIGN_BOTTOM, 0));
+ widget = gfxw_new_dyn_view(s->gfx_state, Common::Point(x, y), 0, view, loop, cel, 0,
+ priority, -1 /* No priority */ , ALIGN_CENTER, ALIGN_BOTTOM, 0);
if (!widget) {
SCIkwarn(SCIkERROR, "Attempt to single-add invalid picview (%d/%d/%d)\n", view, loop, cel);
@@ -2369,7 +2369,7 @@ reg_t kSetPort(EngineState *s, int funct_nr, int argc, reg_t *argv) {
return NULL_REG;
}
- s->port->draw(GFXW(s->port), gfxw_point_zero); // Update the port we're leaving
+ s->port->draw(s->port, gfxw_point_zero); // Update the port we're leaving
s->port = new_port;
return s->r_acc;
}
@@ -2378,7 +2378,7 @@ reg_t kSetPort(EngineState *s, int funct_nr, int argc, reg_t *argv) {
port_origin_x = SKPV(1);
if (SKPV(0) == -10) {
- s->port->draw(GFXW(s->port), gfxw_point_zero); // Update the port we're leaving
+ s->port->draw(s->port, gfxw_point_zero); // Update the port we're leaving
s->port = s->iconbar_port;
activated_icon_bar = 1;
return s->r_acc;
@@ -2427,7 +2427,7 @@ reg_t kDrawCel(EngineState *s, int funct_nr, int argc, reg_t *argv) {
new_view = gfxw_new_view(s->gfx_state, Common::Point(x, y), view, loop, cel, 0, priority, -1,
ALIGN_LEFT, ALIGN_TOP, GFXW_VIEW_FLAG_DONT_MODIFY_OFFSET);
- ADD_TO_CURRENT_PICTURE_PORT(GFXW(new_view));
+ ADD_TO_CURRENT_PICTURE_PORT(new_view);
FULL_REDRAW();
return s->r_acc;
@@ -2541,7 +2541,7 @@ reg_t kNewWindow(EngineState *s, int funct_nr, int argc, reg_t *argv) {
ADD_TO_WINDOW_PORT(window);
FULL_REDRAW();
- window->draw(GFXW(window), gfxw_point_zero);
+ window->draw(window, gfxw_point_zero);
gfxop_update(s->gfx_state);
s->port = window; // Set active port
@@ -3026,11 +3026,11 @@ reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
_k_update_signals_in_view_list(s->dyn_views, templist);
- s->dyn_views->tag(GFXW(s->dyn_views));
+ s->dyn_views->tag(s->dyn_views);
_k_raise_topmost_in_view_list(s, s->dyn_views, (GfxDynView *)templist->contents);
- templist->widfree(GFXW(templist));
+ delete templist;
s->dyn_views->free_tagged(GFXWC(s->dyn_views)); // Free obsolete dynviews
} // if (cast_list)
@@ -3061,7 +3061,7 @@ reg_t kAnimate(EngineState *s, int funct_nr, int argc, reg_t *argv) {
ADD_TO_CURRENT_PICTURE_PORT(s->drop_views);
} else {
assert(s->drop_views);
- gfxw_remove_widget_from_container(s->drop_views->_parent, GFXW(s->drop_views));
+ gfxw_remove_widget_from_container(s->drop_views->_parent, s->drop_views);
ADD_TO_CURRENT_PICTURE_PORT(s->drop_views);
}
@@ -3313,7 +3313,7 @@ reg_t kDisplay(EngineState *s, int funct_nr, int argc, reg_t *argv) {
//ADD_TO_CURRENT_PICTURE_PORT(text_handle);
- ADD_TO_CURRENT_PICTURE_PORT(GFXW(text_handle));
+ ADD_TO_CURRENT_PICTURE_PORT(text_handle);
if ((!s->pic_not_valid) && update_immediately) { // Refresh if drawn to valid picture
FULL_REDRAW();
SCIkdebug(SCIkGRAPHICS, "Refreshing display...\n");
diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp
index 3fb2a0fd67..b29432a2d4 100644
--- a/engines/sci/engine/kmenu.cpp
+++ b/engines/sci/engine/kmenu.cpp
@@ -96,7 +96,7 @@ reg_t kDrawMenuBar(EngineState *s, int funct_nr, int argc, reg_t *argv) {
else
sciw_set_status_bar(s, s->titlebar_port, "", 0, 0);
- s->titlebar_port->draw(GFXW(s->titlebar_port), Common::Point(0, 0));
+ s->titlebar_port->draw(s->titlebar_port, Common::Point(0, 0));
gfxop_update(s->gfx_state);
return s->r_acc;
@@ -118,7 +118,7 @@ static int _menu_go_down(Menubar *menubar, int menu_nr, int item_nr) {
}
#define FULL_REDRAW \
- s->visual->draw(GFXW(s->visual), Common::Point(0, 0)); \
+ s->visual->draw(s->visual, Common::Point(0, 0)); \
gfxop_update(s->gfx_state);
@@ -215,7 +215,7 @@ reg_t kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv) {
case '`':
if (ev.buckybits & SCI_EVM_CTRL)
- s->visual->print(GFXW(s->visual), 0);
+ s->visual->print(s->visual, 0);
break;
case SCI_K_ESC:
@@ -284,11 +284,10 @@ reg_t kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv) {
sciw_set_menubar(s, s->titlebar_port, s->_menubar, menu_nr);
- if (port)
- port->widfree(GFXW(port));
+ delete port;
port = sciw_new_menu(s, s->titlebar_port, s->_menubar, menu_nr);
- s->wm_port->add(GFXWC(s->wm_port), GFXW(port));
+ s->wm_port->add(GFXWC(s->wm_port), port);
if (item_nr > -1)
old_item = -42; /* Enforce redraw in next step */
@@ -311,7 +310,7 @@ reg_t kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv) {
} /* while (menu_mode) */
if (port) {
- port->widfree(GFXW(port));
+ delete port;
port = NULL;
sciw_set_status_bar(s, s->titlebar_port, s->_statusBarText, s->status_bar_foreground, s->status_bar_background);
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 267f57392f..3fde73a2eb 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -1543,7 +1543,7 @@ reg_t kAvoidPath(EngineState *s, int funct_nr, int argc, reg_t *argv) {
if (!port->decorations) {
port->decorations = gfxw_new_list(gfx_rect(0, 0, 320, 200), 0);
- port->decorations->set_visual(GFXW(port->decorations), port->_visual);
+ port->decorations->set_visual(port->decorations, port->_visual);
} else {
port->decorations->free_contents(port->decorations);
}
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 1e31bc06ed..7800f48eb7 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -1613,7 +1613,7 @@ static int c_redraw_screen(EngineState *s) {
return 1;
}
- s->visual->draw(GFXW(s->visual), Common::Point(0, 0));
+ s->visual->draw(s->visual, Common::Point(0, 0));
gfxop_update_box(s->gfx_state, gfx_rect(0, 0, 320, 200));
gfxop_update(s->gfx_state);
gfxop_sleep(s->gfx_state, 0);
@@ -1688,7 +1688,7 @@ static int c_gfx_print_port(EngineState *s) {
}
if (port)
- port->print(GFXW(port), 0);
+ port->print(port, 0);
else
sciprintf("No such port.\n");
@@ -1722,7 +1722,7 @@ static int c_gfx_print_visual(EngineState *s) {
}
if (s->visual)
- s->visual->print(GFXW(s->visual), 0);
+ s->visual->print(s->visual, 0);
else
sciprintf("visual is uninitialized.\n");
@@ -1738,7 +1738,7 @@ static int c_gfx_print_dynviews(EngineState *s) {
if (!s->dyn_views)
sciprintf("No dynview list active.\n");
else
- s->dyn_views->print(GFXW(s->dyn_views), 0);
+ s->dyn_views->print(s->dyn_views, 0);
return 0;
}
@@ -1752,7 +1752,7 @@ static int c_gfx_print_dropviews(EngineState *s) {
if (!s->drop_views)
sciprintf("No dropped dynview list active.\n");
else
- s->drop_views->print(GFXW(s->drop_views), 0);
+ s->drop_views->print(s->drop_views, 0);
return 0;
}
@@ -1822,7 +1822,7 @@ static int c_gfx_show_map(EngineState *s) {
switch (map) {
case 0:
s->visual->add_dirty_abs(GFXWC(s->visual), gfx_rect(0, 0, 320, 200), 0);
- s->visual->draw(GFXW(s->visual), Common::Point(0, 0));
+ s->visual->draw(s->visual, Common::Point(0, 0));
break;
case 1:
@@ -2007,7 +2007,7 @@ static int c_gfx_flush_resources(EngineState *s) {
gfxop_set_pointer_cursor(s->gfx_state, GFXOP_NO_POINTER);
sciprintf("Flushing resources...\n");
- s->visual->widfree(GFXW(s->visual));
+ delete s->visual;
s->gfx_state->gfxResMan->freeAllResources();
s->visual = NULL;
diff --git a/engines/sci/gfx/gfx_gui.cpp b/engines/sci/gfx/gfx_gui.cpp
index da85878281..925b70a567 100644
--- a/engines/sci/gfx/gfx_gui.cpp
+++ b/engines/sci/gfx/gfx_gui.cpp
@@ -40,7 +40,7 @@ namespace Sci {
static void clear_titlebar(GfxPort *titlebar) {
if (titlebar->contents) {
- titlebar->contents->widfree(titlebar->contents);
+ delete titlebar->contents;
titlebar->contents = NULL;
titlebar->nextpp = &(titlebar->contents);
}
@@ -111,10 +111,10 @@ void sciw_set_status_bar(EngineState *s, GfxPort *status_bar, const Common::Stri
list->add((GfxContainer *)list, (GfxWidget *)bgbox);
}
- list->add(GFXWC(status_bar), GFXW(list));
+ list->add(GFXWC(status_bar), list);
finish_titlebar_list(s, list, status_bar);
- status_bar->draw(GFXW(status_bar), gfxw_point_zero);
+ status_bar->draw(status_bar, gfxw_point_zero);
gfxop_update(state);
}
@@ -280,14 +280,14 @@ GfxList *_sciw_add_text_to_list(GfxList *list, GfxPort *port, rect_t zone, char
bgcolor = &(port->_bgcolor);
}
- list->add(GFXWC(list), GFXW(gfxw_new_text(port->_visual->gfx_state, zone, font, text, align, ALIGN_TOP,
- *color1, *color2, *bgcolor, flags)));
+ list->add(GFXWC(list), gfxw_new_text(port->_visual->gfx_state, zone, font, text, align, ALIGN_TOP,
+ *color1, *color2, *bgcolor, flags));
zone.width--;
zone.height -= 2;
if (framed) {
- list->add(GFXWC(list), GFXW(gfxw_new_rect(zone, *color2, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_STIPPLED)));
+ list->add(GFXWC(list), gfxw_new_rect(zone, *color2, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_STIPPLED));
}
return list;
@@ -304,7 +304,7 @@ GfxList *sciw_new_button_control(GfxPort *port, reg_t ID, rect_t zone, char *tex
list = gfxw_new_list(_move_and_extend_rect(zone, Common::Point(port->zone.x, port->zone.y), 1), 0);
- gfxw_set_id(GFXW(list), ID.segment, ID.offset);
+ gfxw_set_id(list, ID.segment, ID.offset);
zone.x = 0;
zone.y = 0;
@@ -314,10 +314,10 @@ GfxList *sciw_new_button_control(GfxPort *port, reg_t ID, rect_t zone, char *tex
text, font, ALIGN_CENTER, 0, inverse, kFontIgnoreLF, grayed_out);
list->add(GFXWC(list),
- GFXW(gfxw_new_rect(zone, *frame_col, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL)));
+ gfxw_new_rect(zone, *frame_col, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
} else {
- list->add(GFXWC(list), GFXW(gfxw_new_box(NULL, gfx_rect(zone.x, zone.y, zone.width + 1, zone.height + 1),
- port->_color, port->_color, GFX_BOX_SHADE_FLAT)));
+ list->add(GFXWC(list), gfxw_new_box(NULL, gfx_rect(zone.x, zone.y, zone.width + 1, zone.height + 1),
+ port->_color, port->_color, GFX_BOX_SHADE_FLAT));
list = _sciw_add_text_to_list(list, port, gfx_rect(zone.x + 1, zone.y + 2, zone.width - 1, zone.height),
text, font, ALIGN_CENTER, 0, inverse, kFontIgnoreLF, grayed_out);
@@ -325,8 +325,8 @@ GfxList *sciw_new_button_control(GfxPort *port, reg_t ID, rect_t zone, char *tex
if (selected)
list->add(GFXWC(list),
- GFXW(gfxw_new_rect(gfx_rect(zone.x + 1, zone.y + 1, zone.width - 2, zone.height - 2),
- *frame_col, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL)));
+ gfxw_new_rect(gfx_rect(zone.x + 1, zone.y + 1, zone.width - 2, zone.height - 2),
+ *frame_col, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
return list;
}
@@ -335,7 +335,7 @@ GfxList *sciw_new_text_control(GfxPort *port, reg_t ID, rect_t zone, char *text,
gfx_alignment_t align, char framed, char inverse) {
GfxList *list = gfxw_new_list(_move_and_extend_rect(zone, Common::Point(port->zone.x, port->zone.y), 2), 0);
- gfxw_set_id(GFXW(list), ID.segment, ID.offset);
+ gfxw_set_id(list, ID.segment, ID.offset);
zone.x = 0;
zone.y = 0;
@@ -356,7 +356,7 @@ GfxList *sciw_new_edit_control(GfxPort *port, reg_t ID, rect_t zone, char *text,
zone.height++;
list = gfxw_new_list(_move_and_extend_rect(zone, Common::Point(port->zone.x, port->zone.y), 1), 0);
- gfxw_set_id(GFXW(list), ID.segment, ID.offset);
+ gfxw_set_id(list, ID.segment, ID.offset);
zone.x = 1;
zone.y = 1;
@@ -364,7 +364,7 @@ GfxList *sciw_new_edit_control(GfxPort *port, reg_t ID, rect_t zone, char *text,
text_handle = gfxw_new_text(port->_visual->gfx_state, zone, font, text, ALIGN_LEFT, ALIGN_TOP,
port->_color, port->_color, port->_bgcolor, kFontNoNewlines);
- list->add(GFXWC(list), GFXW(text_handle));
+ list->add(GFXWC(list), text_handle);
} else {
char *textdup = (char *)sci_malloc(strlen(text) + 1);
@@ -377,7 +377,7 @@ GfxList *sciw_new_edit_control(GfxPort *port, reg_t ID, rect_t zone, char *text,
text_handle = gfxw_new_text(port->_visual->gfx_state, zone, font, textdup, ALIGN_LEFT, ALIGN_TOP,
port->_color, port->_color, port->_bgcolor, kFontNoNewlines);
- list->add(GFXWC(list), GFXW(text_handle));
+ list->add(GFXWC(list), text_handle);
zone.x += text_handle->width;
}
@@ -386,26 +386,26 @@ GfxList *sciw_new_edit_control(GfxPort *port, reg_t ID, rect_t zone, char *text,
textdup[1] = 0;
text_handle = gfxw_new_text(port->_visual->gfx_state, zone, font, textdup, ALIGN_LEFT, ALIGN_TOP,
port->_bgcolor, port->_bgcolor, port->_color, kFontNoNewlines);
- list->add(GFXWC(list), GFXW(text_handle));
+ list->add(GFXWC(list), text_handle);
zone.x += text_handle->width;
};
if (cursor + 1 < strlen(text)) {
text_handle = gfxw_new_text(port->_visual->gfx_state, zone, font, text + cursor + 1, ALIGN_LEFT, ALIGN_TOP,
port->_color, port->_color, port->_bgcolor, kFontNoNewlines);
- list->add(GFXWC(list), GFXW(text_handle));
+ list->add(GFXWC(list), text_handle);
zone.x += text_handle->width;
};
if (cursor == strlen(text))
- list->add(GFXWC(list), GFXW(gfxw_new_line(Common::Point(zone.x, zone.y), Common::Point(zone.x, zone.y + cursor_height - 1),
- port->_color, GFX_LINE_MODE_FAST, GFX_LINE_STYLE_NORMAL)));
+ list->add(GFXWC(list), gfxw_new_line(Common::Point(zone.x, zone.y), Common::Point(zone.x, zone.y + cursor_height - 1),
+ port->_color, GFX_LINE_MODE_FAST, GFX_LINE_STYLE_NORMAL));
free(textdup);
}
zone.x = zone.y = 0;
- list->add(GFXWC(list), GFXW(gfxw_new_rect(zone, port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL)));
+ list->add(GFXWC(list), gfxw_new_rect(zone, port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
return list;
}
@@ -414,7 +414,7 @@ GfxList *sciw_new_icon_control(GfxPort *port, reg_t ID, rect_t zone, int view, i
char frame, char inverse) {
GfxList *list = gfxw_new_list(_move_and_extend_rect(zone, Common::Point(port->zone.x, port->zone.y), 1), 0);
GfxWidget *icon;
- gfxw_set_id(GFXW(list), ID.segment, ID.offset);
+ gfxw_set_id(list, ID.segment, ID.offset);
if (!port->_visual) {
GFXERROR("Attempting to create icon control for virtual port!\n");
@@ -424,8 +424,8 @@ GfxList *sciw_new_icon_control(GfxPort *port, reg_t ID, rect_t zone, int view, i
zone.x = 0;
zone.y = 0;
- icon = GFXW(gfxw_new_view(port->_visual->gfx_state, Common::Point(zone.x, zone.y), view, loop, cel, 0, -1, -1,
- ALIGN_LEFT, ALIGN_TOP, GFXW_VIEW_FLAG_DONT_MODIFY_OFFSET));
+ icon = gfxw_new_view(port->_visual->gfx_state, Common::Point(zone.x, zone.y), view, loop, cel, 0, -1, -1,
+ ALIGN_LEFT, ALIGN_TOP, GFXW_VIEW_FLAG_DONT_MODIFY_OFFSET);
if (!icon) {
GFXERROR("Attempt to create icon control with cel %d/%d/%d (invalid)\n", view, loop, cel);
@@ -461,13 +461,13 @@ GfxList *sciw_new_list_control(GfxPort *port, reg_t ID, rect_t zone, int font_nr
if (font_height <= 0) {
GFXERROR("Attempt to create list control with invalid font %d\n", font_nr);
- list->widfree(GFXW(list));
+ delete list;
return NULL;
}
columns /= font_height;
- gfxw_set_id(GFXW(list), ID.segment, ID.offset);
+ gfxw_set_id(list, ID.segment, ID.offset);
arr_up[0] = SCI_SPECIAL_CHAR_ARROW_UP;
arr_down[0] = SCI_SPECIAL_CHAR_ARROW_DOWN;
@@ -481,15 +481,15 @@ GfxList *sciw_new_list_control(GfxPort *port, reg_t ID, rect_t zone, int font_nr
for (i = list_top; columns-- && i < entries_nr; i++) {
if (i != selection)
list->add(GFXWC(list),
- GFXW(gfxw_new_text(port->_visual->gfx_state, gfx_rect(zone.x, zone.y, zone.width - 2, font_height),
+ gfxw_new_text(port->_visual->gfx_state, gfx_rect(zone.x, zone.y, zone.width - 2, font_height),
font_nr, entries_list[i], ALIGN_LEFT, ALIGN_TOP,
- port->_color, port->_color, port->_bgcolor, kFontNoNewlines)));
+ port->_color, port->_color, port->_bgcolor, kFontNoNewlines));
else {
- list->add(GFXWC(list), GFXW(gfxw_new_box(port->_visual->gfx_state, gfx_rect(zone.x, zone.y, zone.width - 1, font_height),
- port->_color, port->_color, GFX_BOX_SHADE_FLAT)));
- list->add(GFXWC(list), GFXW(gfxw_new_text(port->_visual->gfx_state, gfx_rect(zone.x, zone.y, zone.width - 2, font_height),
+ list->add(GFXWC(list), gfxw_new_box(port->_visual->gfx_state, gfx_rect(zone.x, zone.y, zone.width - 1, font_height),
+ port->_color, port->_color, GFX_BOX_SHADE_FLAT));
+ list->add(GFXWC(list), gfxw_new_text(port->_visual->gfx_state, gfx_rect(zone.x, zone.y, zone.width - 2, font_height),
font_nr, entries_list[i], ALIGN_LEFT, ALIGN_TOP,
- port->_bgcolor, port->_bgcolor, port->_color, kFontNoNewlines)));
+ port->_bgcolor, port->_bgcolor, port->_color, kFontNoNewlines));
}
zone.y += font_height;
@@ -501,26 +501,26 @@ GfxList *sciw_new_list_control(GfxPort *port, reg_t ID, rect_t zone, int font_nr
zone.y = 0;
// Add up arrow
- list->add(GFXWC(list), GFXW(gfxw_new_text(port->_visual->gfx_state, gfx_rect(1, 0, zone.width - 2, 8),
+ list->add(GFXWC(list), gfxw_new_text(port->_visual->gfx_state, gfx_rect(1, 0, zone.width - 2, 8),
port->_font, arr_up, ALIGN_CENTER, ALIGN_CENTER,
- port->_color, port->_color, port->_bgcolor, 0)));
+ port->_color, port->_color, port->_bgcolor, 0));
// Add down arrow
- list->add(GFXWC(list), GFXW(gfxw_new_text(port->_visual->gfx_state, gfx_rect(1, zone.height - 9, zone.width - 2, 8),
+ list->add(GFXWC(list), gfxw_new_text(port->_visual->gfx_state, gfx_rect(1, zone.height - 9, zone.width - 2, 8),
port->_font, arr_down, ALIGN_CENTER, ALIGN_CENTER,
- port->_color, port->_color, port->_bgcolor, 0)));
+ port->_color, port->_color, port->_bgcolor, 0));
if (list_top & 1) { // Hack to work around aggressive caching
- list->add(GFXWC(list), GFXW(gfxw_new_rect(zone, port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL)));
- list->add(GFXWC(list), GFXW(gfxw_new_rect(gfx_rect(zone.x, zone.y + 10, zone.width, zone.height - 20),
- port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL)));
+ list->add(GFXWC(list), gfxw_new_rect(zone, port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
+ list->add(GFXWC(list), gfxw_new_rect(gfx_rect(zone.x, zone.y + 10, zone.width, zone.height - 20),
+ port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
} else {
list->add(GFXWC(list),
- GFXW(gfxw_new_rect(gfx_rect(zone.x, zone.y, zone.width, zone.height - 10),
- port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL)));
+ gfxw_new_rect(gfx_rect(zone.x, zone.y, zone.width, zone.height - 10),
+ port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
list->add(GFXWC(list),
- GFXW(gfxw_new_rect(gfx_rect(zone.x, zone.y + 10, zone.width, zone.height - 10),
- port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL)));
+ gfxw_new_rect(gfx_rect(zone.x, zone.y + 10, zone.width, zone.height - 10),
+ port->_color, GFX_LINE_MODE_CORRECT, GFX_LINE_STYLE_NORMAL));
}
return list;
@@ -538,19 +538,19 @@ void sciw_set_menubar(EngineState *s, GfxPort *status_bar, Menubar *menubar, int
int width = menu->_titleWidth + (MENU_BORDER_SIZE * 2);
if (i == selection) {
- list->add(GFXWC(list), GFXW(gfxw_new_box(status_bar->_visual->gfx_state, gfx_rect(offset, 0, width, MENU_BAR_HEIGHT),
- status_bar->_color, status_bar->_color, GFX_BOX_SHADE_FLAT)));
- list->add(GFXWC(list), GFXW(gfxw_new_text(s->gfx_state, gfx_rect(offset, 0, width, MENU_BAR_HEIGHT),
+ list->add(GFXWC(list), gfxw_new_box(status_bar->_visual->gfx_state, gfx_rect(offset, 0, width, MENU_BAR_HEIGHT),
+ status_bar->_color, status_bar->_color, GFX_BOX_SHADE_FLAT));
+ list->add(GFXWC(list), gfxw_new_text(s->gfx_state, gfx_rect(offset, 0, width, MENU_BAR_HEIGHT),
status_bar->_font, menu->_title.c_str(), ALIGN_CENTER, ALIGN_CENTER,
- status_bar->_bgcolor, status_bar->_bgcolor, status_bar->_color, kFontNoNewlines)));
+ status_bar->_bgcolor, status_bar->_bgcolor, status_bar->_color, kFontNoNewlines));
} else
- list->add(GFXWC(list), GFXW(gfxw_new_text(s->gfx_state, gfx_rect(offset, 0, width, MENU_BAR_HEIGHT),
+ list->add(GFXWC(list), gfxw_new_text(s->gfx_state, gfx_rect(offset, 0, width, MENU_BAR_HEIGHT),
status_bar->_font, menu->_title.c_str(), ALIGN_CENTER, ALIGN_CENTER,
- status_bar->_color, status_bar->_color, status_bar->_bgcolor, kFontNoNewlines)));
+ status_bar->_color, status_bar->_color, status_bar->_bgcolor, kFontNoNewlines));
offset += width;
}
- status_bar->add(GFXWC(status_bar), GFXW(list));
+ status_bar->add(GFXWC(status_bar), list);
finish_titlebar_list(s, list, status_bar);
}
@@ -577,7 +577,7 @@ GfxPort *sciw_new_menu(EngineState *s, GfxPort *status_bar, Menubar *menubar, in
retval = sciw_new_window(s, area, status_bar->_font, status_bar->_color, status_bar->_bgcolor,
0, status_bar->_color, status_bar->_bgcolor, NULL, kWindowNoDropShadow | kWindowTransparent);
- retval->set_visual(GFXW(retval), s->visual);
+ retval->set_visual(retval, s->visual);
for (i = 0; i < (int)menu->_items.size(); i++)
sciw_toggle_item(retval, menu, i, false);
@@ -597,7 +597,7 @@ static gfx_color_t un_prioritize(gfx_color_t col) {
GfxWidget *_make_menu_entry(MenuItem *item, int offset, int width, GfxPort *port, gfx_color_t color, gfx_color_t bgcolor, int ID, int gray) {
rect_t area = gfx_rect(MENU_BOX_LEFT_PADDING, 0, width - MENU_BOX_LEFT_PADDING, 10);
rect_t list_area = gfx_rect(port->zone.x, area.y + offset + port->zone.y, width, area.height);
- GfxList *list = (GfxList *) gfxw_set_id(GFXW(gfxw_new_list(list_area, 0)), ID, GFXW_NO_ID);
+ GfxList *list = (GfxList *) gfxw_set_id(gfxw_new_list(list_area, 0), ID, GFXW_NO_ID);
gfx_color_t xcolor = { PaletteEntry(), 0, 0, 0, 0};
color = un_prioritize(color);
@@ -605,32 +605,32 @@ GfxWidget *_make_menu_entry(MenuItem *item, int offset, int width, GfxPort *port
xcolor = gray ? color : bgcolor;
- list->add(GFXWC(list), GFXW(gfxw_new_box(port->_visual->gfx_state, area, bgcolor, bgcolor, GFX_BOX_SHADE_FLAT)));
- list->add(GFXWC(list), GFXW(gfxw_new_text(port->_visual->gfx_state, area, port->_font, item->_text.c_str(), ALIGN_LEFT, ALIGN_CENTER,
- color, xcolor, bgcolor, kFontNoNewlines)));
+ list->add(GFXWC(list), gfxw_new_box(port->_visual->gfx_state, area, bgcolor, bgcolor, GFX_BOX_SHADE_FLAT));
+ list->add(GFXWC(list), gfxw_new_text(port->_visual->gfx_state, area, port->_font, item->_text.c_str(), ALIGN_LEFT, ALIGN_CENTER,
+ color, xcolor, bgcolor, kFontNoNewlines));
if (!item->_keytext.empty()) {
area.width -= MENU_BOX_RIGHT_PADDING;
- list->add(GFXWC(list), GFXW(gfxw_new_text(port->_visual->gfx_state, area, port->_font, item->_keytext.c_str(), ALIGN_RIGHT, ALIGN_CENTER,
- color, xcolor, bgcolor, kFontNoNewlines)));
+ list->add(GFXWC(list), gfxw_new_text(port->_visual->gfx_state, area, port->_font, item->_keytext.c_str(), ALIGN_RIGHT, ALIGN_CENTER,
+ color, xcolor, bgcolor, kFontNoNewlines));
}
- return GFXW(list);
+ return list;
}
GfxWidget *_make_menu_hbar(int offset, int width, GfxPort *port, gfx_color_t color, gfx_color_t bgcolor, int ID) {
rect_t area = gfx_rect(0, 0, width, 10);
rect_t list_area = gfx_rect(area.x + port->zone.x, area.y + offset + port->zone.y, area.width, area.height);
- GfxList *list = (GfxList *) gfxw_set_id(GFXW(gfxw_new_list(list_area, 0)), ID, GFXW_NO_ID);
+ GfxList *list = (GfxList *) gfxw_set_id(gfxw_new_list(list_area, 0), ID, GFXW_NO_ID);
color = un_prioritize(color);
bgcolor = un_prioritize(bgcolor);
- list->add(GFXWC(list), GFXW(gfxw_new_box(port->_visual->gfx_state, area, bgcolor, bgcolor, GFX_BOX_SHADE_FLAT)));
- list->add(GFXWC(list), GFXW(gfxw_new_line(Common::Point(0, 5), Common::Point(width, 5), color,
- GFX_LINE_MODE_FAST, GFX_LINE_STYLE_STIPPLED)));
+ list->add(GFXWC(list), gfxw_new_box(port->_visual->gfx_state, area, bgcolor, bgcolor, GFX_BOX_SHADE_FLAT));
+ list->add(GFXWC(list), gfxw_new_line(Common::Point(0, 5), Common::Point(width, 5), color,
+ GFX_LINE_MODE_FAST, GFX_LINE_STYLE_STIPPLED));
- return GFXW(list);
+ return list;
}
GfxPort *sciw_toggle_item(GfxPort *menu_port, Menu *menu, int selection, bool selected) {
@@ -643,11 +643,11 @@ GfxPort *sciw_toggle_item(GfxPort *menu_port, Menu *menu, int selection, bool se
MenuItem *item = &menu->_items[selection];
if (item->_type == MENU_TYPE_NORMAL)
- menu_port->add(GFXWC(menu_port), GFXW(_make_menu_entry(item, selection * 10, menu_port->zone.width + 1,
- menu_port, fgColor, bgColor, selection + MAGIC_ID_OFFSET, item->_enabled)));
+ menu_port->add(GFXWC(menu_port), _make_menu_entry(item, selection * 10, menu_port->zone.width + 1,
+ menu_port, fgColor, bgColor, selection + MAGIC_ID_OFFSET, item->_enabled));
else
- menu_port->add(GFXWC(menu_port), GFXW(_make_menu_hbar(selection * 10, menu_port->zone.width + 1,
- menu_port, fgColor, bgColor, selection + MAGIC_ID_OFFSET)));
+ menu_port->add(GFXWC(menu_port), _make_menu_hbar(selection * 10, menu_port->zone.width + 1,
+ menu_port, fgColor, bgColor, selection + MAGIC_ID_OFFSET));
return menu_port;
}
diff --git a/engines/sci/gfx/gfx_state_internal.h b/engines/sci/gfx/gfx_state_internal.h
index 6794c13cb4..e4548e3aac 100644
--- a/engines/sci/gfx/gfx_state_internal.h
+++ b/engines/sci/gfx/gfx_state_internal.h
@@ -102,7 +102,6 @@ struct GfxWidget {
public:
// TODO: Replace the following with virtual methods
gfxw_point_op *draw; /* Draw widget (if dirty) and anything else required for the display to be consistent */
- gfxw_op *widfree; /* Remove widget (and any sub-widgets it may contain) */
gfxw_op *tag; /* Tag the specified widget */
gfxw_op_int *print; /* Prints the widget's contents, using sciprintf. Second parameter is indentation. */
gfxw_bin_op *compare_to; /* a.compare_to(a, b) returns <0 if a<b, =0 if a=b and >0 if a>b */
@@ -111,7 +110,14 @@ public:
gfxw_bin_op *superarea_of; /* a superarea_of b <=> for each pixel of b there exists an opaque pixel in a at the same location */
gfxw_visual_op *set_visual; /* Sets the visual the widget belongs to */
+public:
GfxWidget(gfxw_widget_type_t type);
+
+ /*
+ * The widget automatically removes itself from its owner, if it has one.
+ * Deleting a container will recursively free all of its
+ * contents.
+ */
virtual ~GfxWidget();
};
@@ -178,6 +184,8 @@ struct GfxText : public GfxWidget {
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);
+
+ ~GfxText();
};
@@ -203,6 +211,7 @@ public:
gfxw_container_op *add; /* Append widget to an appropriate position (for view and control lists) */
GfxContainer(rect_t area, gfxw_widget_type_t type);
+ ~GfxContainer();
};
@@ -239,6 +248,7 @@ struct GfxPort : public GfxContainer {
byte gray_text; /* Whether text is 'grayed out' (dithered) */
GfxPort(GfxVisual *visual, rect_t area, gfx_color_t fgcolor, gfx_color_t bgcolor);
+ ~GfxPort();
};
} // End of namespace Sci
diff --git a/engines/sci/gfx/gfx_widgets.cpp b/engines/sci/gfx/gfx_widgets.cpp
index 8be8077c88..40df9a142b 100644
--- a/engines/sci/gfx/gfx_widgets.cpp
+++ b/engines/sci/gfx/gfx_widgets.cpp
@@ -146,7 +146,6 @@ GfxWidget::GfxWidget(gfxw_widget_type_t type_) {
_widgetPriority = -1;
draw = NULL;
- widfree = NULL;
tag = NULL;
print = _gfxwop_print_empty;
compare_to = NULL;
@@ -179,32 +178,9 @@ static int verify_widget(GfxWidget *widget) {
return 0;
}
-GfxWidget::~GfxWidget() {
- _magic = GFXW_MAGIC_INVALID;
- _gfxw_debug_remove_widget(this);
-}
-
#define VERIFY_WIDGET(w) \
if (verify_widget((GfxWidget *)(w))) { GFXERROR("Error occured while validating widget\n"); }
-static void _gfxw_unallocate_widget(gfx_state_t *state, GfxWidget *widget) {
- if (GFXW_IS_TEXT(widget)) {
- GfxText *text = (GfxText *) widget;
-
- if (text->text_handle) {
- if (!state) {
- GFXERROR("Attempt to free text without supplying mode to free it from!\n");
- BREAKPOINT();
- } else {
- gfxop_free_text(state, text->text_handle);
- text->text_handle = NULL;
- }
- }
- }
-
- delete widget;
-}
-
#define GFX_ASSERT(_x) \
{ \
int retval = (_x); \
@@ -283,10 +259,9 @@ static int _gfxwop_basic_should_replace(GfxWidget *widget, GfxWidget *other) {
return 0;
}
-static void _gfxw_set_ops(GfxWidget *widget, gfxw_point_op *draw, gfxw_op *free, gfxw_op *tag, gfxw_op_int *print,
+static void _gfxw_set_ops(GfxWidget *widget, gfxw_point_op *draw, gfxw_op *tag, gfxw_op_int *print,
gfxw_bin_op *compare_to, gfxw_bin_op *equals, gfxw_bin_op *superarea_of) {
widget->draw = draw;
- widget->widfree = free;
widget->tag = tag;
widget->print = print;
widget->compare_to = compare_to;
@@ -321,9 +296,9 @@ void gfxw_remove_widget_from_container(GfxContainer *container, GfxWidget *widge
if (!*seekerp) {
GFXERROR("Internal error: Attempt to remove widget from container it was not contained in!\n");
sciprintf("Widget:");
- widget->print(GFXW(widget), 1);
+ widget->print(widget, 1);
sciprintf("Container:");
- widget->print(GFXW(container), 1);
+ widget->print(container, 1);
BREAKPOINT();
return;
}
@@ -336,24 +311,20 @@ void gfxw_remove_widget_from_container(GfxContainer *container, GfxWidget *widge
widget->_next = NULL;
}
-static int _gfxwop_basic_free(GfxWidget *widget) {
- GfxVisual *visual = widget->_visual;
- gfx_state_t *state = (visual) ? visual->gfx_state : NULL;
-
- DDIRTY(stderr, "BASIC-FREE: SomeAddDirty\n");
+GfxWidget::~GfxWidget() {
+ DDIRTY(stderr, "BASIC-FREE: SomeAddDirty\n"); // FIXME: What is this?
- if (widget->_parent) {
- if (GFXW_IS_CONTAINER(widget))
- widget->_parent->add_dirty_abs(widget->_parent, widget->_bounds, 1);
+ if (_parent) {
+ if (GFXW_IS_CONTAINER(this))
+ _parent->add_dirty_abs(_parent, _bounds, 1);
else
- widget->_parent->add_dirty_rel(widget->_parent, widget->_bounds, 1);
+ _parent->add_dirty_rel(_parent, _bounds, 1);
- gfxw_remove_widget_from_container(widget->_parent, widget);
+ gfxw_remove_widget_from_container(_parent, this);
}
- _gfxw_unallocate_widget(state, widget);
-
- return 0;
+ _magic = GFXW_MAGIC_INVALID;
+ _gfxw_debug_remove_widget(this);
}
static int _gfxwop_basic_tag(GfxWidget *widget) {
@@ -448,7 +419,7 @@ static int _gfxwop_box_equals(GfxWidget *widget, GfxWidget *other) {
}
void _gfxw_set_ops_BOX(GfxWidget *widget) {
- _gfxw_set_ops(GFXW(widget), _gfxwop_box_draw, _gfxwop_basic_free, _gfxwop_basic_tag, _gfxwop_box_print,
+ _gfxw_set_ops(widget, _gfxwop_box_draw, _gfxwop_basic_tag, _gfxwop_box_print,
_gfxwop_basic_compare_to, _gfxwop_box_equals, _gfxwop_box_superarea_of);
}
@@ -531,14 +502,14 @@ static int _gfxwop_rect_draw(GfxWidget *widget, Common::Point pos) {
}
static int _gfxwop_rect_print(GfxWidget *rect, int indentation) {
- _gfxw_print_widget(GFXW(rect), indentation);
+ _gfxw_print_widget(rect, indentation);
sciprintf("RECT");
return 0;
}
void _gfxw_set_ops_RECT(GfxWidget *prim) {
- _gfxw_set_ops(GFXW(prim), _gfxwop_rect_draw, _gfxwop_basic_free, _gfxwop_basic_tag, _gfxwop_rect_print,
+ _gfxw_set_ops(prim, _gfxwop_rect_draw, _gfxwop_basic_tag, _gfxwop_rect_print,
_gfxwop_basic_compare_to, _gfxwop_primitive_equals, _gfxwop_basic_superarea_of);
}
@@ -583,7 +554,7 @@ static int _gfxwop_line_print(GfxWidget *widget, int indentation) {
}
void _gfxw_set_ops_LINE(GfxWidget *prim) {
- _gfxw_set_ops(GFXW(prim), _gfxwop_line_draw, _gfxwop_basic_free, _gfxwop_basic_tag, _gfxwop_line_print,
+ _gfxw_set_ops(prim, _gfxwop_line_draw, _gfxwop_basic_tag, _gfxwop_line_print,
_gfxwop_basic_compare_to, _gfxwop_primitive_equals, _gfxwop_basic_superarea_of);
}
@@ -681,7 +652,7 @@ static int _gfxwop_static_view_print(GfxWidget *widget, int indentation) {
}
void _gfxw_set_ops_VIEW(GfxWidget *view, char stat) {
- _gfxw_set_ops(GFXW(view), (stat) ? _gfxwop_static_view_draw : _gfxwop_view_draw, _gfxwop_basic_free,
+ _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_compare_to, _gfxwop_basic_equals, _gfxwop_basic_superarea_of);
}
@@ -818,7 +789,7 @@ static int _gfxwop_dyn_view_compare_to(GfxWidget *widget, GfxWidget *other) {
}
void _gfxw_set_ops_DYNVIEW(GfxWidget *widget) {
- _gfxw_set_ops(GFXW(widget), _gfxwop_dyn_view_draw, _gfxwop_basic_free, _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);
}
@@ -897,11 +868,20 @@ GfxDynView::GfxDynView(gfx_state_t *state, Common::Point pos_, int z_, int view_
//*** Text ***
-static int _gfxwop_text_free(GfxWidget *widget) {
- GfxText *text = (GfxText *)widget;
- free(text->text);
+GfxText::~GfxText() {
+ free(text);
+ text = NULL;
- return _gfxwop_basic_free(widget);
+ if (text_handle) {
+ gfx_state_t *state = _visual ? _visual->gfx_state : NULL;
+ if (!state) {
+ GFXERROR("Attempt to free text without supplying mode to free it from!\n");
+ BREAKPOINT();
+ } else {
+ gfxop_free_text(state, text_handle);
+ text_handle = NULL;
+ }
+ }
}
static int _gfxwop_text_draw(GfxWidget *widget, Common::Point pos) {
@@ -974,7 +954,7 @@ static int _gfxwop_text_compare_to(GfxWidget *widget, GfxWidget *other) {
}
void _gfxw_set_ops_TEXT(GfxWidget *widget) {
- _gfxw_set_ops(GFXW(widget), _gfxwop_text_alloc_and_draw, _gfxwop_text_free, _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_basic_superarea_of);
widget->should_replace = _gfxwop_text_should_replace;
@@ -1038,12 +1018,12 @@ static int _gfxwop_container_add_dirty_rel(GfxContainer *cont, rect_t rect, int
return cont->add_dirty_abs(cont, _move_rect(rect, Common::Point(cont->zone.x, cont->zone.y)), propagate);
}
-static void _gfxw_set_container_ops(GfxContainer *container, gfxw_point_op *draw, gfxw_op *free, 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 *superarea_of, gfxw_visual_op *set_visual,
gfxw_unary_container_op *free_tagged, gfxw_unary_container_op *free_contents,
gfxw_rect_op *add_dirty, gfxw_container_op *add) {
- _gfxw_set_ops(GFXW(container), draw, free, tag, print, compare_to, equals, superarea_of);
+ _gfxw_set_ops(container, draw, tag, print, compare_to, equals, superarea_of);
container->free_tagged = free_tagged;
container->free_contents = free_contents;
@@ -1196,20 +1176,17 @@ static int _gfxwop_container_draw_contents(GfxWidget *widget, GfxWidget *content
return 0;
}
-static int _gfxwop_container_free(GfxWidget *widget) {
- GfxContainer *container = (GfxContainer *)widget;
- GfxWidget *seeker = container->contents;
+GfxContainer::~GfxContainer() {
+ GfxWidget *seeker = contents;
while (seeker) {
GfxWidget *next = seeker->_next;
- seeker->widfree(seeker);
+ delete seeker;
seeker = next;
}
- recursively_free_dirty_rects(container->dirty);
- container->dirty = NULL;
-
- return _gfxwop_basic_free(widget);
+ recursively_free_dirty_rects(dirty);
+ dirty = NULL;
}
static int _gfxwop_container_tag(GfxWidget *widget) {
@@ -1247,16 +1224,16 @@ static int _gfxwop_container_set_visual(GfxWidget *widget, GfxVisual *visual) {
}
static int _gfxwop_container_free_tagged(GfxContainer *container) {
- GfxWidget *seekerp = (container->contents);
+ GfxWidget *seekerp = container->contents;
while (seekerp) {
GfxWidget *redshirt = seekerp;
if (redshirt->_flags & GFXW_FLAG_TAGGED) {
seekerp = (redshirt->_next);
- redshirt->widfree(redshirt);
+ delete redshirt;
} else
- seekerp = (seekerp)->_next;
+ seekerp = seekerp->_next;
}
return 0;
@@ -1267,7 +1244,7 @@ static int _gfxwop_container_free_contents(GfxContainer *container) {
while (seeker) {
GfxWidget *next = seeker->_next;
- seeker->widfree(seeker);
+ delete seeker;
seeker = next;
}
return 0;
@@ -1283,9 +1260,9 @@ static void _gfxw_dirtify_container(GfxContainer *container, GfxWidget *widget)
static int _parentize_widget(GfxContainer *container, GfxWidget *widget) {
if (widget->_parent) {
GFXERROR("_gfxwop_container_add(): Attempt to give second parent node to widget!\nWidget:");
- widget->print(GFXW(widget), 3);
+ widget->print(widget, 3);
sciprintf("\nContainer:");
- container->print(GFXW(container), 3);
+ container->print(container, 3);
return 1;
}
@@ -1316,12 +1293,12 @@ static int _gfxw_container_id_equals(GfxContainer *container, GfxWidget *widget)
return 0;
if ((*seekerp)->equals(*seekerp, widget) && !(*seekerp)->should_replace(*seekerp, widget)) {
- widget->widfree(widget);
+ delete widget;
(*seekerp)->_flags &= ~GFXW_FLAG_TAGGED;
return 1;
} else {
if (!(widget->_flags & GFXW_FLAG_MULTI_ID))
- (*seekerp)->widfree(*seekerp);
+ delete *seekerp;
return 0;
}
}
@@ -1450,9 +1427,9 @@ int _gfxwop_ordered_add(GfxContainer *container, GfxWidget *widget, int compare_
if (widget->_next) {
GFXERROR("_gfxwop_sorted_list_add(): Attempt to add widget to two lists!\nWidget:");
- widget->print(GFXW(widget), 3);
+ widget->print(widget, 3);
sciprintf("\nList:");
- container->print(GFXW(container), 3);
+ container->print(container, 3);
BREAKPOINT();
return 1;
@@ -1463,17 +1440,17 @@ int _gfxwop_ordered_add(GfxContainer *container, GfxWidget *widget, int compare_
while (*seekerp && (compare_all || (widget->compare_to(widget, *seekerp) >= 0))) {
- if (widget->equals(GFXW(widget), GFXW(*seekerp))) {
+ if (widget->equals(widget, *seekerp)) {
if (compare_all) {
if ((*seekerp)->_visual)
- (*seekerp)->widfree(GFXW(*seekerp)); // If it's a fresh widget
+ delete *seekerp; // If it's a fresh widget
else
- gfxw_annihilate(GFXW(*seekerp));
+ gfxw_annihilate(*seekerp);
return _gfxwop_ordered_add(container, widget, compare_all); // We might have destroyed the container's contents
} else {
widget->_next = (*seekerp)->_next;
- (*seekerp)->widfree(GFXW(*seekerp));
+ delete *seekerp;
*seekerp = widget;
return (_parentize_widget(container, widget));
}
@@ -1496,7 +1473,7 @@ static int _gfxwop_sorted_list_add(GfxContainer *container, GfxWidget *widget) {
void _gfxw_set_ops_LIST(GfxContainer *list, char sorted) {
_gfxw_set_container_ops((GfxContainer *)list, sorted ? _gfxwop_sorted_list_draw : _gfxwop_list_draw,
- _gfxwop_container_free, _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_superarea_of, _gfxwop_container_set_visual,
@@ -1545,21 +1522,6 @@ static int _gfxwop_visual_draw(GfxWidget *widget, Common::Point pos) {
return 0;
}
-static int _gfxwop_visual_free(GfxWidget *widget) {
- GfxVisual *visual = (GfxVisual *) widget;
- int retval;
-
- if (!GFXW_IS_VISUAL(visual)) {
- GFXERROR("_gfxwop_visual_free() called on non-visual!Widget was: ");
- widget->print(widget, 3);
- return 1;
- }
-
- retval = _gfxwop_container_free(widget);
-
- return 0;
-}
-
static int _gfxwop_visual_print(GfxWidget *widget, int indentation) {
int comma = 0;
GfxVisual *visual = (GfxVisual *) widget;
@@ -1588,7 +1550,7 @@ static int _gfxwop_visual_print(GfxWidget *widget, int indentation) {
}
static int _gfxwop_visual_set_visual(GfxWidget *self, GfxVisual *visual) {
- if (self != GFXW(visual)) {
+ if (self != visual) {
GFXWARN("Attempt to set a visual's parent visual to something else!\n");
} else {
GFXWARN("Attempt to set a visual's parent visual!\n");
@@ -1598,7 +1560,7 @@ static int _gfxwop_visual_set_visual(GfxWidget *self, GfxVisual *visual) {
}
void _gfxw_set_ops_VISUAL(GfxContainer *visual) {
- _gfxw_set_container_ops((GfxContainer *)visual, _gfxwop_visual_draw, _gfxwop_visual_free,
+ _gfxw_set_container_ops((GfxContainer *)visual, _gfxwop_visual_draw,
_gfxwop_container_tag, _gfxwop_visual_print, _gfxwop_basic_compare_to,
_gfxwop_basic_equals, _gfxwop_basic_superarea_of, _gfxwop_visual_set_visual,
_gfxwop_container_free_tagged, _gfxwop_container_free_contents,
@@ -1650,7 +1612,7 @@ static int _gfxwop_port_draw(GfxWidget *widget, Common::Point pos) {
if (port->decorations) {
DDIRTY(stderr, "Getting/applying deco dirty (multi)\n");
_gfxwop_add_dirty_rects(GFXWC(port->decorations), port->dirty);
- if (port->decorations->draw(GFXW(port->decorations), gfxw_point_zero)) {
+ if (port->decorations->draw(port->decorations, gfxw_point_zero)) {
port->decorations->dirty = NULL;
return 1;
}
@@ -1666,29 +1628,20 @@ static int _gfxwop_port_draw(GfxWidget *widget, Common::Point pos) {
return 0;
}
-static int _gfxwop_port_free(GfxWidget *widget) {
- GfxPort *port = (GfxPort *) widget;
-
- if (port->_visual) {
- GfxVisual *visual = port->_visual;
- int ID = port->_ID;
-
- if (ID < 0 || ID >= (int)visual->_portRefs.size()) {
- GFXWARN("Attempt to free port #%d; allowed: [0..%d]!\n", ID, visual->_portRefs.size());
- return GFX_ERROR;
+GfxPort::~GfxPort() {
+ if (_visual) {
+ if (_ID < 0 || _ID >= (int)_visual->_portRefs.size()) {
+ error("Attempt to free port #%d; allowed: [0..%d]!\n", _ID, _visual->_portRefs.size());
}
- if (visual->_portRefs[ID] != port) {
- GFXWARN("While freeing port %d: Port is at %p, but port list indicates %p", ID, (void *)port, (void *)visual->_portRefs[ID]);
+ if (_visual->_portRefs[_ID] != this) {
+ GFXWARN("While freeing port %d: Port is at %p, but port list indicates %p", _ID, (void *)this, (void *)_visual->_portRefs[_ID]);
} else
- visual->_portRefs[ID] = NULL;
+ _visual->_portRefs[_ID] = NULL;
}
- if (port->decorations)
- port->decorations->widfree(GFXW(port->decorations));
-
- return _gfxwop_container_free(widget);
+ delete decorations;
}
static int _gfxwop_port_print(GfxWidget *widget, int indentation) {
@@ -1699,9 +1652,9 @@ static int _gfxwop_port_print(GfxWidget *widget, int indentation) {
sciprintf(" font=%d drawpos=(%d,%d)", port->_font, port->draw_pos.x, port->draw_pos.y);
if (port->gray_text)
sciprintf(" (gray)");
- _w_gfxwop_container_print(GFXW(port), indentation);
+ _w_gfxwop_container_print(port, indentation);
- return _w_gfxwop_container_print_contents("decorations", GFXW(port->decorations), indentation);
+ return _w_gfxwop_container_print_contents("decorations", port->decorations, indentation);
}
static int _gfxwop_port_superarea_of(GfxWidget *self, GfxWidget *other) {
@@ -1718,7 +1671,7 @@ static int _gfxwop_port_set_visual(GfxWidget *widget, GfxVisual *visual) {
widget->_visual = visual;
if (decorations)
- if (decorations->set_visual(GFXW(decorations), visual)) {
+ if (decorations->set_visual(decorations, visual)) {
GFXWARN("Setting the visual for decorations failed for port ");
widget->print(widget, 1);
return 1;
@@ -1772,7 +1725,7 @@ static int _gfxwop_port_add(GfxContainer *container, GfxWidget *widget) {
}
void _gfxw_set_ops_PORT(GfxContainer *widget) {
- _gfxw_set_container_ops((GfxContainer *)widget, _gfxwop_port_draw, _gfxwop_port_free, _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_port_set_visual, _gfxwop_container_free_tagged, _gfxwop_container_free_contents,
_gfxwop_port_add_dirty, _gfxwop_port_add);
@@ -1820,8 +1773,7 @@ GfxPort *gfxw_remove_port(GfxVisual *visual, GfxPort *port) {
if (port->port_flags & kWindowAutoRestore)
gfxw_restore_snapshot(visual, port->restore_snap);
- if (port->widfree(GFXW(port)))
- return parent;
+ delete port;
while (parent && !GFXW_IS_PORT(parent))
parent = (GfxPort *)parent->_parent; // Ascend through ancestors
@@ -1958,7 +1910,7 @@ void _gfxw_free_contents_appropriately(GfxContainer *container, gfxw_snapshot_t
if (gfxw_widget_matches_snapshot(snapshot, widget) && !(widget->_flags & GFXW_FLAG_IMMUNE_TO_SNAPSHOTS)
&& (priority == MAGIC_FREE_NUMBER || priority <= widget->_widgetPriority || widget->_widgetPriority == -1)) {
- widget->widfree(widget);
+ delete widget;
} else {
if (GFXW_IS_CONTAINER(widget))
_gfxw_free_contents_appropriately(GFXWC(widget), snapshot, priority);
@@ -1989,7 +1941,7 @@ void gfxw_annihilate(GfxWidget *widget) {
widget_priority = widget->_widgetPriority;
}
- widget->widfree(GFXW(widget));
+ delete widget;
if (free_overdrawn)
_gfxw_free_contents_appropriately(GFXWC(visual), &snapshot, widget_priority);
@@ -1999,10 +1951,10 @@ GfxDynView *gfxw_picviewize_dynview(GfxDynView *dynview) {
dynview->_type = GFXW_PIC_VIEW;
dynview->_flags |= GFXW_FLAG_DIRTY;
- _gfxw_set_ops_PICVIEW(GFXW(dynview));
+ _gfxw_set_ops_PICVIEW(dynview);
if (dynview->_parent)
- _gfxw_dirtify_container(dynview->_parent, GFXW(dynview));
+ _gfxw_dirtify_container(dynview->_parent, dynview);
return dynview;
}
diff --git a/engines/sci/gfx/gfx_widgets.h b/engines/sci/gfx/gfx_widgets.h
index 20e970fa99..509b2f947d 100644
--- a/engines/sci/gfx/gfx_widgets.h
+++ b/engines/sci/gfx/gfx_widgets.h
@@ -82,13 +82,10 @@ struct GfxWidget;
/*********************************/
-#define GFXW(foo) (foo)
-/* Typecast an arbitrary widget to GfxWidget*. Might eventually be changed to do tests as well. */
-
#define GFXWC(foo) ((GfxContainer *) foo)
/* Typecasts a container widget to gfxw_container_widget_t *. */
-/* gfxw_point_zero is declared in gfx/widgets.c */
+/* gfxw_point_zero is declared in gfx/widgets.cpp */
extern Common::Point gfxw_point_zero;
/*********************/
@@ -110,15 +107,6 @@ extern Common::Point gfxw_point_zero;
** a container widget will recursively draw all of its contents.
**
**
-** -- widfree(GfxWidget *self)
-** Frees all memory associated to the widget
-** Parameters: (GfxWidget *) self: self reference
-** Returns : (int) 0
-** The widget automatically removes itself from its owner, if it has one.
-** Invoking this operation on a container will recursively free all of its
-** contents.
-**
-**
** -- tag(GfxWidget *self)
** Tags the specified widget
** Parameters: (GfxWidget *) self: self reference