Patch #2849 2009-11-13 05:44

rickg22

Multiline S &R (final version)
Download
2849-Multiline_S_R.patch (55.5 KB)
Category
Application::FeatureAdd
Status
Accepted
Close date
2010-06-01 11:54
Assigned to
mortenmacfly
Index: src/sdk/replacedlg.cpp
===================================================================
--- src/sdk/replacedlg.cpp    (revision 5925)
+++ src/sdk/replacedlg.cpp    (working copy)
@@ -28,6 +28,12 @@
 
 BEGIN_EVENT_TABLE(ReplaceDlg, wxDialog)
     EVT_NOTEBOOK_PAGE_CHANGED(XRCID("nbReplace"), ReplaceDlg::OnFindChange)
+    EVT_CHECKBOX(XRCID("chkMultiLine1"), ReplaceDlg::OnMultiChange)
+    EVT_CHECKBOX(XRCID("chkMultiLine2"), ReplaceDlg::OnMultiChange)
+    EVT_CHECKBOX(XRCID("chkLimitTo1"), ReplaceDlg::OnLimitToChange)
+    EVT_CHECKBOX(XRCID("chkLimitTo2"), ReplaceDlg::OnLimitToChange)
+
+    EVT_SIZE(                           ReplaceDlg::OnSize)
     EVT_CHECKBOX(XRCID("chkRegEx1"),     ReplaceDlg::OnRegEx)
     EVT_ACTIVATE(                       ReplaceDlg::OnActivate)
 END_EVENT_TABLE()
@@ -40,16 +46,45 @@
     wxXmlResource::Get()->LoadDialog(this, parent, _T("dlgReplace"));
     ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));
 
+    // Get minimum size. This must be done before loading the values, or our dialog could get REALLY fat.
+    wxSize sizeSingle = XRCCTRL(*this, "tabReplaceSingle", wxPanel)->GetEffectiveMinSize();
+    wxSize sizeMulti  = XRCCTRL(*this, "tabReplaceMulti", wxPanel)->GetEffectiveMinSize();
+    wxSize sizeFilesSingle = XRCCTRL(*this, "tabReplaceInFilesSingle", wxPanel)->GetEffectiveMinSize();
+    wxSize sizeFilesMulti  = XRCCTRL(*this, "tabReplaceInFilesMulti", wxPanel)->GetEffectiveMinSize();
+
+    sizeSingle.IncTo(sizeMulti);
+    sizeFilesSingle.IncTo(sizeFilesMulti);
+
+    wxSize tmpsize = XRCCTRL(*this, "nbReplaceInFilesSingleMulti", wxPanel)->GetClientSize();
+    XRCCTRL(*this, "tabReplaceInFilesMulti", wxPanel)->SetSize(tmpsize);
+    XRCCTRL(*this, "tabReplaceInFilesSingle", wxPanel)->SetSize(tmpsize);
+
+    tmpsize = XRCCTRL(*this, "nbReplaceSingleMulti", wxPanel)->GetClientSize();
+    XRCCTRL(*this, "tabReplaceMulti", wxPanel)->SetSize(tmpsize);
+    XRCCTRL(*this, "tabReplaceSingle", wxPanel)->SetSize(tmpsize);
+
     // load last searches
     FillComboWithLastValues(XRCCTRL(*this, "cmbFind1", wxComboBox), CONF_GROUP _T("/last"));
     FillComboWithLastValues(XRCCTRL(*this, "cmbReplace1", wxComboBox), CONF_GROUP _T("/lastReplace"));
     FillComboWithLastValues(XRCCTRL(*this, "cmbFind2", wxComboBox), CONF_GROUP _T("/last"));
     FillComboWithLastValues(XRCCTRL(*this, "cmbReplace2", wxComboBox), CONF_GROUP _T("/lastReplace"));
 
+    // load last multiline searches
+    XRCCTRL(*this, "txtMultiLineFind1", wxTextCtrl)->SetValue(cfg->Read(CONF_GROUP _T("/lastMultiLineFind"), _T("")));
+    XRCCTRL(*this, "txtMultiLineReplace1", wxTextCtrl)->SetValue(cfg->Read(CONF_GROUP _T("/lastMultiLineReplace"), _T("")));
+    XRCCTRL(*this, "txtMultiLineFind2", wxTextCtrl)->SetValue(cfg->Read(CONF_GROUP _T("/lastMultiLineFind"), _T("")));
+    XRCCTRL(*this, "txtMultiLineReplace2", wxTextCtrl)->SetValue(cfg->Read(CONF_GROUP _T("/lastMultiLineReplace"), _T("")));
+
     // replace options
     XRCCTRL(*this, "cmbFind1", wxComboBox)->SetValue(initial);
-    XRCCTRL(*this, "chkWholeWord1", wxCheckBox)->SetValue(cfg->ReadBool(CONF_GROUP _T("/match_word"), false));
-    XRCCTRL(*this, "chkStartWord1", wxCheckBox)->SetValue(cfg->ReadBool(CONF_GROUP _T("/start_word"), false));
+
+    bool flgWholeWord = cfg->ReadBool(CONF_GROUP _T("/match_word"), false);
+    bool flgStartWord = cfg->ReadBool(CONF_GROUP _T("/start_word"), false);
+    bool flgStartFile = cfg->ReadBool(CONF_GROUP _T("/start_file"), false);
+    XRCCTRL(*this, "chkLimitTo1", wxCheckBox)->SetValue(flgWholeWord | flgStartWord | flgStartFile);
+    XRCCTRL(*this, "rbLimitTo1", wxRadioBox)->Enable((bool)(flgWholeWord | flgStartWord | flgStartFile));
+    XRCCTRL(*this, "rbLimitTo1", wxRadioBox)->SetSelection(flgStartFile ? 2 : (flgStartWord ? 1 : 0));
+
     XRCCTRL(*this, "chkMatchCase1", wxCheckBox)->SetValue(cfg->ReadBool(CONF_GROUP _T("/match_case"), false));
     XRCCTRL(*this, "chkRegEx1", wxCheckBox)->SetValue(cfg->ReadBool(CONF_GROUP _T("/regex"), false));
     XRCCTRL(*this, "rbDirection", wxRadioBox)->SetSelection(cfg->ReadInt(CONF_GROUP _T("/direction"), 1));
@@ -61,13 +96,37 @@
     XRCCTRL(*this, "chkAutoWrapSearch", wxCheckBox)->SetValue(cfg->ReadBool(_T("/find_options/auto_wrap_search"), true));
 
     // replace in files options
+    flgWholeWord = cfg->ReadBool(CONF_GROUP _T("/match_word2"), false);
+    flgStartWord = cfg->ReadBool(CONF_GROUP _T("/start_word2"), false);
+    flgStartFile = cfg->ReadBool(CONF_GROUP _T("/start_file2"), false);
+    XRCCTRL(*this, "chkLimitTo2", wxCheckBox)->SetValue(flgWholeWord | flgStartWord | flgStartFile);
+    XRCCTRL(*this, "rbLimitTo2", wxRadioBox)->Enable((bool)(flgWholeWord | flgStartWord | flgStartFile));
+    XRCCTRL(*this, "rbLimitTo2", wxRadioBox)->SetSelection(flgStartFile ? 2 : (flgStartWord ? 1 : 0));
+
     XRCCTRL(*this, "cmbFind2", wxComboBox)->SetValue(initial);
-    XRCCTRL(*this, "chkWholeWord2", wxCheckBox)->SetValu
download for full patch...
rickg22 2009-11-18 14:45

The revised patch adds other new features to the replace dialog.

Note that the weird tabbing in windows still happens. Can't find out why. Perhaps a buggy wxWidgets version?

rickg22 2009-11-20 06:04

This is the final version of the patch, with UI issues fixed.

mortenmacfly 2010-01-01 07:21

I am taking it so it doesn't get lost. It does not apply cleanly on trunk anymore, however, I have a working version (just not a patch).