From 8e0489bc24d7ab5ac36c6b6ad31ca63a2f7c1056 Mon Sep 17 00:00:00 2001
From: Roberto Fernandez Bautista <roberto.fer.bau@gmail.com>
Date: Sat, 3 Feb 2024 16:53:06 +0100
Subject: [PATCH] pns_debug_tool: goto line windows + add visual studio (half
 working)

Visual studio (full) doesn't seem to like  going to the line, but at
least it opens the file in the same instance...
---
 qa/tools/pns/logviewer.fbp                 |  2 +-
 qa/tools/pns/pns_log_viewer_frame.cpp      | 17 ++++++++++++++---
 qa/tools/pns/pns_log_viewer_frame_base.cpp |  2 +-
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/qa/tools/pns/logviewer.fbp b/qa/tools/pns/logviewer.fbp
index 5d96248cc3..336189d660 100644
--- a/qa/tools/pns/logviewer.fbp
+++ b/qa/tools/pns/logviewer.fbp
@@ -973,7 +973,7 @@
                 <property name="caption"></property>
                 <property name="caption_visible">1</property>
                 <property name="center_pane">0</property>
-                <property name="choices">&quot;VS Code&quot; &quot;CLion&quot; &quot;Emacs&quot;</property>
+                <property name="choices">&quot;VS Code&quot; &quot;Visual Studio (full)&quot; &quot;CLion&quot; &quot;Emacs&quot;</property>
                 <property name="close_button">1</property>
                 <property name="context_help"></property>
                 <property name="context_menu">1</property>
diff --git a/qa/tools/pns/pns_log_viewer_frame.cpp b/qa/tools/pns/pns_log_viewer_frame.cpp
index 333b564031..58e5469cab 100644
--- a/qa/tools/pns/pns_log_viewer_frame.cpp
+++ b/qa/tools/pns/pns_log_viewer_frame.cpp
@@ -551,6 +551,16 @@ void PNS_LOG_VIEWER_FRAME::syncModel()
 }
 
 
+void runCommand( const wxString& aCommand )
+{
+#ifdef __WXMSW__
+    wxShell( aCommand ); // on windows we need to launch a shell in order to run the command
+#else
+    wxExecute( aCommand );
+#endif /* __WXMSW__ */
+}
+
+
 void PNS_LOG_VIEWER_FRAME::onListRightClick( wxMouseEvent& event )
 {
     auto sel = m_itemList->GetPopupMenuSelectionFromUser( *m_listPopupMenu );
@@ -618,9 +628,10 @@ void PNS_LOG_VIEWER_FRAME::onListRightClick( wxMouseEvent& event )
 
                 switch( m_ideChoice->GetCurrentSelection() )
                 {
-                    case 0: wxExecute( wxString::Format( "code --goto %s:%s", filepath, line ) ); return;
-                    case 1: wxExecute( wxString::Format( "clion --line %s %s", line, filepath ) ); return;
-                    case 2: wxExecute( wxString::Format( "emacsclient +%s %s", line, filepath ) ); return;
+                    case 0: runCommand( wxString::Format( "code --goto %s:%s", filepath, line ) ); return;
+                    case 1: runCommand( wxString::Format( "start devenv /edit %s /command \"Gotoln %s\"", filepath, line ) ); return; // fixme
+                    case 2: runCommand( wxString::Format( "clion --line %s %s", line, filepath ) ); return;
+                    case 3: runCommand( wxString::Format( "emacsclient +%s %s", line, filepath ) ); return;
                     default: return;
                 }
             }
diff --git a/qa/tools/pns/pns_log_viewer_frame_base.cpp b/qa/tools/pns/pns_log_viewer_frame_base.cpp
index 345776d6f5..236dd5eb7c 100644
--- a/qa/tools/pns/pns_log_viewer_frame_base.cpp
+++ b/qa/tools/pns/pns_log_viewer_frame_base.cpp
@@ -93,7 +93,7 @@ PNS_LOG_VIEWER_FRAME_BASE::PNS_LOG_VIEWER_FRAME_BASE( wxWindow* parent, wxWindow
 
 	fgSizer3->Add( m_ideLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
 
-	wxString m_ideChoiceChoices[] = { wxT("VS Code"), wxT("CLion"), wxT("Emacs") };
+	wxString m_ideChoiceChoices[] = { wxT("VS Code"), wxT("Visual Studio (full)"), wxT("CLion"), wxT("Emacs") };
 	int m_ideChoiceNChoices = sizeof( m_ideChoiceChoices ) / sizeof( wxString );
 	m_ideChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ideChoiceNChoices, m_ideChoiceChoices, 0 );
 	m_ideChoice->SetSelection( 0 );