Patch: view data for tables/views on double click - Mailing list pgadmin-support
From | Ivan Nejgebauer |
---|---|
Subject | Patch: view data for tables/views on double click |
Date | |
Msg-id | 4149600A.3060701@uns.ns.ac.yu Whole thread Raw |
Responses |
Re: Patch: view data for tables/views on double
Re: Patch: view data for tables/views on double |
List | pgadmin-support |
The attached patch a) defines a double click handler for the list in the properties pane, so that a double click on an item in the list launches the properties editor for the item (or the data view if the item is a table or a view); and b) modifies the tree view double click handler so that a double click on a table or a view launches the data view for the corresponding table/view. Rationale for different behavior with tables/views: most of the time, it is expected that the user is interested in table/view _data_, not properties, so the default action on a table/view shoud be to display its data. Comments? i. --- src/include/frmMain.h.old Tue Aug 10 22:51:45 2004 +++ src/include/frmMain.h Wed Sep 15 11:56:51 2004 @@ -110,6 +110,7 @@ void OnPageChange(wxNotebookEvent& event); void OnPropSelChanged(wxListEvent& event); + void OnPropSelActivated(wxListEvent& event); void OnTreeSelChanged(wxTreeEvent &event); void OnTreeKeyDown(wxTreeEvent& event); void OnConnect(wxCommandEvent &ev); --- src/ui/events.cpp.old Tue Sep 7 10:34:34 2004 +++ src/ui/events.cpp Wed Sep 15 15:12:51 2004 @@ -122,6 +122,7 @@ EVT_MENU(MNU_CONTEXTMENU, frmMain::OnContextMenu) EVT_NOTEBOOK_PAGE_CHANGED(CTL_NOTEBOOK, frmMain::OnPageChange) EVT_LIST_ITEM_SELECTED(CTL_PROPVIEW, frmMain::OnPropSelChanged) + EVT_LIST_ITEM_ACTIVATED(CTL_PROPVIEW, frmMain::OnPropSelActivated) EVT_TREE_SEL_CHANGED(CTL_BROWSER, frmMain::OnTreeSelChanged) EVT_TREE_ITEM_EXPANDING(CTL_BROWSER, frmMain::OnExpand) EVT_TREE_ITEM_COLLAPSING(CTL_BROWSER, frmMain::OnCollapse) @@ -684,6 +685,30 @@ } +void frmMain::OnPropSelActivated(wxListEvent& event) +{ + wxTreeItemId item=browser->GetSelection(); + pgObject *data=(pgObject*)browser->GetItemData(item); + wxCommandEvent nullEvent; + + if (!settings->GetDoubleClickProperties()) + return; + if (data && data->IsCollection()) + { + data=((pgCollection*)data)->FindChild(browser, event.GetIndex()); + if (data) + { + int type = data->GetType(); + if (type == PG_TABLE || type == PG_VIEW) + ViewData(false); + else if (data->CanEdit()) + if (!dlgProperty::EditObjectDialog(this, sqlPane, data)) + checkAlive(); + } + } +} + + void frmMain::OnTreeSelChanged(wxTreeEvent& event) { denyCollapseItem=wxTreeItemId(); @@ -958,13 +983,22 @@ } break; + case PG_TABLE: + case PG_VIEW: + if (settings->GetDoubleClickProperties()) { + denyCollapseItem=item; + ViewData(false); + return; + } + break; + default: if (settings->GetDoubleClickProperties()) { if (data->CanEdit()) { + denyCollapseItem=item; OnProperties(nullEvent); - event.Skip(); return; } }
pgadmin-support by date: