Gerbview: remove flicker when refresh screen, and loadind files. Fix very minor bugs.

Minor cosmetic enhancements.
commint forgoten files in boost lib.
This commit is contained in:
jean-pierre charras 2010-12-17 21:34:29 +01:00
parent e5e21a24a2
commit b8eba35cba
29 changed files with 1239 additions and 458 deletions

View File

@ -79,6 +79,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
m_AbortEnable = m_AbortRequest = false; m_AbortEnable = m_AbortRequest = false;
m_AutoPAN_Enable = TRUE; m_AutoPAN_Enable = TRUE;
m_IgnoreMouseEvents = 0; m_IgnoreMouseEvents = 0;
m_DisableEraseBG = false;
ManageCurseur = NULL; ManageCurseur = NULL;
ForceCloseManageCurseur = NULL; ForceCloseManageCurseur = NULL;
@ -673,7 +674,7 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
// call ~wxDCClipper() before ~wxPaintDC() // call ~wxDCClipper() before ~wxPaintDC()
{ {
wxDCClipper dcclip( paintDC, PaintClipBox ); wxDCClipper dcclip( paintDC, PaintClipBox );
ReDraw( &paintDC, true ); ReDraw( &paintDC, m_DisableEraseBG ? false : true );
} }
m_ClipBox = tmp; m_ClipBox = tmp;

View File

@ -37,7 +37,7 @@ void WinEDA_DrawFrame::Recadre_Trace( bool ToMouse )
* use Refresh() and update() do not change problems * use Refresh() and update() do not change problems
*/ */
INSTALL_DC( dc, DrawPanel ); INSTALL_DC( dc, DrawPanel );
DrawPanel->ReDraw( &dc ); DrawPanel->ReDraw( &dc, DrawPanel->m_DisableEraseBG ? false : true );
/* Move the mouse cursor to the on grid graphic cursor position */ /* Move the mouse cursor to the on grid graphic cursor position */
if( ToMouse == TRUE ) if( ToMouse == TRUE )

View File

@ -36,7 +36,7 @@ set(CVPCB_SRCS
listboxes.cpp listboxes.cpp
listlib.cpp listlib.cpp
loadcmp.cpp loadcmp.cpp
menucfg.cpp menubar.cpp
readschematicnetlist.cpp readschematicnetlist.cpp
savecmp.cpp savecmp.cpp
setvisu.cpp setvisu.cpp

View File

@ -1,5 +1,5 @@
/** /**
* @file ./menucfg.cpp * @file menucfg.cpp
* (Re)Create the CvPCB main MenuBar * (Re)Create the CvPCB main MenuBar
*/ */
#include "fctsys.h" #include "fctsys.h"
@ -18,9 +18,18 @@
void WinEDA_CvpcbFrame::ReCreateMenuBar() void WinEDA_CvpcbFrame::ReCreateMenuBar()
{ {
wxMenuItem* item; wxMenuItem* item;
wxMenuBar* menuBar; wxMenuBar* menuBar = GetMenuBar();
menuBar = new wxMenuBar(); if( ! menuBar )
menuBar = new wxMenuBar();
// 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:
wxMenu* filesMenu = new wxMenu; wxMenu* filesMenu = new wxMenu;
item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT,
@ -29,7 +38,7 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar()
item->SetBitmap( open_xpm ); item->SetBitmap( open_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
/* Open Recent submenu */ /* Open Recent submenu */
wxMenu* openRecentMenu = new wxMenu(); wxMenu* openRecentMenu = new wxMenu();
wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu ); wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, -1, _( "Open &Recent" ), ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, -1, _( "Open &Recent" ),
@ -96,14 +105,16 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar()
#endif /* !defined(__WXMAC__) */ #endif /* !defined(__WXMAC__) */
/** // Create the menubar and append all submenus
* Create the menubar and append all submenus
*/
menuBar->Append( filesMenu, _( "&File" ) ); menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) ); menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
/* Calling SetMenuBar() will Destroy the existing menu bar so it can be menuBar->Thaw();
* rebuilt. This allows language changes of the menu text on the fly. */
SetMenuBar( menuBar ); // Associate the menu bar with the frame, if no previous menubar
if( GetMenuBar() == NULL )
SetMenuBar( menuBar );
else
menuBar->Refresh();
} }

View File

@ -28,34 +28,34 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
wxMenuItem* item; wxMenuItem* item;
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar* menuBar = GetMenuBar();
/** if( ! menuBar )
* Destroy the existing menu bar so it can be rebuilt. This allows menuBar = new wxMenuBar();
* language changes of the menu text on the fly.
*/
if( menuBar )
SetMenuBar( NULL );
menuBar = new wxMenuBar(); // 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:
* File menu
*/ // File menu
wxMenu* filesMenu = new wxMenu; wxMenu* filesMenu = new wxMenu;
/* New */ // New
item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New\tCtrl+N" ), item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New\tCtrl+N" ),
_( "New schematic project" ) ); _( "New schematic project" ) );
item->SetBitmap( new_xpm ); item->SetBitmap( new_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
/* Open */ // Open
item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, _( "&Open\tCtrl+O" ), item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, _( "&Open\tCtrl+O" ),
_( "Open an existing schematic project" ) ); _( "Open an existing schematic project" ) );
item->SetBitmap( open_xpm ); item->SetBitmap( open_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
/* Open Recent submenu */ // Open Recent submenu
wxMenu* openRecentMenu = new wxMenu(); wxMenu* openRecentMenu = new wxMenu();
wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu ); wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu,
@ -63,11 +63,9 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
_( "Open a recent opened schematic project" ), _( "Open a recent opened schematic project" ),
open_project_xpm ); open_project_xpm );
/* Separator */
filesMenu->AppendSeparator();
/* Save */ // Save schematic
/* Save Project */ filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT, item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT,
_( "&Save Whole Schematic Project\tCtrl+S" ), _( "&Save Whole Schematic Project\tCtrl+S" ),
_( "Save all sheets in the schematic project" ) ); _( "Save all sheets in the schematic project" ) );
@ -79,22 +77,21 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
item->SetBitmap( save_xpm ); item->SetBitmap( save_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
/* Save as... */ // Save as...
item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET_AS, item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET_AS,
_( "Save Current Sheet &as" ), _( "Save Current Sheet &as" ),
_( "Save current schematic sheet as..." ) ); _( "Save current schematic sheet as..." ) );
item->SetBitmap( save_as_xpm ); item->SetBitmap( save_as_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
/* Separator */
filesMenu->AppendSeparator();
/* Print */ // Print
filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, wxID_PRINT, _( "P&rint" ), _( "Print schematic" ) ); item = new wxMenuItem( filesMenu, wxID_PRINT, _( "P&rint" ), _( "Print schematic" ) );
item->SetBitmap( print_button ); item->SetBitmap( print_button );
filesMenu->Append( item ); filesMenu->Append( item );
/* Plot submenu */ // Plot submenu
wxMenu* choice_plot_fmt = new wxMenu; wxMenu* choice_plot_fmt = new wxMenu;
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS, item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS,
_( "Plot PostScript" ), _( "Plot PostScript" ),
@ -108,19 +105,19 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
item->SetBitmap( plot_HPG_xpm ); item->SetBitmap( plot_HPG_xpm );
choice_plot_fmt->Append( item ); choice_plot_fmt->Append( item );
/* Plot SVG */ // Plot SVG
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_SVG, _( "Plot SVG" ), item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_SVG, _( "Plot SVG" ),
_( "Plot schematic sheet in SVG format" ) ); _( "Plot schematic sheet in SVG format" ) );
item->SetBitmap( plot_xpm ); item->SetBitmap( plot_xpm );
choice_plot_fmt->Append( item ); choice_plot_fmt->Append( item );
/* Plot DXF */ // Plot DXF
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_DXF, _( "Plot DXF" ), item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_DXF, _( "Plot DXF" ),
_( "Plot schematic sheet in DXF format" ) ); _( "Plot schematic sheet in DXF format" ) );
item->SetBitmap( plot_xpm ); item->SetBitmap( plot_xpm );
choice_plot_fmt->Append( item ); choice_plot_fmt->Append( item );
/* Under windows, one can draw to the clipboard */ // Under windows, one can draw to the clipboard
#ifdef __WINDOWS__ #ifdef __WINDOWS__
item = new wxMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD, item = new wxMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD,
@ -128,7 +125,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
_( "Export drawings to clipboard" ) ); _( "Export drawings to clipboard" ) );
item->SetBitmap( copy_button ); item->SetBitmap( copy_button );
choice_plot_fmt->Append( item ); choice_plot_fmt->Append( item );
#endif #endif
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, choice_plot_fmt, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, choice_plot_fmt,
@ -136,7 +132,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
_( "Plot schematic sheet in HPGL, PostScript or SVG format" ), _( "Plot schematic sheet in HPGL, PostScript or SVG format" ),
plot_xpm ); plot_xpm );
/* Quit on all platforms except WXMAC */ // Quit on all platforms except WXMAC
#if !defined(__WXMAC__) #if !defined(__WXMAC__)
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
@ -144,15 +140,12 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
item->SetBitmap( exit_xpm ); item->SetBitmap( exit_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
#endif /* !defined( __WXMAC__) */ #endif // !defined( __WXMAC__)
// Edit menu
/**
* Edit menu
*/
wxMenu* editMenu = new wxMenu; wxMenu* editMenu = new wxMenu;
/* Undo */ // Undo
text = AddHotkeyName( _( "Undo" ), s_Schematic_Hokeys_Descr, HK_UNDO ); text = AddHotkeyName( _( "Undo" ), s_Schematic_Hokeys_Descr, HK_UNDO );
item = new wxMenuItem( editMenu, wxID_UNDO, text, HELP_UNDO, wxITEM_NORMAL ); item = new wxMenuItem( editMenu, wxID_UNDO, text, HELP_UNDO, wxITEM_NORMAL );
@ -166,10 +159,8 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
item->SetBitmap( redo_xpm ); item->SetBitmap( redo_xpm );
editMenu->Append( item ); editMenu->Append( item );
/* Separator */
editMenu->AppendSeparator();
/* Delete */ /* Delete */
editMenu->AppendSeparator();
item = new wxMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT, item = new wxMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT,
_( "Delete" ), HELP_DELETE_ITEMS, wxITEM_NORMAL ); _( "Delete" ), HELP_DELETE_ITEMS, wxITEM_NORMAL );
item->SetBitmap( delete_body_xpm ); item->SetBitmap( delete_body_xpm );
@ -195,9 +186,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
editMenu->Append( item ); editMenu->Append( item );
/** // View menu
* View menu
*/
wxMenu* viewMenu = new wxMenu; wxMenu* viewMenu = new wxMenu;
/* Important Note for ZOOM IN and ZOOM OUT commands from menubar: /* Important Note for ZOOM IN and ZOOM OUT commands from menubar:
@ -378,9 +367,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
placeMenu->Append( item ); placeMenu->Append( item );
/** // Preferences Menu
* Preferences Menu
*/
wxMenu* configmenu = new wxMenu; wxMenu* configmenu = new wxMenu;
/* Library */ /* Library */
@ -423,9 +410,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
configmenu->Append( item ); configmenu->Append( item );
/** // Help Menu
* Help Menu
*/
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
AddHelpVersionInfoMenuEntry( helpMenu ); AddHelpVersionInfoMenuEntry( helpMenu );
@ -446,9 +431,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
#endif /* !defined(__WXMAC__) */ #endif /* !defined(__WXMAC__) */
/** // Create the menubar and append all submenus
* Create the menubar and append all submenus
*/
menuBar->Append( filesMenu, _( "&File" ) ); menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( editMenu, _( "&Edit" ) );
menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( viewMenu, _( "&View" ) );
@ -456,6 +439,11 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
menuBar->Append( configmenu, _( "&Preferences" ) ); menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
/* Associate the menu bar with the frame */ menuBar->Thaw();
SetMenuBar( menuBar );
// Associate the menu bar with the frame, if no previous menubar
if( GetMenuBar() == NULL )
SetMenuBar( menuBar );
else
menuBar->Refresh();
} }

View File

@ -23,44 +23,44 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
wxMenuItem *item; wxMenuItem *item;
wxMenuBar *menuBar = GetMenuBar(); wxMenuBar *menuBar = GetMenuBar();
/** if( ! menuBar )
* Destroy the existing menu bar so it can be rebuilt. This allows menuBar = new wxMenuBar();
* language changes of the menu text on the fly.
*/
if( menuBar )
SetMenuBar( NULL );
menuBar = new wxMenuBar(); // 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:
* File menu
*/ // File menu
wxMenu* filesMenu = new wxMenu; wxMenu* filesMenu = new wxMenu;
/* Save current lib */ // Save current lib
item = new wxMenuItem( filesMenu, ID_LIBEDIT_SAVE_CURRENT_LIB, item = new wxMenuItem( filesMenu, ID_LIBEDIT_SAVE_CURRENT_LIB,
_( "&Save Current Library\tCtrl+S" ), _( "&Save Current Library\tCtrl+S" ),
_( "Save the current active library" ) ); _( "Save the current active library" ) );
item->SetBitmap( save_xpm ); item->SetBitmap( save_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
/* Save as... */ // Save as...
item = new wxMenuItem( filesMenu, ID_LIBEDIT_SAVE_CURRENT_LIB_AS, item = new wxMenuItem( filesMenu, ID_LIBEDIT_SAVE_CURRENT_LIB_AS,
_( "Save Current Library &as" ), _( "Save Current Library &as" ),
_( "Save current active library as..." ) ); _( "Save current active library as..." ) );
item->SetBitmap( save_as_xpm ); item->SetBitmap( save_as_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
/* Separator */ // Separator
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
/* Export as png file */ // Export as png file
item = new wxMenuItem( filesMenu, ID_LIBEDIT_GEN_PNG_FILE, _( "&Create PNG File from Screen" ), item = new wxMenuItem( filesMenu, ID_LIBEDIT_GEN_PNG_FILE, _( "&Create PNG File from Screen" ),
_( "Create a PNG file from the component displayed on screen" ) ); _( "Create a PNG file from the component displayed on screen" ) );
item->SetBitmap( plot_xpm ); item->SetBitmap( plot_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
/* Export as SVG file */ // Export as SVG file
item = new wxMenuItem( filesMenu, ID_LIBEDIT_GEN_SVG_FILE, _( "&Create SVG File" ), item = new wxMenuItem( filesMenu, ID_LIBEDIT_GEN_SVG_FILE, _( "&Create SVG File" ),
_( "Create a SVG file from the current loaded component" ) ); _( "Create a SVG file from the current loaded component" ) );
item->SetBitmap( plot_xpm ); item->SetBitmap( plot_xpm );
@ -77,19 +77,17 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
filesMenu->Append( item ); filesMenu->Append( item );
#endif #endif
/** // Edit menu
* Edit menu
*/
wxMenu* editMenu = new wxMenu; wxMenu* editMenu = new wxMenu;
/* Undo */ // Undo
text = AddHotkeyName( _( "Undo" ), s_Libedit_Hokeys_Descr, HK_UNDO); text = AddHotkeyName( _( "Undo" ), s_Libedit_Hokeys_Descr, HK_UNDO);
item = new wxMenuItem( editMenu, wxID_UNDO, text, _( "Undo last edition" ), wxITEM_NORMAL ); item = new wxMenuItem( editMenu, wxID_UNDO, text, _( "Undo last edition" ), wxITEM_NORMAL );
item->SetBitmap( undo_xpm ); item->SetBitmap( undo_xpm );
editMenu->Append( item ); editMenu->Append( item );
/* Redo */ // Redo
text = AddHotkeyName( _( "Redo" ), s_Libedit_Hokeys_Descr, HK_REDO); text = AddHotkeyName( _( "Redo" ), s_Libedit_Hokeys_Descr, HK_REDO);
item = new wxMenuItem( editMenu, wxID_REDO, text, item = new wxMenuItem( editMenu, wxID_REDO, text,
@ -97,18 +95,14 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
item->SetBitmap( redo_xpm ); item->SetBitmap( redo_xpm );
editMenu->Append( item ); editMenu->Append( item );
/* Separator */ // Delete
editMenu->AppendSeparator(); editMenu->AppendSeparator();
/* Delete */
item = new wxMenuItem( editMenu, ID_LIBEDIT_DELETE_ITEM_BUTT, item = new wxMenuItem( editMenu, ID_LIBEDIT_DELETE_ITEM_BUTT,
_( "Delete" ), HELP_DELETE_ITEMS, wxITEM_NORMAL ); _( "Delete" ), HELP_DELETE_ITEMS, wxITEM_NORMAL );
item->SetBitmap( delete_body_xpm ); item->SetBitmap( delete_body_xpm );
editMenu->Append( item ); editMenu->Append( item );
/** // View menu
* View menu
*/
wxMenu* viewMenu = new wxMenu; wxMenu* viewMenu = new wxMenu;
/* Important Note for ZOOM IN and ZOOM OUT commands from menubar: /* Important Note for ZOOM IN and ZOOM OUT commands from menubar:
@ -128,13 +122,13 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
item->SetBitmap( zoom_in_xpm ); item->SetBitmap( zoom_in_xpm );
viewMenu->Append( item ); viewMenu->Append( item );
/* Zoom out */ // Zoom out
text = _( "Zoom Out" ); text = _( "Zoom Out" );
item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, wxITEM_NORMAL ); item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, wxITEM_NORMAL );
item->SetBitmap( zoom_out_xpm ); item->SetBitmap( zoom_out_xpm );
viewMenu->Append( item ); viewMenu->Append( item );
/* Fit on screen */ // Fit on screen
text = AddHotkeyName( _( "Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO ); text = AddHotkeyName( _( "Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO );
item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, wxITEM_NORMAL ); item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, wxITEM_NORMAL );
@ -143,40 +137,37 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
/* Redraw view */ // Redraw view
text = AddHotkeyName( _( "Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); text = AddHotkeyName( _( "Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW );
item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, wxITEM_NORMAL ); item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, wxITEM_NORMAL );
item->SetBitmap( zoom_redraw_xpm ); item->SetBitmap( zoom_redraw_xpm );
viewMenu->Append( item ); viewMenu->Append( item );
/** // Place menu
* Place menu
* TODO: Unify the ID names!
*/
wxMenu* placeMenu = new wxMenu; wxMenu* placeMenu = new wxMenu;
/* Pin */ // place Pin
item = new wxMenuItem( placeMenu, ID_LIBEDIT_PIN_BUTT, _( "&Pin" ), item = new wxMenuItem( placeMenu, ID_LIBEDIT_PIN_BUTT, _( "&Pin" ),
HELP_ADD_PIN, wxITEM_NORMAL ); HELP_ADD_PIN, wxITEM_NORMAL );
item->SetBitmap( pin_xpm ); item->SetBitmap( pin_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Graphic text */ // Graphic text
item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_TEXT_BUTT, item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_TEXT_BUTT,
_( "Graphic text" ), _( "Graphic text" ),
HELP_ADD_BODYTEXT, wxITEM_NORMAL ); HELP_ADD_BODYTEXT, wxITEM_NORMAL );
item->SetBitmap( add_text_xpm ); item->SetBitmap( add_text_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Graphic rectangle */ // Graphic rectangle
item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_RECT_BUTT, item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_RECT_BUTT,
_( "Rectangle" ), _( "Rectangle" ),
HELP_ADD_BODYRECT, wxITEM_NORMAL ); HELP_ADD_BODYRECT, wxITEM_NORMAL );
item->SetBitmap( add_rectangle_xpm ); item->SetBitmap( add_rectangle_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Graphic Circle */ // Graphic Circle
item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_CIRCLE_BUTT, item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_CIRCLE_BUTT,
_( "Circle" ), _( "Circle" ),
HELP_ADD_BODYCIRCLE, HELP_ADD_BODYCIRCLE,
@ -184,68 +175,55 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
item->SetBitmap( add_circle_xpm ); item->SetBitmap( add_circle_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Graphic Arc */ // Graphic Arc
item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_ARC_BUTT, item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_ARC_BUTT,
_( "Arc" ), _( "Arc" ),
HELP_ADD_BODYARC, wxITEM_NORMAL ); HELP_ADD_BODYARC, wxITEM_NORMAL );
item->SetBitmap( add_arc_xpm ); item->SetBitmap( add_arc_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Graphic line or polygon */ // Graphic line or polygon
item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_LINE_BUTT, item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_LINE_BUTT,
_( "Line or Polygon" ), _( "Line or Polygon" ),
HELP_ADD_BODYPOLYGON, wxITEM_NORMAL ); HELP_ADD_BODYPOLYGON, wxITEM_NORMAL );
item->SetBitmap( add_polygon_xpm ); item->SetBitmap( add_polygon_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/** // Preferences Menu
* Preferences Menu
*/
wxMenu* configmenu = new wxMenu; wxMenu* configmenu = new wxMenu;
/* Library */ // Library
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ), item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ),
_( "Library preferences" ) ); _( "Library preferences" ) );
item->SetBitmap( library_xpm ); item->SetBitmap( library_xpm );
configmenu->Append( item ); configmenu->Append( item );
/* Colors */ // Colors
item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors" ), item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors" ),
_( "Color preferences" ) ); _( "Color preferences" ) );
item->SetBitmap( palette_xpm ); item->SetBitmap( palette_xpm );
configmenu->Append( item ); configmenu->Append( item );
#if 0 // work in progress. activated when finished // Language submenu
/* Dimension */
item = new wxMenuItem( configmenu, ID_LIBEDIT_DIMENSIONS, _( "&Dimensions" ),
_( "Thickness of graphic lines, texts sizes and others" ) );
item->SetBitmap( add_dimension_xpm );
configmenu->Append( item );
#endif
/* Language submenu */
wxGetApp().AddMenuLanguageList( configmenu ); wxGetApp().AddMenuLanguageList( configmenu );
/* Hotkey submenu */ // Hotkey submenu
AddHotkeyConfigMenu( configmenu ); AddHotkeyConfigMenu( configmenu );
/* Separator */ // Save preferences
configmenu->AppendSeparator(); configmenu->AppendSeparator();
/* Save preferences */
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save preferences" ), item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save preferences" ),
_( "Save application preferences" ) ); _( "Save application preferences" ) );
item->SetBitmap( save_setup_xpm ); item->SetBitmap( save_setup_xpm );
configmenu->Append( item ); configmenu->Append( item );
/* Read preferences */ // Read preferences
item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read preferences" ), item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read preferences" ),
_( "Read application preferences" ) ); _( "Read application preferences" ) );
item->SetBitmap( read_setup_xpm ); item->SetBitmap( read_setup_xpm );
configmenu->Append( item ); configmenu->Append( item );
/** // Help Menu
* Help Menu
*/
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
AddHelpVersionInfoMenuEntry( helpMenu ); AddHelpVersionInfoMenuEntry( helpMenu );
@ -255,9 +233,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
item->SetBitmap( online_help_xpm ); item->SetBitmap( online_help_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
/** // Create the menubar and append all submenus
* Create the menubar and append all submenus
*/
menuBar->Append( filesMenu, _( "&File" ) ); menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( editMenu, _( "&Edit" ) );
menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( viewMenu, _( "&View" ) );
@ -265,6 +241,11 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
menuBar->Append( configmenu, _( "&Preferences" ) ); menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
/* Associate the menu bar with the frame */ menuBar->Thaw();
SetMenuBar( menuBar );
// Associate the menu bar with the frame, if no previous menubar
if( GetMenuBar() == NULL )
SetMenuBar( menuBar );
else
menuBar->Refresh();
} }

View File

@ -25,6 +25,7 @@ set(GERBVIEW_SRCS
block.cpp block.cpp
class_am_param.cpp class_am_param.cpp
class_aperture_macro.cpp class_aperture_macro.cpp
class_DCodeSelectionbox.cpp
class_GERBER.cpp class_GERBER.cpp
class_gerber_draw_item.cpp class_gerber_draw_item.cpp
class_gerbview_layer_widget.cpp class_gerbview_layer_widget.cpp

View File

@ -0,0 +1,61 @@
/*****************************************************************/
/* class_DCodeSelectionbox.cpp: class for displaying DCodes list */
/*****************************************************************/
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "wxstruct.h"
#include "common.h"
#include "class_drawpanel.h"
#include "gerbview.h"
#include "class_DCodeSelectionbox.h"
/***************************************/
/* ListBox handling the footprint list */
/***************************************/
DCODE_SELECTION_BOX::DCODE_SELECTION_BOX( WinEDA_Toolbar* aParent, wxWindowID aId,
const wxPoint& aLocation, const wxSize& aSize,
const wxArrayString& aChoices ) :
wxChoice( aParent, aId, aLocation, aSize, aChoices )
{
m_dcodeList = &aChoices;
}
DCODE_SELECTION_BOX::~DCODE_SELECTION_BOX()
{
}
int DCODE_SELECTION_BOX::GetSelectedDCodeId()
{
int ii = GetSelection();
if( ii > 0 )
{
wxString msg = (*m_dcodeList)[ii].AfterFirst( wxChar( ' ' ) );
long id;
msg.ToLong(&id);
return id;
}
return -1;
}
/* SetDCodeSelection
* aDCodeId = the DCode Id to select or -1 to select "no dcode"
*/
void DCODE_SELECTION_BOX::SetDCodeSelection( int aDCodeId )
{
if( aDCodeId > LAST_DCODE )
aDCodeId = LAST_DCODE;
int index = 0;
if( aDCodeId >= FIRST_DCODE )
index = aDCodeId - FIRST_DCODE + 1;
SetSelection(index);
}

View File

@ -0,0 +1,34 @@
// file class_DCodeSelectionbox.h
#ifndef CLASS_DCODESELECTIONBOX_H
#define CLASS_DCODESELECTIONBOX_H
/* helper class to display a DCode list and select a DCode id.
*/
// Define event type for DCODE_SELECTION_BOX
#define EVT_SELECT_DCODE EVT_CHOICE
class DCODE_SELECTION_BOX : public wxChoice
{
private:
const wxArrayString* m_dcodeList;
public: DCODE_SELECTION_BOX( WinEDA_Toolbar* aParent, wxWindowID aId,
const wxPoint& aLocation, const wxSize& aSize,
const wxArrayString& aChoices);
~DCODE_SELECTION_BOX();
/**
* Function GetSelectedDCodeId
* @return the current selected DCode Id or -1 if no dcode
*/
int GetSelectedDCodeId();
/**
* Function SetDCodeSelection
* @param aDCodeId = the DCode Id to select or -1 to select "no dcode"
*/
void SetDCodeSelection( int aDCodeId );
};
#endif //CLASS_DCODESELECTIONBOX_H

View File

@ -80,6 +80,8 @@ void WinEDA_GerberFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if( !GetBoard() ) if( !GetBoard() )
return; return;
wxBusyCursor dummy;
ActiveScreen = screen; ActiveScreen = screen;
GRSetDrawMode( DC, GR_COPY ); GRSetDrawMode( DC, GR_COPY );

View File

@ -15,7 +15,7 @@
#include "gerbview_id.h" #include "gerbview_id.h"
#include "class_GERBER.h" #include "class_GERBER.h"
#include "dialog_helpers.h" #include "dialog_helpers.h"
#include "class_DCodeSelectionbox.h"
/* Process the command triggered by the left button of the mouse when a tool /* Process the command triggered by the left button of the mouse when a tool
* is already selected. * is already selected.
@ -145,19 +145,18 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_TOOLBARH_GERBVIEW_SELECT_LAYER: case ID_TOOLBARH_GERBVIEW_SELECT_LAYER:
setActiveLayer(m_SelLayerBox->GetChoice()); setActiveLayer(m_SelLayerBox->GetChoice());
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh();
break; break;
case ID_TOOLBARH_GERBER_SELECT_TOOL: case ID_TOOLBARH_GERBER_SELECT_TOOL:
if( gerber_layer ) if( gerber_layer )
{ {
int tool = m_SelLayerTool->GetChoice(); int tool = m_DCodeSelector->GetSelectedDCodeId();
if( tool > 0 ) if( tool != gerber_layer->m_Selected_Tool )
tool = tool - 1 + FIRST_DCODE; {
else gerber_layer->m_Selected_Tool = tool;
tool = 0; DrawPanel->Refresh();
gerber_layer->m_Selected_Tool = tool; }
DrawPanel->Refresh( TRUE );
} }
break; break;

View File

@ -9,8 +9,6 @@
#include "gestfich.h" #include "gestfich.h"
#include "gerbview.h" #include "gerbview.h"
#include "pcbplot.h"
static void LoadDCodeFile( WinEDA_GerberFrame* frame, static void LoadDCodeFile( WinEDA_GerberFrame* frame,
const wxString& FullFileName ); const wxString& FullFileName );
@ -159,7 +157,7 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
} }
// Read gerber files: each file is loaded on a new gerbview layer // Read gerber files: each file is loaded on a new gerbview layer
int layer = getActiveLayer() - 1; int layer = getActiveLayer();
for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ ) for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ )
{ {
wxFileName filename = filenamesList[ii]; wxFileName filename = filenamesList[ii];
@ -167,21 +165,13 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
GetScreen()->m_FileName = filename.GetFullPath(); GetScreen()->m_FileName = filename.GetFullPath();
filename.SetExt( g_PenFilenameExt ); filename.SetExt( g_PenFilenameExt );
layer++; setActiveLayer( layer, false );
if( layer >= NB_LAYERS )
layer = 0;
setActiveLayer(layer);
if( Read_GERBER_File( GetScreen()->m_FileName, filename.GetFullPath() ) ) if( Read_GERBER_File( GetScreen()->m_FileName, filename.GetFullPath() ) )
{ {
SetLastProject( GetScreen()->m_FileName ); SetLastProject( GetScreen()->m_FileName );
} layer++;
else if( layer >= NB_LAYERS )
{ layer = 0;
layer--;
if( layer >= 0 )
setActiveLayer(layer);
else
setActiveLayer(0);
} }
} }
@ -189,6 +179,10 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
GetScreen()->SetRefreshReq(); GetScreen()->SetRefreshReq();
g_SaveTime = time( NULL ); g_SaveTime = time( NULL );
// Synchronize layers tools with actual active layer:
setActiveLayer(getActiveLayer());
syncLayerBox();
return true; return true;
} }

View File

@ -2,10 +2,6 @@
/* gerberframe.cpp */ /* gerberframe.cpp */
/*******************/ /*******************/
#ifdef __GNUG__
#pragma implementation
#endif
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "wxstruct.h" #include "wxstruct.h"
@ -20,6 +16,7 @@
#include "hotkeys.h" #include "hotkeys.h"
#include "class_GERBER.h" #include "class_GERBER.h"
#include "dialog_helpers.h" #include "dialog_helpers.h"
#include "class_DCodeSelectionbox.h"
#include "build_version.h" #include "build_version.h"
@ -29,110 +26,109 @@
/****************************************/ /****************************************/
BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame ) BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_GerberFrame::OnCloseWindow )
EVT_SIZE( WinEDA_GerberFrame::OnSize ) EVT_SIZE( WinEDA_GerberFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_GerberFrame::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_GerberFrame::OnZoom )
EVT_TOOL( wxID_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( wxID_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_GERBVIEW_LOAD_DRILL_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_GERBVIEW_LOAD_DCODE_FILE, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_GERBVIEW_LOAD_DCODE_FILE, WinEDA_GerberFrame::Files_io )
EVT_TOOL( ID_NEW_BOARD, WinEDA_GerberFrame::Files_io ) EVT_TOOL( ID_NEW_BOARD, WinEDA_GerberFrame::Files_io )
// Menu Files: // Menu Files:
EVT_MENU( wxID_FILE, WinEDA_GerberFrame::Files_io ) EVT_MENU( wxID_FILE, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_MENU_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io ) EVT_MENU( ID_MENU_INC_LAYER_AND_APPEND_FILE, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_NEW_BOARD, WinEDA_GerberFrame::Files_io ) EVT_MENU( ID_NEW_BOARD, WinEDA_GerberFrame::Files_io )
EVT_MENU( ID_GEN_PLOT, WinEDA_GerberFrame::ToPlotter ) EVT_MENU( ID_GEN_PLOT, WinEDA_GerberFrame::ToPlotter )
EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW, EVT_MENU( ID_GERBVIEW_EXPORT_TO_PCBNEW,
WinEDA_GerberFrame::ExportDataInPcbnewFormat ) WinEDA_GerberFrame::ExportDataInPcbnewFormat )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_GerberFrame::OnFileHistory ) EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_GerberFrame::OnFileHistory )
EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions ) EVT_MENU( ID_EXIT, WinEDA_GerberFrame::Process_Special_Functions )
// menu Preferences // menu Preferences
EVT_MENU( ID_CONFIG_REQ, EVT_MENU( ID_CONFIG_REQ,
WinEDA_GerberFrame::Process_Config ) WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_CONFIG_SAVE, EVT_MENU( ID_CONFIG_SAVE,
WinEDA_GerberFrame::Process_Config ) WinEDA_GerberFrame::Process_Config )
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START,
ID_PREFERENCES_HOTKEY_END, ID_PREFERENCES_HOTKEY_END,
WinEDA_GerberFrame::Process_Config ) WinEDA_GerberFrame::Process_Config )
EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, WinEDA_GerberFrame::OnSelectOptionToolbar ) EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
EVT_MENU( ID_GERBVIEW_OPTIONS_SETUP, WinEDA_GerberFrame::InstallGerberOptionsDialog ) WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_MENU( ID_GERBVIEW_OPTIONS_SETUP, WinEDA_GerberFrame::InstallGerberOptionsDialog )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_DrawFrame::SetLanguage ) WinEDA_DrawFrame::SetLanguage )
// menu Postprocess // menu Postprocess
EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES,
WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS,
WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_SHOW_SOURCE, EVT_MENU( ID_GERBVIEW_SHOW_SOURCE,
WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
// menu Miscellaneous // menu Miscellaneous
EVT_MENU( ID_GERBVIEW_GLOBAL_DELETE, EVT_MENU( ID_GERBVIEW_GLOBAL_DELETE,
WinEDA_GerberFrame::Process_Special_Functions )
// Menu Help
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
EVT_TOOL( wxID_CUT, 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_UNDO, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( wxID_PRINT, WinEDA_GerberFrame::ToPrinter )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
WinEDA_GerberFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_GERBER_SELECT_TOOL,
WinEDA_GerberFrame::Process_Special_Functions )
// Vertical toolbar:
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_GERBVIEW_DELETE_ITEM_BUTT,
WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, // Menu Help
WinEDA_GerberFrame::Process_Special_Functions ) EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
EVT_TOOL( wxID_CUT, 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_UNDO, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( wxID_PRINT, WinEDA_GerberFrame::ToPrinter )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_GerberFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
WinEDA_GerberFrame::Process_Special_Functions )
EVT_SELECT_DCODE( ID_TOOLBARH_GERBER_SELECT_TOOL,
WinEDA_GerberFrame::Process_Special_Functions )
// Vertical toolbar:
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_GerberFrame::Process_Special_Functions )
EVT_TOOL( ID_GERBVIEW_DELETE_ITEM_BUTT,
WinEDA_GerberFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_GerberFrame::Process_Special_Functions )
// Pop up menu // Pop up menu
EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS, EVT_MENU( ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS,
WinEDA_GerberFrame::Process_Special_Functions ) WinEDA_GerberFrame::Process_Special_Functions )
// Option toolbar // Option toolbar
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END, EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_GerberFrame::OnSelectOptionToolbar ) WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, EVT_TOOL( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
WinEDA_GerberFrame::OnSelectOptionToolbar ) WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LINES_SKETCH, EVT_TOOL( ID_TB_OPTIONS_SHOW_LINES_SKETCH,
WinEDA_GerberFrame::OnSelectOptionToolbar ) WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
WinEDA_GerberFrame::OnSelectOptionToolbar ) WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES,
WinEDA_GerberFrame::OnSelectOptionToolbar ) WinEDA_GerberFrame::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_0, EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_0,
WinEDA_GerberFrame::OnSelectDisplayMode ) WinEDA_GerberFrame::OnSelectDisplayMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_1, EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_1,
WinEDA_GerberFrame::OnSelectDisplayMode ) WinEDA_GerberFrame::OnSelectDisplayMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_2, EVT_TOOL( ID_TB_OPTIONS_SHOW_GBR_MODE_2,
WinEDA_GerberFrame::OnSelectDisplayMode ) WinEDA_GerberFrame::OnSelectDisplayMode )
END_EVENT_TABLE() END_EVENT_TABLE() WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
const wxString& title,
WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father, const wxPoint& pos,
const wxString& title, const wxSize& size,
const wxPoint& pos, long style ) :
const wxSize& size,
long style ) :
WinEDA_BasePcbFrame( father, GERBER_FRAME, title, pos, size, style ) WinEDA_BasePcbFrame( father, GERBER_FRAME, title, pos, size, style )
{ {
m_FrameName = wxT( "GerberFrame" ); m_FrameName = wxT( "GerberFrame" );
@ -141,9 +137,9 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
m_Draw_Axis = true; // true to show X and Y axis on screen m_Draw_Axis = true; // true to show X and Y axis on screen
m_Draw_Sheet_Ref = false; // true for reference drawings. m_Draw_Sheet_Ref = false; // true for reference drawings.
m_HotkeysZoomAndGridList = s_Gerbview_Hokeys_Descr; m_HotkeysZoomAndGridList = s_Gerbview_Hokeys_Descr;
m_SelLayerBox = NULL; m_SelLayerBox = NULL;
m_SelLayerTool = NULL; m_DCodeSelector = NULL;
m_displayMode = 0; m_displayMode = 0;
if( DrawPanel ) if( DrawPanel )
DrawPanel->m_Block_Enable = true; DrawPanel->m_Block_Enable = true;
@ -163,8 +159,8 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
// Create the PCB_LAYER_WIDGET *after* SetBoard(): // Create the PCB_LAYER_WIDGET *after* SetBoard():
wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
int pointSize = font.GetPointSize(); int pointSize = font.GetPointSize();
int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y ); int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
if( screenHeight <= 900 ) if( screenHeight <= 900 )
pointSize = (pointSize * 8) / 10; pointSize = (pointSize * 8) / 10;
@ -176,9 +172,12 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
LoadSettings(); LoadSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
if( GetDisplayMode() == 1 || GetDisplayMode() == 2 )
DrawPanel->m_DisableEraseBG = true;
ReCreateMenuBar(); ReCreateMenuBar();
ReCreateHToolbar(); ReCreateHToolbar();
// ReCreateVToolbar(); // Currently: no right vertical toolbar // ReCreateVToolbar(); // Currently: no right vertical toolbar
ReCreateOptToolbar(); ReCreateOptToolbar();
@ -198,39 +197,38 @@ WinEDA_GerberFrame::WinEDA_GerberFrame( wxWindow* father,
horiz.LeftDockable( false ).RightDockable( false ); horiz.LeftDockable( false ).RightDockable( false );
// LAYER_WIDGET is floatable, but initially docked at far right // LAYER_WIDGET is floatable, but initially docked at far right
wxAuiPaneInfo lyrs; wxAuiPaneInfo lyrs;
lyrs.CloseButton( false ); lyrs.CloseButton( false );
lyrs.Caption( _( "Visibles" ) ); lyrs.Caption( _( "Visibles" ) );
lyrs.IsFloatable(); lyrs.IsFloatable();
if( m_HToolBar ) if( m_HToolBar )
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) ); wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
if( m_VToolBar ) if( m_VToolBar )
m_auimgr.AddPane( m_VToolBar, m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Row( 1 ) ); wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right().Row( 1 ) );
m_auimgr.AddPane( m_LayersManager, m_auimgr.AddPane( m_LayersManager,
lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Row( 0 ) ); lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Row( 0 ) );
if( m_OptionsToolBar ) if( m_OptionsToolBar )
m_auimgr.AddPane( m_OptionsToolBar, m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() ); wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
if( DrawPanel ) if( DrawPanel )
m_auimgr.AddPane( DrawPanel, m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() ); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
if( MsgPanel ) if( MsgPanel )
m_auimgr.AddPane( MsgPanel, m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() ); wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
ReFillLayerWidget(); // this is near end because contents establish size ReFillLayerWidget(); // this is near end because contents establish size
SetToolbars(); SetToolbars();
m_auimgr.Update(); m_auimgr.Update();
} }
@ -253,10 +251,10 @@ int WinEDA_GerberFrame::BestZoom()
{ {
// gives a minimal value to zoom, if no item in list // gives a minimal value to zoom, if no item in list
if( GetBoard()->m_Drawings == NULL ) if( GetBoard()->m_Drawings == NULL )
return(16 * GetScreen()->m_ZoomScalar) ; return 16 * GetScreen()->m_ZoomScalar;
double x, y; double x, y;
EDA_Rect bbox; EDA_Rect bbox;
BOARD_ITEM* item = GetBoard()->m_Drawings; BOARD_ITEM* item = GetBoard()->m_Drawings;
@ -267,14 +265,14 @@ int WinEDA_GerberFrame::BestZoom()
} }
bbox.Inflate( wxRound( GetScreen()->GetGridSize().x * 2 ), bbox.Inflate( wxRound( GetScreen()->GetGridSize().x * 2 ),
wxRound( GetScreen()->GetGridSize().y * 2 ) ); wxRound( GetScreen()->GetGridSize().y * 2 ) );
wxSize size = DrawPanel->GetClientSize(); wxSize size = DrawPanel->GetClientSize();
x = bbox.GetWidth() / (double) size.x; x = bbox.GetWidth() / (double) size.x;
y = bbox.GetHeight() / (double) size.y; y = bbox.GetHeight() / (double) size.y;
GetScreen()->m_Curseur = bbox.Centre(); GetScreen()->m_Curseur = bbox.Centre();
int best_zoom = wxRound( MAX( x, y ) * (double) GetScreen()->m_ZoomScalar ) ; int best_zoom = wxRound( MAX( x, y ) * (double) GetScreen()->m_ZoomScalar );
return best_zoom; return best_zoom;
} }
@ -289,16 +287,17 @@ void WinEDA_GerberFrame::LoadSettings()
config->Read( GerbviewDrawModeOption, &m_displayMode, 0l ); config->Read( GerbviewDrawModeOption, &m_displayMode, 0l );
long pageSize_opt; long pageSize_opt;
config->Read( GerbviewShowPageSizeOption, &pageSize_opt, 0l ); config->Read( GerbviewShowPageSizeOption, &pageSize_opt, 0l );
int imax = 0; int imax = 0;
for( ; g_GerberPageSizeList[imax] != NULL; imax++ ); for( ; g_GerberPageSizeList[imax] != NULL; imax++ )
;
if( pageSize_opt < 0 || pageSize_opt >= imax ) if( pageSize_opt < 0 || pageSize_opt >= imax )
pageSize_opt = 0; pageSize_opt = 0;
GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[pageSize_opt]; GetScreen()->m_CurrentSheetDesc = g_GerberPageSizeList[pageSize_opt];
if ( pageSize_opt > 0 ) if( pageSize_opt > 0 )
{ {
m_Draw_Sheet_Ref = true; m_Draw_Sheet_Ref = true;
} }
@ -320,7 +319,7 @@ void WinEDA_GerberFrame::SaveSettings()
wxRealPoint GridSize = GetScreen()->GetGridSize(); wxRealPoint GridSize = GetScreen()->GetGridSize();
long pageSize_opt = 0; long pageSize_opt = 0;
if( m_Draw_Sheet_Ref ) if( m_Draw_Sheet_Ref )
{ {
@ -346,7 +345,7 @@ void WinEDA_GerberFrame::ReFillLayerWidget()
wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_LayersManager ); wxAuiPaneInfo& lyrs = m_auimgr.GetPane( m_LayersManager );
wxSize bestz = m_LayersManager->GetBestSize(); wxSize bestz = m_LayersManager->GetBestSize();
lyrs.MinSize( bestz ); lyrs.MinSize( bestz );
lyrs.BestSize( bestz ); lyrs.BestSize( bestz );
@ -397,7 +396,7 @@ int WinEDA_GerberFrame::GetGridColor()
* Function SetGridColor() , virtual * Function SetGridColor() , virtual
* @param aColor = the new color of the grid * @param aColor = the new color of the grid
*/ */
void WinEDA_GerberFrame::SetGridColor(int aColor) void WinEDA_GerberFrame::SetGridColor( int aColor )
{ {
GetBoard()->SetVisibleElementColor( GERBER_GRID_VISIBLE, aColor ); GetBoard()->SetVisibleElementColor( GERBER_GRID_VISIBLE, aColor );
} }
@ -417,12 +416,13 @@ void WinEDA_GerberFrame::SetElementVisibility( int aGERBER_VISIBLE, bool aNewSta
} }
void WinEDA_GerberFrame::syncLayerWidget( ) void WinEDA_GerberFrame::syncLayerWidget()
{ {
m_LayersManager->SelectLayer( getActiveLayer() ); m_LayersManager->SelectLayer( getActiveLayer() );
UpdateTitleAndInfo(); UpdateTitleAndInfo();
} }
/** /**
* Function syncLayerBox * Function syncLayerBox
* updates the currently "selected" layer within m_SelLayerBox * updates the currently "selected" layer within m_SelLayerBox
@ -432,6 +432,15 @@ void WinEDA_GerberFrame::syncLayerWidget( )
void WinEDA_GerberFrame::syncLayerBox() void WinEDA_GerberFrame::syncLayerBox()
{ {
m_SelLayerBox->SetSelection( getActiveLayer() ); m_SelLayerBox->SetSelection( getActiveLayer() );
int dcodeSelected = -1;
GERBER_IMAGE* gerber = g_GERBER_List[getActiveLayer()];
if( gerber )
dcodeSelected = gerber->m_Selected_Tool;
if( m_DCodeSelector )
{
m_DCodeSelector->SetDCodeSelection( dcodeSelected );
m_DCodeSelector->Enable( gerber != NULL );
}
UpdateTitleAndInfo(); UpdateTitleAndInfo();
} }
@ -453,9 +462,9 @@ void WinEDA_GerberFrame::SetLanguage( wxCommandEvent& event )
} }
void WinEDA_GerberFrame::Liste_D_Codes( ) void WinEDA_GerberFrame::Liste_D_Codes()
{ {
int ii, jj; int ii, jj;
D_CODE* pt_D_code; D_CODE* pt_D_code;
wxString Line; wxString Line;
WinEDA_TextFrame* List; WinEDA_TextFrame* List;
@ -530,7 +539,7 @@ void WinEDA_GerberFrame::Liste_D_Codes( )
void WinEDA_GerberFrame::UpdateTitleAndInfo() void WinEDA_GerberFrame::UpdateTitleAndInfo()
{ {
GERBER_IMAGE* gerber = g_GERBER_List[ GetScreen()->m_Active_Layer ]; GERBER_IMAGE* gerber = g_GERBER_List[ GetScreen()->m_Active_Layer ];
wxString text; wxString text;
// Display the gerber filename // Display the gerber filename
if( gerber == NULL ) if( gerber == NULL )
@ -538,7 +547,7 @@ void WinEDA_GerberFrame::UpdateTitleAndInfo()
text = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion(); text = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
SetTitle( text ); SetTitle( text );
SetStatusText( wxEmptyString, 0 ); SetStatusText( wxEmptyString, 0 );
text.Printf( _("Layer %d not used"), GetScreen()->m_Active_Layer+1 ); text.Printf( _( "Layer %d not in use" ), GetScreen()->m_Active_Layer + 1 );
m_TextInfo->SetValue( text ); m_TextInfo->SetValue( text );
ClearMsgPanel(); ClearMsgPanel();
return; return;
@ -552,12 +561,12 @@ void WinEDA_GerberFrame::UpdateTitleAndInfo()
// Display Image Name and Layer Name (from the current gerber data): // Display Image Name and Layer Name (from the current gerber data):
text.Printf( _( "Image name: \"%s\" Layer name: \"%s\"" ), text.Printf( _( "Image name: \"%s\" Layer name: \"%s\"" ),
GetChars( gerber->m_ImageName ), GetChars( gerber->m_ImageName ),
GetChars( gerber->GetLayerParams().m_LayerName ) ); GetChars( gerber->GetLayerParams().m_LayerName ) );
SetStatusText( text, 0 ); SetStatusText( text, 0 );
// Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar // Display data format like fmt in X3.4Y3.4 no LZ or fmt mm X2.3 Y3.5 no TZ in main toolbar
text.Printf( wxT("fmt: %s X%d.%d Y%d.%d no %cZ"), text.Printf( wxT( "fmt: %s X%d.%d Y%d.%d no %cZ" ),
gerber->m_GerbMetric ? wxT( "mm" ) : wxT( "in" ), gerber->m_GerbMetric ? wxT( "mm" ) : wxT( "in" ),
gerber->m_FmtLen.x - gerber->m_FmtScale.x, gerber->m_FmtScale.x, gerber->m_FmtLen.x - gerber->m_FmtScale.x, gerber->m_FmtScale.x,
gerber->m_FmtLen.y - gerber->m_FmtScale.y, gerber->m_FmtScale.y, gerber->m_FmtLen.y - gerber->m_FmtScale.y, gerber->m_FmtScale.y,
@ -573,24 +582,26 @@ void WinEDA_GerberFrame::UpdateTitleAndInfo()
void WinEDA_GerberFrame::OnSelectDisplayMode( wxCommandEvent& event ) void WinEDA_GerberFrame::OnSelectDisplayMode( wxCommandEvent& event )
{ {
int oldMode = GetDisplayMode(); int oldMode = GetDisplayMode();
switch( event.GetId() ) switch( event.GetId() )
{ {
case ID_TB_OPTIONS_SHOW_GBR_MODE_0: case ID_TB_OPTIONS_SHOW_GBR_MODE_0:
SetDisplayMode( 0 ); SetDisplayMode( 0 );
break; DrawPanel->m_DisableEraseBG = false;
break;
case ID_TB_OPTIONS_SHOW_GBR_MODE_1: case ID_TB_OPTIONS_SHOW_GBR_MODE_1:
SetDisplayMode( 1 ); SetDisplayMode( 1 );
break; DrawPanel->m_DisableEraseBG = true;
break;
case ID_TB_OPTIONS_SHOW_GBR_MODE_2: case ID_TB_OPTIONS_SHOW_GBR_MODE_2:
SetDisplayMode( 2 ); SetDisplayMode( 2 );
break; DrawPanel->m_DisableEraseBG = true;
break;
} }
SetToolbars(); SetToolbars();
if( GetDisplayMode() != oldMode ) if( GetDisplayMode() != oldMode )
DrawPanel->Refresh(); DrawPanel->Refresh();
} }

View File

@ -87,7 +87,6 @@ bool WinEDA_App::OnInit()
} }
ScreenPcb = new PCB_SCREEN(); ScreenPcb = new PCB_SCREEN();
ScreenPcb->m_CurrentSheetDesc = &g_Sheet_GERBER; ScreenPcb->m_CurrentSheetDesc = &g_Sheet_GERBER;
ActiveScreen = ScreenPcb; ActiveScreen = ScreenPcb;
// read current setup and reopen last directory if no filename to open in // read current setup and reopen last directory if no filename to open in

View File

@ -3,7 +3,6 @@
/*************************************/ /*************************************/
#include "fctsys.h" #include "fctsys.h"
#include "wx/wupdlock.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
@ -16,17 +15,18 @@
void WinEDA_GerberFrame::ReCreateMenuBar( void ) void WinEDA_GerberFrame::ReCreateMenuBar( void )
{ {
wxWindowUpdateLocker dummy(this);
wxMenuBar *menuBar = GetMenuBar(); wxMenuBar *menuBar = GetMenuBar();
/* Destroy the existing menu bar so it can be rebuilt. This allows if( ! menuBar )
* language changes of the menu text on the fly. */ menuBar = new wxMenuBar();
if( menuBar )
SetMenuBar( NULL );
menuBar = new wxMenuBar(); // 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:
wxMenu* filesMenu = new wxMenu; wxMenu* filesMenu = new wxMenu;
filesMenu->Append( wxID_FILE, _( "Load Gerber File" ), filesMenu->Append( wxID_FILE, _( "Load Gerber File" ),
_( "Load a new Gerber file on the current layer. Previous data will be deleted" ), _( "Load a new Gerber file on the current layer. Previous data will be deleted" ),
@ -111,9 +111,13 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
menuBar->Append( configmenu, _( "&Preferences" ) ); menuBar->Append( configmenu, _( "&Preferences" ) );
menuBar->Append( miscellaneous_menu, _( "&Miscellaneous" ) ); menuBar->Append( miscellaneous_menu, _( "&Miscellaneous" ) );
//TODO: one day... menuBar->Append(drill_menu, _("&Drill"));
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
// Associate the menu bar with the frame menuBar->Thaw();
SetMenuBar( menuBar );
// Associate the menu bar with the frame, if no previous menubar
if( GetMenuBar() == NULL )
SetMenuBar( menuBar );
else
menuBar->Refresh();
} }

View File

@ -3,7 +3,6 @@
/*************************************/ /*************************************/
#include "fctsys.h" #include "fctsys.h"
#include "wx/wupdlock.h"
//#include "appl_wxstruct.h" //#include "appl_wxstruct.h"
#include "common.h" #include "common.h"
@ -14,6 +13,7 @@
#include "hotkeys.h" #include "hotkeys.h"
#include "class_GERBER.h" #include "class_GERBER.h"
#include "class_layerchoicebox.h" #include "class_layerchoicebox.h"
#include "class_DCodeSelectionbox.h"
#include "dialog_helpers.h" #include "dialog_helpers.h"
void WinEDA_GerberFrame::ReCreateHToolbar( void ) void WinEDA_GerberFrame::ReCreateHToolbar( void )
@ -27,10 +27,6 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
if( m_HToolBar != NULL ) if( m_HToolBar != NULL )
return; return;
// we create m_SelLayerTool that have a lot of items,
// so create a wxWindowUpdateLocker is a good idea
wxWindowUpdateLocker dummy(this);
if( GetScreen() ) if( GetScreen() )
{ {
layer = GetScreen()->m_Active_Layer; layer = GetScreen()->m_Active_Layer;
@ -89,7 +85,6 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
msg = _( "Layer " ); msg << ii + 1; msg = _( "Layer " ); msg << ii + 1;
choices.Add( msg ); choices.Add( msg );
} }
m_SelLayerBox = new WinEDALayerChoiceBox( m_HToolBar, m_SelLayerBox = new WinEDALayerChoiceBox( m_HToolBar,
ID_TOOLBARH_GERBVIEW_SELECT_LAYER, ID_TOOLBARH_GERBVIEW_SELECT_LAYER,
wxDefaultPosition, wxSize( 150, -1 ), wxDefaultPosition, wxSize( 150, -1 ),
@ -97,22 +92,23 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
m_HToolBar->AddControl( m_SelLayerBox ); m_HToolBar->AddControl( m_SelLayerBox );
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
choices.Clear();
choices.Alloc(TOOLS_MAX_COUNT+1); m_DCodesList.Alloc(TOOLS_MAX_COUNT+1);
choices.Add( _( "No tool" ) ); m_DCodesList.Add( _( "No tool" ) );
for( ii = 0; ii < TOOLS_MAX_COUNT; ii++ ) msg = _( "Tool " );
wxString text;
for( ii = FIRST_DCODE; ii < TOOLS_MAX_COUNT; ii++ )
{ {
wxString msg; text = msg;
msg = _( "Tool " ); msg << ii + FIRST_DCODE; text << ii;
choices.Add( msg ); m_DCodesList.Add( text );
} }
m_SelLayerTool = new WinEDAChoiceBox( m_HToolBar, m_DCodeSelector = new DCODE_SELECTION_BOX( m_HToolBar,
ID_TOOLBARH_GERBER_SELECT_TOOL, ID_TOOLBARH_GERBER_SELECT_TOOL,
wxDefaultPosition, wxSize( 150, -1 ), wxDefaultPosition, wxSize( 150, -1 ),
choices ); m_DCodesList );
m_HToolBar->AddControl( m_SelLayerTool ); m_HToolBar->AddControl( m_DCodeSelector );
m_TextInfo = new wxTextCtrl(m_HToolBar, wxID_ANY, wxEmptyString, m_TextInfo = new wxTextCtrl(m_HToolBar, wxID_ANY, wxEmptyString,
wxDefaultPosition, wxSize(150,-1), wxDefaultPosition, wxSize(150,-1),
@ -133,8 +129,6 @@ void WinEDA_GerberFrame::ReCreateVToolbar( void )
if( m_VToolBar ) if( m_VToolBar )
return; return;
wxWindowUpdateLocker dummy(this);
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE ); m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE );
// Set up toolbar // Set up toolbar
@ -157,8 +151,6 @@ void WinEDA_GerberFrame::ReCreateOptToolbar( void )
if( m_OptionsToolBar ) if( m_OptionsToolBar )
return; return;
wxWindowUpdateLocker dummy(this);
// creation of tool bar options // creation of tool bar options
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE ); m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE );
@ -249,26 +241,21 @@ void WinEDA_GerberFrame::SetToolbars()
m_SelLayerBox->SetSelection( screen->m_Active_Layer ); m_SelLayerBox->SetSelection( screen->m_Active_Layer );
} }
if( m_SelLayerTool ) if( m_DCodeSelector )
{ {
if( gerber ) if( gerber )
{ {
int sel_index; int dcodeSelected;
m_SelLayerTool->Enable( true ); m_DCodeSelector->Enable( true );
if( gerber->m_Selected_Tool < FIRST_DCODE ) // No tool selected dcodeSelected = gerber->m_Selected_Tool;
sel_index = 0;
else
sel_index = gerber->m_Selected_Tool - FIRST_DCODE + 1;
if( sel_index != m_SelLayerTool->GetSelection() ) if( dcodeSelected != m_DCodeSelector->GetSelectedDCodeId() )
{ m_DCodeSelector->SetDCodeSelection( dcodeSelected );
m_SelLayerTool->SetSelection( sel_index );
}
} }
else else
{ {
m_SelLayerTool->SetSelection( 0 ); m_DCodeSelector->SetDCodeSelection( 0 );
m_SelLayerTool->Enable( false ); m_DCodeSelector->Enable( false );
} }
} }

View File

@ -17,8 +17,7 @@
* global id.h file. This will prevent the entire project from being rebuilt * global id.h file. This will prevent the entire project from being rebuilt
* when adding new command to the gerber file viewer. * when adding new command to the gerber file viewer.
*/ */
enum id_gerbview_frm enum id_gerbview_frm {
{
// A MenuItem ID of Zero does not work under Mac,first id = 1 // A MenuItem ID of Zero does not work under Mac,first id = 1
ID_GERBVIEW_SHOW_LIST_DCODES = 1, ID_GERBVIEW_SHOW_LIST_DCODES = 1,
ID_GERBVIEW_LOAD_DRILL_FILE, ID_GERBVIEW_LOAD_DRILL_FILE,
@ -32,8 +31,10 @@ enum id_gerbview_frm
}; };
class DCODE_SELECTION_BOX;
/****************************************************************** /******************************************************************
class WinEDA_GerberFrame: this is the main window used in gerbview * class WinEDA_GerberFrame: this is the main window used in gerbview
******************************************************************/ ******************************************************************/
class WinEDA_GerberFrame : public WinEDA_BasePcbFrame class WinEDA_GerberFrame : public WinEDA_BasePcbFrame
@ -41,36 +42,36 @@ class WinEDA_GerberFrame : public WinEDA_BasePcbFrame
friend class PCB_LAYER_WIDGET; friend class PCB_LAYER_WIDGET;
protected: protected:
GERBER_LAYER_WIDGET* m_LayersManager; GERBER_LAYER_WIDGET* m_LayersManager;
public: public:
WinEDALayerChoiceBox* m_SelLayerBox; WinEDALayerChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelLayerTool; DCODE_SELECTION_BOX* m_DCodeSelector; // a list box to select the dcode Id to hightlight.
wxTextCtrl* m_TextInfo; // a wxTextCtrl used to display some info about wxTextCtrl* m_TextInfo; // a wxTextCtrl used to display some info about
// gerber data (format..) // gerber data (format..)
wxArrayString m_DCodesList; // an array string containint all decodes Id (10 to 999)
private: private:
int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn: int m_displayMode; // Gerber images ("layers" in Gerbview) can be drawn:
// - in fast mode (write mode) but if there are negative items // - in fast mode (write mode) but if there are negative items
// only the last image is correctly drawn // only the last image is correctly drawn
// (no problem to see only one image or when no negative items) // (no problem to see only one image or when no negative items)
// - in "exact" mode (but slower) in write mode: // - in "exact" mode (but slower) in write mode:
// last image covers previous images // last image covers previous images
// - in "exact" mode (also slower) in OR mode // - in "exact" mode (also slower) in OR mode
// (transparency mode) // (transparency mode)
// m_displayMode = 0, 1 or 2 // m_displayMode = 0, 1 or 2
bool m_show_layer_manager_tools; bool m_show_layer_manager_tools;
wxArrayString m_Messages; // An array sting to store warning messages when reaging a gerber file wxArrayString m_Messages; // An array sting to store warning messages when reaging a gerber file
public: public: WinEDA_GerberFrame( wxWindow* father, const wxString& title,
WinEDA_GerberFrame( wxWindow* father, const wxString& title, const wxPoint& pos, const wxSize& size,
const wxPoint& pos, const wxSize& size, long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_GerberFrame(); ~WinEDA_GerberFrame();
void Update_config(); void Update_config();
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
/** /**
* Function ReportMessage * Function ReportMessage
@ -78,27 +79,30 @@ public:
* for instance when reading a Gerber file * for instance when reading a Gerber file
* @param aMessage = the straing to add in list * @param aMessage = the straing to add in list
*/ */
void ReportMessage(const wxString aMessage ) void ReportMessage( const wxString aMessage )
{ {
m_Messages.Add( aMessage ); m_Messages.Add( aMessage );
} }
/** /**
* Function ClearMessageList * Function ClearMessageList
* Clear the message list * Clear the message list
* Call it before reading a Gerber file * Call it before reading a Gerber file
*/ */
void ClearMessageList( ) void ClearMessageList()
{ {
m_Messages.Clear( ); m_Messages.Clear();
} }
/** /**
* Function GetDisplayMode * Function GetDisplayMode
* @return 0 for fast mode (not fully compatible with negative objects) * @return 0 for fast mode (not fully compatible with negative objects)
* 1 for exact mode, write mode * 1 for exact mode, write mode
* 2 for exact mode, OR mode (transparency mode) * 2 for exact mode, OR mode (transparency mode)
*/ */
int GetDisplayMode() { return m_displayMode;} int GetDisplayMode() { return m_displayMode; }
/** /**
* Function SetDisplayMode * Function SetDisplayMode
@ -106,13 +110,13 @@ public:
* 1 for exact mode, write mode * 1 for exact mode, write mode
* 2 for exact mode, OR mode (transparency mode) * 2 for exact mode, OR mode (transparency mode)
*/ */
void SetDisplayMode( int aMode ) { m_displayMode = aMode;} void SetDisplayMode( int aMode ) { m_displayMode = aMode; }
/** /**
* Function IsGridVisible() , virtual * Function IsGridVisible() , virtual
* @return true if the grid must be shown * @return true if the grid must be shown
*/ */
virtual bool IsGridVisible(); virtual bool IsGridVisible();
/** /**
* Function SetGridVisibility() , virtual * Function SetGridVisibility() , virtual
@ -120,19 +124,19 @@ public:
* if you want to store/retrieve the grid visiblity in configuration. * if you want to store/retrieve the grid visiblity in configuration.
* @param aVisible = true if the grid must be shown * @param aVisible = true if the grid must be shown
*/ */
virtual void SetGridVisibility(bool aVisible); virtual void SetGridVisibility( bool aVisible );
/** /**
* Function GetGridColor() , virtual * Function GetGridColor() , virtual
* @return the color of the grid * @return the color of the grid
*/ */
virtual int GetGridColor(); virtual int GetGridColor();
/** /**
* Function SetGridColor() , virtual * Function SetGridColor() , virtual
* @param aColor = the new color of the grid * @param aColor = the new color of the grid
*/ */
virtual void SetGridColor(int aColor); virtual void SetGridColor( int aColor );
/** /**
* Function IsElementVisible * Function IsElementVisible
@ -147,6 +151,7 @@ public:
return GetBoard()->IsElementVisible( aGERBER_VISIBLE ); return GetBoard()->IsElementVisible( aGERBER_VISIBLE );
} }
/** /**
* Function SetElementVisibility * Function SetElementVisibility
* changes the visibility of an element category * changes the visibility of an element category
@ -160,14 +165,14 @@ public:
* Function SetVisibleAlls * Function SetVisibleAlls
* Set the status of all visible element categories and layers to VISIBLE * Set the status of all visible element categories and layers to VISIBLE
*/ */
void SetVisibleAlls( ); void SetVisibleAlls();
/** /**
* Function ReFillLayerWidget * Function ReFillLayerWidget
* changes out all the layers in m_Layers and may be called upon * changes out all the layers in m_Layers and may be called upon
* loading a new BOARD. * loading a new BOARD.
*/ */
void ReFillLayerWidget(); void ReFillLayerWidget();
/** /**
* Function setActiveLayer * Function setActiveLayer
@ -182,6 +187,7 @@ public:
syncLayerWidget(); syncLayerWidget();
} }
/** /**
* Function getActiveLayer * Function getActiveLayer
* returns the active layer * returns the active layer
@ -191,6 +197,7 @@ public:
return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer; return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer;
} }
/** /**
* Function syncLayerWidget * Function syncLayerWidget
* updates the currently "selected" layer within the PCB_LAYER_WIDGET. * updates the currently "selected" layer within the PCB_LAYER_WIDGET.
@ -199,7 +206,7 @@ public:
* This function cannot be inline without including layer_widget.h in * This function cannot be inline without including layer_widget.h in
* here and we do not want to do that. * here and we do not want to do that.
*/ */
void syncLayerWidget( ); void syncLayerWidget();
/** /**
* Function syncLayerBox * Function syncLayerBox
@ -207,7 +214,7 @@ public:
* The currently active layer, as defined by the return value of * The currently active layer, as defined by the return value of
* getActiveLayer(). And updates the colored icon in the toolbar. * getActiveLayer(). And updates the colored icon in the toolbar.
*/ */
void syncLayerBox(); void syncLayerBox();
/** /**
* Function UpdateTitleAndInfo * Function UpdateTitleAndInfo
@ -218,7 +225,7 @@ public:
* Name of the Image (found in the gerber file: IN &ltname&gt command) in the status bar * Name of the Image (found in the gerber file: IN &ltname&gt command) in the status bar
* and other data in toolbar * and other data in toolbar
*/ */
void UpdateTitleAndInfo(); void UpdateTitleAndInfo();
/** /**
* Load applications settings specific to the PCBNew. * Load applications settings specific to the PCBNew.
@ -229,7 +236,7 @@ public:
* drawing frames. Please put your application settings for PCBNew here * drawing frames. Please put your application settings for PCBNew here
* to avoid having application settings loaded all over the place. * to avoid having application settings loaded all over the place.
*/ */
virtual void LoadSettings(); virtual void LoadSettings();
/** /**
* Save applications settings common to PCB draw frame objects. * Save applications settings common to PCB draw frame objects.
@ -240,51 +247,53 @@ public:
* drawing frames. Please put your application settings for PCBNew here * drawing frames. Please put your application settings for PCBNew here
* to avoid having application settings saved all over the place. * to avoid having application settings saved all over the place.
*/ */
virtual void SaveSettings(); virtual void SaveSettings();
/** /**
* Function SetLanguage * Function SetLanguage
* called on a language menu selection * called on a language menu selection
*/ */
virtual void SetLanguage( wxCommandEvent& event ); virtual void SetLanguage( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom();
void OnSelectOptionToolbar( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom();
void OnSelectOptionToolbar( wxCommandEvent& event );
/** /**
* Function OnSelectDisplayMode * Function OnSelectDisplayMode
* called on a display mode selection * called on a display mode selection
* Mode selection can be fast display, * Mode selection can be fast display,
* or exact mode with stacked images or with transparency * or exact mode with stacked images or with transparency
*/ */
void OnSelectDisplayMode( wxCommandEvent& event ); void OnSelectDisplayMode( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ); void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
GERBER_DRAW_ITEM* GerberGeneralLocateAndDisplay(); GERBER_DRAW_ITEM* GerberGeneralLocateAndDisplay();
GERBER_DRAW_ITEM* Locate( int typeloc ); GERBER_DRAW_ITEM* Locate( int typeloc );
void SetToolbars(); void SetToolbars();
void Process_Settings( wxCommandEvent& event ); void Process_Settings( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void InstallConfigFrame( const wxPoint& pos ); void InstallConfigFrame( const wxPoint& pos );
void InstallGerberOptionsDialog( wxCommandEvent& event ); void InstallGerberOptionsDialog( wxCommandEvent& event );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
/* handlers for block commands */ /* handlers for block commands */
virtual int ReturnBlockCommand( int key ); virtual int ReturnBlockCommand( int key );
virtual void HandleBlockPlace( wxDC* DC ); virtual void HandleBlockPlace( wxDC* DC );
virtual bool HandleBlockEnd( wxDC* DC ); virtual bool HandleBlockEnd( wxDC* DC );
/* Block operations: */ /* Block operations: */
/** /**
* Function Block_Delete * Function Block_Delete
* deletes all tracks and segments within the selected block. * deletes all tracks and segments within the selected block.
@ -292,7 +301,7 @@ public:
* *
* @param DC A device context to draw on. * @param DC A device context to draw on.
*/ */
void Block_Delete( wxDC* DC ); void Block_Delete( wxDC* DC );
/** /**
* Function Block_Move * Function Block_Move
@ -303,7 +312,7 @@ public:
* *
* @param DC A device context to draw on. * @param DC A device context to draw on.
*/ */
void Block_Move( wxDC* DC ); void Block_Move( wxDC* DC );
/** /**
* Function Block_Duplicate * Function Block_Duplicate
@ -314,39 +323,39 @@ public:
* *
* @param DC A device context to draw on. * @param DC A device context to draw on.
*/ */
void Block_Duplicate( wxDC* DC ); void Block_Duplicate( wxDC* DC );
void ToPostProcess( wxCommandEvent& event ); void ToPostProcess( wxCommandEvent& event );
/** /**
* Function ToPlotter * Function ToPlotter
* Open a dialog frame to create plot and drill files * Open a dialog frame to create plot and drill files
* relative to the current board * relative to the current board
*/ */
void ToPlotter( wxCommandEvent& event ); void ToPlotter( wxCommandEvent& event );
/** /**
* Function ToPrinter * Function ToPrinter
* Open a dialog frame to print layers * Open a dialog frame to print layers
*/ */
void ToPrinter( wxCommandEvent& event ); void ToPrinter( wxCommandEvent& event );
void Genere_HPGL( const wxString& FullFileName, int Layers ); void Genere_HPGL( const wxString& FullFileName, int Layers );
void Genere_GERBER( const wxString& FullFileName, int Layers ); void Genere_GERBER( const wxString& FullFileName, int Layers );
void Genere_PS( const wxString& FullFileName, int Layers ); void Genere_PS( const wxString& FullFileName, int Layers );
void Plot_Layer_HPGL( FILE* File, int masque_layer, void Plot_Layer_HPGL( FILE* File, int masque_layer,
int garde, bool trace_via, int garde, bool trace_via,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
void Plot_Layer_GERBER( FILE* File, int masque_layer, void Plot_Layer_GERBER( FILE* File, int masque_layer,
int garde, bool trace_via, int garde, bool trace_via,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
int Gen_D_CODE_File( const wxString& Name_File ); int Gen_D_CODE_File( const wxString& Name_File );
void Plot_Layer_PS( FILE* File, int masque_layer, void Plot_Layer_PS( FILE* File, int masque_layer,
int garde, bool trace_via, int garde, bool trace_via,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
void Files_io( wxCommandEvent& event ); void Files_io( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event ); void OnFileHistory( wxCommandEvent& event );
/** /**
* function LoadGerberFiles * function LoadGerberFiles
@ -356,12 +365,12 @@ public:
* if void string: user will be prompted for filename(s) * if void string: user will be prompted for filename(s)
* @return true if file was opened successfully. * @return true if file was opened successfully.
*/ */
bool LoadGerberFiles( const wxString& aFileName ); bool LoadGerberFiles( const wxString& aFileName );
int ReadGerberFile( FILE* File, bool Append ); int ReadGerberFile( FILE* File, bool Append );
bool Read_GERBER_File( const wxString& GERBER_FullFileName, bool Read_GERBER_File( const wxString& GERBER_FullFileName,
const wxString& D_Code_FullFileName ); const wxString& D_Code_FullFileName );
void GeneralControle( wxDC* DC, wxPoint Mouse ); void GeneralControle( wxDC* DC, wxPoint Mouse );
/** /**
@ -387,17 +396,17 @@ public:
* g_GERBER_List[]<br> * g_GERBER_List[]<br>
* 1 = read OK<br> * 1 = read OK<br>
*/ */
int Read_D_Code_File( const wxString& D_Code_FullFileName ); int Read_D_Code_File( const wxString& D_Code_FullFileName );
void CopyDCodesSizeToItems(); void CopyDCodesSizeToItems();
void Liste_D_Codes( ); void Liste_D_Codes();
// PCB handling // PCB handling
bool Clear_Pcb( bool query ); bool Clear_Pcb( bool query );
void Erase_Current_Layer( bool query ); void Erase_Current_Layer( bool query );
void Delete_DCode_Items( wxDC* DC, int dcode_value, int layer_number ); void Delete_DCode_Items( wxDC* DC, int dcode_value, int layer_number );
// Conversion function // Conversion function
void ExportDataInPcbnewFormat( wxCommandEvent& event ); void ExportDataInPcbnewFormat( wxCommandEvent& event );
/* SaveCopyInUndoList() virtual /* SaveCopyInUndoList() virtual
* currently: do nothing in gerbview. * currently: do nothing in gerbview.
@ -406,7 +415,7 @@ public:
virtual void SaveCopyInUndoList( virtual void SaveCopyInUndoList(
BOARD_ITEM* aItemToCopy, BOARD_ITEM* aItemToCopy,
UndoRedoOpType aTypeCommand = UR_UNSPECIFIED, UndoRedoOpType aTypeCommand = UR_UNSPECIFIED,
const wxPoint& aTransformPoint = wxPoint(0,0) ) { } const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) { }
/** /**
* Function SaveCopyInUndoList (overloaded). * Function SaveCopyInUndoList (overloaded).
@ -420,11 +429,12 @@ public:
virtual void SaveCopyInUndoList( virtual void SaveCopyInUndoList(
PICKED_ITEMS_LIST& aItemsList, PICKED_ITEMS_LIST& aItemsList,
UndoRedoOpType aTypeCommand, UndoRedoOpType aTypeCommand,
const wxPoint& aTransformPoint = wxPoint(0,0) ) const wxPoint& aTransformPoint = wxPoint( 0, 0 ) )
{ {
// currently: do nothing in gerbview. // currently: do nothing in gerbview.
} }
/** Virtual function PrintPage /** Virtual function PrintPage
* used to print a page * used to print a page
* @param aDC = wxDC given by the calling print function * @param aDC = wxDC given by the calling print function
@ -434,8 +444,8 @@ public:
* @param aData = a pointer on an auxiliary data (not always used, NULL if not used) * @param aData = a pointer on an auxiliary data (not always used, NULL if not used)
*/ */
virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref, virtual void PrintPage( wxDC* aDC, bool aPrint_Sheet_Ref,
int aPrintMasklayer, bool aPrintMirrorMode, int aPrintMasklayer, bool aPrintMirrorMode,
void * aData = NULL); void* aData = NULL );
/** /**
* Function InstallDialogLayerPairChoice * Function InstallDialogLayerPairChoice
@ -443,7 +453,7 @@ public:
* between gerber layers and pcbnew layers * between gerber layers and pcbnew layers
* @return the "lookup table" if ok, or NULL * @return the "lookup table" if ok, or NULL
*/ */
int* InstallDialogLayerPairChoice( ); int* InstallDialogLayerPairChoice();
/** /**
* Function DrawItemsDCodeID * Function DrawItemsDCodeID
@ -452,7 +462,7 @@ public:
* @param aDC = the current device contect * @param aDC = the current device contect
* @param aDrawMode = GR_COPY, GR_OR ... * @param aDrawMode = GR_COPY, GR_OR ...
*/ */
void DrawItemsDCodeID( wxDC* aDC, int aDrawMode ); void DrawItemsDCodeID( wxDC* aDC, int aDrawMode );
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@ -0,0 +1,25 @@
// (C) Copyright Artyom Beilis 2010.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_CONFIG_PLATFORM_VMS_HPP
#define BOOST_CONFIG_PLATFORM_VMS_HPP
#define BOOST_PLATFORM "OpenVMS"
#undef BOOST_HAS_STDINT_H
#define BOOST_HAS_UNISTD_H
#define BOOST_HAS_NL_TYPES_H
#define BOOST_HAS_GETTIMEOFDAY
#define BOOST_HAS_DIRENT_H
#define BOOST_HAS_PTHREADS
#define BOOST_HAS_NANOSLEEP
#define BOOST_HAS_CLOCK_GETTIME
#define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
#define BOOST_HAS_LOG1P
#define BOOST_HAS_EXPM1
#define BOOST_HAS_THREADS
#undef BOOST_HAS_SCHED_YIELD
#endif

View File

@ -0,0 +1,26 @@
// Copyright 2010 John Maddock
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_TYPE_TRAITS_EXT_ADD_LVALUE_REFERENCE__HPP
#define BOOST_TYPE_TRAITS_EXT_ADD_LVALUE_REFERENCE__HPP
#include <boost/type_traits/add_reference.hpp>
// should be the last #include
#include <boost/type_traits/detail/type_trait_def.hpp>
namespace boost{
BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_lvalue_reference,T,typename boost::add_reference<T>::type)
#ifndef BOOST_NO_RVALUE_REFERENCES
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,add_lvalue_reference,T&&,T&)
#endif
}
#include <boost/type_traits/detail/type_trait_undef.hpp>
#endif // BOOST_TYPE_TRAITS_EXT_ADD_LVALUE_REFERENCE__HPP

View File

@ -0,0 +1,67 @@
// add_rvalue_reference.hpp ---------------------------------------------------------//
// Copyright 2010 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
#define BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP
#include <boost/config.hpp>
//----------------------------------------------------------------------------//
#include <boost/type_traits/is_void.hpp>
#include <boost/type_traits/is_reference.hpp>
// should be the last #include
#include <boost/type_traits/detail/type_trait_def.hpp>
//----------------------------------------------------------------------------//
// //
// C++03 implementation of //
// 20.7.6.2 Reference modifications [meta.trans.ref] //
// Written by Vicente J. Botet Escriba //
// //
// If T names an object or function type then the member typedef type
// shall name T&&; otherwise, type shall name T. [ Note: This rule reflects
// the semantics of reference collapsing. For example, when a type T names
// a type T1&, the type add_rvalue_reference<T>::type is not an rvalue
// reference. —end note ]
//----------------------------------------------------------------------------//
namespace boost {
namespace type_traits_detail {
template <typename T, bool b>
struct add_rvalue_reference_helper
{ typedef T type; };
template <typename T>
struct add_rvalue_reference_helper<T, true>
{
#if !defined(BOOST_NO_RVALUE_REFERENCES)
typedef T&& type;
#else
typedef T type;
#endif
};
template <typename T>
struct add_rvalue_reference_imp
{
typedef typename boost::type_traits_detail::add_rvalue_reference_helper
<T, (!is_void<T>::value && !is_reference<T>::value) >::type type;
};
}
BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_rvalue_reference,T,typename boost::type_traits_detail::add_rvalue_reference_imp<T>::type)
} // namespace boost
#include <boost/type_traits/detail/type_trait_undef.hpp>
#endif // BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP

View File

@ -0,0 +1,153 @@
// common_type.hpp ---------------------------------------------------------//
// Copyright 2008 Howard Hinnant
// Copyright 2008 Beman Dawes
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_TYPE_TRAITS_COMMON_TYPE_HPP
#define BOOST_TYPE_TRAITS_COMMON_TYPE_HPP
#include <boost/config.hpp>
#ifdef __SUNPRO_CC
# define BOOST_COMMON_TYPE_DONT_USE_TYPEOF
#endif
#ifdef __IBMCPP__
# define BOOST_COMMON_TYPE_DONT_USE_TYPEOF
#endif
//----------------------------------------------------------------------------//
#if defined(BOOST_NO_VARIADIC_TEMPLATES)
#define BOOST_COMMON_TYPE_ARITY 3
#endif
//----------------------------------------------------------------------------//
#if defined(BOOST_NO_DECLTYPE) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF)
#define BOOST_TYPEOF_SILENT
#include <boost/typeof/typeof.hpp> // boost wonders never cease!
#endif
//----------------------------------------------------------------------------//
#ifndef BOOST_NO_STATIC_ASSERT
#define BOOST_COMMON_TYPE_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG)
#elif defined(BOOST_COMMON_TYPE_USES_MPL_ASSERT)
#include <boost/mpl/assert.hpp>
#include <boost/mpl/bool.hpp>
#define BOOST_COMMON_TYPE_STATIC_ASSERT(CND, MSG, TYPES) \
BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES)
#else
#include <boost/static_assert.hpp>
#define BOOST_COMMON_TYPE_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND)
#endif
#if !defined(BOOST_NO_STATIC_ASSERT) || !defined(BOOST_COMMON_TYPE_USES_MPL_ASSERT)
#define BOOST_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE "must be complete type"
#endif
#if defined(BOOST_NO_DECLTYPE) && defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF)
#include <boost/type_traits/detail/common_type_imp.hpp>
#include <boost/type_traits/remove_cv.hpp>
#endif
#include <boost/mpl/if.hpp>
#include <boost/utility/declval.hpp>
#include <boost/type_traits/add_rvalue_reference.hpp>
//----------------------------------------------------------------------------//
// //
// C++03 implementation of //
// 20.6.7 Other transformations [meta.trans.other] //
// Written by Howard Hinnant //
// Adapted for Boost by Beman Dawes, Vicente Botet and Jeffrey Hellrung //
// //
//----------------------------------------------------------------------------//
namespace boost {
// prototype
#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
template<typename... T>
struct common_type;
#else // or no specialization
template <class T, class U = void, class V = void>
struct common_type
{
public:
typedef typename common_type<typename common_type<T, U>::type, V>::type type;
};
#endif
// 1 arg
template<typename T>
#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
struct common_type<T>
#else
struct common_type<T, void, void>
#endif
{
BOOST_COMMON_TYPE_STATIC_ASSERT(sizeof(T) > 0, BOOST_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE, (T));
public:
typedef T type;
};
// 2 args
namespace type_traits_detail {
template <class T, class U>
struct common_type_2
{
private:
BOOST_COMMON_TYPE_STATIC_ASSERT(sizeof(T) > 0, BOOST_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE, (T));
BOOST_COMMON_TYPE_STATIC_ASSERT(sizeof(U) > 0, BOOST_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE, (U));
static bool declval_bool(); // workaround gcc bug; not required by std
static typename add_rvalue_reference<T>::type declval_T(); // workaround gcc bug; not required by std
static typename add_rvalue_reference<U>::type declval_U(); // workaround gcc bug; not required by std
static typename add_rvalue_reference<bool>::type declval_b();
#if !defined(BOOST_NO_DECLTYPE)
public:
typedef decltype(declval<bool>() ? declval<T>() : declval<U>()) type;
#elif defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF)
public:
typedef typename detail_type_traits_common_type::common_type_impl<
typename remove_cv<T>::type,
typename remove_cv<U>::type
>::type type;
#else
public:
typedef BOOST_TYPEOF_TPL(declval_b() ? declval_T() : declval_U()) type;
#endif
};
template <class T>
struct common_type_2<T, T>
{
typedef T type;
};
}
#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
template <class T, class U>
struct common_type<T, U>
#else
template <class T, class U>
struct common_type<T, U, void>
#endif
: type_traits_detail::common_type_2<T,U>
{ };
// 3 or more args
#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
template<typename T, typename U, typename... V>
struct common_type<T, U, V...> {
public:
typedef typename common_type<typename common_type<T, U>::type, V...>::type type;
};
#endif
} // namespace boost
#endif // BOOST_TYPE_TRAITS_COMMON_TYPE_HPP

View File

@ -0,0 +1,25 @@
// (C) Copyright John Maddock 2010.
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
//
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
#ifndef BOOST_TT_CONDITIONAL_HPP_INCLUDED
#define BOOST_TT_CONDITIONAL_HPP_INCLUDED
#include <boost/mpl/if.hpp>
namespace boost {
template <bool b, class T, class U>
struct conditional : public mpl::if_c<b, T, U>
{
};
} // namespace boost
#endif // BOOST_TT_CONDITIONAL_HPP_INCLUDED

View File

@ -0,0 +1,302 @@
/*******************************************************************************
* boost/type_traits/detail/common_type_imp.hpp
*
* Copyright 2010, Jeffrey Hellrung.
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*
* struct boost::common_type<T,U>
*
* common_type<T,U>::type is the type of the expression
* b() ? x() : y()
* where b() returns a bool, x() has return type T, and y() has return type U.
* See
* http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2661.htm#common_type
*
* Note that this evaluates to void if one or both of T and U is void.
******************************************************************************/
#ifndef BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_IMP_HPP
#define BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_IMP_HPP
#include <cstddef>
#include <boost/mpl/assert.hpp>
#include <boost/mpl/at.hpp>
#include <boost/mpl/begin_end.hpp>
#include <boost/mpl/contains.hpp>
#include <boost/mpl/copy.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/inserter.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/or.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/mpl/push_back.hpp>
#include <boost/mpl/size.hpp>
#include <boost/mpl/vector/vector0.hpp>
#include <boost/mpl/vector/vector10.hpp>
#include <boost/type_traits/integral_constant.hpp>
#include <boost/type_traits/is_enum.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/make_signed.hpp>
#include <boost/type_traits/make_unsigned.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/utility/declval.hpp>
namespace boost
{
namespace detail_type_traits_common_type
{
/*******************************************************************************
* struct propagate_cv< From, To >
*
* This metafunction propagates cv-qualifiers on type From to type To.
******************************************************************************/
template< class From, class To >
struct propagate_cv
{ typedef To type; };
template< class From, class To >
struct propagate_cv< const From, To >
{ typedef To const type; };
template< class From, class To >
struct propagate_cv< volatile From, To >
{ typedef To volatile type; };
template< class From, class To >
struct propagate_cv< const volatile From, To >
{ typedef To const volatile type; };
/*******************************************************************************
* struct is_signable_integral<T>
*
* This metafunction determines if T is an integral type which can be made
* signed or unsigned.
******************************************************************************/
template< class T >
struct is_signable_integral
: mpl::or_< is_integral<T>, is_enum<T> >
{ };
template<>
struct is_signable_integral< bool >
: false_type
{ };
/*******************************************************************************
* struct sizeof_t<N>
* typedef ... yes_type
* typedef ... no_type
*
* These types are integral players in the use of the "sizeof trick", i.e., we
* can distinguish overload selection by inspecting the size of the return type
* of the overload.
******************************************************************************/
template< std::size_t N > struct sizeof_t { char _dummy[N]; };
typedef sizeof_t<1> yes_type;
typedef sizeof_t<2> no_type;
BOOST_MPL_ASSERT_RELATION( sizeof( yes_type ), ==, 1 );
BOOST_MPL_ASSERT_RELATION( sizeof( no_type ), ==, 2 );
/*******************************************************************************
* rvalue_test(T&) -> no_type
* rvalue_test(...) -> yes_type
*
* These overloads are used to determine the rvalue-ness of an expression.
******************************************************************************/
template< class T > no_type rvalue_test(T&);
yes_type rvalue_test(...);
/*******************************************************************************
* struct conversion_test_overloads< Sequence >
*
* This struct has multiple overloads of the static member function apply, each
* one taking a single parameter of a type within the Boost.MPL sequence
* Sequence. Each such apply overload has a return type with sizeof equal to
* one plus the index of the parameter type within Sequence. Thus, we can
* deduce the type T of an expression as long as we can generate a finite set of
* candidate types containing T via these apply overloads and the "sizeof
* trick".
******************************************************************************/
template< class First, class Last, std::size_t Index >
struct conversion_test_overloads_iterate
: conversion_test_overloads_iterate<
typename mpl::next< First >::type, Last, Index + 1
>
{
using conversion_test_overloads_iterate<
typename mpl::next< First >::type, Last, Index + 1
>::apply;
static sizeof_t< Index + 1 >
apply(typename mpl::deref< First >::type);
};
template< class Last, std::size_t Index >
struct conversion_test_overloads_iterate< Last, Last, Index >
{ static sizeof_t< Index + 1 > apply(...); };
template< class Sequence >
struct conversion_test_overloads
: conversion_test_overloads_iterate<
typename mpl::begin< Sequence >::type,
typename mpl::end< Sequence >::type,
0
>
{ };
/*******************************************************************************
* struct select< Sequence, Index >
*
* select is synonymous with mpl::at_c unless Index equals the size of the
* Boost.MPL Sequence, in which case this evaluates to void.
******************************************************************************/
template<
class Sequence, int Index,
int N = mpl::size< Sequence >::value
>
struct select
: mpl::at_c< Sequence, Index >
{ };
template< class Sequence, int N >
struct select< Sequence, N, N >
{ typedef void type; };
/*******************************************************************************
* class deduce_common_type< T, U, NominalCandidates >
* struct nominal_candidates<T,U>
* struct common_type_dispatch_on_rvalueness<T,U>
* struct common_type_impl<T,U>
*
* These classes and structs implement the logic behind common_type, which goes
* roughly as follows. Let C be the type of the conditional expression
* declval< bool >() ? declval<T>() : declval<U>()
* if C is an rvalue, then:
* let T' and U' be T and U stripped of reference- and cv-qualifiers
* if T' and U' are pointer types, say, T' = V* and U' = W*, then:
* define the set of NominalCandidates to be
* { V*, W*, V'*, W'* }
* where V' is V with whatever cv-qualifiers are on W, and W' is W
* with whatever cv-qualifiers are on V
* else T' and U' are both "signable integral types" (integral and enum
* types excepting bool), then:
* define the set of NominalCandidates to be
* { unsigned(T'), unsigned(U'), signed(T'), signed(U') }
* where unsigned(X) is make_unsigned<X>::type and signed(X) is
* make_signed<X>::type
* else
* define the set of NominalCandidates to be
* { T', U' }
* else
* let V and W be T and U stripped of reference-qualifiers
* define the set of NominalCandidates to be
* { V&, W&, V'&, W'& }
* where V' is V with whatever cv-qualifiers are on W, and W' is W with
* whatever cv-qualifiers are on V
* define the set of Candidates to be equal to the set of NominalCandidates with
* duplicates removed, and use this set of Candidates to determine C using the
* conversion_test_overloads struct
******************************************************************************/
template< class T, class U, class NominalCandidates >
class deduce_common_type
{
typedef typename mpl::copy<
NominalCandidates,
mpl::inserter<
mpl::vector0<>,
mpl::if_<
mpl::contains< mpl::_1, mpl::_2 >,
mpl::_1,
mpl::push_back< mpl::_1, mpl::_2 >
>
>
>::type candidate_types;
static const int best_candidate_index =
sizeof( conversion_test_overloads< candidate_types >::apply(
declval< bool >() ? declval<T>() : declval<U>()
) ) - 1;
public:
typedef typename select< candidate_types, best_candidate_index >::type type;
};
template<
class T, class U,
class V = typename remove_cv< typename remove_reference<T>::type >::type,
class W = typename remove_cv< typename remove_reference<U>::type >::type,
bool = is_signable_integral<V>::value && is_signable_integral<W>::value
>
struct nominal_candidates;
template< class T, class U, class V, class W >
struct nominal_candidates< T, U, V, W, false >
{ typedef mpl::vector2<V,W> type; };
template< class T, class U, class V, class W >
struct nominal_candidates< T, U, V, W, true >
{
typedef mpl::vector4<
typename make_unsigned<V>::type,
typename make_unsigned<W>::type,
typename make_signed<V>::type,
typename make_signed<W>::type
> type;
};
template< class T, class U, class V, class W >
struct nominal_candidates< T, U, V*, W*, false >
{
typedef mpl::vector4<
V*, W*,
typename propagate_cv<W,V>::type *,
typename propagate_cv<V,W>::type *
> type;
};
template<class T, class U, bool b>
struct common_type_dispatch_on_rvalueness
: deduce_common_type< T, U, typename nominal_candidates<T,U>::type >
{ };
template< class T, class U >
struct common_type_dispatch_on_rvalueness< T, U, false >
{
private:
typedef typename remove_reference<T>::type unrefed_T_type;
typedef typename remove_reference<U>::type unrefed_U_type;
public:
typedef typename deduce_common_type<
T, U,
mpl::vector4<
unrefed_T_type &,
unrefed_U_type &,
typename propagate_cv< unrefed_U_type, unrefed_T_type >::type &,
typename propagate_cv< unrefed_T_type, unrefed_U_type >::type &
>
>::type type;
};
template< class T, class U >
struct common_type_impl
: common_type_dispatch_on_rvalueness<T,U, sizeof( ::boost::detail_type_traits_common_type::rvalue_test(
declval< bool >() ? declval<T>() : declval<U>() ) ) == sizeof( yes_type ) >
{ };
template< class T > struct common_type_impl< T, void > { typedef void type; };
template< class T > struct common_type_impl< void, T > { typedef void type; };
template<> struct common_type_impl< void, void > { typedef void type; };
} // namespace detail_type_traits_common_type
} // namespace boost
#endif // BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_HPP

View File

@ -0,0 +1,29 @@
// Copyright (C) 2010 Peder Holt
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_TYPEOF_UNSUPPORTED_HPP_INCLUDED
#define BOOST_TYPEOF_UNSUPPORTED_HPP_INCLUDED
namespace boost { namespace type_of {
struct typeof_emulation_is_unsupported_on_this_compiler {};
}}
#define BOOST_TYPEOF(expr) boost::type_of::typeof_emulation_is_unsupported_on_this_compiler
#define BOOST_TYPEOF_TPL BOOST_TYPEOF
#define BOOST_TYPEOF_NESTED_TYPEDEF_TPL(name,expr) \
struct name {\
typedef BOOST_TYPEOF_TPL(expr) type;\
};
#define BOOST_TYPEOF_NESTED_TYPEDEF(name,expr) \
struct name {\
typedef BOOST_TYPEOF(expr) type;\
};
#define BOOST_TYPEOF_REGISTER_TYPE(x)
#define BOOST_TYPEOF_REGISTER_TEMPLATE(x, params)
#endif

View File

@ -0,0 +1,44 @@
// common_type.hpp ---------------------------------------------------------//
// Copyright 2010 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
#ifndef BOOST_TYPE_TRAITS_EXT_DECLVAL__HPP
#define BOOST_TYPE_TRAITS_EXT_DECLVAL__HPP
#include <boost/config.hpp>
//----------------------------------------------------------------------------//
#include <boost/type_traits/add_rvalue_reference.hpp>
//----------------------------------------------------------------------------//
// //
// C++03 implementation of //
// Written by Vicente J. Botet Escriba //
//~ 20.3.4 Function template declval [declval]
//~ 1 The library provides the function template declval to simplify the definition of expressions which occur as
//~ unevaluated operands.
//~ 2 Remarks: If this function is used, the program is ill-formed.
//~ 3 Remarks: The template parameter T of declval may be an incomplete type.
//~ [ Example:
//~ template <class To, class From>
//~ decltype(static_cast<To>(declval<From>())) convert(From&&);
//~ declares a function template convert which only participats in overloading if the type From can be
//~ explicitly converted to type To. For another example see class template common_type (20.7.6.6). —end
//~ example ]
// //
//----------------------------------------------------------------------------//
namespace boost {
template <typename T>
typename add_rvalue_reference<T>::type declval(); //noexcept; // as unevaluated operand
} // namespace boost
#endif // BOOST_TYPE_TRAITS_EXT_DECLVAL__HPP

View File

@ -35,6 +35,9 @@ public:
bool m_AbortEnable; // TRUE if abort button or menu to bool m_AbortEnable; // TRUE if abort button or menu to
// be displayed // be displayed
bool m_DisableEraseBG; // if true: do not allow background erasure
// (used to reduce flicker in Gerbview )
bool m_AutoPAN_Enable; // TRUE to allow auto pan bool m_AutoPAN_Enable; // TRUE to allow auto pan
bool m_AutoPAN_Request; // TRUE to request an auto pan bool m_AutoPAN_Request; // TRUE to request an auto pan

View File

@ -73,17 +73,18 @@ void WinEDA_MainFrame::ReCreateMenuBar()
wxMenuItem *item; wxMenuItem *item;
wxMenuBar *menuBar = GetMenuBar(); wxMenuBar *menuBar = GetMenuBar();
/** if( ! menuBar )
* Destroy the existing menu bar so it can be rebuilt. This allows menuBar = new wxMenuBar();
* language changes of the menu text on the fly.
*/
if( menuBar )
SetMenuBar( NULL );
menuBar = new wxMenuBar();
/** // Delete all existing menus so they can be rebuilt.
* Files menu // This allows language changes of the menu text on the fly.
*/ menuBar->Freeze();
while( menuBar->GetMenuCount() )
delete menuBar->Remove(0);
// Recreate all menus:
// Files menu
wxMenu* filesMenu = new wxMenu; wxMenu* filesMenu = new wxMenu;
/* Open */ /* Open */
@ -295,8 +296,13 @@ void WinEDA_MainFrame::ReCreateMenuBar()
menuBar->Append( PreferencesMenu, _( "&Preferences" ) ); menuBar->Append( PreferencesMenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
/* Associate the menu bar with the frame */ menuBar->Thaw();
SetMenuBar( menuBar );
// Associate the menu bar with the frame, if no previous menubar
if( GetMenuBar() == NULL )
SetMenuBar( menuBar );
else
menuBar->Refresh();
} }

View File

@ -19,10 +19,16 @@ 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(); // 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:
/* File menu */ /* File menu */
wxMenu* fileMenu = new wxMenu; wxMenu* fileMenu = new wxMenu;
@ -310,6 +316,11 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
menuBar->Append( placeMenu, _( "&Place" ) ); menuBar->Append( placeMenu, _( "&Place" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
/* Associate the menu bar with the frame */ menuBar->Thaw();
SetMenuBar( menuBar );
// Associate the menu bar with the frame, if no previous menubar
if( GetMenuBar() == NULL )
SetMenuBar( menuBar );
else
menuBar->Refresh();
} }

View File

@ -23,16 +23,18 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
wxMenuItem* item; wxMenuItem* item;
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar* menuBar = GetMenuBar();
/** if( ! menuBar )
* Destroy the existing menu bar so it can be rebuilt. This allows menuBar = new wxMenuBar();
* language changes of the menu text on the fly.
*/
if( menuBar )
SetMenuBar( NULL );
menuBar = new wxMenuBar();
// 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);
/** Create File Menu */ // Recreate all menus:
// Create File Menu
wxMenu* filesMenu = new wxMenu; wxMenu* filesMenu = new wxMenu;
// New // New
@ -606,6 +608,11 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
menuBar->Append( designRulesMenu, _( "&Design Rules" ) ); menuBar->Append( designRulesMenu, _( "&Design Rules" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
/* Associate the menu bar with the frame */ menuBar->Thaw();
SetMenuBar( menuBar );
// Associate the menu bar with the frame, if no previous menubar
if( GetMenuBar() == NULL )
SetMenuBar( menuBar );
else
menuBar->Refresh();
} }