Checkbox resides under "Options -> Query tool -> Query editor".
NB! didn't add the embed-xrc generated xrcDialogs.cpp class due to verbosity, so it needs to executed by the code maintainer.
From 2fad3850ba2abc63ba9788845777f4f2432e61ec Mon Sep 17 00:00:00 2001 From: kmoppel <kaarel.mop...@zalando.de> Date: Tue, 31 Dec 2013 14:27:15 +0100 Subject: [PATCH] Added an option (Query tool->Query editor) to disable code folding --- pgadmin/ctl/ctlSQLBox.cpp | 7 +++++-- pgadmin/frm/frmOptions.cpp | 3 +++ pgadmin/include/utils/sysSettings.h | 10 ++++++++++ pgadmin/ui/frmOptions.xrc | 15 +++++++++++++++ 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/pgadmin/ctl/ctlSQLBox.cpp b/pgadmin/ctl/ctlSQLBox.cpp index 634435a..0cabc46 100644 --- a/pgadmin/ctl/ctlSQLBox.cpp +++ b/pgadmin/ctl/ctlSQLBox.cpp @@ -153,8 +153,11 @@ void ctlSQLBox::Create(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS, *wxWHITE, *wxBLACK); MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS, *wxWHITE, *wxBLACK); - SetProperty(wxT("fold"), wxT("1")); - SetFoldFlags(16); + if (!settings->GetDisableFolding()) + { + SetProperty(wxT("fold"), wxT("1")); + SetFoldFlags(16); + } // Setup accelerators wxAcceleratorEntry entries[2]; diff --git a/pgadmin/frm/frmOptions.cpp b/pgadmin/frm/frmOptions.cpp index 9fcb1c4..a91f12d 100644 --- a/pgadmin/frm/frmOptions.cpp +++ b/pgadmin/frm/frmOptions.cpp @@ -80,6 +80,7 @@ #define txtAutoRowCount CTRL_TEXT("txtAutoRowCount") #define txtIndent CTRL_TEXT("txtIndent") #define chkSpacesForTabs CTRL_CHECKBOX("chkSpacesForTabs") +#define chkDisableFolding CTRL_CHECKBOX("chkDisableFolding") #define cbCopyQuote CTRL_COMBOBOX("cbCopyQuote") #define cbCopyQuoteChar CTRL_COMBOBOX("cbCopyQuoteChar") #define cbCopySeparator CTRL_COMBOBOX("cbCopySeparator") @@ -290,6 +291,7 @@ frmOptions::frmOptions(frmMain *parent) txtAutoRowCount->SetValue(NumToStr(settings->GetAutoRowCountThreshold())); txtIndent->SetValue(NumToStr(settings->GetIndentSpaces())); chkSpacesForTabs->SetValue(settings->GetSpacesForTabs()); + chkDisableFolding->SetValue(settings->GetDisableFolding()); cbCopyQuote->SetSelection(settings->GetCopyQuoting()); cbCopyQuoteChar->SetValue(settings->GetCopyQuoteChar()); cbRefreshOnClick->SetSelection(settings->GetRefreshOnClick()); @@ -652,6 +654,7 @@ void frmOptions::OnOK(wxCommandEvent &ev) settings->SetAutoRowCountThreshold(StrToLong(txtAutoRowCount->GetValue())); settings->SetIndentSpaces(StrToLong(txtIndent->GetValue())); settings->SetSpacesForTabs(chkSpacesForTabs->GetValue()); + settings->SetDisableFolding(chkDisableFolding->GetValue()); settings->SetCopyQuoting(cbCopyQuote->GetCurrentSelection()); settings->SetCopyQuoteChar(cbCopyQuoteChar->GetValue()); settings->SetHistoryMaxQueries(StrToLong(txtHistoryMaxQueries->GetValue())); diff --git a/pgadmin/include/utils/sysSettings.h b/pgadmin/include/utils/sysSettings.h index 37bdf4d..ae8d0c6 100644 --- a/pgadmin/include/utils/sysSettings.h +++ b/pgadmin/include/utils/sysSettings.h @@ -460,6 +460,16 @@ public: { WriteLong(wxT("History/MaxQuerySize"), newval); } + bool GetDisableFolding() const + { + bool b; + Read(wxT("DisableFolding"), &b, false); + return b; + } + void SetDisableFolding(const bool newval) + { + WriteBool(wxT("DisableFolding"), newval); + } // Custom Colours options wxString GetCustomColour(int index) const diff --git a/pgadmin/ui/frmOptions.xrc b/pgadmin/ui/frmOptions.xrc index a57b0ce..0f7ad0d 100644 --- a/pgadmin/ui/frmOptions.xrc +++ b/pgadmin/ui/frmOptions.xrc @@ -502,6 +502,21 @@ </object> <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag> <border>4</border> + </object> + <object class="sizeritem"> + <object class="wxStaticText" name="stDisableFolding"> + <label>Disable folding</label> + </object> + <flag>wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag> + <border>4</border> + </object> + <object class="sizeritem"> + <object class="wxCheckBox" name="chkDisableFolding"> + <label></label> + <checked>0</checked> + </object> + <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT|wxRIGHT</flag> + <border>4</border> </object> </object> </object> -- 1.7.9.5
-- Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgadmin-hackers