GerbView: add view menu.

Include all actions provided by left vertical toolbar in a new view
menu for consistency with other main frames.

Move show/hide layer manager to view menu.

Simplify some toolbar and menu update logic.

Fixes lp:1753337

https://bugs.launchpad.net/kicad/+bug/1753337
This commit is contained in:
Wayne Stambaugh 2018-03-13 17:59:46 -04:00
parent 8567eab09a
commit a5cca18dd1
6 changed files with 354 additions and 186 deletions

View File

@ -43,6 +43,8 @@
#include <gerbview_layer_widget.h> #include <gerbview_layer_widget.h>
#include <dialog_show_page_borders.h> #include <dialog_show_page_borders.h>
#include <gerbview_draw_panel_gal.h>
#include <gal/graphics_abstraction_layer.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <gerbview_painter.h> #include <gerbview_painter.h>
#include <view/view.h> #include <view/view.h>
@ -84,8 +86,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
GERBVIEW_FRAME::Process_Config ) GERBVIEW_FRAME::Process_Config )
EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
GERBVIEW_FRAME::OnSelectOptionToolbar )
EVT_MENU( wxID_PREFERENCES, GERBVIEW_FRAME::InstallGerberOptionsDialog ) EVT_MENU( wxID_PREFERENCES, GERBVIEW_FRAME::InstallGerberOptionsDialog )
EVT_UPDATE_UI( ID_MENU_CANVAS_LEGACY, GERBVIEW_FRAME::OnUpdateSwitchCanvas ) EVT_UPDATE_UI( ID_MENU_CANVAS_LEGACY, GERBVIEW_FRAME::OnUpdateSwitchCanvas )
EVT_UPDATE_UI( ID_MENU_CANVAS_CAIRO, GERBVIEW_FRAME::OnUpdateSwitchCanvas ) EVT_UPDATE_UI( ID_MENU_CANVAS_CAIRO, GERBVIEW_FRAME::OnUpdateSwitchCanvas )
@ -126,12 +126,12 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
//EVT_TOOL( ID_NO_TOOL_SELECTED, GERBVIEW_FRAME::Process_Special_Functions ) // mentioned below //EVT_TOOL( ID_NO_TOOL_SELECTED, GERBVIEW_FRAME::Process_Special_Functions ) // mentioned below
EVT_TOOL( ID_ZOOM_SELECTION, GERBVIEW_FRAME::Process_Special_Functions ) EVT_TOOL( ID_ZOOM_SELECTION, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( ID_TB_MEASUREMENT_TOOL, GERBVIEW_FRAME::Process_Special_Functions ) EVT_TOOL( ID_TB_MEASUREMENT_TOOL, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, GERBVIEW_FRAME::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, GERBVIEW_FRAME::OnToggleCoordType )
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, GERBVIEW_FRAME::OnTogglePolygonDrawMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, GERBVIEW_FRAME::OnToggleFlashItemDrawMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnToggleLineDrawMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
GERBVIEW_FRAME::OnSelectOptionToolbar ) GERBVIEW_FRAME::OnToggleShowLayerManager )
EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, GERBVIEW_FRAME::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_DCODES, GERBVIEW_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, GERBVIEW_FRAME::OnSelectOptionToolbar ) EVT_TOOL( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, GERBVIEW_FRAME::OnSelectOptionToolbar )
EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2, EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
@ -142,7 +142,8 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
// Auxiliary horizontal toolbar // Auxiliary horizontal toolbar
EVT_CHOICE( ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice ) EVT_CHOICE( ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice )
EVT_CHOICE( ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice ) EVT_CHOICE( ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice )
EVT_CHOICE( ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice ) EVT_CHOICE( ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE,
GERBVIEW_FRAME::OnSelectHighlightChoice )
// Right click context menu // Right click context menu
EVT_MENU( ID_HIGHLIGHT_CMP_ITEMS, GERBVIEW_FRAME::Process_Special_Functions ) EVT_MENU( ID_HIGHLIGHT_CMP_ITEMS, GERBVIEW_FRAME::Process_Special_Functions )
@ -156,8 +157,8 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLAR_COORD, GERBVIEW_FRAME::OnUpdateCoordType ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLAR_COORD, GERBVIEW_FRAME::OnUpdateCoordType )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode ) GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnUpdateLinesDrawMode ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnUpdateLineDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, GERBVIEW_FRAME::OnUpdatePolygonsDrawMode ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, GERBVIEW_FRAME::OnUpdatePolygonDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_DCODES, GERBVIEW_FRAME::OnUpdateShowDCodes ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_DCODES, GERBVIEW_FRAME::OnUpdateShowDCodes )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, GERBVIEW_FRAME::OnUpdateShowNegativeItems ) EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, GERBVIEW_FRAME::OnUpdateShowNegativeItems )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
@ -370,6 +371,7 @@ void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event )
if( gerber_layer ) if( gerber_layer )
{ {
wxString editorname = Pgm().GetEditorName(); wxString editorname = Pgm().GetEditorName();
if( !editorname.IsEmpty() ) if( !editorname.IsEmpty() )
{ {
wxFileName fn( gerber_layer->m_FileName ); wxFileName fn( gerber_layer->m_FileName );
@ -390,7 +392,6 @@ void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event )
else else
wxMessageBox( _( "No editor defined. Please select one" ) ); wxMessageBox( _( "No editor defined. Please select one" ) );
} }
else else
{ {
wxString msg; wxString msg;
@ -445,78 +446,45 @@ void GERBVIEW_FRAME::ShowChangedLanguage()
} }
void GERBVIEW_FRAME::OnToggleShowLayerManager( wxCommandEvent& aEvent )
{
m_show_layer_manager_tools = !m_show_layer_manager_tools;
// show/hide auxiliary Vertical layers and visibility manager toolbar
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
m_auimgr.Update();
}
void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
bool state;
bool needs_refresh = false; bool needs_refresh = false;
GBR_DISPLAY_OPTIONS options = m_DisplayOptions; GBR_DISPLAY_OPTIONS options = m_DisplayOptions;
switch( id ) switch( id )
{ {
case ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG:
state = ! m_show_layer_manager_tools;
id = ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR;
break;
default:
state = m_optionsToolBar->GetToolToggled( id );
break;
}
switch( id )
{
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
options.m_DisplayPolarCood = state;
break;
case ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH:
options.m_DisplayFlashedItemsFill = not state;
needs_refresh = true;
break;
case ID_TB_OPTIONS_SHOW_LINES_SKETCH:
options.m_DisplayLinesFill = not state;
needs_refresh = true;
break;
case ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH:
options.m_DisplayPolygonsFill = not state;
needs_refresh = true;
break;
case ID_TB_OPTIONS_SHOW_DCODES: case ID_TB_OPTIONS_SHOW_DCODES:
SetElementVisibility( LAYER_DCODES, state ); SetElementVisibility( LAYER_DCODES, !IsElementVisible( LAYER_DCODES ) );
m_canvas->Refresh( true ); m_canvas->Refresh( true );
break; break;
case ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS: case ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS:
SetElementVisibility( LAYER_NEGATIVE_OBJECTS, state ); SetElementVisibility( LAYER_NEGATIVE_OBJECTS, !IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
needs_refresh = true; m_canvas->Refresh( true );
break; break;
case ID_TB_OPTIONS_DIFF_MODE: case ID_TB_OPTIONS_DIFF_MODE:
options.m_DiffMode = state; options.m_DiffMode = !options.m_DiffMode;
needs_refresh = true; needs_refresh = true;
break; break;
case ID_TB_OPTIONS_HIGH_CONTRAST_MODE: case ID_TB_OPTIONS_HIGH_CONTRAST_MODE:
options.m_HighContrastMode = state; options.m_HighContrastMode = !options.m_HighContrastMode;
needs_refresh = true; needs_refresh = true;
break; break;
case ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR:
// show/hide auxiliary Vertical layers and visibility manager toolbar
m_show_layer_manager_tools = state;
m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools );
m_auimgr.Update();
GetMenuBar()->SetLabel( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
m_show_layer_manager_tools ?
_("Hide &Layers Manager" ) : _("Show &Layers Manager" ));
break;
// collect GAL-only tools here: // collect GAL-only tools here:
case ID_TB_MEASUREMENT_TOOL: case ID_TB_MEASUREMENT_TOOL:
SetToolID( id, wxCURSOR_DEFAULT, _( "Unsupported tool in this canvas" ) ); SetToolID( id, wxCURSOR_DEFAULT, _( "Unsupported tool in this canvas" ) );
@ -532,6 +500,33 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
} }
void GERBVIEW_FRAME::OnTogglePolygonDrawMode( wxCommandEvent& aEvent )
{
GBR_DISPLAY_OPTIONS options = m_DisplayOptions;
options.m_DisplayPolygonsFill = !m_DisplayOptions.m_DisplayPolygonsFill;
UpdateDisplayOptions( options );
}
void GERBVIEW_FRAME::OnToggleLineDrawMode( wxCommandEvent& aEvent )
{
GBR_DISPLAY_OPTIONS options = m_DisplayOptions;
options.m_DisplayLinesFill = !m_DisplayOptions.m_DisplayLinesFill;
UpdateDisplayOptions( options );
}
void GERBVIEW_FRAME::OnToggleFlashItemDrawMode( wxCommandEvent& aEvent )
{
GBR_DISPLAY_OPTIONS options = m_DisplayOptions;
options.m_DisplayFlashedItemsFill = !m_DisplayOptions.m_DisplayFlashedItemsFill;
UpdateDisplayOptions( options );
}
void GERBVIEW_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( GetToolId() == aEvent.GetId() ); aEvent.Check( GetToolId() == aEvent.GetId() );

View File

@ -136,8 +136,10 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
if( m_LastGridSizeId < 0 ) if( m_LastGridSizeId < 0 )
m_LastGridSizeId = 0; m_LastGridSizeId = 0;
if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000 ) if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000 )
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000; m_LastGridSizeId = ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000;
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId ); GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
m_auimgr.SetManagedWindow( this ); m_auimgr.SetManagedWindow( this );
@ -1074,6 +1076,7 @@ EDA_RECT GERBVIEW_FRAME::GetGerberLayoutBoundingBox()
return GetGerberLayout()->GetBoundingBox(); return GetGerberLayout()->GetBoundingBox();
} }
void GERBVIEW_FRAME::UpdateStatusBar() void GERBVIEW_FRAME::UpdateStatusBar()
{ {
EDA_DRAW_FRAME::UpdateStatusBar(); EDA_DRAW_FRAME::UpdateStatusBar();
@ -1177,11 +1180,13 @@ const wxString GERBVIEW_FRAME::GetZoomLevelIndicator() const
return EDA_DRAW_FRAME::GetZoomLevelIndicator(); return EDA_DRAW_FRAME::GetZoomLevelIndicator();
} }
GERBER_FILE_IMAGE* GERBVIEW_FRAME::GetGbrImage( int aIdx ) const GERBER_FILE_IMAGE* GERBVIEW_FRAME::GetGbrImage( int aIdx ) const
{ {
return m_gerberLayout->GetImagesList()->GetGbrImage( aIdx ); return m_gerberLayout->GetImagesList()->GetGbrImage( aIdx );
} }
unsigned GERBVIEW_FRAME::ImagesMaxCount() const unsigned GERBVIEW_FRAME::ImagesMaxCount() const
{ {
return m_gerberLayout->GetImagesList()->ImagesMaxCount(); return m_gerberLayout->GetImagesList()->ImagesMaxCount();
@ -1236,6 +1241,7 @@ void GERBVIEW_FRAME::UseGalCanvas( bool aEnable )
m_LayersManager->ReFillRender(); m_LayersManager->ReFillRender();
ReCreateOptToolbar(); ReCreateOptToolbar();
ReCreateMenuBar();
} }

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@ -222,8 +222,7 @@ private:
* @param aFilenameList is a list of filenames to load * @param aFilenameList is a list of filenames to load
* @return true if every file loaded successfully * @return true if every file loaded successfully
*/ */
bool loadListOfGerberFiles( const wxString& aPath, bool loadListOfGerberFiles( const wxString& aPath, const wxArrayString& aFilenameList );
const wxArrayString& aFilenameList );
public: public:
GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ); GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent );
@ -493,6 +492,12 @@ public:
void SaveSettings( wxConfigBase* aCfg ) override; void SaveSettings( wxConfigBase* aCfg ) override;
void OnToggleCoordType( wxCommandEvent& aEvent );
void OnToggleFlashItemDrawMode( wxCommandEvent& aEvent );
void OnToggleLineDrawMode( wxCommandEvent& aEvent );
void OnTogglePolygonDrawMode( wxCommandEvent& aEvent );
void OnToggleShowLayerManager( wxCommandEvent& aEvent );
void ShowChangedLanguage() override; void ShowChangedLanguage() override;
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
@ -559,8 +564,8 @@ public:
void OnUpdateDrawMode( wxUpdateUIEvent& aEvent ); void OnUpdateDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateCoordType( wxUpdateUIEvent& aEvent ); void OnUpdateCoordType( wxUpdateUIEvent& aEvent );
void OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent ); void OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateLinesDrawMode( wxUpdateUIEvent& aEvent ); void OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent ); void OnUpdatePolygonDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateShowDCodes( wxUpdateUIEvent& aEvent ); void OnUpdateShowDCodes( wxUpdateUIEvent& aEvent );
void OnUpdateShowNegativeItems( wxUpdateUIEvent& aEvent ); void OnUpdateShowNegativeItems( wxUpdateUIEvent& aEvent );
void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent ); void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
@ -583,7 +588,7 @@ public:
virtual void HandleBlockPlace( wxDC* DC ) override; virtual void HandleBlockPlace( wxDC* DC ) override;
/** /**
* Function HandleBlockEnd( ) * Function HandleBlockEnd
* handles the end of a block command, * handles the end of a block command,
* It is called at the end of the definition of the area of a block. * It is called at the end of the definition of the area of a block.
* Depending on the current block command, this command is executed * Depending on the current block command, this command is executed
@ -644,8 +649,7 @@ public:
* @param aReporter a REPORTER to collect warning and error messages * @param aReporter a REPORTER to collect warning and error messages
* @return true if OK, false if a file cannot be readable * @return true if OK, false if a file cannot be readable
*/ */
bool unarchiveFiles( const wxString& aFullFileName, bool unarchiveFiles( const wxString& aFullFileName, REPORTER* aReporter = nullptr );
REPORTER* aReporter = nullptr );
/** /**
* function LoadGerberFiles * function LoadGerberFiles

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2010-2014 Jean-Pierre Charras jp.charras at wanadoo.fr * Copyright (C) 2010-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2018 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -48,7 +48,6 @@ enum gerbview_ids
ID_GERBVIEW_SHOW_SOURCE, ID_GERBVIEW_SHOW_SOURCE,
ID_GERBVIEW_EXPORT_TO_PCBNEW, ID_GERBVIEW_EXPORT_TO_PCBNEW,
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR, ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR,
ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE, ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE,

View File

@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009-2013 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -179,15 +179,115 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
_( "&Close" ), _( "Close GerbView" ), _( "&Close" ), _( "Close GerbView" ),
KiBitmap( exit_xpm ) ); KiBitmap( exit_xpm ) );
// Menu for configuration and preferences //--------- View menu ----------------
wxMenu* configMenu = new wxMenu; wxMenu* viewMenu = new wxMenu;
// Hide layer manager // Hide layer manager
AddMenuItem( configMenu, ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
_( "Hide &Layers Manager" ), _( "Show &Layers Manager" ), _( "Show or hide the layer manager" ),
m_show_layer_manager_tools ? KiBitmap( layers_manager_xpm ), wxITEM_CHECK );
_( "Hide &Layers Manager" ) : _("Show &Layers Manager" ),
KiBitmap( layers_manager_xpm ) ); viewMenu->AppendSeparator();
/* Important Note for ZOOM IN and ZOOM OUT commands from menubar:
* we cannot add hotkey info here, because the hotkey HK_ZOOM_IN and HK_ZOOM_OUT
* events(default = WXK_F1 and WXK_F2) are *NOT* equivalent to this menu command:
* zoom in and out from hotkeys are equivalent to the pop up menu zoom
* From here, zooming is made around the screen center
* From hotkeys, zooming is made around the mouse cursor position
* (obviously not possible from the toolbar or menubar command)
*
* in other words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators
* for Zoom in and Zoom out sub menus
*/
text = AddHotkeyName( _( "Zoom &In" ), GerbviewHokeysDescr,
HK_ZOOM_IN, IS_ACCELERATOR );
AddMenuItem( viewMenu, ID_ZOOM_IN, text, _( "Zoom in" ), KiBitmap( zoom_in_xpm ) );
text = AddHotkeyName( _( "Zoom &Out" ), GerbviewHokeysDescr,
HK_ZOOM_OUT, IS_ACCELERATOR );
AddMenuItem( viewMenu, ID_ZOOM_OUT, text, _( "Zoom out" ), KiBitmap( zoom_out_xpm ) );
text = AddHotkeyName( _( "&Fit" ), GerbviewHokeysDescr, HK_ZOOM_AUTO );
AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, _( "Zoom to fit" ),
KiBitmap( zoom_fit_in_page_xpm ) );
text = AddHotkeyName( _( "&Redraw" ), GerbviewHokeysDescr, HK_ZOOM_REDRAW );
AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text,
_( "Refresh screen" ), KiBitmap( zoom_redraw_xpm ) );
viewMenu->AppendSeparator();
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_GRID,
_( "Show &Grid" ), wxEmptyString,
KiBitmap( grid_xpm ), wxITEM_CHECK );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_POLAR_COORD,
_( "Display &Polar Coordinates" ), wxEmptyString,
KiBitmap( polar_coord_xpm ), wxITEM_CHECK );
// Units submenu
wxMenu* unitsSubMenu = new wxMenu;
AddMenuItem( unitsSubMenu, ID_TB_OPTIONS_SELECT_UNIT_INCH,
_( "&Imperial" ), _( "Use imperial units" ),
KiBitmap( unit_inch_xpm ), wxITEM_RADIO );
AddMenuItem( unitsSubMenu, ID_TB_OPTIONS_SELECT_UNIT_MM,
_( "&Metric" ), _( "Use metric units" ),
KiBitmap( unit_mm_xpm ), wxITEM_RADIO );
AddMenuItem( viewMenu, unitsSubMenu,
-1, _( "&Units" ),
_( "Select which units are displayed" ),
KiBitmap( unit_mm_xpm ) );
viewMenu->AppendSeparator();
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
_( "Sketch F&lashed Items" ),_( "Show flashed items in outline mode" ),
KiBitmap( pad_sketch_xpm ), wxITEM_CHECK );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_LINES_SKETCH,
_( "Sketch &Lines" ),_( "Show lines in outline mode" ),
KiBitmap( showtrack_xpm ), wxITEM_CHECK );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
_( "Sketch Pol&ygons" ),_( "Show polygons in outline mode" ),
KiBitmap( opt_show_polygon_xpm ), wxITEM_CHECK );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_DCODES,
_( "Show &DCodes" ), _( "Show or hide DCodes" ),
KiBitmap( show_dcodenumber_xpm ), wxITEM_CHECK );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS,
_( "Show &Negative Objects" ), _( "Show negative objects in ghost color" ),
KiBitmap( gerbview_show_negative_objects_xpm ), wxITEM_CHECK );
if( IsGalCanvasActive() )
{
AddMenuItem( viewMenu, ID_TB_OPTIONS_DIFF_MODE,
_( "Show in Differential Mode" ), _( "Show layers in differential mode" ),
KiBitmap( gbr_select_mode2_xpm ), wxITEM_CHECK );
AddMenuItem( viewMenu, ID_TB_OPTIONS_HIGH_CONTRAST_MODE,
_( "Show in High Contrast" ), _( "Show in high contrast mode" ),
KiBitmap( contrast_mode_xpm ), wxITEM_CHECK );
}
else
{
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_GBR_MODE_0,
_( "Show Normal Mode" ), _( "Show layers in normal mode" ),
KiBitmap( gbr_select_mode0_xpm ), wxITEM_RADIO );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_GBR_MODE_1,
_( "Show Stacked Mode" ), _( "Show layers in stacked mode" ),
KiBitmap( gbr_select_mode1_xpm ), wxITEM_RADIO );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
_( "Show Transparency Mode" ), _( "Show layers in transparency mode" ),
KiBitmap( gbr_select_mode2_xpm ), wxITEM_RADIO );
}
// Menu for configuration and preferences
wxMenu* configMenu = new wxMenu;
// Options (Preferences on WXMAC) // Options (Preferences on WXMAC)
#ifdef __WXMAC__ #ifdef __WXMAC__
@ -293,6 +393,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
// Append menus to the menubar // Append menus to the menubar
menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( fileMenu, _( "&File" ) );
menuBar->Append( viewMenu, _( "&View" ) );
menuBar->Append( configMenu, _( "&Preferences" ) ); menuBar->Append( configMenu, _( "&Preferences" ) );
menuBar->Append( miscellaneousMenu, _( "&Miscellaneous" ) ); menuBar->Append( miscellaneousMenu, _( "&Miscellaneous" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@ -81,8 +81,9 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
msg = AddHotkeyName( _( "Zoom out" ), GerbviewHokeysDescr, HK_ZOOM_OUT, IS_COMMENT ); msg = AddHotkeyName( _( "Zoom out" ), GerbviewHokeysDescr, HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg ); m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), GerbviewHokeysDescr, HK_ZOOM_AUTO, IS_COMMENT ); msg = AddHotkeyName( _( "Zoom to fit" ), GerbviewHokeysDescr, HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg ); m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ), m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
_( "Zoom to selection" ), wxITEM_CHECK ); _( "Zoom to selection" ), wxITEM_CHECK );
@ -91,7 +92,7 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
m_SelLayerBox = new GBR_LAYER_BOX_SELECTOR( m_mainToolBar, m_SelLayerBox = new GBR_LAYER_BOX_SELECTOR( m_mainToolBar,
ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
wxDefaultPosition, wxDefaultSize, 0,NULL); wxDefaultPosition, wxDefaultSize, 0, NULL );
m_SelLayerBox->Resync(); m_SelLayerBox->Resync();
m_mainToolBar->AddControl( m_SelLayerBox ); m_mainToolBar->AddControl( m_SelLayerBox );
@ -111,7 +112,8 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
wxStaticText* text; wxStaticText* text;
if( !m_auxiliaryToolBar ) if( !m_auxiliaryToolBar )
m_auxiliaryToolBar = new wxAuiToolBar( this, ID_AUX_TOOLBAR, wxDefaultPosition, wxDefaultSize, m_auxiliaryToolBar = new wxAuiToolBar( this, ID_AUX_TOOLBAR, wxDefaultPosition,
wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT ); KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Creates box to display and choose components: // Creates box to display and choose components:
@ -120,7 +122,7 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
m_SelComponentBox = new wxChoice( m_auxiliaryToolBar, m_SelComponentBox = new wxChoice( m_auxiliaryToolBar,
ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE ); ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE );
m_SelComponentBox->SetToolTip( _("Select a component and highlight items belonging to this component") ); m_SelComponentBox->SetToolTip( _("Select a component and highlight items belonging to this component") );
text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _("Cmp:") ); text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "Cmp: ") );
m_auxiliaryToolBar->AddControl( text ); m_auxiliaryToolBar->AddControl( text );
m_auxiliaryToolBar->AddControl( m_SelComponentBox ); m_auxiliaryToolBar->AddControl( m_SelComponentBox );
KiScaledSeparator( m_auxiliaryToolBar, this ); KiScaledSeparator( m_auxiliaryToolBar, this );
@ -132,7 +134,7 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
m_SelNetnameBox = new wxChoice( m_auxiliaryToolBar, m_SelNetnameBox = new wxChoice( m_auxiliaryToolBar,
ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE ); ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE );
m_SelNetnameBox->SetToolTip( _("Select a net name and highlight graphic items belonging to this net") ); m_SelNetnameBox->SetToolTip( _("Select a net name and highlight graphic items belonging to this net") );
text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _("Net:") ); text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "Net:" ) );
m_auxiliaryToolBar->AddControl( text ); m_auxiliaryToolBar->AddControl( text );
m_auxiliaryToolBar->AddControl( m_SelNetnameBox ); m_auxiliaryToolBar->AddControl( m_SelNetnameBox );
KiScaledSeparator( m_auxiliaryToolBar, this ); KiScaledSeparator( m_auxiliaryToolBar, this );
@ -144,7 +146,7 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
m_SelAperAttributesBox = new wxChoice( m_auxiliaryToolBar, m_SelAperAttributesBox = new wxChoice( m_auxiliaryToolBar,
ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE ); ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE );
m_SelAperAttributesBox->SetToolTip( _("Select an aperture attribute and highlight graphic items having this attribute") ); m_SelAperAttributesBox->SetToolTip( _("Select an aperture attribute and highlight graphic items having this attribute") );
text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _("Attr:") ); text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "Attr:" ) );
m_auxiliaryToolBar->AddControl( text ); m_auxiliaryToolBar->AddControl( text );
m_auxiliaryToolBar->AddControl( m_SelAperAttributesBox ); m_auxiliaryToolBar->AddControl( m_SelAperAttributesBox );
KiScaledSeparator( m_auxiliaryToolBar, this ); KiScaledSeparator( m_auxiliaryToolBar, this );
@ -155,7 +157,7 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
m_DCodeSelector = new DCODE_SELECTION_BOX( m_auxiliaryToolBar, m_DCodeSelector = new DCODE_SELECTION_BOX( m_auxiliaryToolBar,
ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE,
wxDefaultPosition, wxSize( 150, -1 ) ); wxDefaultPosition, wxSize( 150, -1 ) );
text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _("DCode:") ); text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _( "DCode:" ) );
m_auxiliaryToolBar->AddControl( text ); m_auxiliaryToolBar->AddControl( text );
m_auxiliaryToolBar->AddControl( m_DCodeSelector ); m_auxiliaryToolBar->AddControl( m_DCodeSelector );
} }
@ -189,7 +191,8 @@ void GERBVIEW_FRAME::ReCreateVToolbar( void )
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL ); KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar // Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ) ); m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString,
KiScaledBitmap( cursor_xpm, this ) );
KiScaledSeparator( m_mainToolBar, this ); KiScaledSeparator( m_mainToolBar, this );
m_drawToolBar->Realize(); m_drawToolBar->Realize();
@ -207,7 +210,8 @@ void GERBVIEW_FRAME::ReCreateOptToolbar( void )
// TODO: these can be moved to the 'proper' vertical toolbar if and when there are // TODO: these can be moved to the 'proper' vertical toolbar if and when there are
// actual tools to put there. That, or I'll get around to implementing configurable // actual tools to put there. That, or I'll get around to implementing configurable
// toolbars. // toolbars.
m_optionsToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ), m_optionsToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString,
KiScaledBitmap( cursor_xpm, this ),
wxEmptyString, wxITEM_CHECK ); wxEmptyString, wxITEM_CHECK );
if( IsGalCanvasActive() ) if( IsGalCanvasActive() )
@ -220,7 +224,8 @@ void GERBVIEW_FRAME::ReCreateOptToolbar( void )
KiScaledSeparator( m_mainToolBar, this ); KiScaledSeparator( m_mainToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiScaledBitmap( grid_xpm, this ), m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
KiScaledBitmap( grid_xpm, this ),
_( "Turn grid off" ), wxITEM_CHECK ); _( "Turn grid off" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
@ -249,15 +254,15 @@ void GERBVIEW_FRAME::ReCreateOptToolbar( void )
KiScaledSeparator( m_mainToolBar, this ); KiScaledSeparator( m_mainToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, wxEmptyString,
KiScaledBitmap( pad_sketch_xpm, this ), KiScaledBitmap( pad_sketch_xpm, this ),
_( "Show spots in sketch mode" ), wxITEM_CHECK ); _( "Show flashed items in outline mode" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_LINES_SKETCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_LINES_SKETCH, wxEmptyString,
KiScaledBitmap( showtrack_xpm, this ), KiScaledBitmap( showtrack_xpm, this ),
_( "Show lines in sketch mode" ), wxITEM_CHECK ); _( "Show lines in outline mode" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, wxEmptyString,
KiScaledBitmap( opt_show_polygon_xpm, this ), KiScaledBitmap( opt_show_polygon_xpm, this ),
_( "Show polygons in sketch mode" ), _( "Show polygons in outline mode" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, wxEmptyString,
@ -277,17 +282,17 @@ void GERBVIEW_FRAME::ReCreateOptToolbar( void )
KiScaledBitmap( gbr_select_mode0_xpm, this ), KiScaledBitmap( gbr_select_mode0_xpm, this ),
_( "Show layers in raw mode\n" _( "Show layers in raw mode\n"
"(could have problems with negative items when more than one gerber file is shown)" ), "(could have problems with negative items when more than one gerber file is shown)" ),
wxITEM_CHECK ); wxITEM_RADIO );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_1, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_1, wxEmptyString,
KiScaledBitmap( gbr_select_mode1_xpm, this ), KiScaledBitmap( gbr_select_mode1_xpm, this ),
_( "Show layers in stacked mode\n" _( "Show layers in stacked mode\n"
"(show negative items without artifacts)" ), "(show negative items without artifacts)" ),
wxITEM_CHECK ); wxITEM_RADIO );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_2, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_2, wxEmptyString,
KiScaledBitmap( gbr_select_mode2_xpm, this ), KiScaledBitmap( gbr_select_mode2_xpm, this ),
_( "Show layers in transparency mode\n" _( "Show layers in transparency mode\n"
"(show negative items without artifacts)" ), "(show negative items without artifacts)" ),
wxITEM_CHECK ); wxITEM_RADIO );
} }
else else
{ {
@ -375,6 +380,7 @@ void GERBVIEW_FRAME::updateDCodeSelectBox()
} }
} }
void GERBVIEW_FRAME::updateComponentListSelectBox() void GERBVIEW_FRAME::updateComponentListSelectBox()
{ {
m_SelComponentBox->Clear(); m_SelComponentBox->Clear();
@ -479,6 +485,7 @@ void GERBVIEW_FRAME::updateAperAttributesSelectBox()
m_SelAperAttributesBox->SetSelection( 0 ); m_SelAperAttributesBox->SetSelection( 0 );
} }
void GERBVIEW_FRAME::OnUpdateDrawMode( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateDrawMode( wxUpdateUIEvent& aEvent )
{ {
switch( aEvent.GetId() ) switch( aEvent.GetId() )
@ -501,50 +508,106 @@ void GERBVIEW_FRAME::OnUpdateDrawMode( wxUpdateUIEvent& aEvent )
} }
void GERBVIEW_FRAME::OnToggleCoordType( wxCommandEvent& aEvent )
{
m_DisplayOptions.m_DisplayPolarCood = !m_DisplayOptions.m_DisplayPolarCood;
UpdateStatusBar();
}
void GERBVIEW_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( m_DisplayOptions.m_DisplayPolarCood ); aEvent.Check( m_DisplayOptions.m_DisplayPolarCood );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
m_DisplayOptions.m_DisplayPolarCood ?
_( "Turn rectangular coordinates on" ) :
_( "Tunn polar coordinates on" ) );
} }
void GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( !m_DisplayOptions.m_DisplayFlashedItemsFill ); aEvent.Check( !m_DisplayOptions.m_DisplayFlashedItemsFill );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
m_DisplayOptions.m_DisplayFlashedItemsFill ?
_( "Show flashed items in outline mode" ) :
_( "Show flashed items in fill mode" ) );
} }
void GERBVIEW_FRAME::OnUpdateLinesDrawMode( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( !m_DisplayOptions.m_DisplayLinesFill ); aEvent.Check( !m_DisplayOptions.m_DisplayLinesFill );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_LINES_SKETCH,
m_DisplayOptions.m_DisplayFlashedItemsFill ?
_( "Show lines in outline mode" ) :
_( "Show lines in fill mode" ) );
} }
void GERBVIEW_FRAME::OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdatePolygonDrawMode( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( !m_DisplayOptions.m_DisplayPolygonsFill ); aEvent.Check( !m_DisplayOptions.m_DisplayPolygonsFill );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
m_DisplayOptions.m_DisplayFlashedItemsFill ?
_( "Show polygons in outline mode" ) :
_( "Show polygons in fill mode" ) );
} }
void GERBVIEW_FRAME::OnUpdateShowDCodes( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateShowDCodes( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( IsElementVisible( LAYER_DCODES ) ); aEvent.Check( IsElementVisible( LAYER_DCODES ) );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_DCODES,
IsElementVisible( LAYER_DCODES ) ?
_( "Hide DCodes" ) : _( "Show DCodes" ) );
} }
void GERBVIEW_FRAME::OnUpdateShowNegativeItems( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateShowNegativeItems( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( IsElementVisible( LAYER_NEGATIVE_OBJECTS ) ); aEvent.Check( IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS,
IsElementVisible( LAYER_NEGATIVE_OBJECTS ) ?
_( "Show negative objects in normal color" ) :
_( "Show negative objects in ghost color" ) );
} }
void GERBVIEW_FRAME::OnUpdateDiffMode( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateDiffMode( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( m_DisplayOptions.m_DiffMode ); aEvent.Check( m_DisplayOptions.m_DiffMode );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DIFF_MODE,
m_DisplayOptions.m_DiffMode ?
_( "Show layers in normal mode" ) :
_( "Show layers in differential mode" ) );
} }
void GERBVIEW_FRAME::OnUpdateHighContrastMode( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateHighContrastMode( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( m_DisplayOptions.m_HighContrastMode ); aEvent.Check( m_DisplayOptions.m_HighContrastMode );
if( m_optionsToolBar )
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIGH_CONTRAST_MODE,
m_DisplayOptions.m_HighContrastMode ?
_( "Disable high contrast mode" ) :
_( "Enable high contrast mode" ) );
} }
@ -555,9 +618,9 @@ void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
if( m_optionsToolBar ) if( m_optionsToolBar )
{ {
if( m_show_layer_manager_tools ) if( m_show_layer_manager_tools )
m_optionsToolBar->SetToolShortHelp( aEvent.GetId(), _("Hide layers manager" ) ); m_optionsToolBar->SetToolShortHelp( aEvent.GetId(), _( "Hide layers manager" ) );
else else
m_optionsToolBar->SetToolShortHelp( aEvent.GetId(), _("Show layers manager" ) ); m_optionsToolBar->SetToolShortHelp( aEvent.GetId(), _( "Show layers manager" ) );
} }
} }