ACTION-ize toolbar/palette control.
This commit is contained in:
parent
1222f3cc72
commit
15241b7fcf
|
@ -298,14 +298,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
return !( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_ContrastModeDisplay;
|
||||
};
|
||||
|
||||
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
|
||||
_( "Show La&yers Manager" ), HELP_SHOW_HIDE_LAYERMANAGER,
|
||||
layers_manager_xpm, layersPaletteShownCondition );
|
||||
|
||||
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
|
||||
_( "Show Microwa&ve Toolbar" ), HELP_SHOW_HIDE_MICROWAVE_TOOLS,
|
||||
mw_toolbar_xpm, microwaveToolbarShownCondition );
|
||||
|
||||
viewMenu->AddCheckItem( PCB_ACTIONS::showLayersManager, layersPaletteShownCondition );
|
||||
viewMenu->AddCheckItem( PCB_ACTIONS::showMicrowaveToolbar, microwaveToolbarShownCondition );
|
||||
viewMenu->AddItem( ACTIONS::showFootprintBrowser, SELECTION_CONDITIONS::ShowAlways );
|
||||
viewMenu->AddItem( ACTIONS::show3DViewer, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
|
|
|
@ -161,15 +161,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
EVT_TOOL( ID_TOOLBARH_PCB_ACTION_PLUGIN_REFRESH, PCB_EDIT_FRAME::OnActionPluginRefresh )
|
||||
#endif
|
||||
|
||||
// Option toolbar
|
||||
EVT_TOOL( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
|
||||
PCB_EDIT_FRAME::OnSelectOptionToolbar )
|
||||
|
||||
EVT_TOOL( ID_RUN_EESCHEMA, PCB_EDIT_FRAME::OnRunEeschema )
|
||||
|
||||
EVT_TOOL( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
|
||||
PCB_EDIT_FRAME::OnSelectOptionToolbar )
|
||||
|
||||
// Tracks and vias sizes general options
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_SELECT_WIDTH_START_RANGE,
|
||||
ID_POPUP_PCB_SELECT_WIDTH_END_RANGE,
|
||||
|
|
|
@ -552,7 +552,6 @@ public:
|
|||
/**
|
||||
* Function ShowBoardSetupDialog
|
||||
*/
|
||||
void ShowBoardSetupDialog( wxCommandEvent& event );
|
||||
void DoShowBoardSetupDialog( const wxString& aInitialPage = wxEmptyString,
|
||||
const wxString& aInitialParentPage = wxEmptyString );
|
||||
|
||||
|
@ -560,7 +559,8 @@ public:
|
|||
|
||||
void PrepareLayerIndicator();
|
||||
|
||||
void OnSelectOptionToolbar( wxCommandEvent& event );
|
||||
void ToggleLayersManager();
|
||||
void ToggleMicrowaveToolbar();
|
||||
|
||||
/**
|
||||
* Function DoGenFootprintsPositionFile
|
||||
|
|
|
@ -121,9 +121,6 @@ enum pcbnew_ids
|
|||
ID_PCB_GEN_BOM_FILE_FROM_BOARD,
|
||||
ID_PCB_3DSHAPELIB_WIZARD,
|
||||
|
||||
ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
|
||||
ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
|
||||
|
||||
ID_PCB_MUWAVE_START_CMD,
|
||||
ID_PCB_MUWAVE_TOOL_SELF_CMD,
|
||||
ID_PCB_MUWAVE_TOOL_GAP_CMD,
|
||||
|
|
|
@ -354,12 +354,8 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
|
|||
|
||||
// Tools to show/hide toolbars:
|
||||
KiScaledSeparator( m_optionsToolBar, this );
|
||||
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
|
||||
wxEmptyString, KiScaledBitmap( layers_manager_xpm, this ),
|
||||
HELP_SHOW_HIDE_LAYERMANAGER, wxITEM_CHECK );
|
||||
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
|
||||
wxEmptyString, KiScaledBitmap( mw_toolbar_xpm, this ),
|
||||
HELP_SHOW_HIDE_MICROWAVE_TOOLS, wxITEM_CHECK );
|
||||
m_optionsToolBar->Add( PCB_ACTIONS::showLayersManager, ACTION_TOOLBAR::TOGGLE );
|
||||
m_optionsToolBar->Add( PCB_ACTIONS::showMicrowaveToolbar, ACTION_TOOLBAR::TOGGLE );
|
||||
|
||||
KiScaledSeparator( m_optionsToolBar, this );
|
||||
m_optionsToolBar->Realize();
|
||||
|
@ -640,31 +636,20 @@ void PCB_EDIT_FRAME::ReCreateLayerBox( bool aForceResizeToolbar )
|
|||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||
void PCB_EDIT_FRAME::ToggleLayersManager()
|
||||
{
|
||||
int id = event.GetId();
|
||||
bool state = event.IsChecked();
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE:
|
||||
m_show_microwave_tools = state;
|
||||
m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools );
|
||||
m_auimgr.Update();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR:
|
||||
// show auxiliary Vertical layers and visibility manager toolbar
|
||||
m_show_layer_manager_tools = state;
|
||||
m_show_layer_manager_tools = !m_show_layer_manager_tools;
|
||||
m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
|
||||
m_auimgr.Update();
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
DisplayErrorMessage( this, "Invalid toolbar option",
|
||||
"PCB_EDIT_FRAME::OnSelectOptionToolbar error \n (event not handled!)" );
|
||||
break;
|
||||
}
|
||||
|
||||
void PCB_EDIT_FRAME::ToggleMicrowaveToolbar()
|
||||
{
|
||||
m_show_microwave_tools = !m_show_microwave_tools;
|
||||
m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools );
|
||||
m_auimgr.Update();
|
||||
}
|
||||
|
||||
|
||||
|
@ -723,6 +708,7 @@ void PCB_EDIT_FRAME::SyncMenusAndToolbars()
|
|||
PCB_DISPLAY_OPTIONS* opts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions();
|
||||
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
|
||||
int zoneMode = opts->m_DisplayZonesMode;
|
||||
bool ratsnestShown = GetBoard()->IsElementVisible( LAYER_RATSNEST );
|
||||
|
||||
m_mainToolBar->Toggle( ACTIONS::save, GetScreen() && GetScreen()->IsModify() );
|
||||
m_mainToolBar->Toggle( ACTIONS::undo, GetScreen() && GetScreen()->GetUndoCommandCount() > 0 );
|
||||
|
@ -742,8 +728,10 @@ void PCB_EDIT_FRAME::SyncMenusAndToolbars()
|
|||
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::showRatsnest, ratsnestShown );
|
||||
m_optionsToolBar->Toggle( PCB_ACTIONS::ratsnestLineMode, opts->m_DisplayRatsnestLinesCurved );
|
||||
m_optionsToolBar->Toggle( PCB_ACTIONS::showLayersManager, LayerManagerShown() );
|
||||
m_optionsToolBar->Toggle( PCB_ACTIONS::showMicrowaveToolbar, MicrowaveToolbarShown() );
|
||||
|
||||
m_optionsToolBar->Toggle( PCB_ACTIONS::zoneDisplayEnable, zoneMode == 0 );
|
||||
m_optionsToolBar->Toggle( PCB_ACTIONS::zoneDisplayDisable, zoneMode == 1 );
|
||||
|
|
|
@ -280,6 +280,8 @@ public:
|
|||
static TOOL_ACTION runDRC;
|
||||
|
||||
static TOOL_ACTION editFootprintInFpEditor;
|
||||
static TOOL_ACTION showLayersManager;
|
||||
static TOOL_ACTION showMicrowaveToolbar;
|
||||
static TOOL_ACTION showPythonConsole;
|
||||
static TOOL_ACTION showHelp;
|
||||
|
||||
|
|
|
@ -231,6 +231,16 @@ TOOL_ACTION PCB_ACTIONS::showPythonConsole( "pcbnew.Control.showPythonConsole",
|
|||
_( "Scripting Console" ), _( "Show the Python scripting console" ),
|
||||
py_script_xpm );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::showLayersManager( "pcbnew.Control.showLayersManager",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Show Layers Manager" ), _( "Show/hide the layers manager" ),
|
||||
layers_manager_xpm );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::showMicrowaveToolbar( "pcbnew.Control.showMicrowaveToolbar",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Show Microwave Toolbar" ), _( "Show/hide microwave toolbar\n(Experimental feature)" ),
|
||||
mw_toolbar_xpm );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::flipBoard( "pcbnew.Control.flipBoard",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Flip Board View" ), _( "Flip (mirror) the board view" ),
|
||||
|
@ -584,6 +594,20 @@ int PCB_EDITOR_CONTROL::UpdatePCBFromSchematic( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int PCB_EDITOR_CONTROL::ToggleLayersManager( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
frame()->ToggleLayersManager();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int PCB_EDITOR_CONTROL::ToggleMicrowaveToolbar( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
frame()->ToggleMicrowaveToolbar();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int PCB_EDITOR_CONTROL::TogglePythonConsole( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
#if defined( KICAD_SCRIPTING_WXPYTHON )
|
||||
|
@ -1578,6 +1602,8 @@ void PCB_EDITOR_CONTROL::setTransitions()
|
|||
|
||||
Go( &PCB_EDITOR_CONTROL::ListNets, PCB_ACTIONS::listNets.MakeEvent() );
|
||||
Go( &PCB_EDITOR_CONTROL::UpdatePCBFromSchematic, ACTIONS::updatePcbFromSchematic.MakeEvent() );
|
||||
Go( &PCB_EDITOR_CONTROL::ToggleLayersManager, PCB_ACTIONS::showLayersManager.MakeEvent() );
|
||||
Go( &PCB_EDITOR_CONTROL::ToggleMicrowaveToolbar, PCB_ACTIONS::showMicrowaveToolbar.MakeEvent() );
|
||||
Go( &PCB_EDITOR_CONTROL::TogglePythonConsole, PCB_ACTIONS::showPythonConsole.MakeEvent() );
|
||||
Go( &PCB_EDITOR_CONTROL::FlipPcbView, PCB_ACTIONS::flipBoard.MakeEvent() );
|
||||
}
|
||||
|
|
|
@ -68,6 +68,8 @@ public:
|
|||
int GenerateFabFiles( const TOOL_EVENT& aEvent );
|
||||
|
||||
int UpdatePCBFromSchematic( const TOOL_EVENT& aEvent );
|
||||
int ToggleLayersManager( const TOOL_EVENT& aEvent );
|
||||
int ToggleMicrowaveToolbar( const TOOL_EVENT& aEvent );
|
||||
int TogglePythonConsole( const TOOL_EVENT& aEvent );
|
||||
|
||||
int Find( const TOOL_EVENT& aEvent );
|
||||
|
|
Loading…
Reference in New Issue