New key page in GUI
svn-id: r4042
This commit is contained in:
parent
4b6012a0a1
commit
0e102853cb
4 changed files with 91 additions and 53 deletions
11
gapi_keys.h
11
gapi_keys.h
|
@ -11,7 +11,8 @@ enum ActionType {
|
||||||
ACTION_HIDE = 5,
|
ACTION_HIDE = 5,
|
||||||
ACTION_KEYBOARD = 6,
|
ACTION_KEYBOARD = 6,
|
||||||
ACTION_SOUND = 7,
|
ACTION_SOUND = 7,
|
||||||
ACTION_RIGHTCLICK = 8
|
ACTION_RIGHTCLICK = 8,
|
||||||
|
ACTION_CURSOR = 9
|
||||||
};
|
};
|
||||||
|
|
||||||
struct oneAction {
|
struct oneAction {
|
||||||
|
@ -20,8 +21,8 @@ struct oneAction {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define NUMBER_ACTIONS 5
|
#define NUMBER_ACTIONS 10
|
||||||
#define TOTAL_ACTIONS 8
|
#define TOTAL_ACTIONS 9
|
||||||
|
|
||||||
#define GAPI_KEY_BASE 1000
|
#define GAPI_KEY_BASE 1000
|
||||||
#define GAPI_KEY_VKA 1
|
#define GAPI_KEY_VKA 1
|
||||||
|
@ -32,6 +33,10 @@ struct oneAction {
|
||||||
#define GAPI_KEY_CONTACTS 6
|
#define GAPI_KEY_CONTACTS 6
|
||||||
#define GAPI_KEY_INBOX 7
|
#define GAPI_KEY_INBOX 7
|
||||||
#define GAPI_KEY_ITASK 8
|
#define GAPI_KEY_ITASK 8
|
||||||
|
#define GAPI_KEY_VKUP 9
|
||||||
|
#define GAPI_KEY_VKDOWN 10
|
||||||
|
#define GAPI_KEY_VKLEFT 11
|
||||||
|
#define GAPI_KEY_VKRIGHT 12
|
||||||
|
|
||||||
#define INTERNAL_KEY_CALENDAR 0xc1
|
#define INTERNAL_KEY_CALENDAR 0xc1
|
||||||
#define INTERNAL_KEY_CONTACTS 0xc2
|
#define INTERNAL_KEY_CONTACTS 0xc2
|
||||||
|
|
83
gui.cpp
83
gui.cpp
|
@ -27,7 +27,7 @@
|
||||||
#include "guimaps.h"
|
#include "guimaps.h"
|
||||||
|
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
// Additional variables for Win32 specific GUI
|
// Additional variables for WinCE specific GUI
|
||||||
#include "gapi_keys.h"
|
#include "gapi_keys.h"
|
||||||
extern bool toolbar_drawn;
|
extern bool toolbar_drawn;
|
||||||
extern bool draw_keyboard;
|
extern bool draw_keyboard;
|
||||||
|
@ -35,6 +35,7 @@ extern bool get_key_mapping;
|
||||||
extern struct keyops keyMapping;
|
extern struct keyops keyMapping;
|
||||||
extern void registry_save(void);
|
extern void registry_save(void);
|
||||||
uint16 _key_mapping_required;
|
uint16 _key_mapping_required;
|
||||||
|
uint16 _current_page;
|
||||||
#else
|
#else
|
||||||
#define registry_save() ;
|
#define registry_save() ;
|
||||||
bool get_key_mapping;
|
bool get_key_mapping;
|
||||||
|
@ -190,12 +191,19 @@ void Gui::drawWidget(const GuiWidget * w)
|
||||||
#ifdef _WIN32_WCE
|
#ifdef _WIN32_WCE
|
||||||
case GUI_KEYTEXT:
|
case GUI_KEYTEXT:
|
||||||
strcpy(text,
|
strcpy(text,
|
||||||
getGAPIKeyName(getAction(w->_string_number - 1)->action_key));
|
getGAPIKeyName(getAction((_current_page * 5) + w->_string_number - 1)->action_key));
|
||||||
break;
|
break;
|
||||||
case GUI_ACTIONTEXT:
|
case GUI_ACTIONTEXT:
|
||||||
strcpy(text,
|
strcpy(text,
|
||||||
getActionName(getAction(w->_string_number - 1)->action_type));
|
getActionName(getAction((_current_page * 5) + w->_string_number - 1)->action_type));
|
||||||
break;
|
break;
|
||||||
|
case GUI_NEXTTEXT:
|
||||||
|
if (_current_page == 0)
|
||||||
|
strcpy(text, "Next");
|
||||||
|
else
|
||||||
|
strcpy(text, "Prev");
|
||||||
|
break;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,48 +372,37 @@ const GuiWidget keys_dialog[] = {
|
||||||
// First action
|
// First action
|
||||||
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 11, 10 + 10, 15, 15, 10, 3}, // CUSTOMTEXT_PLUS
|
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 11, 10 + 10, 15, 15, 10, 3}, // CUSTOMTEXT_PLUS
|
||||||
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 33, 10 + 10, 15, 15, 11, 4}, // CUSTOMTEXT_MINUS
|
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 33, 10 + 10, 15, 15, 11, 4}, // CUSTOMTEXT_MINUS
|
||||||
{GUI_ACTIONTEXT, 0x01, GWF_BUTTON, 30 + 11 + 33 + 10, 10 + 10, 100, 15, 100,
|
{GUI_ACTIONTEXT, 0x01, GWF_BUTTON, 30 + 11 + 33 + 10, 10 + 10, 100, 15, 100, 1},
|
||||||
1},
|
|
||||||
{GUI_KEYTEXT, 0x01, 0, 30 + 11 + 33 + 120, 10 + 10 + 3, 100, 15, 1, 1},
|
{GUI_KEYTEXT, 0x01, 0, 30 + 11 + 33 + 120, 10 + 10 + 3, 100, 15, 1, 1},
|
||||||
|
|
||||||
//Second action
|
//Second action
|
||||||
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 11, 10 + 10 + 15 + 5, 15, 15, 20, 3}, // CUSTOMTEXT_PLUS
|
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 11, 10 + 10 + 15 + 5, 15, 15, 20, 3}, // CUSTOMTEXT_PLUS
|
||||||
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 33, 10 + 10 + 15 + 5, 15, 15, 21, 4}, // CUSTOMTEXT_MINUS
|
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 33, 10 + 10 + 15 + 5, 15, 15, 21, 4}, // CUSTOMTEXT_MINUS
|
||||||
{GUI_ACTIONTEXT, 0x01, GWF_BUTTON, 30 + 10 + 33 + 10, 10 + 10 + 15 + 5, 100,
|
{GUI_ACTIONTEXT, 0x01, GWF_BUTTON, 30 + 10 + 33 + 10, 10 + 10 + 15 + 5, 100, 15, 101, 2},
|
||||||
15, 101, 2},
|
{GUI_KEYTEXT, 0x01, 0, 30 + 11 + 33 + 120, 10 + 10 + 15 + 5 + 3, 100, 15, 2, 2},
|
||||||
{GUI_KEYTEXT, 0x01, 0, 30 + 11 + 33 + 120, 10 + 10 + 15 + 5 + 3, 100, 15, 2,
|
|
||||||
2},
|
|
||||||
|
|
||||||
//Third action
|
//Third action
|
||||||
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 11, 10 + 10 + 15 + 5 + 15 + 5, 15, 15, 30, 3},// CUSTOMTEXT_PLUS
|
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 11, 10 + 10 + 15 + 5 + 15 + 5, 15, 15, 30, 3},// CUSTOMTEXT_PLUS
|
||||||
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 33, 10 + 10 + 15 + 5 + 15 + 5, 15, 15, 31, 4}, // CUSTOMTEXT_MINUS
|
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 33, 10 + 10 + 15 + 5 + 15 + 5, 15, 15, 31, 4}, // CUSTOMTEXT_MINUS
|
||||||
{GUI_ACTIONTEXT, 0x01, GWF_BUTTON, 30 + 10 + 33 + 10,
|
{GUI_ACTIONTEXT, 0x01, GWF_BUTTON, 30 + 10 + 33 + 10, 10 + 10 + 15 + 5 + 15 + 5, 100, 15, 102, 3},
|
||||||
10 + 10 + 15 + 5 + 15 + 5, 100, 15, 102, 3},
|
{GUI_KEYTEXT, 0x01, 0, 30 + 11 + 33 + 120, 10 + 10 + 15 + 5 + 15 + 5 + 3, 100, 15, 3, 3},
|
||||||
{GUI_KEYTEXT, 0x01, 0, 30 + 11 + 33 + 120, 10 + 10 + 15 + 5 + 15 + 5 + 3,
|
|
||||||
100, 15, 3, 3},
|
|
||||||
|
|
||||||
//Fourth action
|
//Fourth action
|
||||||
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 11,
|
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 11, 10 + 10 + 15 + 5 + 15 + 5 + 15 + 5, 15, 15, 40, 3},
|
||||||
10 + 10 + 15 + 5 + 15 + 5 + 15 + 5, 15, 15, 40, 3},
|
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 33, 10 + 10 + 15 + 5 + 15 + 5 + 15 + 5, 15, 15, 41, 4},
|
||||||
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 33,
|
{GUI_ACTIONTEXT, 0x01, GWF_BUTTON, 30 + 10 + 33 + 10, 10 + 10 + 15 + 5 + 15 + 5 + 15 + 5, 100, 15, 103, 4},
|
||||||
10 + 10 + 15 + 5 + 15 + 5 + 15 + 5, 15, 15, 41, 4},
|
{GUI_KEYTEXT, 0x01, 0, 30 + 11 + 33 + 120, 10 + 10 + 15 + 5 + 15 + 5 + 15 + 5 + 3, 100, 15, 4, 4},
|
||||||
{GUI_ACTIONTEXT, 0x01, GWF_BUTTON, 30 + 10 + 33 + 10,
|
|
||||||
10 + 10 + 15 + 5 + 15 + 5 + 15 + 5, 100, 15, 103, 4},
|
|
||||||
{GUI_KEYTEXT, 0x01, 0, 30 + 11 + 33 + 120,
|
|
||||||
10 + 10 + 15 + 5 + 15 + 5 + 15 + 5 + 3, 100, 15, 4, 4},
|
|
||||||
|
|
||||||
//Fifth action
|
//Fifth action
|
||||||
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 11,
|
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 11, 10 + 10 + 15 + 5 + 15 + 5 + 15 + 5 + 15 + 5, 15, 15, 50, 3},
|
||||||
10 + 10 + 15 + 5 + 15 + 5 + 15 + 5 + 15 + 5, 15, 15, 50, 3},
|
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 33, 10 + 10 + 15 + 5 + 15 + 5 + 15 + 5 + 15 + 5, 15, 15, 51, 4},
|
||||||
{GUI_CUSTOMTEXT, 0x01, GWF_BUTTON, 30 + 33,
|
{GUI_ACTIONTEXT, 0x01, GWF_BUTTON, 30 + 10 + 33 + 10, 10 + 10 + 15 + 5 + 15 + 5 + 15 + 5 + 15 + 5, 100, 15, 104, 5},
|
||||||
10 + 10 + 15 + 5 + 15 + 5 + 15 + 5 + 15 + 5, 15, 15, 51, 4},
|
{GUI_KEYTEXT, 0x01, 0, 30 + 11 + 33 + 120, 10 + 10 + 15 + 5 + 15 + 5 + 15 + 5 + 15 + 5 + 3, 100, 15, 5, 5},
|
||||||
{GUI_ACTIONTEXT, 0x01, GWF_BUTTON, 30 + 10 + 33 + 10,
|
|
||||||
10 + 10 + 15 + 5 + 15 + 5 + 15 + 5 + 15 + 5, 100, 15, 104, 5},
|
|
||||||
{GUI_KEYTEXT, 0x01, 0, 30 + 11 + 33 + 120,
|
|
||||||
10 + 10 + 15 + 5 + 15 + 5 + 15 + 5 + 15 + 5 + 3, 100, 15, 5, 5},
|
|
||||||
|
|
||||||
//OK
|
//OK
|
||||||
{GUI_RESTEXT, 0x01, GWF_BUTTON, 30 + 113, 10 + 106, 54, 16, 60, 9},
|
{GUI_RESTEXT, 0x01, GWF_BUTTON, 30 + 60, 10 + 106, 54, 16, 60, 9 },
|
||||||
|
//Previous-Next
|
||||||
|
{GUI_NEXTTEXT, 0x01, GWF_BUTTON, 30 + 120, 10 + 106, 54, 16, 61, 0 },
|
||||||
{0,0,0,0,0,0,0,0,0}
|
{0,0,0,0,0,0,0,0,0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -551,15 +548,16 @@ void Gui::handleKeysDialogCommand(int cmd)
|
||||||
if (cmd < 100 && cmd != 60) {
|
if (cmd < 100 && cmd != 60) {
|
||||||
|
|
||||||
if ((cmd % 10) == 1)
|
if ((cmd % 10) == 1)
|
||||||
setNextType((cmd / 10) - 1);
|
setNextType((_current_page * 5) + (cmd / 10) - 1);
|
||||||
else
|
else
|
||||||
setPreviousType((cmd / 10) - 1);
|
setPreviousType((_current_page * 5) + (cmd / 10) - 1);
|
||||||
|
|
||||||
draw(0, 200);
|
draw(0, 200);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmd >= 100)
|
||||||
_key_mapping_required = cmd;
|
_key_mapping_required = cmd;
|
||||||
|
|
||||||
if (cmd == 60) {
|
if (cmd == 60) {
|
||||||
|
@ -567,6 +565,16 @@ void Gui::handleKeysDialogCommand(int cmd)
|
||||||
registry_save();
|
registry_save();
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmd == 61) {
|
||||||
|
if (!_current_page)
|
||||||
|
_current_page = 1;
|
||||||
|
else
|
||||||
|
_current_page = 0;
|
||||||
|
draw(0, 200);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
close();
|
close();
|
||||||
#endif
|
#endif
|
||||||
|
@ -574,7 +582,7 @@ void Gui::handleKeysDialogCommand(int cmd)
|
||||||
|
|
||||||
void Gui::handleLauncherDialogCommand(int cmd)
|
void Gui::handleLauncherDialogCommand(int cmd)
|
||||||
{
|
{
|
||||||
printf("handle launcher command\n");
|
debug(9, "handle launcher command\n");
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case 20:
|
case 20:
|
||||||
close();
|
close();
|
||||||
|
@ -589,10 +597,10 @@ void Gui::handleLauncherDialogCommand(int cmd)
|
||||||
_return_to = LAUNCHER_DIALOG;
|
_return_to = LAUNCHER_DIALOG;
|
||||||
_dialog = ABOUT_DIALOG;
|
_dialog = ABOUT_DIALOG;
|
||||||
draw(0, 100);
|
draw(0, 100);
|
||||||
printf("about dialog\n");
|
debug(9, "about dialog\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("default\n");
|
debug(9, "default\n");
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -805,7 +813,7 @@ void Gui::addLetter(byte letter)
|
||||||
case KEYS_DIALOG:
|
case KEYS_DIALOG:
|
||||||
clearActionKey(letter);
|
clearActionKey(letter);
|
||||||
if (_key_mapping_required)
|
if (_key_mapping_required)
|
||||||
getAction(_key_mapping_required - 100)->action_key = letter;
|
getAction((_current_page * 5) + _key_mapping_required - 100)->action_key = letter;
|
||||||
_key_mapping_required = 0;
|
_key_mapping_required = 0;
|
||||||
draw(0, 200);
|
draw(0, 200);
|
||||||
break;
|
break;
|
||||||
|
@ -901,6 +909,9 @@ void Gui::pause()
|
||||||
|
|
||||||
void Gui::options()
|
void Gui::options()
|
||||||
{
|
{
|
||||||
|
#ifdef _WIN32_WCE
|
||||||
|
_current_page = 0;
|
||||||
|
#endif
|
||||||
_widgets[0] = options_dialog;
|
_widgets[0] = options_dialog;
|
||||||
_active = true;
|
_active = true;
|
||||||
_cur_page = 0;
|
_cur_page = 0;
|
||||||
|
|
4
gui.h
4
gui.h
|
@ -35,7 +35,8 @@ enum {
|
||||||
GUI_VARTEXT = 5,
|
GUI_VARTEXT = 5,
|
||||||
GUI_ACTIONTEXT = 6,
|
GUI_ACTIONTEXT = 6,
|
||||||
GUI_KEYTEXT = 7,
|
GUI_KEYTEXT = 7,
|
||||||
GUI_SCROLLTEXT = 8
|
GUI_SCROLLTEXT = 8,
|
||||||
|
GUI_NEXTTEXT = 9
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -45,7 +46,6 @@ enum {
|
||||||
GWF_DELAY = 8,
|
GWF_DELAY = 8,
|
||||||
GWF_DEFAULT = GWF_BORDER|GWF_CLEARBG,
|
GWF_DEFAULT = GWF_BORDER|GWF_CLEARBG,
|
||||||
GWF_BUTTON = GWF_BORDER|GWF_CLEARBG|GWF_DELAY
|
GWF_BUTTON = GWF_BORDER|GWF_CLEARBG|GWF_DELAY
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GuiWidget {
|
struct GuiWidget {
|
||||||
|
|
|
@ -18,6 +18,7 @@ struct GXKeyList _keys;
|
||||||
pAction *_action_functions;
|
pAction *_action_functions;
|
||||||
|
|
||||||
const char* ActionsText[] = {
|
const char* ActionsText[] = {
|
||||||
|
"None",
|
||||||
"Pause",
|
"Pause",
|
||||||
"Save",
|
"Save",
|
||||||
"Quit",
|
"Quit",
|
||||||
|
@ -25,7 +26,8 @@ const char* ActionsText[] = {
|
||||||
"Hide",
|
"Hide",
|
||||||
"Keyboard",
|
"Keyboard",
|
||||||
"Sound",
|
"Sound",
|
||||||
"Right click"
|
"Right click",
|
||||||
|
"Cursor on/off"
|
||||||
};
|
};
|
||||||
|
|
||||||
bool _typeExists(int x) {
|
bool _typeExists(int x) {
|
||||||
|
@ -40,7 +42,7 @@ bool _typeExists(int x) {
|
||||||
|
|
||||||
|
|
||||||
const char* getActionName(int action) {
|
const char* getActionName(int action) {
|
||||||
return ActionsText[action - 1];
|
return ActionsText[action];
|
||||||
}
|
}
|
||||||
|
|
||||||
void GAPIKeysInit(pAction *functions) {
|
void GAPIKeysInit(pAction *functions) {
|
||||||
|
@ -84,6 +86,18 @@ const unsigned char getGAPIKeyMapping(short key) {
|
||||||
if (key == _keys.vkStart)
|
if (key == _keys.vkStart)
|
||||||
return GAPI_KEY_VKSTART;
|
return GAPI_KEY_VKSTART;
|
||||||
|
|
||||||
|
if (key == _keys.vkUp)
|
||||||
|
return GAPI_KEY_VKUP;
|
||||||
|
|
||||||
|
if (key == _keys.vkDown)
|
||||||
|
return GAPI_KEY_VKDOWN;
|
||||||
|
|
||||||
|
if (key == _keys.vkLeft)
|
||||||
|
return GAPI_KEY_VKLEFT;
|
||||||
|
|
||||||
|
if (key == _keys.vkRight)
|
||||||
|
return GAPI_KEY_VKRIGHT;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
// then the "unsupported" keys
|
// then the "unsupported" keys
|
||||||
case INTERNAL_KEY_CALENDAR:
|
case INTERNAL_KEY_CALENDAR:
|
||||||
|
@ -117,6 +131,14 @@ const char* getGAPIKeyName(unsigned char key) {
|
||||||
return "Button Inbox";
|
return "Button Inbox";
|
||||||
case GAPI_KEY_ITASK:
|
case GAPI_KEY_ITASK:
|
||||||
return "Button ITask";
|
return "Button ITask";
|
||||||
|
case GAPI_KEY_VKUP:
|
||||||
|
return "Pad Up";
|
||||||
|
case GAPI_KEY_VKDOWN:
|
||||||
|
return "Pad Down";
|
||||||
|
case GAPI_KEY_VKLEFT:
|
||||||
|
return "Pad Left";
|
||||||
|
case GAPI_KEY_VKRIGHT:
|
||||||
|
return "Pad Right";
|
||||||
default:
|
default:
|
||||||
return "Not mapped";
|
return "Not mapped";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue