[Scummvm-cvs-logs] SF.net SVN: scummvm:[45493] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Thu Oct 29 00:04:57 CET 2009
Revision: 45493
http://scummvm.svn.sourceforge.net/scummvm/?rev=45493&view=rev
Author: thebluegr
Date: 2009-10-28 23:04:56 +0000 (Wed, 28 Oct 2009)
Log Message:
-----------
Changed some of the menu code to use new graphics functions
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kmenu.cpp
scummvm/trunk/engines/sci/gfx/menubar.cpp
scummvm/trunk/engines/sci/gfx/menubar.h
scummvm/trunk/engines/sci/gui/gui.cpp
Modified: scummvm/trunk/engines/sci/engine/kmenu.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmenu.cpp 2009-10-28 22:01:42 UTC (rev 45492)
+++ scummvm/trunk/engines/sci/engine/kmenu.cpp 2009-10-28 23:04:56 UTC (rev 45493)
@@ -39,14 +39,17 @@
Common::String name = s->_segMan->getString(argv[0]);
Common::String contents = s->_segMan->getString(argv[1]);
+ int titlebarFont = 0;
+
#ifdef INCLUDE_OLDGFX
- s->_menubar->addMenu(s->gfx_state, name,
- contents, s->titlebar_port->_font, argv[1]);
+ titlebarFont = s->titlebar_port->_font;
#else
- // TODO
- warning("TODO: kAddMenu()");
+ // TODO: titlebar port font
#endif
+ s->_menubar->addMenu(s->gfx_state, name,
+ contents, titlebarFont, argv[1]);
+
return s->r_acc;
}
Modified: scummvm/trunk/engines/sci/gfx/menubar.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/menubar.cpp 2009-10-28 22:01:42 UTC (rev 45492)
+++ scummvm/trunk/engines/sci/gfx/menubar.cpp 2009-10-28 23:04:56 UTC (rev 45493)
@@ -31,6 +31,7 @@
#include "sci/sci.h"
#include "sci/engine/state.h"
#include "sci/gfx/menubar.h"
+#include "sci/gui/gui.h"
#include "sci/engine/kernel.h"
namespace Sci {
@@ -77,15 +78,14 @@
_tag = 0;
}
-#ifdef INCLUDE_OLDGFX
-
int Menu::addMenuItem(GfxState *state, MenuType type, const char *left, const char *right,
int font, int key, int modifiers, int tag, reg_t text_pos) {
// Returns the total text size, plus MENU_BOX_CENTER_PADDING if (right != NULL)
MenuItem newItem;
MenuItem *item;
int total_left_size = 0;
- int width, height;
+ int16 width = 10, height = 10;
+ EngineState *s = ((SciEngine *)g_engine)->getEngineState(); // HACK
item = &newItem;
item->_type = type;
@@ -108,18 +108,14 @@
}
if (right) {
-#ifdef INCLUDE_OLDGFX
- gfxop_get_text_params(state, font, item->_keytext.c_str(), SIZE_INF, &width, &height, 0, NULL, NULL, NULL);
-#endif
+ s->_gui->textSize(item->_keytext.c_str(), font, -1, &width, &height);
total_left_size = MENU_BOX_CENTER_PADDING + width;
}
item->_enabled = 1;
item->_tag = tag;
item->_textPos = text_pos;
-#ifdef INCLUDE_OLDGFX
- gfxop_get_text_params(state, font, left, SIZE_INF, &width, &height, 0, NULL, NULL, NULL);
-#endif
+ s->_gui->textSize(left, font, -1, &width, &height);
_items.push_back(newItem);
@@ -132,15 +128,15 @@
reg_t left_origin = entries_base;
int string_len = 0;
int tag = 0, c_width, max_width = 0;
- int height;
+ int16 height = 10;
+ EngineState *s = ((SciEngine *)g_engine)->getEngineState(); // HACK
Menu menu;
menu._title = title;
+ menu._titleWidth = 10;
-#ifdef INCLUDE_OLDGFX
- gfxop_get_text_params(state, font, title.c_str(), SIZE_INF, &(menu._titleWidth), &height, 0, NULL, NULL, NULL);
-#endif
+ s->_gui->textSize(title.c_str(), font, -1, &(menu._titleWidth), &height);
const char *entries_p = entries.c_str();
@@ -278,8 +274,6 @@
_menus.push_back(menu);
}
-#endif
-
bool MenuItem::matchKey(int message, int modifiers) {
if ((_key == message) && ((modifiers & (SCI_EVM_CTRL | SCI_EVM_ALT)) == _modifiers))
return true;
Modified: scummvm/trunk/engines/sci/gfx/menubar.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/menubar.h 2009-10-28 22:01:42 UTC (rev 45492)
+++ scummvm/trunk/engines/sci/gfx/menubar.h 2009-10-28 23:04:56 UTC (rev 45493)
@@ -121,10 +121,10 @@
Common::String _title;
/** Width of the title in pixels */
- int _titleWidth;
+ int16 _titleWidth;
/** Pixel width of the menu window */
- int _width;
+ int16 _width;
/**
* Actual entries into the menu.
@@ -139,10 +139,8 @@
//protected:
// FIXME: This should be (partially) turned into a MenuItem constructor
-#ifdef INCLUDE_OLDGFX
int addMenuItem(GfxState *state, MenuType type, const char *left, const char *right,
int font, int key, int modifiers, int tag, reg_t text_pos);
-#endif
};
@@ -174,9 +172,7 @@
* @param[in] font The font which is to be used for drawing
* @param[in] entries_base Segmented VM address of the entries string
*/
-#ifdef INCLUDE_OLDGFX
void addMenu(GfxState *state, const Common::String &title, const Common::String &entries, int font, reg_t entries_base);
-#endif
/**
* Sets the attributes for a menu item.
Modified: scummvm/trunk/engines/sci/gui/gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui/gui.cpp 2009-10-28 22:01:42 UTC (rev 45492)
+++ scummvm/trunk/engines/sci/gui/gui.cpp 2009-10-28 23:04:56 UTC (rev 45493)
@@ -270,7 +270,8 @@
void SciGui::textSize(const char *text, int16 font, int16 maxWidth, int16 *textWidth, int16 *textHeight) {
Common::Rect rect(0, 0, *textWidth, *textHeight);
_text->Size(rect, text, font, maxWidth);
- *textWidth = rect.width(); *textHeight = rect.height();
+ *textWidth = rect.width();
+ *textHeight = rect.height();
}
// Used SCI1+ for text codes
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list