Don't use magic values in GraphicsWindow::menu[].level
We can identify the "Open Recent" and "Import Recent" submenus just as easily by looking at the value of the .id field (MNU_OPEN_RECENT and MNU_GROUP_RECENT, respectively).pull/3/head
parent
66758b9595
commit
37063840db
|
@ -22,7 +22,7 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
|
||||||
{ 0, "&File", 0, 0, NULL },
|
{ 0, "&File", 0, 0, NULL },
|
||||||
{ 1, "&New\tCtrl+N", MNU_NEW, 'N'|C, mFile },
|
{ 1, "&New\tCtrl+N", MNU_NEW, 'N'|C, mFile },
|
||||||
{ 1, "&Open...\tCtrl+O", MNU_OPEN, 'O'|C, mFile },
|
{ 1, "&Open...\tCtrl+O", MNU_OPEN, 'O'|C, mFile },
|
||||||
{10, "Open &Recent", MNU_OPEN_RECENT, 0, mFile },
|
{ 1, "Open &Recent", MNU_OPEN_RECENT, 0, mFile },
|
||||||
{ 1, "&Save\tCtrl+S", MNU_SAVE, 'S'|C, mFile },
|
{ 1, "&Save\tCtrl+S", MNU_SAVE, 'S'|C, mFile },
|
||||||
{ 1, "Save &As...", MNU_SAVE_AS, 0, mFile },
|
{ 1, "Save &As...", MNU_SAVE_AS, 0, mFile },
|
||||||
{ 1, NULL, 0, 0, NULL },
|
{ 1, NULL, 0, 0, NULL },
|
||||||
|
@ -83,7 +83,7 @@ const GraphicsWindow::MenuEntry GraphicsWindow::menu[] = {
|
||||||
{ 1, "&Lathe\tShift+L", MNU_GROUP_LATHE, 'L'|S, mGrp },
|
{ 1, "&Lathe\tShift+L", MNU_GROUP_LATHE, 'L'|S, mGrp },
|
||||||
{ 1, NULL, 0, 0, NULL },
|
{ 1, NULL, 0, 0, NULL },
|
||||||
{ 1, "Import / Assemble...\tShift+I", MNU_GROUP_IMPORT, 'I'|S, mGrp },
|
{ 1, "Import / Assemble...\tShift+I", MNU_GROUP_IMPORT, 'I'|S, mGrp },
|
||||||
{11, "Import Recent", MNU_GROUP_RECENT, 0, mGrp },
|
{ 1, "Import Recent", MNU_GROUP_RECENT, 0, mGrp },
|
||||||
|
|
||||||
{ 0, "&Sketch", 0, 0, NULL },
|
{ 0, "&Sketch", 0, 0, NULL },
|
||||||
{ 1, "In &Workplane\t2", MNU_SEL_WORKPLANE, '2', mReq },
|
{ 1, "In &Workplane\t2", MNU_SEL_WORKPLANE, '2', mReq },
|
||||||
|
|
|
@ -983,19 +983,19 @@ HMENU CreateGraphicsWindowMenus(void)
|
||||||
SubMenus[subMenu] = m;
|
SubMenus[subMenu] = m;
|
||||||
subMenu++;
|
subMenu++;
|
||||||
} else if(SS.GW.menu[i].level == 1) {
|
} else if(SS.GW.menu[i].level == 1) {
|
||||||
if(SS.GW.menu[i].label) {
|
if(SS.GW.menu[i].id == GraphicsWindow::MNU_OPEN_RECENT) {
|
||||||
|
RecentOpenMenu = CreateMenu();
|
||||||
|
AppendMenu(m, MF_STRING | MF_POPUP,
|
||||||
|
(UINT_PTR)RecentOpenMenu, SS.GW.menu[i].label);
|
||||||
|
} else if(SS.GW.menu[i].id == GraphicsWindow::MNU_GROUP_RECENT) {
|
||||||
|
RecentImportMenu = CreateMenu();
|
||||||
|
AppendMenu(m, MF_STRING | MF_POPUP,
|
||||||
|
(UINT_PTR)RecentImportMenu, SS.GW.menu[i].label);
|
||||||
|
} else if(SS.GW.menu[i].label) {
|
||||||
AppendMenu(m, MF_STRING, SS.GW.menu[i].id, SS.GW.menu[i].label);
|
AppendMenu(m, MF_STRING, SS.GW.menu[i].id, SS.GW.menu[i].label);
|
||||||
} else {
|
} else {
|
||||||
AppendMenu(m, MF_SEPARATOR, SS.GW.menu[i].id, "");
|
AppendMenu(m, MF_SEPARATOR, SS.GW.menu[i].id, "");
|
||||||
}
|
}
|
||||||
} else if(SS.GW.menu[i].level == 10) {
|
|
||||||
RecentOpenMenu = CreateMenu();
|
|
||||||
AppendMenu(m, MF_STRING | MF_POPUP,
|
|
||||||
(UINT_PTR)RecentOpenMenu, SS.GW.menu[i].label);
|
|
||||||
} else if(SS.GW.menu[i].level == 11) {
|
|
||||||
RecentImportMenu = CreateMenu();
|
|
||||||
AppendMenu(m, MF_STRING | MF_POPUP,
|
|
||||||
(UINT_PTR)RecentImportMenu, SS.GW.menu[i].label);
|
|
||||||
} else oops();
|
} else oops();
|
||||||
}
|
}
|
||||||
RefreshRecentMenus();
|
RefreshRecentMenus();
|
||||||
|
|
Loading…
Reference in New Issue