2011-04-06 13:52:47 +00:00
|
|
|
/**
|
|
|
|
* @file pcbnew/menubar_modedit.cpp
|
|
|
|
* @brief (Re)Create the main menubar for the module editor
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
#include "pcbnew.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
#include "wxPcbStruct.h"
|
2010-08-10 18:34:26 +00:00
|
|
|
#include "module_editor_frame.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "bitmaps.h"
|
|
|
|
#include "protos.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "pcbnew_id.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
/**
|
|
|
|
* @brief (Re)Create the menubar for the module editor frame
|
|
|
|
*/
|
2007-09-13 11:55:46 +00:00
|
|
|
void WinEDA_ModuleEditFrame::ReCreateMenuBar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-04-06 13:52:47 +00:00
|
|
|
// Create and try to get the current menubar
|
2009-11-18 12:52:19 +00:00
|
|
|
wxMenuBar* menuBar = GetMenuBar();
|
|
|
|
wxMenuItem* item;
|
|
|
|
|
2010-12-17 20:34:29 +00:00
|
|
|
if( ! menuBar )
|
|
|
|
menuBar = new wxMenuBar();
|
2010-07-29 20:00:24 +00:00
|
|
|
|
2010-12-17 20:34:29 +00:00
|
|
|
// Delete all existing menus so they can be rebuilt.
|
|
|
|
// This allows language changes of the menu text on the fly.
|
|
|
|
menuBar->Freeze();
|
|
|
|
while( menuBar->GetMenuCount() )
|
|
|
|
delete menuBar->Remove(0);
|
|
|
|
|
|
|
|
// Recreate all menus:
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Menu File:
|
2010-08-24 17:26:51 +00:00
|
|
|
wxMenu* fileMenu = new wxMenu;
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// New module
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( fileMenu,
|
|
|
|
ID_MODEDIT_NEW_MODULE,
|
|
|
|
_( "New Module" ),
|
|
|
|
_( "Create new module" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( new_footprint_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
fileMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Open submenu
|
2010-08-24 17:26:51 +00:00
|
|
|
wxMenu* openSubmenu = new wxMenu;
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// from File
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( openSubmenu,
|
|
|
|
ID_MODEDIT_IMPORT_PART,
|
2011-04-06 13:52:47 +00:00
|
|
|
_( "Load from File (Import)" ),
|
2010-08-24 17:26:51 +00:00
|
|
|
_( "Import a footprint from an existing file" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( import_module_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
openSubmenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// from Library
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( openSubmenu,
|
|
|
|
ID_MODEDIT_LOAD_MODULE,
|
|
|
|
_( "Load from Library" ),
|
|
|
|
_( "Open a footprint module from a Library" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( module_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
openSubmenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// from current Board
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( openSubmenu,
|
|
|
|
ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
|
|
|
|
_( "Load from current Board" ),
|
|
|
|
_( "Load a footprint module from the current loaded board" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( load_module_board_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
openSubmenu->Append( item );
|
|
|
|
|
|
|
|
/* Append openSubmenu to fileMenu */
|
2011-04-06 13:52:47 +00:00
|
|
|
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openSubmenu, -1,
|
|
|
|
_( "&Load Module" ),
|
|
|
|
_( "Load a footprint module" ),
|
|
|
|
open_document_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Save module
|
|
|
|
item = new wxMenuItem( fileMenu,
|
|
|
|
ID_MODEDIT_SAVE_LIBMODULE,
|
2010-08-24 17:26:51 +00:00
|
|
|
_( "&Save Module in Current Lib" ),
|
|
|
|
_( "Save Module in working library" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( save_library_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
fileMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Save module in new lib
|
2010-08-24 17:26:51 +00:00
|
|
|
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" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( new_library_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
fileMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Export module
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( fileMenu,
|
|
|
|
ID_MODEDIT_EXPORT_PART,
|
|
|
|
_( "&Export module" ),
|
|
|
|
_( "Save the current loaded module to a file" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( export_module_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
fileMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Separator
|
2010-08-24 17:26:51 +00:00
|
|
|
fileMenu->AppendSeparator();
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Print
|
|
|
|
item = new wxMenuItem( fileMenu,
|
|
|
|
wxID_PRINT,
|
|
|
|
_( "&Print\tCtrl+P" ),
|
2010-08-24 17:26:51 +00:00
|
|
|
_( "Print the current module" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( plot_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
fileMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Separator
|
2010-08-24 17:26:51 +00:00
|
|
|
fileMenu->AppendSeparator();
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Close editor
|
|
|
|
item = new wxMenuItem( fileMenu,
|
|
|
|
wxID_EXIT,
|
|
|
|
_( "Close" ),
|
|
|
|
_( "Close the footprint editor" ) );
|
|
|
|
SET_BITMAP( exit_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
fileMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Menu Edit:
|
2010-08-24 17:26:51 +00:00
|
|
|
wxMenu* editMenu = new wxMenu;
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Undo
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( editMenu,
|
|
|
|
wxID_UNDO,
|
|
|
|
_( "Undo" ),
|
|
|
|
_( "Undo last edit" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( undo_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
editMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Redo
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( editMenu,
|
|
|
|
wxID_REDO,
|
|
|
|
_( "Redo" ),
|
|
|
|
_( "Redo the last undo action" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( redo_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
editMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Delete items
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( editMenu,
|
2011-02-21 13:54:29 +00:00
|
|
|
ID_MODEDIT_DELETE_TOOL,
|
2010-08-24 17:26:51 +00:00
|
|
|
_( "Delete" ),
|
|
|
|
_( "Delete objects with the eraser" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( delete_body_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
editMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Separator
|
2010-08-24 17:26:51 +00:00
|
|
|
editMenu->AppendSeparator();
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Properties
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( editMenu,
|
|
|
|
ID_MODEDIT_EDIT_MODULE_PROPERTIES,
|
|
|
|
_( "Properties" ),
|
|
|
|
_( "Edit module properties" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( module_options_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
editMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Dimensions submenu
|
2010-08-24 17:26:51 +00:00
|
|
|
wxMenu* dimensions_Submenu = new wxMenu;
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Sizes and Widths
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( dimensions_Submenu,
|
|
|
|
ID_PCB_DRAWINGS_WIDTHS_SETUP,
|
|
|
|
_( "Sizes and Widths" ),
|
|
|
|
_( "Adjust width for texts and drawings" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( options_text_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
dimensions_Submenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Pad settings
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( dimensions_Submenu,
|
|
|
|
ID_MODEDIT_PAD_SETTINGS,
|
|
|
|
_( "Pad settings" ),
|
|
|
|
_( "Edit the settings for new pads" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( options_pad_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
dimensions_Submenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// User grid size
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( dimensions_Submenu,
|
|
|
|
ID_PCB_USER_GRID_SETUP,
|
|
|
|
_( "User Grid Size" ),
|
|
|
|
_( "Adjust user grid" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( grid_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
dimensions_Submenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Append dimensions_Submenu to editMenu
|
2010-08-24 17:26:51 +00:00
|
|
|
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( editMenu,
|
|
|
|
dimensions_Submenu, -1,
|
|
|
|
_( "&Dimensions" ),
|
|
|
|
_( "Edit dimensions preferences" ),
|
|
|
|
add_dimension_xpm );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// View menu
|
2010-08-24 17:26:51 +00:00
|
|
|
wxMenu* viewMenu = new wxMenu;
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Zoom In
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( viewMenu,
|
|
|
|
ID_ZOOM_IN,
|
|
|
|
_( "Zoom In" ),
|
|
|
|
_( "Zoom in on the module" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( zoom_in_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
viewMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Zoom Out
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( viewMenu,
|
|
|
|
ID_ZOOM_OUT,
|
|
|
|
_( "Zoom Out" ),
|
|
|
|
_( "Zoom out on the module" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( zoom_out_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
viewMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Fit on Screen
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( viewMenu,
|
|
|
|
ID_ZOOM_PAGE,
|
|
|
|
_( "Fit on Screen" ),
|
|
|
|
_( "Zoom and fit the module in the window" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( zoom_fit_in_page_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
viewMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Separator
|
2010-08-24 17:26:51 +00:00
|
|
|
viewMenu->AppendSeparator();
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Redraw
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( viewMenu,
|
|
|
|
ID_ZOOM_REDRAW,
|
|
|
|
_( "Redraw" ),
|
|
|
|
_( "Redraw the window's viewport" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( zoom_redraw_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
viewMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// 3D view
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( viewMenu,
|
|
|
|
ID_MENU_PCB_SHOW_3D_FRAME,
|
|
|
|
_( "3D View" ),
|
|
|
|
_( "Show board in 3D viewer" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( show_3d_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
viewMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Menu Place:
|
2010-08-24 17:26:51 +00:00
|
|
|
wxMenu* placeMenu = new wxMenu;
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Pad
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( placeMenu,
|
2011-02-21 13:54:29 +00:00
|
|
|
ID_MODEDIT_PAD_TOOL,
|
2010-08-24 17:26:51 +00:00
|
|
|
_( "Pad" ),
|
2011-02-21 13:54:29 +00:00
|
|
|
_( "Add pad" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( pad_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
placeMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Separator
|
2010-08-24 17:26:51 +00:00
|
|
|
placeMenu->AppendSeparator();
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Circle
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( placeMenu,
|
2011-02-21 13:54:29 +00:00
|
|
|
ID_MODEDIT_CIRCLE_TOOL,
|
2010-08-24 17:26:51 +00:00
|
|
|
_( "Circle" ),
|
|
|
|
_( "Add graphic circle" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( add_circle_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
placeMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Line or Polygon
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( placeMenu,
|
2011-02-21 13:54:29 +00:00
|
|
|
ID_MODEDIT_LINE_TOOL,
|
2010-08-24 17:26:51 +00:00
|
|
|
_( "Line or Polygon" ),
|
|
|
|
_( "Add graphic line or polygon" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( add_polygon_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
placeMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Arc
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( placeMenu,
|
2011-02-21 13:54:29 +00:00
|
|
|
ID_MODEDIT_ARC_TOOL,
|
2010-08-24 17:26:51 +00:00
|
|
|
_( "Arc" ),
|
|
|
|
_( "Add graphic arc" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( add_arc_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
placeMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Text
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( placeMenu,
|
2011-02-21 13:54:29 +00:00
|
|
|
ID_MODEDIT_TEXT_TOOL,
|
2010-08-24 17:26:51 +00:00
|
|
|
_( "Text" ),
|
|
|
|
_( "Add graphic text" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( add_text_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
placeMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Anchor
|
2010-08-24 17:26:51 +00:00
|
|
|
placeMenu->AppendSeparator();
|
|
|
|
item = new wxMenuItem( placeMenu,
|
2011-02-21 13:54:29 +00:00
|
|
|
ID_MODEDIT_ANCHOR_TOOL,
|
2010-08-24 17:26:51 +00:00
|
|
|
_( "Anchor" ),
|
|
|
|
_( "Place the footprint module reference anchor" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( anchor_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
placeMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Menu Help:
|
2010-08-24 17:26:51 +00:00
|
|
|
wxMenu* helpMenu = new wxMenu;
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Version info
|
2010-08-24 17:26:51 +00:00
|
|
|
AddHelpVersionInfoMenuEntry( helpMenu );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Contents
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( helpMenu,
|
|
|
|
ID_GENERAL_HELP,
|
|
|
|
_( "&Contents" ),
|
|
|
|
_( "Open the PCBNew manual" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( online_help_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
helpMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// About PCBNew
|
2010-08-24 17:26:51 +00:00
|
|
|
item = new wxMenuItem( helpMenu,
|
2011-04-06 13:52:47 +00:00
|
|
|
wxID_ABOUT,
|
2010-08-24 17:26:51 +00:00
|
|
|
_( "&About PCBNew" ),
|
|
|
|
_( "About PCBNew PCB designer" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
SET_BITMAP( info_xpm );
|
2010-08-24 17:26:51 +00:00
|
|
|
helpMenu->Append( item );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Append menus to the menubar
|
|
|
|
menuBar->Append( fileMenu, _( "&File" ) );
|
|
|
|
menuBar->Append( editMenu, _( "&Edit" ) );
|
|
|
|
menuBar->Append( viewMenu, _( "&View" ) );
|
2010-08-24 17:26:51 +00:00
|
|
|
menuBar->Append( placeMenu, _( "&Place" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
menuBar->Append( helpMenu, _( "&Help" ) );
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2010-12-17 20:34:29 +00:00
|
|
|
menuBar->Thaw();
|
|
|
|
|
|
|
|
// Associate the menu bar with the frame, if no previous menubar
|
|
|
|
if( GetMenuBar() == NULL )
|
|
|
|
SetMenuBar( menuBar );
|
|
|
|
else
|
|
|
|
menuBar->Refresh();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|