Fix a (minor) issue in Kicad manager: when the schematic editor or the board editor are run from the project tree frame to edit files of the current project, editors are opened on the background.

This commit is contained in:
jean-pierre charras 2016-06-17 19:58:14 +02:00
parent 0862ac28d0
commit 7fd30e6dc0
3 changed files with 17 additions and 5 deletions

View File

@ -124,7 +124,10 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_enableZoomNoCenter = false; m_enableZoomNoCenter = false;
m_enableAutoPan = true; m_enableAutoPan = true;
m_ignoreMouseEvents = false; m_ignoreMouseEvents = false;
m_ignoreNextLeftButtonRelease = false; // Be sure a mouse release button event will be ignored when creating the canvas
// if the mouse click was not made inside the canvas (can happen sometimes, when
// launching an editor from a double click made in an other frame)
m_ignoreNextLeftButtonRelease = true;
m_mouseCaptureCallback = NULL; m_mouseCaptureCallback = NULL;
m_endMouseCaptureCallback = NULL; m_endMouseCaptureCallback = NULL;

View File

@ -185,7 +185,12 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
if( fullFileName == frame->SchFileName() ) if( fullFileName == frame->SchFileName() )
{ {
// the project's schematic is opened using the *.kiface as part of this process. // the project's schematic is opened using the *.kiface as part of this process.
frame->RunEeschema( fullFileName ); // We do not call frame->RunEeschema( fullFileName ),
// because after the double click, for some reason,
// the tree project frame is brought to the foreground after Eeschema is called from here.
// Instead, we post an event, equivalent to click on the eeschema tool in command frame
wxCommandEvent evt( wxEVT_COMMAND_TOOL_CLICKED, ID_TO_SCH );
wxPostEvent( frame, evt );
} }
else else
{ {
@ -199,7 +204,12 @@ void TREEPROJECT_ITEM::Activate( TREE_PROJECT_FRAME* prjframe )
if( fullFileName == frame->PcbFileName() || fullFileName == frame->PcbLegacyFileName() ) if( fullFileName == frame->PcbFileName() || fullFileName == frame->PcbLegacyFileName() )
{ {
// the project's BOARD is opened using the *.kiface as part of this process. // the project's BOARD is opened using the *.kiface as part of this process.
frame->RunPcbNew( fullFileName ); // We do not call frame->RunPcbNew( fullFileName ),
// because after the double click, for some reason,
// the tree project frame is brought to the foreground after PcbNew is called from here.
// Instead, we post an event, equivalent to simple click on the pcb editor tool in command frame
wxCommandEvent evt( wxEVT_COMMAND_TOOL_CLICKED, ID_TO_PCB );
wxPostEvent( frame, evt );
} }
else else
{ {

View File

@ -29,6 +29,7 @@
*/ */
#include <draw_frame.h>
#include <dialog_hotkeys_editor.h> #include <dialog_hotkeys_editor.h>
#include <gestfich.h> #include <gestfich.h>
#include <kiway.h> #include <kiway.h>
@ -330,9 +331,7 @@ void KICAD_MANAGER_FRAME::RunEeschema( const wxString& aProjectSchematicFileName
void KICAD_MANAGER_FRAME::OnRunEeschema( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnRunEeschema( wxCommandEvent& event )
{ {
wxFileName fn( GetProjectFileName() ); wxFileName fn( GetProjectFileName() );
fn.SetExt( SchematicFileExtension ); fn.SetExt( SchematicFileExtension );
RunEeschema( fn.GetFullPath() ); RunEeschema( fn.GetFullPath() );
} }