That looks good to me.
The one other thing I thought of is that scope should not have a find in open files option if no files are open:
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)
{
.