2007-06-05 12:10:51 +00:00
|
|
|
/****************************************************************/
|
|
|
|
/* pcbframe.cpp - fonctions des classes du type WinEDA_PcbFrame */
|
|
|
|
/****************************************************************/
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "appl_wxstruct.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
2009-02-05 20:53:08 +00:00
|
|
|
#include "confirm.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "pcbnew.h"
|
2007-09-12 02:14:07 +00:00
|
|
|
#include "collectors.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "bitmaps.h"
|
|
|
|
#include "protos.h"
|
|
|
|
#include "id.h"
|
2007-12-01 03:42:52 +00:00
|
|
|
#include "drc_stuff.h"
|
2009-02-05 20:53:08 +00:00
|
|
|
#include "3d_viewer.h"
|
2008-11-14 19:38:58 +00:00
|
|
|
#include "kbool/include/kbool/booleng.h"
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-02-07 08:33:25 +00:00
|
|
|
// Keys used in read/write config
|
2009-02-07 14:13:16 +00:00
|
|
|
#define PCB_CURR_GRID wxT( "PcbCurrGrid" )
|
2009-02-07 08:33:25 +00:00
|
|
|
#define PCB_MAGNETIC_PADS_OPT wxT( "PcbMagPadOpt" )
|
|
|
|
#define PCB_MAGNETIC_TRACKS_OPT wxT( "PcbMagTrackOpt" )
|
|
|
|
#define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" )
|
|
|
|
|
2009-02-07 14:13:16 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
/*******************************/
|
|
|
|
/* class WinEDA_PcbFrame */
|
|
|
|
/*******************************/
|
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, WinEDA_PcbFrame::OnSockRequestServer )
|
|
|
|
EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_PcbFrame::OnSockRequest )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom )
|
|
|
|
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_PcbFrame::OnSelectGrid )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_CLOSE( WinEDA_PcbFrame::OnCloseWindow )
|
|
|
|
EVT_SIZE( WinEDA_PcbFrame::OnSize )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
2009-01-07 15:59:49 +00:00
|
|
|
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_PcbFrame::OnZoom )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_TOOL( ID_LOAD_FILE, WinEDA_PcbFrame::Files_io )
|
|
|
|
EVT_TOOL( ID_MENU_READ_LAST_SAVED_VERSION_BOARD, WinEDA_PcbFrame::Files_io )
|
|
|
|
EVT_TOOL( ID_MENU_RECOVER_BOARD, WinEDA_PcbFrame::Files_io )
|
|
|
|
EVT_TOOL( ID_NEW_BOARD, WinEDA_PcbFrame::Files_io )
|
|
|
|
EVT_TOOL( ID_SAVE_BOARD, WinEDA_PcbFrame::Files_io )
|
|
|
|
EVT_TOOL( ID_OPEN_MODULE_EDITOR, WinEDA_PcbFrame::Process_Special_Functions )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_MENU_RANGE( ID_PREFERENCES_FONT_INFOSCREEN, ID_PREFERENCES_FONT_END,
|
|
|
|
WinEDA_DrawFrame::ProcessFontPreferences )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
|
|
|
// Menu Files:
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_MENU( ID_MAIN_MENUBAR, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
|
|
|
|
EVT_MENU( ID_MENU_LOAD_FILE, WinEDA_PcbFrame::Files_io )
|
|
|
|
EVT_MENU( ID_MENU_NEW_BOARD, WinEDA_PcbFrame::Files_io )
|
|
|
|
EVT_MENU( ID_MENU_SAVE_BOARD, WinEDA_PcbFrame::Files_io )
|
|
|
|
EVT_MENU( ID_MENU_APPEND_FILE, WinEDA_PcbFrame::Files_io )
|
|
|
|
EVT_MENU( ID_MENU_SAVE_BOARD_AS, WinEDA_PcbFrame::Files_io )
|
2009-01-18 13:14:50 +00:00
|
|
|
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_PcbFrame::OnFileHistory )
|
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_MENU( ID_GEN_PLOT, WinEDA_PcbFrame::ToPlotter )
|
|
|
|
|
|
|
|
EVT_MENU( ID_GEN_EXPORT_SPECCTRA, WinEDA_PcbFrame::ExportToSpecctra )
|
|
|
|
EVT_MENU( ID_GEN_EXPORT_FILE_GENCADFORMAT, WinEDA_PcbFrame::ExportToGenCAD )
|
|
|
|
EVT_MENU( ID_GEN_EXPORT_FILE_MODULE_REPORT,
|
|
|
|
WinEDA_PcbFrame::GenModuleReport )
|
|
|
|
|
|
|
|
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION,
|
|
|
|
WinEDA_PcbFrame::ImportSpecctraSession )
|
|
|
|
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_DESIGN,
|
|
|
|
WinEDA_PcbFrame::ImportSpecctraDesign )
|
|
|
|
|
|
|
|
EVT_MENU( ID_MENU_ARCHIVE_NEW_MODULES,
|
|
|
|
WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_MENU( ID_MENU_ARCHIVE_ALL_MODULES,
|
|
|
|
WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
|
|
|
|
EVT_MENU( ID_EXIT, WinEDA_PcbFrame::Process_Special_Functions )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
|
|
|
// menu Config
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START,
|
|
|
|
ID_CONFIG_AND_PREFERENCES_END,
|
|
|
|
WinEDA_PcbFrame::Process_Config )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_MENU( ID_COLORS_SETUP, WinEDA_PcbFrame::Process_Config )
|
|
|
|
EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config )
|
|
|
|
EVT_MENU( ID_PCB_TRACK_SIZE_SETUP, WinEDA_PcbFrame::Process_Config )
|
|
|
|
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config )
|
|
|
|
EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config )
|
|
|
|
EVT_MENU( ID_PCB_LOOK_SETUP, WinEDA_PcbFrame::Process_Config )
|
|
|
|
EVT_MENU( ID_CONFIG_SAVE, WinEDA_PcbFrame::Process_Config )
|
|
|
|
EVT_MENU( ID_CONFIG_READ, WinEDA_PcbFrame::Process_Config )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_MENU( ID_PCB_USER_GRID_SETUP,
|
|
|
|
WinEDA_PcbFrame::Process_Special_Functions )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
|
|
|
|
WinEDA_DrawFrame::SetLanguage )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
|
|
|
// menu Postprocess
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_MENU( ID_PCB_GEN_POS_MODULES_FILE, WinEDA_PcbFrame::GenModulesPosition )
|
|
|
|
EVT_MENU( ID_PCB_GEN_DRILL_FILE, WinEDA_PcbFrame::InstallDrillFrame )
|
2009-03-30 15:36:41 +00:00
|
|
|
EVT_MENU( ID_PCB_GEN_CMP_FILE, WinEDA_PcbFrame::RecreateCmpFileFromBoard )
|
|
|
|
EVT_MENU( ID_PCB_GEN_BOM_FILE_FROM_BOARD, WinEDA_PcbFrame::RecreateBOMFileFromBoard )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
|
|
|
// menu Miscellaneous
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_MENU( ID_MENU_LIST_NETS, WinEDA_PcbFrame::Liste_Equipot )
|
|
|
|
EVT_MENU( ID_PCB_GLOBAL_DELETE, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_MENU( ID_MENU_PCB_CLEAN, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_MENU( ID_MENU_PCB_SWAP_LAYERS,
|
|
|
|
WinEDA_PcbFrame::Process_Special_Functions )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
|
|
|
// Menu Help
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
|
|
|
|
EVT_MENU( ID_KICAD_ABOUT, WinEDA_BasicFrame::GetKicadAbout )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
|
|
|
// Menu 3D Frame
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_PcbFrame::Show3D_Frame )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
|
|
|
// Horizontal toolbar
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_TOOL( ID_TO_LIBRARY, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
|
|
|
|
EVT_TOOL( wxID_CUT, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( wxID_COPY, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( wxID_PASTE, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_UNDO_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_GEN_PRINT, WinEDA_DrawFrame::ToPrinter )
|
2009-01-11 19:12:18 +00:00
|
|
|
EVT_TOOL( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print )
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_TOOL( ID_GEN_PLOT, WinEDA_DrawFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_FIND_ITEMS, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_GET_NETLIST, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_DRC_CONTROL, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
|
|
|
|
WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
|
|
|
|
WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER,
|
|
|
|
WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
|
|
|
|
WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE,
|
|
|
|
WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_TOOLBARH_PCB_AUTOPLACE, WinEDA_PcbFrame::AutoPlace )
|
|
|
|
EVT_TOOL( ID_TOOLBARH_PCB_AUTOROUTE, WinEDA_PcbFrame::AutoPlace )
|
|
|
|
EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS,
|
|
|
|
WinEDA_PcbFrame::Access_to_External_Tool )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
|
|
|
// Option toolbar
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
|
|
|
|
WinEDA_PcbFrame::OnSelectOptionToolbar )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
|
|
|
// Vertical toolbar:
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_PCB_HIGHLIGHT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_COMPONENT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_TRACK_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_PCB_ZONES_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_PCB_MIRE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_PCB_ARC_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_TEXT_COMMENT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_LINE_COMMENT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_PCB_COTATION_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_PCB_DELETE_ITEM_BUTT,
|
|
|
|
WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_PCB_SHOW_1_RATSNEST_BUTT,
|
|
|
|
WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
EVT_TOOL( ID_PCB_PLACE_OFFSET_COORD_BUTT,
|
|
|
|
WinEDA_PcbFrame::Process_Special_Functions )
|
|
|
|
|
|
|
|
EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
|
|
|
|
WinEDA_PcbFrame::ProcessMuWaveFunctions )
|
|
|
|
|
|
|
|
EVT_TOOL_RCLICKED( ID_TRACK_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
|
|
|
|
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
|
|
|
|
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
|
|
|
|
EVT_TOOL_RCLICKED( ID_TEXT_COMMENT_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
|
|
|
|
EVT_TOOL_RCLICKED( ID_LINE_COMMENT_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
|
|
|
|
EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
|
|
|
|
|
|
|
|
EVT_MENU_RANGE( ID_POPUP_PCB_AUTOPLACE_START_RANGE,
|
|
|
|
ID_POPUP_PCB_AUTOPLACE_END_RANGE,
|
|
|
|
WinEDA_PcbFrame::AutoPlace )
|
|
|
|
|
|
|
|
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
|
|
|
|
WinEDA_PcbFrame::Process_Special_Functions )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
|
|
|
// Annulation de commande en cours
|
2008-12-05 16:03:05 +00:00
|
|
|
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
|
|
|
WinEDA_PcbFrame::Process_Special_Functions )
|
2008-06-04 13:17:33 +00:00
|
|
|
|
|
|
|
// PopUp Menus pour Zooms traites dans drawpanel.cpp
|
2007-08-20 01:20:48 +00:00
|
|
|
END_EVENT_TABLE()
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
///////****************************///////////:
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
/****************/
|
|
|
|
/* Constructeur */
|
|
|
|
/****************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-08 15:27:13 +00:00
|
|
|
WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
|
2007-08-20 01:20:48 +00:00
|
|
|
const wxString& title,
|
2007-10-27 12:24:09 +00:00
|
|
|
const wxPoint& pos, const wxSize& size,
|
2008-06-04 13:17:33 +00:00
|
|
|
long style ) :
|
2008-12-08 15:27:13 +00:00
|
|
|
WinEDA_BasePcbFrame( father, PCB_FRAME, title, pos, size, style )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-12-08 15:27:13 +00:00
|
|
|
wxConfig* config = wxGetApp().m_EDA_Config;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
m_FrameName = wxT( "PcbFrame" );
|
2009-04-05 20:49:15 +00:00
|
|
|
m_Draw_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche dessine
|
2007-08-20 01:20:48 +00:00
|
|
|
m_Draw_Auxiliary_Axis = TRUE;
|
|
|
|
m_SelTrackWidthBox = NULL;
|
|
|
|
m_SelViaSizeBox = NULL;
|
|
|
|
m_SelLayerBox = NULL;
|
|
|
|
m_SelTrackWidthBox_Changed = FALSE;
|
|
|
|
m_SelViaSizeBox_Changed = FALSE;
|
2007-12-01 03:42:52 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
SetBoard( new BOARD( NULL, this ) );
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2009-01-17 20:31:19 +00:00
|
|
|
m_drc = new DRC( this ); // these 2 objects point to each other
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
|
|
|
|
m_DisplayPadFill = DisplayOpt.DisplayPadFill;
|
|
|
|
m_DisplayPadNum = DisplayOpt.DisplayPadNum;
|
|
|
|
|
|
|
|
m_DisplayModEdge = DisplayOpt.DisplayModEdge;
|
|
|
|
m_DisplayModText = DisplayOpt.DisplayModText;
|
|
|
|
|
|
|
|
// Give an icon
|
|
|
|
SetIcon( wxICON( a_icon_pcbnew ) );
|
|
|
|
|
|
|
|
m_InternalUnits = PCB_INTERNAL_UNIT; // Unites internes = 1/10000 inch
|
2008-04-17 16:25:29 +00:00
|
|
|
SetBaseScreen( ScreenPcb );
|
2009-04-05 20:49:15 +00:00
|
|
|
LoadSettings();
|
2007-08-20 01:20:48 +00:00
|
|
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
|
|
|
|
2009-02-07 14:13:16 +00:00
|
|
|
wxRealPoint GridSize( 500, 500 ); // Default current grid size
|
2008-12-08 15:27:13 +00:00
|
|
|
|
|
|
|
if( config )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-02-07 08:33:25 +00:00
|
|
|
config->Read( PCB_MAGNETIC_PADS_OPT, &g_MagneticPadOption );
|
2009-04-05 20:49:15 +00:00
|
|
|
config->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2009-02-07 14:13:16 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnits, ID_POPUP_GRID_USER );
|
2007-08-20 01:20:48 +00:00
|
|
|
GetScreen()->SetGrid( GridSize );
|
|
|
|
|
|
|
|
if( DrawPanel )
|
|
|
|
DrawPanel->m_Block_Enable = TRUE;
|
|
|
|
ReCreateMenuBar();
|
|
|
|
ReCreateHToolbar();
|
|
|
|
ReCreateAuxiliaryToolbar();
|
|
|
|
ReCreateVToolbar();
|
2008-12-06 12:49:33 +00:00
|
|
|
if( config )
|
|
|
|
{
|
2009-02-07 14:13:16 +00:00
|
|
|
long gridselection = 1;
|
|
|
|
config->Read( PCB_CURR_GRID, &gridselection );
|
|
|
|
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + gridselection );
|
2008-12-06 12:49:33 +00:00
|
|
|
long display_microwave_tools = 0;
|
2009-02-07 08:33:25 +00:00
|
|
|
config->Read( SHOW_MICROWAVE_TOOLS, &display_microwave_tools );
|
2008-12-06 12:49:33 +00:00
|
|
|
if ( display_microwave_tools )
|
|
|
|
ReCreateAuxVToolbar();
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
ReCreateOptToolbar();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-06-04 13:17:33 +00:00
|
|
|
|
2008-05-30 18:06:21 +00:00
|
|
|
/************************************/
|
2007-09-01 12:00:30 +00:00
|
|
|
WinEDA_PcbFrame::~WinEDA_PcbFrame()
|
2008-05-30 18:06:21 +00:00
|
|
|
/************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-03-28 20:02:34 +00:00
|
|
|
extern PARAM_CFG_BASE* ParamCfgList[];
|
|
|
|
wxGetApp().SaveCurrentSetupValues( ParamCfgList );
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
SetBaseScreen( ScreenPcb );
|
|
|
|
|
2007-12-01 03:42:52 +00:00
|
|
|
delete m_drc;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
if( GetBoard() != g_ModuleEditor_Pcb )
|
|
|
|
delete GetBoard();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
|
2007-06-05 12:10:51 +00:00
|
|
|
/********************************************************/
|
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
PCB_SCREEN* screen;
|
2008-12-08 15:27:13 +00:00
|
|
|
wxConfig * config = wxGetApp().m_EDA_Config;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
DrawPanel->m_AbortRequest = TRUE;
|
|
|
|
|
|
|
|
screen = ScreenPcb;
|
|
|
|
while( screen )
|
|
|
|
{
|
|
|
|
if( screen->IsModify() )
|
|
|
|
break;
|
|
|
|
screen = screen->Next();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( screen )
|
|
|
|
{
|
2008-06-04 13:17:33 +00:00
|
|
|
unsigned ii;
|
2007-08-20 01:20:48 +00:00
|
|
|
wxMessageDialog dialog( this, _( "Board modified, Save before exit ?" ),
|
2008-12-05 16:03:05 +00:00
|
|
|
_( "Confirmation" ),
|
|
|
|
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION |
|
2007-08-20 01:20:48 +00:00
|
|
|
wxYES_DEFAULT );
|
|
|
|
|
|
|
|
ii = dialog.ShowModal();
|
|
|
|
|
|
|
|
switch( ii )
|
|
|
|
{
|
|
|
|
case wxID_CANCEL:
|
|
|
|
Event.Veto();
|
|
|
|
return;
|
|
|
|
|
|
|
|
case wxID_NO:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case wxID_OK:
|
|
|
|
case wxID_YES:
|
|
|
|
SavePcbFile( GetScreen()->m_FileName );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-07 14:13:16 +00:00
|
|
|
while( screen ) // Remove modify flag, to avoi others messages
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
screen->ClrModify();
|
|
|
|
screen = screen->Next();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Reselection de l'ecran de base,
|
|
|
|
* pour les evenements de refresh generes par wxWindows */
|
2008-04-17 16:25:29 +00:00
|
|
|
SetBaseScreen( ActiveScreen = ScreenPcb );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
SaveSettings();
|
2008-12-08 15:27:13 +00:00
|
|
|
if( config )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-02-07 08:33:25 +00:00
|
|
|
wxRealPoint GridSize = GetScreen()->GetGrid();
|
2009-02-07 14:13:16 +00:00
|
|
|
|
|
|
|
config->Write( PCB_CURR_GRID, m_SelGridBox->GetSelection() );
|
2009-02-07 08:33:25 +00:00
|
|
|
config->Write( PCB_MAGNETIC_PADS_OPT, (long) g_MagneticPadOption );
|
|
|
|
config->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption );
|
|
|
|
config->Write( SHOW_MICROWAVE_TOOLS, (long) m_AuxVToolBar ? 1 : 0 );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
Destroy();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************/
|
2007-09-01 12:00:30 +00:00
|
|
|
void WinEDA_PcbFrame::SetToolbars()
|
2007-06-05 12:10:51 +00:00
|
|
|
/***************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*
|
2007-08-20 01:20:48 +00:00
|
|
|
* Active ou desactive les tools des toolbars, en fonction des commandes
|
|
|
|
* en cours
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-12-05 16:03:05 +00:00
|
|
|
size_t i;
|
2007-08-20 01:20:48 +00:00
|
|
|
int ii, jj;
|
|
|
|
|
|
|
|
if( m_ID_current_state == ID_TRACK_BUTT )
|
|
|
|
{
|
|
|
|
if( Drc_On )
|
|
|
|
DrawPanel->SetCursor( wxCursor( wxCURSOR_PENCIL ) );
|
|
|
|
else
|
|
|
|
DrawPanel->SetCursor( wxCursor( wxCURSOR_QUESTION_ARROW ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( m_HToolBar == NULL )
|
|
|
|
return;
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
m_HToolBar->EnableTool( ID_SAVE_BOARD, GetScreen()->IsModify() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
if( GetScreen()->BlockLocate.m_Command == BLOCK_MOVE )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
m_HToolBar->EnableTool( wxID_CUT, TRUE );
|
|
|
|
m_HToolBar->EnableTool( wxID_COPY, TRUE );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_HToolBar->EnableTool( wxID_CUT, FALSE );
|
|
|
|
m_HToolBar->EnableTool( wxID_COPY, FALSE );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( g_UnDeleteStackPtr )
|
|
|
|
{
|
|
|
|
m_HToolBar->EnableTool( wxID_PASTE, TRUE );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_HToolBar->EnableTool( wxID_PASTE, FALSE );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( g_UnDeleteStackPtr )
|
|
|
|
{
|
|
|
|
m_HToolBar->EnableTool( ID_UNDO_BUTT, TRUE );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
m_HToolBar->EnableTool( ID_UNDO_BUTT, FALSE );
|
|
|
|
|
|
|
|
if( m_OptionsToolBar )
|
|
|
|
{
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_DRC_OFF,
|
|
|
|
!Drc_On );
|
2008-12-05 16:03:05 +00:00
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF,
|
|
|
|
Drc_On ?
|
|
|
|
_( "DRC Off (Disable !!!), Currently: DRC is active" ) :
|
|
|
|
_( "DRC On (Currently: DRC is inactive !!!)" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM,
|
|
|
|
g_UnitMetric == MILLIMETRE ? TRUE : FALSE );
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
|
|
|
|
g_UnitMetric == INCHES ? TRUE : FALSE );
|
|
|
|
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
|
|
|
|
DisplayOpt.DisplayPolarCood );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
|
2008-12-05 16:03:05 +00:00
|
|
|
DisplayOpt.DisplayPolarCood ?
|
|
|
|
_( "Polar Coords not show" ) :
|
|
|
|
_( "Display Polar Coords" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
|
|
|
|
m_Draw_Grid );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
|
2008-12-05 16:03:05 +00:00
|
|
|
m_Draw_Grid ? _( "Grid not show" ) : _( "Show Grid" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
|
2009-04-05 20:49:15 +00:00
|
|
|
m_CursorShape );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_RATSNEST,
|
|
|
|
g_Show_Ratsnest );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST,
|
2008-12-05 16:03:05 +00:00
|
|
|
g_Show_Ratsnest ?
|
|
|
|
_( "Hide General ratsnest" ) :
|
|
|
|
_( "Show General ratsnest" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
|
|
|
|
g_Show_Module_Ratsnest );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST,
|
2008-12-05 16:03:05 +00:00
|
|
|
g_Show_Module_Ratsnest ?
|
|
|
|
_( "Hide Module ratsnest" ) :
|
|
|
|
_( "Show Module ratsnest" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_AUTO_DEL_TRACK,
|
|
|
|
g_AutoDeleteOldTrack );
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_AUTO_DEL_TRACK,
|
2008-12-05 16:03:05 +00:00
|
|
|
g_AutoDeleteOldTrack ?
|
|
|
|
_( "Disable Auto Delete old Track" ) :
|
|
|
|
_( "Enable Auto Delete old Track" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
|
|
|
|
!m_DisplayPadFill );
|
2008-12-12 21:30:07 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
|
2008-12-05 16:03:05 +00:00
|
|
|
m_DisplayPadFill ?
|
|
|
|
_( "Show Pads Sketch mode" ) :
|
|
|
|
_( "Show pads filled mode" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
|
|
|
|
!m_DisplayPcbTrackFill );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
|
2008-12-05 16:03:05 +00:00
|
|
|
m_DisplayPcbTrackFill ?
|
|
|
|
_( "Show Tracks Sketch mode" ) :
|
|
|
|
_( "Show Tracks filled mode" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE,
|
|
|
|
DisplayOpt.ContrastModeDisplay );
|
|
|
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE,
|
2008-12-05 16:03:05 +00:00
|
|
|
DisplayOpt.ContrastModeDisplay ?
|
|
|
|
_( "Normal Contrast Mode Display" ) :
|
|
|
|
_( "Hight Contrast Mode Display" ) );
|
2008-12-06 12:49:33 +00:00
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, m_AuxVToolBar ? true : false );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( m_AuxiliaryToolBar )
|
|
|
|
{
|
|
|
|
wxString msg;
|
2008-01-28 18:44:14 +00:00
|
|
|
m_AuxiliaryToolBar->ToggleTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
|
2008-06-04 13:17:33 +00:00
|
|
|
g_DesignSettings.m_UseConnectedTrackWidth );
|
2007-08-20 01:20:48 +00:00
|
|
|
if( m_SelTrackWidthBox && m_SelTrackWidthBox_Changed )
|
|
|
|
{
|
|
|
|
m_SelTrackWidthBox_Changed = FALSE;
|
|
|
|
m_SelTrackWidthBox->Clear();
|
|
|
|
wxString format = _( "Track" );
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
if( g_UnitMetric == INCHES )
|
|
|
|
format += wxT( " %.1f" );
|
|
|
|
else
|
|
|
|
format += wxT( " %.3f" );
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2008-01-26 02:02:27 +00:00
|
|
|
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2008-01-26 02:02:27 +00:00
|
|
|
if( g_DesignSettings.m_TrackWidthHistory[ii] == 0 )
|
2008-06-04 13:17:33 +00:00
|
|
|
break; // Fin de liste
|
2007-08-20 01:20:48 +00:00
|
|
|
double value = To_User_Unit( g_UnitMetric,
|
2008-01-26 02:02:27 +00:00
|
|
|
g_DesignSettings.m_TrackWidthHistory[ii],
|
2007-08-20 01:20:48 +00:00
|
|
|
PCB_INTERNAL_UNIT );
|
|
|
|
|
|
|
|
if( g_UnitMetric == INCHES )
|
|
|
|
msg.Printf( format.GetData(), value * 1000 );
|
|
|
|
else
|
|
|
|
msg.Printf( format.GetData(), value );
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
m_SelTrackWidthBox->Append( msg );
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2008-01-26 02:02:27 +00:00
|
|
|
if( g_DesignSettings.m_TrackWidthHistory[ii] ==
|
2008-06-04 13:17:33 +00:00
|
|
|
g_DesignSettings.m_CurrentTrackWidth )
|
2007-08-20 01:20:48 +00:00
|
|
|
m_SelTrackWidthBox->SetSelection( ii );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_SelViaSizeBox && m_SelViaSizeBox_Changed )
|
|
|
|
{
|
|
|
|
m_SelViaSizeBox_Changed = FALSE;
|
|
|
|
m_SelViaSizeBox->Clear();
|
|
|
|
wxString format = _( "Via" );
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
if( g_UnitMetric == INCHES )
|
|
|
|
format += wxT( " %.1f" );
|
|
|
|
else
|
|
|
|
format += wxT( " %.3f" );
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2008-01-26 02:02:27 +00:00
|
|
|
for( ii = 0; ii < HISTORY_NUMBER; ii++ )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
if( g_DesignSettings.m_ViaSizeHistory[ii] == 0 )
|
2008-06-04 13:17:33 +00:00
|
|
|
break; // Fin de liste
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
double value = To_User_Unit( g_UnitMetric,
|
|
|
|
g_DesignSettings.m_ViaSizeHistory[ii],
|
|
|
|
PCB_INTERNAL_UNIT );
|
|
|
|
|
|
|
|
if( g_UnitMetric == INCHES )
|
|
|
|
msg.Printf( format.GetData(), value * 1000 );
|
|
|
|
else
|
|
|
|
msg.Printf( format.GetData(), value );
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
m_SelViaSizeBox->Append( msg );
|
|
|
|
if( g_DesignSettings.m_ViaSizeHistory[ii] == g_DesignSettings.m_CurrentViaSize )
|
|
|
|
m_SelViaSizeBox->SetSelection( ii );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( m_SelZoomBox )
|
|
|
|
{
|
2009-02-06 11:45:35 +00:00
|
|
|
bool not_found = true;
|
2009-01-29 14:26:20 +00:00
|
|
|
for( jj = 0; jj < (int)GetScreen()->m_ZoomList.GetCount(); jj++ )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-01-29 14:26:20 +00:00
|
|
|
if( GetScreen()->GetZoom() == GetScreen()->m_ZoomList[jj] )
|
|
|
|
{
|
|
|
|
m_SelZoomBox->SetSelection( jj + 1 );
|
2009-02-06 11:45:35 +00:00
|
|
|
not_found = false;
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2009-01-29 14:26:20 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2009-02-06 11:45:35 +00:00
|
|
|
if ( not_found )
|
|
|
|
m_SelZoomBox->SetSelection( -1 );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
if( m_SelGridBox && GetScreen() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
int kk = m_SelGridBox->GetChoice();
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2008-12-05 16:03:05 +00:00
|
|
|
if( GetScreen()->GetGrid() == GetScreen()->m_GridList[i].m_Size )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2008-12-05 16:03:05 +00:00
|
|
|
if( kk != ( int ) i )
|
|
|
|
m_SelGridBox->SetSelection( ( int ) i );
|
|
|
|
kk = ( int ) i;
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-29 13:35:26 +00:00
|
|
|
UpdateToolbarLayerInfo();
|
2007-08-20 01:20:48 +00:00
|
|
|
PrepareLayerIndicator();
|
|
|
|
DisplayUnitsMsg();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2009-02-05 20:53:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Display 3D frame of current printed circuit board.
|
|
|
|
*/
|
|
|
|
void WinEDA_PcbFrame::Show3D_Frame( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
if( m_Draw3DFrame )
|
|
|
|
{
|
|
|
|
DisplayInfo( this, _( "3D Frame already opened" ) );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, _( "3D Viewer" ) );
|
|
|
|
m_Draw3DFrame->Show( TRUE );
|
|
|
|
}
|