Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: oBFusCATed on February 16, 2010, 10:33:56 pm

Title: New event - cbEVT_EDITOR_SAVE_ALL
Post by: oBFusCATed on February 16, 2010, 10:33:56 pm
Hello,

Is it a good idea the addition of cbEVT_EDITOR_SAVE_ALL?
For example, this event will be fired when the compiler starts to build the project (currently it calls project->SaveAllFiles() :( )  every other plugin/core needs to save all files.
I want this event in order to make the wxSmith plugin save the *.wxs file, when the user compiles the project.
At the moment when you hit compile in a wxSmith project the *.wxs is not saved, which is a bit disturbing and not very user friendly.
Title: Re: New event - cbEVT_EDITOR_SAVE_ALL
Post by: MortenMacFly on February 17, 2010, 06:40:36 am
Is it a good idea the addition of cbEVT_EDITOR_SAVE_ALL?
Why don't you simply use cbEVT_COMPILER_STARTED?
Title: Re: New event - cbEVT_EDITOR_SAVE_ALL
Post by: oBFusCATed on February 17, 2010, 08:14:19 am
That was my first idea, but adding the event SAVE_ALL sounds more logical and robust (can save all files on other events, not sure which :) ).

Maybe the event name should be other, because cbEVT_EDITOR_* is for the editors... probably cbEVT_PROJECT_SAVE_FILES is better one.
Title: Re: New event - cbEVT_EDITOR_SAVE_ALL
Post by: MortenMacFly on February 17, 2010, 09:21:02 am
That was my first idea, but adding the event SAVE_ALL sounds more logical and robust (can save all files on other events, not sure which :) ).
Make it cbEVT_PROJECT_SAVE_ALL_FILES then to comply with the method's name.
Title: Re: New event - cbEVT_EDITOR_SAVE_ALL
Post by: oBFusCATed on February 17, 2010, 12:26:12 pm
OK, One more thing - should I fire it from the inside of project->SaveAllFiles() or I need to modify all places that call SaveAllFiles() to fire the event?
Title: Re: New event - cbEVT_EDITOR_SAVE_ALL
Post by: MortenMacFly on February 17, 2010, 01:26:14 pm
inside of project->SaveAllFiles()
This one. :-)
Title: Re: New event - cbEVT_EDITOR_SAVE_ALL
Post by: oBFusCATed on February 18, 2010, 12:17:18 am
OK, I've done it.
And now I need to know how to save all wxs files in a project.
I've written this:

Code
bool wxsProject::SaveResources()
{
    for (size_t ii = 0; ii < m_Resources.GetCount(); ++ii)
    {
        wxsResource* Resource = m_Resources[ii];
        Resource->
    }
    return false;
}

And I don't know what to type after "->". I've found that the wxs' data is stored in wxsItemResData objects, but I don't see a way to get to such an object for a given wxsResource object.
Does anyone know how could I do that?