Push polar coords down into COMMON_TOOLS.

This commit is contained in:
Jeff Young 2019-05-17 12:52:38 +01:00
parent e33871fbf0
commit 1a3d0492f5
30 changed files with 88 additions and 152 deletions

View File

@ -126,6 +126,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight();
m_movingCursorWithKeyboard = false;
m_zoomLevelCoeff = 1.0;
m_UserUnits = MILLIMETRES;
m_PolarCoords = false;
m_auimgr.SetFlags(wxAUI_MGR_DEFAULT);

View File

@ -212,6 +212,11 @@ TOOL_ACTION ACTIONS::toggleUnits( "common.Control.toggleUnits",
unit_mm_xpm );
TOOL_ACTION ACTIONS::togglePolarCoords( "common.Control.togglePolarCoords",
AS_GLOBAL, 0,
_( "Polar Coordinates" ), _( "Switch between polar and cartesian coordinate systems" ),
polar_coord_xpm );
TOOL_ACTION ACTIONS::toggleCursor( "common.Control.toggleCursor",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_TOGGLE_CURSOR ),
_( "Always Show Cursor" ), _( "Display crosshairs even in selection tool" ),

View File

@ -445,6 +445,16 @@ int COMMON_TOOLS::ToggleUnits( const TOOL_EVENT& aEvent )
}
int COMMON_TOOLS::TogglePolarCoords( const TOOL_EVENT& aEvent )
{
m_frame->SetStatusText( wxEmptyString );
m_frame->SetShowPolarCoords( !m_frame->GetShowPolarCoords() );
m_frame->UpdateStatusBar();
return 0;
}
int COMMON_TOOLS::ToggleCursor( const TOOL_EVENT& aEvent )
{
auto& galOpts = m_frame->GetGalDisplayOptions();
@ -509,6 +519,7 @@ void COMMON_TOOLS::setTransitions()
Go( &COMMON_TOOLS::ImperialUnits, ACTIONS::imperialUnits.MakeEvent() );
Go( &COMMON_TOOLS::MetricUnits, ACTIONS::metricUnits.MakeEvent() );
Go( &COMMON_TOOLS::ToggleUnits, ACTIONS::toggleUnits.MakeEvent() );
Go( &COMMON_TOOLS::TogglePolarCoords, ACTIONS::togglePolarCoords.MakeEvent() );
Go( &COMMON_TOOLS::ToggleCursor, ACTIONS::toggleCursor.MakeEvent() );
Go( &COMMON_TOOLS::ToggleCursorStyle, ACTIONS::toggleCursorStyle.MakeEvent() );

View File

@ -229,12 +229,8 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar()
wxITEM_CHECK );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
KiScaledBitmap( polar_coord_xpm, this ),
_( "Display polar coordinates" ), wxITEM_CHECK );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );

View File

@ -37,7 +37,7 @@ PANEL_GERBVIEW_SETTINGS::PANEL_GERBVIEW_SETTINGS( GERBVIEW_FRAME *aFrame, wxWind
bool PANEL_GERBVIEW_SETTINGS::TransferDataToWindow( )
{
m_PolarDisplay->SetSelection( m_Parent->m_DisplayOptions.m_DisplayPolarCood ? 1 : 0 );
m_PolarDisplay->SetSelection( m_Parent->GetShowPolarCoords() ? 1 : 0 );
m_BoxUnits->SetSelection( m_Parent->GetUserUnits() ? 1 : 0 );
m_ShowPageLimitsOpt->SetValue( m_Parent->m_DisplayOptions.m_DisplayPageLimits );
@ -56,7 +56,7 @@ bool PANEL_GERBVIEW_SETTINGS::TransferDataToWindow( )
bool PANEL_GERBVIEW_SETTINGS::TransferDataFromWindow()
{
m_Parent->m_DisplayOptions.m_DisplayPolarCood = ( m_PolarDisplay->GetSelection() != 0 );
m_Parent->SetShowPolarCoords( m_PolarDisplay->GetSelection() != 0 );
m_Parent->SetUserUnits( m_BoxUnits->GetSelection() == 0 ? INCHES : MILLIMETRES );
m_Parent->m_DisplayOptions.m_DisplayPageLimits = m_ShowPageLimitsOpt->GetValue();

View File

@ -115,7 +115,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
// Option toolbar
EVT_TOOL( ID_TB_MEASUREMENT_TOOL, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, GERBVIEW_FRAME::OnToggleCoordType )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
GERBVIEW_FRAME::OnToggleShowLayerManager )
EVT_TOOL_RANGE( ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_2,

View File

@ -42,7 +42,6 @@ public:
bool m_DisplayFlashedItemsFill; ///< Option to draw flashed items (filled/sketch)
bool m_DisplayLinesFill; ///< Option to draw line items (filled/sketch)
bool m_DisplayPolygonsFill; ///< Option to draw polygons (filled/sketch)
bool m_DisplayPolarCood; ///< Option to display coordinates in status bar in X,Y or Polar coords
bool m_DisplayDCodes; ///< Option to show dcode values on items drawn with a dcode tool
bool m_DisplayPageLimits;
bool m_DisplayNegativeObjects; ///< Option to draw negative objects in a specific color
@ -61,7 +60,6 @@ public:
m_DisplayFlashedItemsFill = true;
m_DisplayLinesFill = true;
m_DisplayPolygonsFill = true;
m_DisplayPolarCood = false;
m_DisplayDCodes = false;
m_DisplayPageLimits = false;
m_IsPrinting = false;

View File

@ -94,7 +94,7 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
&g_ColorsSettings.m_LayersColors[LAYER_PCB_BACKGROUND], BLACK ) );
m_configSettings.push_back( new PARAM_CFG_BOOL(
true, wxT( "DisplayPolarCoordinates" ),
&m_DisplayOptions.m_DisplayPolarCood, false ) );
&m_PolarCoords, false ) );
// Default colors for layers 0 to 31
static const COLOR4D color_default[] = {

View File

@ -1059,7 +1059,7 @@ void GERBVIEW_FRAME::UpdateStatusBar()
double dYpos;
wxString line;
if( m_DisplayOptions.m_DisplayPolarCood ) // display relative polar coordinates
if( GetShowPolarCoords() ) // display relative polar coordinates
{
double theta, ro;
@ -1116,7 +1116,7 @@ void GERBVIEW_FRAME::UpdateStatusBar()
line.Printf( absformatter, dXpos, dYpos );
SetStatusText( line, 2 );
if( !m_DisplayOptions.m_DisplayPolarCood ) // display relative cartesian coordinates
if( !GetShowPolarCoords() ) // display relative cartesian coordinates
{
// Display relative coordinates:
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;

View File

@ -413,13 +413,8 @@ public:
PARAM_CFG_ARRAY& GetConfigurationSettings( void );
void LoadSettings( 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;

View File

@ -190,7 +190,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
return IsGridVisible();
};
auto polarCoordsCondition = [ this ] ( const SELECTION& aSel ) {
return m_DisplayOptions.m_DisplayPolarCood;
return GetShowPolarCoords();
};
auto layersManagerShownCondition = [ this ] ( const SELECTION& aSel ) {
return m_show_layer_manager_tools;
@ -238,12 +238,8 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AppendSeparator();
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_POLAR_COORD,
_( "Display &Polar Coordinates" ), wxEmptyString,
polar_coord_xpm, polarCoordsCondition );
viewMenu->AddCheckItem( ACTIONS::togglePolarCoords, polarCoordsCondition );
// Units submenu
CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool );

View File

@ -224,12 +224,8 @@ void GERBVIEW_FRAME::ReCreateOptToolbar()
m_optionsToolBar->Add( GERBVIEW_ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
KiScaledBitmap( polar_coord_xpm, this ),
_( "Display polar coordinates" ), wxITEM_CHECK );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
@ -446,14 +442,6 @@ void GERBVIEW_FRAME::OnUpdateDrawMode( wxUpdateUIEvent& aEvent )
}
void GERBVIEW_FRAME::OnToggleCoordType( wxCommandEvent& aEvent )
{
m_DisplayOptions.m_DisplayPolarCood = !m_DisplayOptions.m_DisplayPolarCood;
UpdateStatusBar();
}
void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent )
{
if( !m_DCodeSelector )

View File

@ -123,6 +123,7 @@ protected:
int m_UndoRedoCountMax; ///< default Undo/Redo command Max depth, to be handed
// to screens
EDA_UNITS_T m_UserUnits;
bool m_PolarCoords; //< for those frames that support polar coordinates
/// The area to draw on.
EDA_DRAW_PANEL* m_canvas;
@ -295,6 +296,12 @@ public:
unitsChangeRefresh();
}
/**
* For those frames that support polar coordinates.
*/
bool GetShowPolarCoords() const { return m_PolarCoords; }
void SetShowPolarCoords( bool aShow ) { m_PolarCoords = aShow; }
/**
* Return the origin of the axis used for plotting and various exports.
*/

View File

@ -267,9 +267,6 @@ enum main_id
ID_EDA_SOCKET_EVENT,
// Common to all
ID_TB_OPTIONS_SELECT_CURSOR,
ID_TB_OPTIONS_SHOW_POLAR_COORD,
ID_TB_OPTIONS_SHOW_GRID,
ID_HELP_GET_INVOLVED,
// Common to Pcbnew and CvPcb

View File

@ -572,7 +572,6 @@ public:
void CommonSettingsChanged() override;
void OnTogglePolarCoords( wxCommandEvent& aEvent );
void OnTogglePadDrawMode( wxCommandEvent& aEvent );
void OnToggleGraphicDrawMode( wxCommandEvent& aEvent );
void OnToggleEdgeDrawMode( wxCommandEvent& aEvent );
@ -581,7 +580,6 @@ public:
virtual void OnSwitchCanvas( wxCommandEvent& aEvent );
// User interface update event handlers.
void OnUpdateCoordType( wxUpdateUIEvent& aEvent );
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
virtual void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) {}

View File

@ -72,7 +72,6 @@ public:
/// How trace clearances are displayed. @see TRACE_CLEARANCE_DISPLAY_MODE_T.
TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode;
bool m_DisplayPolarCood;
int m_DisplayZonesMode;
int m_DisplayNetNamesMode; /* 0 do not show netnames,
* 1 show netnames on pads

View File

@ -73,7 +73,6 @@ public:
/// How trace clearances are displayed. @see TRACE_CLEARANCE_DISPLAY_MODE_T.
TRACE_CLEARANCE_DISPLAY_MODE_T m_ShowTrackClearanceMode;
bool m_DisplayPolarCood;
int m_DisplayZonesMode;
int m_DisplayNetNamesMode; /* 0 do not show netnames,
* 1 show netnames on pads

View File

@ -104,6 +104,7 @@ public:
static TOOL_ACTION imperialUnits;
static TOOL_ACTION metricUnits;
static TOOL_ACTION toggleUnits;
static TOOL_ACTION togglePolarCoords;
/**
* Function TranslateLegacyId()

View File

@ -69,6 +69,7 @@ public:
int ImperialUnits( const TOOL_EVENT& aEvent );
int MetricUnits( const TOOL_EVENT& aEvent );
int ToggleUnits( const TOOL_EVENT& aEvent );
int TogglePolarCoords( const TOOL_EVENT& aEvent );
// Grid control
int GridNext( const TOOL_EVENT& aEvent );

View File

@ -43,7 +43,7 @@ bool PANEL_MODEDIT_SETTINGS::TransferDataToWindow()
auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
// Display options
m_PolarDisplay->SetSelection( displ_opts->m_DisplayPolarCood ? 1 : 0 );
m_PolarDisplay->SetSelection( m_frame->GetShowPolarCoords() ? 1 : 0 );
m_UnitsSelection->SetSelection( m_frame->GetUserUnits() == INCHES ? 0 : 1 );
// Editing options
@ -58,9 +58,7 @@ bool PANEL_MODEDIT_SETTINGS::TransferDataToWindow()
bool PANEL_MODEDIT_SETTINGS::TransferDataFromWindow()
{
// Display options
auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_frame->GetDisplayOptions();
displ_opts->m_DisplayPolarCood = m_PolarDisplay->GetSelection() != 0;
m_frame->SetShowPolarCoords( m_PolarDisplay->GetSelection() != 0 );
m_frame->SetUserUnits( m_UnitsSelection->GetSelection() == 0 ? INCHES : MILLIMETRES );
// Editing options

View File

@ -44,7 +44,7 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataToWindow()
auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_Frame->GetDisplayOptions();
/* Set display options */
m_PolarDisplay->SetSelection( displ_opts->m_DisplayPolarCood ? 1 : 0 );
m_PolarDisplay->SetSelection( m_Frame->GetShowPolarCoords() ? 1 : 0 );
m_UnitsSelection->SetSelection( m_Frame->GetUserUnits() == INCHES ? 0 : 1 );
wxString rotationAngle;
@ -70,9 +70,7 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataToWindow()
bool PANEL_PCBNEW_SETTINGS::TransferDataFromWindow()
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)m_Frame->GetDisplayOptions();
displ_opts->m_DisplayPolarCood = m_PolarDisplay->GetSelection() != 0;
m_Frame->SetShowPolarCoords( m_PolarDisplay->GetSelection() != 0 );
m_Frame->SetUserUnits( m_UnitsSelection->GetSelection() == 0 ? INCHES : MILLIMETRES );
m_Frame->SetRotationAngle( wxRound( 10.0 * wxAtof( m_RotationAngle->GetValue() ) ) );
@ -94,8 +92,9 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataFromWindow()
m_Frame->SetShowPageLimits( m_Show_Page_Limits->GetValue() );
// Apply changes to the GAL
KIGFX::VIEW* view = m_Frame->GetGalCanvas()->GetView();
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*) m_Frame->GetDisplayOptions();
KIGFX::VIEW* view = m_Frame->GetGalCanvas()->GetView();
KIGFX::PCB_PAINTER* painter = static_cast<KIGFX::PCB_PAINTER*>( view->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings = painter->GetSettings();
settings->LoadDisplayOptions( displ_opts, m_Frame->ShowPageLimits() );

View File

@ -50,7 +50,7 @@ PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings()
// Display options:
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ),
&displ_opts->m_DisplayPolarCood, false ) );
&m_PolarCoords, false ) );
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ),
&displ_opts->m_DisplayPadFill, true ) );
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorGraphicLinesDisplayMode" ),

View File

@ -192,7 +192,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
return IsGridVisible();
};
auto polarCoordsCondition = [ this ] ( const SELECTION& aSel ) {
return ( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayPolarCood;
return GetShowPolarCoords();
};
auto imperialUnitsCondition = [ this ] ( const SELECTION& aSel ) {
return GetUserUnits() == INCHES;
@ -226,35 +226,28 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
three_d_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddSeparator();
viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomTool, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomTool, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AppendSeparator();
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
viewMenu->AddItem( ACTIONS::gridProperties, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_POLAR_COORD,
_( "Display &Polar Coordinates" ), wxEmptyString,
polar_coord_xpm, polarCoordsCondition );
viewMenu->AddSeparator();
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
viewMenu->AddItem( ACTIONS::gridProperties, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddCheckItem( PCB_ACTIONS::togglePolarCoords, polarCoordsCondition );
// Units submenu
CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool );
unitsSubMenu->SetTitle( _( "&Units" ) );
unitsSubMenu->SetIcon( unit_mm_xpm );
unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition );
unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition );
unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition );
unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition );
viewMenu->AddMenu( unitsSubMenu );
viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition );
viewMenu->AppendSeparator();
viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition );
viewMenu->AddSeparator();
// Drawing Mode Submenu
CONDITIONAL_MENU* drawingModeSubMenu = new CONDITIONAL_MENU( false, selTool );
drawingModeSubMenu->SetTitle( _( "&Drawing Mode" ) );
@ -262,7 +255,6 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::padDisplayMode, sketchPadsCondition );
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::moduleEdgeOutlines, sketchEdgesCondition );
viewMenu->AddMenu( drawingModeSubMenu );
// Contrast Mode Submenu
@ -271,16 +263,11 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
contrastModeSubMenu->SetIcon( contrast_mode_xpm );
contrastModeSubMenu->AddCheckItem( PCB_ACTIONS::highContrastMode, contrastModeCondition );
contrastModeSubMenu->AddSeparator();
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaDec, SELECTION_CONDITIONS::ShowAlways );
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaInc, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddMenu( contrastModeSubMenu );
// Separator
viewMenu->AppendSeparator();
viewMenu->AddSeparator();
viewMenu->AddCheckItem( ID_MODEDIT_SHOW_HIDE_SEARCH_TREE,
_( "&Search Tree" ), _( "Toggles the search tree visibility" ),
search_tree_xpm, searchTreeShownCondition );

View File

@ -154,7 +154,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
return IsGridVisible();
};
auto polarCoordsCondition = [ this ] ( const SELECTION& aSel ) {
return ( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayPolarCood;
return GetShowPolarCoords();
};
auto imperialUnitsCondition = [ this ] ( const SELECTION& aSel ) {
return GetUserUnits() == INCHES;
@ -211,19 +211,16 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
three_d_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddSeparator();
viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomTool, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomTool, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AppendSeparator();
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
viewMenu->AddItem( ACTIONS::gridProperties, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_POLAR_COORD,
_( "Display &Polar Coordinates" ), wxEmptyString,
polar_coord_xpm, polarCoordsCondition );
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
viewMenu->AddItem( ACTIONS::gridProperties, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddCheckItem( PCB_ACTIONS::togglePolarCoords, polarCoordsCondition );
// Units submenu
CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool );
@ -240,7 +237,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
viewMenu->AddCheckItem( PCB_ACTIONS::ratsnestLineMode, curvedRatsnestCondition );
viewMenu->AddSeparator();
// Drawing Mode Submenu
CONDITIONAL_MENU* drawingModeSubMenu = new CONDITIONAL_MENU( false, selTool );
drawingModeSubMenu->SetTitle( _( "&Drawing Mode" ) );
@ -254,7 +250,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::padDisplayMode, sketchPadsCondition );
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::viaDisplayMode, sketchViasCondition );
drawingModeSubMenu->AddCheckItem( PCB_ACTIONS::trackDisplayMode, sketchTracksCondition );
viewMenu->AddMenu( drawingModeSubMenu );
// Contrast Mode Submenu
@ -263,11 +258,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
contrastModeSubMenu->SetIcon( contrast_mode_xpm );
contrastModeSubMenu->AddCheckItem( PCB_ACTIONS::highContrastMode, contrastModeCondition );
contrastModeSubMenu->AddSeparator();
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaDec, SELECTION_CONDITIONS::ShowAlways );
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaInc, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddMenu( contrastModeSubMenu );
viewMenu->AddCheckItem( ID_MENU_PCB_FLIP_VIEW,

View File

@ -81,13 +81,11 @@ BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
PCB_BASE_FRAME::ProcessItemSelection )
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, PCB_BASE_FRAME::OnTogglePolarCoords )
EVT_TOOL( ID_TB_OPTIONS_SHOW_PADS_SKETCH, PCB_BASE_FRAME::OnTogglePadDrawMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH, PCB_BASE_FRAME::OnToggleGraphicDrawMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, PCB_BASE_FRAME::OnToggleEdgeDrawMode )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, PCB_BASE_FRAME::OnToggleTextDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLAR_COORD, PCB_BASE_FRAME::OnUpdateCoordType )
EVT_UPDATE_UI( ID_ON_GRID_SELECT, PCB_BASE_FRAME::OnUpdateSelectGrid )
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, PCB_BASE_FRAME::OnUpdateSelectZoom )
// Switching canvases
@ -529,17 +527,6 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer )
}
void PCB_BASE_FRAME::OnTogglePolarCoords( wxCommandEvent& aEvent )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
SetStatusText( wxEmptyString );
displ_opts->m_DisplayPolarCood = !displ_opts->m_DisplayPolarCood;
UpdateStatusBar();
}
void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
@ -629,18 +616,6 @@ void PCB_BASE_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent )
}
void PCB_BASE_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( displ_opts->m_DisplayPolarCood );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
displ_opts->m_DisplayPolarCood ?
_( "Display rectangular coordinates" ) :
_( "Display polar coordinates" ) );
}
void PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
{
if( m_zoomSelectBox == NULL || m_zoomSelectBox->GetParent() == NULL )
@ -784,11 +759,10 @@ void PCB_BASE_FRAME::UpdateStatusBar()
wxString line;
wxString locformatter;
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
EDA_DRAW_FRAME::UpdateStatusBar();
if( displ_opts->m_DisplayPolarCood ) // display polar coordinates
if( GetShowPolarCoords() ) // display polar coordinates
{
double dx = (double)GetCrossHairPosition().x - (double)screen->m_O_Curseur.x;
double dy = (double)GetCrossHairPosition().y - (double)screen->m_O_Curseur.y;
@ -853,7 +827,7 @@ void PCB_BASE_FRAME::UpdateStatusBar()
line.Printf( absformatter, dXpos, dYpos );
SetStatusText( line, 2 );
if( !displ_opts->m_DisplayPolarCood ) // display relative cartesian coordinates
if( !GetShowPolarCoords() ) // display relative cartesian coordinates
{
// Display relative coordinates:
double dx = (double)GetCrossHairPosition().x - (double)screen->m_O_Curseur.x;

View File

@ -43,8 +43,6 @@ PCB_DISPLAY_OPTIONS::PCB_DISPLAY_OPTIONS()
m_DisplayPcbTrackFill = FILLED; // false = sketch , true = filled
m_ShowTrackClearanceMode = SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS;
m_DisplayPolarCood = false; /* false = display absolute coordinates,
* true = display polar cordinates */
m_DisplayZonesMode = 0; /* 0 = Show filled areas outlines in zones,
* 1 = do not show filled areas outlines
* 2 = show outlines of filled areas */

View File

@ -172,7 +172,7 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
if( m_configParams.empty() )
{
m_configParams.push_back( new PARAM_CFG_BOOL( true, wxT( "DisplayPolarCoords" ),
&displ_opts->m_DisplayPolarCood, false ) );
&m_PolarCoords, false ) );
// Display options and modes:
m_configParams.push_back( new PARAM_CFG_INT( true, wxT( "ShowNetNamesMode" ),
&displ_opts->m_DisplayNetNamesMode, 3, 0, 3 ) );

View File

@ -174,11 +174,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
KiScaledBitmap( polar_coord_xpm, this ),
_( "Display Polar Coord ON" ), wxITEM_CHECK );
m_optionsToolBar->Add( PCB_ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
@ -206,12 +202,13 @@ void FOOTPRINT_EDIT_FRAME::SyncMenusAndToolbars()
m_mainToolBar->Toggle( ACTIONS::zoomTool, GetToolId() == ID_ZOOM_SELECTION );
m_mainToolBar->Refresh();
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts->m_DisplayPadFill );
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
m_optionsToolBar->Toggle( ACTIONS::togglePolarCoords, GetShowPolarCoords() );
m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts->m_DisplayPadFill );
m_optionsToolBar->Toggle( PCB_ACTIONS::moduleEdgeOutlines, !opts->m_DisplayModEdgeFill );
m_optionsToolBar->Toggle( PCB_ACTIONS::highContrastMode, opts->m_ContrastModeDisplay );
m_optionsToolBar->Toggle( PCB_ACTIONS::highContrastMode, opts->m_ContrastModeDisplay );
m_optionsToolBar->Refresh();
m_drawToolBar->Toggle( PCB_ACTIONS::selectionTool, GetToolId() == ID_NO_TOOL_SELECTED );

View File

@ -349,10 +349,7 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
_( "Enable design rule checking" ), wxITEM_CHECK );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
KiScaledBitmap( polar_coord_xpm, this ),
_( "Display polar coordinates" ), wxITEM_CHECK );
m_optionsToolBar->Add( PCB_ACTIONS::togglePolarCoords, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
@ -815,12 +812,13 @@ void PCB_EDIT_FRAME::SyncMenusAndToolbars()
m_mainToolBar->Toggle( ACTIONS::zoomTool, GetToolId() == ID_ZOOM_SELECTION );
m_mainToolBar->Refresh();
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, !galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( PCB_ACTIONS::showRatsnest, GetBoard()->IsElementVisible( LAYER_RATSNEST ) );
m_optionsToolBar->Toggle( PCB_ACTIONS::ratsnestLineMode, opts->m_DisplayRatsnestLinesCurved );
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
m_optionsToolBar->Toggle( ACTIONS::togglePolarCoords, GetShowPolarCoords() );
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, !galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( PCB_ACTIONS::showRatsnest, GetBoard()->IsElementVisible( LAYER_RATSNEST ) );
m_optionsToolBar->Toggle( PCB_ACTIONS::ratsnestLineMode, opts->m_DisplayRatsnestLinesCurved );
m_optionsToolBar->Toggle( PCB_ACTIONS::zoneDisplayEnable, zoneMode == 0 );
m_optionsToolBar->Toggle( PCB_ACTIONS::zoneDisplayDisable, zoneMode == 1 );

View File

@ -1006,6 +1006,7 @@ void PCBNEW_CONTROL::setTransitions()
Go( &PCBNEW_CONTROL::TrackDisplayMode, PCB_ACTIONS::trackDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::showRatsnest.MakeEvent() );
Go( &PCBNEW_CONTROL::ToggleRatsnest, PCB_ACTIONS::ratsnestLineMode.MakeEvent() );
Go( &PCBNEW_CONTROL::TogglePolarCoords, PCB_ACTIONS::togglePolarCoords.MakeEvent() );
Go( &PCBNEW_CONTROL::PadDisplayMode, PCB_ACTIONS::padDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() );
Go( &PCBNEW_CONTROL::GraphicDisplayMode, PCB_ACTIONS::graphicDisplayMode.MakeEvent() );