Commit 92676ee0 authored by jean-pierre charras's avatar jean-pierre charras

added " pcbnew module editor toolbar items now in menubar" patch from Jerry...

added " pcbnew module editor toolbar items now in menubar" patch from Jerry Jacobs. Fixed TODO, and some issues.
Fixed some minor translation issues (different help texts for the same command in tools and menus).
minor code cleaning.
fixed minor warnings in debug mode.
parents 3aabdd26 0a635873
...@@ -107,7 +107,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -107,7 +107,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_PanelBasic->SetSizer( bSizerBasicPanel ); m_PanelBasic->SetSizer( bSizerBasicPanel );
m_PanelBasic->Layout(); m_PanelBasic->Layout();
bSizerBasicPanel->Fit( m_PanelBasic ); bSizerBasicPanel->Fit( m_PanelBasic );
m_NoteBook->AddPage( m_PanelBasic, _("Options"), true ); m_NoteBook->AddPage( m_PanelBasic, _("Options"), false );
m_PanelDoc = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); m_PanelDoc = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
wxBoxSizer* m_PanelDocBoxSizer; wxBoxSizer* m_PanelDocBoxSizer;
m_PanelDocBoxSizer = new wxBoxSizer( wxVERTICAL ); m_PanelDocBoxSizer = new wxBoxSizer( wxVERTICAL );
...@@ -123,7 +123,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -123,7 +123,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_staticTextKeywords = new wxStaticText( m_PanelDoc, wxID_ANY, _("Keywords:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextKeywords = new wxStaticText( m_PanelDoc, wxID_ANY, _("Keywords:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextKeywords->Wrap( -1 ); m_staticTextKeywords->Wrap( -1 );
m_staticTextKeywords->SetToolTip( _("Enter keys words that can be used to select this composant\nkeys words cannot have spaces and are separated by a space") ); m_staticTextKeywords->SetToolTip( _("Enter keys words that can be used to select this composant.\nKey words cannot have spaces and are separated by a space.") );
m_PanelDocBoxSizer->Add( m_staticTextKeywords, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_PanelDocBoxSizer->Add( m_staticTextKeywords, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
...@@ -153,7 +153,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -153,7 +153,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_PanelDoc->SetSizer( m_PanelDocBoxSizer ); m_PanelDoc->SetSizer( m_PanelDocBoxSizer );
m_PanelDoc->Layout(); m_PanelDoc->Layout();
m_PanelDocBoxSizer->Fit( m_PanelDoc ); m_PanelDocBoxSizer->Fit( m_PanelDoc );
m_NoteBook->AddPage( m_PanelDoc, _("Description"), false ); m_NoteBook->AddPage( m_PanelDoc, _("Description"), true );
m_PanelAlias = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); m_PanelAlias = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
wxBoxSizer* bSizerMainPanelAlias; wxBoxSizer* bSizerMainPanelAlias;
bSizerMainPanelAlias = new wxBoxSizer( wxHORIZONTAL ); bSizerMainPanelAlias = new wxBoxSizer( wxHORIZONTAL );
......
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
<object class="notebookpage" expanded="1"> <object class="notebookpage" expanded="1">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="label">Options</property> <property name="label">Options</property>
<property name="select">1</property> <property name="select">0</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="context_help"></property> <property name="context_help"></property>
...@@ -851,7 +851,7 @@ ...@@ -851,7 +851,7 @@
<object class="notebookpage" expanded="1"> <object class="notebookpage" expanded="1">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="label">Description</property> <property name="label">Description</property>
<property name="select">0</property> <property name="select">1</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="context_help"></property> <property name="context_help"></property>
...@@ -1026,7 +1026,7 @@ ...@@ -1026,7 +1026,7 @@
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip">Enter keys words that can be used to select this composant&#x0A;keys words cannot have spaces and are separated by a space</property> <property name="tooltip">Enter keys words that can be used to select this composant.&#x0A;Key words cannot have spaces and are separated by a space.</property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
......
...@@ -429,7 +429,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -429,7 +429,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
{ {
if( m_ID_current_state != ID_NOCONN_BUTT ) if( m_ID_current_state != ID_NOCONN_BUTT )
SetToolID( ID_NOCONN_BUTT, wxCURSOR_PENCIL, SetToolID( ID_NOCONN_BUTT, wxCURSOR_PENCIL,
_( "Add a no connected flag" ) ); _( "Add \"NoNonnect\" Flags" ) );
OnLeftClick( DC, MousePos ); OnLeftClick( DC, MousePos );
} }
break; break;
......
...@@ -144,6 +144,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -144,6 +144,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ), item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ),
_( "Quit EESchema" ) ); _( "Quit EESchema" ) );
item->SetBitmap( exit_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
#endif /* !defined( __WXMAC__) */ #endif /* !defined( __WXMAC__) */
......
...@@ -76,6 +76,7 @@ void WinEDA_LibeditFrame::ReCreateMenuBar() ...@@ -76,6 +76,7 @@ void WinEDA_LibeditFrame::ReCreateMenuBar()
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ), item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ),
_( "Quit Library Editor" ) ); _( "Quit Library Editor" ) );
item->SetBitmap( exit_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
#endif #endif
......
...@@ -90,7 +90,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame ) ...@@ -90,7 +90,7 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_TOOL( wxID_COPY, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( wxID_COPY, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( wxID_PASTE, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( wxID_PASTE, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( wxID_UNDO, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( wxID_UNDO, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_GEN_PRINT, WinEDA_GerberFrame::ToPrinter ) EVT_TOOL( wxID_PRINT, WinEDA_GerberFrame::ToPrinter )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_GerberFrame::Process_Special_Functions ) EVT_TOOL( ID_FIND_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_GERBVIEW_SELECT_LAYER, EVT_KICAD_CHOICEBOX( ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
......
...@@ -68,7 +68,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) ...@@ -68,7 +68,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
filesMenu->Append( ID_GEN_PRINT, _( "P&rint" ), _( "Print gerber" ) ); filesMenu->Append( wxID_PRINT, _( "P&rint" ), _( "Print gerber" ) );
filesMenu->Append( ID_GEN_PLOT, _( "Plot" ), filesMenu->Append( ID_GEN_PLOT, _( "Plot" ),
_( "Plotting in various formats" ) ); _( "Plotting in various formats" ) );
...@@ -177,7 +177,7 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void ) ...@@ -177,7 +177,7 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
_( "Undelete" ) ); _( "Undelete" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, m_HToolBar->AddTool( wxID_PRINT, wxEmptyString,
wxBitmap( print_button ), wxBitmap( print_button ),
_( "Print world" ) ); _( "Print world" ) );
......
...@@ -43,7 +43,6 @@ enum main_id ...@@ -43,7 +43,6 @@ enum main_id
ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
ID_PREFERENCES_HOTKEY_END, ID_PREFERENCES_HOTKEY_END,
ID_GEN_PRINT,
ID_GEN_PLOT, ID_GEN_PLOT,
ID_GEN_PLOT_PS, ID_GEN_PLOT_PS,
ID_GEN_PLOT_HPGL, ID_GEN_PLOT_HPGL,
...@@ -52,7 +51,6 @@ enum main_id ...@@ -52,7 +51,6 @@ enum main_id
ID_GEN_PLOT_DXF, ID_GEN_PLOT_DXF,
ID_GEN_COPY_SHEET_TO_CLIPBOARD, ID_GEN_COPY_SHEET_TO_CLIPBOARD,
ID_GEN_COPY_BLOCK_TO_CLIPBOARD, ID_GEN_COPY_BLOCK_TO_CLIPBOARD,
ID_GEN_UNUSED0,
ID_GEN_EXPORT_FILE, ID_GEN_EXPORT_FILE,
ID_GEN_EXPORT_SPECCTRA, ID_GEN_EXPORT_SPECCTRA,
......
...@@ -1073,6 +1073,8 @@ public: ...@@ -1073,6 +1073,8 @@ public:
void InstallOptionsFrame( const wxPoint& pos ); void InstallOptionsFrame( const wxPoint& pos );
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void CloseModuleEditor( wxCommandEvent& Event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar(); void ReCreateHToolbar();
......
...@@ -40,7 +40,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind ...@@ -40,7 +40,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pad Geometry:") ), wxVERTICAL ); sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pad Geometry:") ), wxVERTICAL );
wxFlexGridSizer* fgSizerGeometry; wxFlexGridSizer* fgSizerGeometry;
fgSizerGeometry = new wxFlexGridSizer( 9, 3, 0, 0 ); fgSizerGeometry = new wxFlexGridSizer( 12, 3, 0, 0 );
fgSizerGeometry->SetFlexibleDirection( wxBOTH ); fgSizerGeometry->SetFlexibleDirection( wxBOTH );
fgSizerGeometry->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizerGeometry->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
...@@ -230,7 +230,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind ...@@ -230,7 +230,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
sbClearancesSizer->Add( m_staticText20, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); sbClearancesSizer->Add( m_staticText20, 0, wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxFlexGridSizer* fgClearancesGridSizer; wxFlexGridSizer* fgClearancesGridSizer;
fgClearancesGridSizer = new wxFlexGridSizer( 4, 3, 0, 0 ); fgClearancesGridSizer = new wxFlexGridSizer( 5, 3, 0, 0 );
fgClearancesGridSizer->SetFlexibleDirection( wxBOTH ); fgClearancesGridSizer->SetFlexibleDirection( wxBOTH );
fgClearancesGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgClearancesGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
......
...@@ -331,7 +331,7 @@ ...@@ -331,7 +331,7 @@
<property name="name">fgSizerGeometry</property> <property name="name">fgSizerGeometry</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property> <property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property> <property name="permission">none</property>
<property name="rows">9</property> <property name="rows">12</property>
<property name="vgap">0</property> <property name="vgap">0</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
...@@ -2207,7 +2207,7 @@ ...@@ -2207,7 +2207,7 @@
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">1</property>
<object class="wxBoxSizer" expanded="0"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bMiddleSizer</property> <property name="name">bMiddleSizer</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
...@@ -2590,7 +2590,7 @@ ...@@ -2590,7 +2590,7 @@
<property name="name">fgClearancesGridSizer</property> <property name="name">fgClearancesGridSizer</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property> <property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property> <property name="permission">none</property>
<property name="rows">4</property> <property name="rows">5</property>
<property name="vgap">0</property> <property name="vgap">0</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
......
/************************************************/ /***
/* menubarmodedit.cpp - Module editor menu bar. */ * @file menubarmodedit.cpp
/************************************************/ * Module editor menu bar.
***/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
...@@ -12,75 +12,304 @@ ...@@ -12,75 +12,304 @@
#include "protos.h" #include "protos.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
/* Create the menubar for the module editor */
void WinEDA_ModuleEditFrame::ReCreateMenuBar() void WinEDA_ModuleEditFrame::ReCreateMenuBar()
{ {
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar* menuBar = GetMenuBar();
wxMenuItem* item; wxMenuItem* item;
if( !menuBar ) if( menuBar )
{ return;
menuBar = new wxMenuBar(); menuBar = new wxMenuBar();
wxMenu* sizes_menu = new wxMenu; /* File menu */
wxMenu* fileMenu = new wxMenu;
/* New module */
item = new wxMenuItem( fileMenu,
ID_MODEDIT_NEW_MODULE,
_( "New Module" ),
_( "Create new module" ) );
item->SetBitmap( new_footprint_xpm );
fileMenu->Append( item );
/* Open submenu */
wxMenu* openSubmenu = new wxMenu;
/* from File */
item = new wxMenuItem( openSubmenu,
ID_MODEDIT_IMPORT_PART,
_( "from File (Import)" ),
_( "Import a footprint from an existing file" ) );
item->SetBitmap( import_module_xpm );
openSubmenu->Append( item );
/* from Library */
item = new wxMenuItem( openSubmenu,
ID_MODEDIT_LOAD_MODULE,
_( "Load from Library" ),
_( "Open a footprint module from a Library" ) );
item->SetBitmap( module_xpm );
openSubmenu->Append( item );
/* from current Board */
item = new wxMenuItem( openSubmenu,
ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
_( "Load from current Board" ),
_( "Load a footprint module from the current loaded board" ) );
item->SetBitmap( load_module_board_xpm );
openSubmenu->Append( item );
/* Append openSubmenu to fileMenu */
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openSubmenu, -1,
_( "&Load Module" ), _( "Load a footprint module" ), open_xpm );
/* Save module */
item = new wxMenuItem( fileMenu, ID_MODEDIT_SAVE_LIBMODULE,
_( "&Save Module in Current Lib" ),
_( "Save Module in working library" ) );
item->SetBitmap( save_library_xpm );
fileMenu->Append( item );
item = new wxMenuItem( fileMenu,
ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
_( "&Save Module in a New Lib" ),
_( "Create new library and save current module" ) );
item->SetBitmap( new_library_xpm );
fileMenu->Append( item );
item = new wxMenuItem( fileMenu,
ID_MODEDIT_EXPORT_PART,
_( "&Export module" ),
_( "Save the current loaded module to a file on the harddisk" ) );
item->SetBitmap( export_module_xpm );
fileMenu->Append( item );
/* Separator */
fileMenu->AppendSeparator();
/* Print */
item = new wxMenuItem( fileMenu, wxID_PRINT, _( "&Print" ),
_( "Print the current module" ) );
item->SetBitmap( plot_xpm );
fileMenu->Append( item );
item = new wxMenuItem( sizes_menu, ID_PCB_DRAWINGS_WIDTHS_SETUP, /* Separator */
fileMenu->AppendSeparator();
/* Close editor */
item = new wxMenuItem( fileMenu, wxID_EXIT, _( "Close" ),
_( "Close the footprint editor" ) );
item->SetBitmap( exit_xpm );
fileMenu->Append( item );
/* Edit menu */
wxMenu* editMenu = new wxMenu;
/* Undo */
item = new wxMenuItem( editMenu,
wxID_UNDO,
_( "Undo" ),
_( "Undo last edit" ) );
item->SetBitmap( undo_xpm );
editMenu->Append( item );
/* Redo */
item = new wxMenuItem( editMenu,
wxID_REDO,
_( "Redo" ),
_( "Redo the last undo action" ) );
item->SetBitmap( redo_xpm );
editMenu->Append( item );
/* Delete items */
item = new wxMenuItem( editMenu,
ID_MODEDIT_DELETE_ITEM_BUTT,
_( "Delete" ),
_( "Delete objects with the eraser" ) );
item->SetBitmap( delete_body_xpm );
editMenu->Append( item );
/* Separator */
editMenu->AppendSeparator();
/* Properties */
item = new wxMenuItem( editMenu,
ID_MODEDIT_EDIT_MODULE_PROPERTIES,
_( "Properties" ),
_( "Edit module properties" ) );
item->SetBitmap( module_options_xpm );
editMenu->Append( item );
/* Dimensions submenu */
wxMenu* dimensions_Submenu = new wxMenu;
/* Sizes and Widths */
item = new wxMenuItem( dimensions_Submenu,
ID_PCB_DRAWINGS_WIDTHS_SETUP,
_( "Sizes and Widths" ), _( "Sizes and Widths" ),
_( "Adjust width for texts and drawings" ) ); _( "Adjust width for texts and drawings" ) );
item->SetBitmap( options_text_xpm ); item->SetBitmap( options_text_xpm );
sizes_menu->Append( item ); dimensions_Submenu->Append( item );
item = new wxMenuItem( sizes_menu, ID_PCB_PAD_SETUP, _( "Pad Settings" ),
_( "Adjust size, shape, layers... for pads" ) );
item->SetBitmap( pad_xpm );
sizes_menu->Append( item );
item = /* Pad settings */
new wxMenuItem( sizes_menu, ID_PCB_USER_GRID_SETUP, item = new wxMenuItem( dimensions_Submenu,
ID_MODEDIT_PAD_SETTINGS,
_( "Pad settings" ),
_( "Edit the settings for new pads" ) );
item->SetBitmap( options_pad_xpm );
dimensions_Submenu->Append( item );
/* User Grid Size */
item = new wxMenuItem( dimensions_Submenu,
ID_PCB_USER_GRID_SETUP,
_( "User Grid Size" ), _( "User Grid Size" ),
_( "Adjust user grid" ) ); _( "Adjust user grid" ) );
item->SetBitmap( grid_xpm ); item->SetBitmap( grid_xpm );
sizes_menu->Append( item ); dimensions_Submenu->Append( item );
/* Append dimensions_Submenu to editMenu */
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( editMenu,
dimensions_Submenu, -1,
_( "&Dimensions" ),
_( "Edit dimensions preferences" ),
add_dimension_xpm );
//////////////// /* View menu */
// Menu Help: // wxMenu* viewMenu = new wxMenu;
////////////////
/* Zoom In */
item = new wxMenuItem( viewMenu,
ID_ZOOM_IN,
_( "Zoom In" ),
_( "Zoom in on the module" ) );
item->SetBitmap( zoom_in_xpm );
viewMenu->Append( item );
/* Zoom Out */
item = new wxMenuItem( viewMenu,
ID_ZOOM_OUT,
_( "Zoom Out" ),
_( "Zoom out on the module" ) );
item->SetBitmap( zoom_out_xpm );
viewMenu->Append( item );
/* Fit on Screen */
item = new wxMenuItem( viewMenu,
ID_ZOOM_PAGE,
_( "Fit on Screen" ),
_( "Zoom and fit the module in the window" ) );
item->SetBitmap( zoom_auto_xpm );
viewMenu->Append( item );
/* Separator */
viewMenu->AppendSeparator();
/* Redraw */
item = new wxMenuItem( viewMenu,
ID_ZOOM_REDRAW,
_( "Redraw" ),
_( "Redraw the window's viewport" ) );
item->SetBitmap( zoom_redraw_xpm );
viewMenu->Append( item );
/* 3D Viewer */
item = new wxMenuItem( viewMenu,
ID_MENU_PCB_SHOW_3D_FRAME,
_( "3D View" ),
_( "Show board in 3D viewer" ) );
item->SetBitmap( show_3d_xpm );
viewMenu->Append( item );
/* Place menu */
wxMenu* placeMenu = new wxMenu;
/* Pad */
item = new wxMenuItem( placeMenu,
ID_MODEDIT_ADD_PAD,
_( "Pad" ),
_( "Add Pads" ) );
item->SetBitmap( pad_xpm );
placeMenu->Append( item );
/* Separator */
placeMenu->AppendSeparator();
/* Circle */
item = new wxMenuItem( placeMenu,
ID_PCB_CIRCLE_BUTT,
_( "Circle" ),
_( "Add graphic circle" ) );
item->SetBitmap( add_circle_xpm );
placeMenu->Append( item );
/* Line or Polygon */
item = new wxMenuItem( placeMenu,
ID_PCB_ADD_LINE_BUTT,
_( "Line or Polygon" ),
_( "Add graphic line or polygon" ) );
item->SetBitmap( add_polygon_xpm );
placeMenu->Append( item );
/* Arc */
item = new wxMenuItem( placeMenu,
ID_PCB_ARC_BUTT,
_( "Arc" ),
_( "Add graphic arc" ) );
item->SetBitmap( add_arc_xpm );
placeMenu->Append( item );
/* Text */
item = new wxMenuItem( placeMenu,
ID_PCB_ADD_TEXT_BUTT,
_( "Text" ),
_( "Add graphic text" ) );
item->SetBitmap( add_text_xpm );
placeMenu->Append( item );
/* Anchor */
placeMenu->AppendSeparator();
item = new wxMenuItem( placeMenu,
ID_MODEDIT_PLACE_ANCHOR,
_( "Anchor" ),
_( "Place the footprint module reference anchor" ) );
item->SetBitmap( anchor_xpm );
placeMenu->Append( item );
/* Help menu */
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
// Contents /* Contents */
item = new wxMenuItem( helpMenu, item = new wxMenuItem( helpMenu,
ID_GENERAL_HELP, ID_GENERAL_HELP,
_( "&Contents" ), _( "&Contents" ),
_( "Open the pcbnew manual" ) ); _( "Open the PCBNew pdf manual" ) );
item->SetBitmap( online_help_xpm ); item->SetBitmap( online_help_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
/* About PCBNew */
// About pcbnew
item = new wxMenuItem( helpMenu, item = new wxMenuItem( helpMenu,
ID_KICAD_ABOUT, ID_KICAD_ABOUT,
_( "&About pcbnew" ), _( "&About PCBNew" ),
_( "About pcbnew PCB designer" ) ); _( "About PCBNew PCB designer" ) );
item->SetBitmap( info_xpm ); item->SetBitmap( info_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
//////////////////////
// Menu Display 3D: //
//////////////////////
wxMenu* Display3DMenu = new wxMenu;
item = new wxMenuItem( Display3DMenu,
ID_MENU_PCB_SHOW_3D_FRAME,
_( "3D Display" ),
_( "Show board in 3D viewer" ) );
item->SetBitmap( show_3d_xpm );
Display3DMenu->Append( item );
menuBar->Append( sizes_menu, _( "&Dimensions" ) ); /* Append all the menu's to the menubar */
menuBar->Append( Display3DMenu, _( "&3D Display" ) ); menuBar->Append( fileMenu, _( "&File" ) );
menuBar->Append( editMenu, _( "&Edit" ) );
menuBar->Append( viewMenu, _( "&View" ) );
menuBar->Append( placeMenu, _( "&Place" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
// Associate the menu bar with the frame /* Associate the menu bar with the frame */
SetMenuBar( menuBar ); SetMenuBar( menuBar );
}
} }
...@@ -195,7 +195,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar() ...@@ -195,7 +195,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
/* Print */ /* Print */
item = new wxMenuItem( filesMenu, ID_GEN_PRINT, _( "&Print" ), item = new wxMenuItem( filesMenu, wxID_PRINT, _( "&Print" ),
_( "Print pcb board" ) ); _( "Print pcb board" ) );
item->SetBitmap( print_button ); item->SetBitmap( print_button );
filesMenu->Append( item ); filesMenu->Append( item );
...@@ -237,6 +237,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar() ...@@ -237,6 +237,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ), item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ),
_( "Quit PCBNew" ) ); _( "Quit PCBNew" ) );
item->SetBitmap( exit_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
#endif /* !defined( __WXMAC__ ) */ #endif /* !defined( __WXMAC__ ) */
......
...@@ -135,6 +135,9 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ), ...@@ -135,6 +135,9 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
case ID_MODEDIT_PLACE_ANCHOR: case ID_MODEDIT_PLACE_ANCHOR:
{ {
MODULE* module = GetBoard()->m_Modules; MODULE* module = GetBoard()->m_Modules;
if( module == NULL // No module loaded
|| (module->m_Flags != 0) )
break;
module->m_Flags = 0; module->m_Flags = 0;
SaveCopyInUndoList( module, UR_MODEDIT ); SaveCopyInUndoList( module, UR_MODEDIT );
Place_Ancre( module ); // set the new relatives internal Place_Ancre( module ); // set the new relatives internal
...@@ -145,7 +148,7 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ), ...@@ -145,7 +148,7 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
// Replace the module in position 0, to recalculate absolutes // Replace the module in position 0, to recalculate absolutes
// coordinates of items // coordinates of items
module->SetPosition( wxPoint( 0, 0 ) ); module->SetPosition( wxPoint( 0, 0 ) );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, 0, wxEmptyString );
SetCurItem( NULL ); SetCurItem( NULL );
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
...@@ -159,6 +162,8 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ), ...@@ -159,6 +162,8 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
break; break;
case ID_PCB_ADD_TEXT_BUTT: case ID_PCB_ADD_TEXT_BUTT:
if( GetBoard()->m_Modules == NULL )
break;
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
CreateTextModule( GetBoard()->m_Modules, DC ); CreateTextModule( GetBoard()->m_Modules, DC );
break; break;
...@@ -172,10 +177,9 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ), ...@@ -172,10 +177,9 @@ m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
break; break;
default: default:
DrawPanel->SetCursor( wxCURSOR_ARROW );
DisplayError( this, DisplayError( this,
wxT( "WinEDA_ModuleEditFrame::ProcessCommand error" ) ); wxT( "WinEDA_ModuleEditFrame::ProcessCommand error" ) );
m_ID_current_state = 0; SetToolID( 0, 0, wxEmptyString );
break; break;
} }
......
...@@ -2,10 +2,6 @@ ...@@ -2,10 +2,6 @@
/* moduleframe.cpp - Footprint (module) editor main window. */ /* moduleframe.cpp - Footprint (module) editor main window. */
/************************************************************/ /************************************************************/
#ifdef __GNUG__
#pragma implementation
#endif
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
...@@ -31,119 +27,121 @@ static BOARD_DESIGN_SETTINGS s_ModuleEditorDesignSetting; ...@@ -31,119 +27,121 @@ static BOARD_DESIGN_SETTINGS s_ModuleEditorDesignSetting;
/* class WinEDA_ModuleEditFrame */ /* class WinEDA_ModuleEditFrame */
/********************************/ /********************************/
BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame ) BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame )
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END, ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection ) WinEDA_BasePcbFrame::ProcessItemSelection )
EVT_CLOSE( WinEDA_ModuleEditFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_ModuleEditFrame::OnCloseWindow )
EVT_SIZE( WinEDA_ModuleEditFrame::OnSize ) EVT_MENU( wxID_EXIT, WinEDA_ModuleEditFrame::CloseModuleEditor )
EVT_SIZE( WinEDA_ModuleEditFrame::OnSize )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT,
WinEDA_ModuleEditFrame::OnSelectZoom ) WinEDA_ModuleEditFrame::OnSelectZoom )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT,
WinEDA_ModuleEditFrame::OnSelectGrid ) WinEDA_ModuleEditFrame::OnSelectGrid )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_ModuleEditFrame::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_ModuleEditFrame::OnZoom )
EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB, EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE, EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_DELETE_PART, EVT_TOOL( ID_MODEDIT_DELETE_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_NEW_MODULE, EVT_TOOL( ID_MODEDIT_NEW_MODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE, EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_IMPORT_PART, EVT_TOOL( ID_MODEDIT_IMPORT_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_EXPORT_PART, EVT_TOOL( ID_MODEDIT_EXPORT_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SHEET_SET, EVT_TOOL( ID_MODEDIT_SHEET_SET,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_GEN_PRINT, WinEDA_ModuleEditFrame::ToPrinter ) EVT_TOOL( wxID_PRINT, WinEDA_ModuleEditFrame::ToPrinter )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE, EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_CHECK, EVT_TOOL( ID_MODEDIT_CHECK,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_PAD_SETTINGS, EVT_TOOL( ID_MODEDIT_PAD_SETTINGS,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, EVT_TOOL( ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
WinEDA_ModuleEditFrame::LoadModuleFromBoard ) WinEDA_ModuleEditFrame::LoadModuleFromBoard )
EVT_TOOL( ID_MODEDIT_INSERT_MODULE_IN_BOARD, EVT_TOOL( ID_MODEDIT_INSERT_MODULE_IN_BOARD,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, EVT_TOOL( ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES, EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( wxID_UNDO, EVT_TOOL( wxID_UNDO,
WinEDA_ModuleEditFrame::GetComponentFromUndoList ) WinEDA_ModuleEditFrame::GetComponentFromUndoList )
EVT_TOOL( wxID_REDO, EVT_TOOL( wxID_REDO,
WinEDA_ModuleEditFrame::GetComponentFromRedoList ) WinEDA_ModuleEditFrame::GetComponentFromRedoList )
// Vertical toolbar (left click): // Vertical toolbar (left click):
EVT_TOOL( ID_NO_SELECT_BUTT, EVT_TOOL( ID_NO_SELECT_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_ADD_PAD, EVT_TOOL( ID_MODEDIT_ADD_PAD,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ARC_BUTT, EVT_TOOL( ID_PCB_ARC_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_CIRCLE_BUTT, EVT_TOOL( ID_PCB_CIRCLE_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_TEXT_BUTT, EVT_TOOL( ID_PCB_ADD_TEXT_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_LINE_BUTT, EVT_TOOL( ID_PCB_ADD_LINE_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_DELETE_ITEM_BUTT, EVT_TOOL( ID_MODEDIT_DELETE_ITEM_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_PLACE_ANCHOR, EVT_TOOL( ID_MODEDIT_PLACE_ANCHOR,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_PLACE_GRID_COORD_BUTT, EVT_TOOL( ID_PCB_PLACE_GRID_COORD_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
// Vertical toolbar (right click): // Vertical toolbar (right click):
EVT_TOOL_RCLICKED( ID_MODEDIT_ADD_PAD, EVT_TOOL_RCLICKED( ID_MODEDIT_ADD_PAD,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_TRACK_BUTT, EVT_TOOL_RCLICKED( ID_TRACK_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT, EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT, EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_TEXT_BUTT, EVT_TOOL_RCLICKED( ID_PCB_ADD_TEXT_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT, EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_DIMENSION_BUTT, EVT_TOOL_RCLICKED( ID_PCB_DIMENSION_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::ToolOnRightClick )
// Options Toolbar // Options Toolbar
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END, EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_ModuleEditFrame::OnSelectOptionToolbar ) WinEDA_ModuleEditFrame::OnSelectOptionToolbar )
// popup commands // popup commands
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE, EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
// Module transformations // Module transformations
EVT_MENU( ID_MODEDIT_MODULE_ROTATE, EVT_MENU( ID_MODEDIT_MODULE_ROTATE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_MIRROR, EVT_MENU( ID_MODEDIT_MODULE_MIRROR,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_PAD_SETUP, EVT_MENU( ID_PCB_PAD_SETUP,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_USER_GRID_SETUP, EVT_MENU( ID_PCB_USER_GRID_SETUP,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
// Menu 3D Frame // Menu 3D Frame
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame ) EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -192,7 +190,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, ...@@ -192,7 +190,7 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
ReCreateOptToolbar(); ReCreateOptToolbar();
if( DrawPanel ) if( DrawPanel )
DrawPanel->m_Block_Enable = TRUE; DrawPanel->m_Block_Enable = true;
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
...@@ -268,13 +266,31 @@ void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event ) ...@@ -268,13 +266,31 @@ void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event )
} }
void WinEDA_ModuleEditFrame::CloseModuleEditor( wxCommandEvent& Event )
{
Close();
}
/** function WinEDA_ModuleEditFrame::SetToolbars()
* Enable or disable some tools and menus, according to
* the current state of the footprint editor:
* >> a footprint is loaded or not
* >> a working library is selected or not
*/
void WinEDA_ModuleEditFrame::SetToolbars() void WinEDA_ModuleEditFrame::SetToolbars()
{ {
bool active, islib = TRUE; bool active, islib = true;
WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*) wxGetApp().GetTopWindow(); WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*) wxGetApp().GetTopWindow();
if( m_HToolBar == NULL ) if( m_HToolBar == NULL )
return; return;
wxMenuBar* menuBar = GetMenuBar();
if( menuBar == NULL )
return;
if( m_VToolBar == NULL )
return;
if( m_OptionsToolBar == NULL )
return;
if( m_CurrentLib == wxEmptyString ) if( m_CurrentLib == wxEmptyString )
islib = false; islib = false;
...@@ -285,12 +301,17 @@ void WinEDA_ModuleEditFrame::SetToolbars() ...@@ -285,12 +301,17 @@ void WinEDA_ModuleEditFrame::SetToolbars()
if( GetBoard()->m_Modules == NULL ) if( GetBoard()->m_Modules == NULL )
active = false; active = false;
else else
active = TRUE; active = true;
m_HToolBar->EnableTool( ID_MODEDIT_EXPORT_PART, active ); m_HToolBar->EnableTool( ID_MODEDIT_EXPORT_PART, active );
m_HToolBar->EnableTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, menuBar->Enable( ID_MODEDIT_EXPORT_PART, active );
active );
m_HToolBar->EnableTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, active );
menuBar->Enable( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, active );
m_HToolBar->EnableTool( ID_MODEDIT_SAVE_LIBMODULE, active && islib ); m_HToolBar->EnableTool( ID_MODEDIT_SAVE_LIBMODULE, active && islib );
menuBar->Enable( ID_MODEDIT_SAVE_LIBMODULE, active && islib );
MODULE* module_in_edit = GetBoard()->m_Modules; MODULE* module_in_edit = GetBoard()->m_Modules;
if( module_in_edit && module_in_edit->m_Link ) // this is not a new module if( module_in_edit && module_in_edit->m_Link ) // this is not a new module
{ {
...@@ -322,44 +343,38 @@ void WinEDA_ModuleEditFrame::SetToolbars() ...@@ -322,44 +343,38 @@ void WinEDA_ModuleEditFrame::SetToolbars()
m_HToolBar->EnableTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, false ); m_HToolBar->EnableTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, false );
} }
if( GetScreen() ) m_HToolBar->EnableTool( wxID_UNDO, GetScreen()->GetUndoCommandCount()>0 && active );
{ menuBar->Enable( wxID_UNDO, GetScreen()->GetUndoCommandCount()>0 && active );
m_HToolBar->EnableTool( wxID_UNDO,
GetScreen()->GetUndoCommandCount()>0 && active );
m_HToolBar->EnableTool( wxID_REDO, m_HToolBar->EnableTool( wxID_REDO,
GetScreen()->GetRedoCommandCount()>0 && active ); GetScreen()->GetRedoCommandCount()>0 && active );
} menuBar->Enable( wxID_REDO, GetScreen()->GetRedoCommandCount()>0 && active );
m_HToolBar->EnableTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, GetBoard()->m_Modules != NULL );
menuBar->Enable( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, GetBoard()->m_Modules != NULL );
m_HToolBar->Refresh();
if( frame->GetBoard()->m_Modules )
// Enable/disable tools to edit module items:
int idtools[] =
{ {
m_HToolBar->EnableTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, TRUE ); ID_MODEDIT_ADD_PAD, ID_MODEDIT_ADD_PAD,
} ID_PCB_ADD_LINE_BUTT, ID_PCB_CIRCLE_BUTT,
else ID_PCB_ARC_BUTT, ID_PCB_ADD_TEXT_BUTT,
ID_MODEDIT_PLACE_ANCHOR, ID_MODEDIT_DELETE_ITEM_BUTT
};
for( unsigned ii = 0; ii < sizeof(idtools) / sizeof(int); ii++ )
{ {
m_HToolBar->EnableTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, false ); m_VToolBar->EnableTool( idtools[ii], active );
menuBar->Enable( idtools[ii], active );
} }
m_HToolBar->Refresh();
if( m_VToolBar )
{
m_VToolBar->EnableTool( ID_MODEDIT_ADD_PAD, active );
m_VToolBar->EnableTool( ID_PCB_ADD_LINE_BUTT, active );
m_VToolBar->EnableTool( ID_PCB_CIRCLE_BUTT, active );
m_VToolBar->EnableTool( ID_PCB_ARC_BUTT, active );
m_VToolBar->EnableTool( ID_PCB_ADD_TEXT_BUTT, active );
m_VToolBar->EnableTool( ID_MODEDIT_PLACE_ANCHOR, active );
m_VToolBar->EnableTool( ID_PCB_DELETE_ITEM_BUTT, active );
m_VToolBar->Refresh(); m_VToolBar->Refresh();
}
if( m_OptionsToolBar )
{
m_OptionsToolBar->ToggleTool( m_OptionsToolBar->ToggleTool(
ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UserUnit == g_UserUnit == MILLIMETRES ? true : false );
MILLIMETRES ? TRUE : false );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UserUnit == INCHES ? TRUE : false ); g_UserUnit == INCHES ? true : false );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ); DisplayOpt.DisplayPolarCood );
...@@ -369,9 +384,9 @@ void WinEDA_ModuleEditFrame::SetToolbars() ...@@ -369,9 +384,9 @@ void WinEDA_ModuleEditFrame::SetToolbars()
_( "Display polar coordinates" ) ); _( "Display polar coordinates" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
IsGridVisible( ) ); IsGridVisible() );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
IsGridVisible( ) ? IsGridVisible() ?
_( "Hide grid" ) : _( "Hide grid" ) :
_( "Show grid" ) ); _( "Show grid" ) );
...@@ -388,7 +403,6 @@ void WinEDA_ModuleEditFrame::SetToolbars() ...@@ -388,7 +403,6 @@ void WinEDA_ModuleEditFrame::SetToolbars()
_( "Show pads in sketch mode" ) : _( "Show pads in sketch mode" ) :
_( "Show pads in filled mode" ) ); _( "Show pads in filled mode" ) );
m_OptionsToolBar->Refresh(); m_OptionsToolBar->Refresh();
}
if( m_AuxiliaryToolBar ) if( m_AuxiliaryToolBar )
{ {
...@@ -435,7 +449,7 @@ void WinEDA_ModuleEditFrame::Show3D_Frame( wxCommandEvent& event ) ...@@ -435,7 +449,7 @@ void WinEDA_ModuleEditFrame::Show3D_Frame( wxCommandEvent& event )
} }
m_Draw3DFrame = new WinEDA3D_DrawFrame( this, _( "3D Viewer" ) ); m_Draw3DFrame = new WinEDA3D_DrawFrame( this, _( "3D Viewer" ) );
m_Draw3DFrame->Show( TRUE ); m_Draw3DFrame->Show( true );
} }
...@@ -447,7 +461,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -447,7 +461,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
if( GetScreen()->IsRefreshReq() ) if( GetScreen()->IsRefreshReq() )
{ {
DrawPanel->Refresh( ); DrawPanel->Refresh();
// We must return here, instead of proceeding. // We must return here, instead of proceeding.
// If we let the cursor move during a refresh request, // If we let the cursor move during a refresh request,
...@@ -519,7 +533,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -519,7 +533,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
{ {
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE ); DrawPanel->ManageCurseur( DrawPanel, DC, true );
} }
} }
...@@ -530,22 +544,23 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -530,22 +544,23 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
if( GetScreen()->IsRefreshReq() ) if( GetScreen()->IsRefreshReq() )
{ {
DrawPanel->Refresh( ); DrawPanel->Refresh();
wxSafeYield(); wxSafeYield();
} }
SetToolbars(); SetToolbars();
UpdateStatusBar(); UpdateStatusBar();
} }
/** Virtual Function OnModify() /** Virtual Function OnModify()
* Must be called after a change * Must be called after a change
* in order to set the "modify" flag of the current screen * in order to set the "modify" flag of the current screen
* and prepare, if needed the refresh of the 3D frame showing the footprint * and prepare, if needed the refresh of the 3D frame showing the footprint
* do not forget to call the basic OnModify function to update auxiliary info * do not forget to call the basic OnModify function to update auxiliary info
*/ */
void WinEDA_ModuleEditFrame::OnModify( ) void WinEDA_ModuleEditFrame::OnModify()
{ {
WinEDA_BasePcbFrame::OnModify( ); WinEDA_BasePcbFrame::OnModify();
if( m_Draw3DFrame ) if( m_Draw3DFrame )
m_Draw3DFrame->ReloadRequest( ); m_Draw3DFrame->ReloadRequest();
} }
...@@ -166,7 +166,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) ...@@ -166,7 +166,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_TOOL( wxID_PASTE, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( wxID_PASTE, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( wxID_UNDO, WinEDA_PcbFrame::GetBoardFromUndoList ) EVT_TOOL( wxID_UNDO, WinEDA_PcbFrame::GetBoardFromUndoList )
EVT_TOOL( wxID_REDO, WinEDA_PcbFrame::GetBoardFromRedoList ) EVT_TOOL( wxID_REDO, WinEDA_PcbFrame::GetBoardFromRedoList )
EVT_TOOL( ID_GEN_PRINT, WinEDA_PcbFrame::ToPrinter ) EVT_TOOL( wxID_PRINT, WinEDA_PcbFrame::ToPrinter )
EVT_TOOL( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print ) EVT_TOOL( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print )
EVT_TOOL( ID_GEN_PLOT, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_GEN_PLOT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_FIND_ITEMS, WinEDA_PcbFrame::Process_Special_Functions )
......
/*
* file polygons_defs.h
* definitions to use boost::polygon in Kicad
*/
#ifndef _POLYGONS_DEFS_H_
#define _POLYGONS_DEFS_H_
#ifdef USE_BOOST_POLYGON_LIBRARY
#include "boost/polygon/polygon.hpp"
// Define some types used here from boost::polygon
namespace bpl = boost::polygon; // bpl = boost polygon library
using namespace bpl::operators; // +, -, =, ...
typedef int coordinate_type;
typedef bpl::polygon_data<int> KPolygon;
typedef std::vector<KPolygon> KPolygonSet;
typedef bpl::point_data<int> KPolyPoint;
#endif // USE_BOOST_POLYGON_LIBRARY
#endif // #ifndef _POLYGONS_DEFS_H_
...@@ -96,7 +96,7 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar() ...@@ -96,7 +96,7 @@ void WinEDA_ModuleEditFrame::ReCreateHToolbar()
_( "Module Properties" ) ); _( "Module Properties" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, wxBitmap( print_button ), m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ),
_( "Print Module" ) ); _( "Print Module" ) );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
...@@ -173,7 +173,8 @@ void WinEDA_ModuleEditFrame::ReCreateVToolbar() ...@@ -173,7 +173,8 @@ void WinEDA_ModuleEditFrame::ReCreateVToolbar()
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_MODEDIT_PLACE_ANCHOR, wxEmptyString, m_VToolBar->AddTool( ID_MODEDIT_PLACE_ANCHOR, wxEmptyString,
wxBitmap( anchor_xpm ), wxBitmap( anchor_xpm ),
_( "Place anchor" ), wxITEM_CHECK ); _( "Place the footprint module reference anchor" ),
wxITEM_CHECK );
m_VToolBar->AddSeparator(); m_VToolBar->AddSeparator();
m_VToolBar->AddTool( ID_MODEDIT_DELETE_ITEM_BUTT, wxEmptyString, m_VToolBar->AddTool( ID_MODEDIT_DELETE_ITEM_BUTT, wxEmptyString,
......
...@@ -222,7 +222,7 @@ void WinEDA_PcbFrame::ReCreateHToolbar() ...@@ -222,7 +222,7 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
HELP_REDO ); HELP_REDO );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, wxBitmap( print_button ), m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ),
_( "Print board" ) ); _( "Print board" ) );
m_HToolBar->AddTool( ID_GEN_PLOT, wxEmptyString, wxBitmap( plot_xpm ), m_HToolBar->AddTool( ID_GEN_PLOT, wxEmptyString, wxBitmap( plot_xpm ),
_( "Plot (HPGL, PostScript, or GERBER format)" ) ); _( "Plot (HPGL, PostScript, or GERBER format)" ) );
......
...@@ -22,29 +22,18 @@ ...@@ -22,29 +22,18 @@
#include <math.h> #include <math.h>
#include <vector> #include <vector>
#include "boost/polygon/polygon.hpp"
#include "fctsys.h" #include "fctsys.h"
#include "polygons_defs.h"
#include "common.h" #include "common.h"
#include "pcbnew.h" #include "pcbnew.h"
#include "wxPcbStruct.h" #include "wxPcbStruct.h"
#include "trigo.h" #include "trigo.h"
#include "zones.h" #include "zones.h"
#include "PolyLine.h" #include "PolyLine.h"
#include "boost/polygon/polygon.hpp"
// Define some types used here from boost::polygon
namespace bpl = boost::polygon; // bpl = boost polygon library
using namespace bpl::operators; // +, -, =, ...
using namespace bpl;
typedef int coordinate_type;
typedef bpl::point_data<int> KPolyPoint;
typedef bpl::polygon_data<int> KPolygon;
typedef std::vector< KPolygon > KPolygonSet;
extern void Test_For_Copper_Island_And_Remove( BOARD* aPcb, extern void Test_For_Copper_Island_And_Remove( BOARD* aPcb,
ZONE_CONTAINER* aZone_container ); ZONE_CONTAINER* aZone_container );
......
...@@ -246,16 +246,16 @@ sp_after_type = force # ignore/add/remove/force ...@@ -246,16 +246,16 @@ sp_after_type = force # ignore/add/remove/force
# Add or remove space in 'template <' vs 'template<'. # Add or remove space in 'template <' vs 'template<'.
# If set to ignore, sp_before_angle is used. # If set to ignore, sp_before_angle is used.
sp_template_angle = ignore # ignore/add/remove/force sp_template_angle = force # ignore/add/remove/force
# Add or remove space before '<>' # Add or remove space before '<>'
sp_before_angle = ignore # ignore/add/remove/force sp_before_angle = ignore # ignore/add/remove/force
# Add or remove space inside '<' and '>' # Add or remove space inside '<' and '>'
sp_inside_angle = ignore # ignore/add/remove/force sp_inside_angle = remove # ignore/add/remove/force
# Add or remove space after '<>' # Add or remove space after '<>'
sp_after_angle = ignore # ignore/add/remove/force sp_after_angle = force # ignore/add/remove/force
# Add or remove space between '<>' and '(' as found in 'new List<byte>();' # Add or remove space between '<>' and '(' as found in 'new List<byte>();'
sp_angle_paren = ignore # ignore/add/remove/force sp_angle_paren = ignore # ignore/add/remove/force
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment