Author Topic: WIP: Generic wizard plugin  (Read 9360 times)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
WIP: Generic wizard plugin
« on: February 21, 2006, 09:23:49 am »
...just being curious: What does "WIP" mean?! "Wery Interesting Plugin"?! ;-)

LOL :lol:

Since you 're curious, it's a generic wizard plugin for new projects.
It's completely data-driven using a combination of scripts and XRCs. Being scripted, allows it to have logic. For example, in the script for new wxwidgets projects, it detects if you have a matching configuration and, if not, it tells you beforehand that the new project is not going to build ;)
Actually, it could completely replace the current new project dialog and be part of the SDK as opposed to being a plugin. But there are some reasons that this wouldn't be beneficial, so it's not decided yet and is developed as a plugin currently.

Curiosity satisfied now? ;)
Be patient!
This bug will be fixed soon...

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
WIP: Generic wizard plugin
« Reply #1 on: February 21, 2006, 09:28:23 am »
It's completely data-driven using a combination of scripts and XRCs.

Exactly what I wanted :D

So it should be possible to create the XRC with wxSmith, and write the scripts using AngelScript, right?
If so, it could handle only the widgets registered, or how it's the process?

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
WIP: Generic wizard plugin
« Reply #2 on: February 21, 2006, 09:29:31 am »
...just being curious: What does "WIP" mean?! "Wery Interesting Plugin"?! ;-)

LOL :lol:

Since you 're curious, it's a generic wizard plugin for new projects.
It's completely data-driven using a combination of scripts and XRCs. Being scripted, allows it to have logic. For example, in the script for new wxwidgets projects, it detects if you have a matching configuration and, if not, it tells you beforehand that the new project is not going to build ;)
Actually, it could completely replace the current new project dialog and be part of the SDK as opposed to being a plugin. But there are some reasons that this wouldn't be beneficial, so it's not decided yet and is developed as a plugin currently.

Curiosity satisfied now? ;)

Mine yes :D.

Wery....oops....Very interesting plugin anyway :D.

Best wishes,
Michael

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: WIP: Generic wizard plugin
« Reply #3 on: February 21, 2006, 09:43:42 am »
As usual, the clarification produced more questions :P
Here. Attached is everything needed for the new console project wizard. Have a look, it's over-documented ;)

[attachment deleted by admin]
Be patient!
This bug will be fixed soon...

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: WIP: Generic wizard plugin
« Reply #4 on: February 21, 2006, 11:05:44 am »
Seems almost extremely easy. :D

Few things to point out:
-The scripts will need _("") macros to get i18n. I don't know how easy will be it to do with AngelScript in middle. HeroMyth?
-Languages other than C/C++, two options: having different wizards for each language, or having all in one wizard.

On "having all in one wizard" option, this for example:

Code: C++
  1.     if (IsCpp)
  2.     {
  3.         // C++ source file
  4.         result = "console/cpp";
  5.     }
  6.     else
  7.     {
  8.         // C source file
  9.         result = "console/c";
  10.     }

can become:

Code: C++
  1.     if( Wizard.GetLanguageID() == "cpp")
  2.         result = "console/cpp"; // C++ source file
  3.        
  4.     if( Wizard.GetLanguageID() == "c")
  5.         result = "console/c"; // C source file
  6.        
  7.     if( Wizard.GetLanguageID() == "d")
  8.         result = "console/d"; // D source file
  9.  
  10.     if( Wizard.GetLanguageID() == "fortran")
  11.         result = "console/fortran"; // Fortran source file
  12.  
  13.     if( Wizard.GetLanguageID() == "python")
  14.         result = "console/python"; // Python source file

Actually it would make more sense, as a lot of languages can share the Wizard (Console, wxWidgets projects, etc).

There are more things, but that suffices. :)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: WIP: Generic wizard plugin
« Reply #5 on: February 21, 2006, 11:32:34 am »
The IsCpp variable there is used to keep the language selection. It's not something internal to the wizard.
This sample wizard has one XRC page to select the type of console app to create. It offers C and C++ (like the current console template).
If you update the XRC to include more languages, you just have to change IsCpp from bool to int so that it can hold the index to the selected language.
Be patient!
This bug will be fixed soon...

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: WIP: Generic wizard plugin
« Reply #6 on: February 21, 2006, 12:02:14 pm »
Yes, I know that. It was just an example. :)

I'd have to explain more then:
I'm suggesting to add a Wizard.GetLanguageID() function with the code above.

The language would be set previously with a screen before the Wizard takes action.

That screen would be a dialog simmilar to this:


Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: WIP: Generic wizard plugin
« Reply #7 on: February 21, 2006, 12:26:46 pm »
i think the "final location" line (as shown in the pix above)
would be a very good idea to add to our CB wizard too,
and it would be good the project's path to be editable in an edit control
like the Build-options compiler's & linker's directories have it already !

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: WIP: Generic wizard plugin
« Reply #8 on: February 21, 2006, 12:31:23 pm »
In fact I think it should be almost exactly as that, but I would remove: the image, author, email, version, and license. They just clutter the dialog.

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: WIP: Generic wizard plugin
« Reply #9 on: February 21, 2006, 02:08:05 pm »
So here it is:



The blank space is a wxTreeCtrl.
I'm attaching the XRC.

[attachment deleted by admin]

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: WIP: Generic wizard plugin
« Reply #10 on: February 21, 2006, 02:14:16 pm »
Thanks Takeshi.
The main reason I hold this back (although it is ready), is because scripting doesn't work in all platforms yet. This would make it impossible to create a new project on those platforms...
Be patient!
This bug will be fixed soon...

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: WIP: Generic wizard plugin
« Reply #11 on: February 21, 2006, 02:23:43 pm »
Thanks Takeshi.
The main reason I hold this back (although it is ready), is because scripting doesn't work in all platforms yet. This would make it impossible to create a new project on those platforms...

Yes, I'm worried about the same. So I think C::B should be useable without scripting (at least for now, AngelScript should be an optional dependency).
That's why I think the dependencies are good to be ifdef'ed (except when ifdef'ing introduce too much cruft in the code).

Actually AngelScript works on all platforms (I think), but only when using AS_MAX_PORTABILITY, and AFAIK only the asCALL_GENERIC calling convention is available.

C::B could introduce a header with things like
Code: C++
  1. #ifdef AS_MAX_PORTABILITY
  2. #define ... asCALL_GENERIC
  3. #else
  4. #define ... ...
  5. #endif

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: WIP: Generic wizard plugin
« Reply #12 on: February 21, 2006, 02:45:38 pm »
One of the main reasons (besides raw speed) AngelScript was chosen, is because it's so damn easy to bind to existing C++ classes. No need to create wrapper classes, fight with the stack or other annoyances all other scripting languages have.

Plus, Andreas (AngelScript's author) provides excellent support for nothing. Much as we do here :) (shameless plug).

With that said, work has begun by Andreas for a 64bit port and I promised to help him. So I don't think it will really take long before it's done ;)
Also, with the help of afb, a PowerPC port is in the works. I wouldn't know how long this will take because it really depends on afb.

To recap, I think it's worth waiting a little while longer to have native AngelScript support (at least for 64bit) than start writing wrapper functions for everything inside C::B (which would become obsolete anyway once the above ports are done).
Be patient!
This bug will be fixed soon...

Offline takeshi miya

  • Lives here!
  • ****
  • Posts: 1487
Re: WIP: Generic wizard plugin
« Reply #13 on: February 21, 2006, 03:11:05 pm »
To recap, I think it's worth waiting a little while longer to have native AngelScript support (at least for 64bit) than start writing wrapper functions for everything inside C::B (which would become obsolete anyway once the above ports are done).

I know, I'll ask Andreas if he can make the wrappers right in AngelScript, because there always will be times where AS_MAX_PORTABILITY is the only thing that works.