2. Add regular expression option: "." searches across newlines or withinWe have that already?!
3. Find/Replace in files: add option to specify project to search in (active or others)Good - also an option to search int he files of the target is something I'd like to see... ;-)
4. Load XRC for each configuration panel on demandBe careful here: We have a resource loader that kind off does such things already, but its not used. Something I had in mind to investigate why that is...
5. Explore making the settings dialog a modeless editor tabAgain: Be careful: We disable some function s if the settings dialog is opened for good reasons. also, avoid race conditions, like changing the (project's) compiler options while compiling in the background. Modeless dialogs require to handle this carefully. As we have an event based system this is not so easy! Other than That: Fine.
6. Explore replacing the settings dialog listbook with a single scrollable page where panels are folded away and unfold on click revealing their contentThis sounds like a very major change and I don't know how it affects plugins which provide panels as their foreign config dialogs. There was a very nice wxWidgets class though - I recall where you were able to shrink/unshrink parts of the window. But I didn't find it anymore... wxTreeSomewhat... wxScrolledSomewhat...?!
1. is a very useful feature, I use a lot in find and replace dialog, because you get the posibility to select a range of text and only replace a keyword in this selection. Very good for manual refactoring after copy and paste. Please do not remove !Yes, but it is annoying that if you have accidentally selected some text and you start a search it is in this unexpected mode.
1. is a very useful feature, I use a lot in find and replace dialog, because you get the posibility to select a range of text and only replace a keyword in this selection. Very good for manual refactoring after copy and paste. Please do not remove !
Yes, but it is annoying that if you have accidentally selected some text and you start a search it is in this unexpected mode.
What about making it the non-automatically selected option and the user is explicitly required to switch to this mode?
I can will add 7 to the list:
7). See if it is possible to make the project properties and build options modeless or editors, so the user can edit multiple settings at once.
This will be pretty useful in multi project workspaces.
2. Add regular expression option: "." searches across newlines or withinWe have that already?!
Good - also an option to search int he files of the target is something I'd like to see... ;-)
4. Load XRC for each configuration panel on demandBe careful here: We have a resource loader that kind off does such things already, but its not used. Something I had in mind to investigate why that is...
5. Explore making the settings dialog a modeless editor tabAgain: Be careful: We disable some function s if the settings dialog is opened for good reasons. also, avoid race conditions, like changing the (project's) compiler options while compiling in the background. Modeless dialogs require to handle this carefully. As we have an event based system this is not so easy! Other than That: Fine.
6. Explore replacing the settings dialog listbook with a single scrollable page where panels are folded away and unfold on click revealing their contentThis sounds like a very major change and I don't know how it affects plugins which provide panels as their foreign config dialogs. There was a very nice wxWidgets class though - I recall where you were able to shrink/unshrink parts of the window. But I didn't find it anymore... wxTreeSomewhat... wxScrolledSomewhat...?!
(codeblocks:9081): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `GtkRadioMenuItem'
(codeblocks:9081): Gtk-CRITICAL **: IA__gtk_radio_menu_item_get_group: assertion `GTK_IS_RADIO_MENU_ITEM (radio_menu_item)' failed
(codeblocks:9081): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `GtkRadioMenuItem'
(codeblocks:9081): Gtk-CRITICAL **: IA__gtk_radio_menu_item_get_group: assertion `GTK_IS_RADIO_MENU_ITEM (radio_menu_item)' failed
Aborted (core dumped)
I do get an assertion on exit:Code(codeblocks:9081): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `GtkRadioMenuItem'
(codeblocks:9081): Gtk-CRITICAL **: IA__gtk_radio_menu_item_get_group: assertion `GTK_IS_RADIO_MENU_ITEM (radio_menu_item)' failed
(codeblocks:9081): GLib-GObject-WARNING **: invalid uninstantiatable type `<invalid>' in cast to `GtkRadioMenuItem'
(codeblocks:9081): Gtk-CRITICAL **: IA__gtk_radio_menu_item_get_group: assertion `GTK_IS_RADIO_MENU_ITEM (radio_menu_item)' failed
Aborted (core dumped)
The core-dump is not related to this as far as I know, and it seems it has gone with the xm-compiler branch, so it might be related to compiler-plugin.I've cleaned-up the resource file sin the compiler plugin. Maybe we can merge that part to trunk a little earlier, too... I seems wxSmith does strange things sometimes in combination with editing XRC files, but I did not iinvestigate any further.
o Open files
o Project files
Project Combo\/ Target Combo\/
o Workspace
o Path
There was a very nice wxWidgets class though - I recall where you were able to shrink/unshrink parts of the window. But I didn't find it anymore... wxTreeSomewhat... wxScrolledSomewhat...?!
wxCollapsiblePane? http://docs.wxwidgets.org/2.8/wx_wxcollapsiblepane.htmlMaybe that was it, yes. Just I recall that it didn't have buttons but tiny plusses for collapsing...?! Maybe it was an older version.
svn cp src/sdk/replacedlg.cpp src/sdk/findreplacedlg.cpp
svn cp src/include/replacedlg.h src/include/findreplacedlg.h
I had used svn cp to do this, but the svn diff does not show up the need to copy replacedlg.* first.What you need to do is copy these files plain, the svn add them temporarily, then do the modifications and then create the patch.
I had used svn cp to do this, but the svn diff does not show up the need to copy replacedlg.* first.What you need to do is copy these files plain, the svn add them temporarily, then do the modifications and then create the patch.
Both patches presented here do not work for me. Alternatively just provide the two new files as "plain" files here, not included in the patch.
Did you make the copies using the two commands I suggested?Yes, I did - but they were left un-modifed after applying the patch.
Yes, I did - but they were left un-modifed after applying the patch.BTW, in the patch file you see this:
(The bigger problem may be because the patch was created on linux and you are trying to apply to windows)If they are created with "svn diff", they normally work out of the box on windows.
If they are created with "svn diff", they normally work out of the box on windows.Yes, unless there are missing steps. Like here, patch assumes files to be present which are not. So it cannot work. Not even, if you do a svn cp, because they are assumed to be there, committed, in r8239 - that's not the case.
I've attached another one, hopefully this works. (It does say "revision 0" for the new files, hope that is what you are expecting)Yes, this one worked out of the box (as expected).
I guess you are using some "fancy" patch tool. good ole linux patch apparently ignores the stuff in parentheses, so it applies fine after creating the copies of the file. :-\Well I am on Windows - so thee is no "good ole linux patch". And still: A patch is correct only, if it doesn't require any pre-requisite. Everything else just may work but is not guaranteed.
Yes, I did - but they were left un-modifed after applying the patch.BTW, in the patch file you see this:
--- src/sdk/findreplacedlg.cpp (revision 8239)
+++ src/sdk/findreplacedlg.cpp (working copy)
...but this will fail, because in revision 8239 there is no such file. That's why I said you need to add them.
So OK I was wrong, but isn't that partly an issue with svn diff? Why does it treat the added file as if it was in revision 8239, when clearly it wasn't? I used svn cp, but I guess diff just treats the cp as having occurred and just reports the changes.Maybe... I wonder how "svn cp" and "svn add" are interpreted by patch. I mean: In both cases you have a brand new file. From a "diff"-view perspective its the same. But: If you look at both patches, in one case you get a diff to an existing file, in the other you get the full file. I guess its just a mystery...
Anyway, any thoughts on the patch? (Note that the patch does not remove the files that are no longer needed)Hey, I've just managed to compile C::B... please gimme more than 5 minutes to try... ;D
BTW: Which files should I remove now? (Header, source, resource files?!)
Will then need to adjust project/make files accordinglyWell, when compiling the C::B sources with the patch applied, compilation of the plugins (namely codesnippets) will fail:
Well, when compiling the C::B sources with the patch applied, compilation of the plugins (namely codesnippets) will fail:
C:/Devel/CodeBlocks/src/plugins/contrib/codesnippets/editor/seditormanager.cpp:1524:101: error: cannot allocate an object of abstract type 'FindDlg'
C:/Devel/CodeBlocks/src/plugins/contrib/codesnippets/editor/seditormanager.cpp:1527:104: error: cannot allocate an object of abstract type 'ReplaceDlg'
Can you provide a complete patch, so one can compile the whole workspace?
Perhaps this plugin should really have its own dialogs?IMHO it is because besides the plugin, the codesnippets project also includes a standalone app to edito your snippets. For this to work, the dialogs were "copied" and renamed. Not nice, I know...
Perhaps this plugin should really have its own dialogs?IMHO it is because besides the plugin, the codesnippets project also includes a standalone app to edito your snippets. For this to work, the dialogs were "copied" and renamed. Not nice, I know...
Is there any chance Thread search might be merged into the standard search (only really makes sense for Find in files)? I find it a little confusing to have the duplicate search buttons, but I like features of both. (Just a thought.)
Is there any chance Thread search might be merged into the standard search (only really makes sense for Find in files)? I find it a little confusing to have the duplicate search buttons, but I like features of both. (Just a thought.)I've keybinded the ctrl-shift-f to thread search and I've not use the standard find in files for ages.
Yes, I have give some thought to making the search use a worker thread (for find). Are there other features besides that?why bother, thread search for the win...
why bother, thread search for the win...
Yes, I have give some thought to making the search use a worker thread (for find). Are there other features besides that?I prefer the UI of find, however Thread search has "Delete item" in a right-click menu. It also shows filenames in a separate column, which is important, because (on a small screen) it is fine for the path column to have a default size it which it is truncated, but I always want to see the full filename.
Thread search supplies the "Find occurrences" context menu item; if there is a merge, I would like for this item to be supplied by Find in files.Thread search provides on better option View -> Focus Thread search. I've a key bound to it and I'm using it all the time.
Here's a separate patch for CodeSnippets [...]For the record: Having applied both patches I see no negative side effect. It seems to work and looks OK.
Thread search provides on better option View -> Focus Thread search. I've a key bound to it and I'm using it all the time.I agree; Thread search is currently the best large search option in Code::Blocks. However my personal preference is that the UI for Find in files is nicer. (Also it feels redundant to have two items that do nearly the same thing; it took me several months when I first started Code::Blocks to figure out the difference between the two :-[.) If anyone (in this case, it seems it might be you, dmoore) is willing to spend time merging them, I would appreciate it.
In combination with a disabled option of "Delete previous entries before search" this is the best searcher in town.
Here's a separate patch for CodeSnippets [...]For the record: Having applied both patches I see no negative side effect. It seems to work and looks OK.
If you consider to apply, please also remove the obsolete files in SVN and from all build system (projects files, automake).
Find/Replace Dialog updated in SVN. I think this is a cleaner look and it should work better on smaller screens. Please test and report any issues.It seems to work well so far. If no projects are open, some of the radio boxes should be disabled:
Index: src/sdk/findreplacedlg.cpp
===================================================================
--- src/sdk/findreplacedlg.cpp (revision 8330)
+++ src/sdk/findreplacedlg.cpp (working copy)
@@ -168,6 +168,18 @@
chTarget->AppendString(active_project->GetBuildTarget(j)->GetTitle());
}
}
+ if (pa->IsEmpty())
+ {
+ if (rbScope->GetSelection() == 1 || rbScope->GetSelection() == 2)
+ {
+ rbScope->SetSelection(0);
+ XRCCTRL(*this, "pnSearchPath", wxPanel)->Show();
+ XRCCTRL(*this, "pnSearchPath", wxPanel)->Disable();
+ XRCCTRL(*this, "pnSearchProject", wxPanel)->Hide();
+ }
+ rbScope->Enable(1, false);
+ rbScope->Enable(2, false);
+ }
if (findReplaceInFilesOnly)
{
if (findReplaceInFilesOnly)
{
// NOTE (jens#1#): Do not delete, just hide the page, to avoid asserts in debug-mode
XRCCTRL(*this, "nbReplace", wxNotebook)->SetSelection(1);
(XRCCTRL(*this, "nbReplace", wxNotebook)->GetPage(0))->Hide(); // no active editor, so only replace-in-files
XRCCTRL(*this, "cmbFind2", wxComboBox)->SetFocus();
}
The page is still visible after your resequencing.
RemovePage() does work, however, that would take much more effort to work properly (and may introduce a memory leak). (DeletePage() may be the best choice, but a quick test crashed Code::Blocks - methods try to access the deleted objects.)
Index: src/sdk/findreplacedlg.cpp
===================================================================
--- src/sdk/findreplacedlg.cpp (revision 8351)
+++ src/sdk/findreplacedlg.cpp (working copy)
@@ -194,11 +194,13 @@
XRCCTRL(*this, "chkFixEOLs2", wxCheckBox)->Hide();
}
+ m_findPage=0;
if (findReplaceInFilesOnly)
{
- // NOTE (jens#1#): Do not delete, just hide the page, to avoid asserts in debug-mode
+ //Remove, but don't destroy the Find/Replace page until this dialog is destroyed.
XRCCTRL(*this, "nbReplace", wxNotebook)->SetSelection(1);
- (XRCCTRL(*this, "nbReplace", wxNotebook)->GetPage(0))->Hide(); // no active editor, so only replace-in-files
+ m_findPage=(XRCCTRL(*this, "nbReplace", wxNotebook)->GetPage(0)); // no active editor, so only replace-in-files
+ (XRCCTRL(*this, "nbReplace", wxNotebook)->RemovePage(0)); // no active editor, so only replace-in-files
XRCCTRL(*this, "cmbFind2", wxComboBox)->SetFocus();
}
else if (m_findReplaceInFilesActive)
@@ -270,6 +272,11 @@
cfg->Write(CONF_GROUP _T("/regex2"), XRCCTRL(*this, "chkRegEx2", wxCheckBox)->GetValue());
cfg->Write(CONF_GROUP _T("/scope2"), XRCCTRL(*this, "rbScope2", wxRadioBox)->GetSelection());
+ if(m_findPage!=0)
+ {
+ m_findPage->Destroy();
+ }
+
Disconnect(XRCID("nbReplace"), wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler(FindReplaceDlg::OnReplaceChange));
}
Index: src/include/findreplacedlg.h
===================================================================
--- src/include/findreplacedlg.h (revision 8351)
+++ src/include/findreplacedlg.h (working copy)
@@ -62,6 +62,7 @@
void SaveComboValues(wxComboBox* combo, const wxString& configKey);
bool m_findReplaceInFilesActive;
bool m_findMode;
+ wxWindow *m_findPage;
DECLARE_EVENT_TABLE()
};
So I gather this issue predates my recent changes and was actually introduced here (http://svn.berlios.de/wsvn/codeblocks?manualorder=1&op=comp&compare%5B0%5D=%2Ftrunk%2Fsrc%2Fsdk%2Freplacedlg.cpp&compare_rev%5B0%5D=7915&compare%5B1%5D=%2Ftrunk%2Fsrc%2Fsdk%2Freplacedlg.cpp&compare_rev%5B1%5D=7916&comparesubmit=Compare+Paths)Sorry; I am not sure why I never noticed this before.
try this:The page disappears correctly, but you may run into trouble with lines like:
bool FindReplaceDlg::IsFindInFiles() const
{
return (m_findReplaceInFilesActive || XRCCTRL(*this, "nbReplace", wxNotebook)->GetSelection() == 1);
}
//After hiding/showing panels, redo the layout in the notebook pages
(XRCCTRL(*this, "nbReplace", wxNotebook)->GetPage(0))->Layout();
(XRCCTRL(*this, "nbReplace", wxNotebook)->GetPage(1))->Layout();
The page disappears correctly, but you may run into trouble with lines like:Codeandbool FindReplaceDlg::IsFindInFiles() const
{
return (m_findReplaceInFilesActive || XRCCTRL(*this, "nbReplace", wxNotebook)->GetSelection() == 1);
}Codebecause (from what I can tell in the documentation) there now would only exist a single page (GetSelection() would always == 0).//After hiding/showing panels, redo the layout in the notebook pages
(XRCCTRL(*this, "nbReplace", wxNotebook)->GetPage(0))->Layout();
(XRCCTRL(*this, "nbReplace", wxNotebook)->GetPage(1))->Layout();
In the find menu, enable regular expressions and search something. Now open find in files, switch to the find tab, and disable regular expressions. The direction boxes (incorrectly) remain disabled.
Is it only me?! :-)No, confirmed here. It seems the wrong text boxes are toggled on initialisation. You are actually typing either in the replace, or in the multi-line find box.
Is it only me?! :-)No, confirmed here. It seems the wrong text boxes are toggled on initialisation. You are actually typing either in the replace, or in the multi-line find box.
Well this is strange, because I don't have the issue here(!?). Also using win7.I'll do a full re-compile. Maybe its an old resource or alike...
Seems to be a problem after the XRC rename, morten?I doubt... Why would that cause such a strange issue?
Seems to be a problem after the XRC rename, morten?I doubt... Why would that cause such a strange issue?
Ok, I fixed the bug, tested carefully (but only on windows) and committed the fix in rev 8369. Let me know if there are any other issues.Fix confirmed here as well (win7).
Index: src/sdk/findreplacedlg.cpp
===================================================================
--- src/sdk/findreplacedlg.cpp (revision 8376)
+++ src/sdk/findreplacedlg.cpp (working copy)
@@ -34,6 +34,9 @@
BEGIN_EVENT_TABLE(FindReplaceDlg, wxScrollingDialog)
EVT_ACTIVATE( FindReplaceDlg::OnActivate)
EVT_CHECKBOX(XRCID("chkRegEx1"), FindReplaceDlg::OnRegEx)
+#ifdef __WXGTK__
+ EVT_IDLE( FindReplaceDlg::OnIdle)
+#endif
// Special events for Replace
EVT_CHECKBOX(XRCID("chkMultiLine1"), FindReplaceDlg::OnMultiChange)
@@ -50,6 +53,9 @@
: FindReplaceBase(parent, initial, hasSelection),
m_findReplaceInFilesActive(findReplaceInFilesActive),
m_findMode(findMode)
+#ifdef __WXGTK__
+ ,m_setFocus(false)
+#endif
{
wxXmlResource::Get()->LoadObject(this, parent, _T("dlgFindReplace"),_T("wxScrollingDialog"));
ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor"));
@@ -552,7 +558,9 @@
m_findReplaceInFilesActive = true;
}
}
-
+#ifdef __WXGTK__
+ m_setFocus = true;
+#endif
Refresh();
event.Skip();
}
@@ -672,3 +680,26 @@
values.Insert(find, 0);
Manager::Get()->GetConfigManager(_T("editor"))->Write(configKey, values);
}
+
+#ifdef __WXGTK__
+void FindReplaceDlg::OnIdle(wxIdleEvent& event)
+{
+ if (m_setFocus && !wxGetMouseState().LeftIsDown())
+ {
+ m_setFocus = false;
+ if ( IsMultiLine() )
+ {
+ wxTextCtrl* tcp = ( IsFindInFiles() ? XRCCTRL(*this, "txtMultiLineFind2", wxTextCtrl)
+ : XRCCTRL(*this, "txtMultiLineFind1", wxTextCtrl) );
+ if (tcp) tcp->SetFocus();
+ }
+ else
+ {
+ wxComboBox* cbp = ( IsFindInFiles() ? XRCCTRL(*this, "cmbFind2", wxComboBox)
+ : XRCCTRL(*this, "cmbFind1", wxComboBox) );
+ if (cbp) cbp->SetFocus();
+ }
+ }
+ event.Skip();
+}
+#endif
Index: src/include/findreplacedlg.h
===================================================================
--- src/include/findreplacedlg.h (revision 8376)
+++ src/include/findreplacedlg.h (working copy)
@@ -62,6 +62,10 @@
void SaveComboValues(wxComboBox* combo, const wxString& configKey);
bool m_findReplaceInFilesActive;
bool m_findMode;
+#ifdef __WXGTK__
+ void OnIdle(wxIdleEvent& event);
+ bool m_setFocus;
+#endif
wxWindow *m_findPage;
DECLARE_EVENT_TABLE()
Index: include/findreplacedlg.h
===================================================================
--- include/findreplacedlg.h (revision 8376)
+++ include/findreplacedlg.h (working copy)
@@ -56,6 +56,7 @@
void OnScopeChange(wxCommandEvent& event);
void OnBrowsePath(wxCommandEvent& event);
void OnSearchProject(wxCommandEvent& event);
+ void OnDeferredFocus(wxCommandEvent& event);
private:
void FillComboWithLastValues(wxComboBox* combo, const wxString& configKey);
Index: sdk/findreplacedlg.cpp
===================================================================
--- sdk/findreplacedlg.cpp (revision 8376)
+++ sdk/findreplacedlg.cpp (working copy)
@@ -31,11 +31,17 @@
#define CONF_GROUP _T("/replace_options")
+//On wxGTK changing the focus of widgets inside the notebook page change event doesn't work
+//so we create this custom event (and associated handler) to do the focus change after
+//the notebook page change is complete
+DECLARE_EVENT_TYPE(wxDEFERRED_FOCUS_EVENT, -1)
+DEFINE_EVENT_TYPE(wxDEFERRED_FOCUS_EVENT)
+
BEGIN_EVENT_TABLE(FindReplaceDlg, wxScrollingDialog)
EVT_ACTIVATE( FindReplaceDlg::OnActivate)
EVT_CHECKBOX(XRCID("chkRegEx1"), FindReplaceDlg::OnRegEx)
- // Special events for Replace
+ // Special events for Find/Replace
EVT_CHECKBOX(XRCID("chkMultiLine1"), FindReplaceDlg::OnMultiChange)
EVT_CHECKBOX(XRCID("chkMultiLine2"), FindReplaceDlg::OnMultiChange)
EVT_CHECKBOX(XRCID("chkLimitTo1"), FindReplaceDlg::OnLimitToChange)
@@ -43,6 +49,9 @@
EVT_RADIOBOX(XRCID("rbScope2"), FindReplaceDlg::OnScopeChange)
EVT_BUTTON( XRCID("btnBrowsePath"), FindReplaceDlg::OnBrowsePath)
EVT_CHOICE( XRCID("chProject"), FindReplaceDlg::OnSearchProject)
+
+ EVT_COMMAND(wxID_ANY, wxDEFERRED_FOCUS_EVENT, FindReplaceDlg::OnDeferredFocus)
+
END_EVENT_TABLE()
FindReplaceDlg::FindReplaceDlg(wxWindow* parent, const wxString& initial, bool hasSelection,
@@ -532,10 +541,6 @@
txtFind1->SetValue(txtFind2->GetValue());
cmbFind1->SetValue(cmbFind2->GetValue());
cmbReplace1->SetValue(cmbReplace2->GetValue());
- if ( IsMultiLine() )
- txtFind1->SetFocus();
- else
- cmbFind1->SetFocus();
m_findReplaceInFilesActive = false;
}
else if (event.GetSelection() == 1)
@@ -545,18 +550,30 @@
cmbFind2->SetValue(cmbFind1->GetValue());
cmbReplace2->SetValue(cmbReplace1->GetValue());
cmbFind1->SetFocus();
- if ( IsMultiLine() )
- txtFind2->SetFocus();
- else
- cmbFind2->SetFocus();
m_findReplaceInFilesActive = true;
}
}
- Refresh();
+ wxCommandEvent e(wxDEFERRED_FOCUS_EVENT,wxID_ANY);
+ AddPendingEvent(e);
event.Skip();
}
+void FindReplaceDlg::OnDeferredFocus(wxCommandEvent& /*event*/)
+{
+ if ( IsMultiLine() )
+ {
+ wxTextCtrl* tcp = ( IsFindInFiles() ? XRCCTRL(*this, "txtMultiLineFind2", wxTextCtrl)
+ : XRCCTRL(*this, "txtMultiLineFind1", wxTextCtrl) );
+ if (tcp) tcp->SetFocus();
+ }
+ else
+ {
+ wxComboBox* cbp = ( IsFindInFiles() ? XRCCTRL(*this, "cmbFind2", wxComboBox)
+ : XRCCTRL(*this, "cmbFind1", wxComboBox) );
+ if (cbp) cbp->SetFocus();
+ }
+}
void FindReplaceDlg::OnRegEx(wxCommandEvent& /*event*/)
{
XRCCTRL(*this, "rbDirection", wxRadioBox)->Enable(!XRCCTRL(*this, "chkRegEx1", wxCheckBox)->GetValue());
Index: src/sdk/findreplacedlg.cpp
===================================================================
--- src/sdk/findreplacedlg.cpp (revision 8376)
+++ src/sdk/findreplacedlg.cpp (working copy)
@@ -128,28 +128,6 @@
XRCCTRL(*this, "pnSearchProject", wxPanel)->SetMinSize(szSearchPath);
XRCCTRL(*this, "pnSearchPath", wxPanel)->SetMinSize(szSearchPath);
- wxRadioBox* rbScope = XRCCTRL(*this, "rbScope2", wxRadioBox);
- switch(rbScope->GetSelection())
- {
- case 1:
- XRCCTRL(*this, "pnSearchPath", wxPanel)->Hide();
- XRCCTRL(*this, "pnSearchPath", wxPanel)->Disable();
- XRCCTRL(*this, "pnSearchProject", wxPanel)->Show();
- break;
- case 3:
- XRCCTRL(*this, "pnSearchPath", wxPanel)->Show();
- XRCCTRL(*this, "pnSearchPath", wxPanel)->Enable();
- XRCCTRL(*this, "pnSearchProject", wxPanel)->Hide();
- break;
- default:
- XRCCTRL(*this, "pnSearchPath", wxPanel)->Show();
- XRCCTRL(*this, "pnSearchPath", wxPanel)->Disable();
- XRCCTRL(*this, "pnSearchProject", wxPanel)->Hide();
- break;
- }
- (XRCCTRL(*this, "nbReplace", wxNotebook)->GetPage(1))->Layout();
-
-
ProjectManager *pm = Manager::Get()->GetProjectManager();
ProjectsArray *pa = pm->GetProjects();
cbProject *active_project = Manager::Get()->GetProjectManager()->GetActiveProject();
@@ -170,18 +148,54 @@
}
}
+ wxRadioBox* rbScope = XRCCTRL(*this, "rbScope2", wxRadioBox);
+ EditorManager* edMgr = Manager::Get()->GetEditorManager();
+ bool filesOpen = false;
+ for (int i = 0; i < edMgr->GetEditorsCount(); ++i)
+ {
+ if (edMgr->GetBuiltinEditor(i))
+ {
+ filesOpen = true;
+ break;
+ }
+ }
+ if (!filesOpen)
+ {
+ if (rbScope->GetSelection() == 0)
+ rbScope->SetSelection(1);
+ rbScope->Enable(0, false);
+ }
if (pa->IsEmpty())
{
if (rbScope->GetSelection() == 1 || rbScope->GetSelection() == 2)
{
- rbScope->SetSelection(0);
- XRCCTRL(*this, "pnSearchPath", wxPanel)->Show();
- XRCCTRL(*this, "pnSearchPath", wxPanel)->Disable();
- XRCCTRL(*this, "pnSearchProject", wxPanel)->Hide();
+ if (rbScope->IsItemEnabled(0))
+ rbScope->SetSelection(0);
+ else
+ rbScope->SetSelection(3);
}
rbScope->Enable(1, false);
rbScope->Enable(2, false);
}
+ switch(rbScope->GetSelection())
+ {
+ case 1:
+ XRCCTRL(*this, "pnSearchPath", wxPanel)->Hide();
+ XRCCTRL(*this, "pnSearchPath", wxPanel)->Disable();
+ XRCCTRL(*this, "pnSearchProject", wxPanel)->Show();
+ break;
+ case 3:
+ XRCCTRL(*this, "pnSearchPath", wxPanel)->Show();
+ XRCCTRL(*this, "pnSearchPath", wxPanel)->Enable();
+ XRCCTRL(*this, "pnSearchProject", wxPanel)->Hide();
+ break;
+ default:
+ XRCCTRL(*this, "pnSearchPath", wxPanel)->Show();
+ XRCCTRL(*this, "pnSearchPath", wxPanel)->Disable();
+ XRCCTRL(*this, "pnSearchProject", wxPanel)->Hide();
+ break;
+ }
+ (XRCCTRL(*this, "nbReplace", wxNotebook)->GetPage(1))->Layout();
if(findMode)
{
Good find Alpha.I presume no pun intended ;).
Alpha: I forgot to give you credit in the log message. My apologies.No worries. (Anyways, you technically wrote at least half of it...)