[Lazarus] Enabling menu-options depending on a Lazarus-setting?

Martin Frb lazarus at mfriebe.de
Tue Sep 2 15:31:16 CEST 2014

On 02/09/2014 12:11, Joost van der Sluis wrote:
> Hi all,
> On Linux there's the option to view a window with the console-output 
> of applications being debugged.
> This option is enabled with the define DBG_ENABLE_TERMINAL in three 
> units.
> In debugger/debugger.pp the define is set for linux only, with the 
> result that the window is actually visible in the menu.
> In components/lazdebuggergdbmi/gdbmimiscclasses.pp and 
> components/lazdebuggergdbmi/gdbmimiscclasses.pp the define is also set 
> on linux, so that this debugger actually sends the console output to 
> the screen.
> Now I have my own debugger, and this debugger also supports the 
> console-window on OS/X. So I could adapt the define in debugger.pp for 
> OS/X, but then the menu-item also appears when a gdb-based debugger is 
> used, which do not support this option on OS/X.
> So, question: what would be the correct way to display this 
> menu-option, based onto the selected debugger. (Add a property to 
> TDebuggerIntf, but after that?)

Add a class[1] method to the debugger-class. return true/false, 
depending on the availability of the feature.

The base class, would have the current ifdef. All other code depends on 
the value of the method.

In ide/DebugManager the debugger class is selected and setup. That would 
be the place to update the menu (maybe enable/disable instead of hiding).

[1] If it is a class method debug manager may be able to decide on the 
class. If the code in debug manager allows to wait for the instance, 
then it can be a normal method.

More information about the Lazarus mailing list