[BUG_FIXED] Fix crash bug while loading File of User Defined Language.

Fusion 2 commands "activate main view" and "activate sub view" in "Focus the other view".

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@365 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
donho 2008-12-09 23:24:55 +00:00
parent e6d799a644
commit abf2bffba8
5 changed files with 21 additions and 13 deletions

View File

@ -3991,13 +3991,22 @@ void Notepad_plus::command(int id)
docOpenInNewInstance(TransferClone); docOpenInNewInstance(TransferClone);
break; break;
case IDM_VIEW_SWITCHTO_MAIN: case IDM_VIEW_SWITCHTO_OTHER_VIEW:
switchEditViewTo(MAIN_VIEW); {
break; int view_to_focus;
HWND wnd = GetFocus();
case IDM_VIEW_SWITCHTO_SUB: if (_pEditView->getHSelf() == wnd)
switchEditViewTo(SUB_VIEW); {
view_to_focus = otherView();
if (!viewVisible(view_to_focus)) view_to_focus = _activeView;
}
else
{
view_to_focus = currentView();
}
switchEditViewTo(view_to_focus);
break; break;
}
case IDM_ABOUT: case IDM_ABOUT:
{ {

View File

@ -317,8 +317,7 @@ BEGIN
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "Go to another view", IDM_VIEW_GOTO_ANOTHER_VIEW MENUITEM "Go to another view", IDM_VIEW_GOTO_ANOTHER_VIEW
MENUITEM "Clone to another view", IDM_VIEW_CLONE_TO_ANOTHER_VIEW MENUITEM "Clone to another view", IDM_VIEW_CLONE_TO_ANOTHER_VIEW
MENUITEM "Activate main view", IDM_VIEW_SWITCHTO_MAIN MENUITEM "Focus on other view", IDM_VIEW_SWITCHTO_OTHER_VIEW // working, but no need in menu
MENUITEM "Activate sub view", IDM_VIEW_SWITCHTO_SUB
MENUITEM "Go to new instance", IDM_VIEW_GOTO_NEW_INSTANCE MENUITEM "Go to new instance", IDM_VIEW_GOTO_NEW_INSTANCE
MENUITEM "Open to new instance", IDM_VIEW_LOAD_IN_NEW_INSTANCE MENUITEM "Open to new instance", IDM_VIEW_LOAD_IN_NEW_INSTANCE
MENUITEM SEPARATOR MENUITEM SEPARATOR

View File

@ -154,8 +154,7 @@ WinMenuKeyDefinition winKeyDefs[] = { //array of accelerator keys for all std me
{VK_NULL, IDM_VIEW_CLONE_TO_ANOTHER_VIEW, false, false, false, NULL}, {VK_NULL, IDM_VIEW_CLONE_TO_ANOTHER_VIEW, false, false, false, NULL},
{VK_NULL, IDM_VIEW_SYNSCROLLV, false, false, false, NULL}, {VK_NULL, IDM_VIEW_SYNSCROLLV, false, false, false, NULL},
{VK_NULL, IDM_VIEW_SYNSCROLLH, false, false, false, NULL}, {VK_NULL, IDM_VIEW_SYNSCROLLH, false, false, false, NULL},
{VK_F7, IDM_VIEW_SWITCHTO_MAIN, false, false, false, NULL}, {VK_F8, IDM_VIEW_SWITCHTO_OTHER_VIEW, false, false, false, TEXT("Focus on other view")},
{VK_F8, IDM_VIEW_SWITCHTO_SUB, false, false, false, NULL},
{VK_NULL, IDM_FORMAT_TODOS, false, false, false, NULL}, {VK_NULL, IDM_FORMAT_TODOS, false, false, false, NULL},
{VK_NULL, IDM_FORMAT_TOUNIX, false, false, false, NULL}, {VK_NULL, IDM_FORMAT_TOUNIX, false, false, false, NULL},

View File

@ -1322,7 +1322,9 @@ BOOL CALLBACK UserDefineDialog::run_dlgProc(UINT message, WPARAM wParam, LPARAM
{ {
if (HIWORD(wParam) == EN_CHANGE) if (HIWORD(wParam) == EN_CHANGE)
{ {
::SendDlgItemMessage(_hSelf, IDC_EXT_EDIT, WM_GETTEXT, extsLenMax, (LPARAM)(_pUserLang->_ext.c_str())); TCHAR ext[extsLenMax];
::SendDlgItemMessage(_hSelf, IDC_EXT_EDIT, WM_GETTEXT, extsLenMax, (LPARAM)ext);
_pUserLang->_ext = ext;
return TRUE; return TRUE;
} }
else if (HIWORD(wParam) == CBN_SELCHANGE) else if (HIWORD(wParam) == CBN_SELCHANGE)

View File

@ -183,8 +183,7 @@
#define IDM_VIEW_GOTO_NEW_INSTANCE 10003 #define IDM_VIEW_GOTO_NEW_INSTANCE 10003
#define IDM_VIEW_LOAD_IN_NEW_INSTANCE 10004 #define IDM_VIEW_LOAD_IN_NEW_INSTANCE 10004
#define IDM_VIEW_SWITCHTO_MAIN (IDM_VIEW + 70) #define IDM_VIEW_SWITCHTO_OTHER_VIEW (IDM_VIEW + 72)
#define IDM_VIEW_SWITCHTO_SUB (IDM_VIEW + 71)
#define IDM_FORMAT (IDM + 5000) #define IDM_FORMAT (IDM + 5000)