Commit a985255f authored by Dick Hollenbeck's avatar Dick Hollenbeck

add back missing pcbnew cross probing event handlers. eeschema launches...

add back missing pcbnew cross probing event handlers.  eeschema launches kiface versions of pcbnew & cvpcb if not single.
parent f9f3ff22
......@@ -47,8 +47,8 @@ KIWAY::KIWAY( PGM_BASE* aProgram, wxFrame* aTop ):
// Any event types derived from wxCommandEvt, like wxWindowDestroyEvent, are
// propogated upwards to parent windows if not handled below. Therefor the
// m_top window should receive all wxWindowDestroyEvents from originating
// from KIWAY_PLAYERs. It does anyways, but now playerDestroyHandler eavesdrops
// m_top window should receive all wxWindowDestroyEvents originating from
// KIWAY_PLAYERs. It does anyways, but now playerDestroyHandler eavesdrops
// on that event stream looking for KIWAY_PLAYERs being closed.
void KIWAY::playerDestroyHandler( wxWindowDestroyEvent& event )
......@@ -57,7 +57,7 @@ void KIWAY::playerDestroyHandler( wxWindowDestroyEvent& event )
for( unsigned i=0; i<DIM(m_player); ++i )
{
// if destroying one of our flock, then mark it as diseased.
// if destroying one of our flock, then mark it as deceased.
if( (wxWindow*) m_player[i] == w )
{
// DBG(printf( "%s: marking m_player[%d] as destroyed\n", __func__, i );)
......@@ -219,7 +219,7 @@ KIWAY::FACE_T KIWAY::KifaceType( FRAME_T aFrameType )
}
KIWAY_PLAYER* KIWAY::PlayerCreate( FRAME_T aFrameType )
KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate )
{
// Since this will be called from python, cannot assume that code will
// not pass a bad aFrameType.
......@@ -236,6 +236,8 @@ KIWAY_PLAYER* KIWAY::PlayerCreate( FRAME_T aFrameType )
if( m_player[aFrameType] )
return m_player[aFrameType];
if( doCreate )
{
FACE_T face_type = KifaceType( aFrameType );
wxASSERT( face_type != FACE_T(-1) );
......@@ -245,6 +247,9 @@ KIWAY_PLAYER* KIWAY::PlayerCreate( FRAME_T aFrameType )
KIWAY_PLAYER* frame = (KIWAY_PLAYER*) kiface->CreateWindow( m_top, aFrameType, this, KFCTL_PROJECT_SUITE );
return m_player[aFrameType] = frame;
}
return NULL;
}
......
......@@ -78,7 +78,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
return NULL;
}
/* Cross probing to Pcbnew if a pin or a component is found */
// Cross probing to Pcbnew if a pin or a component is found
switch( item->Type() )
{
case SCH_FIELD_T:
......@@ -105,6 +105,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
{
// Force display pin information (the previous display could be a component info)
MSG_PANEL_ITEMS items;
Pin->GetMsgPanelInfo( items );
if( LibItem )
......
......@@ -29,6 +29,7 @@
#include <fctsys.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <macros.h>
#include <eda_dde.h>
#include <wxEeschemaStruct.h>
......@@ -107,56 +108,74 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
}
void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT* LibItem )
std::string FormatProbeItem( EDA_ITEM* aComponent, SCH_COMPONENT* aPart )
{
if( objectToSync == NULL )
return;
LIB_PIN* Pin = NULL;
char Line[1024];
/* Cross probing to Pcbnew if a pin or a component is found */
switch( objectToSync->Type() )
// Cross probing to Pcbnew if a pin or a component is found
switch( aComponent->Type() )
{
case SCH_FIELD_T:
case LIB_FIELD_T:
{
if( !LibItem )
if( !aPart )
break;
sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
SendCommand( MSG_TO_PCB, Line );
return StrPrintf( "$PART: %s", TO_UTF8( aPart->GetField( REFERENCE )->GetText() ) );
}
break;
case SCH_COMPONENT_T:
LibItem = (SCH_COMPONENT*) objectToSync;
sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
SendCommand( MSG_TO_PCB, Line );
break;
aPart = (SCH_COMPONENT*) aComponent;
return StrPrintf( "$PART: %s", TO_UTF8( aPart->GetField( REFERENCE )->GetText() ) );
case LIB_PIN_T:
if( !LibItem )
{
if( !aPart )
break;
Pin = (LIB_PIN*) objectToSync;
LIB_PIN* pin = (LIB_PIN*) aComponent;
if( Pin->GetNumber() )
if( pin->GetNumber() )
{
wxString pinnum;
Pin->PinStringNum( pinnum );
sprintf( Line, "$PIN: %s $PART: %s", TO_UTF8( pinnum ),
TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
pin->PinStringNum( pinnum );
return StrPrintf( "$PIN: %s $PART: %s", TO_UTF8( pinnum ),
TO_UTF8( aPart->GetField( REFERENCE )->GetText() ) );
}
else
{
sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
return StrPrintf( "$PART: %s", TO_UTF8( aPart->GetField( REFERENCE )->GetText() ) );
}
}
SendCommand( MSG_TO_PCB, Line );
break;
default:
break;
}
return "";
}
void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* aComponent, SCH_COMPONENT* aPart )
{
#if 1
wxASSERT( aComponent ); // fix the caller
#else // WTF?
if( objectToSync == NULL ) // caller remains eternally stupid.
return;
#endif
std::string packet = FormatProbeItem( aComponent, aPart );
if( packet.size() )
{
if( Kiface().IsSingle() )
SendCommand( MSG_TO_PCB, packet.c_str() );
else
{
}
}
}
......@@ -64,20 +64,22 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Menu File:
wxMenu* fileMenu = new wxMenu;
// New
if( Kiface().IsSingle() ) // not when under a project mgr
{
AddMenuItem( fileMenu,
ID_NEW_PROJECT,
_( "&New Schematic Project" ),
_( "Clear current schematic hierarchy and start a new schematic root sheet" ),
KiBitmap( new_xpm ) );
// Open
text = AddHotkeyName( _( "&Open Schematic Project" ), s_Schematic_Hokeys_Descr, HK_LOAD_SCH );
AddMenuItem( fileMenu,
ID_LOAD_PROJECT, text,
_( "Open an existing schematic hierarchy" ),
KiBitmap( open_document_xpm ) );
}
// @todo: static probably not OK in multiple open projects.
// Open Recent submenu
static wxMenu* openRecentMenu;
......@@ -91,21 +93,21 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
Kiface().GetFileHistory().UseMenu( openRecentMenu );
Kiface().GetFileHistory().AddFilesToMenu( openRecentMenu );
if( Kiface().IsSingle() ) // not when under a project mgr
{
AddMenuItem( fileMenu, openRecentMenu,
wxID_ANY, _( "Open &Recent" ),
_( "Open a recent opened schematic project" ),
KiBitmap( open_project_xpm ) );
}
// Import
AddMenuItem( fileMenu,
ID_APPEND_PROJECT, _( "&Append Schematic Sheet" ),
_( "Append schematic sheet to current project" ),
KiBitmap( open_document_xpm ) );
// Separator
fileMenu->AppendSeparator();
// Save schematic project
text = AddHotkeyName( _( "&Save Schematic Project" ),
s_Schematic_Hokeys_Descr, HK_SAVE_SCH );
AddMenuItem( fileMenu,
......@@ -113,31 +115,29 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
_( "Save all sheets in schematic project" ),
KiBitmap( save_project_xpm ) );
// Save current sheet
AddMenuItem( fileMenu,
ID_UPDATE_ONE_SHEET,
_( "Save &Current Sheet Only" ),
_( "Save only current schematic sheet" ),
KiBitmap( save_xpm ) );
// Save current sheet as
if( Kiface().IsSingle() ) // not when under a project mgr
{
AddMenuItem( fileMenu,
ID_SAVE_ONE_SHEET_UNDER_NEW_NAME,
_( "Save Current Sheet &As" ),
_( "Save current schematic sheet as..." ),
KiBitmap( save_as_xpm ) );
}
// Separator
fileMenu->AppendSeparator();
// Page settings
AddMenuItem( fileMenu,
ID_SHEET_SET,
_( "Pa&ge Settings" ),
_( "Setting for sheet size and frame references" ),
KiBitmap( sheetset_xpm ) );
// Print
AddMenuItem( fileMenu,
wxID_PRINT,
_( "Pri&nt" ),
......@@ -155,7 +155,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Plot to Clipboard (Windows only)
AddMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD,
_( "Plot to &Clipboard" ),
_( "Export drawings to clipboard" ),
......@@ -243,32 +242,26 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
* using in AddHotkeyName call the option "false" (not a shortcut)
*/
// Zoom in
text = AddHotkeyName( _( "Zoom &In" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_IN, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) );
// Zoom out
text = AddHotkeyName( _( "Zoom &Out" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_OUT, IS_ACCELERATOR ); // add accelerator, not a shortcut
AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) );
// Fit on screen
text = AddHotkeyName( _( "&Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO );
AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, KiBitmap( zoom_fit_in_page_xpm ) );
// Separator
viewMenu->AppendSeparator();
// Hierarchy
AddMenuItem( viewMenu,
ID_HIERARCHY,
_( "Show &Hierarchical Navigator" ),
_( "Navigate hierarchical sheets" ),
KiBitmap( hierarchy_nav_xpm ) );
// Redraw
text = AddHotkeyName( _( "&Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW );
AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) );
......@@ -276,78 +269,66 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// @todo unify IDs
wxMenu* placeMenu = new wxMenu;
// Component
text = AddHotkeyName( _( "&Component" ), s_Schematic_Hokeys_Descr,
HK_ADD_NEW_COMPONENT, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text,
HELP_PLACE_COMPONENTS,
KiBitmap( add_component_xpm ) );
// Power port
text = AddHotkeyName( _( "&Power Port" ), s_Schematic_Hokeys_Descr,
HK_ADD_NEW_POWER, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text,
HELP_PLACE_POWERPORT,
KiBitmap( add_power_xpm ) );
// Wire
text = AddHotkeyName( _( "&Wire" ), s_Schematic_Hokeys_Descr,
HK_BEGIN_WIRE, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_WIRE_BUTT, text,
HELP_PLACE_WIRE,
KiBitmap( add_line_xpm ) );
// Bus
text = AddHotkeyName( _( "&Bus" ), s_Schematic_Hokeys_Descr,
HK_BEGIN_BUS, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_BUS_BUTT, text,
HELP_PLACE_BUS,
KiBitmap( add_bus_xpm ) );
// Wire to Bus entry
text = AddHotkeyName( _( "Wire to Bus &Entry" ), s_Schematic_Hokeys_Descr,
HK_ADD_WIRE_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text,
HELP_PLACE_WIRE2BUS_ENTRY,
KiBitmap( add_line2bus_xpm ) );
// Bus to Bus entry
text = AddHotkeyName( _( "Bus &to Bus Entry" ), s_Schematic_Hokeys_Descr,
HK_ADD_BUS_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text,
HELP_PLACE_BUS2BUS_ENTRY,
KiBitmap( add_bus2bus_xpm ) );
// No Connect Flag
text = AddHotkeyName( _( "&No Connect Flag" ), s_Schematic_Hokeys_Descr,
HK_ADD_NOCONN_FLAG, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, KiBitmap( noconn_xpm ) );
// Net name
text = AddHotkeyName( _( "&Label" ), s_Schematic_Hokeys_Descr,
HK_ADD_LABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_LABEL_BUTT, text,
HELP_PLACE_NETLABEL,
KiBitmap( add_line_label_xpm ) );
// Global label
text = AddHotkeyName( _( "Gl&obal Label" ), s_Schematic_Hokeys_Descr,
HK_ADD_GLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_GLABEL_BUTT, text,
HELP_PLACE_GLOBALLABEL,
KiBitmap( add_glabel_xpm ) );
// Junction
text = AddHotkeyName( _( "&Junction" ), s_Schematic_Hokeys_Descr,
HK_ADD_JUNCTION, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_JUNCTION_BUTT, text,
HELP_PLACE_JUNCTION,
KiBitmap( add_junction_xpm ) );
// Separator
placeMenu->AppendSeparator();
// Hierarchical label
text = AddHotkeyName( _( "&Hierarchical Label" ), s_Schematic_Hokeys_Descr,
HK_ADD_HLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_HIERLABEL_BUTT,
......@@ -355,38 +336,32 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( add_hierarchical_label_xpm ) );
// Hierarchical sheet
text = AddHotkeyName( _( "H&ierarchical &Sheet" ), s_Schematic_Hokeys_Descr,
HK_ADD_HIER_SHEET, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text,
HELP_PLACE_SHEET,
KiBitmap( add_hierarchical_subsheet_xpm ) );
// Import hierarchical sheet
AddMenuItem( placeMenu,
ID_IMPORT_HLABEL_BUTT,
_( "I&mport Hierarchical Label" ),
HELP_IMPORT_SHEETPIN,
KiBitmap( import_hierarchical_label_xpm ) );
// Add hierarchical Pin to Sheet
AddMenuItem( placeMenu,
ID_SHEET_PIN_BUTT,
_( "Hierarchical Pi&n to Sheet" ),
HELP_PLACE_SHEETPIN,
KiBitmap( add_hierar_pin_xpm ) );
// Separator
placeMenu->AppendSeparator();
// Graphic line or polygon
text = AddHotkeyName( _( "Graphic Polyline" ), s_Schematic_Hokeys_Descr,
HK_ADD_GRAPHIC_POLYLINE, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text,
HELP_PLACE_GRAPHICLINES,
KiBitmap( add_dashed_line_xpm ) );
// Graphic text
text = AddHotkeyName( _( "Graphic Text" ), s_Schematic_Hokeys_Descr,
HK_ADD_GRAPHIC_TEXT, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text,
......@@ -437,14 +412,12 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Separator
preferencesMenu->AppendSeparator();
// Save preferences
AddMenuItem( preferencesMenu,
ID_CONFIG_SAVE,
_( "&Save Preferences" ),
_( "Save application preferences" ),
KiBitmap( save_setup_xpm ) );
// Read preferences
AddMenuItem( preferencesMenu,
ID_CONFIG_READ,
_( "&Read Preferences" ),
......@@ -454,22 +427,18 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Menu Tools:
wxMenu* toolsMenu = new wxMenu;
// Library editor
AddMenuItem( toolsMenu,
ID_TO_LIBRARY,
_( "Library &Editor" ), HELP_RUN_LIB_EDITOR,
KiBitmap( libedit_xpm ) );
// Library viewer
AddMenuItem( toolsMenu,
ID_TO_LIBVIEW,
_( "Library &Browser" ), HELP_RUN_LIB_VIEWER,
KiBitmap( library_browse_xpm ) );
// Separator
toolsMenu->AppendSeparator();
// Annotate
AddMenuItem( toolsMenu,
ID_GET_ANNOTATE,
_( "&Annotate Schematic" ), HELP_ANNOTATE,
......@@ -482,24 +451,21 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
_( "Perform electrical rule check" ),
KiBitmap( erc_xpm ) );
// Generate netlist
AddMenuItem( toolsMenu,
ID_GET_NETLIST,
_( "Generate &Netlist File" ),
_( "Generate the component netlist file" ),
KiBitmap( netlist_xpm ) );
// Generate bill of materials
AddMenuItem( toolsMenu,
ID_GET_TOOLS,
_( "Generate Bill of &Materials" ),
HELP_GENERATE_BOM,
KiBitmap( bom_xpm ) );
// Separator
toolsMenu->AppendSeparator();
//Run CvPcb
// Run CvPcb
AddMenuItem( toolsMenu,
ID_TO_CVPCB,
_( "A&ssign Component Footprint" ),
......@@ -519,7 +485,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Version info
AddHelpVersionInfoMenuEntry( helpMenu );
// Contents
AddMenuItem( helpMenu,
wxID_HELP,
_( "Eesc&hema Manual" ),
......@@ -532,7 +497,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
_( "Open \"Getting Started in KiCad\" guide for beginners" ),
KiBitmap( help_xpm ) );
// About Eeschema
helpMenu->AppendSeparator();
AddMenuItem( helpMenu,
wxID_ABOUT,
......
......@@ -764,11 +764,25 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
{
fn.SetExt( PcbFileExtension );
if( Kiface().IsSingle() )
{
wxString filename = QuoteFullPath( fn );
ExecuteFile( this, PCBNEW_EXE, filename );
}
else
{
KIWAY_PLAYER* player = Kiway().Player( FRAME_PCB, false ); // test open already.
if( !player )
{
player = Kiway().Player( FRAME_PCB, true );
player->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
player->Show( true );
}
player->Raise();
}
}
else
{
ExecuteFile( this, PCBNEW_EXE );
}
......@@ -782,10 +796,25 @@ void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
fn.SetExt( NetlistFileExtension );
if( fn.IsOk() && fn.FileExists() )
{
if( Kiface().IsSingle() )
{
ExecuteFile( this, CVPCB_EXE, QuoteFullPath( fn ) );
}
else
{
KIWAY_PLAYER* player = Kiway().Player( FRAME_CVPCB, false ); // test open already.
if( !player )
{
player = Kiway().Player( FRAME_CVPCB, true );
player->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
player->Show( true );
}
player->Raise();
}
}
else
{
ExecuteFile( this, CVPCB_EXE );
}
......@@ -802,13 +831,15 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
if( (item == NULL) || (item->GetFlags() != 0) || ( item->Type() != SCH_COMPONENT_T ) )
{
wxMessageBox( _("Error: not a component or no component" ) );
wxMessageBox( _( "Error: not a component or no component" ) );
return;
}
component = (SCH_COMPONENT*) item;
}
// @todo: should be changed to use Kiway().Player()?
LIB_EDIT_FRAME* libeditFrame = LIB_EDIT_FRAME::GetActiveLibraryEditor();;
if( libeditFrame )
{
......
......@@ -288,16 +288,19 @@ public:
VTBL_ENTRY KIFACE* KiFACE( FACE_T aFaceId, bool doLoad = true );
/**
* Function PlayerCreate
* Function Player
* returns the KIWAY_PLAYER* given a FRAME_T. If it is not already created,
* the required KIFACE is found and loaded and initialized if necessary, then
* the KIWAY_PLAYER window is created but not shown. Caller must Show() it.
* If it is already created, then the existing KIWAY_PLAYER* pointer is returned.
*
* @param aFrameType is from enum #FRAME_T.
* @param doCreate when true asks that the player be created if it is not already created, false means do not create.
*
* @return KIWAY_PLAYER* - a valid opened KIWAY_PLAYER or NULL if there
* is something wrong.
* is something wrong or doCreate was false and the player has yet to be created.
*/
VTBL_ENTRY KIWAY_PLAYER* PlayerCreate( FRAME_T aFrameType );
VTBL_ENTRY KIWAY_PLAYER* Player( FRAME_T aFrameType, bool doCreate = true );
/**
* Function PlayerClose
......
......@@ -248,7 +248,7 @@ void KICAD_MANAGER_FRAME::OnRunPcbNew( wxCommandEvent& event )
kicad_board : legacy_board;
#if USE_KIFACE
KIWAY_PLAYER* frame = Kiway.PlayerCreate( FRAME_PCB );
KIWAY_PLAYER* frame = Kiway.Player( FRAME_PCB );
frame->OpenProjectFiles( std::vector<wxString>( 1, board.GetFullPath() ) );
frame->Show( true );
......@@ -266,7 +266,7 @@ void KICAD_MANAGER_FRAME::OnRunCvpcb( wxCommandEvent& event )
fn.SetExt( NetlistFileExtension );
#if USE_KIFACE
KIWAY_PLAYER* frame = Kiway.PlayerCreate( FRAME_CVPCB );
KIWAY_PLAYER* frame = Kiway.Player( FRAME_CVPCB );
frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
frame->Show( true );
......@@ -284,7 +284,7 @@ void KICAD_MANAGER_FRAME::OnRunEeschema( wxCommandEvent& event )
fn.SetExt( SchematicFileExtension );
#if USE_KIFACE
KIWAY_PLAYER* frame = Kiway.PlayerCreate( FRAME_SCH );
KIWAY_PLAYER* frame = Kiway.Player( FRAME_SCH );
frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
frame->Show( true );
......
......@@ -12,6 +12,7 @@
#include <fctsys.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <wxPcbStruct.h>
#include <eda_dde.h>
#include <macros.h>
......@@ -141,7 +142,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
*/
void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
{
char cmd[1024];
std::string cmd;
const char* text_key;
MODULE* module = NULL;
D_PAD* pad;
......@@ -155,14 +156,14 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
{
case PCB_MODULE_T:
module = (MODULE*) objectToSync;
sprintf( cmd, "$PART: \"%s\"", TO_UTF8( module->GetReference() ) );
StrPrintf( &cmd, "$PART: \"%s\"", TO_UTF8( module->GetReference() ) );
break;
case PCB_PAD_T:
module = (MODULE*) objectToSync->GetParent();
pad = (D_PAD*) objectToSync;
msg = pad->GetPadName();
sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"",
StrPrintf( &cmd, "$PART: \"%s\" $PAD: \"%s\"",
TO_UTF8( module->GetReference() ),
TO_UTF8( msg ) );
break;
......@@ -178,7 +179,7 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
else
break;
sprintf( cmd, "$PART: \"%s\" %s \"%s\"",
StrPrintf( &cmd, "$PART: \"%s\" %s \"%s\"",
TO_UTF8( module->GetReference() ),
text_key,
TO_UTF8( text_mod->GetText() ) );
......@@ -188,8 +189,12 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
break;
}
if( module )
if( module && cmd.size() )
{
if( Kiface().IsSingle() )
SendCommand( MSG_TO_SCH, cmd.c_str() );
else
{
SendCommand( MSG_TO_SCH, cmd );
}
}
}
......@@ -68,7 +68,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Clear current board and initialize a new one" ),
KiBitmap( new_pcb_xpm ) );
// Open
text = AddHotkeyName( _( "&Open" ), g_Board_Editor_Hokeys_Descr, HK_LOAD_BOARD );
AddMenuItem( filesMenu, ID_LOAD_FILE, text,
_( "Delete current board and load new board" ),
......
......@@ -85,6 +85,9 @@
BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, PCB_EDIT_FRAME::OnSockRequestServer )
EVT_SOCKET( ID_EDA_SOCKET_EVENT, PCB_EDIT_FRAME::OnSockRequest )
EVT_COMBOBOX( ID_ON_ZOOM_SELECT, PCB_EDIT_FRAME::OnSelectZoom )
EVT_COMBOBOX( ID_ON_GRID_SELECT, PCB_EDIT_FRAME::OnSelectGrid )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment