diff options
author | Martin Kiewitz | 2009-10-06 16:36:28 +0000 |
---|---|---|
committer | Martin Kiewitz | 2009-10-06 16:36:28 +0000 |
commit | ca9f08c6244a51098669993ccd829afefe33ff72 (patch) | |
tree | c9b2464b8aa8c6e9032de9cb618f678c4523a5a7 /engines | |
parent | d2fdc8fc79839ebb7cc2b2e61644651d534e34a5 (diff) | |
download | scummvm-rg350-ca9f08c6244a51098669993ccd829afefe33ff72.tar.gz scummvm-rg350-ca9f08c6244a51098669993ccd829afefe33ff72.tar.bz2 scummvm-rg350-ca9f08c6244a51098669993ccd829afefe33ff72.zip |
SCI/newgui: kHiLite support
svn-id: r44701
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/kgraphics.cpp | 12 | ||||
-rw-r--r-- | engines/sci/gui/gui.cpp | 52 | ||||
-rw-r--r-- | engines/sci/gui/gui.h | 6 | ||||
-rw-r--r-- | engines/sci/gui32/gui32.cpp | 12 | ||||
-rw-r--r-- | engines/sci/gui32/gui32.h | 6 |
5 files changed, 50 insertions, 38 deletions
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp index 06dcd73c95..e3293dad9c 100644 --- a/engines/sci/engine/kgraphics.cpp +++ b/engines/sci/engine/kgraphics.cpp @@ -1394,7 +1394,7 @@ reg_t kEditControl(EngineState *s, int argc, reg_t *argv) { return s->r_acc; } -static void _k_draw_control(EngineState *s, reg_t obj, bool inverse) { +static void _k_draw_control(EngineState *s, reg_t obj, bool hilite) { SegManager *segMan = s->_segMan; int x = (int16)GET_SEL32V(obj, nsLeft); int y = (int16)GET_SEL32V(obj, nsTop); @@ -1423,13 +1423,13 @@ static void _k_draw_control(EngineState *s, reg_t obj, bool inverse) { switch (type) { case K_CONTROL_BUTTON: debugC(2, kDebugLevelGraphics, "drawing button %04x:%04x to %d,%d\n", PRINT_REG(obj), x, y); - s->gui->drawControlButton(rect, obj, s->strSplit(text.c_str(), NULL).c_str(), font_nr, state, inverse); + s->gui->drawControlButton(rect, obj, s->strSplit(text.c_str(), NULL).c_str(), font_nr, state, hilite); return; case K_CONTROL_TEXT: mode = (gfx_alignment_t) GET_SEL32V(obj, mode); debugC(2, kDebugLevelGraphics, "drawing text %04x:%04x ('%s') to %d,%d, mode=%d\n", PRINT_REG(obj), text.c_str(), x, y, mode); - s->gui->drawControlText(rect, obj, s->strSplit(text.c_str(), NULL).c_str(), font_nr, mode, state, inverse); + s->gui->drawControlText(rect, obj, s->strSplit(text.c_str(), NULL).c_str(), font_nr, mode, state, hilite); return; case K_CONTROL_EDIT: @@ -1442,12 +1442,12 @@ static void _k_draw_control(EngineState *s, reg_t obj, bool inverse) { cursor = text.size(); // update_cursor_limits(&s->save_dir_edit_offset, &cursor, max); FIXME: get rid of this? - ADD_TO_CURRENT_PICTURE_PORT(sciw_new_edit_control(s->port, obj, area, text.c_str(), font_nr, (unsigned)cursor, (int8)inverse)); + ADD_TO_CURRENT_PICTURE_PORT(sciw_new_edit_control(s->port, obj, area, text.c_str(), font_nr, (unsigned)cursor, (int8)hilite)); break; case K_CONTROL_ICON: debugC(2, kDebugLevelGraphics, "drawing icon control %04x:%04x to %d,%d\n", PRINT_REG(obj), x, y - 1); - s->gui->drawControlIcon(rect, obj, view, loop, cel, state, inverse); + s->gui->drawControlIcon(rect, obj, view, loop, cel, state, hilite); return; case K_CONTROL_CONTROL: @@ -1506,7 +1506,7 @@ static void _k_draw_control(EngineState *s, reg_t obj, bool inverse) { } ADD_TO_CURRENT_PICTURE_PORT(sciw_new_list_control(s->port, obj, area, font_nr, entries_list, entries_nr, - list_top, selection, (int8)inverse)); + list_top, selection, (int8)hilite)); free(entries_list); delete[] strings; } diff --git a/engines/sci/gui/gui.cpp b/engines/sci/gui/gui.cpp index 33189cd015..acb04cf428 100644 --- a/engines/sci/gui/gui.cpp +++ b/engines/sci/gui/gui.cpp @@ -279,36 +279,48 @@ void SciGui::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo ce _screen->copyToScreen(); } -void SciGui::drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool inverse) { - rect.grow(1); - _gfx->EraseRect(rect); - _gfx->FrameRect(rect); - rect.grow(-2); - _gfx->TextFace(style & 1 ? 0 : 1); - _gfx->TextBox(text, 0, rect, 1, fontId); - _gfx->TextFace(0); - if (style & 8) { // selected +void SciGui::drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite) { + if (!hilite) { rect.grow(1); + _gfx->EraseRect(rect); _gfx->FrameRect(rect); + rect.grow(-2); + _gfx->TextFace(style & 1 ? 0 : 1); + _gfx->TextBox(text, 0, rect, 1, fontId); + _gfx->TextFace(0); + if (style & 8) { // selected + rect.grow(1); + _gfx->FrameRect(rect); + } + } else { + _gfx->InvertRect(rect); } _screen->copyToScreen(); } -void SciGui::drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool inverse) { - rect.grow(1); - _gfx->EraseRect(rect); - rect.grow(-1); - _gfx->TextBox(text, 0, rect, mode, fontId); - if (style & 8) { // selected - _gfx->FrameRect(rect); +void SciGui::drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool hilite) { + if (!hilite) { + rect.grow(1); + _gfx->EraseRect(rect); + rect.grow(-1); + _gfx->TextBox(text, 0, rect, mode, fontId); + if (style & 8) { // selected + _gfx->FrameRect(rect); + } + } else { + _gfx->InvertRect(rect); } _screen->copyToScreen(); } -void SciGui::drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 style, bool inverse) { - _gfx->drawCel(viewId, loopNo, celNo, rect.left, rect.top, 255, 0); - if (style & 0x20) { - _gfx->FrameRect(rect); +void SciGui::drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 style, bool hilite) { + if (!hilite) { + _gfx->drawCel(viewId, loopNo, celNo, rect.left, rect.top, 255, 0); + if (style & 0x20) { + _gfx->FrameRect(rect); + } + } else { + _gfx->InvertRect(rect); } _screen->copyToScreen(); } diff --git a/engines/sci/gui/gui.h b/engines/sci/gui/gui.h index 79185deddf..a6262771a9 100644 --- a/engines/sci/gui/gui.h +++ b/engines/sci/gui/gui.h @@ -65,9 +65,9 @@ public: virtual void drawStatus(const char *text, int16 colorPen, int16 colorBack); virtual void drawPicture(GuiResourceId pictureId, uint16 showStyle, uint16 flags, int16 EGApaletteNo); virtual void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo); - virtual void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool inverse); - virtual void drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool inverse); - virtual void drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 style, bool inverse); + virtual void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite); + virtual void drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool hilite); + virtual void drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, int16 style, bool hilite); virtual void graphFillBoxForeground(Common::Rect rect); virtual void graphFillBoxBackground(Common::Rect rect); diff --git a/engines/sci/gui32/gui32.cpp b/engines/sci/gui32/gui32.cpp index 1a05c9a20f..9e91f2b0c5 100644 --- a/engines/sci/gui32/gui32.cpp +++ b/engines/sci/gui32/gui32.cpp @@ -583,27 +583,27 @@ void SciGui32::drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo FULL_REDRAW(); } -void SciGui32::drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool inverse) { +void SciGui32::drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite) { rect_t area = gfx_rect(rect.left, rect.top, rect.width(), rect.height()); ADD_TO_CURRENT_PICTURE_PORT(sciw_new_button_control(s->port, obj, area, text, fontId, - (int8)(style & kControlStateFramed), (int8)inverse, (int8)(style & kControlStateDisabled))); + (int8)(style & kControlStateFramed), (int8)hilite, (int8)(style & kControlStateDisabled))); if (!s->pic_not_valid) FULL_REDRAW(); } -void SciGui32::drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool inverse) { +void SciGui32::drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool hilite) { rect_t area = gfx_rect(rect.left, rect.top, rect.width(), rect.height()); ADD_TO_CURRENT_PICTURE_PORT(sciw_new_text_control(s->port, obj, area, text, fontId, (gfx_alignment_t) mode, - (int8)(!!(style & kControlStateDitherFramed)), (int8)inverse)); + (int8)(!!(style & kControlStateDitherFramed)), (int8)hilite)); if (!s->pic_not_valid) FULL_REDRAW(); } -void SciGui32::drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo cellNo, int16 style, bool inverse) { +void SciGui32::drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo cellNo, int16 style, bool hilite) { rect_t area = gfx_rect(rect.left, rect.top, rect.width(), rect.height()); ADD_TO_CURRENT_PICTURE_PORT(sciw_new_icon_control(s->port, obj, area, viewId, loopNo, cellNo, - (int8)(style & kControlStateFramed), (int8)inverse)); + (int8)(style & kControlStateFramed), (int8)hilite)); if (!s->pic_not_valid) FULL_REDRAW(); } diff --git a/engines/sci/gui32/gui32.h b/engines/sci/gui32/gui32.h index 9861d3bcc5..38a3feb221 100644 --- a/engines/sci/gui32/gui32.h +++ b/engines/sci/gui32/gui32.h @@ -59,9 +59,9 @@ public: void drawStatus(const char *text, int16 colorPen, int16 colorBack); void drawPicture(GuiResourceId pictureId, uint16 showStyle, uint16 flags, int16 EGApaletteNo); void drawCel(GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo celNo, uint16 leftPos, uint16 topPos, int16 priority, uint16 paletteNo); - void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool inverse); - void drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool inverse); - void drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo, int16 style, bool inverse); + void drawControlButton(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 style, bool hilite); + void drawControlText(Common::Rect rect, reg_t obj, const char *text, int16 fontId, int16 mode, int16 style, bool hilite); + void drawControlIcon(Common::Rect rect, reg_t obj, GuiResourceId viewId, GuiViewLoopNo loopNo, GuiViewCelNo, int16 style, bool hilite); void graphFillBoxForeground(Common::Rect rect); void graphFillBoxBackground(Common::Rect rect); |