add back missing pcbnew cross probing event handlers. eeschema launches kiface versions of pcbnew & cvpcb if not single.

This commit is contained in:
Dick Hollenbeck 2014-04-19 23:35:34 -05:00
parent f9f3ff22dc
commit a985255f95
10 changed files with 160 additions and 130 deletions

View File

@ -47,8 +47,8 @@ KIWAY::KIWAY( PGM_BASE* aProgram, wxFrame* aTop ):
// Any event types derived from wxCommandEvt, like wxWindowDestroyEvent, are // Any event types derived from wxCommandEvt, like wxWindowDestroyEvent, are
// propogated upwards to parent windows if not handled below. Therefor the // propogated upwards to parent windows if not handled below. Therefor the
// m_top window should receive all wxWindowDestroyEvents from originating // m_top window should receive all wxWindowDestroyEvents originating from
// from KIWAY_PLAYERs. It does anyways, but now playerDestroyHandler eavesdrops // KIWAY_PLAYERs. It does anyways, but now playerDestroyHandler eavesdrops
// on that event stream looking for KIWAY_PLAYERs being closed. // on that event stream looking for KIWAY_PLAYERs being closed.
void KIWAY::playerDestroyHandler( wxWindowDestroyEvent& event ) void KIWAY::playerDestroyHandler( wxWindowDestroyEvent& event )
@ -57,7 +57,7 @@ void KIWAY::playerDestroyHandler( wxWindowDestroyEvent& event )
for( unsigned i=0; i<DIM(m_player); ++i ) 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 ) if( (wxWindow*) m_player[i] == w )
{ {
// DBG(printf( "%s: marking m_player[%d] as destroyed\n", __func__, i );) // 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 // Since this will be called from python, cannot assume that code will
// not pass a bad aFrameType. // not pass a bad aFrameType.
@ -236,15 +236,20 @@ KIWAY_PLAYER* KIWAY::PlayerCreate( FRAME_T aFrameType )
if( m_player[aFrameType] ) if( m_player[aFrameType] )
return m_player[aFrameType]; return m_player[aFrameType];
FACE_T face_type = KifaceType( aFrameType ); if( doCreate )
{
FACE_T face_type = KifaceType( aFrameType );
wxASSERT( face_type != FACE_T(-1) ); wxASSERT( face_type != FACE_T(-1) );
KIFACE* kiface = KiFACE( face_type ); KIFACE* kiface = KiFACE( face_type );
KIWAY_PLAYER* frame = (KIWAY_PLAYER*) kiface->CreateWindow( m_top, aFrameType, this, KFCTL_PROJECT_SUITE ); KIWAY_PLAYER* frame = (KIWAY_PLAYER*) kiface->CreateWindow( m_top, aFrameType, this, KFCTL_PROJECT_SUITE );
return m_player[aFrameType] = frame; return m_player[aFrameType] = frame;
}
return NULL;
} }

View File

@ -78,7 +78,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
return NULL; 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() ) switch( item->Type() )
{ {
case SCH_FIELD_T: 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) // Force display pin information (the previous display could be a component info)
MSG_PANEL_ITEMS items; MSG_PANEL_ITEMS items;
Pin->GetMsgPanelInfo( items ); Pin->GetMsgPanelInfo( items );
if( LibItem ) if( LibItem )

View File

@ -29,6 +29,7 @@
#include <fctsys.h> #include <fctsys.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <kiface_i.h>
#include <macros.h> #include <macros.h>
#include <eda_dde.h> #include <eda_dde.h>
#include <wxEeschemaStruct.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 ) // Cross probing to Pcbnew if a pin or a component is found
return; switch( aComponent->Type() )
LIB_PIN* Pin = NULL;
char Line[1024];
/* Cross probing to Pcbnew if a pin or a component is found */
switch( objectToSync->Type() )
{ {
case SCH_FIELD_T: case SCH_FIELD_T:
case LIB_FIELD_T: case LIB_FIELD_T:
{ {
if( !LibItem ) if( !aPart )
break; break;
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; break;
case SCH_COMPONENT_T: case SCH_COMPONENT_T:
LibItem = (SCH_COMPONENT*) objectToSync; aPart = (SCH_COMPONENT*) aComponent;
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;
case LIB_PIN_T: case LIB_PIN_T:
if( !LibItem )
break;
Pin = (LIB_PIN*) objectToSync;
if( Pin->GetNumber() )
{ {
wxString pinnum; if( !aPart )
Pin->PinStringNum( pinnum ); break;
sprintf( Line, "$PIN: %s $PART: %s", TO_UTF8( pinnum ),
TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
}
else
{
sprintf( Line, "$PART: %s", TO_UTF8( LibItem->GetField( REFERENCE )->GetText() ) );
}
SendCommand( MSG_TO_PCB, Line ); LIB_PIN* pin = (LIB_PIN*) aComponent;
if( pin->GetNumber() )
{
wxString pinnum;
pin->PinStringNum( pinnum );
return StrPrintf( "$PIN: %s $PART: %s", TO_UTF8( pinnum ),
TO_UTF8( aPart->GetField( REFERENCE )->GetText() ) );
}
else
{
return StrPrintf( "$PART: %s", TO_UTF8( aPart->GetField( REFERENCE )->GetText() ) );
}
}
break; break;
default: default:
break; 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
{
}
}
} }

View File

@ -64,20 +64,22 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Menu File: // Menu File:
wxMenu* fileMenu = new wxMenu; wxMenu* fileMenu = new wxMenu;
// New if( Kiface().IsSingle() ) // not when under a project mgr
AddMenuItem( fileMenu, {
ID_NEW_PROJECT, AddMenuItem( fileMenu,
_( "&New Schematic Project" ), ID_NEW_PROJECT,
_( "Clear current schematic hierarchy and start a new schematic root sheet" ), _( "&New Schematic Project" ),
KiBitmap( new_xpm ) ); _( "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 );
text = AddHotkeyName( _( "&Open Schematic Project" ), s_Schematic_Hokeys_Descr, HK_LOAD_SCH ); AddMenuItem( fileMenu,
AddMenuItem( fileMenu, ID_LOAD_PROJECT, text,
ID_LOAD_PROJECT, text, _( "Open an existing schematic hierarchy" ),
_( "Open an existing schematic hierarchy" ), KiBitmap( open_document_xpm ) );
KiBitmap( open_document_xpm ) ); }
// @todo: static probably not OK in multiple open projects.
// Open Recent submenu // Open Recent submenu
static wxMenu* openRecentMenu; static wxMenu* openRecentMenu;
@ -91,21 +93,21 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
Kiface().GetFileHistory().UseMenu( openRecentMenu ); Kiface().GetFileHistory().UseMenu( openRecentMenu );
Kiface().GetFileHistory().AddFilesToMenu( openRecentMenu ); Kiface().GetFileHistory().AddFilesToMenu( openRecentMenu );
AddMenuItem( fileMenu, openRecentMenu, if( Kiface().IsSingle() ) // not when under a project mgr
wxID_ANY, _( "Open &Recent" ), {
_( "Open a recent opened schematic project" ), AddMenuItem( fileMenu, openRecentMenu,
KiBitmap( open_project_xpm ) ); wxID_ANY, _( "Open &Recent" ),
_( "Open a recent opened schematic project" ),
KiBitmap( open_project_xpm ) );
}
// Import
AddMenuItem( fileMenu, AddMenuItem( fileMenu,
ID_APPEND_PROJECT, _( "&Append Schematic Sheet" ), ID_APPEND_PROJECT, _( "&Append Schematic Sheet" ),
_( "Append schematic sheet to current project" ), _( "Append schematic sheet to current project" ),
KiBitmap( open_document_xpm ) ); KiBitmap( open_document_xpm ) );
// Separator
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
// Save schematic project
text = AddHotkeyName( _( "&Save Schematic Project" ), text = AddHotkeyName( _( "&Save Schematic Project" ),
s_Schematic_Hokeys_Descr, HK_SAVE_SCH ); s_Schematic_Hokeys_Descr, HK_SAVE_SCH );
AddMenuItem( fileMenu, AddMenuItem( fileMenu,
@ -113,31 +115,29 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
_( "Save all sheets in schematic project" ), _( "Save all sheets in schematic project" ),
KiBitmap( save_project_xpm ) ); KiBitmap( save_project_xpm ) );
// Save current sheet
AddMenuItem( fileMenu, AddMenuItem( fileMenu,
ID_UPDATE_ONE_SHEET, ID_UPDATE_ONE_SHEET,
_( "Save &Current Sheet Only" ), _( "Save &Current Sheet Only" ),
_( "Save only current schematic sheet" ), _( "Save only current schematic sheet" ),
KiBitmap( save_xpm ) ); 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, AddMenuItem( fileMenu,
_( "Save Current Sheet &As" ), ID_SAVE_ONE_SHEET_UNDER_NEW_NAME,
_( "Save current schematic sheet as..." ), _( "Save Current Sheet &As" ),
KiBitmap( save_as_xpm ) ); _( "Save current schematic sheet as..." ),
KiBitmap( save_as_xpm ) );
}
// Separator
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
// Page settings
AddMenuItem( fileMenu, AddMenuItem( fileMenu,
ID_SHEET_SET, ID_SHEET_SET,
_( "Pa&ge Settings" ), _( "Pa&ge Settings" ),
_( "Setting for sheet size and frame references" ), _( "Setting for sheet size and frame references" ),
KiBitmap( sheetset_xpm ) ); KiBitmap( sheetset_xpm ) );
// Print
AddMenuItem( fileMenu, AddMenuItem( fileMenu,
wxID_PRINT, wxID_PRINT,
_( "Pri&nt" ), _( "Pri&nt" ),
@ -155,7 +155,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Plot to Clipboard (Windows only) // Plot to Clipboard (Windows only)
AddMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD, AddMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD,
_( "Plot to &Clipboard" ), _( "Plot to &Clipboard" ),
_( "Export drawings 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) * using in AddHotkeyName call the option "false" (not a shortcut)
*/ */
// Zoom in
text = AddHotkeyName( _( "Zoom &In" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Zoom &In" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_IN, IS_ACCELERATOR ); // add an accelerator, not a shortcut HK_ZOOM_IN, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) ); AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) );
// Zoom out
text = AddHotkeyName( _( "Zoom &Out" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Zoom &Out" ), s_Schematic_Hokeys_Descr,
HK_ZOOM_OUT, IS_ACCELERATOR ); // add accelerator, not a shortcut HK_ZOOM_OUT, IS_ACCELERATOR ); // add accelerator, not a shortcut
AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) ); 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 ); 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 ) ); AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, KiBitmap( zoom_fit_in_page_xpm ) );
// Separator
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
// Hierarchy
AddMenuItem( viewMenu, AddMenuItem( viewMenu,
ID_HIERARCHY, ID_HIERARCHY,
_( "Show &Hierarchical Navigator" ), _( "Show &Hierarchical Navigator" ),
_( "Navigate hierarchical sheets" ), _( "Navigate hierarchical sheets" ),
KiBitmap( hierarchy_nav_xpm ) ); KiBitmap( hierarchy_nav_xpm ) );
// Redraw
text = AddHotkeyName( _( "&Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); text = AddHotkeyName( _( "&Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW );
AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) ); 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 // @todo unify IDs
wxMenu* placeMenu = new wxMenu; wxMenu* placeMenu = new wxMenu;
// Component
text = AddHotkeyName( _( "&Component" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "&Component" ), s_Schematic_Hokeys_Descr,
HK_ADD_NEW_COMPONENT, IS_ACCELERATOR ); // add an accelerator, not a shortcut HK_ADD_NEW_COMPONENT, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text, AddMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text,
HELP_PLACE_COMPONENTS, HELP_PLACE_COMPONENTS,
KiBitmap( add_component_xpm ) ); KiBitmap( add_component_xpm ) );
// Power port
text = AddHotkeyName( _( "&Power Port" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "&Power Port" ), s_Schematic_Hokeys_Descr,
HK_ADD_NEW_POWER, IS_ACCELERATOR ); // add an accelerator, not a shortcut HK_ADD_NEW_POWER, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text, AddMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text,
HELP_PLACE_POWERPORT, HELP_PLACE_POWERPORT,
KiBitmap( add_power_xpm ) ); KiBitmap( add_power_xpm ) );
// Wire
text = AddHotkeyName( _( "&Wire" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "&Wire" ), s_Schematic_Hokeys_Descr,
HK_BEGIN_WIRE, IS_ACCELERATOR ); // add an accelerator, not a shortcut HK_BEGIN_WIRE, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_WIRE_BUTT, text, AddMenuItem( placeMenu, ID_WIRE_BUTT, text,
HELP_PLACE_WIRE, HELP_PLACE_WIRE,
KiBitmap( add_line_xpm ) ); KiBitmap( add_line_xpm ) );
// Bus
text = AddHotkeyName( _( "&Bus" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "&Bus" ), s_Schematic_Hokeys_Descr,
HK_BEGIN_BUS, IS_ACCELERATOR ); // add an accelerator, not a shortcut HK_BEGIN_BUS, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_BUS_BUTT, text, AddMenuItem( placeMenu, ID_BUS_BUTT, text,
HELP_PLACE_BUS, HELP_PLACE_BUS,
KiBitmap( add_bus_xpm ) ); KiBitmap( add_bus_xpm ) );
// Wire to Bus entry
text = AddHotkeyName( _( "Wire to Bus &Entry" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Wire to Bus &Entry" ), s_Schematic_Hokeys_Descr,
HK_ADD_WIRE_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut HK_ADD_WIRE_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text, AddMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text,
HELP_PLACE_WIRE2BUS_ENTRY, HELP_PLACE_WIRE2BUS_ENTRY,
KiBitmap( add_line2bus_xpm ) ); KiBitmap( add_line2bus_xpm ) );
// Bus to Bus entry
text = AddHotkeyName( _( "Bus &to Bus Entry" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Bus &to Bus Entry" ), s_Schematic_Hokeys_Descr,
HK_ADD_BUS_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut HK_ADD_BUS_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text, AddMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text,
HELP_PLACE_BUS2BUS_ENTRY, HELP_PLACE_BUS2BUS_ENTRY,
KiBitmap( add_bus2bus_xpm ) ); KiBitmap( add_bus2bus_xpm ) );
// No Connect Flag
text = AddHotkeyName( _( "&No Connect Flag" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "&No Connect Flag" ), s_Schematic_Hokeys_Descr,
HK_ADD_NOCONN_FLAG, IS_ACCELERATOR ); // add an accelerator, not a shortcut 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 ) ); AddMenuItem( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, KiBitmap( noconn_xpm ) );
// Net name
text = AddHotkeyName( _( "&Label" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "&Label" ), s_Schematic_Hokeys_Descr,
HK_ADD_LABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut HK_ADD_LABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_LABEL_BUTT, text, AddMenuItem( placeMenu, ID_LABEL_BUTT, text,
HELP_PLACE_NETLABEL, HELP_PLACE_NETLABEL,
KiBitmap( add_line_label_xpm ) ); KiBitmap( add_line_label_xpm ) );
// Global label
text = AddHotkeyName( _( "Gl&obal Label" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Gl&obal Label" ), s_Schematic_Hokeys_Descr,
HK_ADD_GLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut HK_ADD_GLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_GLABEL_BUTT, text, AddMenuItem( placeMenu, ID_GLABEL_BUTT, text,
HELP_PLACE_GLOBALLABEL, HELP_PLACE_GLOBALLABEL,
KiBitmap( add_glabel_xpm ) ); KiBitmap( add_glabel_xpm ) );
// Junction
text = AddHotkeyName( _( "&Junction" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "&Junction" ), s_Schematic_Hokeys_Descr,
HK_ADD_JUNCTION, IS_ACCELERATOR ); // add an accelerator, not a shortcut HK_ADD_JUNCTION, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_JUNCTION_BUTT, text, AddMenuItem( placeMenu, ID_JUNCTION_BUTT, text,
HELP_PLACE_JUNCTION, HELP_PLACE_JUNCTION,
KiBitmap( add_junction_xpm ) ); KiBitmap( add_junction_xpm ) );
// Separator
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
// Hierarchical label
text = AddHotkeyName( _( "&Hierarchical Label" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "&Hierarchical Label" ), s_Schematic_Hokeys_Descr,
HK_ADD_HLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut HK_ADD_HLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_HIERLABEL_BUTT, AddMenuItem( placeMenu, ID_HIERLABEL_BUTT,
@ -355,38 +336,32 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( add_hierarchical_label_xpm ) ); KiBitmap( add_hierarchical_label_xpm ) );
// Hierarchical sheet
text = AddHotkeyName( _( "H&ierarchical &Sheet" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "H&ierarchical &Sheet" ), s_Schematic_Hokeys_Descr,
HK_ADD_HIER_SHEET, IS_ACCELERATOR ); // add an accelerator, not a shortcut HK_ADD_HIER_SHEET, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text, AddMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text,
HELP_PLACE_SHEET, HELP_PLACE_SHEET,
KiBitmap( add_hierarchical_subsheet_xpm ) ); KiBitmap( add_hierarchical_subsheet_xpm ) );
// Import hierarchical sheet
AddMenuItem( placeMenu, AddMenuItem( placeMenu,
ID_IMPORT_HLABEL_BUTT, ID_IMPORT_HLABEL_BUTT,
_( "I&mport Hierarchical Label" ), _( "I&mport Hierarchical Label" ),
HELP_IMPORT_SHEETPIN, HELP_IMPORT_SHEETPIN,
KiBitmap( import_hierarchical_label_xpm ) ); KiBitmap( import_hierarchical_label_xpm ) );
// Add hierarchical Pin to Sheet
AddMenuItem( placeMenu, AddMenuItem( placeMenu,
ID_SHEET_PIN_BUTT, ID_SHEET_PIN_BUTT,
_( "Hierarchical Pi&n to Sheet" ), _( "Hierarchical Pi&n to Sheet" ),
HELP_PLACE_SHEETPIN, HELP_PLACE_SHEETPIN,
KiBitmap( add_hierar_pin_xpm ) ); KiBitmap( add_hierar_pin_xpm ) );
// Separator
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
// Graphic line or polygon
text = AddHotkeyName( _( "Graphic Polyline" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Graphic Polyline" ), s_Schematic_Hokeys_Descr,
HK_ADD_GRAPHIC_POLYLINE, IS_ACCELERATOR ); // add an accelerator, not a shortcut HK_ADD_GRAPHIC_POLYLINE, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text, AddMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text,
HELP_PLACE_GRAPHICLINES, HELP_PLACE_GRAPHICLINES,
KiBitmap( add_dashed_line_xpm ) ); KiBitmap( add_dashed_line_xpm ) );
// Graphic text
text = AddHotkeyName( _( "Graphic Text" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Graphic Text" ), s_Schematic_Hokeys_Descr,
HK_ADD_GRAPHIC_TEXT, IS_ACCELERATOR ); // add an accelerator, not a shortcut HK_ADD_GRAPHIC_TEXT, IS_ACCELERATOR ); // add an accelerator, not a shortcut
AddMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text, AddMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text,
@ -437,14 +412,12 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Separator // Separator
preferencesMenu->AppendSeparator(); preferencesMenu->AppendSeparator();
// Save preferences
AddMenuItem( preferencesMenu, AddMenuItem( preferencesMenu,
ID_CONFIG_SAVE, ID_CONFIG_SAVE,
_( "&Save Preferences" ), _( "&Save Preferences" ),
_( "Save application preferences" ), _( "Save application preferences" ),
KiBitmap( save_setup_xpm ) ); KiBitmap( save_setup_xpm ) );
// Read preferences
AddMenuItem( preferencesMenu, AddMenuItem( preferencesMenu,
ID_CONFIG_READ, ID_CONFIG_READ,
_( "&Read Preferences" ), _( "&Read Preferences" ),
@ -454,22 +427,18 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Menu Tools: // Menu Tools:
wxMenu* toolsMenu = new wxMenu; wxMenu* toolsMenu = new wxMenu;
// Library editor
AddMenuItem( toolsMenu, AddMenuItem( toolsMenu,
ID_TO_LIBRARY, ID_TO_LIBRARY,
_( "Library &Editor" ), HELP_RUN_LIB_EDITOR, _( "Library &Editor" ), HELP_RUN_LIB_EDITOR,
KiBitmap( libedit_xpm ) ); KiBitmap( libedit_xpm ) );
// Library viewer
AddMenuItem( toolsMenu, AddMenuItem( toolsMenu,
ID_TO_LIBVIEW, ID_TO_LIBVIEW,
_( "Library &Browser" ), HELP_RUN_LIB_VIEWER, _( "Library &Browser" ), HELP_RUN_LIB_VIEWER,
KiBitmap( library_browse_xpm ) ); KiBitmap( library_browse_xpm ) );
// Separator
toolsMenu->AppendSeparator(); toolsMenu->AppendSeparator();
// Annotate
AddMenuItem( toolsMenu, AddMenuItem( toolsMenu,
ID_GET_ANNOTATE, ID_GET_ANNOTATE,
_( "&Annotate Schematic" ), HELP_ANNOTATE, _( "&Annotate Schematic" ), HELP_ANNOTATE,
@ -482,24 +451,21 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
_( "Perform electrical rule check" ), _( "Perform electrical rule check" ),
KiBitmap( erc_xpm ) ); KiBitmap( erc_xpm ) );
// Generate netlist
AddMenuItem( toolsMenu, AddMenuItem( toolsMenu,
ID_GET_NETLIST, ID_GET_NETLIST,
_( "Generate &Netlist File" ), _( "Generate &Netlist File" ),
_( "Generate the component netlist file" ), _( "Generate the component netlist file" ),
KiBitmap( netlist_xpm ) ); KiBitmap( netlist_xpm ) );
// Generate bill of materials
AddMenuItem( toolsMenu, AddMenuItem( toolsMenu,
ID_GET_TOOLS, ID_GET_TOOLS,
_( "Generate Bill of &Materials" ), _( "Generate Bill of &Materials" ),
HELP_GENERATE_BOM, HELP_GENERATE_BOM,
KiBitmap( bom_xpm ) ); KiBitmap( bom_xpm ) );
// Separator
toolsMenu->AppendSeparator(); toolsMenu->AppendSeparator();
//Run CvPcb // Run CvPcb
AddMenuItem( toolsMenu, AddMenuItem( toolsMenu,
ID_TO_CVPCB, ID_TO_CVPCB,
_( "A&ssign Component Footprint" ), _( "A&ssign Component Footprint" ),
@ -519,7 +485,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Version info // Version info
AddHelpVersionInfoMenuEntry( helpMenu ); AddHelpVersionInfoMenuEntry( helpMenu );
// Contents
AddMenuItem( helpMenu, AddMenuItem( helpMenu,
wxID_HELP, wxID_HELP,
_( "Eesc&hema Manual" ), _( "Eesc&hema Manual" ),
@ -532,7 +497,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
_( "Open \"Getting Started in KiCad\" guide for beginners" ), _( "Open \"Getting Started in KiCad\" guide for beginners" ),
KiBitmap( help_xpm ) ); KiBitmap( help_xpm ) );
// About Eeschema
helpMenu->AppendSeparator(); helpMenu->AppendSeparator();
AddMenuItem( helpMenu, AddMenuItem( helpMenu,
wxID_ABOUT, wxID_ABOUT,

View File

@ -764,9 +764,23 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event )
{ {
fn.SetExt( PcbFileExtension ); fn.SetExt( PcbFileExtension );
wxString filename = QuoteFullPath( fn ); if( Kiface().IsSingle() )
{
wxString filename = QuoteFullPath( fn );
ExecuteFile( this, PCBNEW_EXE, filename );
}
else
{
KIWAY_PLAYER* player = Kiway().Player( FRAME_PCB, false ); // test open already.
ExecuteFile( this, PCBNEW_EXE, filename ); if( !player )
{
player = Kiway().Player( FRAME_PCB, true );
player->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
player->Show( true );
}
player->Raise();
}
} }
else else
{ {
@ -783,7 +797,22 @@ void SCH_EDIT_FRAME::OnOpenCvpcb( wxCommandEvent& event )
if( fn.IsOk() && fn.FileExists() ) if( fn.IsOk() && fn.FileExists() )
{ {
ExecuteFile( this, CVPCB_EXE, QuoteFullPath( fn ) ); 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 else
{ {
@ -802,13 +831,15 @@ void SCH_EDIT_FRAME::OnOpenLibraryEditor( wxCommandEvent& event )
if( (item == NULL) || (item->GetFlags() != 0) || ( item->Type() != SCH_COMPONENT_T ) ) 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; return;
} }
component = (SCH_COMPONENT*) item; component = (SCH_COMPONENT*) item;
} }
// @todo: should be changed to use Kiway().Player()?
LIB_EDIT_FRAME* libeditFrame = LIB_EDIT_FRAME::GetActiveLibraryEditor();; LIB_EDIT_FRAME* libeditFrame = LIB_EDIT_FRAME::GetActiveLibraryEditor();;
if( libeditFrame ) if( libeditFrame )
{ {

View File

@ -288,16 +288,19 @@ public:
VTBL_ENTRY KIFACE* KiFACE( FACE_T aFaceId, bool doLoad = true ); 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, * 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 required KIFACE is found and loaded and initialized if necessary, then
* the KIWAY_PLAYER window is created but not shown. Caller must Show() it. * 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. * 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 * @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 * Function PlayerClose

View File

@ -248,7 +248,7 @@ void KICAD_MANAGER_FRAME::OnRunPcbNew( wxCommandEvent& event )
kicad_board : legacy_board; kicad_board : legacy_board;
#if USE_KIFACE #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->OpenProjectFiles( std::vector<wxString>( 1, board.GetFullPath() ) );
frame->Show( true ); frame->Show( true );
@ -266,7 +266,7 @@ void KICAD_MANAGER_FRAME::OnRunCvpcb( wxCommandEvent& event )
fn.SetExt( NetlistFileExtension ); fn.SetExt( NetlistFileExtension );
#if USE_KIFACE #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->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
frame->Show( true ); frame->Show( true );
@ -284,7 +284,7 @@ void KICAD_MANAGER_FRAME::OnRunEeschema( wxCommandEvent& event )
fn.SetExt( SchematicFileExtension ); fn.SetExt( SchematicFileExtension );
#if USE_KIFACE #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->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
frame->Show( true ); frame->Show( true );

View File

@ -12,6 +12,7 @@
#include <fctsys.h> #include <fctsys.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <kiface_i.h>
#include <wxPcbStruct.h> #include <wxPcbStruct.h>
#include <eda_dde.h> #include <eda_dde.h>
#include <macros.h> #include <macros.h>
@ -141,12 +142,12 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
*/ */
void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync ) void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
{ {
char cmd[1024]; std::string cmd;
const char* text_key; const char* text_key;
MODULE* module = NULL; MODULE* module = NULL;
D_PAD* pad; D_PAD* pad;
TEXTE_MODULE* text_mod; TEXTE_MODULE* text_mod;
wxString msg; wxString msg;
if( objectToSync == NULL ) if( objectToSync == NULL )
return; return;
@ -155,14 +156,14 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
{ {
case PCB_MODULE_T: case PCB_MODULE_T:
module = (MODULE*) objectToSync; module = (MODULE*) objectToSync;
sprintf( cmd, "$PART: \"%s\"", TO_UTF8( module->GetReference() ) ); StrPrintf( &cmd, "$PART: \"%s\"", TO_UTF8( module->GetReference() ) );
break; break;
case PCB_PAD_T: case PCB_PAD_T:
module = (MODULE*) objectToSync->GetParent(); module = (MODULE*) objectToSync->GetParent();
pad = (D_PAD*) objectToSync; pad = (D_PAD*) objectToSync;
msg = pad->GetPadName(); msg = pad->GetPadName();
sprintf( cmd, "$PART: \"%s\" $PAD: \"%s\"", StrPrintf( &cmd, "$PART: \"%s\" $PAD: \"%s\"",
TO_UTF8( module->GetReference() ), TO_UTF8( module->GetReference() ),
TO_UTF8( msg ) ); TO_UTF8( msg ) );
break; break;
@ -178,7 +179,7 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
else else
break; break;
sprintf( cmd, "$PART: \"%s\" %s \"%s\"", StrPrintf( &cmd, "$PART: \"%s\" %s \"%s\"",
TO_UTF8( module->GetReference() ), TO_UTF8( module->GetReference() ),
text_key, text_key,
TO_UTF8( text_mod->GetText() ) ); TO_UTF8( text_mod->GetText() ) );
@ -188,8 +189,12 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync )
break; break;
} }
if( module ) if( module && cmd.size() )
{ {
SendCommand( MSG_TO_SCH, cmd ); if( Kiface().IsSingle() )
SendCommand( MSG_TO_SCH, cmd.c_str() );
else
{
}
} }
} }

View File

@ -68,7 +68,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Clear current board and initialize a new one" ), _( "Clear current board and initialize a new one" ),
KiBitmap( new_pcb_xpm ) ); KiBitmap( new_pcb_xpm ) );
// Open
text = AddHotkeyName( _( "&Open" ), g_Board_Editor_Hokeys_Descr, HK_LOAD_BOARD ); text = AddHotkeyName( _( "&Open" ), g_Board_Editor_Hokeys_Descr, HK_LOAD_BOARD );
AddMenuItem( filesMenu, ID_LOAD_FILE, text, AddMenuItem( filesMenu, ID_LOAD_FILE, text,
_( "Delete current board and load new board" ), _( "Delete current board and load new board" ),

View File

@ -85,6 +85,9 @@
BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) 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_ZOOM_SELECT, PCB_EDIT_FRAME::OnSelectZoom )
EVT_COMBOBOX( ID_ON_GRID_SELECT, PCB_EDIT_FRAME::OnSelectGrid ) EVT_COMBOBOX( ID_ON_GRID_SELECT, PCB_EDIT_FRAME::OnSelectGrid )