Code::Blocks

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: mandrav on January 11, 2006, 02:06:12 pm

Title: Auto-layout switching for debugger
Post by: mandrav on January 11, 2006, 02:06:12 pm
I implemented what the title says.
It's cool to see it in action but an initial manual configuration must be done by the user.
So here I will describe the two steps you have to take to make it work.

What has been added, is two text boxes in "Settings->Debugger" where you can type the names of two layouts:
1) The layout to switch to when the debugging session starts
2) The layout to switch to when the debugging session ends

If one of these is empty (the default), no layout switching takes place in the respective session point (start/end).
So, how do we glue these together? Fear not. It only takes two steps :)


Now start a debugging session and enjoy :)
Title: Re: Auto-layout switching for debugger
Post by: Michael on January 11, 2006, 04:52:09 pm
I implemented what the title says.
It's cool to see it in action but an initial manual configuration must be done by the user.
So here I will describe the two steps you have to take to make it work.

What has been added, is two text boxes in "Settings->Debugger" where you can type the names of two layouts:
1) The layout to switch to when the debugging session starts
2) The layout to switch to when the debugging session ends

If one of these is empty (the default), no layout switching takes place in the respective session point (start/end).
So, how do we glue these together? Fear not. It only takes two steps :)

  • If you haven't done so already, create a layout for debugging. I.e. open the watches window, put it where you want, open the callstack, put it where you want, etc. You get the point. Open any windows you like and arrange them as you like. When you 're happy, click "View->Layouts->Save current". Name it as you like (I suggest "Debugging" :P).
  • Go to "Settings->Debugger". Type in the first layout box (debugging start) the name of the layout you saved, e.g. "Debugging" (no quotes). Then type in the second layout box (debugging end) "Code::Blocks default" (or any other you might have created).

Now start a debugging session and enjoy :)

This is a useful addition IMHO :D. It is "similar" as in Visual Studio .NET (and I think, but not sure, Eclipse), when you start a debug session, correct?

Michael
Title: Re: Auto-layout switching for debugger
Post by: 280Z28 on January 11, 2006, 04:57:35 pm
Can you make it:

When the debugger starts, the current layout is stored (anonymous, direct call to wxFrameManager to get the layout).

When the debugger stops, the current layout is stored in the layout file or wherever C::B stores layout info, in a branch just for the debugger. Then the layout that it remembered from the debugger starting is restored.

?
Title: Re: Auto-layout switching for debugger
Post by: thomas on January 11, 2006, 05:05:46 pm
Can you make it:
Why? The event based approach is a lot better, as it is truly universal.
Title: Re: Auto-layout switching for debugger
Post by: 280Z28 on January 11, 2006, 05:21:50 pm
Can you make it:
Why? The event based approach is a lot better, as it is truly universal.

Huh? We must not be talking about the same thing.  :?
Title: Re: Auto-layout switching for debugger
Post by: Ceniza on January 11, 2006, 08:08:27 pm
Could those textctrl to write the layout name be changed to a combobox where you can select one of the current layouts + an empty one that would mean 'no change'?
Title: Re: Auto-layout switching for debugger
Post by: mandrav on January 12, 2006, 09:46:07 am
Could those textctrl to write the layout name be changed to a combobox where you can select one of the current layouts + an empty one that would mean 'no change'?

See below...

Can you make it:
Why? The event based approach is a lot better, as it is truly universal.

Huh? We must not be talking about the same thing.  :?

Thomas knows what he 's talking about. The layout switch (from the debugger) is done by sending an event to the app.
What you (and Ceniza) probably missed is that the docking system is not part of the SDK. It is part of the main app. The SDK and plugins know absolutely nothing about wxAUI/wxDockit/wxIFM/whatever-docking-system-is-in-use. And that's A Good ThingTM. It allows us to easily switch docking systems by just updating the app.
The SDK and plugins only know that they can send the app some docking-related events. What the app does with them, is none of their business.

In other words: the SDK and plugins are not bound with the app. The app is bound to them...

And because events are of the fire-and-forget kind (i.e. we can't get return values from them), Ceniza you got your answer about retrieving a list of layouts...
Title: Re: Auto-layout switching for debugger
Post by: yop on January 12, 2006, 10:02:21 am
In other words: the SDK and plugins are not bound with the app. The app is bound to them...
That is after all what a sdk is all about
Title: Re: Auto-layout switching for debugger
Post by: Chriss on January 12, 2006, 04:14:25 pm
maybe it could be possible to make a standard debug layout, for those who don't want to create a new layout. It would be more user-friendly
Title: Re: Auto-layout switching for debugger
Post by: 280Z28 on January 12, 2006, 04:35:54 pm
Could those textctrl to write the layout name be changed to a combobox where you can select one of the current layouts + an empty one that would mean 'no change'?

See below...

Can you make it:
Why? The event based approach is a lot better, as it is truly universal.

Huh? We must not be talking about the same thing.  :?

Thomas knows what he 's talking about. The layout switch (from the debugger) is done by sending an event to the app.
What you (and Ceniza) probably missed is that the docking system is not part of the SDK. It is part of the main app. The SDK and plugins know absolutely nothing about wxAUI/wxDockit/wxIFM/whatever-docking-system-is-in-use. And that's A Good ThingTM. It allows us to easily switch docking systems by just updating the app.
The SDK and plugins only know that they can send the app some docking-related events. What the app does with them, is none of their business.

In other words: the SDK and plugins are not bound with the app. The app is bound to them...

And because events are of the fire-and-forget kind (i.e. we can't get return values from them), Ceniza you got your answer about retrieving a list of layouts...

An SDK based approach might work like this:

1) When the plugin starts, it says "store the current view (whatever it may be for [insert name] library in use) temporarily (not to disk as a user layout) as 'debugger_temp_layout'" or any unique name that the debugger has come up with.
2) When the plugin is about to end, it says "store the current view permanently (in some irrelevant manner so long as it has access to it by name the next time the program runs) with the name 'debugger_layout'" then "restore the temporary view named 'debugger_temp_layout'"

The plugin only cares that a current "view" (abstract sdk concept that can be linked to whatever internal implementation is used by the app) can be referenced by name, and stored at least permanently with the possible option of temporarily. If the layout engine changes and a view from the old implementation is requested, just return "View not found" and the plugin should be happy.

This is both event based and covers my request. :)
Title: Re: Auto-layout switching for debugger
Post by: mandrav on January 12, 2006, 05:44:40 pm
I never said there is no room for improvement. I just explained the situation because you seemed not grasping it firmly ;)
Title: Re: Auto-layout switching for debugger
Post by: 280Z28 on January 12, 2006, 05:47:18 pm
I would never ever say there is no room for improvement. I just explained the situation because you seemed not grasping it firmly ;)

Fixed your quote. :D I had no doubt, just trying to follow the explanation with a possible suggestion that's more in line with what you've said so far.
Title: Re: Auto-layout switching for debugger
Post by: Michael on January 12, 2006, 07:41:20 pm
Hello,

I have a small question concerning layouts.

It is possible to re-use layout from one revision to another?

I have just finished a debugging layout for rev1707, when discovering that no layout boxes where present in the Settings-->Debugger. So, I wanted to imported the newly created layout into rev1728, but I could not find it.

Thank you very much.

Best wishes,
Michael