--- 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/include/sysSettings.h.old Mon Aug 9 09:59:20 2004
+++ src/include/sysSettings.h Wed Sep 22 11:51:58 2004
@@ -53,6 +53,8 @@
void SetLastSSL(const int newval);
long GetMaxRows() const { return maxRows; }
void SetMaxRows(const long l) { maxRows=l; }
+ long GetMaxViewRows() const { return maxViewRows; }
+ void SetMaxViewRows(const long l) { maxViewRows=l; }
long GetMaxColSize() const { return maxColSize; }
void SetMaxColSize(const long l) { maxColSize=l; }
bool GetAskSaveConfirmation() const { return askSaveConfirmation; }
@@ -89,6 +91,10 @@
bool GetDoubleClickProperties() const { return doubleClickProperties; }
void SetDoubleClickProperties(const bool newval);
+ // View instead of Properties
+ bool GetDoubleClickView() const { return doubleClickView; }
+ void SetDoubleClickView(const bool newval);
+
// maximum size of server log to read
long GetMaxServerLogSize() const { return maxServerLogSize; }
void SetMaxServerLogSize(long l) { maxServerLogSize = l; }
@@ -172,9 +178,9 @@
bool showUsersForPrivileges;
bool askSaveConfirmation;
bool confirmDelete;
- long maxRows, maxColSize, autoRowCountThreshold;
+ long maxRows, maxColSize, autoRowCountThreshold, maxViewRows;
bool stickySql, unicodeFile;
- bool doubleClickProperties;
+ bool doubleClickProperties, doubleClickView;
long maxServerLogSize;
wxString searchPath;
--- src/include/frmOptions.h.old Fri Jun 11 20:17:52 2004
+++ src/include/frmOptions.h Wed Sep 22 12:30:59 2004
@@ -37,6 +37,7 @@
void OnOK(wxCommandEvent &ev);
void OnCancel(wxCommandEvent &ev);
void OnHelp(wxCommandEvent &ev);
+ void OnDoubleClickProps(wxCommandEvent &ev);
DECLARE_EVENT_TABLE()
};
--- src/ui/common/frmOptions.xrc.old Tue Sep 7 10:38:13 2004
+++ src/ui/common/frmOptions.xrc Wed Sep 22 12:03:26 2004
@@ -58,33 +58,49 @@
+
+
+
-
\ No newline at end of file
+
--- src/ui/events.cpp.old Tue Sep 7 10:34:34 2004
+++ src/ui/events.cpp Wed Sep 22 12:57:28 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 (settings->GetDoubleClickView() && (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() && settings->GetDoubleClickView()) {
+ denyCollapseItem=item;
+ ViewData(false);
+ return;
+ }
+ /* FALL-THROUGH */
+
default:
if (settings->GetDoubleClickProperties())
{
if (data->CanEdit())
{
+ denyCollapseItem=item;
OnProperties(nullEvent);
- event.Skip();
return;
}
}
--- src/ui/frmEditGrid.cpp.old Tue Sep 7 15:44:56 2004
+++ src/ui/frmEditGrid.cpp Wed Sep 22 13:03:10 2004
@@ -599,6 +599,11 @@
{
qry += wxT(" ORDER BY ") + orderBy;
}
+ long maxViewRows = settings->GetMaxViewRows();
+ if (maxViewRows > 0)
+ {
+ qry += wxT(" LIMIT ") + NumToStr(maxViewRows);
+ }
thread=new pgQueryThread(connection, qry);
if (thread->Create() != wxTHREAD_NO_ERROR)
--- src/ui/frmOptions.cpp.old Tue Sep 7 10:38:12 2004
+++ src/ui/frmOptions.cpp Wed Sep 22 12:32:32 2004
@@ -38,6 +38,7 @@
#define txtLogfile CTRL_TEXT("txtLogfile")
#define radLoglevel CTRL_RADIOBOX("radLoglevel")
#define txtMaxRows CTRL_TEXT("txtMaxRows")
+#define txtMaxViewRows CTRL_TEXT("txtMaxViewRows")
#define txtMaxColSize CTRL_TEXT("txtMaxColSize")
#define txtFont CTRL_TEXT("txtFont")
#define chkUnicodeFile CTRL_CHECKBOX("chkUnicodeFile")
@@ -47,6 +48,7 @@
#define txtAutoRowCount CTRL_TEXT("txtAutoRowCount")
#define chkStickySql CTRL_CHECKBOX("chkStickySql")
#define chkDoubleClickProperties CTRL_CHECKBOX("chkDoubleClickProperties")
+#define chkDoubleClickView CTRL_CHECKBOX("chkDoubleClickView")
#define cbLanguage CTRL_COMBOBOX("cbLanguage")
#define txtSqlFont CTRL_TEXT("txtSqlFont")
@@ -59,6 +61,8 @@
EVT_BUTTON (XRCID("btnOK"), frmOptions::OnOK)
EVT_BUTTON (XRCID("btnHelp"), frmOptions::OnHelp)
EVT_BUTTON (XRCID("btnCancel"), frmOptions::OnCancel)
+ EVT_CHECKBOX
+ (XRCID("chkDoubleClickProperties"), frmOptions::OnDoubleClickProps)
END_EVENT_TABLE()
frmOptions::frmOptions(frmMain *parent)
@@ -82,12 +86,14 @@
wxTextValidator numval(wxFILTER_NUMERIC);
txtMaxRows->SetValidator(numval);
+ txtMaxViewRows->SetValidator(numval);
txtMaxColSize->SetValidator(numval);
txtAutoRowCount->SetValidator(numval);
txtLogfile->SetValue(settings->GetLogFile());
radLoglevel->SetSelection(settings->GetLogLevel());
txtMaxRows->SetValue(NumToStr(settings->GetMaxRows()));
+ txtMaxViewRows->SetValue(NumToStr(settings->GetMaxViewRows()));
txtMaxColSize->SetValue(NumToStr(settings->GetMaxColSize()));
chkAskSaveConfirm->SetValue(!settings->GetAskSaveConfirmation());
chkAskDelete->SetValue(settings->GetConfirmDelete());
@@ -95,6 +101,8 @@
txtAutoRowCount->SetValue(NumToStr(settings->GetAutoRowCountThreshold()));
chkStickySql->SetValue(settings->GetStickySql());
chkDoubleClickProperties->SetValue(settings->GetDoubleClickProperties());
+ chkDoubleClickView->SetValue(settings->GetDoubleClickView());
+ chkDoubleClickView->Enable(settings->GetDoubleClickProperties());
txtSqlHelpSite->SetValue(settings->GetSqlHelpSite());
txtProxy->SetValue(settings->GetProxy());
chkUnicodeFile->SetValue(settings->GetUnicodeFile());
@@ -178,12 +186,15 @@
settings->SetMaxRows(StrToLong(txtMaxRows->GetValue()));
settings->SetMaxColSize(StrToLong(txtMaxColSize->GetValue()));
+ // Preferences
settings->SetAskSaveConfirmation(!chkAskSaveConfirm->GetValue());
settings->SetConfirmDelete(chkAskDelete->GetValue());
settings->SetShowUsersForPrivileges(chkShowUsersForPrivileges->GetValue());
settings->SetAutoRowCountThreshold(StrToLong(txtAutoRowCount->GetValue()));
settings->SetStickySql(chkStickySql->GetValue());
settings->SetDoubleClickProperties(chkDoubleClickProperties->GetValue());
+ settings->SetDoubleClickView(chkDoubleClickView->GetValue());
+ settings->SetMaxViewRows(StrToLong(txtMaxViewRows->GetValue()));
settings->SetUnicodeFile(chkUnicodeFile->GetValue());
settings->SetFont(currentFont);
settings->SetSQLFont(currentSqlFont);
@@ -276,3 +287,8 @@
if (logFile.ShowModal() == wxID_OK)
txtLogfile->SetValue(logFile.GetPath());
}
+
+void frmOptions::OnDoubleClickProps(wxCommandEvent &ev)
+{
+ chkDoubleClickView->Enable(chkDoubleClickProperties->IsChecked());
+}
--- src/utils/sysSettings.cpp.old Mon Aug 9 09:59:20 2004
+++ src/utils/sysSettings.cpp Wed Sep 22 13:11:28 2004
@@ -70,6 +70,8 @@
autoRowCountThreshold=Read(wxT("AutoRowCount"), 2000);
Read(wxT("StickySql"), &stickySql, false);
Read(wxT("DoubleClickProperties"), &doubleClickProperties, true);
+ Read(wxT("DoubleClickView"), &doubleClickView, false);
+ maxViewRows=Read(wxT("MaxViewRows"), 500L);
Read(wxT("WriteUnicodeFile"), &unicodeFile, false);
Read(wxT("SearchPath"), &searchPath, wxEmptyString);
Read(wxT("MaxServerLogSize"), &maxServerLogSize, 100000L);
@@ -147,6 +149,7 @@
Write(wxT("AskSaveConfirmation"), BoolToStr(askSaveConfirmation));
Write(wxT("ConfirmDelete"), BoolToStr(confirmDelete));
Write(wxT("ShowUsersForPrivileges"), BoolToStr(showUsersForPrivileges));
+ Write(wxT("MaxViewRows"), maxViewRows);
Write(wxT("SqlHelpSite"), sqlHelpSite);
Write(wxT("Proxy"), proxy);
Write(wxT("AutoRowCount"), autoRowCountThreshold);
@@ -328,3 +331,13 @@
doubleClickProperties = newval;
Write(wxT("DoubleClickProperties"), doubleClickProperties);
}
+
+//////////////////////////////////////////////////////////////////////////
+// View instead of properties
+//////////////////////////////////////////////////////////////////////////
+
+void sysSettings::SetDoubleClickView(const bool newval)
+{
+ doubleClickView = newval;
+ Write(wxT("DoubleClickView"), doubleClickView);
+}