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
@ -104,23 +104,23 @@ public:
* calculates the bounding box containing all gerber items. * calculates the bounding box containing all gerber items.
* @return EDA_RECT - the items bounding box * @return EDA_RECT - the items bounding box
*/ */
EDA_RECT GetGerberLayoutBoundingBox(); EDA_RECT GetGerberLayoutBoundingBox();
void SetPageSettings( const PAGE_INFO& aPageSettings ) override; void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
const PAGE_INFO& GetPageSettings() const override; const PAGE_INFO& GetPageSettings() const override;
const wxSize GetPageSizeIU() const override; const wxSize GetPageSizeIU() const override;
const wxPoint& GetAuxOrigin() const override; const wxPoint& GetAuxOrigin() const override;
void SetAuxOrigin( const wxPoint& aPoint ) override; void SetAuxOrigin( const wxPoint& aPoint ) override;
const wxPoint& GetGridOrigin() const override { return m_grid_origin; } const wxPoint& GetGridOrigin() const override { return m_grid_origin; }
void SetGridOrigin( const wxPoint& aPoint ) override void SetGridOrigin( const wxPoint& aPoint ) override
{ {
m_grid_origin = aPoint; m_grid_origin = aPoint;
} }
const TITLE_BLOCK& GetTitleBlock() const override; const TITLE_BLOCK& GetTitleBlock() const override;
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override; void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
/** /**
* Function SetCurItem * Function SetCurItem
@ -132,7 +132,7 @@ public:
* @param aItem The GERBER_DRAW_ITEM to make the selected item or NULL if none. * @param aItem The GERBER_DRAW_ITEM to make the selected item or NULL if none.
* @param aDisplayInfo = true to display item info, false if not (default = true) * @param aDisplayInfo = true to display item info, false if not (default = true)
*/ */
void SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo = true ); void SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo = true );
/** Install the dialog box for layer selection /** Install the dialog box for layer selection
* @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer) * @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer)
@ -222,21 +222,20 @@ 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 );
~GERBVIEW_FRAME(); ~GERBVIEW_FRAME();
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl ) override; bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl ) override;
// Virtual basic functions: // Virtual basic functions:
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override; void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
void ReCreateHToolbar() override; void ReCreateHToolbar() override;
void ReCreateAuxiliaryToolbar() override; void ReCreateAuxiliaryToolbar() override;
/** /**
* Function ReCreateVToolbar * Function ReCreateVToolbar
@ -244,20 +243,20 @@ public:
* *
* @note This is currently not used. * @note This is currently not used.
*/ */
void ReCreateVToolbar() override; void ReCreateVToolbar() override;
/** /**
* Create or update the left vertical toolbar (option toolbar * Create or update the left vertical toolbar (option toolbar
*/ */
void ReCreateOptToolbar(); void ReCreateOptToolbar();
void ReCreateMenuBar() override; void ReCreateMenuBar() override;
void OnLeftClick( wxDC* aDC, const wxPoint& aMousePos ) override; void OnLeftClick( wxDC* aDC, const wxPoint& aMousePos ) override;
void OnLeftDClick( wxDC* aDC, const wxPoint& aMousePos ) override; void OnLeftDClick( wxDC* aDC, const wxPoint& aMousePos ) override;
bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) override; bool OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) override;
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent ); void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
double BestZoom() override; double BestZoom() override;
void UpdateStatusBar() override; void UpdateStatusBar() override;
wxAuiToolBar* GetMainToolBar() { return m_optionsToolBar; } wxAuiToolBar* GetMainToolBar() { return m_optionsToolBar; }
@ -313,7 +312,7 @@ public:
* @param aItemIdVisible is an item id from the enum GERBVIEW_LAYER_ID * @param aItemIdVisible is an item id from the enum GERBVIEW_LAYER_ID
* @return bool - true if the element is visible. * @return bool - true if the element is visible.
*/ */
bool IsElementVisible( GERBVIEW_LAYER_ID aItemIdVisible ) const; bool IsElementVisible( GERBVIEW_LAYER_ID aItemIdVisible ) const;
/** /**
* Function SetElementVisibility * Function SetElementVisibility
@ -322,14 +321,14 @@ public:
* @param aNewState = The new visibility state of the element category * @param aNewState = The new visibility state of the element category
* (see enum PCB) * (see enum PCB)
*/ */
void SetElementVisibility( GERBVIEW_LAYER_ID aItemIdVisible, bool aNewState ); void SetElementVisibility( GERBVIEW_LAYER_ID aItemIdVisible, bool aNewState );
/** /**
* Function SetGridVisibility(), virtual from EDA_DRAW_FRAME * Function SetGridVisibility(), virtual from EDA_DRAW_FRAME
* It may be overloaded by derived classes * It may be overloaded by derived classes
* @param aVisible = true if the grid must be shown * @param aVisible = true if the grid must be shown
*/ */
void SetGridVisibility( bool aVisible ) override; void SetGridVisibility( bool aVisible ) override;
/** /**
* Function GetVisibleLayers * Function GetVisibleLayers
@ -345,7 +344,7 @@ public:
* changes the bit-mask of visible layers * changes the bit-mask of visible layers
* @param aLayerMask = The new bit-mask of visible layers * @param aLayerMask = The new bit-mask of visible layers
*/ */
void SetVisibleLayers( long aLayerMask ); void SetVisibleLayers( long aLayerMask );
/** /**
* Function IsLayerVisible * Function IsLayerVisible
@ -353,7 +352,7 @@ public:
* @param aLayer = The layer to be tested (still 0-31!) * @param aLayer = The layer to be tested (still 0-31!)
* @return bool - true if the layer is visible. * @return bool - true if the layer is visible.
*/ */
bool IsLayerVisible( int aLayer ) const; bool IsLayerVisible( int aLayer ) const;
/** /**
* Function GetVisibleElementColor * Function GetVisibleElementColor
@ -361,7 +360,7 @@ public:
*/ */
COLOR4D GetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible ); COLOR4D GetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible );
void SetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible, COLOR4D aColor ); void SetVisibleElementColor( GERBVIEW_LAYER_ID aItemIdVisible, COLOR4D aColor );
/** /**
* Function GetLayerColor * Function GetLayerColor
@ -373,7 +372,7 @@ public:
* Function SetLayerColor * Function SetLayerColor
* changes a layer color for any valid layer. * changes a layer color for any valid layer.
*/ */
void SetLayerColor( int aLayer, COLOR4D aColor ); void SetLayerColor( int aLayer, COLOR4D aColor );
/** /**
* Function GetNegativeItemsColor * Function GetNegativeItemsColor
@ -418,7 +417,7 @@ public:
* 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 new gerber files. * loading new gerber files.
*/ */
void ReFillLayerWidget(); void ReFillLayerWidget();
/** /**
* Function SetActiveLayer * Function SetActiveLayer
@ -455,7 +454,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
@ -465,7 +464,7 @@ public:
* @param aRebuildLayerBox = true to rebuild the layer box * @param aRebuildLayerBox = true to rebuild the layer box
* false to just updates the selection. * false to just updates the selection.
*/ */
void syncLayerBox( bool aRebuildLayerBox = false ); void syncLayerBox( bool aRebuildLayerBox = false );
/** /**
* Function UpdateTitleAndInfo * Function UpdateTitleAndInfo
@ -476,7 +475,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();
/** /**
* Function GetConfigurationSettings * Function GetConfigurationSettings
@ -487,26 +486,32 @@ public:
* GerbView source code (mainly in dialogs). If you need to define a configuration * GerbView source code (mainly in dialogs). If you need to define a configuration
* setting that need to be loaded at run time, this is the place to define it. * setting that need to be loaded at run time, this is the place to define it.
*/ */
PARAM_CFG_ARRAY& GetConfigurationSettings( void ); PARAM_CFG_ARRAY& GetConfigurationSettings( void );
void LoadSettings( wxConfigBase* aCfg ) override; void LoadSettings( wxConfigBase* aCfg ) override;
void SaveSettings( wxConfigBase* aCfg ) override; void SaveSettings( wxConfigBase* aCfg ) override;
void ShowChangedLanguage() override; void OnToggleCoordType( wxCommandEvent& aEvent );
void OnToggleFlashItemDrawMode( wxCommandEvent& aEvent );
void OnToggleLineDrawMode( wxCommandEvent& aEvent );
void OnTogglePolygonDrawMode( wxCommandEvent& aEvent );
void OnToggleShowLayerManager( wxCommandEvent& aEvent );
void Process_Special_Functions( wxCommandEvent& event ); void ShowChangedLanguage() override;
void OnSelectOptionToolbar( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event );
/// Handles the changing of the highlighted component/net/attribute /// Handles the changing of the highlighted component/net/attribute
void OnSelectHighlightChoice( wxCommandEvent& event ); void OnSelectHighlightChoice( wxCommandEvent& event );
/** /**
* Function OnSelectActiveDCode * Function OnSelectActiveDCode
* Selects the active DCode for the current active layer. * Selects the active DCode for the current active layer.
* Items using this DCode are highlighted. * Items using this DCode are highlighted.
*/ */
void OnSelectActiveDCode( wxCommandEvent& event ); void OnSelectActiveDCode( wxCommandEvent& event );
/** /**
* Function OnSelectActiveLayer * Function OnSelectActiveLayer
@ -514,14 +519,14 @@ public:
* - if a file is loaded, it is loaded in this layer * - if a file is loaded, it is loaded in this layer
* _ this layer is displayed on top of other layers * _ this layer is displayed on top of other layers
*/ */
void OnSelectActiveLayer( wxCommandEvent& event ); void OnSelectActiveLayer( wxCommandEvent& event );
/** /**
* Function OnShowGerberSourceFile * Function OnShowGerberSourceFile
* Call the preferred editor to show (and edit) the gerber source file * Call the preferred editor to show (and edit) the gerber source file
* loaded in the active layer * loaded in the active layer
*/ */
void OnShowGerberSourceFile( wxCommandEvent& event ); void OnShowGerberSourceFile( wxCommandEvent& event );
/** /**
* Function OnSelectDisplayMode * Function OnSelectDisplayMode
@ -529,13 +534,13 @@ public:
* 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 );
/** /**
* Function OnQuit * Function OnQuit
* called on request of application quit * called on request of application quit
*/ */
void OnQuit( wxCommandEvent& event ); void OnQuit( wxCommandEvent& event );
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription() ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override; EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
@ -551,39 +556,39 @@ public:
*/ */
bool OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override; bool OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, EDA_ITEM* aItem = NULL ) override;
GERBER_DRAW_ITEM* Locate( const wxPoint& aPosition, int typeloc ); GERBER_DRAW_ITEM* Locate( const wxPoint& aPosition, int typeloc );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void InstallGerberOptionsDialog( wxCommandEvent& event ); void InstallGerberOptionsDialog( wxCommandEvent& event );
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 );
void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent ); void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent ); void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
void OnUpdateDiffMode( wxUpdateUIEvent& aEvent ); void OnUpdateDiffMode( wxUpdateUIEvent& aEvent );
void OnUpdateHighContrastMode( wxUpdateUIEvent& aEvent ); void OnUpdateHighContrastMode( wxUpdateUIEvent& aEvent );
/** /**
* Function BlockCommand * Function BlockCommand
* returns the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to * returns the block command (BLOCK_MOVE, BLOCK_COPY...) corresponding to
* the \a aKey (ALT, SHIFT ALT ..) * the \a aKey (ALT, SHIFT ALT ..)
*/ */
virtual int BlockCommand( EDA_KEY key ) override; virtual int BlockCommand( EDA_KEY key ) override;
/** /**
* Function HandleBlockPlace * Function HandleBlockPlace
* handles the block place command. * handles the block place command.
*/ */
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
@ -593,7 +598,7 @@ public:
* @return false if no item selected, or command finished, * @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later. * true if some items found and HandleBlockPlace must be called later.
*/ */
virtual bool HandleBlockEnd( wxDC* DC ) override; virtual bool HandleBlockEnd( wxDC* DC ) override;
/** /**
* Function Block_Move * Function Block_Move
@ -601,42 +606,42 @@ public:
* New location is determined by the current offset from the selected * New location is determined by the current offset from the selected
* block's original location. * block's original location.
*/ */
void Block_Move(); void Block_Move();
/** /**
* 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 Files_io( wxCommandEvent& event ); void Files_io( wxCommandEvent& event );
/** /**
* Function OnGbrFileHistory * Function OnGbrFileHistory
* deletes the current data and loads a Gerber file selected from history list on * deletes the current data and loads a Gerber file selected from history list on
* current layer. * current layer.
*/ */
void OnGbrFileHistory( wxCommandEvent& event ); void OnGbrFileHistory( wxCommandEvent& event );
/** /**
* Function OnDrlFileHistory * Function OnDrlFileHistory
* deletes the current data and load a drill file in Excellon format selected from * deletes the current data and load a drill file in Excellon format selected from
* history list on current layer. * history list on current layer.
*/ */
void OnDrlFileHistory( wxCommandEvent& event ); void OnDrlFileHistory( wxCommandEvent& event );
/** /**
* Function OnZipFileHistory * Function OnZipFileHistory
* deletes the current data and load a zip archive file selected from the * deletes the current data and load a zip archive file selected from the
* history list. The archive is expected coantaining a set of gerber and drill file * history list. The archive is expected coantaining a set of gerber and drill file
*/ */
void OnZipFileHistory( wxCommandEvent& event ); void OnZipFileHistory( wxCommandEvent& event );
/** /**
* deletes the current data and load a gerber job file selected from the * deletes the current data and load a gerber job file selected from the
* history list. * history list.
*/ */
void OnJobFileHistory( wxCommandEvent& event ); void OnJobFileHistory( wxCommandEvent& event );
/** /**
* Extracts gerber and drill files from the zip archive, and load them * Extracts gerber and drill files from the zip archive, and load them
@ -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
@ -655,8 +659,8 @@ 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 );
bool Read_GERBER_File( const wxString& GERBER_FullFileName ); bool Read_GERBER_File( const wxString& GERBER_FullFileName );
/** /**
* function LoadExcellonFiles * function LoadExcellonFiles
@ -666,8 +670,8 @@ public:
* if empty string: user will be prompted for filename(s) * if empty string: user will be prompted for filename(s)
* @return true if file was opened successfully. * @return true if file was opened successfully.
*/ */
bool LoadExcellonFiles( const wxString& aFileName ); bool LoadExcellonFiles( const wxString& aFileName );
bool Read_EXCELLON_File( const wxString& aFullFileName ); bool Read_EXCELLON_File( const wxString& aFullFileName );
/** /**
* function LoadZipArchiveFileLoadZipArchiveFile * function LoadZipArchiveFileLoadZipArchiveFile
@ -677,7 +681,7 @@ public:
* if empty string: user will be prompted for filename(s) * if empty string: user will be prompted for filename(s)
* @return true if file was opened successfully. * @return true if file was opened successfully.
*/ */
bool LoadZipArchiveFile( const wxString& aFileName ); bool LoadZipArchiveFile( const wxString& aFileName );
/** /**
@ -687,30 +691,30 @@ public:
* if empty string: user will be prompted for filename(s) * if empty string: user will be prompted for filename(s)
* @return true if file(s) was opened successfully. * @return true if file(s) was opened successfully.
*/ */
bool LoadGerberJobFile( const wxString& aFileName ); bool LoadGerberJobFile( const wxString& aFileName );
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override; bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey = 0 ) override;
/** /**
* Set Size Items (Lines, Flashes) from DCodes List * Set Size Items (Lines, Flashes) from DCodes List
*/ */
void Liste_D_Codes(); void Liste_D_Codes();
// PCB handling // PCB handling
bool Clear_DrawLayers( bool query ); bool Clear_DrawLayers( bool query );
void Erase_Current_DrawLayer( bool query ); void Erase_Current_DrawLayer( bool query );
void SortLayersByX2Attributes(); void SortLayersByX2Attributes();
/** /**
* Updates the display options and refreshes the view as needed * Updates the display options and refreshes the view as needed
* @param aOptions is the new options to apply * @param aOptions is the new options to apply
*/ */
void UpdateDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions ); void UpdateDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions );
// 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.
@ -742,8 +746,8 @@ public:
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
* @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, LSET aPrintMasklayer, bool aPrintMirrorMode, virtual void PrintPage( wxDC* aDC, LSET aPrintMasklayer, bool aPrintMirrorMode,
void* aData = NULL ) override; void* aData = NULL ) override;
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas ///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
virtual void UseGalCanvas( bool aEnable ) override; virtual void UseGalCanvas( bool aEnable ) override;

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,17 +81,18 @@ 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 );
KiScaledSeparator( m_mainToolBar, this ); KiScaledSeparator( m_mainToolBar, this );
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 );
@ -142,9 +144,9 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
if( !m_SelAperAttributesBox ) if( !m_SelAperAttributesBox )
{ {
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" ) );
} }
} }