Author Topic: Modified & Improved wxWidgets Project Wizard  (Read 225270 times)

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Modified & Improved wxWidgets Project Wizard
« Reply #165 on: February 19, 2007, 04:27:55 pm »
It would be pretty easy for wxFB to change to this:
Code
#if ( defined(WX_GCH) || defined(USE_PCH) )
#include <wx_pch.h>
#else
#include <wx/wx.h>
#endif

That way existing projects setup with WX_GCH would not break, but it should also work the with Code::Blocks wizard.

Yes! This will work. But I'll request you to NOT to add this immediately. Because I'm not sure about wxSmith. These three options need a common Pre-processor define to avoid this problem.  :D

Customization would be better, probably, but I'll need to talk to the other devs about adding a property.
This would be a nice addition.  :)
Be a part of the solution, not a part of the problem.

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: Modified & Improved wxWidgets Project Wizard
« Reply #166 on: February 19, 2007, 10:05:24 pm »
@byo
Can you please provide me with two project files, one for Dialog based and one for Frame based? Please include wxs file, cpp and header files. :)

Project file for wxDialog-based app is in attachment :) I've added some content into dialog since wxDialog can not have menus nor toolbars

Yes! This will work. But I'll request you to NOT to add this immediately. Because I'm not sure about wxSmith. These three options need a common Pre-processor define to avoid this problem.  :D

wxSmith uses the same scheme as in current wizard, this can be changed without any harm to wxSmith's behaviour. Maybe current content of files could be tweaked a little bit because wxSmith always generates list of includes in source/header files - these could be disabled when using PCH by putting inside #if block. wxSmith should easily handle this :)

Regards
  BYO

[attachment deleted by admin]

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Modified & Improved wxWidgets Project Wizard
« Reply #167 on: February 20, 2007, 09:58:06 am »
Project file for wxDialog-based app is in attachment :) I've added some content into dialog since wxDialog can not have menus nor toolbars

Many Thanks to You, Byo!  :D

I'll add the same contents to wxFormBuilder, too. ;)

wxSmith uses the same scheme as in current wizard, this can be changed without any harm to wxSmith's behaviour. Maybe current content of files could be tweaked a little bit because wxSmith always generates list of includes in source/header files - these could be disabled when using PCH by putting inside #if block. wxSmith should easily handle this :)

OK, I'll change the PCH Pre-processor definition to WX_PRECOMP. This is also supported by wxFormBuilder. As wxSmith can use it easily, this could solve our problem.

@rjmyst3
As byo wrote that wxSmith can support WX_PRECOMP Pre-processor definition without any problem, I'll go ahead with it.

The following code, in the generated header, should not be a problem. AFAIK, if you wish to use this header to create Pre-Compiled Header then the following code is necessary, otherwise Not. IMHO, the following code is bit redundant.

Code
#ifdef WX_GCH
#include <wx_pch.h>
#else
#include <wx/wx.h>
#endif

During compilation of cpp file, this code may not play a big role. :)

Regards,

Biplab
Be a part of the solution, not a part of the problem.

Offline rjmyst3

  • Multiple posting newcomer
  • *
  • Posts: 117
    • wxFormBuilder
Re: Modified & Improved wxWidgets Project Wizard
« Reply #168 on: February 20, 2007, 03:27:17 pm »
Quote
IMHO, the following code is bit redundant.

Code
#ifdef WX_GCH
#include <wx_pch.h>
#else
#include <wx/wx.h>
#endif

During compilation of cpp file, this code may not play a big role.

I tend to agree, but I didn't create it and I don't know enough, yet. I've posted about it on our forum, and am researching, so hopefully I'll figure it out soon.

Anyway, I'm looking forward to the wizard, thanks for your work!  :D

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: Modified & Improved wxWidgets Project Wizard
« Reply #169 on: February 21, 2007, 10:13:44 pm »
I've managed to add extra function to squirrel (was pretty easy using SqPlus - this lib rocks  8) ). Currently new function only popups dialog with parameters passed to it but for testing purposes it works like a charm :D

I've used this code in script:
Code
local ProjectName = Wizard.GetProjectName();   
WxsAddWxExtensions(project,ProjectName+_T("App.cpp"),ProjectName+_T("Main.cpp"),ProjectName+_T("Main.h"),_T("wxsmith/")+ProjectName+_T("dialog.wxs"));
(The last parameter may need some update since the file may be little bit different)

I've checked and if function is not registered, wizard works fine as long as function is not called (even if it's used in script's source) so we can be sure that even if wxSmith is not loaded, wizard will work fine as long as there's no wxSmith RAD selected.

The only thing I haven't found out yet is how to check if WxsAddWxExtensions function is defined using script's code - if it's not, wxSmith RAD should be disabled (or it should show some message).

Regards
   BYO

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Modified & Improved wxWidgets Project Wizard
« Reply #170 on: February 21, 2007, 11:05:51 pm »
Quote
The only thing I haven't found out yet is how to check if WxsAddWxExtensions function is defined using script's code - if it's not, wxSmith RAD should be disabled (or it should show some message).

To those interested in this, the "safe" way to check if a function exists without raising an error, is this:

Code
if ("WxsAddWxExtensions" in getroottable())
{
    ...
}

@byo: it's great that you added the first wxSmith script binding :). But make sure to de-register it when the plugin is unloaded (at least if the app is not shutting down). If you don't know how to do it, check compilergcc.cpp: it does this for a script function named "BuildLog" iirc.
« Last Edit: February 21, 2007, 11:09:18 pm by mandrav »
Be patient!
This bug will be fixed soon...

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: Modified & Improved wxWidgets Project Wizard
« Reply #171 on: February 22, 2007, 12:31:29 am »
Code
if ("WxsAddWxExtensions" in getroottable())
{
    ...
}

Jay, that's everything we need :D Thanks Boss :)

Quote
@byo: it's great that you added the first wxSmith script binding :). But make sure to de-register it when the plugin is unloaded (at least if the app is not shutting down). If you don't know how to do it, check compilergcc.cpp: it does this for a script function named "BuildLog" iirc.

Yup, right, forgot to unregister, thansk again ;)

EDIT:

I guess that mentioned function is not unregistered in compilergcc.cpp coz I couldn't find it :(
« Last Edit: February 22, 2007, 12:45:17 am by byo »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Modified & Improved wxWidgets Project Wizard
« Reply #172 on: February 22, 2007, 07:59:53 am »
EDIT:
I guess that mentioned function is not unregistered in compilergcc.cpp coz I couldn't find it :(
It is as simple as that:
Code
    // disable script functions
    ScriptBindings::gBuildLogId = -1;
(in void CompilerGCC::OnRelease(bool appShutDown))... If I get Yiannis correctly.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Modified & Improved wxWidgets Project Wizard
« Reply #173 on: February 22, 2007, 05:50:12 pm »
Hi Everybody,

Here is an glimpse of the next most interesting change in wxWidgets wizard. We're trying to add support for wxSmith or wxFormBuilder right through the wizard. Here is the first part.

Feature:
  • Supports Only wxFormBuilder+wxFrame based app.

Warning:
  • This is a development release and may contain serious bug. Download it only if you wish to test it.
  • Latest wizard has not been tested in Linux.

I'll commit it to main repository after some more tests.

@rjmyst3

Please test it once and give your feedback. :)

@byo

wxSmith support will be added after I finish this one. :)

Regards,

Biplab

[attachment deleted by admin]
Be a part of the solution, not a part of the problem.

Offline byo

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 837
Re: Modified & Improved wxWidgets Project Wizard
« Reply #174 on: February 22, 2007, 06:11:38 pm »
EDIT:
I guess that mentioned function is not unregistered in compilergcc.cpp coz I couldn't find it :(
It is as simple as that:
Code
    // disable script functions
    ScriptBindings::gBuildLogId = -1;
(in void CompilerGCC::OnRelease(bool appShutDown))... If I get Yiannis correctly.
With regards, Morten.

Nop, it won't unregister function from squirrel, it will simply make this function do nothing. But if copmpiler's dll is unloaded, any call to this function from script will cause a seg fault. I've already looked into squirrel and probably got a solution, but have to test it.

/EDIT:
Following part of code does the job:
Code
    Manager::Get()->GetScriptingManager();
    HSQUIRRELVM v = SquirrelVM::GetVMPtr();
    if ( v )
    {
        sq_pushroottable(v);
        sq_pushstring(v,"WxsAddWxExtensions",-1);
        sq_deleteslot(v,-2,false);
        sq_poptop(v);
    }
EDIT/

@byo
wxSmith support will be added after I finish this one. :)
No problem, there's no rush. I hope to have it in 1.0 final, and it rather won't be released in a week ;)

BYO
« Last Edit: February 22, 2007, 07:41:35 pm by byo »

Offline rjmyst3

  • Multiple posting newcomer
  • *
  • Posts: 117
    • wxFormBuilder
Re: Modified & Improved wxWidgets Project Wizard
« Reply #175 on: February 22, 2007, 06:49:56 pm »
Supports Only wxFormBuilder+wxFrame based app.
@rjmyst3
Please test it once and give your feedback. :)

I tested wxFB + wxFrame on Windows XP, and it worked flawlessly. Very Nice!  :D

I only have one suggestion:
 The title for the frame ("wxWidgets Application Template") should be set in wxFB. Otherwise the user will not be able to easily change it in wxFB later.

I will test it in Linux tonight.

Good Work!

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Modified & Improved wxWidgets Project Wizard
« Reply #176 on: February 22, 2007, 06:53:58 pm »
I tested wxFB + wxFrame on Windows XP, and it worked flawlessly. Very Nice!  :D

I only have one suggestion:
 The title for the frame ("wxWidgets Application Template") should be set in wxFB. Otherwise the user will not be able to easily change it in wxFB later.

Thanks a lot for the feedback.  :D

You are right, it should be set by wxFormBuilder. I'll change it. FYI, work on wxDialog+wxFB is in progress. :)
Be a part of the solution, not a part of the problem.

Offline Biplab

  • Developer
  • Lives here!
  • *****
  • Posts: 1874
    • Biplab's Blog
Re: Modified & Improved wxWidgets Project Wizard
« Reply #177 on: February 22, 2007, 07:56:51 pm »
Here is second update of latest development on wxwidgets wizard.

Feature:
  • Supports wxFormBuilder+wxDialog/wxFrame based app.

Known Issues:
Wizard generated project will fail to compile in Non-PCH+wxFB mode. This is due to Not wrapping PCH header include with appropriate Pre-Processor definition. Though I can wrap it manually but if you regenerate the source using wxFB, everything will be gone.

To solve this, Just comment out the following line (In Non-PCH mode only)
Code
#include "wx_pch.h"
in GUIDialog.cpp or GUIFrame.cpp file. Alternatively you may change it to
Code
#ifdef WX_PRECOMP
#include "wx_pch.h"
#endif

@rjmyst3
I think wrapping the include with appropriate Pre-Processor definition will be the best solution of this problem. Presently wxFB generated files include <wx/wxprec.h> by default which is always available and thus this issue have not come up earlier. Though this works, IMHO, creating custom PCH file will be beneficial for large projects. :)

Also please post your feedback on this update. Title issue will be solved once it is stable. :)

Regards,

Biplab

[attachment deleted by admin]
« Last Edit: February 22, 2007, 08:00:12 pm by Biplab »
Be a part of the solution, not a part of the problem.

Offline rjmyst3

  • Multiple posting newcomer
  • *
  • Posts: 117
    • wxFormBuilder
Re: Modified & Improved wxWidgets Project Wizard
« Reply #178 on: February 22, 2007, 10:18:43 pm »
Quote
I think wrapping the include with appropriate Pre-Processor definition will be the best solution of this problem. Presently wxFB generated files include <wx/wxprec.h> by default which is always available and thus this issue have not come up earlier. Though this works, IMHO, creating custom PCH file will be beneficial for large projects. Smile

I tend to agree with you, I've posted on our forum and I await the other devs' replies.

The wxDialog works great.

Offline rjmyst3

  • Multiple posting newcomer
  • *
  • Posts: 117
    • wxFormBuilder
Re: Modified & Improved wxWidgets Project Wizard
« Reply #179 on: February 23, 2007, 01:46:23 pm »
I tested wxFB + wxFrame and wxFB + wxDialog on Linux (Ubuntu 6.10) and they work great.

I did notice one small bug though.

The event table generated in Main.cpp has the wrong base class.
The generated code is:
Code
BEGIN_EVENT_TABLE(<generated Frame Name>, wxFrame)
when it should be:
Code
BEGIN_EVENT_TABLE(<generated Frame Name>, GUIFrame)

If GUIFrame is not the base specified in the BEGIN_EVENT_TABLE macro, then the event table generated by wxFB will be skipped.

It would be even better if wxFB was used to generate the event table, but I don't know how difficult that would be to conditionally implement in the wizard.

Everything else is superb. Great job.  :D