Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: mandrav on April 18, 2006, 02:26:26 pm

Title: New plugin committed
Post by: mandrav on April 18, 2006, 02:26:26 pm
I committed a new plugin in HEAD: Project wizard.

This complements (and eventually will replace) the project templates.
Currently we use a file-based approach for templates.
This wizard is based on scripts and allows the creation of wizard-like interfaces, guiding the user. I have also created a few wizards as examples. Surely, most of them, might need some finishing touches here and there.

For info on how you can create additional wizards, have a look in plugins/projectwizard/resources/console/wizard.script. It is fully commented and it should give you a nice head start.
To add a new wizard, you must add a new directory under plugins/projectwizard/resources/ and register it in plugins/projectwizard/resources/config.script.

Just follow the samples :).

Criticism and ideas for enhancement are welcomed, as always ;).
Title: Re: New plugin committed
Post by: mandrav on April 18, 2006, 03:31:32 pm
Known "issue": when you run update.bat to update your installation, it copies the Makefile.am files too. These are not part of the sample projects. They don't hurt, but they don't belong there...
Title: Re: New plugin committed
Post by: Michael on April 18, 2006, 03:46:34 pm
Hello,

I am trying to build it with cbp (rev2354) on Ubuntu 5.10, but I get 3 errors:

Quote
plugins/projectwizard/wiz.cpp:128: error: ´class wxXmlResource´ has no member named ´Unload´
plugins/projectwizard/wiz.cpp:326: error: ´wxDir´ has not been declared
plugins/projectwizard/wiz.cpp:128: error: ´getAllFiles´ was not declared in this scope

Best wishes,
Michael
Title: Re: New plugin committed
Post by: TDragon on April 18, 2006, 04:00:21 pm
Some thoughts:
Title: Re: New plugin committed
Post by: killerbot on April 18, 2006, 04:03:01 pm
add the following includes :
#include <wx/dir.h>


the other one : from wx header :
#if wxABI_VERSION > 20601
    // Unload resource from the given XML file (wildcards not allowed)
    bool Unload(const wxString& filename);
#endif // wxABI_VERSION


are you using old wx ??

EDIT : the include fix has been committed
Title: Re: New plugin committed
Post by: Michael on April 18, 2006, 04:05:53 pm
add the following includes :
#include <wx/dir.h>

Thanks :). I will give it a try.

the other one : from wx header :
#if wxABI_VERSION > 20601
    // Unload resource from the given XML file (wildcards not allowed)
    bool Unload(const wxString& filename);
#endif // wxABI_VERSION


are you using old wx ??

I use the the deafult Ubuntu package. Should not be that old, or?

Best wishes,
Michael
Title: Re: New plugin committed
Post by: Michael on April 18, 2006, 04:39:20 pm
add the following includes :
#include <wx/dir.h>

I still get the ´Unload´ error.

Best wishes,
Michael
Title: Re: New plugin committed
Post by: killerbot on April 18, 2006, 04:51:59 pm
Unload : the needed header is included (#include <wx/xrc/xmlres.h>
) but the Unload does only exist if the ABI is above a certain version, seems your ABI is below ??
Title: Re: New plugin committed
Post by: Michael on April 18, 2006, 04:55:43 pm
Unload : the needed header is included (#include <wx/xrc/xmlres.h>
) but the Unload does only exist if the ABI is above a certain version, seems your ABI is below ??

I have these here (Ubuntu default):

Quote
libwxgtk2.6-0 (2.6.1.1.1ubuntu2) [universe]
wxWidgets Cross-platform C++ GUI toolkit (GTK+ runtime)
libwxgtk2.6-dbg (2.6.1.1.1ubuntu2) [universe]
wxWidgets Cross-platform C++ GUI toolkit (GTK+ development)
libwxgtk2.6-dev (2.6.1.1.1ubuntu2) [universe]
wxWidgets Cross-platform C++ GUI toolkit (GTK+ development)

May be they are too old for the ABI...

Best wishes,
Michael
Title: Re: New plugin committed
Post by: MortenMacFly on April 18, 2006, 05:18:54 pm
Looks awesome. When I'm back home I'll try to create my own wizard.
Anyway, so far I found one bug (?): When I try to run the wizard for a D console application I get an error message box saying:

---------------------------
Scripting error
---------------------------
Error compiling script.
Error code: -1 (ERROR)

Details:
[WizardModule] wizard.script (66, 1) : Error   : A function with the same name and parameters already exist
[WizardModule] wizard.script (67, 1) : Error   : A function with the same name and parameters already exist
[WizardModule] wizard.script (68, 1) : Error   : A function with the same name and parameters already exist
[WizardModule] wizard.script (30, 1) : Info    : Compiling bool SetupProject(Project@)
[WizardModule] wizard.script (37, 5) : Error   : Multiple matching signatures to 'WarningsOn(CompileOptionsBase@&, wxString&)'
[WizardModule] wizard.script (46, 9) : Error   : Multiple matching signatures to 'DebugSymbolsOn(CompileOptionsBase@&, wxString&)'
[WizardModule] wizard.script (56, 9) : Error   : Multiple matching signatures to 'OptimizationsOn(CompileOptionsBase@&, wxString&)'

...all the other work fine.
With regards, Morten.
Title: Re: New plugin committed
Post by: mandrav on April 18, 2006, 06:08:23 pm
@michael: I confirm the wxXmlResource::Unload() problem in Ubuntu. I have #ifdef'd this line of code, but note that the second time you 'll run this wizard (in the same session) you may expect a crash because the loaded XRC will not be refreshed...

@morten: fixed, thanks.

@TDragon: remarks noted, thanks.

@all: thanks for the feedback guys :)
Title: Re: New plugin committed
Post by: MortenMacFly on April 18, 2006, 08:54:05 pm
I tried to implement the wizards for GLFW and GLUT, and: success. No I can really say: Nice work, though - easy to understand and really flexible.
How and when are other devs supposed to contribute (e.g. translate all other templates into wizards)? As a patch? Or is it better to wait with submitting new wizards - I'm thinking about the compiler framework overhaul here...?! (Because I believe the wizards will be changed slightly once this is done.)
With regards, Morten.
Title: Re: New plugin committed
Post by: sethjackson on April 18, 2006, 09:35:14 pm
Nice work.  8) I like it. :D
Title: Re: New plugin committed
Post by: mandrav on April 18, 2006, 09:35:21 pm
Quote
How and when are other devs supposed to contribute (e.g. translate all other templates into wizards)? As a patch?

Initially I 'd like to identify potential pitfalls/shortcomings and fix them. Then we can convert the file-based templates to scripts :).
So if something seems to be missing here, please discuss it.

Quote
I'm thinking about the compiler framework overhaul here...?! (Because I believe the wizards will be changed slightly once this is done.)

Most probably, only the way of setting compiler options might need update, i.e. not much.
Title: Re: New plugin committed
Post by: MortenMacFly on April 18, 2006, 09:49:57 pm
So if something seems to be missing here, please discuss it.
Ok, understood. From my point of view - after converting SmartWin and FLTK, too ;-) - I can say that for these examples it works very well... If you think of the wizards as a help for:
1.) setting up the and verify example requirements (headers, libs...),
2.) settings up and verifying the dev environment (Win/Linux/...; GCC/MSVC...) and then
3.) providing a readily setup, compilable and easy-to-understand example piece of code
I personally couldn't think of anything missing. But maybe I've chosen the easy ones... :oops:
Is there anything else the wizards could be good for that should be pointed out here?
With regards, Morten.
Title: Re: New plugin committed
Post by: Michael on April 18, 2006, 10:08:52 pm
@michael: I confirm the wxXmlResource::Unload() problem in Ubuntu. I have #ifdef'd this line of code, but note that the second time you 'll run this wizard (in the same session) you may expect a crash because the loaded XRC will not be refreshed...

Thank you very much for the help and the warning :D. Now it compiles fine. The problem with Ubuntu is due to the wxGTK library that is too old?

Best wishes,
Michael
Title: Re: New plugin committed
Post by: mandrav on April 18, 2006, 10:41:09 pm
Thank you very much for the help and the warning :D. Now it compiles fine. The problem with Ubuntu is due to the wxGTK library that is too old?

Yes. Although I haven't checked this, maybe there's a newer wxGTK in the backports repository...
Title: Re: New plugin committed
Post by: Michael on April 18, 2006, 10:53:15 pm
Thank you very much for the help and the warning :D. Now it compiles fine. The problem with Ubuntu is due to the wxGTK library that is too old?

Yes. Although I haven't checked this, maybe there's a newer wxGTK in the backports repository...

Ok. I am quite sure that Dapper will come with an update version (I hope it anyway :)). If not it would be better to build wxGTK directly from the sources. I will look to check if I find a newer version.

Best wishes,
Michael
Title: Re: New plugin committed [FIX]
Post by: MortenMacFly on April 19, 2006, 08:31:49 am
Known "issue": when you run update.bat to update your installation, it copies the Makefile.am files too. These are not part of the sample projects.
If you change some lines in update.bat as following it will work.
Change:

xcopy /y /s plugins\projectwizard\resources\* %RESDIR%\templates\wizard >nul
xcopy /y /s plugins\projectwizard\resources\* output\share\codeblocks\templates\wizard >nul

...into:

echo Makefile.am > excludes.txt
xcopy /y /s plugins\projectwizard\resources\* %RESDIR%\templates\wizard /EXCLUDE:excludes.txt >nul
xcopy /y /s plugins\projectwizard\resources\* output\share\codeblocks\templates\wizard /EXCLUDE:excludes.txt >nul
del excludes.txt

With regards, Morten.
Title: Re: New plugin committed
Post by: manmach on April 19, 2006, 09:32:57 am
  • I like the Debug/Release options; they save me a bit of work. Beginners to programming and/or Visual Studio converts will also feel much more comfortable. (I know your goal isn't to duplicate VS, but a few crossovers like this definitely don't hurt.)
  • The assumption that I will want my project in a subfolder of whatever folder I choose, with the same name as the project, is faintly irritating to me. Admittedly, I only have a few "projects" for which this wouldn't be suitable -- i.e. "solutions", containing multiple C::B "Projects", and I only have to set them up once. Still, semi-pros such as myself might appreciate a way to put the .cbp file exactly where we want when it's first created.

I don't like the idea of the subfolder either. In fact, in my (our) case it is almost always the wrong choice.
And if you want to compromise, make the compisted path editable. It is already listed to show the final result, so making that editable can't be too much bother. People who prefer the current setup can simply accept the end result, while others can remove the unwanted smartness.
Myself, I would go with letting people specify the path without adding a subdirectory automatically. Most other programs don't.

As for the debug and release, that is nice, but I find the choice of directorie odd. That may be because I am used to how KDevelop does it.
Title: Re: New plugin committed
Post by: mandrav on April 19, 2006, 11:30:51 am
Quote
As for the debug and release, that is nice, but I find the choice of directorie odd. That may be because I am used to how KDevelop does it.

Those are just the initial values. If you change them, the next time you run the wizard it will use the last values you entered. So this is a non-issue.
Title: Re: New plugin committed
Post by: killerbot on April 19, 2006, 02:05:35 pm
Makefile.am problem solved on windows (Thanks Morton !!!).
People who are already using a build from yesterday :
 a) by building themselves : before a new update : delete the "share\CodeBlocks\templates\wizard" dir from output and devel
 b) nightly builds users : just use tonights build but don't put it on top of a previous build (or if you instist to put it on top of an older one, you should first delete the same directory as in a) )
Title: Re: New plugin committed
Post by: manmach on April 19, 2006, 02:15:29 pm
Quote
As for the debug and release, that is nice, but I find the choice of directorie odd. That may be because I am used to how KDevelop does it.

Those are just the initial values. If you change them, the next time you run the wizard it will use the last values you entered. So this is a non-issue.

I see. Of course I haven't tried it a second time yet, otherwise I might have noticed.
Title: Re: New plugin committed
Post by: sethjackson on April 19, 2006, 10:03:36 pm
Umm the wxWidgets wizard doesn't use global user variables...... Is this intended?