git.ucc.asn.au
/
tpg
/
acess2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8ed1749
)
Usermode/AxWin3 - Fixed bug with underlined items in menus
author
John Hodge
<
[email protected]
>
Tue, 14 Feb 2012 07:34:50 +0000
(15:34 +0800)
committer
John Hodge
<
[email protected]
>
Tue, 14 Feb 2012 07:34:50 +0000
(15:34 +0800)
Usermode/Applications/axwin3_src/Interface/main.c
patch
|
blob
|
history
Usermode/Applications/axwin3_src/WM/main.c
patch
|
blob
|
history
Usermode/Applications/axwin3_src/WM/renderers/menu.c
patch
|
blob
|
history
diff --git
a/Usermode/Applications/axwin3_src/Interface/main.c
b/Usermode/Applications/axwin3_src/Interface/main.c
index
2fcb98f
..
80bf329
100644
(file)
--- a/
Usermode/Applications/axwin3_src/Interface/main.c
+++ b/
Usermode/Applications/axwin3_src/Interface/main.c
@@
-83,7
+83,11
@@
void create_sidebar(void)
AxWin3_Widget_SetSize(ele, 4);
// > Version/Time
AxWin3_Widget_SetSize(ele, 4);
// > Version/Time
- ele = AxWin3_Widget_AddWidget(gSidebarRoot, ELETYPE_BOX, ELEFLAG_VERTICAL|ELEFLAG_ALIGN_CENTER|ELEFLAG_NOSTRETCH, "Version/Time");
+ ele = AxWin3_Widget_AddWidget(gSidebarRoot,
+ ELETYPE_BOX,
+ ELEFLAG_VERTICAL|ELEFLAG_ALIGN_CENTER|ELEFLAG_NOSTRETCH,
+ "Version/Time"
+ );
txt = AxWin3_Widget_AddWidget(ele, ELETYPE_TEXT, ELEFLAG_NOSTRETCH, "Version String");
AxWin3_Widget_SetSize(txt, 20);
AxWin3_Widget_SetText(txt, "3.0");
txt = AxWin3_Widget_AddWidget(ele, ELETYPE_TEXT, ELEFLAG_NOSTRETCH, "Version String");
AxWin3_Widget_SetSize(txt, 20);
AxWin3_Widget_SetText(txt, "3.0");
@@
-116,9
+120,9
@@
void create_mainmenu(void)
gSystemMenu = AxWin3_Menu_Create(NULL);
AxWin3_Menu_AddItem(gSystemMenu, "Text &Editor\tWin+E", mainmenu_app_textedit, NULL, 0, NULL);
gSystemMenu = AxWin3_Menu_Create(NULL);
AxWin3_Menu_AddItem(gSystemMenu, "Text &Editor\tWin+E", mainmenu_app_textedit, NULL, 0, NULL);
- AxWin3_Menu_AddItem(gSystemMenu, "Terminal Emulator\tWin+T", mainmenu_app_terminal, NULL, 0, NULL);
+ AxWin3_Menu_AddItem(gSystemMenu, "
&
Terminal Emulator\tWin+T", mainmenu_app_terminal, NULL, 0, NULL);
AxWin3_Menu_AddItem(gSystemMenu, NULL, NULL, NULL, 0, NULL);
AxWin3_Menu_AddItem(gSystemMenu, NULL, NULL, NULL, 0, NULL);
- AxWin3_Menu_AddItem(gSystemMenu, "Run\tWin+R", mainmenu_run_dialog, NULL, 0, NULL);
+ AxWin3_Menu_AddItem(gSystemMenu, "
&
Run\tWin+R", mainmenu_run_dialog, NULL, 0, NULL);
}
int run_dorun(tAxWin3_Widget *unused)
}
int run_dorun(tAxWin3_Widget *unused)
diff --git
a/Usermode/Applications/axwin3_src/WM/main.c
b/Usermode/Applications/axwin3_src/WM/main.c
index
b8f3065
..
b6fcf49
100644
(file)
--- a/
Usermode/Applications/axwin3_src/WM/main.c
+++ b/
Usermode/Applications/axwin3_src/WM/main.c
@@
-53,7
+53,6
@@
int main(int argc, char *argv[])
}
Video_Setup();
}
Video_Setup();
-// Interface_Init();
IPC_Init();
Input_Init();
IPC_Init();
Input_Init();
diff --git
a/Usermode/Applications/axwin3_src/WM/renderers/menu.c
b/Usermode/Applications/axwin3_src/WM/renderers/menu.c
index
ffd1db0
..
a183de0
100644
(file)
--- a/
Usermode/Applications/axwin3_src/WM/renderers/menu.c
+++ b/
Usermode/Applications/axwin3_src/WM/renderers/menu.c
@@
-275,17
+275,14
@@
int Renderer_Menu_int_AddItem(tWindow *Window, int Length, const tMenuMsg_AddIte
}
else
{
}
else
{
- char tmp = item->Label[item->KeyOffset];
// Get width of preceding substring
WM_Render_GetTextDims(NULL, item->Label, item->KeyOffset, &item->UnderlineX, NULL);
// Get the width of the underlined character
// Get width of preceding substring
WM_Render_GetTextDims(NULL, item->Label, item->KeyOffset, &item->UnderlineX, NULL);
// Get the width of the underlined character
- item->Label[item->KeyOffset] = tmp;
// NOTE: 1 makes only one character be parsed, even if it is >1 byte long
WM_Render_GetTextDims(
NULL, item->Label+item->KeyOffset, 1,
&item->UnderlineW, NULL
);
// NOTE: 1 makes only one character be parsed, even if it is >1 byte long
WM_Render_GetTextDims(
NULL, item->Label+item->KeyOffset, 1,
&item->UnderlineW, NULL
);
- item->Label[item->KeyOffset+1] = tmp;
}
// - Labels
WM_Render_GetTextDims(NULL, item->Label, -1, &item->LabelWidth, NULL);
}
// - Labels
WM_Render_GetTextDims(NULL, item->Label, -1, &item->LabelWidth, NULL);
@@
-293,12
+290,16
@@
int Renderer_Menu_int_AddItem(tWindow *Window, int Length, const tMenuMsg_AddIte
WM_Render_GetTextDims(NULL, item->Shortcut, -1, &item->ShortcutWidth, NULL);
else
item->ShortcutWidth = 0;
WM_Render_GetTextDims(NULL, item->Shortcut, -1, &item->ShortcutWidth, NULL);
else
item->ShortcutWidth = 0;
-
+
+ // Get maximum lengths (to determine the size of the menu
if( item->LabelWidth > info->MaxLabelWidth )
info->MaxLabelWidth = item->LabelWidth;
if( item->ShortcutWidth > info->MaxShortcutWidth )
info->MaxShortcutWidth = item->ShortcutWidth;
if( item->LabelWidth > info->MaxLabelWidth )
info->MaxLabelWidth = item->LabelWidth;
if( item->ShortcutWidth > info->MaxShortcutWidth )
info->MaxShortcutWidth = item->ShortcutWidth;
+ // Update width
+ // TODO: Check, do I want to resize down too?
+ // TODO: Take into account padding too
if( info->MaxLabelWidth + info->MaxShortcutWidth + ciMenu_Gap > info->CachedW )
{
info->CachedW = ciMenu_LeftPadding + info->MaxLabelWidth
if( info->MaxLabelWidth + info->MaxShortcutWidth + ciMenu_Gap > info->CachedW )
{
info->CachedW = ciMenu_LeftPadding + info->MaxLabelWidth
@@
-310,6
+311,9
@@
int Renderer_Menu_int_AddItem(tWindow *Window, int Length, const tMenuMsg_AddIte
return 0;
}
return 0;
}
+/**
+ * \brief Convert coordinates into an item index
+ */
int Renderer_Menu_int_GetItemByPos(tWindow *Window, tMenuWindowInfo *Info, int X, int Y)
{
int i;
int Renderer_Menu_int_GetItemByPos(tWindow *Window, tMenuWindowInfo *Info, int X, int Y)
{
int i;
UCC
git Repository :: git.ucc.asn.au