1 // MyLoadMenu
2
3 #include "StdAfx.h"
4
5 // For compilers that support precompilation, includes "wx/wx.h".
6 #include "wx/wxprec.h"
7
8 #ifdef __BORLANDC__
9 #pragma hdrstop
10 #endif
11
12 #ifndef WX_PRECOMP
13 #include "wx/wx.h"
14 #endif
15
16 typedef wxMenuBar * HMENU;
17
18 #include "Common/StringConvert.h"
19
20 // FIXME #include "Windows/Menu.h"
21 #include "Windows/Error.h"
22 // FIXME #include "Windows/Clipboard.h"
23
24 #include "../../PropID.h"
25
26 #include "resource.h"
27 #include "App.h"
28 // FIXME #include "AboutDialog.h"
29 #include "../Common/CompressCall.h"
30
31 #include "HelpUtils.h"
32 #include "LangUtils.h"
33 #include "PluginInterface.h"
34
35 static const UINT kOpenBookmarkMenuID = 730;
36 static const UINT kSetBookmarkMenuID = 740;
37
38 extern HINSTANCE g_hInstance;
39
40 static LPCWSTR kFMHelpTopic = L"fm/index.htm";
41
42 extern void OptionsDialog(HWND hwndOwner, HINSTANCE hInstance);
43
44 using namespace NWindows;
45
46 static const int kFileMenuIndex = 0;
47 static const int kEditMenuIndex = 1;
48 static const int kViewMenuIndex = 2;
49 static const int kBookmarksMenuIndex = kViewMenuIndex + 1;
50
51 struct CStringLangPair
52 {
53 wchar_t *String;
54 UINT32 LangID;
55 };
56
57 static CStringLangPair kStringLangPairs[] =
58 {
59 { L"&File", 0x03000102 },
60 { L"&Edit", 0x03000103 },
61 { L"&View", 0x03000104 },
62 { L"&Bookmarks", 0x03000107 },
63 { L"&Tools", 0x03000105 },
64 { L"&Help", 0x03000106 },
65 };
66
67 UINT32 kAddToFavoritesLangID = 0x03000710;
68 UINT32 kToolbarsLangID = 0x03000451;
69
70 /*
71 static int FindStringLangItem(const UString &anItem)
72 {
73 for (int i = 0; i < sizeof(kStringLangPairs) /
74 sizeof(kStringLangPairs[0]); i++)
75 if (anItem.CompareNoCase(kStringLangPairs[i].String) == 0)
76 return i;
77 return -1;
78 }
79 */
80
81 static CIDLangPair kIDLangPairs[] =
82 {
83 // File
84 { IDM_FILE_OPEN, 0x03000210 },
85 { IDM_FILE_OPEN_INSIDE, 0x03000211 },
86 { IDM_FILE_OPEN_OUTSIDE, 0x03000212 },
87 // { IDM_FILE_VIEW, 0x03000220 }, // FIXME : does not exist !
88 { IDM_FILE_EDIT, 0x03000221 },
89 { IDM_RENAME, 0x03000230 },
90 { IDM_COPY_TO, 0x03000231 },
91 { IDM_MOVE_TO, 0x03000232 },
92 { IDM_DELETE, 0x03000233 },
93 { IDM_FILE_PROPERTIES, 0x03000240 },
94 { IDM_FILE_COMMENT, 0x03000241 },
95 { IDM_FILE_CRC, 0x03000242 },
96 { IDM_FILE_SPLIT, 0x03000270 },
97 { IDM_FILE_COMBINE, 0x03000271 },
98 { IDM_CREATE_FOLDER, 0x03000250 },
99 { IDM_CREATE_FILE, 0x03000251 },
100 // FIXME { IDCLOSE, 0x03000260 },
101
102 // Edit
103 { IDM_EDIT_CUT, 0x03000320 },
104 { IDM_EDIT_COPY, 0x03000321 },
105 { IDM_EDIT_PASTE, 0x03000322 },
106
107 { IDM_SELECT_ALL, 0x03000330 },
108 { IDM_DESELECT_ALL, 0x03000331 },
109 { IDM_INVERT_SELECTION, 0x03000332 },
110 { IDM_SELECT, 0x03000333 },
111 { IDM_DESELECT, 0x03000334 },
112 { IDM_SELECT_BY_TYPE, 0x03000335 },
113 { IDM_DESELECT_BY_TYPE, 0x03000336 },
114
115 { IDM_VIEW_LARGE_ICONS, 0x03000410 },
116 { IDM_VIEW_SMALL_ICONS, 0x03000411 },
117 { IDM_VIEW_LIST, 0x03000412 },
118 { IDM_VIEW_DETAILS, 0x03000413 },
119
120 { IDM_VIEW_ARANGE_BY_NAME, 0x02000204 },
121 { IDM_VIEW_ARANGE_BY_TYPE, 0x02000214 },
122 { IDM_VIEW_ARANGE_BY_DATE, 0x0200020C },
123 { IDM_VIEW_ARANGE_BY_SIZE, 0x02000207 },
124 { IDM_VIEW_ARANGE_NO_SORT, 0x03000420 },
125
126 { IDM_OPEN_ROOT_FOLDER, 0x03000430 },
127 { IDM_OPEN_PARENT_FOLDER, 0x03000431 },
128 { IDM_FOLDERS_HISTORY, 0x03000432 },
129
130 { IDM_VIEW_REFRESH, 0x03000440 },
131
132 { IDM_VIEW_FLAT_VIEW, 0x03000449 },
133 { IDM_VIEW_TWO_PANELS, 0x03000450 },
134 { IDM_VIEW_ARCHIVE_TOOLBAR, 0x03000460 },
135 { IDM_VIEW_STANDARD_TOOLBAR, 0x03000461 },
136 { IDM_VIEW_TOOLBARS_LARGE_BUTTONS, 0x03000462 },
137 { IDM_VIEW_TOOLBARS_SHOW_BUTTONS_TEXT, 0x03000463 },
138
139 { IDM_OPTIONS, 0x03000510 },
140 { IDM_BENCHMARK, 0x03000511 },
141
142 { IDM_HELP_CONTENTS, 0x03000610 },
143 { IDM_ABOUT, 0x03000620 },
144
145 { 12111 , 0x03000710 }, // FIXME kAddToFavoritesLangID
146 { 12112 , 0x03000451 } // FIXME kToolbarsLangID
147 };
148
149
150 #ifdef _WIN32
FindLangItem(int ControlID)151 static int FindLangItem(int ControlID)
152 {
153 for (int i = 0; i < sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]); i++)
154 if (kIDLangPairs[i].ControlID == ControlID)
155 return i;
156 return -1;
157 }
158 #endif
159
160
161 /*
162 static bool g_IsNew_fMask = true;
163
164 class CInit_fMask
165 {
166 public:
167 CInit_fMask()
168 {
169 g_IsNew_fMask = false;
170 OSVERSIONINFO vi;
171 vi.dwOSVersionInfoSize = sizeof(vi);
172 if (::GetVersionEx(&vi))
173 {
174 g_IsNew_fMask = (vi.dwMajorVersion > 4 ||
175 (vi.dwMajorVersion == 4 && vi.dwMinorVersion > 0));
176 }
177 g_IsNew_fMask = false;
178 }
179 } g_Init_fMask;
180
181 // it's hack for supporting Windows NT
182 // constants are from WinUser.h
183
184 #if(WINVER < 0x0500)
185 #define MIIM_STRING 0x00000040
186 #define MIIM_BITMAP 0x00000080
187 #define MIIM_FTYPE 0x00000100
188 #endif
189
190 static UINT Get_fMaskForString()
191 {
192 return g_IsNew_fMask ? MIIM_STRING : MIIM_TYPE;
193 }
194
195 static UINT Get_fMaskForFTypeAndString()
196 {
197 return g_IsNew_fMask ? (MIIM_STRING | MIIM_FTYPE) : MIIM_TYPE;
198 }
199 */
200
201 #ifdef _WIN32
Get_fMaskForString()202 static UINT Get_fMaskForString()
203 {
204 return MIIM_TYPE;
205 }
206
Get_fMaskForFTypeAndString()207 static UINT Get_fMaskForFTypeAndString()
208 {
209 return MIIM_TYPE;
210 }
211 #endif
212
213
MyChangeItem(wxMenuItem * mi,int LangID)214 static void MyChangeItem(wxMenuItem * mi,int LangID)
215 {
216 UString newString = LangString(LangID);
217 if (newString.IsEmpty())
218 return;
219 wxString ss = mi->GetItemLabel();
220 UString shorcutString((const wchar_t *)ss); // = item.StringValue;
221 int tabPos = shorcutString.ReverseFind(wchar_t('\t'));
222 if (tabPos >= 0)
223 newString += shorcutString.Mid(tabPos);
224 // printf("Change Menu : %ls => %ls\n",(const wchar_t *)ss,(const wchar_t *)newString);
225 mi->SetItemLabel((const wchar_t *)newString);
226
227 }
228
MyChangeMenu(HMENU menuLoc,int level,int menuIndex)229 static void MyChangeMenu(HMENU menuLoc, int level, int menuIndex)
230 {
231 // Sets the label of the top-level menus
232 for (int i1= 0; i1< sizeof(kStringLangPairs) / sizeof(kStringLangPairs[0]); i1++)
233 {
234 UString newString = LangString(kStringLangPairs[i1].LangID);
235 if (! newString.IsEmpty()) menuLoc->SetMenuLabel(i1, (const TCHAR *)newString);
236 }
237
238 // sub-menu items
239 for (int i = 0; i < sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]); i++)
240 {
241 wxMenuItem * mi = menuLoc->FindItem(kIDLangPairs[i].ControlID);
242 if (mi)
243 {
244 MyChangeItem(mi,kIDLangPairs[i].LangID);
245 }
246 else
247 printf("Change Menu : id=%d index=%d<>\n",kIDLangPairs[i].ControlID,i);
248 }
249 }
250
251 #ifdef _WIN32
252 CMenu g_FileMenu;
253
254 class CFileMenuDestroyer
255 {
256 public:
~CFileMenuDestroyer()257 ~CFileMenuDestroyer()
258 {
259 if ((HMENU)g_FileMenu != 0)
260 g_FileMenu.Destroy();
261 }
262 } g_FileMenuDestroyer;
263 #endif
264
265
MyLoadMenu(HWND hWnd)266 void MyLoadMenu(HWND hWnd)
267 {
268 #ifdef _WIN32
269 if ((HMENU)g_FileMenu != 0)
270 g_FileMenu.Destroy();
271 HMENU oldMenu = ::GetMenu(hWnd);
272 HMENU baseMenu = ::LoadMenu(g_hInstance, MAKEINTRESOURCE(IDM_MENU));
273 ::SetMenu(hWnd, baseMenu);
274 ::DestroyMenu(oldMenu);
275 if (!g_LangID.IsEmpty())
276 {
277 HMENU menuOld = ::GetMenu(hWnd);
278 MyChangeMenu(menuOld, 0, 0);
279 }
280 ::DrawMenuBar(hWnd);
281 #else
282 extern void rc_MyLoadMenu(HWND hWnd);
283 rc_MyLoadMenu(hWnd);
284 if (!g_LangID.IsEmpty())
285 {
286 HMENU menuOld = ((wxFrame *)hWnd)->GetMenuBar(); // ::GetMenu(hWnd);
287 MyChangeMenu(menuOld, 0, 0);
288 }
289 #endif
290 }
291
292 #ifdef _WIN32
293 extern HWND g_HWND;
MyLoadMenu()294 void MyLoadMenu()
295 {
296 MyLoadMenu(g_HWND);
297 }
298
CopyMenu(HMENU srcMenuSpec,HMENU destMenuSpec)299 static void CopyMenu(HMENU srcMenuSpec, HMENU destMenuSpec)
300 {
301 CMenu srcMenu;
302 srcMenu.Attach(srcMenuSpec);
303 CMenu destMenu;
304 destMenu.Attach(destMenuSpec);
305 int startPos = 0;
306 for (int i = 0; i < srcMenu.GetItemCount(); i++)
307 {
308 CMenuItem item;
309 item.fMask = MIIM_STATE | MIIM_ID | Get_fMaskForFTypeAndString();
310 item.fType = MFT_STRING;
311 if (srcMenu.GetItem(i, true, item))
312 if (destMenu.InsertItem(startPos, true, item))
313 startPos++;
314 }
315 }
316
OnMenuActivating(HWND,HMENU hMenu,int position)317 void OnMenuActivating(HWND /* hWnd */, HMENU hMenu, int position)
318 {
319 if (::GetSubMenu(::GetMenu(g_HWND), position) != hMenu)
320 return;
321 if (position == kFileMenuIndex)
322 {
323 if ((HMENU)g_FileMenu == 0)
324 {
325 g_FileMenu.CreatePopup();
326 CopyMenu(hMenu, g_FileMenu);
327 }
328 CMenu menu;
329 menu.Attach(hMenu);
330 while (menu.GetItemCount() > 0)
331 {
332 if (!menu.RemoveItem(0, MF_BYPOSITION))
333 break;
334 }
335 // CopyMenu(g_FileMenu, hMenu);
336 g_App.GetFocusedPanel().CreateFileMenu(hMenu);
337 }
338 else if (position == kEditMenuIndex)
339 {
340 /*
341 CMenu menu;
342 menu.Attach(hMenu);
343 menu.EnableItem(IDM_EDIT_CUT, MF_ENABLED);
344 menu.EnableItem(IDM_EDIT_COPY, MF_ENABLED);
345 menu.EnableItem(IDM_EDIT_PASTE, IsClipboardFormatAvailableHDROP() ? MF_ENABLED : MF_GRAYED);
346 */
347 }
348 else if (position == kViewMenuIndex)
349 {
350 // View;
351 CMenu menu;
352 menu.Attach(hMenu);
353 menu.CheckRadioItem(IDM_VIEW_LARGE_ICONS, IDM_VIEW_DETAILS,
354 IDM_VIEW_LARGE_ICONS + g_App.GetListViewMode(), MF_BYCOMMAND);
355 menu.CheckItem(IDM_VIEW_TWO_PANELS, MF_BYCOMMAND |
356 ((g_App.NumPanels == 2) ? MF_CHECKED : MF_UNCHECKED));
357 menu.CheckItem(IDM_VIEW_FLAT_VIEW, MF_BYCOMMAND |
358 ((g_App.GetFlatMode()) ? MF_CHECKED : MF_UNCHECKED));
359 menu.CheckItem(IDM_VIEW_ARCHIVE_TOOLBAR, MF_BYCOMMAND |
360 (g_App.ShowArchiveToolbar ? MF_CHECKED : MF_UNCHECKED));
361 menu.CheckItem(IDM_VIEW_STANDARD_TOOLBAR, MF_BYCOMMAND |
362 (g_App.ShowStandardToolbar ? MF_CHECKED : MF_UNCHECKED));
363 menu.CheckItem(IDM_VIEW_TOOLBARS_LARGE_BUTTONS, MF_BYCOMMAND |
364 (g_App.LargeButtons ? MF_CHECKED : MF_UNCHECKED));
365 menu.CheckItem(IDM_VIEW_TOOLBARS_SHOW_BUTTONS_TEXT, MF_BYCOMMAND |
366 (g_App.ShowButtonsLables ? MF_CHECKED : MF_UNCHECKED));
367 }
368 else if (position == kBookmarksMenuIndex)
369 {
370 CMenu menu;
371 menu.Attach(hMenu);
372
373 CMenu subMenu;
374 subMenu.Attach(menu.GetSubMenu(0));
375 while (subMenu.GetItemCount() > 0)
376 subMenu.RemoveItem(subMenu.GetItemCount() - 1, MF_BYPOSITION);
377 int i;
378 for (i = 0; i < 10; i++)
379 {
380 UString s = LangString(IDS_BOOKMARK, 0x03000720);
381 s += L" ";
382 wchar_t c = (wchar_t)(L'0' + i);
383 s += c;
384 s += L"\tAlt+Shift+";
385 s += c;
386 subMenu.AppendItem(MF_STRING, kSetBookmarkMenuID + i, s);
387 }
388
389 while (menu.GetItemCount() > 2)
390 menu.RemoveItem(menu.GetItemCount() - 1, MF_BYPOSITION);
391
392 for (i = 0; i < 10; i++)
393 {
394 UString path = g_App.AppState.FastFolders.GetString(i);
395 const int kMaxSize = 100;
396 const int kFirstPartSize = kMaxSize / 2;
397 if (path.Length() > kMaxSize)
398 {
399 path = path.Left(kFirstPartSize) + UString(L" ... ") +
400 path.Right(kMaxSize - kFirstPartSize);
401 }
402 UString s = path;
403 if (s.IsEmpty())
404 s = L"-";
405 s += L"\tAlt+";
406 s += (wchar_t)(L'0' + i);
407 menu.AppendItem(MF_STRING, kOpenBookmarkMenuID + i, s);
408 }
409 }
410 }
411
412 /*
413 It doesn't help
414 void OnMenuUnActivating(HWND hWnd, HMENU hMenu, int id)
415 {
416 if (::GetSubMenu(::GetMenu(g_HWND), 0) != hMenu)
417 return;
418 // g_App.GetFocusedPanel()._contextMenu.Release();
419 }
420
421 void OnMenuUnActivating(HWND hWnd)
422 {
423 }
424 */
425
426
LoadFileMenu(HMENU hMenu,int startPos,bool,bool programMenu)427 void LoadFileMenu(HMENU hMenu, int startPos, bool /* forFileMode */, bool programMenu)
428 {
429 {
430 CMenu srcMenu;
431 srcMenu.Attach(::GetSubMenu(::GetMenu(g_HWND), 0));
432 if ((HMENU)g_FileMenu == 0)
433 {
434 g_FileMenu.CreatePopup();
435 CopyMenu(srcMenu, g_FileMenu);
436 }
437 }
438
439 CMenu destMenu;
440 destMenu.Attach(hMenu);
441
442 for (int i = 0; i < g_FileMenu.GetItemCount(); i++)
443 {
444 CMenuItem item;
445
446 item.fMask = MIIM_STATE | MIIM_ID | Get_fMaskForFTypeAndString();
447 item.fType = MFT_STRING;
448 if (g_FileMenu.GetItem(i, true, item))
449 {
450 if (!programMenu)
451 if (item.wID == IDCLOSE)
452 continue;
453 /*
454 bool createItem = (item.wID == IDM_CREATE_FOLDER || item.wID == IDM_CREATE_FILE);
455 if (forFileMode)
456 {
457 if (createItem)
458 continue;
459 }
460 else
461 {
462 if (!createItem)
463 continue;
464 }
465 */
466 if (destMenu.InsertItem(startPos, true, item))
467 startPos++;
468 }
469 }
470 while (destMenu.GetItemCount() > 0)
471 {
472 CMenuItem item;
473 item.fMask = MIIM_TYPE;
474 item.fType = 0;
475 // item.dwTypeData = 0;
476 int lastIndex = destMenu.GetItemCount() - 1;
477 if (!destMenu.GetItem(lastIndex, true, item))
478 break;
479 if(item.fType != MFT_SEPARATOR)
480 break;
481 if (!destMenu.RemoveItem(lastIndex, MF_BYPOSITION))
482 break;
483 }
484 }
485 #endif
486
ExecuteFileCommand(int id)487 bool ExecuteFileCommand(int id)
488 {
489 if (id >= kPluginMenuStartID)
490 {
491 #ifdef _WIN32
492 g_App.GetFocusedPanel().InvokePluginCommand(id);
493 g_App.GetFocusedPanel()._sevenZipContextMenu.Release();
494 g_App.GetFocusedPanel()._systemContextMenu.Release();
495 #endif
496 return true;
497 }
498
499 switch (id)
500 {
501 // File
502 case IDM_FILE_OPEN:
503 g_App.OpenItem();
504 break;
505 case IDM_FILE_OPEN_INSIDE:
506 g_App.OpenItemInside();
507 break;
508 case IDM_FILE_OPEN_OUTSIDE:
509 g_App.OpenItemOutside();
510 break;
511 case IDM_FILE_VIEW:
512 break;
513 case IDM_FILE_EDIT:
514 g_App.EditItem();
515 break;
516 case IDM_RENAME:
517 g_App.Rename();
518 break;
519 case IDM_COPY_TO:
520 g_App.CopyTo();
521 break;
522 case IDM_MOVE_TO:
523 g_App.MoveTo();
524 break;
525 case IDM_DELETE:
526 {
527 #ifdef _WIN32 // FIXME
528 bool shift = (::GetKeyState(VK_SHIFT) & 0x8000) != 0;
529 g_App.Delete(!shift);
530 #endif
531 break;
532 }
533 case IDM_FILE_CRC:
534 g_App.CalculateCrc();
535 break;
536 case IDM_FILE_SPLIT:
537 g_App.Split();
538 break;
539 case IDM_FILE_COMBINE:
540 g_App.Combine();
541 break;
542 case IDM_FILE_PROPERTIES:
543 g_App.Properties();
544 break;
545 case IDM_FILE_COMMENT:
546 g_App.Comment();
547 break;
548
549 case IDM_CREATE_FOLDER:
550 g_App.CreateFolder();
551 break;
552 case IDM_CREATE_FILE:
553 g_App.CreateFile();
554 break;
555 default:
556 return false;
557 }
558 return true;
559 }
560
OnMenuCommand(HWND hWnd,int id)561 bool OnMenuCommand(HWND hWnd, int id)
562 {
563 printf("DEBUG : OnMenuCommand(%p,id=%d)-0\n",hWnd,id);
564
565 if (ExecuteFileCommand(id))
566 return true;
567
568 printf("DEBUG : OnMenuCommand(%p,id=%d)-1\n",hWnd,id);
569
570 switch (id)
571 {
572 // File
573 /* FIXME
574 case IDCLOSE:
575 SendMessage(hWnd, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, 0), (LPARAM)hWnd);
576 SendMessage (hWnd, WM_CLOSE, 0, 0);
577 break;
578 */
579
580 // Edit
581 case IDM_EDIT_CUT:
582 g_App.EditCut();
583 break;
584 case IDM_EDIT_COPY:
585 g_App.EditCopy();
586 break;
587 case IDM_EDIT_PASTE:
588 g_App.EditPaste();
589 break;
590 case IDM_SELECT_ALL:
591 g_App.SelectAll(true);
592 g_App.RefreshStatusBar();
593 break;
594 case IDM_DESELECT_ALL:
595 g_App.SelectAll(false);
596 g_App.RefreshStatusBar();
597 break;
598 case IDM_INVERT_SELECTION:
599 g_App.InvertSelection();
600 g_App.RefreshStatusBar();
601 break;
602 case IDM_SELECT:
603 g_App.SelectSpec(true);
604 g_App.RefreshStatusBar();
605 break;
606 case IDM_DESELECT:
607 g_App.SelectSpec(false);
608 g_App.RefreshStatusBar();
609 break;
610 case IDM_SELECT_BY_TYPE:
611 g_App.SelectByType(true);
612 g_App.RefreshStatusBar();
613 break;
614 case IDM_DESELECT_BY_TYPE:
615 g_App.SelectByType(false);
616 g_App.RefreshStatusBar();
617 break;
618
619 //View
620 case IDM_VIEW_LARGE_ICONS:
621 case IDM_VIEW_SMALL_ICONS:
622 case IDM_VIEW_LIST:
623 case IDM_VIEW_DETAILS:
624 {
625 UINT index = id - IDM_VIEW_LARGE_ICONS;
626 if (index < 4)
627 {
628 g_App.SetListViewMode(index);
629 /*
630 CMenu menu;
631 menu.Attach(::GetSubMenu(::GetMenu(hWnd), kViewMenuIndex));
632 menu.CheckRadioItem(IDM_VIEW_LARGE_ICONS, IDM_VIEW_DETAILS,
633 id, MF_BYCOMMAND);
634 */
635 }
636 break;
637 }
638 case IDM_VIEW_ARANGE_BY_NAME:
639 {
640 g_App.SortItemsWithPropID(kpidName);
641 break;
642 }
643 case IDM_VIEW_ARANGE_BY_TYPE:
644 {
645 g_App.SortItemsWithPropID(kpidExtension);
646 break;
647 }
648 case IDM_VIEW_ARANGE_BY_DATE:
649 {
650 g_App.SortItemsWithPropID(kpidMTime);
651 break;
652 }
653 case IDM_VIEW_ARANGE_BY_SIZE:
654 {
655 g_App.SortItemsWithPropID(kpidSize);
656 break;
657 }
658 case IDM_VIEW_ARANGE_NO_SORT:
659 {
660 g_App.SortItemsWithPropID(kpidNoProperty);
661 break;
662 }
663
664 case IDM_OPEN_ROOT_FOLDER:
665 g_App.OpenRootFolder();
666 break;
667 case IDM_OPEN_PARENT_FOLDER:
668 g_App.OpenParentFolder();
669 break;
670 case IDM_FOLDERS_HISTORY:
671 g_App.FoldersHistory();
672 break;
673 case IDM_VIEW_REFRESH:
674 g_App.RefreshView();
675 break;
676 case IDM_VIEW_FLAT_VIEW:
677 g_App.ChangeFlatMode();
678 break;
679 case IDM_VIEW_TWO_PANELS:
680 g_App.SwitchOnOffOnePanel();
681 break;
682 case IDM_VIEW_STANDARD_TOOLBAR:
683 g_App.SwitchStandardToolbar();
684 break;
685 case IDM_VIEW_ARCHIVE_TOOLBAR:
686 g_App.SwitchArchiveToolbar();
687 break;
688 case IDM_VIEW_TOOLBARS_SHOW_BUTTONS_TEXT:
689 g_App.SwitchButtonsLables();
690 break;
691 case IDM_VIEW_TOOLBARS_LARGE_BUTTONS:
692 g_App.SwitchLargeButtons();
693 break;
694
695 // Tools
696 case IDM_OPTIONS:
697 // FIXME OptionsDialog(hWnd, g_hInstance);
698 break;
699
700 case IDM_BENCHMARK:
701 Benchmark();
702 break;
703 // Help
704 case IDM_HELP_CONTENTS:
705 ShowHelpWindow(NULL, kFMHelpTopic);
706 break;
707 case IDM_ABOUT:
708 {
709 /* FIXME
710 CAboutDialog dialog;
711 dialog.Create(hWnd);
712 */
713 printf("IDM_ABOUT ...\n");
714 break;
715 }
716 default:
717 {
718 if (id >= kOpenBookmarkMenuID && id <= kOpenBookmarkMenuID + 9)
719 {
720 g_App.OpenBookmark(id - kOpenBookmarkMenuID);
721 return true;
722 }
723 else if (id >= kSetBookmarkMenuID && id <= kSetBookmarkMenuID + 9)
724 {
725 g_App.SetBookmark(id - kSetBookmarkMenuID);
726 return true;
727 }
728 return false;
729 }
730 }
731 return true;
732 }
733
734