diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2014-11-23 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:51 +0300 |
commit | f08f4dcc3c02464c17753b3feafcfe5243b9e236 (patch) | |
tree | b0e1b15bc5368d92dff422e8ec0818564a2b00b8 /CPP/7zip/UI/FileManager/MenuPage.cpp | |
parent | 83f8ddcc5b2161e1e3c49666265257fca8aeb12c (diff) |
9.349.34
Diffstat (limited to 'CPP/7zip/UI/FileManager/MenuPage.cpp')
-rw-r--r--[-rwxr-xr-x] | CPP/7zip/UI/FileManager/MenuPage.cpp | 84 |
1 files changed, 46 insertions, 38 deletions
diff --git a/CPP/7zip/UI/FileManager/MenuPage.cpp b/CPP/7zip/UI/FileManager/MenuPage.cpp index c3e013b5..0784f92c 100755..100644 --- a/CPP/7zip/UI/FileManager/MenuPage.cpp +++ b/CPP/7zip/UI/FileManager/MenuPage.cpp @@ -14,13 +14,16 @@ #include "MenuPageRes.h" #include "FormatUtils.h" +#include "../FileManager/PropertyNameRes.h" + using namespace NContextMenuFlags; -static CIDLangPair kIDLangPairs[] = +static const UInt32 kLangIDs[] = { - { IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU, 0x01000301}, - { IDC_SYSTEM_CASCADED_MENU, 0x01000302}, - { IDC_SYSTEM_STATIC_CONTEXT_MENU_ITEMS, 0x01000310} + IDX_SYSTEM_INTEGRATE_TO_CONTEXT_MENU, + IDX_SYSTEM_CASCADED_MENU, + IDX_SYSTEM_ICON_IN_MENU, + IDT_SYSTEM_CONTEXT_MENU_ITEMS }; static LPCWSTR kSystemTopic = L"fm/options.htm#sevenZip"; @@ -28,77 +31,80 @@ static LPCWSTR kSystemTopic = L"fm/options.htm#sevenZip"; struct CContextMenuItem { int ControlID; - UInt32 LangID; UInt32 Flag; }; static CContextMenuItem kMenuItems[] = { - { IDS_CONTEXT_OPEN, 0x02000103, kOpen}, - { IDS_CONTEXT_OPEN, 0x02000103, kOpenAs}, - { IDS_CONTEXT_EXTRACT, 0x02000105, kExtract}, - { IDS_CONTEXT_EXTRACT_HERE, 0x0200010B, kExtractHere }, - { IDS_CONTEXT_EXTRACT_TO, 0x0200010D, kExtractTo }, + { IDS_CONTEXT_OPEN, kOpen}, + { IDS_CONTEXT_OPEN, kOpenAs}, + { IDS_CONTEXT_EXTRACT, kExtract}, + { IDS_CONTEXT_EXTRACT_HERE, kExtractHere }, + { IDS_CONTEXT_EXTRACT_TO, kExtractTo }, - { IDS_CONTEXT_TEST, 0x02000109, kTest}, + { IDS_CONTEXT_TEST, kTest}, - { IDS_CONTEXT_COMPRESS, 0x02000107, kCompress }, - { IDS_CONTEXT_COMPRESS_TO, 0x0200010F, kCompressTo7z }, - { IDS_CONTEXT_COMPRESS_TO, 0x0200010F, kCompressToZip } + { IDS_CONTEXT_COMPRESS, kCompress }, + { IDS_CONTEXT_COMPRESS_TO, kCompressTo7z }, + { IDS_CONTEXT_COMPRESS_TO, kCompressToZip } #ifndef UNDER_CE , - { IDS_CONTEXT_COMPRESS_EMAIL, 0x02000111, kCompressEmail }, - { IDS_CONTEXT_COMPRESS_TO_EMAIL, 0x02000113, kCompressTo7zEmail }, - { IDS_CONTEXT_COMPRESS_TO_EMAIL, 0x02000113, kCompressToZipEmail } + { IDS_CONTEXT_COMPRESS_EMAIL, kCompressEmail }, + { IDS_CONTEXT_COMPRESS_TO_EMAIL, kCompressTo7zEmail }, + { IDS_CONTEXT_COMPRESS_TO_EMAIL, kCompressToZipEmail } #endif -}; -const int kNumMenuItems = sizeof(kMenuItems) / sizeof(kMenuItems[0]); + , { IDS_PROP_CHECKSUM, kCRC } +}; bool CMenuPage::OnInit() { _initMode = true; - LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0])); + LangSetDlgItems(*this, kLangIDs, ARRAY_SIZE(kLangIDs)); #ifdef UNDER_CE - EnableItem(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU, false); + EnableItem(IDX_SYSTEM_INTEGRATE_TO_CONTEXT_MENU, false); #else - CheckButton(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU, NZipRootRegistry::CheckContextMenuHandler()); + CheckButton(IDX_SYSTEM_INTEGRATE_TO_CONTEXT_MENU, NZipRootRegistry::CheckContextMenuHandler()); #endif CContextMenuInfo ci; ci.Load(); - CheckButton(IDC_SYSTEM_CASCADED_MENU, ci.Cascaded); + CheckButton(IDX_SYSTEM_CASCADED_MENU, ci.Cascaded); + CheckButton(IDX_SYSTEM_ICON_IN_MENU, ci.MenuIcons); - _listView.Attach(GetItem(IDC_SYSTEM_OPTIONS_LIST)); + _listView.Attach(GetItem(IDL_SYSTEM_OPTIONS)); UInt32 newFlags = LVS_EX_CHECKBOXES | LVS_EX_FULLROWSELECT; _listView.SetExtendedListViewStyle(newFlags, newFlags); _listView.InsertColumn(0, L"", 100); - for (int i = 0; i < kNumMenuItems; i++) + for (int i = 0; i < ARRAY_SIZE(kMenuItems); i++) { CContextMenuItem &menuItem = kMenuItems[i]; - UString s = LangString(menuItem.ControlID, menuItem.LangID); - if (menuItem.Flag == kOpenAs) + UString s = LangString(menuItem.ControlID); + if (menuItem.Flag == kCRC) + s = L"CRC SHA"; + if (menuItem.Flag == kOpenAs || + menuItem.Flag == kCRC) s += L" >"; - switch(menuItem.ControlID) + switch (menuItem.ControlID) { case IDS_CONTEXT_EXTRACT_TO: { - s = MyFormatNew(s, LangString(IDS_CONTEXT_FOLDER, 0x02000140)); + s = MyFormatNew(s, LangString(IDS_CONTEXT_FOLDER)); break; } case IDS_CONTEXT_COMPRESS_TO: case IDS_CONTEXT_COMPRESS_TO_EMAIL: { - UString s2 = LangString(IDS_CONTEXT_ARCHIVE, 0x02000141); - switch(menuItem.Flag) + UString s2 = LangString(IDS_CONTEXT_ARCHIVE); + switch (menuItem.Flag) { case kCompressTo7z: case kCompressTo7zEmail: @@ -133,7 +139,7 @@ LONG CMenuPage::OnApply() { #ifndef UNDER_CE g_MenuPageHWND = *this; - if (IsButtonCheckedBool(IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU)) + if (IsButtonCheckedBool(IDX_SYSTEM_INTEGRATE_TO_CONTEXT_MENU)) { DllRegisterServer(); NZipRootRegistry::AddContextMenuHandler(); @@ -146,9 +152,10 @@ LONG CMenuPage::OnApply() #endif CContextMenuInfo ci; - ci.Cascaded = IsButtonCheckedBool(IDC_SYSTEM_CASCADED_MENU); + ci.Cascaded = IsButtonCheckedBool(IDX_SYSTEM_CASCADED_MENU); + ci.MenuIcons = IsButtonCheckedBool(IDX_SYSTEM_ICON_IN_MENU); ci.Flags = 0; - for (int i = 0; i < kNumMenuItems; i++) + for (int i = 0; i < ARRAY_SIZE(kMenuItems); i++) if (_listView.GetCheckState(i)) ci.Flags |= kMenuItems[i].Flag; ci.Save(); @@ -163,10 +170,11 @@ void CMenuPage::OnNotifyHelp() bool CMenuPage::OnButtonClicked(int buttonID, HWND buttonHWND) { - switch(buttonID) + switch (buttonID) { - case IDC_SYSTEM_CASCADED_MENU: - case IDC_SYSTEM_INTEGRATE_TO_CONTEXT_MENU: + case IDX_SYSTEM_INTEGRATE_TO_CONTEXT_MENU: + case IDX_SYSTEM_CASCADED_MENU: + case IDX_SYSTEM_ICON_IN_MENU: Changed(); return true; } @@ -178,7 +186,7 @@ bool CMenuPage::OnNotify(UINT controlID, LPNMHDR lParam) { if (lParam->hwndFrom == HWND(_listView)) { - switch(lParam->code) + switch (lParam->code) { case (LVN_ITEMCHANGED): return OnItemChanged((const NMLISTVIEW *)lParam); |