diff --git a/ctl/ctlListView.cpp b/ctl/ctlListView.cpp index 61d6adf..421517c 100644 --- a/ctl/ctlListView.cpp +++ b/ctl/ctlListView.cpp @@ -35,6 +35,7 @@ ctlListView::ctlListView(wxWindow* p, int id, wxPoint pos, wxSize siz, long attr : wxListView(p, id, pos, siz, attr | wxLC_REPORT) { nosort = false; + autohint=false; order = 1; prev_col = -1; storelongstring = false; diff --git a/ctl/ctlNavigatePanel.cpp b/ctl/ctlNavigatePanel.cpp index 5baadfc..40208a5 100644 --- a/ctl/ctlNavigatePanel.cpp +++ b/ctl/ctlNavigatePanel.cpp @@ -75,6 +75,11 @@ void ctlNavigatePanel::Init(bool reorganization) { cm8["hotkey"] = wxString("F8"); cm8["description"] = wxString(_("Find all strings content current row State.")); cmds.Append(cm8); + wxJSONValue cm9(wxJSONType::wxJSONTYPE_OBJECT); + cm9["name"] = wxString("AutoHint"); + cm9["hotkey"] = wxString("F9"); + cm9["description"] = wxString(_("Enable/disable auto hint.")); + cmds.Append(cm9); @@ -164,6 +169,20 @@ void ctlNavigatePanel::Init(bool reorganization) { if (pr >= 0 && pr <= 100) { findwidth = pr; } + // check + wxJSONValue r=opt["commands"]; + bool isok=false; + for (int j = 0; j < r.Size(); j++) { + wxJSONValue ccm = r[j]; + if (ccm["name"].AsString()=="AutoHint") { + isok=true; + break; + }; + } + if (!isok) { + opt["commands"].Append(cm9); + settings->WriteJsonObect("LogNavigatePanel", opt); + } } else opt = def; } @@ -300,6 +319,11 @@ bool ctlNavigatePanel::RunKeyCommand(wxKeyEvent& event,int numCmd) { bool shift = false; bool directionUp = false; if (isok && cmdName == "Help") help = true; + if (isok && cmdName == "AutoHint") { + bool curr=ctrl->ToggleAutoHint(); + return true; + } + if (isok && cmdName == "FindNext") { // F3 if (logFindString.IsEmpty()) cmdName = "Find"; diff --git a/frm/frmMain.cpp b/frm/frmMain.cpp index b601671..12db8ef 100644 --- a/frm/frmMain.cpp +++ b/frm/frmMain.cpp @@ -265,8 +265,11 @@ frmMain::frmMain(const wxString &title) browser->Expand(root); browser->SortChildren(root); browser->SetFocus(); - - + wxString selServerName=settings->Read(wxT("Servers/SelectItem"), ""); + if (selServerName.Len()>0) { + wxTreeItemId sel=browser->FindItem(root,selServerName,true); + if (sel.IsOk()) browser->SelectItem(sel); + } } @@ -1287,6 +1290,15 @@ void frmMain::StoreServers() wxTreeItemIdValue foldercookie; wxTreeItemId folderitem = browser->GetFirstChild(browser->GetRootItem(), foldercookie); + wxTreeItemId cursoritem = browser->GetSelection(); + while (cursoritem.IsOk()) { + server = (pgServer *)browser->GetItemData(cursoritem); + if (server != NULL && server->IsCreatedBy(serverFactory)) { + break; + } + cursoritem=browser->GetItemParent(cursoritem); + } + wxString selServerName; while (folderitem) { if (browser->ItemHasChildren(folderitem)) @@ -1300,7 +1312,7 @@ void frmMain::StoreServers() { wxString key; ++numServers; - + if (cursoritem==serveritem) selServerName=server->GetName(); key.Printf(wxT("Servers/%d/"), numServers); settings->Write(key + wxT("Server"), server->GetName()); settings->Write(key + wxT("HostAddr"), server->GetHostAddr()); @@ -1353,6 +1365,7 @@ void frmMain::StoreServers() // Write the server count settings->WriteInt(wxT("Servers/Count"), numServers); + settings->Write(wxT("Servers/SelectItem"), selServerName); settings->FlushChanges(); wxLogInfo(wxT("Stored %d servers."), numServers); } diff --git a/frm/frmStatus.cpp b/frm/frmStatus.cpp index e9c5b4f..646e269 100644 --- a/frm/frmStatus.cpp +++ b/frm/frmStatus.cpp @@ -4791,7 +4791,7 @@ void frmStatus::OnMoveMouseLog(wxMouseEvent& event) if (lastlogitem != -1 || lastlogitem != item) { #define DELAYHITLOGPERIOD 1000 delayHitLog->Stop(); - delayHitLog->StartOnce(DELAYHITLOGPERIOD); + if (logList->GetAutoHint()) delayHitLog->StartOnce(DELAYHITLOGPERIOD); } else delayHitLog->Stop(); diff --git a/include/ctl/ctlListView.h b/include/ctl/ctlListView.h index 761783e..e8fc1f7 100644 --- a/include/ctl/ctlListView.h +++ b/include/ctl/ctlListView.h @@ -30,6 +30,7 @@ private: /// void SortGrid(int colsort, bool isevent); bool nosort; // если кто то пользуется SetItemData то не будем сортировать такие ctlListView + bool autohint=false; int order, prev_col; // будем сохранять длинные строки 0 колонки в этом массиве bool storelongstring = false; @@ -42,6 +43,8 @@ public: bool ReSort(); bool IsNumberColumn(const wxString& columnlabel); void SetModeStoreLongString() { storelongstring = true; } + bool ToggleAutoHint() { autohint=!autohint; return autohint;}; + bool GetAutoHint() {return autohint;}; bool DeleteAllItemsWithLong() { longstring.clear(); return wxListView::DeleteAllItems(); diff --git a/utils/FormatterSQL.cpp b/utils/FormatterSQL.cpp index e3cb5bc..2393200 100644 --- a/utils/FormatterSQL.cpp +++ b/utils/FormatterSQL.cpp @@ -1114,6 +1114,11 @@ int FormatterSQL::ParseSql(int flags) { } // no sql command if (ex) break; + #ifdef _DEBUG + int st=items[items.size()-1].srcpos+items[items.size()-1].txt.Length(); + wxString b=sql.substr(st,100); + wxMessageBox(wxString::Format("Bad sql syntax : %s",b)); + #endif errorposition=i; return -3;