Index: src/plugins/scriptedwizard/resources/manifest.xml
===================================================================
--- src/plugins/scriptedwizard/resources/manifest.xml (revision 11053)
+++ src/plugins/scriptedwizard/resources/manifest.xml (working copy)
@@ -3,12 +3,17 @@
<SdkVersion major="1" minor="10" release="0" />
<Plugin name="ScriptedWizard">
<Value title="Scripted wizard" />
- <Value version="0.9" />
- <Value description="A generic scripted wizard" />
+ <Value version="1.1" />
+ <Value description="An extended generic scripted wizard
+Add Wiz::FillContainerWithSelCompilers()
+ Wiz::AppendContainerWithSelCompilers()
+ Wiz::FillContainerWithChoices()
+ Wiz::AppendContainerWithChoices()
+ Wiz::GetWizardScriptFolder()" />
<Value author="Yiannis An. Mandravellos" />
<Value authorEmail="info@codeblocks.org" />
<Value authorWebsite="http://www.codeblocks.org" />
- <Value thanksTo="" />
+ <Value thanksTo="YWX for extended additions." />
<Value license="GPL" />
</Plugin>
</CodeBlocks_plugin_manifest_file>
Index: src/plugins/scriptedwizard/wiz.cpp
===================================================================
--- src/plugins/scriptedwizard/wiz.cpp (revision 11053)
+++ src/plugins/scriptedwizard/wiz.cpp (working copy)
@@ -277,6 +277,8 @@
InfoWindow::Display(_("Error"), _("Failed to load the wizard's script.\nPlease check the debug log for details..."));
return nullptr;
}
+ m_WizardScriptFolder = script.BeforeLast( _T('/') );
+ m_WizardScriptFolder = m_WizardScriptFolder.AfterLast( _T('/') );
// call BeginWizard()
try
@@ -680,7 +682,7 @@
{
const wxString &filename = files.BeforeFirst(_T(';'));
if (pFilename)
- *pFilename = filename;
+ *pFilename = files.BeforeFirst(_T(';'));
EditorBase *editor = Manager::Get()->GetEditorManager()->GetEditor(filename);
if (editor && editor->IsBuiltinEditor())
static_cast<cbEditor*>(editor)->SetEditorStyle();
@@ -898,6 +900,78 @@
}
}
+void Wiz::FillContainerWithSelCompilers( const wxString& name, const wxString& validCompilerIDs )
+{
+ wxWizardPage* page = m_pWizard->GetCurrentPage();
+ if (page)
+ {
+ wxItemContainer* win = dynamic_cast<wxItemContainer*>( page->FindWindowByName( name.IsEmpty() ? _T("GenericChoiceList") : name , page ) );
+ if (win)
+ {
+ wxArrayString valids = GetArrayFromString(validCompilerIDs, _T(";"), true);
+ win->Clear();
+ for (size_t i = 0; i < CompilerFactory::GetCompilersCount(); ++i)
+ {
+ Compiler* compiler = CompilerFactory::GetCompiler(i);
+ if (compiler)
+ {
+ for (size_t n = 0; n < valids.GetCount(); ++n)
+ {
+ // match not only if IDs match, but if ID inherits from it too
+ if (CompilerFactory::CompilerInheritsFrom(compiler, valids[n]))
+ {
+ win->Append(compiler->GetName());
+ break;
+ }
+ }
+ }
+ }
+ Compiler* compiler = CompilerFactory::GetDefaultCompiler();
+ if (compiler)
+ win->SetSelection(win->FindString(compiler->GetName()));
+ }
+ }
+}
+
+void Wiz::AppendContainerWithSelCompilers( const wxString& name, const wxString& validCompilerIDs )
+{
+ wxWizardPage* page = m_pWizard->GetCurrentPage();
+ if (page)
+ {
+ wxItemContainer* win = dynamic_cast<wxItemContainer*>( page->FindWindowByName( name.IsEmpty() ? _T("GenericChoiceList") : name , page ) );
+ if (win)
+ {
+ wxArrayString valids = GetArrayFromString(validCompilerIDs, _T(";"), true);
+ size_t iItemsCount = win->GetCount();
+ wxString nameInItems = _T(";");
+ for( size_t i = 0; i < iItemsCount; ++i )
+ {
+ nameInItems += win->GetString(i) + _T(";");
+ }
+ for (size_t i = 0; i < CompilerFactory::GetCompilersCount(); ++i)
+ {
+ Compiler* compiler = CompilerFactory::GetCompiler(i);
+ if (compiler)
+ {
+ wxString compilerName = compiler->GetName();
+ if( wxNOT_FOUND != nameInItems.Find( _T(";") + compilerName + _T(";") ) )
+ continue;
+ for (size_t n = 0; n < valids.GetCount(); ++n)
+ {
+ // match not only if IDs match, but if ID inherits from it too
+ if (CompilerFactory::CompilerInheritsFrom(compiler, valids[n]))
+ {
+ win->Append( compilerName );
+ nameInItems += compilerName + _T(";");
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
void Wiz::EnableWindow(const wxString& name, bool enable)
{
wxWizardPage* page = m_pWizard->GetCurrentPage();
@@ -1567,6 +1641,66 @@
m_ReleaseObjOutputDir = releaseObjOut;
}
+
+int Wiz::FillContainerWithChoices( const wxString& name, const wxString& choices )
+{
+ wxWizardPage* page = m_pWizard->GetCurrentPage();
+ if (page)
+ {
+ wxItemContainer* win = dynamic_cast<wxItemContainer*>( page->FindWindowByName( name.IsEmpty() ? _T("GenericChoiceList") : name , page ) );
+ if (win)
+ {
+ win->Clear();
+ wxArrayString items = GetArrayFromString( choices, _T(";") );
+ unsigned int nItems = items.GetCount();
+ for ( unsigned int i = 0; i < nItems; i++ )
+ {
+ win->Append( items[i] );
+ }
+
+ return 0;
+ }
+ }
+ return -1;
+}
+
+int Wiz::AppendContainerWithChoices( const wxString& name, const wxString& choices )
+{
+ wxWizardPage* page = m_pWizard->GetCurrentPage();
+ if (page)
+ {
+ wxItemContainer* win = dynamic_cast<wxItemContainer*>( page->FindWindowByName( name.IsEmpty() ? _T("GenericChoiceList") : name , page ) );
+ if (win)
+ {
+ wxArrayString items = GetArrayFromString( choices, _T(";") );
+ size_t iItemsCount = win->GetCount();
+ wxString nameInItems = _T(";");
+ for( size_t i = 0; i < iItemsCount; ++i )
+ {
+ nameInItems += win->GetString(i) + _T(";");
+ }
+ unsigned int nItems = items.GetCount();
+ for ( unsigned int i = 0; i < nItems; i++ )
+ {
+ wxString tItemsName = items[i];
+ if( wxNOT_FOUND != nameInItems.Find( _T(";") + tItemsName + _T(";") ) )
+ continue;
+ win->Append( tItemsName );
+ nameInItems += tItemsName + _T(";");
+ }
+
+ return 0;
+ }
+ }
+ return -1;
+}
+
+wxString Wiz::GetWizardScriptFolder(void)
+{
+ return m_WizardScriptFolder;
+}
+
+
void Wiz::RegisterWizard()
{
SqPlus::SQClassDef<Wiz>("Wiz").
@@ -1646,8 +1780,15 @@
func(&Wiz::GetFileHeaderGuard, "GetFileHeaderGuard").
func(&Wiz::GetFileAddToProject, "GetFileAddToProject").
func(&Wiz::GetFileTargetIndex, "GetFileTargetIndex").
- func(&Wiz::SetFilePathSelectionFilter, "SetFilePathSelectionFilter");
+ func(&Wiz::SetFilePathSelectionFilter, "SetFilePathSelectionFilter").
+ // extender
+ func(&Wiz::FillContainerWithSelCompilers, "FillContainerWithSelCompilers").
+ func(&Wiz::AppendContainerWithSelCompilers, "AppendContainerWithSelCompilers").
+ func(&Wiz::FillContainerWithChoices, "FillContainerWithChoices").
+ func(&Wiz::AppendContainerWithChoices, "AppendContainerWithChoices").
+ func(&Wiz::GetWizardScriptFolder, "GetWizardScriptFolder");
+
SqPlus::BindVariable(this, "Wizard", SqPlus::VAR_ACCESS_READ_ONLY);
}
Index: src/plugins/scriptedwizard/wiz.h
===================================================================
--- src/plugins/scriptedwizard/wiz.h (revision 11053)
+++ src/plugins/scriptedwizard/wiz.h (working copy)
@@ -78,6 +78,8 @@
bool IsCheckboxChecked(const wxString& name);
void FillComboboxWithCompilers(const wxString& name);
+ void FillContainerWithSelCompilers( const wxString& name, const wxString& validCompilerIDs );
+ void AppendContainerWithSelCompilers( const wxString& name, const wxString& validCompilerIDs );
wxString GetCompilerFromCombobox(const wxString& name);
void FillContainerWithCompilers(const wxString& name, const wxString& compilerID,
const wxString& validCompilerIDs);
@@ -150,6 +152,11 @@
const wxString& releaseOut,
const wxString& releaseObjOut);
+ // extender
+ int FillContainerWithChoices( const wxString& name, const wxString& choices );
+ int AppendContainerWithChoices( const wxString& name, const wxString& choices );
+ wxString GetWizardScriptFolder(void);
+
// pre-defined pages
void AddInfoPage(const wxString& pageId, const wxString& intro_msg);
void AddFilePathPage(bool showHeaderGuard);
@@ -190,6 +197,8 @@
wxString m_ReleaseName;
wxString m_ReleaseOutputDir;
wxString m_ReleaseObjOutputDir;
+
+ wxString m_WizardScriptFolder;
private:
Wiz(cb_unused const Wiz& rhs); // prevent copy construction
};
Index: src/plugins/scriptedwizard/wizpage.h
===================================================================
--- src/plugins/scriptedwizard/wizpage.h (revision 11053)
+++ src/plugins/scriptedwizard/wizpage.h (working copy)
@@ -94,6 +94,7 @@
wxString m_Filename;
wxString m_HeaderGuard;
bool m_AddToProject;
+ int m_TargetIndex;
};
class WizProjectPathPanel : public WizPageBase