summaryrefslogtreecommitdiff
path: root/win
diff options
context:
space:
mode:
authorleo2005-03-08 20:12:51 +0000
committerleo2005-03-08 20:12:51 +0000
commit342008b552f16892b5abfe86eadce9feee4d0da0 (patch)
treef7a6c0bc9c492fdc228f815e1a9098887f3ec57b /win
parent5430dc9b0c6ea433458cac5999fc7dea58778d56 (diff)
Allowed more commands to have their shortcuts changed,
Fixed a memory leak in the BMP Menu class. git-svn-id: http://svn.leocad.org/trunk@387 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win')
-rw-r--r--win/Bmpmenu.cpp18
-rw-r--r--win/Bmpmenu.h1
-rw-r--r--win/Mainfrm.cpp26
-rw-r--r--win/System.cpp12
4 files changed, 49 insertions, 8 deletions
diff --git a/win/Bmpmenu.cpp b/win/Bmpmenu.cpp
index 2f0864e..67bfb0a 100644
--- a/win/Bmpmenu.cpp
+++ b/win/Bmpmenu.cpp
@@ -95,7 +95,8 @@ CBMPMenu::CBMPMenu()
m_bitmapBackground = RGB(192,192,192); //gray
m_bitmapBackgroundFlag=FALSE;
GetCPInfo(CP_ACP,&CPInfo);
- m_List.Create (IDB_VIEWPORTS, 41, 0, RGB (192,192,192));
+ if (!m_List.m_hImageList)
+ m_List.Create (IDB_VIEWPORTS, 41, 0, RGB (192,192,192));
}
CBMPMenu::~CBMPMenu()
@@ -1410,3 +1411,18 @@ BOOL CBMPMenu::ChangeMenuItemShortcut(const char *Shortcut, UINT nID)
return (CMenu::ModifyMenu(nID,mdata->nFlags,nID,(LPCTSTR)mdata));
}
+BOOL CBMPMenu::DeleteMenu(UINT nPosition, UINT nFlags)
+{
+ if (nFlags == MF_BYPOSITION)
+ m_MenuList.RemoveAt(nPosition);
+ else
+ {
+ int nLoc;
+
+ CBMPMenu *psubmenu = FindMenuOption(nPosition, nLoc);
+ if (psubmenu && nLoc >= 0)
+ psubmenu->m_MenuList.RemoveAt(nLoc);
+ }
+
+ return (CMenu::DeleteMenu(nPosition, nFlags));
+}
diff --git a/win/Bmpmenu.h b/win/Bmpmenu.h
index 8866ea7..bc17aa1 100644
--- a/win/Bmpmenu.h
+++ b/win/Bmpmenu.h
@@ -116,6 +116,7 @@ public:
BOOL AppendODMenuW(wchar_t *lpstrText, UINT nFlags = MF_OWNERDRAW, UINT nID = 0, int nIconNormal = -1); // Owner-Drawn Append
BOOL ChangeMenuItemShortcut(const char *Shortcut, UINT nID);
+ BOOL DeleteMenu(UINT nPosition, UINT nFlags);
BOOL ModifyODMenuA(const char *lpstrText,UINT nID=0,int nIconNormal=-1);
BOOL ModifyODMenuA(const char *lpstrText,const char *OptionText,int nIconNormal);
BOOL ModifyODMenuW(wchar_t *lpstrText,UINT nID=0,int nIconNormal=-1);
diff --git a/win/Mainfrm.cpp b/win/Mainfrm.cpp
index 3e4bdee..43d393f 100644
--- a/win/Mainfrm.cpp
+++ b/win/Mainfrm.cpp
@@ -1196,6 +1196,13 @@ void CMainFrame::UpdateMenuAccelerators()
ID_VIEW_STEP_DELETE, // LC_VIEW_STEP_DELETE
ID_ANIMATOR_STOP, // LC_VIEW_STOP
ID_ANIMATOR_PLAY, // LC_VIEW_PLAY
+ ID_CAMERA_FIRST + 0, // LC_VIEW_CAMERA_FRONT,
+ ID_CAMERA_FIRST + 1, // LC_VIEW_CAMERA_BACK,
+ ID_CAMERA_FIRST + 2, // LC_VIEW_CAMERA_TOP,
+ ID_CAMERA_FIRST + 3, // LC_VIEW_CAMERA_BOTTOM,
+ ID_CAMERA_FIRST + 4, // LC_VIEW_CAMERA_LEFT,
+ ID_CAMERA_FIRST + 5, // LC_VIEW_CAMERA_RIGHT,
+ ID_CAMERA_FIRST + 6, // LC_VIEW_CAMERA_MAIN,
0, // LC_VIEW_CAMERA_MENU
ID_VIEW_CAMERAS_RESET, // LC_VIEW_CAMERA_RESET
0, // LC_VIEW_AUTOPAN
@@ -1207,6 +1214,25 @@ void CMainFrame::UpdateMenuAccelerators()
0, // LC_TOOLBAR_SNAPMOVEMENU
0, // LC_TOOLBAR_FASTRENDER
0, // LC_TOOLBAR_BACKGROUND
+ 0, // LC_EDIT_MOVE_SNAP_0,
+ 0, // LC_EDIT_MOVE_SNAP_1,
+ 0, // LC_EDIT_MOVE_SNAP_2,
+ 0, // LC_EDIT_MOVE_SNAP_3,
+ 0, // LC_EDIT_MOVE_SNAP_4,
+ 0, // LC_EDIT_MOVE_SNAP_5,
+ 0, // LC_EDIT_MOVE_SNAP_6,
+ 0, // LC_EDIT_MOVE_SNAP_7,
+ 0, // LC_EDIT_MOVE_SNAP_8,
+ 0, // LC_EDIT_MOVE_SNAP_9,
+ 0, // LC_EDIT_ANGLE_SNAP_0,
+ 0, // LC_EDIT_ANGLE_SNAP_1,
+ 0, // LC_EDIT_ANGLE_SNAP_2,
+ 0, // LC_EDIT_ANGLE_SNAP_3,
+ 0, // LC_EDIT_ANGLE_SNAP_4,
+ 0, // LC_EDIT_ANGLE_SNAP_5,
+ 0, // LC_EDIT_ANGLE_SNAP_6,
+ 0, // LC_EDIT_ANGLE_SNAP_7,
+ 0, // LC_EDIT_ANGLE_SNAP_8,
};
m_bmpMenu.Attach(m_hMenuDefault);
diff --git a/win/System.cpp b/win/System.cpp
index af1710e..6d951ce 100644
--- a/win/System.cpp
+++ b/win/System.cpp
@@ -777,8 +777,6 @@ void SystemUpdateCameraMenu(Camera* pCamera)
CBMPMenu* pMainMenu = (CBMPMenu*)GetMainMenu(2)->GetSubMenu(13);
CMenu* pPopupMenu = menuPopups.GetSubMenu(1)->GetSubMenu(3);
Camera* pFirst = pCamera;
- char tmp[90];
- const char* s = "FBTULRM";
int i;
while (pMainMenu->GetMenuItemCount())
@@ -802,12 +800,10 @@ void SystemUpdateCameraMenu(Camera* pCamera)
pCamera = pFirst;
for (i = 0; pCamera && (i < 7); i++, pCamera = pCamera->m_pNext)
{
- strcpy(tmp, pCamera->GetName());
- strcat(tmp, "\t ");
- tmp[strlen(tmp)-1] = s[i];
+ pMainMenu->AppendODMenu(pCamera->GetName(), MF_ENABLED, i + ID_CAMERA_FIRST);
+ pPopupMenu->AppendMenu(MF_STRING, i + ID_CAMERA_FIRST, pCamera->GetName());
- pMainMenu->AppendODMenu(tmp, MF_ENABLED, i + ID_CAMERA_FIRST);
- pPopupMenu->AppendMenu(MF_STRING, i + ID_CAMERA_FIRST, tmp);
+ pMainMenu->ChangeMenuItemShortcut("str", i + ID_CAMERA_FIRST);
}
pMainMenu->AppendODMenu("", MF_SEPARATOR);
@@ -816,6 +812,8 @@ void SystemUpdateCameraMenu(Camera* pCamera)
pPopupMenu->AppendMenu(MF_STRING, ID_VIEW_CAMERAS_RESET, "Reset");
// pMainMenu->AppendODMenu("Adjust...\t", MF_ENABLED, ID_VIEW_VIEWPOINT);
// pPopupMenu->AppendODMenu("Adjust...\t", MF_ENABLED, ID_VIEW_VIEWPOINT);
+
+ ((CMainFrame*)AfxGetMainWnd())->UpdateMenuAccelerators();
}
extern UINT AFXAPI AfxGetFileTitle(LPCTSTR lpszPathName, LPTSTR lpszTitle, UINT nMax);