summaryrefslogtreecommitdiffstats
path: root/uisimulator
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2004-09-19 21:58:37 +0000
committerBjörn Stenberg <bjorn@haxx.se>2004-09-19 21:58:37 +0000
commit6c33c51a4ca9907d23e3154d956fd6781122f492 (patch)
treef0e598efaf064bb72c33c0a8a2edba4cf9ebb13c /uisimulator
parent17f54a40f100a3343a15a431d235699024aa76c8 (diff)
downloadrockbox-6c33c51a4ca9907d23e3154d956fd6781122f492.tar.gz
rockbox-6c33c51a4ca9907d23e3154d956fd6781122f492.zip
Redesigned the button handling. The code now uses symbolic function defines instead of checking for specific buttons. This makes it easier to add support for new devices with different button layouts.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5091 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r--uisimulator/common/lcd-playersim.c2
-rw-r--r--uisimulator/win32/Makefile3
-rw-r--r--uisimulator/win32/button.c31
-rw-r--r--uisimulator/x11/Makefile7
-rw-r--r--uisimulator/x11/button-x11.c32
5 files changed, 62 insertions, 13 deletions
diff --git a/uisimulator/common/lcd-playersim.c b/uisimulator/common/lcd-playersim.c
index 3f3453b9a1..5c8ca92f32 100644
--- a/uisimulator/common/lcd-playersim.c
+++ b/uisimulator/common/lcd-playersim.c
@@ -102,7 +102,7 @@ void lcd_print_char(int x, int y)
static char bitmap_content[11*8][2*8];
if (double_height == 2 && y == 1)
- return; /* Second row can't be printed in double height. ??*/
+ return; /* only one row available if text is double height */
for (col=0; col<5; col++) {
unsigned char fontbitmap=(*font_player)[ch][col];
diff --git a/uisimulator/win32/Makefile b/uisimulator/win32/Makefile
index d105076f85..22ce4d65d1 100644
--- a/uisimulator/win32/Makefile
+++ b/uisimulator/win32/Makefile
@@ -23,6 +23,7 @@ PLAYDIR = $(APPDIR)/player
PLUGINDIR = $(APPDIR)/plugins
SIMCOMMON = ../common
+ISONDIO := $(findstring ONDIO, $(TARGET))
ISPLAYER := $(findstring PLAYER, $(TARGET))
ifeq ($(ISPLAYER), PLAYER)
MACHINEDIR = $(PLAYDIR)
@@ -124,8 +125,10 @@ SRCS = button.c lcd-win32.c panic-win32.c thread-win32.c \
OBJS := $(OBJDIR)/lang.o $(SRCS:%.c=$(OBJDIR)/%.o) $(OBJDIR)/uisw32-res.o
+ifneq ($(ISONDIO),ONDIO)
ROCKS := $(patsubst $(PLUGINDIR)/%.c,$(OBJDIR)/%.rock,$(wildcard $(PLUGINDIR)/*.c))
PLUGINLIBOBJS := $(patsubst $(PLUGINDIR)/lib/%.c,$(OBJDIR)/%.o,$(wildcard $(PLUGINDIR)/lib/*.c))
+endif
all: $(TOOLSDIR)/convbdf $(EXEFILE) $(ROCKS)
diff --git a/uisimulator/win32/button.c b/uisimulator/win32/button.c
index 0af6ff40a6..5d56456f6e 100644
--- a/uisimulator/win32/button.c
+++ b/uisimulator/win32/button.c
@@ -59,22 +59,38 @@ void button_event(int key, bool pressed)
case VK_RIGHT:
new_btn = BUTTON_RIGHT;
break;
+
case VK_NUMPAD8:
case VK_UP:
+#ifdef BUTTON_UP
new_btn = BUTTON_UP;
+#elif defined BUTTON_PLAY
+ new_btn = BUTTON_PLAY;
+#endif
break;
+
case VK_NUMPAD2:
case VK_DOWN:
+#ifdef BUTTON_DOWN
new_btn = BUTTON_DOWN;
+#elif defined BUTTON_STOP
+ new_btn = BUTTON_STOP;
+#endif
break;
+
+#ifdef BUTTON_ON
case VK_ADD:
new_btn = BUTTON_ON;
break;
+#endif
-#ifdef HAVE_RECORDER_KEYPAD
+#ifdef BUTTON_OFF
case VK_RETURN:
new_btn = BUTTON_OFF;
break;
+#endif
+
+#ifdef BUTTON_F1
case VK_DIVIDE:
case VK_F1:
new_btn = BUTTON_F1;
@@ -87,11 +103,16 @@ void button_event(int key, bool pressed)
case VK_F3:
new_btn = BUTTON_F3;
break;
+#endif
+
+#ifdef BUTTON_PLAY
case VK_NUMPAD5:
case VK_SPACE:
new_btn = BUTTON_PLAY;
break;
+#endif
+#ifdef HAVE_LCD_BITMAP
case VK_NUMPAD0:
case VK_F5:
if(pressed)
@@ -100,8 +121,14 @@ void button_event(int key, bool pressed)
return;
}
break;
-#else
+#endif
+
+#ifdef BUTTON_MENU
+#ifdef HAVE_PLAYER_KEYPAD
case VK_RETURN:
+#elif defined HAVE_ONDIO_KEYPAD
+ case VK_INSERT:
+#endif
new_btn = BUTTON_MENU;
break;
#endif
diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile
index 785e590623..2bc2cba267 100644
--- a/uisimulator/x11/Makefile
+++ b/uisimulator/x11/Makefile
@@ -23,6 +23,7 @@ PLAYDIR = $(APPDIR)/player
PLUGINDIR = $(APPDIR)/plugins
SIMCOMMON = ../common
+ISONDIO := $(findstring ONDIO, $(TARGET))
ISPLAYER := $(findstring PLAYER, $(TARGET))
ifeq ($(ISPLAYER), PLAYER)
MACHINEDIR = $(PLAYDIR)
@@ -142,8 +143,10 @@ SRCS = screenhack.c uibasic.c resources.c visual.c lcd-x11.c \
OBJS := $(OBJDIR)/lang.o $(SRCS:%.c=$(OBJDIR)/%.o)
+ifneq ($(ISONDIO),ONDIO)
ROCKS := $(patsubst $(PLUGINDIR)/%.c,$(OBJDIR)/%.rock,$(wildcard $(PLUGINDIR)/*.c))
PLUGINLIBOBJS := $(patsubst $(PLUGINDIR)/lib/%.c,$(OBJDIR)/%.o,$(wildcard $(PLUGINDIR)/lib/*.c))
+endif
all: $(TOOLSDIR)/convbdf $(EXEFILE) $(ROCKS)
@@ -249,11 +252,11 @@ $(OBJDIR)/%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
ifeq ($(UNAME),CYGWIN)
-$(EXEFILE): $(OBJS) $(OBJDIR)/libplugin.a
+$(EXEFILE): $(OBJS)
@echo LD $@
@$(CC) -g -o $(EXEFILE) $(OBJS) $(LIBDIRS) $(LDFLAGS) $(LIBS)
else
-$(EXEFILE): $(OBJS) $(OBJDIR)/libplugin.a
+$(EXEFILE): $(OBJS)
@echo LD $@
@$(CC) -g -o $(EXEFILE) $(LIBDIRS) $(LDFLAGS) $(OBJS) $(LIBS)
endif
diff --git a/uisimulator/x11/button-x11.c b/uisimulator/x11/button-x11.c
index 951bf730c5..534568b658 100644
--- a/uisimulator/x11/button-x11.c
+++ b/uisimulator/x11/button-x11.c
@@ -75,35 +75,49 @@ static int get_raw_button (void)
case XK_KP_Up:
case XK_Up:
case XK_KP_8:
+#ifdef BUTTON_UP
k = BUTTON_UP;
+#elif defined BUTTON_PLAY
+ k = BUTTON_PLAY;
+#endif
break;
case XK_KP_Down:
case XK_Down:
case XK_KP_2:
+#ifdef BUTTON_DOWN
k = BUTTON_DOWN;
+#elif defined BUTTON_STOP
+ k = BUTTON_STOP;
+#endif
break;
-#ifdef HAVE_RECORDER_KEYPAD
+#ifdef BUTTON_PLAY
case XK_KP_Space:
case XK_KP_5:
case XK_KP_Begin:
case XK_space:
k = BUTTON_PLAY;
break;
+#endif
+#ifdef BUTTON_OFF
case XK_KP_Enter:
case XK_A:
case XK_a:
k = BUTTON_OFF;
break;
+#endif
+#ifdef BUTTON_ON
case XK_KP_Add:
case XK_Q:
case XK_q:
k = BUTTON_ON;
break;
+#endif
+#ifdef BUTTON_F1
case XK_KP_Divide:
case XK_1:
k = BUTTON_F1;
@@ -118,7 +132,9 @@ static int get_raw_button (void)
case XK_3:
k = BUTTON_F3;
break;
+#endif
+#ifdef HAVE_LCD_BITMAP
case XK_5:
if(!release)
{
@@ -126,16 +142,16 @@ static int get_raw_button (void)
return 0;
}
break;
+#endif
-#else
- case XK_KP_Add:
- case XK_Q:
- case XK_q:
- k = BUTTON_ON;
- break;
-
+#ifdef BUTTON_MENU
+#ifdef HAVE_PLAYER_KEYPAD
case XK_KP_Enter:
case XK_Return:
+#elif defined HAVE_ONDIO_KEYPAD
+ case XK_KP_Insert:
+ case XK_Control_R:
+#endif
k = BUTTON_MENU;
break;
#endif