diff --git a/ctl/ctlSQLBox.cpp b/ctl/ctlSQLBox.cpp index 6d29876..78562b0 100644 --- a/ctl/ctlSQLBox.cpp +++ b/ctl/ctlSQLBox.cpp @@ -787,7 +787,27 @@ void ctlSQLBox::OnKeyDown(wxKeyEvent &event) else event.Skip(); } +bool ctlSQLBox::BlockDouble(bool undouble) +{ + int start = GetSelectionStart(); + if (!GetSelectedText().IsEmpty()) + { + wxString selection = GetSelectedText(); + if (!undouble) + { + selection.Replace("'", "''"); + } + else + { + selection.Replace("''", "'"); + + } + ReplaceSelection(selection); + SetSelection(start, start + selection.Length()); + } + return true; +} bool ctlSQLBox::BlockComment(bool uncomment) { wxString lineEnd; diff --git a/frm/frmQuery.cpp b/frm/frmQuery.cpp index a3e24b4..18b5713 100644 --- a/frm/frmQuery.cpp +++ b/frm/frmQuery.cpp @@ -169,6 +169,8 @@ BEGIN_EVENT_TABLE(frmQuery, pgFrame) EVT_MENU(MNU_LOWER_CASE, frmQuery::OnChangeToLowerCase) EVT_MENU(MNU_COMMENT_TEXT, frmQuery::OnCommentText) EVT_MENU(MNU_UNCOMMENT_TEXT, frmQuery::OnUncommentText) + EVT_MENU(MNU_DOUBLEQUOTE_TEXT, frmQuery::OnDoubleText) + EVT_MENU(MNU_UNDOUBLEQUOTE_TEXT,frmQuery::OnUnDoubleText) EVT_MENU(MNU_EXTERNALFORMAT, frmQuery::OnExternalFormat) EVT_MENU(MNU_LF, frmQuery::OnSetEOLMode) EVT_MENU(MNU_CRLF, frmQuery::OnSetEOLMode) @@ -385,6 +387,8 @@ frmQuery::frmQuery(frmMain *form, const wxString &_title, pgConn *_conn, const w formatMenu->Append(MNU_BLOCK_OUTDENT, _("Block &Outdent\tShift-Tab"), _("Outdent the selected block")); formatMenu->Append(MNU_COMMENT_TEXT, _("Co&mment Text\tCtrl-K"), _("Comment out the selected text")); formatMenu->Append(MNU_UNCOMMENT_TEXT, _("Uncomme&nt Text\tCtrl-Shift-K"), _("Uncomment the selected text")); + formatMenu->Append(MNU_DOUBLEQUOTE_TEXT, _("Double the single quote\tCtrl-'"), _("Double the single quote")); + formatMenu->Append(MNU_UNDOUBLEQUOTE_TEXT, _("Undouble the single quote\tCtrl-Shift-'"), _("Undouble the single quote")); formatMenu->AppendSeparator(); formatMenu->Append(MNU_EXTERNALFORMAT, _("External Format\tCtrl-Shift-F"), _("Call external formatting command")); editMenu->AppendSubMenu(formatMenu, _("F&ormat")); @@ -4016,6 +4020,17 @@ void frmQuery::OnUncommentText(wxCommandEvent &event) if (FindFocus()->GetId() == CTL_SQLQUERY) sqlQuery->BlockComment(true); } +void frmQuery::OnDoubleText(wxCommandEvent& event) +{ + if (FindFocus()->GetId() == CTL_SQLQUERY) + sqlQuery->BlockDouble(false); +} + +void frmQuery::OnUnDoubleText(wxCommandEvent& event) +{ + if (FindFocus()->GetId() == CTL_SQLQUERY) + sqlQuery->BlockDouble(true); +} void frmQuery::OnExternalFormat(wxCommandEvent &event) { diff --git a/include/ctl/ctlSQLBox.h b/include/ctl/ctlSQLBox.h index 558b7cc..94c9ef7 100644 --- a/include/ctl/ctlSQLBox.h +++ b/include/ctl/ctlSQLBox.h @@ -78,6 +78,7 @@ public: m_autocompDisabled = on; } bool BlockComment(bool uncomment = false); + bool BlockDouble(bool undouble = false); void UpdateLineNumber(); wxString ExternalFormat(); void AbortProcess(); diff --git a/include/frm/frmQuery.h b/include/frm/frmQuery.h index f6e7ee8..3283e7a 100644 --- a/include/frm/frmQuery.h +++ b/include/frm/frmQuery.h @@ -258,6 +258,8 @@ private: void OnChangeToLowerCase(wxCommandEvent &event); void OnCommentText(wxCommandEvent &event); void OnUncommentText(wxCommandEvent &event); + void OnDoubleText(wxCommandEvent& event); + void OnUnDoubleText(wxCommandEvent& event); void OnExternalFormat(wxCommandEvent &event); void OnDeleteCurrent(wxCommandEvent &event); diff --git a/include/frm/menu.h b/include/frm/menu.h index f1f1170..bb1b093 100644 --- a/include/frm/menu.h +++ b/include/frm/menu.h @@ -115,6 +115,8 @@ enum MNU_BLOCK_OUTDENT, MNU_COMMENT_TEXT, MNU_UNCOMMENT_TEXT, + MNU_DOUBLEQUOTE_TEXT, + MNU_UNDOUBLEQUOTE_TEXT, MNU_EXTERNALFORMAT, MNU_PLUGINBUTTONLIST, diff --git a/x64/Release_(3.0)/pgAdmin3.exe b/x64/Release_(3.0)/pgAdmin3.exe index a8fb801..5f181c2 100644 Binary files a/x64/Release_(3.0)/pgAdmin3.exe and b/x64/Release_(3.0)/pgAdmin3.exe differ