mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-05-15 14:15:49 -06:00
Extended use shortcut
Быстрый поиск по F4 выполняется теперь не только по посещенным узлам, но и не явно по серверам и их хостам. В выпадающем списке сервера не указываются, поиск производится при наборе фразы.
This commit is contained in:
parent
98d435b843
commit
183a800f45
5 changed files with 71 additions and 7 deletions
|
|
@ -16,7 +16,7 @@ ctlShortCut::ctlShortCut(frmMain* main,wxWindow* parent, wxWindowID id, const wx
|
|||
Create(parent, id, wxEmptyString, pos, sz, style);
|
||||
//comboCustom->Create(panel, wxID_ANY, wxEmptyString);
|
||||
txt->Create(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, style);
|
||||
txt->SetFont(settings->GetSystemFont());
|
||||
txt->SetFont(settings->GetSystemFont());
|
||||
//txt->SetBackgroundColour(*wxWHITE);
|
||||
pop = new wxVListBoxComboPopup();
|
||||
///UseAltPopupWindow(false);
|
||||
|
|
@ -83,6 +83,20 @@ wxArrayString ctlShortCut::BuildList(wxString& find, bool full) {
|
|||
|
||||
}
|
||||
}
|
||||
// check servers list
|
||||
for (int i = 0; i<frm->servers_find_list.Count(); i++) {
|
||||
wxString t = viewText(frm->servers_find_list[i]);
|
||||
if (t.Find(find) != wxNOT_FOUND) {
|
||||
//wxString t2=frm->servers_find_list[i].BeforeFirst('(').Trim();
|
||||
wxString t2=frm->servers_find_list[i];
|
||||
if (full)
|
||||
{
|
||||
if (find.Length() == t.length()) rez.Add(t2);
|
||||
}
|
||||
else
|
||||
rez.Add(t2);
|
||||
}
|
||||
}
|
||||
if (rez.Count() > 0|| full) return rez;
|
||||
|
||||
return frm->shortcut;
|
||||
|
|
@ -118,8 +132,16 @@ void ctlShortCut::OnTEXT(wxCommandEvent& event) {
|
|||
if (!IsPopupShown() && ( true) ) {
|
||||
wxString s = txt->GetValue();
|
||||
SetText(s,false);
|
||||
if (pop->GetCount() > 0) {
|
||||
if (pop->GetCount() > 0 && s.Length()>0) {
|
||||
Popup();
|
||||
#ifdef __LINUX__
|
||||
//wxCommandEvent event(wxEVT_COMBOBOX_DROPDOWN,GetId() );
|
||||
//event.SetEventObject( this );
|
||||
//wxPostEvent(GetParent(), event);
|
||||
//this->AddPendingEvent(event);
|
||||
#else
|
||||
//Popup();
|
||||
#endif
|
||||
}
|
||||
//int e = txt->SetSelection(0, 1);
|
||||
//
|
||||
|
|
|
|||
|
|
@ -867,12 +867,15 @@ void frmMain::OnShortCut(wxCommandEvent& event)
|
|||
path = select_shortcut.SubString(1, select_shortcut.Length() - 1);
|
||||
add = true;
|
||||
}
|
||||
else path = select_shortcut.substr(4);
|
||||
else path = select_shortcut;
|
||||
|
||||
if (!SetCurrentNode(GetBrowser()->GetRootItem(), path))
|
||||
{
|
||||
wxMessageBox(_("The specified object couldn't be found in the tree."));
|
||||
return;
|
||||
path = path.substr(4).BeforeFirst('(').Trim();
|
||||
if (!SetCurrentNode(GetBrowser()->GetRootItem(), path)) {
|
||||
wxMessageBox(_("The specified object couldn't be found in the tree."));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (add) {
|
||||
int p = shortcut.Index(path);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public:
|
|||
|
||||
int idx=0;
|
||||
wxString si = ss.substr(0, 4).Trim();
|
||||
if (si.ToInt(&idx)) {
|
||||
if (si.ToInt(&idx) && idx>=0) {
|
||||
dc.DrawBitmap(imageList->GetBitmap(idx),wxPoint(rect.x,rect.y));
|
||||
}
|
||||
;
|
||||
|
|
@ -55,7 +55,10 @@ public:
|
|||
dc.GetTextExtent(pref, &lineWidth, &lineHeight);
|
||||
r.width = lineWidth;
|
||||
r.height = lineHeight;
|
||||
dc.DrawRoundedRectangle(r, 3);
|
||||
{
|
||||
wxDCPenChanger npen(dc, *wxThePenList->FindOrCreatePen(*wxBLACK, 1, wxPENSTYLE_SOLID));
|
||||
dc.DrawRoundedRectangle(r, 3);
|
||||
}
|
||||
}
|
||||
dc.GetTextExtent(src, &w1, &h1);
|
||||
dc.DrawText(src,
|
||||
|
|
|
|||
|
|
@ -206,7 +206,10 @@ public:
|
|||
|
||||
public:
|
||||
frmLog* Logfrm;
|
||||
// select node full path
|
||||
wxArrayString shortcut;
|
||||
// all servers info for find . Append only start pgadmin3
|
||||
wxArrayString servers_find_list;
|
||||
wxString select_shortcut;
|
||||
private:
|
||||
wxAuiManager manager;
|
||||
|
|
|
|||
33
pgAdmin3.cpp
33
pgAdmin3.cpp
|
|
@ -933,6 +933,39 @@ bool pgAdmin3::OnInit()
|
|||
|
||||
winMain->Show();
|
||||
SetTopWindow(winMain);
|
||||
// Append all server for shortcut
|
||||
wxTreeItemIdValue foldercookie;
|
||||
ctlTree *browser=winMain->GetBrowser();
|
||||
wxTreeItemId folderitem = browser->GetFirstChild(browser->GetRootItem(), foldercookie);
|
||||
while (folderitem)
|
||||
{
|
||||
if (browser->ItemHasChildren(folderitem))
|
||||
{
|
||||
wxTreeItemIdValue servercookie;
|
||||
wxTreeItemId serveritem = browser->GetFirstChild(folderitem, servercookie);
|
||||
while (serveritem)
|
||||
{
|
||||
pgServer *server = (pgServer *)browser->GetItemData(serveritem);
|
||||
if (server != NULL && server->IsCreatedBy(serverFactory)) {
|
||||
wxString path=server->GetFullName();
|
||||
wxTreeItemId node=serveritem;
|
||||
|
||||
wxTreeItemId parent = browser->GetItemParent(node);
|
||||
while (parent.IsOk())
|
||||
{
|
||||
path = browser->GetItemText(parent).BeforeFirst('(').Trim() + wxT("/") + path;
|
||||
parent = browser->GetItemParent(parent);
|
||||
}
|
||||
path=wxString::Format("%4d%s",-1,path);
|
||||
|
||||
winMain->servers_find_list.Add(path);
|
||||
|
||||
}
|
||||
serveritem = browser->GetNextChild(folderitem, servercookie);
|
||||
}
|
||||
}
|
||||
folderitem = browser->GetNextChild(browser->GetRootItem(), foldercookie);
|
||||
}
|
||||
|
||||
wxString str;
|
||||
if (cmdParser.Found(wxT("s"), &str))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue