PATCH: Show 'Debug' window on first 'Start Debugger' command

Discussion about CodeLite development process and patches
foxmuldr
CodeLite Expert
Posts: 120
Joined: Sun May 10, 2009 6:56 am
Contact:

PATCH: Show 'Debug' window on first 'Start Debugger' command

Post by foxmuldr »

This patch creates a new option under Settings -> Global Editor Preferences -> Misc, which specifies whether or not the debug window should be displayed on the first Start Debugger command.

This option saves and restores the settings for the dialog:

Code: Select all

Index: LiteEditor/editorsettingsmiscpanel.cpp
===================================================================
--- LiteEditor/editorsettingsmiscpanel.cpp	(revision 4394)
+++ LiteEditor/editorsettingsmiscpanel.cpp	(working copy)
@@ -76,6 +76,10 @@
 	EditorConfigST::Get()->GetLongValue(wxT("ShowFullPathInFrameTitle"), check);
 	m_fullFilePath->SetValue(check ? true : false);
 
+	check = 1;
+	EditorConfigST::Get()->GetLongValue(wxT("ShowDebugOnRun"), check);
+	m_showDebugOnRun->SetValue(check ? true : false);
+
 	bool showSplash = info.GetFlags() & CL_SHOW_SPLASH ? true : false;
 	m_showSplashScreen->SetValue(showSplash);
 
@@ -106,6 +110,7 @@
 	EditorConfigST::Get()->SaveLongValue(wxT("SingleInstance"), m_singleAppInstance->IsChecked() ? 1 : 0);
 	EditorConfigST::Get()->SaveLongValue(wxT("CheckNewVersion"), m_versionCheckOnStartup->IsChecked() ? 1 : 0);
 	EditorConfigST::Get()->SaveLongValue(wxT("ShowFullPathInFrameTitle"), m_fullFilePath->IsChecked() ? 1 : 0);
+	EditorConfigST::Get()->SaveLongValue(wxT("ShowDebugOnRun"), m_showDebugOnRun->IsChecked() ? 1 : 0);
 
 	bool oldUseSingleToolbar = !PluginManager::Get()->AllowToolbar();
 	EditorConfigST::Get()->SaveLongValue(wxT("UseSingleToolbar"), m_useSingleToolbar->IsChecked() ? 1 : 0);
This will only show the Debug window if the user has the option checked, or if it has never been set, it will default to the old behavior:

Code: Select all

Index: LiteEditor/manager.cpp
===================================================================
--- LiteEditor/manager.cpp	(revision 4394)
+++ LiteEditor/manager.cpp	(working copy)
@@ -2109,7 +2109,10 @@
 	DebugMessage ( _ ( "Debug session started successfully!\n" ) );
 
 	// set the debug tab as active
-	ShowOutputPane(OutputPane::OUTPUT_DEBUG);
+	long check(1);
+	EditorConfigST::Get()->GetLongValue(wxT("ShowDebugOnRun"), check);
+	if (check)
+		ShowOutputPane(OutputPane::OUTPUT_DEBUG);
 
 	if ( dbgr->GetIsRemoteDebugging() ) {
 
The attached file is the wxFormBuilder file as it was changed. This forum would not allow an upload of .fbp file extension, so the .txt file needs to be renamed .fbp.

I have added the dialog option to a Misc option under Settings -> Global Editor blah blah. Please feel free to move this to whatever location is appropriate. For me, and since this is my first attempt, I put it somewhere easy to access and code ;) , and am willing to move it if you suggest a place.

Please advise any problems / notes on code or style. Thanks, Eran!
editor_options_misc.txt
You do not have the required permissions to view the files attached to this post.
Best regards,
Rick C. Hodgin
www.Visual-FreePro.org
www.LibSF.org
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: PATCH: Show 'Debug' window on first 'Start Debugger' command

Post by eranif »

The patch looks fine, with my comment:
It should be under 'Settings -> Global Editor Preferences -> Docking Windows'
(this place also contains the options to hide output pane when user clicks inside the editor etc)

Can you please upload a revised version with the option set in the suggested place?

Eran
Make sure you have read the HOW TO POST thread
foxmuldr
CodeLite Expert
Posts: 120
Joined: Sun May 10, 2009 6:56 am
Contact:

Re: PATCH: Show 'Debug' window on first 'Start Debugger' command

Post by foxmuldr »

eranif wrote:The patch looks fine, with my comment:
It should be under 'Settings -> Global Editor Preferences -> Docking Windows'
Here's the revised patch. This code should be working, but I cannot get it to work in my version. The checkbox setting in the docking window is not persistent across loads. And the manager.cpp code doesn't seem to see the m_showDebugOnRun value returned by the GetShowDebugOnRun() accessor when I've tried setting it on/off during successive debug runs.

What am I doing wrong? Is there a de/serializer that needs updated somewhere?

Code: Select all

Index: Plugin/optionsconfig.h
===================================================================
--- Plugin/optionsconfig.h    (revision 4394)
+++ Plugin/optionsconfig.h    (working copy)
@@ -76,6 +76,7 @@
     bool           m_disableSemicolonShift;
     int            m_caretLineAlpha;
     bool           m_outputPaneDockable;
+    bool           m_showDebugOnRun;
     bool           m_caretUseCamelCase;
 
 public:
@@ -99,6 +100,12 @@
     bool GetOutputPaneDockable() const {
         return m_outputPaneDockable;
     }
+    void SetShowDebugOnRun(bool showDebugOnRun) {
+        this->m_showDebugOnRun = showDebugOnRun;
+    }
+    bool GetShowDebugOnRun() const {
+        return m_showDebugOnRun;
+    }
     bool GetDisableSemicolonShift() const {
         return m_disableSemicolonShift;
     }

Code: Select all

Index: LiteEditor/editorsettingsdockingwidows.cpp
===================================================================
--- LiteEditor/editorsettingsdockingwidows.cpp    (revision 4394)
+++ LiteEditor/editorsettingsdockingwidows.cpp    (working copy)
@@ -8,6 +8,7 @@
     m_checkBoxHideOutputPaneNotIfDebug->SetValue(EditorConfigST::Get()->GetOptions()->GetHideOutputPaneNotIfDebug());
     m_checkBoxFindBarAtBottom->SetValue(EditorConfigST::Get()->GetOptions()->GetFindBarAtBottom());
     m_checkBoxOutputPaneCanDock->SetValue(EditorConfigST::Get()->GetOptions()->GetOutputPaneDockable());
+    m_checkBoxShowDebugOnRun->SetValue(EditorConfigST::Get()->GetOptions()->GetShowDebugOnRun());
     m_checkBoxHideOutputPaneNotIfDebug->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( EditorSettingsDockingWindows::OnHideOutputPaneNotIfDebugUI ), NULL, this );
 }
 
@@ -16,7 +17,8 @@
     options->SetHideOutpuPaneOnUserClick( m_checkBoxHideOutputPaneOnClick->IsChecked() );
     options->SetHideOutputPaneNotIfDebug( m_checkBoxHideOutputPaneNotIfDebug->IsChecked() );
     options->SetFindBarAtBottom( m_checkBoxFindBarAtBottom->IsChecked() );
-    options->SetOutputPaneDockable( m_checkBoxOutputPaneCanDock->IsChecked());
+    options->SetOutputPaneDockable( m_checkBoxOutputPaneCanDock->IsChecked() );
+    options->SetShowDebugOnRun( m_checkBoxShowDebugOnRun->IsChecked() );
 }
 
 void EditorSettingsDockingWindows::OnHideOutputPaneNotIfDebugUI(wxUpdateUIEvent& event)

Code: Select all

Index: LiteEditor/manager.cpp
===================================================================
--- LiteEditor/manager.cpp    (revision 4394)
+++ LiteEditor/manager.cpp    (working copy)
@@ -2109,7 +2109,8 @@
     DebugMessage ( _ ( "Debug session started successfully!\n" ) );
 
     // set the debug tab as active
-    ShowOutputPane(OutputPane::OUTPUT_DEBUG);
+    if (EditorConfigST::Get()->GetOptions()->GetShowDebugOnRun())
+        ShowOutputPane(OutputPane::OUTPUT_DEBUG);
 
     if ( dbgr->GetIsRemoteDebugging() ) {
 
The attached .txt file needs renamed to .fbp. That should be it. I don't know why it's not working on my version. Let me know. Thanks, Eran! :)
editor_options_docking_windows.txt
You do not have the required permissions to view the files attached to this post.
Best regards,
Rick C. Hodgin
www.Visual-FreePro.org
www.LibSF.org
foxmuldr
CodeLite Expert
Posts: 120
Joined: Sun May 10, 2009 6:56 am
Contact:

Re: PATCH: Show 'Debug' window on first 'Start Debugger' command

Post by foxmuldr »

Okay, I found it. The serializing code was in the .cpp. Here's the last patch:

Code: Select all

Index: Plugin/optionsconfig.cpp
===================================================================
--- Plugin/optionsconfig.cpp    (revision 4394)
+++ Plugin/optionsconfig.cpp    (working copy)
@@ -74,6 +74,7 @@
         , m_disableSemicolonShift(false)
         , m_caretLineAlpha(50)
         , m_outputPaneDockable(false)
+        , m_showDebugOnRun(false)
         , m_caretUseCamelCase(false)
 {
     //set the default font name to be wxFONTENCODING_UTF8
@@ -119,6 +120,7 @@
         m_disableSemicolonShift     = XmlUtils::ReadBool  (node, wxT("DisableSemicolonShift"),     m_disableSemicolonShift);
         m_caretLineAlpha            = XmlUtils::ReadLong  (node, wxT("CaretLineAlpha"),            m_caretLineAlpha);
         m_outputPaneDockable        = XmlUtils::ReadBool  (node, wxT("OutputPaneDockable"),        m_outputPaneDockable);
+        m_showDebugOnRun            = XmlUtils::ReadBool  (node, wxT("ShowDebugOnRun"),            m_showDebugOnRun);
         m_caretUseCamelCase         = XmlUtils::ReadBool  (node, wxT("m_caretUseCamelCase"),       m_caretUseCamelCase);
 
         // These hacks will likely be changed in the future. If so, we'll be able to remove the #include "editor_config.h" too
@@ -163,6 +165,7 @@
     n->AddProperty(wxT("DisableSmartIndent"),        BoolToString(m_disableSmartIndent));
     n->AddProperty(wxT("DisableSemicolonShift"),     BoolToString(m_disableSemicolonShift));
     n->AddProperty(wxT("OutputPaneDockable"),        BoolToString(m_outputPaneDockable));
+    n->AddProperty(wxT("ShowDebugOnRun"),            BoolToString(m_showDebugOnRun));
     n->AddProperty(wxT("ConsoleCommand"),            m_programConsoleCommand);
     n->AddProperty(wxT("EOLMode"),                   m_eolMode);
     n->AddProperty(wxT("m_caretUseCamelCase"),       BoolToString(m_caretUseCamelCase));
Thanks, Eran!
Best regards,
Rick C. Hodgin
www.Visual-FreePro.org
www.LibSF.org
foxmuldr
CodeLite Expert
Posts: 120
Joined: Sun May 10, 2009 6:56 am
Contact:

Re: PATCH: Show 'Debug' window on first 'Start Debugger' command

Post by foxmuldr »

Eran,

The patch I've put above works if you go in to the editor and manually change the values on the Docking Windows form. However, if you do not go into that window it does not. EditorConfigST is a singleton, so I'm not understanding why this is not automatically retrieving those values from the XML file. The read command in manager.cpp should read the correct value, as loaded from the XML at startup, but it does not seem to be doing so.

Why is this? Can you help me?

- Rick
Best regards,
Rick C. Hodgin
www.Visual-FreePro.org
www.LibSF.org
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: PATCH: Show 'Debug' window on first 'Start Debugger' command

Post by eranif »

Hi,
In order to be able to test it, i need the patch as a single file. Can you please attach the patch to this post *not inline* but rather and as a single file?

I can not apply it on my local copy the way you are uploading it (I keep getting rejects).
You need to create a single file containing all the changes and attach it.

By pasting the patch content, EOL are getting lost, whitespace at each line are setting lost.

To create a single file:
select all the modified files in the 'Subversion View' and then right click it 'Create Diff...' accepts the defaults and attach the diff you got.

Eran
Make sure you have read the HOW TO POST thread
foxmuldr
CodeLite Expert
Posts: 120
Joined: Sun May 10, 2009 6:56 am
Contact:

Re: PATCH: Show 'Debug' window on first 'Start Debugger' command

Post by foxmuldr »

eranif wrote:In order to be able to test it, i need the patch as a single file...
See attached.

Note: I also figured out why the code I wrote wasn't working like I expected. It's because I had to do "sudo make install" each time to test my changes, and it was overwriting my previous settings. This version works correctly.

- Rick
You do not have the required permissions to view the files attached to this post.
Best regards,
Rick C. Hodgin
www.Visual-FreePro.org
www.LibSF.org
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: PATCH: Show 'Debug' window on first 'Start Debugger' command

Post by eranif »

Patch tested and applied.

Thanks,
Eran
Make sure you have read the HOW TO POST thread
foxmuldr
CodeLite Expert
Posts: 120
Joined: Sun May 10, 2009 6:56 am
Contact:

Re: PATCH: Show 'Debug' window on first 'Start Debugger' command

Post by foxmuldr »

eranif wrote:Patch tested and applied.
Thanks,
Eran
No problem. I'll be submitting more now that I'm getting a feel for your application design.

Also, as a side note, my name is "Hodgin" with no "s" on the end. It's the most common mistake made with my name, and pretty much everybody makes it, calling me "Rick Hodgins," as though there are multiple of me. LOL! Though some also use the name "Hodgkin" as was made "famous" from "Hodgkin's Disease". It's also interesting that it's pronounced "hodge-in," like "lodge in". We could always tell the telemarketers when they used to call on the phone. They'd say "Is Mr. Hod Gin there," with a hard "g", like "guild". Always funny. We'd say, "Nope. No one here by that name." :-)

- Rick
Best regards,
Rick C. Hodgin
www.Visual-FreePro.org
www.LibSF.org
Post Reply