[Scummvm-cvs-logs] CVS: scummvm/gui ListWidget.cpp,1.22,1.23 browser.cpp,1.9,1.10 console.cpp,1.23,1.24 launcher.cpp,1.36,1.37 newgui.cpp,1.43,1.44 newgui.h,1.23,1.24
Max Horn
fingolfin at users.sourceforge.net
Wed Apr 30 06:59:02 CEST 2003
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv30660
Modified Files:
ListWidget.cpp browser.cpp console.cpp launcher.cpp newgui.cpp
newgui.h
Log Message:
PalmOS changes: allow 8 bit GUI mode
Index: ListWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/ListWidget.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- ListWidget.cpp 9 Mar 2003 00:39:16 -0000 1.22
+++ ListWidget.cpp 30 Apr 2003 13:57:54 -0000 1.23
@@ -219,13 +219,11 @@
_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;
Index: browser.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/browser.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- browser.cpp 26 Mar 2003 22:41:11 -0000 1.9
+++ browser.cpp 30 Apr 2003 13:57:55 -0000 1.10
@@ -38,6 +38,15 @@
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);
Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/console.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- console.cpp 6 Mar 2003 21:45:38 -0000 1.23
+++ console.cpp 30 Apr 2003 13:57:55 -0000 1.24
@@ -404,7 +404,11 @@
}
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);
Index: launcher.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- launcher.cpp 29 Apr 2003 04:27:08 -0000 1.36
+++ launcher.cpp 30 Apr 2003 13:57:55 -0000 1.37
@@ -451,6 +451,9 @@
updateButtons();
break;
case kQuitCmd:
+#ifdef __PALM_OS__
+ close();
+#endif
g_system->quit();
break;
default:
Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- newgui.cpp 8 Mar 2003 06:53:32 -0000 1.43
+++ newgui.cpp 30 Apr 2003 13:57:56 -0000 1.44
@@ -49,6 +49,9 @@
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 @@
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 @@
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 @@
_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 @@
_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 @@
_system->hide_overlay();
if (_screen) {
+#ifndef __PALM_OS__
delete [] _screen;
+#else
+ free(_screen);
+#endif
_screen = 0;
}
@@ -258,13 +272,13 @@
#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 @@
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::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 @@
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 @@
}
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::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::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 @@
// 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 @@
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 @@
// 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 @@
// 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 @@
//
// 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 @@
_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
Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- newgui.h 6 Mar 2003 21:45:44 -0000 1.23
+++ newgui.h 30 Apr 2003 13:57:57 -0000 1.24
@@ -75,7 +75,7 @@
protected:
OSystem *_system;
- int16 *_screen;
+ NewGuiColor *_screen;
int _screenPitch;
bool _needRedraw;
@@ -116,31 +116,31 @@
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);
};
More information about the Scummvm-git-logs
mailing list