diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index a51063ef0..856313129 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -6961,8 +6961,14 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa } case WM_CREATE: { + NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI(); + // Menu _mainMenuHandle = ::GetMenu(_hSelf); + int langPos2BeRemoved = MENUINDEX_LANGUAGE+1; + if (nppGUI._isLangMenuCompact) + langPos2BeRemoved = MENUINDEX_LANGUAGE; + ::RemoveMenu(_mainMenuHandle, langPos2BeRemoved, MF_BYPOSITION); //Views _pDocTab = &_mainDocTab; @@ -6977,7 +6983,7 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa MainFileManager->init(this, &_fileEditView); //get it up and running asap. pNppParam->setFontList(hwnd); - NppGUI & nppGUI = (NppGUI &)pNppParam->getNppGUI(); + _mainWindowStatus = WindowMainActive; _activeView = MAIN_VIEW; diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 0a80e2168..4a20d1167 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -282,6 +282,9 @@ private: WindowsMenu _windowsMenu; HMENU _mainMenuHandle; + HMENU _menuLang; + HMENU _menuLangCompact; + bool _sysMenuEntering; // For FullScreen/PostIt features diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index ed78c2b8f..0dca6778c 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -441,7 +441,99 @@ BEGIN MENUITEM SEPARATOR MENUITEM "User Defined", IDM_LANG_USER END - + POPUP "&Language" + BEGIN + POPUP "A" + BEGIN + MENUITEM "Ada", IDM_LANG_ADA + MENUITEM "ASP", IDM_LANG_ASP + MENUITEM "Assembly", IDM_LANG_ASM + MENUITEM "AutoIt", IDM_LANG_AU3 + END + MENUITEM "Batch", IDM_LANG_BATCH + POPUP "C" + BEGIN + MENUITEM "C", IDM_LANG_C + MENUITEM "C#", IDM_LANG_CS + MENUITEM "C++", IDM_LANG_CPP + MENUITEM "Caml", IDM_LANG_CAML + MENUITEM "Cmake", IDM_LANG_CMAKE + MENUITEM "CSS", IDM_LANG_CSS + END + MENUITEM "Diff", IDM_LANG_DIFF + POPUP "F" + BEGIN + MENUITEM "Flash actionscript", IDM_LANG_FLASH + MENUITEM "Fortran", IDM_LANG_FORTRAN + END + POPUP "H" + BEGIN + MENUITEM "Haskell", IDM_LANG_HASKELL + MENUITEM "HTML", IDM_LANG_HTML + END + MENUITEM "INNO", IDM_LANG_INNO + POPUP "J" + BEGIN + MENUITEM "Java", IDM_LANG_JAVA + MENUITEM "Javascript", IDM_LANG_JS + END + MENUITEM "KIXtart", IDM_LANG_KIX + POPUP "L" + BEGIN + MENUITEM "LISP", IDM_LANG_LISP + MENUITEM "Lua", IDM_LANG_LUA + END + POPUP "M" + BEGIN + MENUITEM "Makefile", IDM_LANG_MAKEFILE + MENUITEM "Matlab", IDM_LANG_MATLAB + MENUITEM "MS INI file", IDM_LANG_INI + MENUITEM "MS-DOS Style", IDM_LANG_ASCII + END + POPUP "N" + BEGIN + MENUITEM "Normal Text", IDM_LANG_TEXT + MENUITEM "NSIS", IDM_LANG_NSIS + END + MENUITEM "Objective-C", IDM_LANG_OBJC + POPUP "P" + BEGIN + MENUITEM "Pascal", IDM_LANG_PASCAL + MENUITEM "Perl", IDM_LANG_PERL + MENUITEM "PHP", IDM_LANG_PHP + MENUITEM "Postscript", IDM_LANG_PS + MENUITEM "Properties", IDM_LANG_PROPS + MENUITEM "Python", IDM_LANG_PYTHON + END + POPUP "R" + BEGIN + MENUITEM "rc resource file", IDM_LANG_RC + MENUITEM "Ruby", IDM_LANG_RUBY + END + POPUP "S" + BEGIN + MENUITEM "Shell", IDM_LANG_SH + MENUITEM "Scheme", IDM_LANG_SCHEME + MENUITEM "Smalltalk", IDM_LANG_SMALLTALK + MENUITEM "SQL", IDM_LANG_SQL + END + POPUP "T" + BEGIN + MENUITEM "TCL", IDM_LANG_TCL + MENUITEM "TeX", IDM_LANG_TEX + END + POPUP "V" + BEGIN + MENUITEM "VB", IDM_LANG_VB + MENUITEM "VHDL", IDM_LANG_VHDL + MENUITEM "Verilog", IDM_LANG_VERILOG + END + MENUITEM "XML", IDM_LANG_XML + MENUITEM "YAML", IDM_LANG_YAML + MENUITEM SEPARATOR + MENUITEM "User Defined", IDM_LANG_USER + END + POPUP "Se&ttings" BEGIN MENUITEM "Preferences...", IDM_SETTING_PREFERECE diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 191a65d86..8ed58df14 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -2988,6 +2988,10 @@ void NppParameters::feedGUIParameters(TiXmlNode *node) _nppGUI._excludedLangList.push_back(LangMenuItem((LangType)i)); mask <<= 1; } + + val = element->Attribute(TEXT("langMenuCompact")); + if (val) + _nppGUI._isLangMenuCompact = (!lstrcmp(val, TEXT("yes"))); } else if (!lstrcmp(nm, TEXT("Print"))) @@ -3733,6 +3737,7 @@ bool NppParameters::writeGUIParams() else if (!lstrcmp(nm, TEXT("langsExcluded"))) { writeExcludedLangList(element); + element->SetAttribute(TEXT("langMenuCompact"), _nppGUI._isLangMenuCompact?TEXT("yes"):TEXT("no")); langsExcludedLstExist = true; } else if (!lstrcmp(nm, TEXT("Print"))) @@ -3922,6 +3927,7 @@ bool NppParameters::writeGUIParams() TiXmlElement *GUIConfigElement = (GUIRoot->InsertEndChild(TiXmlElement(TEXT("GUIConfig"))))->ToElement(); GUIConfigElement->SetAttribute(TEXT("name"), TEXT("langsExcluded")); writeExcludedLangList(GUIConfigElement); + GUIConfigElement->SetAttribute(TEXT("langMenuCompact"), _nppGUI._isLangMenuCompact?TEXT("yes"):TEXT("no")); } if (!printSettingExist) diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index 6d5e4126f..76f4414ca 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -552,7 +552,7 @@ struct NppGUI _isMaximized(false), _isMinimizedToTray(false), _rememberLastSession(true), _backup(bak_none), _useDir(false),\ _doTaskList(true), _maitainIndent(true), _openSaveDir(dir_followCurrent), _styleMRU(true), _styleURL(0),\ _autocStatus(autoc_none), _autocFromLen(1), _funcParams(false), _definedSessionExt(TEXT("")), _neverUpdate(false),\ - _doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _shortTitlebar(false), _themeName(TEXT("")) { + _doesExistUpdater(false), _caretBlinkRate(250), _caretWidth(1), _shortTitlebar(false), _themeName(TEXT("")), _isLangMenuCompact(false) { _appPos.left = 0; _appPos.top = 0; _appPos.right = 700; @@ -609,6 +609,8 @@ struct NppGUI void setTabReplacedBySpace(bool b) {_tabReplacedBySpace = b;}; const NewDocDefaultSettings & getNewDocDefaultSettings() const {return _newDocDefaultSettings;}; vector _excludedLangList; + bool _isLangMenuCompact; + PrintSettings _printSettings; BackupFeature _backup; bool _useDir; diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc index ccba93e19..aefc85d88 100644 --- a/PowerEditor/src/WinControls/Preference/preference.rc +++ b/PowerEditor/src/WinControls/Preference/preference.rc @@ -162,12 +162,13 @@ IDD_PREFERENCE_LANG_BOX DIALOGEX 0, 0, 390, 185 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, TEXT("MS Shell Dlg"), 0, 0, 0x1 BEGIN - LISTBOX IDC_LIST_ENABLEDLANG,80,21,78,140,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - LISTBOX IDC_LIST_DISABLEDLANG,226,21,78,140,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "->",IDC_BUTTON_REMOVE,167,53,50,14 - PUSHBUTTON "<-",IDC_BUTTON_RESTORE,168,84,50,14 - CTEXT "Available items",IDC_ENABLEDITEMS_STATIC,83,8,72,8 - CTEXT "Disabled items",IDC_DISABLEDITEMS_STATIC,229,8,72,8 + LISTBOX IDC_LIST_ENABLEDLANG,85,39,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LISTBOX IDC_LIST_DISABLEDLANG,231,39,78,120,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "->",IDC_BUTTON_REMOVE,172,71,50,14 + PUSHBUTTON "<-",IDC_BUTTON_RESTORE,173,102,50,14 + CTEXT "Available items",IDC_ENABLEDITEMS_STATIC,88,26,72,8 + CTEXT "Disabled items",IDC_DISABLEDITEMS_STATIC,234,26,72,8 + CONTROL "Make Language Menu compact",IDC_CHECK_LANGMENUCOMPACT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,86,5,174,10 END IDD_PREFERENCE_PRINT_BOX DIALOGEX 0, 0, 390, 185 diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index ec2038172..876925260 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -1081,7 +1081,7 @@ BOOL CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara ::SendDlgItemMessage(_hSelf, IDC_LIST_DISABLEDLANG, LB_ADDSTRING, 0, (LPARAM)nppGUI._excludedLangList[i]._langName.c_str()); } - + ::SendDlgItemMessage(_hSelf, IDC_CHECK_LANGMENUCOMPACT, BM_SETCHECK, nppGUI._isLangMenuCompact?BST_CHECKED:BST_UNCHECKED, 0); ::EnableWindow(::GetDlgItem(_hSelf, IDC_BUTTON_REMOVE), FALSE); ::EnableWindow(::GetDlgItem(_hSelf, IDC_BUTTON_RESTORE), FALSE); @@ -1132,7 +1132,16 @@ BOOL CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara } return TRUE; } - + + case IDC_CHECK_LANGMENUCOMPACT : + { + nppGUI._isLangMenuCompact = (BST_CHECKED == ::SendMessage(::GetDlgItem(_hSelf, IDC_CHECK_LANGMENUCOMPACT), BM_GETCHECK, 0, 0)); + ::MessageBox(_hSelf, + nppGUI._isLangMenuCompact?TEXT("This option will be enable on the next launch."):TEXT("This option will be disable on the next launch."), + TEXT("Compact Language Menu"), MB_OK); + return TRUE; + } + case IDC_BUTTON_RESTORE : case IDC_BUTTON_REMOVE : { diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h index 69cccaab0..b9fa101ba 100644 --- a/PowerEditor/src/WinControls/Preference/preference_rc.h +++ b/PowerEditor/src/WinControls/Preference/preference_rc.h @@ -139,6 +139,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #define IDC_BUTTON_RESTORE (IDD_PREFERENCE_LANG_BOX + 4) #define IDC_ENABLEDITEMS_STATIC (IDD_PREFERENCE_LANG_BOX + 5) #define IDC_DISABLEDITEMS_STATIC (IDD_PREFERENCE_LANG_BOX + 6) + #define IDC_CHECK_LANGMENUCOMPACT (IDD_PREFERENCE_LANG_BOX + 7) #define IDD_PREFERENCE_PRINT_BOX 6600 //(IDD_PREFERENCE_BOX + 600) #define IDC_CHECK_PRINTLINENUM (IDD_PREFERENCE_PRINT_BOX + 1)