[NEW] Hide menu bar (in progress).

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@169 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-04-18 17:40:56 +00:00
parent a2aa87d8c3
commit 11333a7ec3
12 changed files with 51 additions and 25 deletions

View File

@ -61,7 +61,7 @@ struct SortTaskListPred
Notepad_plus::Notepad_plus(): Window(), _mainWindowStatus(0), _pDocTab(NULL), _pEditView(NULL),
_pMainSplitter(NULL), _isfullScreen(false),
_recordingMacro(false), _pTrayIco(NULL), _isUDDocked(false), _isRTL(false),
_linkTriggered(true), _isDocModifing(false), _isHotspotDblClicked(false), _isSaving(false), _hideMenu(true)
_linkTriggered(true), _isDocModifing(false), _isHotspotDblClicked(false), _isSaving(false), _hideMenu(true), _sysMenuEntering(false)
{
_winVersion = getWindowsVersion();
@ -7552,6 +7552,16 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
::ShowWindow(hwnd, SW_HIDE);
return TRUE;
}
if (wParam == SC_KEYMENU && lParam == VK_SPACE)
{
_sysMenuEntering = true;
}
else if (wParam == 0xF093) //it should be SC_MOUSEMENU. A bug?
{
_sysMenuEntering = true;
}
return ::DefWindowProc(hwnd, Message, wParam, lParam);
}
@ -7585,10 +7595,6 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
return TRUE;
}
case WM_INITMENUPOPUP:
_windowsMenu.initPopupMenu((HMENU)wParam, _pEditView);
return TRUE;
case NPPM_DMMSHOW:
{
_dockingManager.showDockableDlg((HWND)lParam, SW_SHOW);
@ -7737,17 +7743,30 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
return (HWND)lParam == pMainTB;
}
case NPPM_INTERNAL_GETMENU :
{
return (LRESULT)_mainMenuHandle;
}
case WM_INITMENUPOPUP:
{
_windowsMenu.initPopupMenu((HMENU)wParam, _pEditView);
return TRUE;
}
case WM_ENTERMENULOOP:
{
if (_hideMenu)
if (_hideMenu && !wParam && !_sysMenuEntering)
::SetMenu(_hSelf, _mainMenuHandle);
return FALSE;
return TRUE;
}
case WM_EXITMENULOOP:
{
if (_hideMenu)
if (_hideMenu && !wParam && !_sysMenuEntering)
::SetMenu(_hSelf, NULL);
_sysMenuEntering = false;
return FALSE;
}

View File

@ -220,6 +220,8 @@ private:
WindowsMenu _windowsMenu;
HMENU _mainMenuHandle;
bool _hideMenu;
bool _sysMenuEntering;
LONG_PTR _prevStyles;
// For FullScreen feature
@ -491,8 +493,6 @@ private:
void MaintainIndentation(char ch);
void addHotSpot(bool docIsModifing = false);
//void styleHotSpotForWholeDoc();
//void styleHotSpotModifyMode();
void bookmarkAdd(int lineno) const {
if (lineno == -1)

View File

@ -1387,7 +1387,7 @@ BOOL CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM
//remove current language from langMenu
HWND hNpp = ::GetParent(_hSelf);
::RemoveMenu(::GetSubMenu(::GetMenu(hNpp), MENUINDEX_LANGUAGE), IDM_LANG_USER + i, MF_BYCOMMAND);
::RemoveMenu(::GetSubMenu((HMENU)::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_LANGUAGE), IDM_LANG_USER + i, MF_BYCOMMAND);
::DrawMenuBar(hNpp);
::SendMessage(_hParent, WM_REMOVE_USERLANG, 0, (LPARAM)langName);
}
@ -1423,7 +1423,7 @@ BOOL CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM
//rename current language name in langMenu
HWND hNpp = ::GetParent(_hSelf);
::ModifyMenu(::GetSubMenu(::GetMenu(hNpp), MENUINDEX_LANGUAGE), IDM_LANG_USER + i, MF_BYCOMMAND, IDM_LANG_USER + i, newName);
::ModifyMenu(::GetSubMenu((HMENU)::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_LANGUAGE), IDM_LANG_USER + i, MF_BYCOMMAND, IDM_LANG_USER + i, newName);
::DrawMenuBar(hNpp);
::SendMessage(_hParent, WM_RENAME_USERLANG, (WPARAM)newName, (LPARAM)langName);
}
@ -1471,7 +1471,7 @@ BOOL CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM
//add new language name in langMenu
HWND hNpp = ::GetParent(_hSelf);
::InsertMenu(::GetSubMenu(::GetMenu(hNpp), MENUINDEX_LANGUAGE), IDM_LANG_USER + newIndex /*+ 1*/, MF_BYCOMMAND, IDM_LANG_USER + newIndex + 1, newName);
::InsertMenu(::GetSubMenu((HMENU)::SendMessage(hNpp, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_LANGUAGE), IDM_LANG_USER + newIndex /*+ 1*/, MF_BYCOMMAND, IDM_LANG_USER + newIndex + 1, newName);
::DrawMenuBar(hNpp);
}

View File

@ -304,7 +304,7 @@ BOOL CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
// preparing to remove from menu
posBase = 6;
nbElem = theMacros.size();
hMenu = ::GetSubMenu(::GetMenu(_hParent), MENUINDEX_MACRO);
hMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_MACRO);
for (size_t i = shortcutIndex ; i < nbElem ; i++) //lower the IDs of the remaining items so there are no gaps
{
MacroShortcut ms = theMacros[i];
@ -323,7 +323,7 @@ BOOL CALLBACK ShortcutMapper::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
// preparing to remove from menu
posBase = 2;
nbElem = theUserCmds.size();
hMenu = ::GetSubMenu(::GetMenu(_hParent), MENUINDEX_RUN);
hMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_RUN);
for (size_t i = shortcutIndex ; i < nbElem ; i++) //lower the IDs of the remaining items so there are no gaps
{
UserCommand uc = theUserCmds[i];

View File

@ -36,7 +36,7 @@ IDD_PREFERENCE_BAR_BOX DIALOGEX 0, 0, 370, 180
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Tool bar",IDC_TOOLBAR_GB_STATIC,17,5,131,68,BS_CENTER
GROUPBOX "Tool bar",IDC_TOOLBAR_GB_STATIC,17,5,145,68,BS_CENTER
CONTROL "Hide",IDC_CHECK_HIDE,"Button",BS_AUTOCHECKBOX,24,15,94,10
CONTROL "Small icons",IDC_RADIO_SMALLICON,"Button",BS_AUTORADIOBUTTON,24,29,114,10
CONTROL "Big icons",IDC_RADIO_BIGICON,"Button",BS_AUTORADIOBUTTON,24,43,109,10
@ -53,7 +53,9 @@ BEGIN
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,118,133,10
CONTROL "Double click to close document",IDC_CHECK_DBCLICK2CLOSE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,189,133,133,10
CONTROL "Show Status Bar",IDC_CHECK_SHOWSTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,133,130,10
CONTROL "Show Status Bar",IDC_CHECK_SHOWSTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,140,130,10
GROUPBOX "Menu bar",IDC_MENUBAR_GB_STATIC,16,77,147,49,BS_CENTER
CONTROL "Hide (Use Alt or F10 key to toggle it)",IDC_CHECK_HIDEMENUBAR,"Button",BS_AUTOCHECKBOX | BS_MULTILINE,24,87,135,26
END
IDD_PREFERENCE_MARGEIN_BOX DIALOGEX 0, 0, 370, 180

View File

@ -942,11 +942,11 @@ BOOL CALLBACK LangMenuDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM lPara
if (LOWORD(wParam)==IDC_BUTTON_REMOVE)
{
::DeleteMenu(::GetMenu(grandParent), lmi._cmdID, MF_BYCOMMAND);
::DeleteMenu((HMENU)::SendMessage(grandParent, NPPM_INTERNAL_GETMENU, 0, 0), lmi._cmdID, MF_BYCOMMAND);
}
else
{
::InsertMenu(::GetSubMenu(::GetMenu(grandParent), MENUINDEX_LANGUAGE), iAdd-1, MF_BYPOSITION, lmi._cmdID, lmi._langName.c_str());
::InsertMenu(::GetSubMenu((HMENU)::SendMessage(grandParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_LANGUAGE), iAdd-1, MF_BYPOSITION, lmi._cmdID, lmi._langName.c_str());
}
::DrawMenuBar(grandParent);
return TRUE;

View File

@ -43,6 +43,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#define IDC_CHECK_TAB_HIDE (IDD_PREFERENCE_BAR_BOX + 18)
#define IDC_CHECK_TAB_MULTILINE (IDD_PREFERENCE_BAR_BOX + 19)
#define IDC_CHECK_TAB_VERTICAL (IDD_PREFERENCE_BAR_BOX + 20)
#define IDC_MENUBAR_GB_STATIC (IDD_PREFERENCE_BAR_BOX + 21)
#define IDC_CHECK_HIDEMENUBAR (IDD_PREFERENCE_BAR_BOX + 22)
#define IDD_PREFERENCE_MARGEIN_BOX 6200 //(IDD_PREFERENCE_BOX + 200)
#define IDC_FMS_GB_STATIC (IDD_PREFERENCE_MARGEIN_BOX + 1)

View File

@ -207,7 +207,7 @@ BOOL CALLBACK RunDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
if (uc.doDialog() != -1)
{
HMENU hRunMenu = ::GetSubMenu(::GetMenu(_hParent), MENUINDEX_RUN);
HMENU hRunMenu = ::GetSubMenu((HMENU)::SendMessage(_hParent, NPPM_INTERNAL_GETMENU, 0, 0), MENUINDEX_RUN);
int const posBase = 2;
if (nbCmd == 0)

View File

@ -310,7 +310,7 @@ void getNameStrFromCmd(DWORD cmd, string & str)
{
HWND hNotepad_plus = ::FindWindow(Notepad_plus::getClassName(), NULL);
char cmdName[64];
int nbChar = ::GetMenuString(::GetMenu(hNotepad_plus), cmd, cmdName, sizeof(cmdName), MF_BYCOMMAND);
int nbChar = ::GetMenuString((HMENU)::SendMessage(hNotepad_plus, NPPM_INTERNAL_GETMENU, 0, 0), cmd, cmdName, sizeof(cmdName), MF_BYCOMMAND);
if (!nbChar)
return;
bool fin = false;

View File

@ -4,6 +4,7 @@
<Item id="42002"/>
<Item id="42005"/>
<Item id="42006"/>
<Item id="42007"/>
<Item id="0"/>
<Item id="43016"/>
<Item id="43017"/>

View File

@ -283,6 +283,8 @@
#define NPPM_INTERNAL_DOCSWITCHIN (NOTEPADPLUS_USER_INTERNAL + 11)
#define NPPM_INTERNAL_ISTABBARREDUCED (NOTEPADPLUS_USER_INTERNAL + 12)
#define NPPM_INTERNAL_ISFOCUSEDTAB (NOTEPADPLUS_USER_INTERNAL + 13)
#define NPPM_INTERNAL_GETMENU (NOTEPADPLUS_USER_INTERNAL + 14)
// See Notepad_plus_msgs.h
//#define NOTEPADPLUS_USER (WM_USER + 1000)
#define SCINTILLA_USER (WM_USER + 2000)

View File

@ -576,10 +576,6 @@
RelativePath="..\src\MISC\RegExt\regExtDlgRc.h"
>
</File>
<File
RelativePath="..\src\MISC\RegExt\resource.h"
>
</File>
<File
RelativePath="..\src\resource.h"
>
@ -588,6 +584,10 @@
RelativePath="..\src\WinControls\Preference\resource.h"
>
</File>
<File
RelativePath="..\src\MISC\RegExt\resource.h"
>
</File>
<File
RelativePath="..\src\WinControls\StaticDialog\RunDlg\RunDlg.h"
>