wyBool EditorBase::ShowResultWindow() { wyInt32 lstyle; wyUInt32 menustate; wyUInt32 ret; HMENU hmenu, hsubmenu; TabMgmt *ptabmgmt; TabEditorSplitter *ptesplitter; MDIWindow * pCQueryWnd =(MDIWindow*)GetActiveWin(); if (pCQueryWnd->GetActiveTabEditor()->m_isresultwnd) return wyTrue; VERIFY(hmenu = GetMenu(pGlobals->m_pcmainwin->m_hwndmain)); lstyle = GetWindowLongPtr(pCQueryWnd->m_hwnd, GWL_STYLE); if ((lstyle & WS_MAXIMIZE) && wyTheme::IsSysmenuEnabled(pCQueryWnd->m_hwnd)) VERIFY(hsubmenu = GetSubMenu(hmenu, 2)); else VERIFY(hsubmenu = GetSubMenu(hmenu, 1)); menustate = GetMenuState(hsubmenu, IDC_EDIT_SHOWRESULT, MF_BYCOMMAND); ret = CheckMenuItem(hsubmenu, IDC_EDIT_SHOWRESULT, MF_BYCOMMAND | MF_UNCHECKED); pCQueryWnd->GetActiveTabEditor()->m_isresultwnd = wyTrue; ptesplitter = pCQueryWnd->GetActiveTabEditor()->m_pcetsplitter; if(ptesplitter->m_leftortoppercent == ptesplitter->m_lasttoppercent && ptesplitter->m_leftortoppercent == 100 && ptesplitter->m_lasttoppercent == 100) { ptesplitter->m_lasttoppercent = 50; ptesplitter->m_leftortoppercent = ptesplitter->m_lasttoppercent; } else ptesplitter->m_leftortoppercent = ptesplitter->m_lasttoppercent; pCQueryWnd->m_pctabmodule->Resize(); ptabmgmt = pCQueryWnd->GetActiveTabEditor()->m_pctabmgmt; VERIFY(UpdateWindow(ptabmgmt->m_hwnd)); //VERIFY(UpdateWindow(ptabmgmt->m_pcdataviewquery->m_hwndgrid)); return wyTrue; }
wyBool EditorBase::SelectFirstTableToEdit(wyBool isedit) { MDIWindow *wnd = GetActiveWin(); wyString currenttable; ResultView* presultview; if(!wnd || !wnd->GetActiveTabEditor() || !wnd->GetActiveTabEditor()->m_pctabmgmt || !(presultview = wnd->GetActiveTabEditor()->m_pctabmgmt->m_presultview)) { return wyFalse; } presultview->SelectTableComboItem(isedit == wyTrue ? 1 : 0); return wyTrue; }
// Subclass procedure for the edit box. LRESULT CALLBACK EditorBase::WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { EditorBase *ebase = (EditorBase*)GetWindowLongPtr(hwnd, GWLP_USERDATA); MDIWindow *wnd = NULL; wyInt32 ret = 0; static wyChar keyword[128]; static wyBool keyflag; static wyInt32 wrdlen = 0; VERIFY(wnd = GetActiveWin()); //if message is from find replace dialog - pass it to the right handler //forced type cast if(message == (wyUInt32)pGlobals->m_pcmainwin->m_findmsg) { if( ebase->m_findreplace->FindReplace(hwnd, lparam) == wyFalse) { //when we are closing the find dialog, deleting the memory allocated for Find delete(ebase->m_findreplace); ebase->m_findreplace = NULL; } return 0; } switch(message) { case WM_HELP: ShowHelp("SQL%20Window%20SQLyog%20for%20MySQL%20Administration.htm"); return wyTrue; case WM_CONTEXTMENU: if(wnd->GetActiveTabEditor()) { //CustomGrid_ApplyChanges(wnd->GetActiveTabEditor()->m_pctabmgmt->m_insert->m_hwndgrid, wyTrue); } if(ebase->OnContextMenu(lparam) == 1) { return 1; } break; case WM_KEYUP: ebase->OnWMKeyUp(hwnd, wparam); break; case WM_KEYDOWN: { //This needs to work Ctrl+X to be handled in WM_CHAR, if it wont return '0', that wont process as expected if(GetKeyState(VK_CONTROL) & 0x8000) { if(wparam == 'X') return 0; if(wparam == VK_INSERT) { CopyStyledTextToClipBoard(hwnd); return 0; } } if(wnd->m_acinterface->HandlerOnWMKeyDown(hwnd, ebase, wparam)) return 1; } break; case WM_SYSKEYDOWN: if(lparam >> 29) { //check whether it is insert/delete if (wparam == 'C' || wparam == 'c')//switch(wparam) { ret = ebase->OnWMChar(hwnd, wparam, wnd, ebase); } } break; case WM_SETFOCUS: if(wnd) { PostMessage(wnd->m_pctabmodule->m_hwnd, UM_SETSTATUSLINECOL, (WPARAM)hwnd, 1); } break; case WM_KILLFOCUS: if(wnd) { PostMessage(wnd->m_pctabmodule->m_hwnd, UM_SETSTATUSLINECOL, (WPARAM)NULL, 0); } break; case WM_LBUTTONUP: ebase->OnLButtonUp(wnd,hwnd); break; case UM_FOCUS: ::SendMessage(hwnd, SCI_GRABFOCUS, 0, 0); break; case WM_CHAR: ret = ebase->OnWMChar(hwnd, wparam, wnd, ebase); if(ret == -1) break; return ret; case UM_ADDBACKQUOTEONAC: if(lparam & 1) { SendMessage(hwnd, SCI_INSERTTEXT, wparam, (LPARAM)"`"); } if(lparam & 2) { SendMessage(hwnd, SCI_REPLACESEL, (WPARAM)0, (LPARAM)"`"); } SendMessage(hwnd, SCI_ENDUNDOACTION, 0, 0); } return CallWindowProc(ebase->wpOrigProc, hwnd, message, wparam, lparam); }