diff --git a/README.md b/README.md index df9f7f2..ae35d22 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,12 @@ This text Russian language. Удалено отображение узлов имеющих статус (Never execute) на закладке графического плана, но в табличном виде они присутствуют. 01.11.2018 -Добавлено отображение publications -Добавлено изменение фона при при не закоммиченой транзакции +Добавлено отображение publications. +Добавлено изменение фона при при не закоммиченой транзакции. У Commit/Rollback измененены горячие клавиши + +11.12.2018 +Добавлен поиск в дереве по F4 выделеного текста и если объект найден то его открытие. +Если запрос длится более 2 минут то после завершения запроса окно будет мигать. +При открытия функции фокус устанавливается сразу на закладку Код. + diff --git a/Release/pgAdmin3.exe b/Release/pgAdmin3.exe index 43d3d04..2e8e417 100644 Binary files a/Release/pgAdmin3.exe and b/Release/pgAdmin3.exe differ diff --git a/ctl/ctlTree.cpp b/ctl/ctlTree.cpp index 6a33309..51a9e4e 100644 --- a/ctl/ctlTree.cpp +++ b/ctl/ctlTree.cpp @@ -25,7 +25,7 @@ BEGIN_EVENT_TABLE(ctlTree, wxTreeCtrl) END_EVENT_TABLE() -wxTreeItemId ctlTree::FindItem(const wxTreeItemId &idParent, const wxString &prefixOrig) +wxTreeItemId ctlTree::FindItem(const wxTreeItemId &idParent, const wxString &prefixOrig, const bool full ) { // match is case insensitive as this is more convenient to the user: having // to press Shift-letter to go to the item starting with a capital letter @@ -37,7 +37,7 @@ wxTreeItemId ctlTree::FindItem(const wxTreeItemId &idParent, const wxString &pre // pressing it) but we shouldn't jump to the next one if the user is // continuing to type as otherwise he might easily skip the item he wanted wxTreeItemId id = idParent; - + int le=prefix.length(); if ( prefix.length() == 1 ) { wxCookieType cookie; @@ -61,7 +61,11 @@ wxTreeItemId ctlTree::FindItem(const wxTreeItemId &idParent, const wxString &pre // look for the item starting with the given prefix after it while ( id.IsOk() && ( ( GetItemText(id) == wxT("Dummy") && !GetItemData(id) ) || - !GetItemText(id).Lower().StartsWith(prefix) )) + !( (!full&&GetItemText(id).Lower().StartsWith(prefix)) || + (full && //GetItemText(id).Lower().StartsWith(prefix) && GetItemText(id).length()==le) + GetObject(id)->GetName()==prefix ) + ) + )) { wxCookieType cookie; if ( HasChildren(id) ) @@ -110,7 +114,11 @@ wxTreeItemId ctlTree::FindItem(const wxTreeItemId &idParent, const wxString &pre // and try all the items (stop when we get to the one we started from) while ( id.IsOk() && id != idParent && (( GetItemText(id) == wxT("Dummy") && !GetItemData(id) ) || - !GetItemText(id).Lower().StartsWith(prefix) )) + !((!full&&GetItemText(id).Lower().StartsWith(prefix)) || + (full && //GetItemText(id).Lower().StartsWith(prefix) && GetItemText(id).length()==le) + GetObject(id)->GetName()==prefix ) + ) + )) { wxCookieType cookie; if ( HasChildren(id) ) diff --git a/dlg/dlgFunction.cpp b/dlg/dlgFunction.cpp index 7cba8f2..a4256fd 100644 --- a/dlg/dlgFunction.cpp +++ b/dlg/dlgFunction.cpp @@ -155,7 +155,6 @@ dlgFunction::dlgFunction(pgaFactory *f, frmMain *frame, pgFunction *node, pgSche txtSqlBox->SetMarginType(1, wxSTC_MARGIN_NUMBER); txtSqlBox->SetMarginWidth(1, ConvertDialogToPixels(wxPoint(16, 0)).x); } - btnAdd->Disable(); btnRemove->Disable(); btnChange->Disable(); diff --git a/dlg/dlgProperty.cpp b/dlg/dlgProperty.cpp index 7381729..888e737 100644 --- a/dlg/dlgProperty.cpp +++ b/dlg/dlgProperty.cpp @@ -339,6 +339,11 @@ int dlgProperty::Go(bool modal) wxString typeName = factory->GetTypeName(); SetTitle(wxString(wxGetTranslation(typeName)) + wxT(" ") + GetObject()->GetFullIdentifier()); + if (typeName==wxT("Function")) { + if (nbNotebook) + nbNotebook->SetSelection(4); + } + } else { diff --git a/frm/frmQuery.cpp b/frm/frmQuery.cpp index 7889b5b..9a3d4e5 100644 --- a/frm/frmQuery.cpp +++ b/frm/frmQuery.cpp @@ -39,6 +39,7 @@ #include "dlg/dlgAddFavourite.h" #include "dlg/dlgManageFavourites.h" #include "dlg/dlgManageMacros.h" +#include "dlg/dlgFunction.h" #include "frm/frmReport.h" #include "gqb/gqbViewController.h" #include "gqb/gqbModel.h" @@ -164,6 +165,7 @@ BEGIN_EVENT_TABLE(frmQuery, pgFrame) EVT_MENU(MNU_LF, frmQuery::OnSetEOLMode) EVT_MENU(MNU_CRLF, frmQuery::OnSetEOLMode) EVT_MENU(MNU_CR, frmQuery::OnSetEOLMode) + EVT_MENU(MNU_AUTOEDITOBJECT, frmQuery::OnAutoEditObject) EVT_MENU_RANGE(MNU_FAVOURITES_MANAGE + 1, MNU_FAVOURITES_MANAGE + 999, frmQuery::OnSelectFavourite) EVT_MENU_RANGE(MNU_MACROS_MANAGE + 1, MNU_MACROS_MANAGE + 99, frmQuery::OnMacroInvoke) EVT_ACTIVATE( frmQuery::OnActivate) @@ -320,6 +322,7 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w editMenu->AppendSubMenu(formatMenu, _("F&ormat")); editMenu->Append(MNU_LINEENDS, _("&Line ends"), lineEndMenu); editMenu->Append(MNU_AUTOREPLACE_MANAGE, _("Manage autoreplace..."), _("Edit and delete autoreplace strings")); + editMenu->Append(MNU_AUTOEDITOBJECT, _("Open object\tF4"), _("Open object in brouser tree")); autoreplace = queryMacroFileProvider::LoadAutoReplace(true); @@ -2116,7 +2119,47 @@ int frmQuery::GetLineEndingStyle() return sqlQuery->GetEOLMode(); } +void frmQuery::OnAutoEditObject(wxCommandEvent &event) +{ + //parent->SetCurrentNode(parent->GetBrowser()->GetRootItem(), path); + pgObject *obj = mainForm->GetBrowser()->GetObject(mainForm->GetBrowser()->GetSelection()); + pgFunction *fun=(pgFunction *)obj;//obj->Show + //mainForm.propFactory->StartDialog(mainForm, obj); + //showMessage(obj->GetTypeName()); + //return; + if (obj->GetTypeName()==wxT("Servers")||obj->GetTypeName()==wxT("Server")||obj->GetTypeName()==wxT("Databases") + ||obj->GetTypeName()==wxT("Tablespaces")||obj->GetTypeName()==wxT("Group Roles") + ||obj->GetTypeName()==wxT("Login Roles") + ) return; + wxString databasePath = mainForm->GetNodePath(obj->GetDatabase()->GetId()); + //showMessage(databasePath); + wxString selText = sqlQuery->GetSelectedText(); + if (!selText.IsNull()) { + databasePath =databasePath +wxT("/")+ _("Schemas"); + if(!mainForm->SetCurrentNode(mainForm->GetBrowser()->GetRootItem(), databasePath)) + { + wxMessageBox(_("The specified object couldn't be found in the tree.") + databasePath); + } + //int n=mainForm->GetBrowser()->GetChildrenCount(mainForm->GetBrowser()->GetSelection(),false); + wxTreeItemId matchItem = mainForm->GetBrowser()->FindItem(obj->GetId(),selText,true); + + if (matchItem.IsOk()) { + wxString findtext= mainForm->GetBrowser()->GetItemText(matchItem); + pgObject *o=mainForm->GetBrowser()->GetObject(matchItem); + //mainForm->GetBrowser()->SelectItem(o->GetId()); + //showMessage(o->GetName().Lower()); + if (o->GetName().Lower()==selText.Lower()) { + + //obj = mainForm->GetBrowser()->GetObject(mainForm->GetBrowser()->GetSelection()); + obj=o; + if (!dlgProperty::EditObjectDialog(mainForm, 0, obj)) + mainForm->CheckAlive(); + } + } + } + +} // User-set the current EOL mode for the form void frmQuery::OnSetEOLMode(wxCommandEvent &event) { @@ -3360,7 +3403,7 @@ void frmQuery::completeQuery(bool done, bool explain, bool verbose) setTools(false); fileMenu->Enable(MNU_EXPORT, sqlResult->CanExport()); - if (!IsActive() || IsIconized()) + if ((!IsActive() || IsIconized())|| (elapsedQuery>120*1000)) RequestUserAttention(); if (!viewMenu->IsChecked(MNU_OUTPUTPANE)) @@ -3403,6 +3446,7 @@ void frmQuery::completeQuery(bool done, bool explain, bool verbose) sqlQueryExec = NULL; sqlQuery->SetFocus(); + } diff --git a/include/ctl/ctlTree.h b/include/ctl/ctlTree.h index b7700e8..90f1dcc 100644 --- a/include/ctl/ctlTree.h +++ b/include/ctl/ctlTree.h @@ -39,7 +39,7 @@ public: pgCollection *GetParentCollection(wxTreeItemId id); pgObject *FindObject(pgaFactory &factory, wxTreeItemId parent); pgCollection *FindCollection(pgaFactory &factory, wxTreeItemId parent); - wxTreeItemId FindItem(const wxTreeItemId &item, const wxString &str); + wxTreeItemId FindItem(const wxTreeItemId &item, const wxString &str, bool full = false); void NavigateTree(int keyCode); virtual ~ctlTree(); diff --git a/include/frm/frmQuery.h b/include/frm/frmQuery.h index 667d092..f3368f6 100644 --- a/include/frm/frmQuery.h +++ b/include/frm/frmQuery.h @@ -259,6 +259,7 @@ private: void showMessage(const wxString &msg, const wxString &msgShort = wxT("")); int GetLineEndingStyle(); void OnSetEOLMode(wxCommandEvent &event); + void OnAutoEditObject(wxCommandEvent &event); void SetEOLModeDisplay(int mode); void OnMacroInvoke(wxCommandEvent &event); void OnMacroManage(wxCommandEvent &event); diff --git a/include/frm/menu.h b/include/frm/menu.h index d0f3adb..9c8be6f 100644 --- a/include/frm/menu.h +++ b/include/frm/menu.h @@ -130,6 +130,7 @@ enum MNU_TOGGLEDDSQL, MNU_TOGGLEMBROWSER, MNU_AUTOREPLACE_MANAGE, + MNU_AUTOEDITOBJECT, MNU_RECENT, MNU_NEW = MNU_RECENT + 15, // leave space for recent file entries