2009-11-04 20:46:53 +00:00
|
|
|
/******************/
|
|
|
|
/* schframe.cpp */
|
|
|
|
/******************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "appl_wxstruct.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "gestfich.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "bitmaps.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "program.h"
|
|
|
|
#include "general.h"
|
|
|
|
#include "protos.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "eeschema_id.h"
|
2008-02-27 19:38:16 +00:00
|
|
|
#include "netlist.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
#include "annotate_dialog.h"
|
2008-02-27 19:38:16 +00:00
|
|
|
#include "dialog_build_BOM.h"
|
|
|
|
#include "dialog_erc.h"
|
|
|
|
#include "dialog_find.h"
|
|
|
|
#include "netlist_control.h"
|
2009-07-03 18:25:06 +00:00
|
|
|
#include "dialog_erc.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "libeditfrm.h"
|
|
|
|
#include "libviewfrm.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
|
|
|
|
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV,
|
|
|
|
WinEDA_DrawFrame::OnSockRequestServer )
|
|
|
|
EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_DrawFrame::OnSockRequest )
|
|
|
|
|
|
|
|
EVT_CLOSE( WinEDA_SchematicFrame::OnCloseWindow )
|
|
|
|
EVT_SIZE( WinEDA_SchematicFrame::OnSize )
|
|
|
|
|
|
|
|
EVT_MENU( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject )
|
|
|
|
EVT_MENU( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject )
|
|
|
|
|
2009-01-17 20:31:19 +00:00
|
|
|
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_SchematicFrame::OnLoadFile )
|
2009-01-07 15:59:49 +00:00
|
|
|
|
|
|
|
EVT_TOOL( ID_NEW_PROJECT, WinEDA_SchematicFrame::OnNewProject )
|
|
|
|
EVT_TOOL( ID_LOAD_PROJECT, WinEDA_SchematicFrame::OnLoadProject )
|
|
|
|
|
|
|
|
EVT_MENU( ID_SAVE_PROJECT, WinEDA_SchematicFrame::Save_File )
|
|
|
|
EVT_MENU( ID_SAVE_ONE_SHEET, WinEDA_SchematicFrame::Save_File )
|
|
|
|
EVT_MENU( ID_SAVE_ONE_SHEET_AS, WinEDA_SchematicFrame::Save_File )
|
|
|
|
EVT_TOOL( ID_SAVE_PROJECT, WinEDA_SchematicFrame::Save_File )
|
|
|
|
EVT_MENU( ID_GEN_PRINT, WinEDA_SchematicFrame::ToPrinter )
|
|
|
|
EVT_MENU( ID_GEN_PLOT_PS, WinEDA_SchematicFrame::ToPlot_PS )
|
|
|
|
EVT_MENU( ID_GEN_PLOT_HPGL, WinEDA_SchematicFrame::ToPlot_HPGL )
|
|
|
|
EVT_MENU( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print )
|
2009-06-30 10:43:20 +00:00
|
|
|
EVT_MENU( ID_GEN_PLOT_DXF, WinEDA_SchematicFrame::ToPlot_DXF )
|
2009-01-07 15:59:49 +00:00
|
|
|
EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard )
|
|
|
|
EVT_MENU( ID_GEN_COPY_BLOCK_TO_CLIPBOARD, WinEDA_DrawFrame::CopyToClipboard )
|
|
|
|
EVT_MENU( ID_EXIT, WinEDA_SchematicFrame::OnExit )
|
|
|
|
|
|
|
|
EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START,
|
|
|
|
ID_CONFIG_AND_PREFERENCES_END,
|
|
|
|
WinEDA_SchematicFrame::Process_Config )
|
|
|
|
EVT_TOOL( ID_COLORS_SETUP, WinEDA_SchematicFrame::Process_Config )
|
2009-12-01 15:14:18 +00:00
|
|
|
EVT_TOOL( ID_OPTIONS_SETUP, WinEDA_SchematicFrame::OnSetOptions )
|
2009-01-07 15:59:49 +00:00
|
|
|
|
|
|
|
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
|
|
|
|
WinEDA_DrawFrame::SetLanguage )
|
|
|
|
|
|
|
|
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_SchematicFrame::OnZoom )
|
|
|
|
|
|
|
|
EVT_TOOL( ID_TO_LIBRARY, WinEDA_SchematicFrame::OnOpenLibraryEditor )
|
|
|
|
EVT_TOOL( ID_TO_LIBVIEW, WinEDA_SchematicFrame::OnOpenLibraryViewer )
|
|
|
|
|
|
|
|
EVT_TOOL( ID_TO_PCB, WinEDA_SchematicFrame::OnOpenPcbnew )
|
|
|
|
EVT_TOOL( ID_TO_CVPCB, WinEDA_SchematicFrame::OnOpenCvpcb )
|
|
|
|
|
|
|
|
EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
|
|
|
|
EVT_TOOL( ID_HIERARCHY, WinEDA_SchematicFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( wxID_CUT, WinEDA_SchematicFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( wxID_COPY, WinEDA_SchematicFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( wxID_PASTE, WinEDA_SchematicFrame::Process_Special_Functions )
|
2009-11-04 20:46:53 +00:00
|
|
|
EVT_TOOL( ID_SCHEMATIC_UNDO,
|
|
|
|
WinEDA_SchematicFrame::GetSchematicFromUndoList )
|
|
|
|
EVT_TOOL( ID_SCHEMATIC_REDO,
|
|
|
|
WinEDA_SchematicFrame::GetSchematicFromRedoList )
|
2009-01-07 15:59:49 +00:00
|
|
|
EVT_TOOL( ID_GET_ANNOTATE, WinEDA_SchematicFrame::OnAnnotate )
|
|
|
|
EVT_TOOL( ID_GEN_PRINT, WinEDA_SchematicFrame::ToPrinter )
|
|
|
|
EVT_TOOL( ID_GET_ERC, WinEDA_SchematicFrame::OnErc )
|
|
|
|
EVT_TOOL( ID_GET_NETLIST, WinEDA_SchematicFrame::OnCreateNetlist )
|
|
|
|
EVT_TOOL( ID_GET_TOOLS, WinEDA_SchematicFrame::OnCreateBillOfMaterials )
|
|
|
|
EVT_TOOL( ID_FIND_ITEMS, WinEDA_SchematicFrame::OnFindItems )
|
|
|
|
EVT_TOOL( ID_BACKANNO_ITEMS, WinEDA_SchematicFrame::OnLoadStuffFile )
|
2009-09-22 12:27:57 +00:00
|
|
|
EVT_TOOL( ID_COMPONENT_BUTT,
|
|
|
|
WinEDA_SchematicFrame::Process_Special_Functions )
|
2009-01-07 15:59:49 +00:00
|
|
|
|
|
|
|
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
|
|
|
|
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
// Tools and buttons for vertical toolbar.
|
2009-12-02 21:44:03 +00:00
|
|
|
EVT_TOOL( ID_NO_SELECT_BUTT,
|
|
|
|
WinEDA_SchematicFrame::Process_Special_Functions )
|
2009-01-07 15:59:49 +00:00
|
|
|
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
|
|
|
|
ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
|
|
|
WinEDA_SchematicFrame::Process_Special_Functions )
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
|
|
|
|
WinEDA_SchematicFrame::Process_Special_Functions )
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
// Tools and buttons options toolbar
|
2009-01-07 15:59:49 +00:00
|
|
|
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
|
|
|
|
WinEDA_SchematicFrame::OnSelectOptionToolbar )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
|
|
|
WinEDA_SchematicFrame::Process_Special_Functions )
|
2009-04-29 17:09:00 +00:00
|
|
|
|
|
|
|
/* Handle user interface update events. */
|
|
|
|
EVT_UPDATE_UI( wxID_CUT, WinEDA_SchematicFrame::OnUpdateBlockSelected )
|
|
|
|
EVT_UPDATE_UI( wxID_COPY, WinEDA_SchematicFrame::OnUpdateBlockSelected )
|
|
|
|
EVT_UPDATE_UI( wxID_PASTE, WinEDA_SchematicFrame::OnUpdatePaste )
|
|
|
|
EVT_UPDATE_UI( ID_SCHEMATIC_UNDO,
|
|
|
|
WinEDA_SchematicFrame::OnUpdateSchematicUndo )
|
|
|
|
EVT_UPDATE_UI( ID_SCHEMATIC_REDO,
|
|
|
|
WinEDA_SchematicFrame::OnUpdateSchematicRedo )
|
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRID,
|
|
|
|
WinEDA_SchematicFrame::OnUpdateGrid )
|
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_SELECT_CURSOR,
|
|
|
|
WinEDA_SchematicFrame::OnUpdateSelectCursor )
|
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_HIDDEN_PINS,
|
|
|
|
WinEDA_SchematicFrame::OnUpdateHiddenPins )
|
|
|
|
EVT_UPDATE_UI( ID_TB_OPTIONS_BUS_WIRES_ORIENT,
|
|
|
|
WinEDA_SchematicFrame::OnUpdateBusOrientation )
|
|
|
|
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM,
|
|
|
|
ID_TB_OPTIONS_SELECT_UNIT_INCH,
|
|
|
|
WinEDA_SchematicFrame::OnUpdateUnits )
|
2007-05-06 16:03:28 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
|
2008-02-26 01:07:38 +00:00
|
|
|
const wxString& title,
|
2009-01-04 18:52:57 +00:00
|
|
|
const wxPoint& pos,
|
|
|
|
const wxSize& size,
|
|
|
|
long style ) :
|
2008-12-08 15:27:13 +00:00
|
|
|
WinEDA_DrawFrame( father, SCHEMATIC_FRAME, title, pos, size, style )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-01-04 18:52:57 +00:00
|
|
|
m_FrameName = wxT( "SchematicFrame" );
|
|
|
|
m_Draw_Axis = FALSE; // TRUE to show axis
|
2008-02-26 01:07:38 +00:00
|
|
|
m_Draw_Sheet_Ref = TRUE; // TRUE to show sheet references
|
2009-12-02 21:44:03 +00:00
|
|
|
m_CurrentSheet = new SCH_SHEET_PATH();
|
2008-11-24 06:53:43 +00:00
|
|
|
m_CurrentField = NULL;
|
2009-01-04 18:52:57 +00:00
|
|
|
m_Multiflag = 0;
|
|
|
|
m_TextFieldSize = DEFAULT_SIZE_TEXT;
|
|
|
|
m_LibeditFrame = NULL; // Component editor frame.
|
|
|
|
m_ViewlibFrame = NULL; // Frame for browsing component libraries
|
2009-04-29 17:09:00 +00:00
|
|
|
m_DefaultSchematicFileName = wxT( "noname.sch" );
|
2009-11-04 20:46:53 +00:00
|
|
|
m_ShowAllPins = false;
|
2008-02-26 01:07:38 +00:00
|
|
|
|
|
|
|
CreateScreens();
|
|
|
|
|
|
|
|
// Give an icon
|
|
|
|
#ifdef __WINDOWS__
|
|
|
|
SetIcon( wxICON( a_icon_eeschema ) );
|
|
|
|
#else
|
|
|
|
SetIcon( wxICON( icon_eeschema ) );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
g_ItemToRepeat = NULL;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
/* Get config */
|
2009-04-05 20:49:15 +00:00
|
|
|
LoadSettings();
|
2009-11-04 20:46:53 +00:00
|
|
|
|
|
|
|
// Internalize grid id to a default value if not found in config or bad:
|
|
|
|
if( (m_LastGridSizeId <= 0)
|
|
|
|
|| ( m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000) ) )
|
2009-10-15 11:35:53 +00:00
|
|
|
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
if( DrawPanel )
|
|
|
|
DrawPanel->m_Block_Enable = TRUE;
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
ReCreateMenuBar();
|
|
|
|
ReCreateHToolbar();
|
|
|
|
ReCreateVToolbar();
|
|
|
|
ReCreateOptToolbar();
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2009-11-05 08:52:41 +00:00
|
|
|
#if defined(KICAD_AUIMANAGER)
|
2009-11-04 20:46:53 +00:00
|
|
|
m_auimgr.SetManagedWindow( this );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
|
|
|
wxAuiPaneInfo horiz;
|
2009-11-04 20:46:53 +00:00
|
|
|
horiz.Gripper( false );
|
|
|
|
horiz.DockFixed( true );
|
|
|
|
horiz.Movable( false );
|
|
|
|
horiz.Floatable( false );
|
|
|
|
horiz.CloseButton( false );
|
|
|
|
horiz.CaptionVisible( false );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
wxAuiPaneInfo vert( horiz );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
vert.TopDockable( false ).BottomDockable( false );
|
|
|
|
horiz.LeftDockable( false ).RightDockable( false );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
m_auimgr.AddPane( m_HToolBar,
|
|
|
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
|
|
|
|
Row( 0 ) );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
m_auimgr.AddPane( m_VToolBar,
|
|
|
|
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
m_auimgr.AddPane( m_OptionsToolBar,
|
|
|
|
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
m_auimgr.AddPane( DrawPanel,
|
|
|
|
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
m_auimgr.AddPane( MsgPanel,
|
|
|
|
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
|
|
|
m_auimgr.Update();
|
|
|
|
#endif
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
WinEDA_SchematicFrame::~WinEDA_SchematicFrame()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2008-02-26 01:07:38 +00:00
|
|
|
SAFE_DELETE( g_RootSheet );
|
2009-12-02 21:44:03 +00:00
|
|
|
SAFE_DELETE( m_CurrentSheet ); //a SCH_SHEET_PATH, on the heap.
|
2008-02-26 01:07:38 +00:00
|
|
|
m_CurrentSheet = NULL;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 01:07:38 +00:00
|
|
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
BASE_SCREEN* WinEDA_SchematicFrame::GetBaseScreen() const
|
|
|
|
{
|
|
|
|
return GetScreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_PATH* WinEDA_SchematicFrame::GetSheet()
|
2008-02-26 01:07:38 +00:00
|
|
|
{
|
|
|
|
return m_CurrentSheet;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 01:07:38 +00:00
|
|
|
|
|
|
|
|
2008-04-30 17:04:22 +00:00
|
|
|
/** Function SetSheetNumberAndCount
|
|
|
|
* Set the m_ScreenNumber and m_NumberOfScreen members for screens
|
2009-11-04 20:46:53 +00:00
|
|
|
* must be called after a delete or add sheet command, and when entering a
|
|
|
|
* sheet
|
2008-04-30 17:04:22 +00:00
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
void WinEDA_SchematicFrame::SetSheetNumberAndCount()
|
|
|
|
{
|
2009-01-04 18:52:57 +00:00
|
|
|
SCH_SCREEN* screen = GetScreen();
|
2008-04-30 17:04:22 +00:00
|
|
|
EDA_ScreenList s_list;
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
/* Set the sheet count, and the sheet number (1 for root sheet)
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
int sheet_count = g_RootSheet->CountSheets();
|
|
|
|
int SheetNumber = 1;
|
|
|
|
wxString current_sheetpath = m_CurrentSheet->Path();
|
|
|
|
SCH_SHEET_LIST SheetList;
|
2009-01-04 18:52:57 +00:00
|
|
|
|
|
|
|
// Examine all sheets path to find the current sheets path,
|
2009-11-04 20:46:53 +00:00
|
|
|
// and count them from root to the current sheet path:
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_PATH* sheet;
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
|
|
|
sheet = SheetList.GetNext() )
|
2008-04-30 17:04:22 +00:00
|
|
|
{
|
2009-01-04 18:52:57 +00:00
|
|
|
wxString sheetpath = sheet->Path();
|
|
|
|
if( sheetpath == current_sheetpath ) // Current sheet path found
|
|
|
|
break;
|
2009-11-04 20:46:53 +00:00
|
|
|
SheetNumber++; /* Not found, increment sheet
|
|
|
|
* number before this current
|
|
|
|
* path */
|
2008-04-30 17:04:22 +00:00
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
for( screen = s_list.GetFirst(); screen != NULL; screen = s_list.GetNext() )
|
|
|
|
{
|
|
|
|
screen->m_NumberOfScreen = sheet_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetScreen()->m_ScreenNumber = SheetNumber;
|
|
|
|
}
|
2008-04-30 17:04:22 +00:00
|
|
|
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
SCH_SCREEN* WinEDA_SchematicFrame::GetScreen() const
|
2008-02-26 01:07:38 +00:00
|
|
|
{
|
|
|
|
return m_CurrentSheet->LastScreen();
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 01:07:38 +00:00
|
|
|
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
wxString WinEDA_SchematicFrame::GetScreenDesc()
|
|
|
|
{
|
2008-02-26 01:07:38 +00:00
|
|
|
wxString s = m_CurrentSheet->PathHumanReadable();
|
|
|
|
|
|
|
|
return s;
|
2008-02-12 21:12:46 +00:00
|
|
|
}
|
2008-02-26 01:07:38 +00:00
|
|
|
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
void WinEDA_SchematicFrame::CreateScreens()
|
|
|
|
{
|
2008-02-26 01:07:38 +00:00
|
|
|
if( g_RootSheet == NULL )
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
g_RootSheet = new SCH_SHEET();
|
2008-02-26 01:07:38 +00:00
|
|
|
}
|
2008-02-26 19:19:54 +00:00
|
|
|
if( g_RootSheet->m_AssociatedScreen == NULL )
|
2008-02-26 01:07:38 +00:00
|
|
|
{
|
2008-12-05 16:03:05 +00:00
|
|
|
g_RootSheet->m_AssociatedScreen = new SCH_SCREEN();
|
2008-02-26 19:19:54 +00:00
|
|
|
g_RootSheet->m_AssociatedScreen->m_RefCount++;
|
2008-02-26 01:07:38 +00:00
|
|
|
}
|
2009-04-29 17:09:00 +00:00
|
|
|
g_RootSheet->m_AssociatedScreen->m_FileName = m_DefaultSchematicFileName;
|
2009-01-04 18:52:57 +00:00
|
|
|
g_RootSheet->m_AssociatedScreen->m_Date = GenDate();
|
2008-02-26 01:07:38 +00:00
|
|
|
m_CurrentSheet->Clear();
|
|
|
|
m_CurrentSheet->Push( g_RootSheet );
|
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
if( GetBaseScreen() == NULL )
|
|
|
|
SetBaseScreen( new SCH_SCREEN() );
|
|
|
|
GetBaseScreen()->SetZoom( 4 * GetBaseScreen()->m_ZoomScalar );
|
|
|
|
GetBaseScreen()->m_UndoRedoCountMax = 10;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
|
|
|
|
void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_PATH* sheet;
|
2008-02-26 01:07:38 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
if( m_LibeditFrame ) // Can close component editor ?
|
2008-02-26 01:07:38 +00:00
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
if( !m_LibeditFrame->Close() )
|
2008-02-26 01:07:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_LIST SheetList;
|
2008-02-26 01:07:38 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
|
|
|
sheet = SheetList.GetNext() )
|
2008-02-26 01:07:38 +00:00
|
|
|
{
|
|
|
|
if( sheet->LastScreen() && sheet->LastScreen()->IsModify() )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( sheet )
|
|
|
|
{
|
|
|
|
wxMessageDialog dialog( this,
|
|
|
|
_( "Schematic modified, Save before exit ?" ),
|
|
|
|
_( "Confirmation" ), wxYES_NO | wxCANCEL |
|
|
|
|
wxICON_EXCLAMATION | wxYES_DEFAULT );
|
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
switch( dialog.ShowModal() )
|
2008-02-26 01:07:38 +00:00
|
|
|
{
|
|
|
|
case wxID_CANCEL:
|
|
|
|
Event.Veto();
|
|
|
|
return;
|
|
|
|
|
|
|
|
case wxID_NO:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case wxID_OK:
|
|
|
|
case wxID_YES:
|
|
|
|
SaveProject();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
for( sheet = SheetList.GetFirst();
|
|
|
|
sheet != NULL;
|
|
|
|
sheet = SheetList.GetNext() )
|
2008-02-26 01:07:38 +00:00
|
|
|
{
|
|
|
|
if( sheet->LastScreen() )
|
|
|
|
{
|
|
|
|
sheet->LastScreen()->ClrModify();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
if( !g_RootSheet->m_AssociatedScreen->m_FileName.IsEmpty()
|
2009-11-04 20:46:53 +00:00
|
|
|
&& (g_RootSheet->m_AssociatedScreen->EEDrawList != NULL) )
|
2008-02-26 19:19:54 +00:00
|
|
|
SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
|
2008-02-26 01:07:38 +00:00
|
|
|
|
2008-02-26 19:19:54 +00:00
|
|
|
ClearProjectDrawList( g_RootSheet->m_AssociatedScreen, TRUE );
|
2008-02-26 01:07:38 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
/* all sub sheets are deleted, only the main sheet is usable */
|
2008-02-26 01:07:38 +00:00
|
|
|
m_CurrentSheet->Clear();
|
|
|
|
SaveSettings();
|
|
|
|
Destroy();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
int WinEDA_SchematicFrame::BestZoom()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
int dx, dy;
|
2008-02-26 01:07:38 +00:00
|
|
|
wxSize size;
|
2009-04-05 20:49:15 +00:00
|
|
|
double zoom;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
dx = GetScreen()->m_CurrentSheetDesc->m_Size.x;
|
|
|
|
dy = GetScreen()->m_CurrentSheetDesc->m_Size.y;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
size = DrawPanel->GetClientSize();
|
|
|
|
zoom = MAX( (double) dx / (double) size.x,
|
2009-11-04 20:46:53 +00:00
|
|
|
(double) dy / (double) size.y );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->m_Curseur.x = dx / 2;
|
|
|
|
GetScreen()->m_Curseur.y = dy / 2;
|
2008-04-14 19:22:48 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
return wxRound( zoom * (double) GetScreen()->m_ZoomScalar );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2009-01-08 20:29:07 +00:00
|
|
|
/** Function GetUniqueFilenameForCurrentSheet
|
|
|
|
* @return a filename that can be used in plot and print functions
|
2009-11-04 20:46:53 +00:00
|
|
|
* for the current screen and sheet path.
|
2009-04-16 08:48:54 +00:00
|
|
|
* This filename is unique and must be used insteed of the screen filename
|
2009-11-04 20:46:53 +00:00
|
|
|
* (or sheet filename) when one must creates file for each sheet in the
|
|
|
|
* heierarchy.
|
|
|
|
* because in complex hierarchies a sheet and a SCH_SCREEN is used more than
|
|
|
|
* once
|
2009-01-08 20:29:07 +00:00
|
|
|
* Name is <root sheet filename>-<sheet path>
|
|
|
|
* and has no extension.
|
|
|
|
* However if filename is too long name is <sheet filename>-<sheet number>
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet()
|
|
|
|
{
|
2009-04-16 08:48:54 +00:00
|
|
|
wxFileName fn = g_RootSheet->GetFileName();
|
2009-11-04 20:46:53 +00:00
|
|
|
wxString filename = fn.GetName();
|
2009-01-08 20:29:07 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
if( ( filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < 50 )
|
2009-01-08 20:29:07 +00:00
|
|
|
{
|
|
|
|
filename += m_CurrentSheet->PathHumanReadable();
|
|
|
|
filename.Replace( wxT( "/" ), wxT( "-" ) );
|
|
|
|
filename.RemoveLast();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
filename << wxT( "-" ) << GetScreen()->m_ScreenNumber;
|
2009-01-08 20:29:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return filename;
|
|
|
|
}
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
/*****************************************************************************
|
2009-11-04 20:46:53 +00:00
|
|
|
* Enable or disable menu entry and toolbar buttons according to current
|
|
|
|
* conditions.
|
|
|
|
*****************************************************************************/
|
2009-04-29 17:09:00 +00:00
|
|
|
|
|
|
|
void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event )
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
bool enable = ( GetScreen()
|
|
|
|
&& GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE );
|
|
|
|
|
|
|
|
event.Enable( enable );
|
2009-04-29 17:09:00 +00:00
|
|
|
m_HToolBar->EnableTool( wxID_CUT, enable );
|
|
|
|
m_HToolBar->EnableTool( wxID_COPY, enable );
|
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
void WinEDA_SchematicFrame::OnUpdatePaste( wxUpdateUIEvent& event )
|
|
|
|
{
|
2009-07-25 04:53:39 +00:00
|
|
|
event.Enable( g_BlockSaveDataList.GetCount() > 0 );
|
|
|
|
m_HToolBar->EnableTool( wxID_PASTE, g_BlockSaveDataList.GetCount() > 0 );
|
2009-04-29 17:09:00 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
void WinEDA_SchematicFrame::OnUpdateSchematicUndo( wxUpdateUIEvent& event )
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
if( GetScreen() )
|
2009-07-23 15:37:00 +00:00
|
|
|
event.Enable( GetScreen()->GetUndoCommandCount() > 0 );
|
2009-04-29 17:09:00 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
void WinEDA_SchematicFrame::OnUpdateSchematicRedo( wxUpdateUIEvent& event )
|
|
|
|
{
|
2009-11-04 20:46:53 +00:00
|
|
|
if( GetScreen() )
|
2009-07-23 15:37:00 +00:00
|
|
|
event.Enable( GetScreen()->GetRedoCommandCount() > 0 );
|
2009-04-29 17:09:00 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
void WinEDA_SchematicFrame::OnUpdateBusOrientation( wxUpdateUIEvent& event )
|
|
|
|
{
|
|
|
|
wxString tool_tip = g_HVLines ?
|
2009-12-02 21:44:03 +00:00
|
|
|
_( "Draw wires and buses in any direction" ) :
|
|
|
|
_( "Draw horizontal and vertical wires and buses only" );
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, g_HVLines );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT,
|
|
|
|
tool_tip );
|
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
void WinEDA_SchematicFrame::OnUpdateHiddenPins( wxUpdateUIEvent& event )
|
|
|
|
{
|
|
|
|
wxString tool_tip = m_ShowAllPins ? _( "Do not show hidden pins" ) :
|
2009-11-04 20:46:53 +00:00
|
|
|
_( "Show hidden pins" );
|
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_HIDDEN_PINS, m_ShowAllPins );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, tool_tip );
|
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
void WinEDA_SchematicFrame::OnUpdateSelectCursor( wxUpdateUIEvent& event )
|
|
|
|
{
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, m_CursorShape );
|
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
void WinEDA_SchematicFrame::OnUpdateUnits( wxUpdateUIEvent& event )
|
|
|
|
{
|
|
|
|
bool is_metric = g_UnitMetric == MILLIMETRE ? true : false;
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, is_metric );
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, !is_metric );
|
|
|
|
DisplayUnitsMsg();
|
|
|
|
}
|
|
|
|
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
void WinEDA_SchematicFrame::OnUpdateGrid( wxUpdateUIEvent& event )
|
|
|
|
{
|
|
|
|
wxString tool_tip = m_Draw_Grid ? _( "Hide grid" ) : _( "Show grid" );
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, m_Draw_Grid );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event )
|
|
|
|
{
|
2009-10-27 19:30:32 +00:00
|
|
|
DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this );
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-26 01:07:38 +00:00
|
|
|
dlg->ShowModal();
|
|
|
|
dlg->Destroy();
|
|
|
|
}
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event )
|
|
|
|
{
|
2009-07-03 18:25:06 +00:00
|
|
|
DIALOG_ERC* dlg = new DIALOG_ERC( this );
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
dlg->ShowModal();
|
|
|
|
dlg->Destroy();
|
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2009-04-29 17:09:00 +00:00
|
|
|
if( m_NetlistFormat < NET_TYPE_PCBNEW )
|
|
|
|
m_NetlistFormat = NET_TYPE_PCBNEW;
|
2008-02-27 19:38:16 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
WinEDA_NetlistFrame* dlg = new WinEDA_NetlistFrame( this );
|
|
|
|
i = dlg->ShowModal();
|
|
|
|
dlg->Destroy();
|
|
|
|
} while( i == NET_PLUGIN_CHANGE );
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
// If a plugin is removed or added, rebuild and reopen the new dialog
|
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
|
|
|
void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent& )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2009-03-12 15:24:52 +00:00
|
|
|
DIALOG_BUILD_BOM* dlg = new DIALOG_BUILD_BOM( this );
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
dlg->ShowModal();
|
|
|
|
dlg->Destroy();
|
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
this->DrawPanel->m_IgnoreMouseEvents = TRUE;
|
|
|
|
WinEDA_FindFrame* dlg = new WinEDA_FindFrame( this );
|
|
|
|
dlg->ShowModal();
|
|
|
|
dlg->Destroy();
|
|
|
|
this->DrawPanel->m_IgnoreMouseEvents = FALSE;
|
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
|
|
|
|
{
|
2009-01-17 20:31:19 +00:00
|
|
|
wxString fn;
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2009-01-17 20:31:19 +00:00
|
|
|
fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
|
|
|
|
|
|
|
|
if( fn != wxEmptyString )
|
|
|
|
{
|
|
|
|
LoadOneEEProject( fn, false );
|
|
|
|
SetToolbars();
|
|
|
|
}
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
2008-05-07 15:08:16 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-05-07 15:08:16 +00:00
|
|
|
void WinEDA_SchematicFrame::OnLoadStuffFile( wxCommandEvent& event )
|
|
|
|
{
|
2009-01-04 18:52:57 +00:00
|
|
|
ReadInputStuffFile();
|
2008-05-15 15:59:11 +00:00
|
|
|
DrawPanel->Refresh();
|
2008-05-07 15:08:16 +00:00
|
|
|
}
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
void WinEDA_SchematicFrame::OnNewProject( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
LoadOneEEProject( wxEmptyString, true );
|
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
void WinEDA_SchematicFrame::OnLoadProject( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
LoadOneEEProject( wxEmptyString, false );
|
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event )
|
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
if( fn.IsOk() )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
fn.ClearExt();
|
|
|
|
ExecuteFile( this, PCBNEW_EXE, QuoteFullPath( fn ) );
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ExecuteFile( this, PCBNEW_EXE );
|
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event )
|
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
2009-11-04 20:46:53 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
fn.SetExt( NetlistFileExtension );
|
2008-02-27 19:38:16 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
if( fn.IsOk() && fn.FileExists() )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
ExecuteFile( this, CVPCB_EXE, QuoteFullPath( fn ) );
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ExecuteFile( this, CVPCB_EXE );
|
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
|
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
if( m_ViewlibFrame )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
m_ViewlibFrame->Show( TRUE );
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
m_ViewlibFrame = new WinEDA_ViewlibFrame( this );
|
|
|
|
m_ViewlibFrame->AdjustScrollBars();
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event )
|
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
if( m_LibeditFrame )
|
2008-02-27 19:38:16 +00:00
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
m_LibeditFrame->Show( TRUE );
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
m_LibeditFrame = new WinEDA_LibeditFrame( this,
|
2009-01-07 15:59:49 +00:00
|
|
|
wxT( "Library Editor" ),
|
|
|
|
wxPoint( -1, -1 ),
|
|
|
|
wxSize( 600, 400 ) );
|
2009-09-25 18:49:04 +00:00
|
|
|
ActiveScreen = GetBaseScreen();
|
2008-12-08 15:27:13 +00:00
|
|
|
m_LibeditFrame->AdjustScrollBars();
|
2008-02-27 19:38:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-04 18:52:57 +00:00
|
|
|
|
2008-02-27 19:38:16 +00:00
|
|
|
void WinEDA_SchematicFrame::OnExit( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
Close( true );
|
|
|
|
}
|