mirror of
https://github.com/levinsv/pgadmin3.git
synced 2026-08-22 22:03:33 -06:00
Double the single quote.
Добавлена команда удвоения одиночной кавычки в выделеном тексте и обратная команда.
This commit is contained in:
parent
2bb2ff25cf
commit
614a7f0adc
6 changed files with 40 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ public:
|
|||
m_autocompDisabled = on;
|
||||
}
|
||||
bool BlockComment(bool uncomment = false);
|
||||
bool BlockDouble(bool undouble = false);
|
||||
void UpdateLineNumber();
|
||||
wxString ExternalFormat();
|
||||
void AbortProcess();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -115,6 +115,8 @@ enum
|
|||
MNU_BLOCK_OUTDENT,
|
||||
MNU_COMMENT_TEXT,
|
||||
MNU_UNCOMMENT_TEXT,
|
||||
MNU_DOUBLEQUOTE_TEXT,
|
||||
MNU_UNDOUBLEQUOTE_TEXT,
|
||||
MNU_EXTERNALFORMAT,
|
||||
|
||||
MNU_PLUGINBUTTONLIST,
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue