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:
parent
8567eab09a
commit
a5cca18dd1
|
@ -43,6 +43,8 @@
|
|||
#include <gerbview_layer_widget.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 <gerbview_painter.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,
|
||||
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_UPDATE_UI( ID_MENU_CANVAS_LEGACY, 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_ZOOM_SELECTION, 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_POLYGONS_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar )
|
||||
EVT_TOOL( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar )
|
||||
EVT_TOOL( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnSelectOptionToolbar )
|
||||
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, GERBVIEW_FRAME::OnToggleCoordType )
|
||||
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, GERBVIEW_FRAME::OnTogglePolygonDrawMode )
|
||||
EVT_TOOL( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, GERBVIEW_FRAME::OnToggleFlashItemDrawMode )
|
||||
EVT_TOOL( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnToggleLineDrawMode )
|
||||
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_NEGATIVE_ITEMS, GERBVIEW_FRAME::OnSelectOptionToolbar )
|
||||
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
|
||||
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_APERATTRIBUTES_CHOICE, GERBVIEW_FRAME::OnSelectHighlightChoice )
|
||||
EVT_CHOICE( ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE,
|
||||
GERBVIEW_FRAME::OnSelectHighlightChoice )
|
||||
|
||||
// Right click context menu
|
||||
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_FLASHED_ITEMS_SKETCH,
|
||||
GERBVIEW_FRAME::OnUpdateFlashedItemsDrawMode )
|
||||
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnUpdateLinesDrawMode )
|
||||
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, GERBVIEW_FRAME::OnUpdatePolygonsDrawMode )
|
||||
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LINES_SKETCH, GERBVIEW_FRAME::OnUpdateLineDrawMode )
|
||||
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_NEGATIVE_ITEMS, GERBVIEW_FRAME::OnUpdateShowNegativeItems )
|
||||
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
|
||||
|
@ -370,6 +371,7 @@ void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event )
|
|||
if( gerber_layer )
|
||||
{
|
||||
wxString editorname = Pgm().GetEditorName();
|
||||
|
||||
if( !editorname.IsEmpty() )
|
||||
{
|
||||
wxFileName fn( gerber_layer->m_FileName );
|
||||
|
@ -390,7 +392,6 @@ void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event )
|
|||
else
|
||||
wxMessageBox( _( "No editor defined. Please select one" ) );
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
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 )
|
||||
{
|
||||
int id = event.GetId();
|
||||
bool state;
|
||||
bool needs_refresh = false;
|
||||
|
||||
GBR_DISPLAY_OPTIONS options = m_DisplayOptions;
|
||||
|
||||
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:
|
||||
SetElementVisibility( LAYER_DCODES, state );
|
||||
SetElementVisibility( LAYER_DCODES, !IsElementVisible( LAYER_DCODES ) );
|
||||
m_canvas->Refresh( true );
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS:
|
||||
SetElementVisibility( LAYER_NEGATIVE_OBJECTS, state );
|
||||
needs_refresh = true;
|
||||
SetElementVisibility( LAYER_NEGATIVE_OBJECTS, !IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
|
||||
m_canvas->Refresh( true );
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_DIFF_MODE:
|
||||
options.m_DiffMode = state;
|
||||
options.m_DiffMode = !options.m_DiffMode;
|
||||
needs_refresh = true;
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_HIGH_CONTRAST_MODE:
|
||||
options.m_HighContrastMode = state;
|
||||
options.m_HighContrastMode = !options.m_HighContrastMode;
|
||||
needs_refresh = true;
|
||||
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:
|
||||
case ID_TB_MEASUREMENT_TOOL:
|
||||
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 )
|
||||
{
|
||||
aEvent.Check( GetToolId() == aEvent.GetId() );
|
||||
|
|
|
@ -136,8 +136,10 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
|
||||
if( m_LastGridSizeId < 0 )
|
||||
m_LastGridSizeId = 0;
|
||||
|
||||
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;
|
||||
|
||||
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||
|
||||
m_auimgr.SetManagedWindow( this );
|
||||
|
@ -1074,6 +1076,7 @@ EDA_RECT GERBVIEW_FRAME::GetGerberLayoutBoundingBox()
|
|||
return GetGerberLayout()->GetBoundingBox();
|
||||
}
|
||||
|
||||
|
||||
void GERBVIEW_FRAME::UpdateStatusBar()
|
||||
{
|
||||
EDA_DRAW_FRAME::UpdateStatusBar();
|
||||
|
@ -1177,11 +1180,13 @@ const wxString GERBVIEW_FRAME::GetZoomLevelIndicator() const
|
|||
return EDA_DRAW_FRAME::GetZoomLevelIndicator();
|
||||
}
|
||||
|
||||
|
||||
GERBER_FILE_IMAGE* GERBVIEW_FRAME::GetGbrImage( int aIdx ) const
|
||||
{
|
||||
return m_gerberLayout->GetImagesList()->GetGbrImage( aIdx );
|
||||
}
|
||||
|
||||
|
||||
unsigned GERBVIEW_FRAME::ImagesMaxCount() const
|
||||
{
|
||||
return m_gerberLayout->GetImagesList()->ImagesMaxCount();
|
||||
|
@ -1236,6 +1241,7 @@ void GERBVIEW_FRAME::UseGalCanvas( bool aEnable )
|
|||
m_LayersManager->ReFillRender();
|
||||
|
||||
ReCreateOptToolbar();
|
||||
ReCreateMenuBar();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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) 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.
|
||||
*
|
||||
* 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
|
||||
* @return true if every file loaded successfully
|
||||
*/
|
||||
bool loadListOfGerberFiles( const wxString& aPath,
|
||||
const wxArrayString& aFilenameList );
|
||||
bool loadListOfGerberFiles( const wxString& aPath, const wxArrayString& aFilenameList );
|
||||
|
||||
public:
|
||||
GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
|
@ -493,6 +492,12 @@ public:
|
|||
|
||||
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 Process_Special_Functions( wxCommandEvent& event );
|
||||
|
@ -559,8 +564,8 @@ public:
|
|||
void OnUpdateDrawMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateCoordType( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateFlashedItemsDrawMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateLinesDrawMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdatePolygonsDrawMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdatePolygonDrawMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateShowDCodes( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateShowNegativeItems( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
|
||||
|
@ -583,7 +588,7 @@ public:
|
|||
virtual void HandleBlockPlace( wxDC* DC ) override;
|
||||
|
||||
/**
|
||||
* Function HandleBlockEnd( )
|
||||
* Function HandleBlockEnd
|
||||
* handles the end of a block command,
|
||||
* 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
|
||||
|
@ -644,8 +649,7 @@ public:
|
|||
* @param aReporter a REPORTER to collect warning and error messages
|
||||
* @return true if OK, false if a file cannot be readable
|
||||
*/
|
||||
bool unarchiveFiles( const wxString& aFullFileName,
|
||||
REPORTER* aReporter = nullptr );
|
||||
bool unarchiveFiles( const wxString& aFullFileName, REPORTER* aReporter = nullptr );
|
||||
|
||||
/**
|
||||
* function LoadGerberFiles
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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) 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
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -48,7 +48,6 @@ enum gerbview_ids
|
|||
ID_GERBVIEW_SHOW_SOURCE,
|
||||
ID_GERBVIEW_EXPORT_TO_PCBNEW,
|
||||
|
||||
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
|
||||
ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR,
|
||||
|
||||
ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE,
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* 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) 2009-2013 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -179,15 +179,115 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
_( "&Close" ), _( "Close GerbView" ),
|
||||
KiBitmap( exit_xpm ) );
|
||||
|
||||
// Menu for configuration and preferences
|
||||
wxMenu* configMenu = new wxMenu;
|
||||
//--------- View menu ----------------
|
||||
wxMenu* viewMenu = new wxMenu;
|
||||
|
||||
// Hide layer manager
|
||||
AddMenuItem( configMenu, ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
|
||||
_( "Hide &Layers Manager" ),
|
||||
m_show_layer_manager_tools ?
|
||||
_( "Hide &Layers Manager" ) : _("Show &Layers Manager" ),
|
||||
KiBitmap( layers_manager_xpm ) );
|
||||
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
|
||||
_( "Show &Layers Manager" ), _( "Show or hide the layer manager" ),
|
||||
KiBitmap( layers_manager_xpm ), wxITEM_CHECK );
|
||||
|
||||
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)
|
||||
#ifdef __WXMAC__
|
||||
|
@ -293,6 +393,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
|||
|
||||
// Append menus to the menubar
|
||||
menuBar->Append( fileMenu, _( "&File" ) );
|
||||
menuBar->Append( viewMenu, _( "&View" ) );
|
||||
menuBar->Append( configMenu, _( "&Preferences" ) );
|
||||
menuBar->Append( miscellaneousMenu, _( "&Miscellaneous" ) );
|
||||
menuBar->Append( helpMenu, _( "&Help" ) );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* 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 );
|
||||
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
|
||||
|
||||
msg = AddHotkeyName( _( "Zoom auto" ), GerbviewHokeysDescr, HK_ZOOM_AUTO, IS_COMMENT );
|
||||
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
|
||||
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_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
|
||||
_( "Zoom to selection" ), wxITEM_CHECK );
|
||||
|
@ -111,7 +112,8 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
|
|||
wxStaticText* text;
|
||||
|
||||
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 );
|
||||
|
||||
// Creates box to display and choose components:
|
||||
|
@ -189,7 +191,8 @@ void GERBVIEW_FRAME::ReCreateVToolbar( void )
|
|||
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
|
||||
|
||||
// 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 );
|
||||
|
||||
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
|
||||
// actual tools to put there. That, or I'll get around to implementing configurable
|
||||
// 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 );
|
||||
|
||||
if( IsGalCanvasActive() )
|
||||
|
@ -220,7 +224,8 @@ void GERBVIEW_FRAME::ReCreateOptToolbar( void )
|
|||
|
||||
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 );
|
||||
|
||||
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
|
||||
|
@ -249,15 +254,15 @@ void GERBVIEW_FRAME::ReCreateOptToolbar( void )
|
|||
KiScaledSeparator( m_mainToolBar, this );
|
||||
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, wxEmptyString,
|
||||
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,
|
||||
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,
|
||||
KiScaledBitmap( opt_show_polygon_xpm, this ),
|
||||
_( "Show polygons in sketch mode" ),
|
||||
_( "Show polygons in outline mode" ),
|
||||
wxITEM_CHECK );
|
||||
|
||||
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 ),
|
||||
_( "Show layers in raw mode\n"
|
||||
"(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,
|
||||
KiScaledBitmap( gbr_select_mode1_xpm, this ),
|
||||
_( "Show layers in stacked mode\n"
|
||||
"(show negative items without artifacts)" ),
|
||||
wxITEM_CHECK );
|
||||
wxITEM_RADIO );
|
||||
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_2, wxEmptyString,
|
||||
KiScaledBitmap( gbr_select_mode2_xpm, this ),
|
||||
_( "Show layers in transparency mode\n"
|
||||
"(show negative items without artifacts)" ),
|
||||
wxITEM_CHECK );
|
||||
wxITEM_RADIO );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -375,6 +380,7 @@ void GERBVIEW_FRAME::updateDCodeSelectBox()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void GERBVIEW_FRAME::updateComponentListSelectBox()
|
||||
{
|
||||
m_SelComponentBox->Clear();
|
||||
|
@ -479,6 +485,7 @@ void GERBVIEW_FRAME::updateAperAttributesSelectBox()
|
|||
m_SelAperAttributesBox->SetSelection( 0 );
|
||||
}
|
||||
|
||||
|
||||
void GERBVIEW_FRAME::OnUpdateDrawMode( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 );
|
||||
|
||||
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 );
|
||||
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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" ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue