diff options
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/ListWidget.cpp | 6 | ||||
| -rw-r--r-- | gui/browser.cpp | 9 | ||||
| -rw-r--r-- | gui/console.cpp | 4 | ||||
| -rw-r--r-- | gui/launcher.cpp | 3 | ||||
| -rw-r--r-- | gui/newgui.cpp | 70 | ||||
| -rw-r--r-- | gui/newgui.h | 28 | 
6 files changed, 80 insertions, 40 deletions
diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index 0a1d67c6fa..3efb7254aa 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -219,13 +219,11 @@ bool ListWidget::handleKeyDown(uint16 ascii, int keycode, int modifiers) {  		_scrollBar->draw();  	} -#ifndef _WIN32_WCE - -	// not done on WinCE because keyboard is emulated and +#if !defined(_WIN32_WCE) && !defined(__PALM_OS__) +	// not done on WinCE / PalmOS because keyboard is emulated and  	// keyup is not generated  	_currentKeyDown = keycode; -  #endif  	return handled; diff --git a/gui/browser.cpp b/gui/browser.cpp index 7c6c96bae8..e7baa87341 100644 --- a/gui/browser.cpp +++ b/gui/browser.cpp @@ -38,6 +38,15 @@ enum {  BrowserDialog::BrowserDialog(NewGui *gui, const char *title)  	: Dialog(gui, 20, 10, 320 -2 * 20, 200 - 2 * 10),  	  _node(0), _nodeContent(0) { + +#ifdef __PALM_OS__ +	_fileList = NULL; +	_currentPath = NULL; +	_node = NULL; +	_nodeContent = NULL; +	_choice = NULL; +#endif +  	// Headline - TODO: should be customizable during creation time  	new StaticTextWidget(this, 10, 8, _w-2 * 10, kLineHeight, title, kTextAlignCenter); diff --git a/gui/console.cpp b/gui/console.cpp index 272469f5ad..3cc6132a69 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -404,7 +404,11 @@ int ConsoleDialog::printf(const char *format, ...) {  }  int ConsoleDialog::vprintf(const char *format, va_list argptr) { +#ifdef __PALM_OS__ +	char	buf[256]; +#else  	char	buf[2048]; +#endif  #if defined(WIN32)  	int count = _vsnprintf(buf, sizeof(buf), format, argptr); diff --git a/gui/launcher.cpp b/gui/launcher.cpp index a96cdcf275..43188b3ce6 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -451,6 +451,9 @@ void LauncherDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat  		updateButtons();  		break;  	case kQuitCmd: +#ifdef __PALM_OS__ +		close(); +#endif  		g_system->quit();  		break;  	default: diff --git a/gui/newgui.cpp b/gui/newgui.cpp index 97f2182f6e..33243818e8 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -49,6 +49,9 @@ enum {  	kKeyRepeatSustainDelay = 100  }; +#ifdef __PALM_OS__ +static byte *guifont; +#else  // Built-in font  static byte guifont[] = {  0,0,99,1,226,8,4,8,6,8,6,0,0,0,0,0,0,0,0,0,0,0,8,2,1,8,0,0,0,0,0,0,0,0,0,0,0,0,4,3,7,8,7,7,8,4,5,5,8,7,4,7,3,8,7,7,7,7,8,7,7,7,7,7,3,4,7,5,7,7,8,7,7,7,7,7,7,7,7,5,7,7, @@ -78,6 +81,7 @@ static byte guifont[] = {  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  0,0,0,0,0,0,28,54,54,124,102,102,124,64,0,0,0  }; +#endif  // Constructor  NewGui::NewGui(OSystem *system) : _system(system), _screen(0), _needRedraw(false), @@ -139,6 +143,7 @@ void NewGui::runLoop() {  					activeDialog->handleKeyDown(event.kbd.ascii, event.kbd.keycode, event.kbd.flags);  #ifndef _WIN32_WCE +#ifndef __PALM_OS__  					// init continuous event stream  					// not done on WinCE because keyboard is emulated and  					// keyup is not generated @@ -147,6 +152,7 @@ void NewGui::runLoop() {  					_currentKeyDown.flags = event.kbd.flags;  					_keyRepeatTime = time + kKeyRepeatInitialDelay;  #endif +#endif  					break;  				case OSystem::EVENT_KEYUP:  					activeDialog->handleKeyUp(event.kbd.ascii, event.kbd.keycode, event.kbd.flags); @@ -215,7 +221,11 @@ void NewGui::saveState() {  	_system->show_overlay();  	// TODO - add getHeight & getWidth methods to OSystem. -	_screen = new int16[sys_width * sys_height]; +#ifndef __PALM_OS__ +	_screen = new NewGuiColor[sys_width * sys_height]; +#else +	_screen = (NewGuiColor*)calloc(sys_width*sys_height,sizeof(NewGuiColor)); +#endif  	_screenPitch = sys_width;  	_system->grab_overlay(_screen, _screenPitch); @@ -232,7 +242,11 @@ void NewGui::restoreState() {  	_system->hide_overlay();  	if (_screen) { +#ifndef __PALM_OS__  		delete [] _screen; +#else +		free(_screen); +#endif  		_screen = 0;  	} @@ -258,13 +272,13 @@ void NewGui::closeTopDialog() {  #pragma mark - -int16 *NewGui::getBasePtr(int x, int y) { +NewGuiColor *NewGui::getBasePtr(int x, int y) {  	return _screen + x + y * _screenPitch;  }  void NewGui::box(int x, int y, int width, int height, bool inverted) { -	int16 colorA = inverted ? _shadowcolor : _color; -	int16 colorB = inverted ? _color : _shadowcolor; +	NewGuiColor colorA = inverted ? _shadowcolor : _color; +	NewGuiColor colorB = inverted ? _color : _shadowcolor;  	hline(x + 1, y, x + width - 2, colorA);  	hline(x, y + 1, x + width - 1, colorA); @@ -277,8 +291,8 @@ void NewGui::box(int x, int y, int width, int height, bool inverted) {  	vline(x + width - 2, y + 1, y + height - 1, colorB);  } -void NewGui::line(int x, int y, int x2, int y2, int16 color) { -	int16 *ptr; +void NewGui::line(int x, int y, int x2, int y2, NewGuiColor color) { +	NewGuiColor *ptr;  	if (x2 < x)  		SWAP(x2, x); @@ -302,7 +316,10 @@ void NewGui::line(int x, int y, int x2, int y2, int16 color) {  	}  } -void NewGui::blendRect(int x, int y, int w, int h, int16 color, int level) { +void NewGui::blendRect(int x, int y, int w, int h, NewGuiColor color, int level) { +#ifdef NEWGUI_256 +	fillRect(x,y,w,h,color); +#else  	int r, g, b;  	uint8 ar, ag, ab;  	_system->colorToRGB(color, ar, ag, ab); @@ -310,7 +327,7 @@ void NewGui::blendRect(int x, int y, int w, int h, int16 color, int level) {  	g = ag * level;  	b = ab * level; -	int16 *ptr = getBasePtr(x, y); +	NewGuiColor *ptr = getBasePtr(x, y);  	while (h--) {  		for (int i = 0; i < w; i++) { @@ -321,11 +338,12 @@ void NewGui::blendRect(int x, int y, int w, int h, int16 color, int level) {  		}  		ptr += _screenPitch;  	} +#endif  } -void NewGui::fillRect(int x, int y, int w, int h, int16 color) { +void NewGui::fillRect(int x, int y, int w, int h, NewGuiColor color) {  	int i; -	int16 *ptr = getBasePtr(x, y); +	NewGuiColor *ptr = getBasePtr(x, y);  	while (h--) {  		for (i = 0; i < w; i++) { @@ -335,9 +353,9 @@ void NewGui::fillRect(int x, int y, int w, int h, int16 color) {  	}  } -void NewGui::checkerRect(int x, int y, int w, int h, int16 color) { +void NewGui::checkerRect(int x, int y, int w, int h, NewGuiColor color) {  	int i; -	int16 *ptr = getBasePtr(x, y); +	NewGuiColor *ptr = getBasePtr(x, y);  	while (h--) {  		for (i = 0; i < w; i++) { @@ -348,9 +366,9 @@ void NewGui::checkerRect(int x, int y, int w, int h, int16 color) {  	}  } -void NewGui::frameRect(int x, int y, int w, int h, int16 color) { +void NewGui::frameRect(int x, int y, int w, int h, NewGuiColor color) {  	int i; -	int16 *ptr, *basePtr = getBasePtr(x, y); +	NewGuiColor *ptr, *basePtr = getBasePtr(x, y);  	if (basePtr == NULL)  		return; @@ -372,17 +390,17 @@ void NewGui::addDirtyRect(int x, int y, int w, int h) {  	// For now we don't keep yet another list of dirty rects but simply  	// blit the affected area directly to the overlay. At least for our current  	// GUI/widget/dialog code that is just fine. -	int16 *buf = getBasePtr(x, y); +	NewGuiColor *buf = getBasePtr(x, y);  	_system->copy_rect_overlay(buf, _screenPitch, x, y, w, h);  } -void NewGui::drawChar(const byte chr, int xx, int yy, int16 color) { +void NewGui::drawChar(const byte chr, int xx, int yy, NewGuiColor color) {  	unsigned int buffer = 0, mask = 0, x, y;  	byte *tmp;  	tmp = guifont + 224 + (chr + 1) * 8; -	int16 *ptr = getBasePtr(xx, yy); +	NewGuiColor *ptr = getBasePtr(xx, yy);  	for (y = 0; y < 8; y++) {  		for (x = 0; x < 8; x++) { @@ -411,7 +429,7 @@ int NewGui::getCharWidth(byte c) {  	return guifont[c+6];  } -void NewGui::drawString(const String &str, int x, int y, int w, int16 color, int align) { +void NewGui::drawString(const String &str, int x, int y, int w, NewGuiColor color, int align) {  	const int leftX = x, rightX = x + w;  	int width = getStringWidth(str);  	if (align == kTextAlignCenter) @@ -433,7 +451,7 @@ void NewGui::drawString(const String &str, int x, int y, int w, int16 color, int  // Blit from a buffer to the display  //  void NewGui::blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pitch) { -	int16 *ptr = getBasePtr(x, y); +	NewGuiColor *ptr = getBasePtr(x, y);  	assert(buf);  	while (h--) { @@ -447,7 +465,7 @@ void NewGui::blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pit  // Blit from the display to a buffer  //  void NewGui::blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch) { -	int16 *ptr = getBasePtr(x, y); +	NewGuiColor *ptr = getBasePtr(x, y);  	assert(buf);  	while (h--) { @@ -460,8 +478,8 @@ void NewGui::blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch) {  //  // Draw an 8x8 bitmap at location (x,y)  // -void NewGui::drawBitmap(uint32 *bitmap, int x, int y, int16 color, int h) { -	int16 *ptr = getBasePtr(x, y); +void NewGui::drawBitmap(uint32 *bitmap, int x, int y, NewGuiColor color, int h) { +	NewGuiColor *ptr = getBasePtr(x, y);  	for (y = 0; y < h; y++) {  		uint32 mask = 0xF0000000; @@ -498,3 +516,11 @@ void NewGui::animateCursor() {  		_cursorAnimateCounter = (_cursorAnimateCounter + 1) % 4;  	}  } + +#ifdef __PALM_OS__ +#include "scumm_globals.h"	// init globals +void NewGui_initGlobals()	{ +	GSETPTR(guifont, GBVARS_GUIFONT_INDEX, byte, GBVARS_SCUMM) +} +void NewGui_releaseGlobals(){	GRELEASEPTR(GBVARS_GUIFONT_INDEX, GBVARS_SCUMM)				} +#endif
\ No newline at end of file diff --git a/gui/newgui.h b/gui/newgui.h index e6b266c904..c0f8fe5d4b 100644 --- a/gui/newgui.h +++ b/gui/newgui.h @@ -75,7 +75,7 @@ public:  protected:  	OSystem		*_system; -	int16		*_screen; +	NewGuiColor	*_screen;  	int			_screenPitch;  	bool		_needRedraw; @@ -116,31 +116,31 @@ protected:  public:  	// Theme colors -	int16 _color, _shadowcolor; -	int16 _bgcolor; -	int16 _textcolor; -	int16 _textcolorhi; +	NewGuiColor _color, _shadowcolor; +	NewGuiColor _bgcolor; +	NewGuiColor _textcolor; +	NewGuiColor _textcolorhi;  	// Misc util  	uint32 get_time() const { return _system->get_msecs(); }  	// Drawing primitives -	int16 *getBasePtr(int x, int y); +	NewGuiColor *getBasePtr(int x, int y);  	void box(int x, int y, int width, int height, bool inverted = false); -	void line(int x, int y, int x2, int y2, int16 color); -	void blendRect(int x, int y, int w, int h, int16 color, int level = 3); -	void fillRect(int x, int y, int w, int h, int16 color); -	void checkerRect(int x, int y, int w, int h, int16 color); -	void frameRect(int x, int y, int w, int h, int16 color); -	void drawChar(byte c, int x, int y, int16 color); +	void line(int x, int y, int x2, int y2, NewGuiColor color); +	void blendRect(int x, int y, int w, int h, NewGuiColor color, int level = 3); +	void fillRect(int x, int y, int w, int h, NewGuiColor color); +	void checkerRect(int x, int y, int w, int h, NewGuiColor color); +	void frameRect(int x, int y, int w, int h, NewGuiColor color); +	void drawChar(byte c, int x, int y, NewGuiColor color);  	int getStringWidth(const String &str);  	int getCharWidth(byte c); -	void drawString(const String &str, int x, int y, int w, int16 color, int align = kTextAlignLeft); +	void drawString(const String &str, int x, int y, int w, NewGuiColor color, int align = kTextAlignLeft);  	void blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pitch);  	void blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch); -	void drawBitmap(uint32 *bitmap, int x, int y, int16 color, int h = 8); +	void drawBitmap(uint32 *bitmap, int x, int y, NewGuiColor color, int h = 8);  	void addDirtyRect(int x, int y, int w, int h);  };  | 
