aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gfx
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/sci/gfx
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/sci/gfx')
-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
4 files changed, 153 insertions, 203 deletions
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