Yet more command conversions to ACTIONs.

This commit is contained in:
Jeff Young 2019-06-02 19:58:09 +01:00
parent 60d2dc2e90
commit 33773bad4d
41 changed files with 1004 additions and 808 deletions

View File

@ -14,6 +14,11 @@ TOOL_ACTION ACTIONS::newLibrary( "common.Control.newLibrary",
_( "New Library..." ), _( "Create a new library folder" ), _( "New Library..." ), _( "Create a new library folder" ),
new_generic_xpm ); new_generic_xpm );
TOOL_ACTION ACTIONS::addLibrary( "common.Control.addLibrary",
AS_GLOBAL, 0,
_( "Add Library..." ), _( "Add an existing library folder" ),
add_library_xpm );
TOOL_ACTION ACTIONS::open( "common.Control.open", TOOL_ACTION ACTIONS::open( "common.Control.open",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_OPEN ), AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_OPEN ),
_( "Open..." ), _( "Open existing document" ), _( "Open..." ), _( "Open existing document" ),
@ -326,6 +331,19 @@ TOOL_ACTION ACTIONS::toggleCursorStyle( "common.Control.toggleCursorStyle",
_( "Full-Window Crosshairs" ), _( "Switch display of full-window crosshairs" ), _( "Full-Window Crosshairs" ), _( "Switch display of full-window crosshairs" ),
cursor_shape_xpm ); cursor_shape_xpm );
TOOL_ACTION ACTIONS::highContrastMode( "common.Control.highContrastMode",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_HIGHCONTRAST_MODE ),
_( "High Contrast Mode" ), _( "Use high contrast display mode" ),
contrast_mode_xpm );
TOOL_ACTION ACTIONS::highContrastInc( "common.Control.highContrastInc",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HIGHCONTRAST_INC ),
"", "" );
TOOL_ACTION ACTIONS::highContrastDec( "common.Control.highContrastDec",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HIGHCONTRAST_DEC ),
"", "" );
TOOL_ACTION ACTIONS::acceleratedGraphics( "common.Control.acceleratedGraphics", TOOL_ACTION ACTIONS::acceleratedGraphics( "common.Control.acceleratedGraphics",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_CANVAS_OPENGL ), AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_CANVAS_OPENGL ),
_( "Accelerated Graphics" ), _( "Use hardware-accelerated graphics (recommended)" ), _( "Accelerated Graphics" ), _( "Use hardware-accelerated graphics (recommended)" ),

View File

@ -368,7 +368,6 @@ void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
void CVPCB_MAINFRAME::OnOK( wxCommandEvent& aEvent ) void CVPCB_MAINFRAME::OnOK( wxCommandEvent& aEvent )
{ {
SaveFootprintAssociation( false ); SaveFootprintAssociation( false );
m_modified = false; m_modified = false;
Close( true ); Close( true );
@ -378,7 +377,6 @@ void CVPCB_MAINFRAME::OnOK( wxCommandEvent& aEvent )
void CVPCB_MAINFRAME::OnSaveAndContinue( wxCommandEvent& aEvent ) void CVPCB_MAINFRAME::OnSaveAndContinue( wxCommandEvent& aEvent )
{ {
SaveFootprintAssociation( true ); SaveFootprintAssociation( true );
m_modified = false; m_modified = false;
} }

View File

@ -122,7 +122,7 @@ public:
void OnSize( wxSizeEvent& SizeEvent ); void OnSize( wxSizeEvent& SizeEvent );
void OnKeyDown( wxKeyEvent& aEvent ); void OnKeyDown( wxKeyEvent& aEvent );
void ReCreateHToolbar(); void ReCreateHToolbar();
virtual void ReCreateMenuBar() override; void ReCreateMenuBar() override;
void ShowChangedLanguage() override; void ShowChangedLanguage() override;
void ChangeFocus( bool aMoveRight ); void ChangeFocus( bool aMoveRight );

View File

@ -22,24 +22,17 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file cvpcb/menubar.cpp
* @brief (Re)Create the menubar for CvPcb
*/
#include <common_help_msg.h> #include <common_help_msg.h>
#include <kiface_i.h> #include <kiface_i.h>
#include <menus_helpers.h> #include <menus_helpers.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <tool/action_menu.h>
#include <tool/actions.h>
#include "cvpcb.h" #include "cvpcb.h"
#include "cvpcb_id.h" #include "cvpcb_id.h"
#include "cvpcb_mainframe.h" #include "cvpcb_mainframe.h"
/**
* @brief (Re)Create the menubar for the CvPcb mainframe
*/
void CVPCB_MAINFRAME::ReCreateMenuBar() void CVPCB_MAINFRAME::ReCreateMenuBar()
{ {
// wxWidgets handles the Mac Application menu behind the scenes, but that means // wxWidgets handles the Mac Application menu behind the scenes, but that means

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 1 2018) // C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -19,12 +19,6 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
wxBoxSizer* bSizerTop; wxBoxSizer* bSizerTop;
bSizerTop = new wxBoxSizer( wxVERTICAL ); bSizerTop = new wxBoxSizer( wxVERTICAL );
m_staticTextGeneralSettings = new wxStaticText( this, wxID_ANY, _("General Settings:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGeneralSettings->Wrap( -1 );
m_staticTextGeneralSettings->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bSizerTop->Add( m_staticTextGeneralSettings, 0, wxALL, 5 );
wxFlexGridSizer* fgSizer31; wxFlexGridSizer* fgSizer31;
fgSizer31 = new wxFlexGridSizer( 0, 2, 0, 0 ); fgSizer31 = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer31->AddGrowableCol( 1 ); fgSizer31->AddGrowableCol( 1 );
@ -35,24 +29,30 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
m_staticTextName->Wrap( -1 ); m_staticTextName->Wrap( -1 );
m_staticTextName->SetToolTip( _("This is the symbol name in library,\nand also the default component value when loaded in the schematic.") ); m_staticTextName->SetToolTip( _("This is the symbol name in library,\nand also the default component value when loaded in the schematic.") );
fgSizer31->Add( m_staticTextName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizer31->Add( m_staticTextName, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_textName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 100,-1 ), 0 ); m_textName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 100,-1 ), 0 );
fgSizer31->Add( m_textName, 1, wxALL|wxEXPAND, 3 ); fgSizer31->Add( m_textName, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticTextDes = new wxStaticText( this, wxID_ANY, _("Default reference designator:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextDes = new wxStaticText( this, wxID_ANY, _("Default reference designator:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextDes->Wrap( -1 ); m_staticTextDes->Wrap( -1 );
fgSizer31->Add( m_staticTextDes, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); fgSizer31->Add( m_staticTextDes, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_textReference = new wxTextCtrl( this, wxID_ANY, _("U"), wxDefaultPosition, wxDefaultSize, 0 ); m_textReference = new wxTextCtrl( this, wxID_ANY, _("U"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer31->Add( m_textReference, 0, wxALL|wxEXPAND, 3 ); fgSizer31->Add( m_textReference, 0, wxEXPAND|wxALL, 5 );
fgSizer31->Add( 0, 0, 1, wxEXPAND|wxTOP, 10 );
fgSizer31->Add( 0, 0, 1, wxEXPAND, 10 );
m_staticTextUnits = new wxStaticText( this, wxID_ANY, _("Number of units per package:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextUnits = new wxStaticText( this, wxID_ANY, _("Number of units per package:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextUnits->Wrap( -1 ); m_staticTextUnits->Wrap( -1 );
fgSizer31->Add( m_staticTextUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); fgSizer31->Add( m_staticTextUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_spinPartCount = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 64, 0 ); m_spinPartCount = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 64, 0 );
fgSizer31->Add( m_spinPartCount, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 ); fgSizer31->Add( m_spinPartCount, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
bSizerTop->Add( fgSizer31, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 ); bSizerTop->Add( fgSizer31, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
@ -60,17 +60,20 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
wxBoxSizer* bSizer17; wxBoxSizer* bSizer17;
bSizer17 = new wxBoxSizer( wxVERTICAL ); bSizer17 = new wxBoxSizer( wxVERTICAL );
m_checkLockItems = new wxCheckBox( this, wxID_ANY, _("Units are not interchangeable"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer17->Add( m_checkLockItems, 0, wxRIGHT|wxLEFT, 5 );
bSizer17->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 );
m_checkHasConversion = new wxCheckBox( this, wxID_ANY, _("Create symbol with alternate body style (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkHasConversion = new wxCheckBox( this, wxID_ANY, _("Create symbol with alternate body style (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer17->Add( m_checkHasConversion, 0, wxALL, 5 ); bSizer17->Add( m_checkHasConversion, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_checkIsPowerSymbol = new wxCheckBox( this, wxID_ANY, _("Create symbol as power symbol"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkIsPowerSymbol = new wxCheckBox( this, wxID_ANY, _("Create symbol as power symbol"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer17->Add( m_checkIsPowerSymbol, 0, wxALL, 5 ); bSizer17->Add( m_checkIsPowerSymbol, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_checkLockItems = new wxCheckBox( this, wxID_ANY, _("Units are not interchangeable"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer17->Add( m_checkLockItems, 0, wxALL, 5 );
bSizerTop->Add( bSizer17, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 ); bSizerTop->Add( bSizer17, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerMain->Add( bSizerTop, 0, wxALL|wxEXPAND, 5 ); bSizerMain->Add( bSizerTop, 0, wxALL|wxEXPAND, 5 );
@ -78,11 +81,8 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
wxBoxSizer* bSizerBottom; wxBoxSizer* bSizerBottom;
bSizerBottom = new wxBoxSizer( wxVERTICAL ); bSizerBottom = new wxBoxSizer( wxVERTICAL );
m_staticTextPinSettings = new wxStaticText( this, wxID_ANY, _("Pin Settings:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextPinSettings->Wrap( -1 );
m_staticTextPinSettings->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bSizerBottom->Add( m_staticTextPinSettings, 0, wxALL, 5 ); bSizerBottom->Add( 0, 0, 1, wxEXPAND|wxTOP, 5 );
wxFlexGridSizer* fgSizer4; wxFlexGridSizer* fgSizer4;
fgSizer4 = new wxFlexGridSizer( 0, 2, 0, 55 ); fgSizer4 = new wxFlexGridSizer( 0, 2, 0, 55 );
@ -104,23 +104,20 @@ DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent,
m_checkShowPinNumber = new wxCheckBox( this, wxID_ANY, _("Show pin number text"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkShowPinNumber = new wxCheckBox( this, wxID_ANY, _("Show pin number text"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinNumber->SetValue(true); m_checkShowPinNumber->SetValue(true);
bSizer19->Add( m_checkShowPinNumber, 0, wxALL, 5 ); bSizer19->Add( m_checkShowPinNumber, 0, wxRIGHT|wxLEFT, 5 );
m_checkShowPinName = new wxCheckBox( this, wxID_ANY, _("Show pin name text"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkShowPinName = new wxCheckBox( this, wxID_ANY, _("Show pin name text"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinName->SetValue(true); m_checkShowPinName->SetValue(true);
bSizer19->Add( m_checkShowPinName, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); bSizer19->Add( m_checkShowPinName, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_checkShowPinNameInside = new wxCheckBox( this, wxID_ANY, _("Pin name inside"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkShowPinNameInside = new wxCheckBox( this, wxID_ANY, _("Pin name inside"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinNameInside->SetValue(true); m_checkShowPinNameInside->SetValue(true);
bSizer19->Add( m_checkShowPinNameInside, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); bSizer19->Add( m_checkShowPinNameInside, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
bSizerBottom->Add( bSizer19, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 ); bSizerBottom->Add( bSizer19, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
bSizerBottom->Add( 0, 10, 0, wxEXPAND, 5 );
bSizerMain->Add( bSizerBottom, 1, wxALL|wxEXPAND, 5 ); bSizerMain->Add( bSizerBottom, 1, wxALL|wxEXPAND, 5 );
m_sdbSizer = new wxStdDialogButtonSizer(); m_sdbSizer = new wxStdDialogButtonSizer();

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,12 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 1 2018) // C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#pragma once #ifndef __DIALOG_LIB_NEW_COMPONENT_BASE_H__
#define __DIALOG_LIB_NEW_COMPONENT_BASE_H__
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
@ -34,17 +35,15 @@ class DIALOG_LIB_NEW_COMPONENT_BASE : public DIALOG_SHIM
private: private:
protected: protected:
wxStaticText* m_staticTextGeneralSettings;
wxStaticText* m_staticTextName; wxStaticText* m_staticTextName;
wxTextCtrl* m_textName; wxTextCtrl* m_textName;
wxStaticText* m_staticTextDes; wxStaticText* m_staticTextDes;
wxTextCtrl* m_textReference; wxTextCtrl* m_textReference;
wxStaticText* m_staticTextUnits; wxStaticText* m_staticTextUnits;
wxSpinCtrl* m_spinPartCount; wxSpinCtrl* m_spinPartCount;
wxCheckBox* m_checkLockItems;
wxCheckBox* m_checkHasConversion; wxCheckBox* m_checkHasConversion;
wxCheckBox* m_checkIsPowerSymbol; wxCheckBox* m_checkIsPowerSymbol;
wxCheckBox* m_checkLockItems;
wxStaticText* m_staticTextPinSettings;
wxStaticText* m_staticText12; wxStaticText* m_staticText12;
wxSpinCtrl* m_spinPinTextPosition; wxSpinCtrl* m_spinPinTextPosition;
wxCheckBox* m_checkShowPinNumber; wxCheckBox* m_checkShowPinNumber;
@ -56,8 +55,9 @@ class DIALOG_LIB_NEW_COMPONENT_BASE : public DIALOG_SHIM
public: public:
DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Symbol Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("New Symbol"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_NEW_COMPONENT_BASE(); ~DIALOG_LIB_NEW_COMPONENT_BASE();
}; };
#endif //__DIALOG_LIB_NEW_COMPONENT_BASE_H__

View File

@ -99,14 +99,7 @@ enum id_eeschema_frm
ID_ADD_PART_TO_SCHEMATIC, ID_ADD_PART_TO_SCHEMATIC,
/* Library editor: edit events */ /* Library editor: edit events */
ID_LIBEDIT_NEW_LIBRARY,
ID_LIBEDIT_ADD_LIBRARY,
ID_LIBEDIT_SAVE,
ID_LIBEDIT_SAVE_AS,
ID_LIBEDIT_REVERT,
ID_LIBEDIT_NEW_PART,
ID_LIBEDIT_EDIT_PART, ID_LIBEDIT_EDIT_PART,
ID_LIBEDIT_IMPORT_PART,
ID_LIBEDIT_EXPORT_PART, ID_LIBEDIT_EXPORT_PART,
ID_LIBEDIT_REMOVE_PART, ID_LIBEDIT_REMOVE_PART,
ID_LIBEDIT_CUT_PART, ID_LIBEDIT_CUT_PART,
@ -115,10 +108,7 @@ enum id_eeschema_frm
ID_LIBEDIT_DUPLICATE_PART, ID_LIBEDIT_DUPLICATE_PART,
/* Library editor horizontal toolbar IDs. */ /* Library editor horizontal toolbar IDs. */
ID_DE_MORGAN_NORMAL_BUTT,
ID_DE_MORGAN_CONVERT_BUTT,
ID_LIBEDIT_SYNC_PIN_EDIT, ID_LIBEDIT_SYNC_PIN_EDIT,
ID_LIBEDIT_CHECK_PART,
ID_LIBEDIT_SELECT_PART_NUMBER, ID_LIBEDIT_SELECT_PART_NUMBER,
/* Library editor vertical toolbar IDs. */ /* Library editor vertical toolbar IDs. */

View File

@ -86,11 +86,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_SIZE( LIB_EDIT_FRAME::OnSize ) EVT_SIZE( LIB_EDIT_FRAME::OnSize )
// Actions // Actions
EVT_TOOL( ID_LIBEDIT_NEW_LIBRARY, LIB_EDIT_FRAME::OnCreateNewLibrary )
EVT_TOOL( ID_LIBEDIT_ADD_LIBRARY, LIB_EDIT_FRAME::OnAddLibrary )
EVT_TOOL( ID_LIBEDIT_NEW_PART, LIB_EDIT_FRAME::OnCreateNewPart )
EVT_TOOL( ID_LIBEDIT_EDIT_PART, LIB_EDIT_FRAME::OnEditPart ) EVT_TOOL( ID_LIBEDIT_EDIT_PART, LIB_EDIT_FRAME::OnEditPart )
EVT_TOOL( ID_LIBEDIT_IMPORT_PART, LIB_EDIT_FRAME::OnImportPart )
EVT_TOOL( ID_LIBEDIT_EXPORT_PART, LIB_EDIT_FRAME::OnExportPart ) EVT_TOOL( ID_LIBEDIT_EXPORT_PART, LIB_EDIT_FRAME::OnExportPart )
EVT_TOOL( ID_LIBEDIT_REMOVE_PART, LIB_EDIT_FRAME::OnRemovePart ) EVT_TOOL( ID_LIBEDIT_REMOVE_PART, LIB_EDIT_FRAME::OnRemovePart )
EVT_TOOL( ID_LIBEDIT_CUT_PART, LIB_EDIT_FRAME::OnCopyCutPart ) EVT_TOOL( ID_LIBEDIT_CUT_PART, LIB_EDIT_FRAME::OnCopyCutPart )
@ -100,7 +96,6 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
// Main horizontal toolbar. // Main horizontal toolbar.
EVT_TOOL( ID_TO_LIBVIEW, LIB_EDIT_FRAME::OnOpenLibraryViewer ) EVT_TOOL( ID_TO_LIBVIEW, LIB_EDIT_FRAME::OnOpenLibraryViewer )
EVT_TOOL( ID_LIBEDIT_CHECK_PART, LIB_EDIT_FRAME::OnCheckComponent )
EVT_TOOL( ID_LIBEDIT_SYNC_PIN_EDIT, LIB_EDIT_FRAME::OnSyncPinEditClick ) EVT_TOOL( ID_LIBEDIT_SYNC_PIN_EDIT, LIB_EDIT_FRAME::OnSyncPinEditClick )
EVT_TOOL( ID_ADD_PART_TO_SCHEMATIC, LIB_EDIT_FRAME::OnAddPartToSchematic ) EVT_TOOL( ID_ADD_PART_TO_SCHEMATIC, LIB_EDIT_FRAME::OnAddPartToSchematic )
@ -561,7 +556,7 @@ void LIB_EDIT_FRAME::refreshSchematic()
} }
bool LIB_EDIT_FRAME::addLibraryFile( bool aCreateNew ) bool LIB_EDIT_FRAME::AddLibraryFile( bool aCreateNew )
{ {
wxFileName fn = m_libMgr->GetUniqueLibraryName(); wxFileName fn = m_libMgr->GetUniqueLibraryName();

View File

@ -205,25 +205,14 @@ public:
void OnExportBody( wxCommandEvent& aEvent ); void OnExportBody( wxCommandEvent& aEvent );
/** /**
* Creates a new library. The library is added to the project libraries table. * Creates or adds an existing library to the symbol library table.
*/ */
void OnCreateNewLibrary( wxCommandEvent& aEvent ) bool AddLibraryFile( bool aCreateNew );
{
addLibraryFile( true );
}
/**
* Adds an existing library. The library is added to the project libraries table.
*/
void OnAddLibrary( wxCommandEvent& aEvent )
{
addLibraryFile( false );
}
/** /**
* Creates a new part in the selected library. * Creates a new part in the selected library.
*/ */
void OnCreateNewPart( wxCommandEvent& aEvent ); void CreateNewPart();
/** /**
* Opens the selected part for editing. * Opens the selected part for editing.
@ -236,7 +225,7 @@ public:
* Or 1 component if there are several. * Or 1 component if there are several.
* If the first component is an alias, it will load the corresponding root. * If the first component is an alias, it will load the corresponding root.
*/ */
void OnImportPart( wxCommandEvent& event ); void ImportPart();
/** /**
* Creates a new library and backup the current component in this library or exports * Creates a new library and backup the current component in this library or exports
@ -286,8 +275,6 @@ public:
bool IsSearchTreeShown(); bool IsSearchTreeShown();
void ClearSearchTreeSelection(); void ClearSearchTreeSelection();
void OnCheckComponent( wxCommandEvent& event );
void OnUpdateHavePart( wxUpdateUIEvent& aEvent ); void OnUpdateHavePart( wxUpdateUIEvent& aEvent );
void OnUpdateSyncPinEdit( wxUpdateUIEvent& event ); void OnUpdateSyncPinEdit( wxUpdateUIEvent& event );
void OnUpdatePartNumber( wxUpdateUIEvent& event ); void OnUpdatePartNumber( wxUpdateUIEvent& event );
@ -542,9 +529,6 @@ private:
///> Saves the current part. ///> Saves the current part.
bool saveCurrentPart(); bool saveCurrentPart();
///> Creates or adds an existing library to the symbol library table.
bool addLibraryFile( bool aCreateNew );
///> Stores the currently modified part in the library manager buffer. ///> Stores the currently modified part in the library manager buffer.
void storeCurrentPart(); void storeCurrentPart();

View File

@ -36,7 +36,7 @@
#include <wx/filename.h> #include <wx/filename.h>
void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event ) void LIB_EDIT_FRAME::ImportPart()
{ {
wxString msg; wxString msg;
wxString libName = getTargetLib(); wxString libName = getTargetLib();

View File

@ -277,7 +277,7 @@ void LIB_EDIT_FRAME::OnSaveAll()
} }
void LIB_EDIT_FRAME::OnCreateNewPart( wxCommandEvent& event ) void LIB_EDIT_FRAME::CreateNewPart()
{ {
m_toolManager->RunAction( ACTIONS::cancelInteractive, true ); m_toolManager->RunAction( ACTIONS::cancelInteractive, true );
wxString lib = getTargetLib(); wxString lib = getTargetLib();
@ -877,39 +877,3 @@ bool LIB_EDIT_FRAME::saveAllLibraries( bool aRequireConfirmation )
} }
void LIB_EDIT_FRAME::DisplayCmpDoc()
{
LIB_PART* part = GetCurPart();
EDA_DRAW_FRAME::ClearMsgPanel();
if( !part )
return;
LIB_ALIAS* alias = part->GetAlias( part->GetName() );
wxString msg = part->GetName();
AppendMsgPanel( _( "Name" ), msg, BLUE, 8 );
static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
msg = UnitLetter[m_unit];
AppendMsgPanel( _( "Unit" ), msg, BROWN, 8 );
if( m_convert > 1 )
msg = _( "Convert" );
else
msg = _( "Normal" );
AppendMsgPanel( _( "Body" ), msg, GREEN, 8 );
if( part->IsPower() )
msg = _( "Power Symbol" );
else
msg = _( "Symbol" );
AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 );
AppendMsgPanel( _( "Description" ), alias->GetDescription(), CYAN, 8 );
AppendMsgPanel( _( "Key words" ), alias->GetKeyWords(), DARKDARKGRAY );
AppendMsgPanel( _( "Datasheet" ), alias->GetDocFileName(), DARKDARKGRAY );
}

View File

@ -61,30 +61,18 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
// //
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool ); CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
fileMenu->AddItem( ID_LIBEDIT_NEW_LIBRARY, fileMenu->AddItem( ACTIONS::newLibrary, EE_CONDITIONS::ShowAlways );
_( "New Library..." ), fileMenu->AddItem( ACTIONS::addLibrary, EE_CONDITIONS::ShowAlways );
_( "Creates an empty library" ), fileMenu->AddItem( EE_ACTIONS::newSymbol, EE_CONDITIONS::ShowAlways );
new_library_xpm, EE_CONDITIONS::ShowAlways );
fileMenu->AddItem( ID_LIBEDIT_ADD_LIBRARY,
_( "Add Library..." ),
_( "Adds a previously created library" ),
add_library_xpm, EE_CONDITIONS::ShowAlways );
fileMenu->AddItem( ID_LIBEDIT_NEW_PART,
AddHotkeyName( _( "New Symbol..." ), m_hotkeysDescrList, HK_NEW ),
_( "Create a new symbol" ),
new_component_xpm, EE_CONDITIONS::ShowAlways );
fileMenu->AddSeparator(); fileMenu->AddSeparator();
fileMenu->AddItem( ACTIONS::save, modifiedDocumentCondition ); fileMenu->AddItem( ACTIONS::save, modifiedDocumentCondition );
fileMenu->AddItem( ACTIONS::saveAs, EE_CONDITIONS::ShowAlways ); fileMenu->AddItem( ACTIONS::saveCopyAs, EE_CONDITIONS::ShowAlways );
fileMenu->AddItem( ACTIONS::saveAll, EE_CONDITIONS::ShowAlways ); fileMenu->AddItem( ACTIONS::saveAll, EE_CONDITIONS::ShowAlways );
fileMenu->AddItem( ACTIONS::revert, modifiedDocumentCondition ); fileMenu->AddItem( ACTIONS::revert, modifiedDocumentCondition );
fileMenu->AddSeparator(); fileMenu->AddSeparator();
fileMenu->AddItem( ID_LIBEDIT_IMPORT_PART, fileMenu->AddItem( EE_ACTIONS::importSymbol, EE_CONDITIONS::ShowAlways );
_( "Import Symbol..." ),
_( "Import a symbol to the current library" ),
import_part_xpm, EE_CONDITIONS::ShowAlways );
// Export submenu // Export submenu
ACTION_MENU* submenuExport = new ACTION_MENU(); ACTION_MENU* submenuExport = new ACTION_MENU();
@ -209,12 +197,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
}; };
inspectMenu->AddItem( EE_ACTIONS::showDatasheet, datasheetAvailableCondition ); inspectMenu->AddItem( EE_ACTIONS::showDatasheet, datasheetAvailableCondition );
inspectMenu->AddItem( EE_ACTIONS::runERC, EE_CONDITIONS::ShowAlways );
AddMenuItem( inspectMenu,
ID_LIBEDIT_CHECK_PART,
_( "Electrical Rules Checker" ),
_( "Check for duplicate and off-grid pins" ),
KiBitmap( erc_xpm ) );
inspectMenu->Resolve(); inspectMenu->Resolve();

View File

@ -37,7 +37,6 @@
#include <sch_legacy_plugin.h> #include <sch_legacy_plugin.h>
#include <properties.h> #include <properties.h>
#include <view/view.h> #include <view/view.h>
#include <dialogs/dialog_display_info_HTML_base.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h> #include <tools/ee_selection_tool.h>
@ -203,147 +202,39 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
} }
// helper function to sort pins by pin num void LIB_EDIT_FRAME::DisplayCmpDoc()
bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst )
{
// Use number as primary key
int test = ref->GetNumber().Cmp( tst->GetNumber() );
// Use DeMorgan variant as secondary key
if( test == 0 )
test = ref->GetConvert() - tst->GetConvert();
// Use unit as tertiary key
if( test == 0 )
test = ref->GetUnit() - tst->GetUnit();
return test < 0;
}
void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event )
{ {
LIB_PART* part = GetCurPart(); LIB_PART* part = GetCurPart();
EDA_DRAW_FRAME::ClearMsgPanel();
if( !part ) if( !part )
return; return;
wxRealPoint curr_grid_size = GetScreen()->GetGridSize(); LIB_ALIAS* alias = part->GetAlias( part->GetName() );
const int min_grid_size = 25; wxString msg = part->GetName();
const int grid_size = KiROUND( curr_grid_size.x );
const int clamped_grid_size = ( grid_size < min_grid_size ) ? min_grid_size : grid_size;
LIB_PINS pinList; AppendMsgPanel( _( "Name" ), msg, BLUE, 8 );
part->GetPins( pinList ); static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
msg = UnitLetter[m_unit];
if( pinList.size() == 0 ) AppendMsgPanel( _( "Unit" ), msg, BROWN, 8 );
{
DisplayInfoMessage( this, _( "No pins!" ) );
return;
}
// Sort pins by pin num, so 2 duplicate pins if( m_convert > 1 )
// (pins with the same number) will be consecutive in list msg = _( "Convert" );
sort( pinList.begin(), pinList.end(), sort_by_pin_number );
// Test for duplicates:
DIALOG_DISPLAY_HTML_TEXT_BASE error_display( this, wxID_ANY,
_( "Marker Information" ),
wxDefaultPosition,
wxSize( 750, 600 ) );
int dup_error = 0;
for( unsigned ii = 1; ii < pinList.size(); ii++ )
{
LIB_PIN* curr_pin = pinList[ii];
LIB_PIN* pin = pinList[ii - 1];
if( pin->GetNumber() != curr_pin->GetNumber()
|| pin->GetConvert() != curr_pin->GetConvert() )
continue;
dup_error++;
/* TODO I dare someone to find a way to make happy translators on
this thing! Lorenzo */
wxString msg = wxString::Format( _(
"<b>Duplicate pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b>"
" conflicts with pin %s \"%s\" at location <b>(%.3f, %.3f)</b>" ),
GetChars( curr_pin->GetNumber() ),
GetChars( curr_pin->GetName() ),
curr_pin->GetPosition().x / 1000.0,
-curr_pin->GetPosition().y / 1000.0,
GetChars( pin->GetNumber() ),
GetChars( pin->GetName() ),
pin->GetPosition().x / 1000.0,
-pin->GetPosition().y / 1000.0
);
if( part->GetUnitCount() > 1 )
{
msg += wxString::Format( _( " in units %c and %c" ),
'A' + curr_pin->GetUnit() - 1,
'A' + pin->GetUnit() - 1 );
}
if( m_showDeMorgan )
{
if( curr_pin->GetConvert() )
msg += _( " of converted" );
else else
msg += _( " of normal" ); msg = _( "Normal" );
}
msg += wxT( ".<br>" ); AppendMsgPanel( _( "Body" ), msg, GREEN, 8 );
error_display.m_htmlWindow->AppendToPage( msg ); if( part->IsPower() )
} msg = _( "Power Symbol" );
// Test for off grid pins:
int offgrid_error = 0;
for( unsigned ii = 0; ii < pinList.size(); ii++ )
{
LIB_PIN* pin = pinList[ii];
if( ( (pin->GetPosition().x % clamped_grid_size) == 0 ) &&
( (pin->GetPosition().y % clamped_grid_size) == 0 ) )
continue;
// "pin" is off grid here.
offgrid_error++;
wxString msg = wxString::Format( _(
"<b>Off grid pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b>" ),
GetChars( pin->GetNumber() ),
GetChars( pin->GetName() ),
pin->GetPosition().x / 1000.0,
-pin->GetPosition().y / 1000.0
);
if( part->GetUnitCount() > 1 )
{
msg += wxString::Format( _( " in symbol %c" ), 'A' + pin->GetUnit() - 1 );
}
if( m_showDeMorgan )
{
if( pin->GetConvert() )
msg += _( " of converted" );
else else
msg += _( " of normal" ); msg = _( "Symbol" );
}
msg += wxT( ".<br>" ); AppendMsgPanel( _( "Type" ), msg, MAGENTA, 8 );
AppendMsgPanel( _( "Description" ), alias->GetDescription(), CYAN, 8 );
error_display.m_htmlWindow->AppendToPage( msg ); AppendMsgPanel( _( "Key words" ), alias->GetKeyWords(), DARKDARKGRAY );
} AppendMsgPanel( _( "Datasheet" ), alias->GetDocFileName(), DARKDARKGRAY );
if( !dup_error && !offgrid_error )
DisplayInfoMessage( this, _( "No off grid or duplicate pins were found." ) );
else
error_display.ShowModal();
} }

View File

@ -85,10 +85,7 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT ); KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar // Set up toolbar
m_mainToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString, m_mainToolBar->Add( EE_ACTIONS::newSymbol );
KiScaledBitmap( new_component_xpm, this ),
_( "Create new symbol" ) );
m_mainToolBar->Add( ACTIONS::saveAll ); m_mainToolBar->Add( ACTIONS::saveAll );
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
@ -107,11 +104,8 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->Add( EE_ACTIONS::pinTable ); m_mainToolBar->Add( EE_ACTIONS::pinTable );
KiScaledSeparator( m_mainToolBar, this ); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->Add( EE_ACTIONS::showDatasheet ); m_mainToolBar->Add( EE_ACTIONS::showDatasheet );
m_mainToolBar->Add( EE_ACTIONS::runERC );
m_mainToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString, KiScaledBitmap( erc_xpm, this ),
_( "Check duplicate and off grid pins" ) );
KiScaledSeparator( m_mainToolBar, this ); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->Add( EE_ACTIONS::showDeMorganStandard, ACTION_TOOLBAR::TOGGLE ); m_mainToolBar->Add( EE_ACTIONS::showDeMorganStandard, ACTION_TOOLBAR::TOGGLE );

View File

@ -166,10 +166,16 @@ public:
static TOOL_ACTION generateBOM; static TOOL_ACTION generateBOM;
static TOOL_ACTION runSimulation; static TOOL_ACTION runSimulation;
// Miscellaneous // Library management
static TOOL_ACTION newSymbol;
static TOOL_ACTION importSymbol;
// Hierarchy navigation
static TOOL_ACTION enterSheet; static TOOL_ACTION enterSheet;
static TOOL_ACTION leaveSheet; static TOOL_ACTION leaveSheet;
static TOOL_ACTION navigateHierarchy; static TOOL_ACTION navigateHierarchy;
// Miscellaneous
static TOOL_ACTION cleanupSheetPins; static TOOL_ACTION cleanupSheetPins;
static TOOL_ACTION toggleHiddenPins; static TOOL_ACTION toggleHiddenPins;
static TOOL_ACTION symbolProperties; static TOOL_ACTION symbolProperties;

View File

@ -44,6 +44,7 @@
#include <eda_doc.h> #include <eda_doc.h>
#include <invoke_sch_dialog.h> #include <invoke_sch_dialog.h>
#include <project.h> #include <project.h>
#include <dialogs/dialog_display_info_HTML_base.h>
TOOL_ACTION EE_ACTIONS::runERC( "eeschame.InspectionTool.runERC", TOOL_ACTION EE_ACTIONS::runERC( "eeschame.InspectionTool.runERC",
AS_GLOBAL, 0, AS_GLOBAL, 0,
@ -92,19 +93,155 @@ bool EE_INSPECTION_TOOL::Init()
int EE_INSPECTION_TOOL::RunERC( const TOOL_EVENT& aEvent ) int EE_INSPECTION_TOOL::RunERC( const TOOL_EVENT& aEvent )
{ {
SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame ); if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) )
{
checkPart( static_cast<LIB_EDIT_FRAME*>( m_frame )->GetCurPart() );
}
else if( m_frame->IsType( FRAME_SCH ) )
{
wxWindow* erc = wxWindow::FindWindowById( ID_DIALOG_ERC, m_frame ); wxWindow* erc = wxWindow::FindWindowById( ID_DIALOG_ERC, m_frame );
if( erc ) if( erc )
// Bring it to the top if already open. Dual monitor users need this. // Bring it to the top if already open. Dual monitor users need this.
erc->Raise(); erc->Raise();
else if( editFrame ) else
InvokeDialogERC( editFrame ); InvokeDialogERC( static_cast<SCH_EDIT_FRAME*>( m_frame ) );
}
return 0; return 0;
} }
// helper function to sort pins by pin num
bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst )
{
// Use number as primary key
int test = ref->GetNumber().Cmp( tst->GetNumber() );
// Use DeMorgan variant as secondary key
if( test == 0 )
test = ref->GetConvert() - tst->GetConvert();
// Use unit as tertiary key
if( test == 0 )
test = ref->GetUnit() - tst->GetUnit();
return test < 0;
}
void EE_INSPECTION_TOOL::checkPart( LIB_PART* aPart )
{
if( !aPart )
return;
wxString msg;
wxRealPoint curr_grid_size = m_frame->GetScreen()->GetGridSize();
const int min_grid_size = 25;
const int grid_size = KiROUND( curr_grid_size.x );
const int clamped_grid_size = ( grid_size < min_grid_size ) ? min_grid_size : grid_size;
LIB_PINS pinList;
aPart->GetPins( pinList );
if( pinList.empty() )
{
DisplayInfoMessage( m_frame, _( "No pins!" ) );
return;
}
// Sort pins by pin num, so 2 duplicate pins
// (pins with the same number) will be consecutive in list
sort( pinList.begin(), pinList.end(), sort_by_pin_number );
// Test for duplicates:
DIALOG_DISPLAY_HTML_TEXT_BASE error_display( m_frame, wxID_ANY, _( "Marker Information" ),
wxDefaultPosition, wxSize( 750, 600 ) );
int dup_error = 0;
for( unsigned ii = 1; ii < pinList.size(); ii++ )
{
LIB_PIN* pin = pinList[ii - 1];
LIB_PIN* next = pinList[ii];
if( pin->GetNumber() != next->GetNumber() || pin->GetConvert() != next->GetConvert() )
continue;
dup_error++;
/* TODO I dare someone to find a way to make happy translators on
this thing! Lorenzo */
msg = wxString::Format( _( "<b>Duplicate pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b>"
" conflicts with pin %s \"%s\" at location <b>(%.3f, %.3f)</b>" ),
next->GetNumber(),
next->GetName(),
next->GetPosition().x / 1000.0, -next->GetPosition().y / 1000.0,
pin->GetNumber(),
pin->GetName(),
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0 );
if( aPart->GetUnitCount() > 1 )
{
msg += wxString::Format( _( " in units %c and %c" ),
'A' + next->GetUnit() - 1,
'A' + pin->GetUnit() - 1 );
}
if( aPart->HasConversion() )
{
if( next->GetConvert() )
msg += _( " of converted" );
else
msg += _( " of normal" );
}
msg += wxT( ".<br>" );
error_display.m_htmlWindow->AppendToPage( msg );
}
// Test for off grid pins:
int offgrid_error = 0;
for( LIB_PIN* pin : pinList )
{
if( ( (pin->GetPosition().x % clamped_grid_size) == 0 ) &&
( (pin->GetPosition().y % clamped_grid_size) == 0 ) )
continue;
// "pin" is off grid here.
offgrid_error++;
msg = wxString::Format( _( "<b>Off grid pin %s</b> \"%s\" at location <b>(%.3f, %.3f)</b>" ),
pin->GetNumber(),
pin->GetName(),
pin->GetPosition().x / 1000.0, -pin->GetPosition().y / 1000.0 );
if( aPart->GetUnitCount() > 1 )
msg += wxString::Format( _( " in symbol %c" ), 'A' + pin->GetUnit() - 1 );
if( aPart->HasConversion() )
{
if( pin->GetConvert() )
msg += _( " of converted" );
else
msg += _( " of normal" );
}
msg += wxT( ".<br>" );
error_display.m_htmlWindow->AppendToPage( msg );
}
if( !dup_error && !offgrid_error )
DisplayInfoMessage( m_frame, _( "No off grid or duplicate pins were found." ) );
else
error_display.ShowModal();
}
int EE_INSPECTION_TOOL::RunSimulation( const TOOL_EVENT& aEvent ) int EE_INSPECTION_TOOL::RunSimulation( const TOOL_EVENT& aEvent )
{ {
#ifdef KICAD_SPICE #ifdef KICAD_SPICE
@ -125,12 +262,9 @@ int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
{ {
wxString datasheet; wxString datasheet;
LIB_EDIT_FRAME* libEditFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame ); if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) )
LIB_VIEW_FRAME* libViewFrame = dynamic_cast<LIB_VIEW_FRAME*>( m_frame );
if( libEditFrame )
{ {
LIB_PART* part = libEditFrame->GetCurPart(); LIB_PART* part = static_cast<LIB_EDIT_FRAME*>( m_frame )->GetCurPart();
if( !part ) if( !part )
return 0; return 0;
@ -155,16 +289,16 @@ int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
else else
datasheet = part->GetAlias( 0 )->GetDocFileName(); datasheet = part->GetAlias( 0 )->GetDocFileName();
} }
else if( libViewFrame ) else if( m_frame->IsType( FRAME_SCH_VIEWER ) || m_frame->IsType( FRAME_SCH_VIEWER_MODAL ) )
{ {
LIB_ALIAS* entry = libViewFrame->GetSelectedAlias(); LIB_ALIAS* entry = static_cast<LIB_VIEW_FRAME*>( m_frame )->GetSelectedAlias();
if( !entry ) if( !entry )
return 0; return 0;
datasheet = entry->GetDocFileName(); datasheet = entry->GetDocFileName();
} }
else else if( m_frame->IsType( FRAME_SCH ) )
{ {
SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::ComponentsOnly ); SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::ComponentsOnly );

View File

@ -51,6 +51,8 @@ public:
int UpdateMessagePanel( const TOOL_EVENT& aEvent ); int UpdateMessagePanel( const TOOL_EVENT& aEvent );
private: private:
void checkPart( LIB_PART* aPart );
///> @copydoc TOOL_INTERACTIVE::setTransitions(); ///> @copydoc TOOL_INTERACTIVE::setTransitions();
void setTransitions() override; void setTransitions() override;
}; };

View File

@ -42,6 +42,31 @@ TOOL_ACTION EE_ACTIONS::showComponentTree( "eeschema.SymbolLibraryControl.showCo
search_tree_xpm ); search_tree_xpm );
int LIB_CONTROL::AddLibrary( const TOOL_EVENT& aEvent )
{
bool createNew = aEvent.IsAction( &ACTIONS::newLibrary );
if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) )
static_cast<LIB_EDIT_FRAME*>( m_frame )->AddLibraryFile( createNew );
return 0;
}
int LIB_CONTROL::AddSymbol( const TOOL_EVENT& aEvent )
{
if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) )
{
if( aEvent.IsAction( &EE_ACTIONS::newSymbol ) )
static_cast<LIB_EDIT_FRAME*>( m_frame )->CreateNewPart();
else if( aEvent.IsAction( &EE_ACTIONS::importSymbol ) )
static_cast<LIB_EDIT_FRAME*>( m_frame )->ImportPart();
}
return 0;
}
int LIB_CONTROL::Save( const TOOL_EVENT& aEvent ) int LIB_CONTROL::Save( const TOOL_EVENT& aEvent )
{ {
if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) ) if( m_frame->IsType( FRAME_SCH_LIB_EDITOR ) )
@ -140,8 +165,14 @@ int LIB_CONTROL::ShowElectricalTypes( const TOOL_EVENT& aEvent )
void LIB_CONTROL::setTransitions() void LIB_CONTROL::setTransitions()
{ {
Go( &LIB_CONTROL::AddLibrary, ACTIONS::newLibrary.MakeEvent() );
Go( &LIB_CONTROL::AddLibrary, ACTIONS::addLibrary.MakeEvent() );
Go( &LIB_CONTROL::AddSymbol, EE_ACTIONS::newSymbol.MakeEvent() );
Go( &LIB_CONTROL::AddSymbol, EE_ACTIONS::importSymbol.MakeEvent() );
Go( &LIB_CONTROL::Save, ACTIONS::save.MakeEvent() ); Go( &LIB_CONTROL::Save, ACTIONS::save.MakeEvent() );
Go( &LIB_CONTROL::SaveAs, ACTIONS::saveAs.MakeEvent() ); Go( &LIB_CONTROL::SaveAs, ACTIONS::saveAs.MakeEvent() ); // for libraries
Go( &LIB_CONTROL::SaveAs, ACTIONS::saveCopyAs.MakeEvent() ); // for symbols
Go( &LIB_CONTROL::SaveAll, ACTIONS::saveAll.MakeEvent() ); Go( &LIB_CONTROL::SaveAll, ACTIONS::saveAll.MakeEvent() );
Go( &LIB_CONTROL::Revert, ACTIONS::revert.MakeEvent() ); Go( &LIB_CONTROL::Revert, ACTIONS::revert.MakeEvent() );

View File

@ -44,6 +44,9 @@ public:
virtual ~LIB_CONTROL() { } virtual ~LIB_CONTROL() { }
int AddLibrary( const TOOL_EVENT& aEvent );
int AddSymbol( const TOOL_EVENT& aEvent );
int Save( const TOOL_EVENT& aEvent ); int Save( const TOOL_EVENT& aEvent );
int SaveAs( const TOOL_EVENT& aEvent ); int SaveAs( const TOOL_EVENT& aEvent );
int SaveAll( const TOOL_EVENT& aEvent ); int SaveAll( const TOOL_EVENT& aEvent );

View File

@ -131,6 +131,16 @@ TOOL_ACTION EE_ACTIONS::generateBOM( "eeschema.EditorControl.generateBOM",
_( "Generate BOM..." ), _( "Generate a bill of materials for the current schematic" ), _( "Generate BOM..." ), _( "Generate a bill of materials for the current schematic" ),
bom_xpm ); bom_xpm );
TOOL_ACTION EE_ACTIONS::newSymbol( "eeschema.EditorControl.newSymbol",
AS_GLOBAL, 0,
_( "New Symbol..." ), _( "Create a new symbol" ),
new_component_xpm );
TOOL_ACTION EE_ACTIONS::importSymbol( "eeschema.EditorControl.importSymbol",
AS_GLOBAL, 0,
_( "Import Symbol..." ), _( "Import a symbol to the current library" ),
import_part_xpm );
TOOL_ACTION EE_ACTIONS::enterSheet( "eeschema.EditorControl.enterSheet", TOOL_ACTION EE_ACTIONS::enterSheet( "eeschema.EditorControl.enterSheet",
AS_GLOBAL, 0, AS_GLOBAL, 0,
_( "Enter Sheet" ), _( "Display the selected sheet's contents in the Eeschema window" ), _( "Enter Sheet" ), _( "Display the selected sheet's contents in the Eeschema window" ),

View File

@ -30,16 +30,20 @@
#include <lib_edit_frame.h> #include <lib_edit_frame.h>
#include <symbol_lib_table.h> #include <symbol_lib_table.h>
#include <menus_helpers.h> #include <menus_helpers.h>
#include <tool/action_menu.h>
#include <tool/actions.h>
#include <tools/ee_actions.h>
SYMBOL_TREE_PANE::SYMBOL_TREE_PANE( LIB_EDIT_FRAME* aParent, LIB_MANAGER* aLibMgr ) SYMBOL_TREE_PANE::SYMBOL_TREE_PANE( LIB_EDIT_FRAME* aParent, LIB_MANAGER* aLibMgr )
: wxPanel( aParent ), : wxPanel( aParent ),
m_libEditFrame( aParent ), m_tree( nullptr ), m_libMgr( aLibMgr ) m_libEditFrame( aParent ),
m_tree( nullptr ),
m_libMgr( aLibMgr )
{ {
// Create widgets // Create widgets
wxBoxSizer* boxSizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* boxSizer = new wxBoxSizer( wxVERTICAL );
m_tree = new LIB_TREE( this, &SYMBOL_LIB_TABLE::GetGlobalLibTable(), m_tree = new LIB_TREE( this, &SYMBOL_LIB_TABLE::GetGlobalLibTable(), m_libMgr->GetAdapter(),
m_libMgr->GetAdapter(), LIB_TREE::SEARCH ); LIB_TREE::SEARCH );
boxSizer->Add( m_tree, 1, wxEXPAND, 5 ); boxSizer->Add( m_tree, 1, wxEXPAND, 5 );
SetSizer( boxSizer ); // should remove the previous sizer according to wxWidgets docs SetSizer( boxSizer ); // should remove the previous sizer according to wxWidgets docs
@ -47,42 +51,32 @@ SYMBOL_TREE_PANE::SYMBOL_TREE_PANE( LIB_EDIT_FRAME* aParent, LIB_MANAGER* aLibMg
boxSizer->Fit( this ); boxSizer->Fit( this );
// Setup right click-context menus // Setup right click-context menus
std::unique_ptr<wxMenu> menuLibrary = std::make_unique<wxMenu>(); std::unique_ptr<ACTION_MENU> menuLibrary = std::make_unique<ACTION_MENU>();
AddMenuItem( menuLibrary.get(), ID_LIBEDIT_NEW_LIBRARY, _( "&New Library..." ), menuLibrary->Add( ACTIONS::newLibrary );
KiBitmap( new_library_xpm ) ); menuLibrary->Add( ACTIONS::addLibrary );
AddMenuItem( menuLibrary.get(), ID_LIBEDIT_ADD_LIBRARY, _( "&Add Library..." ), menuLibrary->Add( ACTIONS::save );
KiBitmap( add_library_xpm ) ); menuLibrary->Add( ACTIONS::saveAs );
AddMenuItem( menuLibrary.get(), ID_LIBEDIT_SAVE, _( "&Save" ), menuLibrary->Add( ACTIONS::revert );
KiBitmap( save_xpm ) );
AddMenuItem( menuLibrary.get(), ID_LIBEDIT_SAVE_AS, _( "Save As..." ),
KiBitmap( save_as_xpm ) );
AddMenuItem( menuLibrary.get(), ID_LIBEDIT_REVERT, _( "Revert" ),
KiBitmap( undo_xpm ) );
menuLibrary->AppendSeparator(); menuLibrary->AppendSeparator();
AddMenuItem( menuLibrary.get(), ID_LIBEDIT_NEW_PART, _( "New Sy&mbol..." ), menuLibrary->Add( EE_ACTIONS::newSymbol );
KiBitmap( new_component_xpm ) ); menuLibrary->Add( EE_ACTIONS::importSymbol );
AddMenuItem( menuLibrary.get(), ID_LIBEDIT_IMPORT_PART, _( "&Import Symbol..." ),
KiBitmap( import_part_xpm ) );
AddMenuItem( menuLibrary.get(), ID_LIBEDIT_PASTE_PART, _( "Paste Symbol" ), AddMenuItem( menuLibrary.get(), ID_LIBEDIT_PASTE_PART, _( "Paste Symbol" ),
KiBitmap( paste_xpm ) ); KiBitmap( paste_xpm ) );
std::unique_ptr<wxMenu> menuPart = std::make_unique<wxMenu>(); std::unique_ptr<ACTION_MENU> menuPart = std::make_unique<ACTION_MENU>();
AddMenuItem( menuPart.get(), ID_LIBEDIT_EDIT_PART, _( "&Edit Symbol" ), AddMenuItem( menuPart.get(), ID_LIBEDIT_EDIT_PART, _( "Edit Symbol" ),
KiBitmap( edit_xpm ) ); KiBitmap( edit_xpm ) );
menuPart->AppendSeparator(); menuPart->AppendSeparator();
AddMenuItem( menuPart.get(), ID_LIBEDIT_SAVE, _( "&Save" ), menuPart->Add( ACTIONS::save );
KiBitmap( save_xpm ) ); menuPart->Add( ACTIONS::saveCopyAs );
AddMenuItem( menuPart.get(), ID_LIBEDIT_SAVE_AS, _( "Save a Copy As..." ),
KiBitmap( save_xpm ) );
AddMenuItem( menuPart.get(), ID_LIBEDIT_DUPLICATE_PART, _( "Duplicate" ), AddMenuItem( menuPart.get(), ID_LIBEDIT_DUPLICATE_PART, _( "Duplicate" ),
KiBitmap( duplicate_xpm ) ); KiBitmap( duplicate_xpm ) );
AddMenuItem( menuPart.get(), ID_LIBEDIT_REMOVE_PART, _( "Delete" ), AddMenuItem( menuPart.get(), ID_LIBEDIT_REMOVE_PART, _( "Delete" ),
KiBitmap( delete_xpm ) ); KiBitmap( delete_xpm ) );
AddMenuItem( menuPart.get(), ID_LIBEDIT_REVERT, _( "Revert" ), menuPart->Add( ACTIONS::revert );
KiBitmap( undo_xpm ) );
menuPart->AppendSeparator(); menuPart->AppendSeparator();
AddMenuItem( menuPart.get(), ID_LIBEDIT_CUT_PART, _( "Cut" ), AddMenuItem( menuPart.get(), ID_LIBEDIT_CUT_PART, _( "Cut" ),
@ -95,11 +89,9 @@ SYMBOL_TREE_PANE::SYMBOL_TREE_PANE( LIB_EDIT_FRAME* aParent, LIB_MANAGER* aLibMg
KiBitmap( export_part_xpm ) ); KiBitmap( export_part_xpm ) );
// Menu displayed when nothing is selected // Menu displayed when nothing is selected
std::unique_ptr<wxMenu> menuNoSelection = std::make_unique<wxMenu>(); std::unique_ptr<ACTION_MENU> menuNoSelection = std::make_unique<ACTION_MENU>();
AddMenuItem( menuNoSelection.get(), ID_LIBEDIT_NEW_LIBRARY, _( "&New Library..." ), menuLibrary->Add( ACTIONS::newLibrary );
KiBitmap( new_library_xpm ) ); menuLibrary->Add( ACTIONS::addLibrary );
AddMenuItem( menuNoSelection.get(), ID_LIBEDIT_ADD_LIBRARY, _( "&Add Library..." ),
KiBitmap( add_library_xpm ) );
m_tree->SetMenu( LIB_TREE_NODE::LIBID, std::move( menuPart ) ); m_tree->SetMenu( LIB_TREE_NODE::LIBID, std::move( menuPart ) );
m_tree->SetMenu( LIB_TREE_NODE::LIB, std::move( menuLibrary ) ); m_tree->SetMenu( LIB_TREE_NODE::LIB, std::move( menuLibrary ) );

View File

@ -36,6 +36,7 @@
#include <gerber_file_image_list.h> #include <gerber_file_image_list.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tools/gerbview_actions.h> #include <tools/gerbview_actions.h>
#include <tools/gerbview_control.h>
///@{ ///@{
/// \ingroup config /// \ingroup config
@ -309,13 +310,15 @@ void DIALOG_PRINT_GERBVIEW::saveSettings()
} }
void GERBVIEW_FRAME::ToPrinter( wxCommandEvent& event ) int GERBVIEW_CONTROL::Print( const TOOL_EVENT& aEvent )
{ {
// Selection affects the original item visibility // Selection affects the original item visibility
GetToolManager()->RunAction( GERBVIEW_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( GERBVIEW_ACTIONS::selectionClear, true );
BOARD_PRINTOUT_SETTINGS settings( GetPageSettings() ); BOARD_PRINTOUT_SETTINGS settings( m_frame->GetPageSettings() );
DIALOG_PRINT_GERBVIEW dlg( this, &settings ); DIALOG_PRINT_GERBVIEW dlg( m_frame, &settings );
dlg.ForcePrintBorder( false ); dlg.ForcePrintBorder( false );
dlg.ShowModal(); dlg.ShowModal();
return 0;
} }

View File

@ -86,7 +86,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
// menu Miscellaneous // menu Miscellaneous
EVT_MENU( ID_GERBVIEW_ERASE_CURR_LAYER, GERBVIEW_FRAME::Process_Special_Functions ) EVT_MENU( ID_GERBVIEW_ERASE_CURR_LAYER, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_PRINT, GERBVIEW_FRAME::ToPrinter )
EVT_COMBOBOX( ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, GERBVIEW_FRAME::OnSelectActiveLayer ) EVT_COMBOBOX( ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, GERBVIEW_FRAME::OnSelectActiveLayer )
EVT_SELECT_DCODE( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnSelectActiveDCode ) EVT_SELECT_DCODE( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnSelectActiveDCode )
@ -95,13 +94,10 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
GERBVIEW_FRAME::Process_Special_Functions ) GERBVIEW_FRAME::Process_Special_Functions )
// Option toolbar // Option toolbar
EVT_TOOL( ID_TB_MEASUREMENT_TOOL, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
GERBVIEW_FRAME::OnToggleShowLayerManager ) GERBVIEW_FRAME::OnToggleShowLayerManager )
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,
GERBVIEW_FRAME::OnSelectDisplayMode ) GERBVIEW_FRAME::OnSelectDisplayMode )
EVT_TOOL( ID_TB_OPTIONS_DIFF_MODE, GERBVIEW_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_HIGH_CONTRAST_MODE, GERBVIEW_FRAME::OnSelectOptionToolbar )
// 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 )
@ -143,10 +139,6 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
ClearMsgPanel(); ClearMsgPanel();
break; break;
case ID_TB_MEASUREMENT_TOOL:
SetToolID( id, wxCURSOR_DEFAULT, _( "Unsupported tool in this canvas" ) );
break;
case ID_GERBVIEW_SHOW_LIST_DCODES: case ID_GERBVIEW_SHOW_LIST_DCODES:
Liste_D_Codes(); Liste_D_Codes();
break; break;
@ -312,36 +304,3 @@ void GERBVIEW_FRAME::OnToggleShowLayerManager( wxCommandEvent& aEvent )
m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools ); m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
m_auimgr.Update(); m_auimgr.Update();
} }
void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{
int id = event.GetId();
bool needs_refresh = false;
GBR_DISPLAY_OPTIONS options = m_DisplayOptions;
switch( id )
{
case ID_TB_OPTIONS_DIFF_MODE:
options.m_DiffMode = !options.m_DiffMode;
needs_refresh = true;
break;
case ID_TB_OPTIONS_HIGH_CONTRAST_MODE:
options.m_HighContrastMode = !options.m_HighContrastMode;
needs_refresh = true;
break;
case ID_TB_MEASUREMENT_TOOL:
SetToolID( id, wxCURSOR_DEFAULT, _( "Unsupported tool in this canvas" ) );
break;
default:
wxMessageBox( wxT( "GERBVIEW_FRAME::OnSelectOptionToolbar error" ) );
break;
}
if( needs_refresh )
UpdateDisplayOptions( options );
}

View File

@ -97,8 +97,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_zipFileHistory.SetMaxFiles( fileHistorySize ); m_zipFileHistory.SetMaxFiles( fileHistorySize );
m_jobFileHistory.SetMaxFiles( fileHistorySize ); m_jobFileHistory.SetMaxFiles( fileHistorySize );
EDA_DRAW_PANEL_GAL* galCanvas = new GERBVIEW_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), auto* galCanvas = new GERBVIEW_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
m_FrameSize,
GetGalDisplayOptions(), GetGalDisplayOptions(),
EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE ); EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
@ -757,20 +756,11 @@ bool GERBVIEW_FRAME::IsElementVisible( int aLayerID ) const
{ {
switch( aLayerID ) switch( aLayerID )
{ {
case LAYER_DCODES: case LAYER_DCODES: return m_DisplayOptions.m_DisplayDCodes;
return m_DisplayOptions.m_DisplayDCodes; case LAYER_NEGATIVE_OBJECTS: return m_DisplayOptions.m_DisplayNegativeObjects;
case LAYER_GERBVIEW_GRID: return IsGridVisible();
case LAYER_NEGATIVE_OBJECTS: case LAYER_WORKSHEET: return m_showBorderAndTitleBlock;
return m_DisplayOptions.m_DisplayNegativeObjects; case LAYER_PCB_BACKGROUND: return true;
case LAYER_GERBVIEW_GRID:
return IsGridVisible();
case LAYER_WORKSHEET:
return m_showBorderAndTitleBlock;
case LAYER_PCB_BACKGROUND:
return true;
default: default:
wxLogDebug( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aLayerID ); wxLogDebug( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aLayerID );

View File

@ -410,7 +410,6 @@ public:
void ShowChangedLanguage() override; void ShowChangedLanguage() override;
void Process_Special_Functions( 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 );
@ -462,12 +461,6 @@ public:
void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent ); void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent ); void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
/**
* Function ToPrinter
* Open a dialog frame to print layers
*/
void ToPrinter( wxCommandEvent& event );
void Files_io( wxCommandEvent& event ); void Files_io( wxCommandEvent& event );
/** /**

View File

@ -50,26 +50,16 @@ enum gerbview_ids
ID_GERBVIEW_SHOW_SOURCE, ID_GERBVIEW_SHOW_SOURCE,
ID_GERBVIEW_EXPORT_TO_PCBNEW, ID_GERBVIEW_EXPORT_TO_PCBNEW,
ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR,
ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE, ID_GBR_AUX_TOOLBAR_PCB_CMP_CHOICE,
ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE, ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE,
ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE, ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE,
ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
ID_GERBVIEW_ERASE_CURR_LAYER, ID_GERBVIEW_ERASE_CURR_LAYER,
ID_GERBVIEW_OPTIONS_SETUP,
ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
ID_TB_OPTIONS_SHOW_DCODES,
ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
ID_TB_OPTIONS_SHOW_LINES_SKETCH,
ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH,
ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS,
ID_TB_OPTIONS_SHOW_GBR_MODE_0, ID_TB_OPTIONS_SHOW_GBR_MODE_0,
ID_TB_OPTIONS_SHOW_GBR_MODE_1, ID_TB_OPTIONS_SHOW_GBR_MODE_1,
ID_TB_OPTIONS_SHOW_GBR_MODE_2, ID_TB_OPTIONS_SHOW_GBR_MODE_2,
ID_TB_OPTIONS_DIFF_MODE,
ID_TB_OPTIONS_HIGH_CONTRAST_MODE,
ID_TB_MEASUREMENT_TOOL, ID_TB_MEASUREMENT_TOOL,
// Right click context menu // Right click context menu

View File

@ -217,39 +217,26 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
viewMenu->AddCheckItem( GERBVIEW_ACTIONS::polygonsDisplayOutlines, sketchPolygonsCondition ); viewMenu->AddCheckItem( GERBVIEW_ACTIONS::polygonsDisplayOutlines, sketchPolygonsCondition );
viewMenu->AddCheckItem( GERBVIEW_ACTIONS::dcodeDisplay, showDcodes ); viewMenu->AddCheckItem( GERBVIEW_ACTIONS::dcodeDisplay, showDcodes );
viewMenu->AddCheckItem( GERBVIEW_ACTIONS::negativeObjectDisplay, showNegativeObjects ); viewMenu->AddCheckItem( GERBVIEW_ACTIONS::negativeObjectDisplay, showNegativeObjects );
viewMenu->AddCheckItem( GERBVIEW_ACTIONS::toggleDiffMode, diffModeCondition );
viewMenu->AddCheckItem( ID_TB_OPTIONS_DIFF_MODE, viewMenu->AddCheckItem( ACTIONS::highContrastMode, contrastModeCondition );
_( "Show in Differential Mode" ),
_( "Show layers in differential mode" ),
gbr_select_mode2_xpm, diffModeCondition );
viewMenu->AddCheckItem( ID_TB_OPTIONS_HIGH_CONTRAST_MODE,
AddHotkeyName( _( "Show in High Contrast" ), GerbviewHotkeysDescr, HK_SWITCH_HIGHCONTRAST_MODE ),
_( "Show in high contrast mode" ),
contrast_mode_xpm, contrastModeCondition );
viewMenu->Resolve(); viewMenu->Resolve();
//-- Tools menu ------------------------------------------------------- //-- Tools menu -------------------------------------------------------
// //
wxMenu* toolsMenu = new wxMenu; ACTION_MENU* toolsMenu = new ACTION_MENU();
// List dcodes toolsMenu->Add( _( "&List DCodes..." ), _( "List D-codes defined in Gerber files" ),
AddMenuItem( toolsMenu, ID_GERBVIEW_SHOW_LIST_DCODES, _( "&List DCodes..." ), ID_GERBVIEW_SHOW_LIST_DCODES, show_dcodenumber_xpm );
_( "List D-codes defined in Gerber files" ),
KiBitmap( show_dcodenumber_xpm ) );
// Show source toolsMenu->Add( _( "&Show Source..." ), _( "Show source file for the current layer" ),
AddMenuItem( toolsMenu, ID_GERBVIEW_SHOW_SOURCE, _( "&Show Source..." ), ID_GERBVIEW_SHOW_SOURCE, tools_xpm );
_( "Show source file for the current layer" ),
KiBitmap( tools_xpm ) ); toolsMenu->Add( GERBVIEW_ACTIONS::measureTool );
toolsMenu->AppendSeparator(); toolsMenu->AppendSeparator();
toolsMenu->Add( _( "Clear Current Layer..." ), _( "Clear the selected graphic layer" ),
// Erase graphic layer ID_GERBVIEW_ERASE_CURR_LAYER, delete_sheet_xpm );
AddMenuItem( toolsMenu, ID_GERBVIEW_ERASE_CURR_LAYER, _( "&Clear Current Layer..." ),
_( "Clear the graphic layer currently selected" ),
KiBitmap( delete_sheet_xpm ) );
//-- Preferences menu ----------------------------------------------- //-- Preferences menu -----------------------------------------------
// //

View File

@ -236,16 +236,8 @@ void GERBVIEW_FRAME::ReCreateOptToolbar()
m_optionsToolBar->Add( GERBVIEW_ACTIONS::polygonsDisplayOutlines, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( GERBVIEW_ACTIONS::polygonsDisplayOutlines, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( GERBVIEW_ACTIONS::negativeObjectDisplay, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( GERBVIEW_ACTIONS::negativeObjectDisplay, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( GERBVIEW_ACTIONS::dcodeDisplay, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( GERBVIEW_ACTIONS::dcodeDisplay, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( GERBVIEW_ACTIONS::toggleDiffMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_DIFF_MODE, wxEmptyString, m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE );
KiScaledBitmap( gbr_select_mode2_xpm, this ),
_( "Show layers in diff (compare) mode" ),
wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_HIGH_CONTRAST_MODE, wxEmptyString,
KiScaledBitmap( contrast_mode_xpm, this ),
_( "Enable high contrast display mode" ),
wxITEM_CHECK );
// Tools to show/hide toolbars: // Tools to show/hide toolbars:
KiScaledSeparator( m_mainToolBar, this ); KiScaledSeparator( m_mainToolBar, this );
@ -493,5 +485,7 @@ void GERBVIEW_FRAME::SyncMenusAndToolbars()
IsElementVisible( LAYER_NEGATIVE_OBJECTS ) ); IsElementVisible( LAYER_NEGATIVE_OBJECTS ) );
m_optionsToolBar->Toggle( GERBVIEW_ACTIONS::dcodeDisplay, m_optionsToolBar->Toggle( GERBVIEW_ACTIONS::dcodeDisplay,
IsElementVisible( LAYER_DCODES ) ); IsElementVisible( LAYER_DCODES ) );
m_optionsToolBar->Toggle( GERBVIEW_ACTIONS::toggleDiffMode,m_DisplayOptions.m_DiffMode );
m_optionsToolBar->Toggle( ACTIONS::highContrastMode, m_DisplayOptions.m_HighContrastMode );
m_optionsToolBar->Refresh(); m_optionsToolBar->Refresh();
} }

View File

@ -64,6 +64,7 @@ public:
static TOOL_ACTION polygonsDisplayOutlines; static TOOL_ACTION polygonsDisplayOutlines;
static TOOL_ACTION negativeObjectDisplay; static TOOL_ACTION negativeObjectDisplay;
static TOOL_ACTION dcodeDisplay; static TOOL_ACTION dcodeDisplay;
static TOOL_ACTION toggleDiffMode;
// Layer control // Layer control
static TOOL_ACTION layerPrev; static TOOL_ACTION layerPrev;

View File

@ -92,6 +92,11 @@ TOOL_ACTION GERBVIEW_ACTIONS::dcodeDisplay( "gerbview.Control.dcodeDisplay",
_( "Show DCodes" ), _( "Show dcode number" ), _( "Show DCodes" ), _( "Show dcode number" ),
show_dcodenumber_xpm ); show_dcodenumber_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::toggleDiffMode( "gerbview.Control.toggleDiffMode",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GBR_DCODE_DISPLAY_ONOFF ),
_( "Show in Differential Mode" ), _( "Show layers in diff (compare) mode" ),
gbr_select_mode2_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::showHelp( "gerbview.Control.showHelp", TOOL_ACTION GERBVIEW_ACTIONS::showHelp( "gerbview.Control.showHelp",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HELP ), AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HELP ),
"", "" ); "", "" );
@ -195,6 +200,16 @@ int GERBVIEW_CONTROL::DisplayControl( const TOOL_EVENT& aEvent )
state = !m_frame->IsElementVisible( LAYER_DCODES ); state = !m_frame->IsElementVisible( LAYER_DCODES );
m_frame->SetElementVisibility( LAYER_DCODES, state ); m_frame->SetElementVisibility( LAYER_DCODES, state );
} }
else if( aEvent.IsAction( &ACTIONS::highContrastMode ) )
{
options.m_HighContrastMode = !options.m_HighContrastMode;
needs_refresh = true;
}
else if( aEvent.IsAction( &GERBVIEW_ACTIONS::toggleDiffMode ) )
{
options.m_DiffMode = !options.m_DiffMode;
needs_refresh = true;
}
if( needs_refresh ) if( needs_refresh )
m_frame->UpdateDisplayOptions( options ); m_frame->UpdateDisplayOptions( options );
@ -264,6 +279,8 @@ int GERBVIEW_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
void GERBVIEW_CONTROL::setTransitions() void GERBVIEW_CONTROL::setTransitions()
{ {
Go( &GERBVIEW_CONTROL::Print, ACTIONS::print.MakeEvent() );
Go( &GERBVIEW_CONTROL::HighlightControl, GERBVIEW_ACTIONS::highlightClear.MakeEvent() ); Go( &GERBVIEW_CONTROL::HighlightControl, GERBVIEW_ACTIONS::highlightClear.MakeEvent() );
Go( &GERBVIEW_CONTROL::HighlightControl, GERBVIEW_ACTIONS::highlightNet.MakeEvent() ); Go( &GERBVIEW_CONTROL::HighlightControl, GERBVIEW_ACTIONS::highlightNet.MakeEvent() );
Go( &GERBVIEW_CONTROL::HighlightControl, GERBVIEW_ACTIONS::highlightComponent.MakeEvent() ); Go( &GERBVIEW_CONTROL::HighlightControl, GERBVIEW_ACTIONS::highlightComponent.MakeEvent() );
@ -277,6 +294,8 @@ void GERBVIEW_CONTROL::setTransitions()
Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::polygonsDisplayOutlines.MakeEvent() ); Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::polygonsDisplayOutlines.MakeEvent() );
Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::negativeObjectDisplay.MakeEvent() ); Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::negativeObjectDisplay.MakeEvent() );
Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::dcodeDisplay.MakeEvent() ); Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::dcodeDisplay.MakeEvent() );
Go( &GERBVIEW_CONTROL::DisplayControl, ACTIONS::highContrastMode.MakeEvent() );
Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::toggleDiffMode.MakeEvent() );
Go( &GERBVIEW_CONTROL::ShowHelp, GERBVIEW_ACTIONS::showHelp.MakeEvent() ); Go( &GERBVIEW_CONTROL::ShowHelp, GERBVIEW_ACTIONS::showHelp.MakeEvent() );

View File

@ -60,6 +60,7 @@ public:
int SwitchUnits( const TOOL_EVENT& aEvent ); int SwitchUnits( const TOOL_EVENT& aEvent );
int ShowHelp( const TOOL_EVENT& aEvent ); int ShowHelp( const TOOL_EVENT& aEvent );
int UpdateMessagePanel( const TOOL_EVENT& aEvent ); int UpdateMessagePanel( const TOOL_EVENT& aEvent );
int Print( const TOOL_EVENT& aEvent );
///> Sets up handlers for various events. ///> Sets up handlers for various events.
void setTransitions() override; void setTransitions() override;

View File

@ -787,8 +787,7 @@ int GERBVIEW_SELECTION_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
auto previous_settings = controls.GetSettings(); auto previous_settings = controls.GetSettings();
Activate(); Activate();
m_frame->SetToolID( ID_TB_MEASUREMENT_TOOL, wxCURSOR_PENCIL, m_frame->SetToolID( ID_TB_MEASUREMENT_TOOL, wxCURSOR_PENCIL, _( "Measure distance" ) );
_( "Measure distance" ) );
KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPtMgr; KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER twoPtMgr;
KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, m_frame->GetUserUnits() ); KIGFX::PREVIEW::RULER_ITEM ruler( twoPtMgr, m_frame->GetUserUnits() );

View File

@ -47,6 +47,7 @@ public:
// Generic document actions // Generic document actions
static TOOL_ACTION doNew; // sadly 'new' is a reserved word static TOOL_ACTION doNew; // sadly 'new' is a reserved word
static TOOL_ACTION newLibrary; static TOOL_ACTION newLibrary;
static TOOL_ACTION addLibrary;
static TOOL_ACTION open; static TOOL_ACTION open;
static TOOL_ACTION save; static TOOL_ACTION save;
static TOOL_ACTION saveAs; static TOOL_ACTION saveAs;
@ -92,6 +93,9 @@ public:
static TOOL_ACTION centerContents; static TOOL_ACTION centerContents;
static TOOL_ACTION toggleCursor; static TOOL_ACTION toggleCursor;
static TOOL_ACTION toggleCursorStyle; static TOOL_ACTION toggleCursorStyle;
static TOOL_ACTION highContrastMode;
static TOOL_ACTION highContrastInc;
static TOOL_ACTION highContrastDec;
/// Cursor control with keyboard /// Cursor control with keyboard
static TOOL_ACTION cursorUp; static TOOL_ACTION cursorUp;

View File

@ -48,9 +48,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
return GetScreen() && GetScreen()->IsModify(); return GetScreen() && GetScreen()->IsModify();
}; };
wxString msg; static ACTION_MENU* openRecentMenu; // Open Recent submenu, static to remember this menu
static ACTION_MENU* openRecentMenu; // Open Recent submenu,
// static to remember this menu
// Before deleting, remove the menus managed by m_fileHistory // Before deleting, remove the menus managed by m_fileHistory
// (the file history will be updated when adding/removing files in history // (the file history will be updated when adding/removing files in history
@ -156,12 +154,12 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
//-- Preferences menu -------------------------------------------------- //-- Preferences menu --------------------------------------------------
// //
wxMenu* preferencesMenu = new wxMenu; CONDITIONAL_MENU* preferencesMenu = new CONDITIONAL_MENU( false, selTool );
msg = AddHotkeyName( _( "Preferences..." ), PlEditorHotkeysDescr, HK_PREFERENCES ); preferencesMenu->AddItem( wxID_PREFERENCES,
AddMenuItem( preferencesMenu, wxID_PREFERENCES, msg, AddHotkeyName( _( "Preferences..." ), PlEditorHotkeysDescr, HK_PREFERENCES ),
_( "Show preferences for all open tools" ), _( "Show preferences for all open tools" ),
KiBitmap( preference_xpm ) ); preference_xpm, SELECTION_CONDITIONS::ShowAlways );
// Language submenu // Language submenu
Pgm().AddMenuLanguageList( preferencesMenu ); Pgm().AddMenuLanguageList( preferencesMenu );

View File

@ -251,7 +251,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) ); contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) );
contrastModeSubMenu->SetIcon( contrast_mode_xpm ); contrastModeSubMenu->SetIcon( contrast_mode_xpm );
contrastModeSubMenu->AddCheckItem( PCB_ACTIONS::highContrastMode, contrastModeCondition ); contrastModeSubMenu->AddCheckItem( ACTIONS::highContrastMode, contrastModeCondition );
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaDec, SELECTION_CONDITIONS::ShowAlways ); contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaDec, SELECTION_CONDITIONS::ShowAlways );
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaInc, SELECTION_CONDITIONS::ShowAlways ); contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaInc, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddMenu( contrastModeSubMenu ); viewMenu->AddMenu( contrastModeSubMenu );

View File

@ -400,7 +400,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) ); contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) );
contrastModeSubMenu->SetIcon( contrast_mode_xpm ); contrastModeSubMenu->SetIcon( contrast_mode_xpm );
contrastModeSubMenu->AddCheckItem( PCB_ACTIONS::highContrastMode, contrastModeCondition ); contrastModeSubMenu->AddCheckItem( ACTIONS::highContrastMode, contrastModeCondition );
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaDec, SELECTION_CONDITIONS::ShowAlways ); contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaDec, SELECTION_CONDITIONS::ShowAlways );
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaInc, SELECTION_CONDITIONS::ShowAlways ); contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaInc, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddMenu( contrastModeSubMenu ); viewMenu->AddMenu( contrastModeSubMenu );

View File

@ -182,7 +182,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->AddSeparator(); m_optionsToolBar->AddSeparator();
m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::moduleEdgeOutlines, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( PCB_ACTIONS::moduleEdgeOutlines, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddSeparator(); m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddTool( ID_MODEDIT_SHOW_HIDE_SEARCH_TREE, wxEmptyString, m_optionsToolBar->AddTool( ID_MODEDIT_SHOW_HIDE_SEARCH_TREE, wxEmptyString,
@ -208,7 +208,7 @@ void FOOTPRINT_EDIT_FRAME::SyncMenusAndToolbars()
m_optionsToolBar->Toggle( ACTIONS::togglePolarCoords, GetShowPolarCoords() ); m_optionsToolBar->Toggle( ACTIONS::togglePolarCoords, GetShowPolarCoords() );
m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts->m_DisplayPadFill ); m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts->m_DisplayPadFill );
m_optionsToolBar->Toggle( PCB_ACTIONS::moduleEdgeOutlines, !opts->m_DisplayModEdgeFill ); m_optionsToolBar->Toggle( PCB_ACTIONS::moduleEdgeOutlines, !opts->m_DisplayModEdgeFill );
m_optionsToolBar->Toggle( PCB_ACTIONS::highContrastMode, opts->m_ContrastModeDisplay ); m_optionsToolBar->Toggle( ACTIONS::highContrastMode, opts->m_ContrastModeDisplay );
m_optionsToolBar->Refresh(); m_optionsToolBar->Refresh();
m_drawToolBar->Toggle( PCB_ACTIONS::selectionTool, GetToolId() == ID_NO_TOOL_SELECTED ); m_drawToolBar->Toggle( PCB_ACTIONS::selectionTool, GetToolId() == ID_NO_TOOL_SELECTED );

View File

@ -364,7 +364,7 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::viaDisplayMode, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( PCB_ACTIONS::viaDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::trackDisplayMode, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( PCB_ACTIONS::trackDisplayMode, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE ); m_optionsToolBar->Add( ACTIONS::highContrastMode, ACTION_TOOLBAR::TOGGLE );
// Tools to show/hide toolbars: // Tools to show/hide toolbars:
KiScaledSeparator( m_optionsToolBar, this ); KiScaledSeparator( m_optionsToolBar, this );
@ -796,7 +796,7 @@ void PCB_EDIT_FRAME::SyncMenusAndToolbars()
m_optionsToolBar->Toggle( PCB_ACTIONS::trackDisplayMode, !opts->m_DisplayPcbTrackFill ); m_optionsToolBar->Toggle( PCB_ACTIONS::trackDisplayMode, !opts->m_DisplayPcbTrackFill );
m_optionsToolBar->Toggle( PCB_ACTIONS::viaDisplayMode, !opts->m_DisplayViaFill ); m_optionsToolBar->Toggle( PCB_ACTIONS::viaDisplayMode, !opts->m_DisplayViaFill );
m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts->m_DisplayPadFill ); m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts->m_DisplayPadFill );
m_optionsToolBar->Toggle( PCB_ACTIONS::highContrastMode, opts->m_ContrastModeDisplay ); m_optionsToolBar->Toggle( ACTIONS::highContrastMode, opts->m_ContrastModeDisplay );
m_optionsToolBar->Refresh(); m_optionsToolBar->Refresh();
m_drawToolBar->Toggle( PCB_ACTIONS::selectionTool, GetToolId() == ID_NO_TOOL_SELECTED ); m_drawToolBar->Toggle( PCB_ACTIONS::selectionTool, GetToolId() == ID_NO_TOOL_SELECTED );

View File

@ -218,9 +218,6 @@ public:
static TOOL_ACTION zoneDisplayEnable; static TOOL_ACTION zoneDisplayEnable;
static TOOL_ACTION zoneDisplayDisable; static TOOL_ACTION zoneDisplayDisable;
static TOOL_ACTION zoneDisplayOutlines; static TOOL_ACTION zoneDisplayOutlines;
static TOOL_ACTION highContrastMode;
static TOOL_ACTION highContrastInc;
static TOOL_ACTION highContrastDec;
// Layer control // Layer control
static TOOL_ACTION layerTop; static TOOL_ACTION layerTop;

View File

@ -117,19 +117,6 @@ TOOL_ACTION PCB_ACTIONS::zoneDisplayOutlines( "pcbnew.Control.zoneDisplayOutline
_( "Sketch Zones" ), _( "Outline filled areas of zones" ), _( "Sketch Zones" ), _( "Outline filled areas of zones" ),
show_zone_outline_only_xpm); show_zone_outline_only_xpm);
TOOL_ACTION PCB_ACTIONS::highContrastMode( "pcbnew.Control.highContrastMode",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_HIGHCONTRAST_MODE ),
_( "High Contrast Mode" ), _( "Use high contrast display mode" ),
contrast_mode_xpm );
TOOL_ACTION PCB_ACTIONS::highContrastInc( "pcbnew.Control.highContrastInc",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HIGHCONTRAST_INC ),
"", "" );
TOOL_ACTION PCB_ACTIONS::highContrastDec( "pcbnew.Control.highContrastDec",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HIGHCONTRAST_DEC ),
"", "" );
// Layer control // Layer control
TOOL_ACTION PCB_ACTIONS::layerTop( "pcbnew.Control.layerTop", TOOL_ACTION PCB_ACTIONS::layerTop( "pcbnew.Control.layerTop",
@ -1067,9 +1054,9 @@ void PCBNEW_CONTROL::setTransitions()
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() );
Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() ); Go( &PCBNEW_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastMode, PCB_ACTIONS::highContrastMode.MakeEvent() ); Go( &PCBNEW_CONTROL::HighContrastMode, ACTIONS::highContrastMode.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastInc, PCB_ACTIONS::highContrastInc.MakeEvent() ); Go( &PCBNEW_CONTROL::HighContrastInc, ACTIONS::highContrastInc.MakeEvent() );
Go( &PCBNEW_CONTROL::HighContrastDec, PCB_ACTIONS::highContrastDec.MakeEvent() ); Go( &PCBNEW_CONTROL::HighContrastDec, ACTIONS::highContrastDec.MakeEvent() );
// Layer control // Layer control
Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerTop.MakeEvent() ); Go( &PCBNEW_CONTROL::LayerSwitch, PCB_ACTIONS::layerTop.MakeEvent() );