Loading common/class_layer_box_selector.cpp +42 −40 Original line number Original line Diff line number Diff line Loading @@ -11,6 +11,46 @@ #include <class_layer_box_selector.h> #include <class_layer_box_selector.h> LAYER_SELECTOR::LAYER_SELECTOR() { m_layerorder = true; m_layerhotkeys = true; m_hotkeys = NULL; } bool LAYER_SELECTOR::SetLayersOrdered( bool value ) { m_layerorder = value; return m_layerorder; } bool LAYER_SELECTOR::SetLayersHotkeys( bool value ) { m_layerhotkeys = value; return m_layerhotkeys; } void LAYER_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer ) { wxMemoryDC bmpDC; wxBrush brush; // Prepare Bitmap bmpDC.SelectObject( aLayerbmp ); brush.SetColour( MakeColour( GetLayerColor( aLayer ) ) ); brush.SetStyle( wxSOLID ); bmpDC.SetBrush( brush ); bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() ); bmpDC.SetBrush( *wxTRANSPARENT_BRUSH ); bmpDC.SetPen( *wxBLACK_PEN ); bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() ); } /* class to display a layer list. /* class to display a layer list. * * */ */ Loading @@ -18,12 +58,9 @@ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size, int n, const wxString choices[] ) : int n, const wxString choices[] ) : LAYER_SELECTOR(), wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ) wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ) { { m_layerorder = true; m_layerhotkeys = true; m_hotkeys = NULL; if( choices != NULL ) if( choices != NULL ) ResyncBitmapOnly(); ResyncBitmapOnly(); } } Loading @@ -32,31 +69,14 @@ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size, const wxArrayString& choices ) : const wxArrayString& choices ) : LAYER_SELECTOR(), wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ) wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ) { { m_layerorder = true; m_layerhotkeys = true; m_hotkeys = NULL; if( !choices.IsEmpty() ) if( !choices.IsEmpty() ) ResyncBitmapOnly(); ResyncBitmapOnly(); } } bool LAYER_BOX_SELECTOR::SetLayersOrdered( bool value ) { m_layerorder = value; return m_layerorder; } bool LAYER_BOX_SELECTOR::SetLayersHotkeys( bool value ) { m_layerhotkeys = value; return m_layerhotkeys; } // Get Current Item # // Get Current Item # int LAYER_BOX_SELECTOR::GetChoice() int LAYER_BOX_SELECTOR::GetChoice() { { Loading Loading @@ -104,21 +124,3 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly() SetBitmapLayer( layerbmp, i ); SetBitmapLayer( layerbmp, i ); } } } } void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer ) { wxMemoryDC bmpDC; wxBrush brush; // Prepare Bitmap bmpDC.SelectObject( aLayerbmp ); brush.SetColour( MakeColour( GetLayerColor( aLayer ) ) ); brush.SetStyle( wxSOLID ); bmpDC.SetBrush( brush ); bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() ); bmpDC.SetBrush( *wxTRANSPARENT_BRUSH ); bmpDC.SetPen( *wxBLACK_PEN ); bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() ); } include/class_layer_box_selector.h +32 −20 Original line number Original line Diff line number Diff line Loading @@ -9,11 +9,11 @@ class wxAuiToolBar; class wxAuiToolBar; /* class to display a layer list. /* Basic class to build a layer list. * * this is an basic abstract class to build a layer list selector. * To display this list, you should therefore derive this class */ */ class LAYER_SELECTOR class LAYER_BOX_SELECTOR : public wxBitmapComboBox { { protected: protected: bool m_layerhotkeys; bool m_layerhotkeys; Loading @@ -24,14 +24,7 @@ public: struct EDA_HOTKEY_CONFIG* m_hotkeys; struct EDA_HOTKEY_CONFIG* m_hotkeys; public: public: LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, LAYER_SELECTOR(); const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL ); LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices ); // Returns a color index from the layer id // Returns a color index from the layer id // Virtual function because GerbView uses its own functions in a derived class // Virtual function because GerbView uses its own functions in a derived class Loading @@ -45,6 +38,32 @@ public: // Virtual function pure because GerbView uses its own functions in a derived class // Virtual function pure because GerbView uses its own functions in a derived class virtual bool IsLayerEnabled( LAYER_NUM aLayer ) const = 0; virtual bool IsLayerEnabled( LAYER_NUM aLayer ) const = 0; bool SetLayersOrdered(bool value); bool SetLayersHotkeys(bool value); protected: // Fills the layer bitmap aLayerbmp with the layer color void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer ); }; /* class to display a layer list in a wxBitmapComboBox. */ class LAYER_BOX_SELECTOR : public LAYER_SELECTOR, public wxBitmapComboBox { public: // Hotkey Info struct EDA_HOTKEY_CONFIG* m_hotkeys; public: LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL ); LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices ); // Get Current Item # // Get Current Item # int GetChoice(); int GetChoice(); Loading @@ -60,13 +79,6 @@ public: // Reload the Layers bitmaps colors // Reload the Layers bitmaps colors void ResyncBitmapOnly(); void ResyncBitmapOnly(); bool SetLayersOrdered(bool value); bool SetLayersHotkeys(bool value); protected: // Fills the layer bitmap aLayerbmp with the layer color void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer ); }; }; #define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \ #define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \ Loading pagelayout_editor/files.cpp +7 −2 Original line number Original line Diff line number Diff line Loading @@ -186,9 +186,14 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) filename = openFileDialog.GetPath(); filename = openFileDialog.GetPath(); // Ensure the file has the right extension: // Ensure the file has the right extension: // because a name like name.subname.subsubname is legal, // add the right extension without replacing the wxFileName // extension wxFileName fn(filename); wxFileName fn(filename); fn.SetExt( PageLayoutDescrFileExtension ); filename = fn.GetFullPath(); if( fn.GetExt() != PageLayoutDescrFileExtension ) filename << wxT(".") << PageLayoutDescrFileExtension; if( !SavePageLayoutDescrFile( filename ) ) if( !SavePageLayoutDescrFile( filename ) ) { { wxString msg; wxString msg; Loading pcbnew/CMakeLists.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -76,6 +76,7 @@ set( PCBNEW_DIALOGS dialogs/dialog_global_deletion_base.cpp dialogs/dialog_global_deletion_base.cpp dialogs/dialog_keepout_area_properties.cpp dialogs/dialog_keepout_area_properties.cpp dialogs/dialog_keepout_area_properties_base.cpp dialogs/dialog_keepout_area_properties_base.cpp dialogs/dialog_layer_selection_base.cpp dialogs/dialog_layers_setup.cpp dialogs/dialog_layers_setup.cpp dialogs/dialog_layers_setup_base.cpp dialogs/dialog_layers_setup_base.cpp dialogs/dialog_netlist.cpp dialogs/dialog_netlist.cpp Loading pcbnew/edit.cpp +8 −0 Original line number Original line Diff line number Diff line Loading @@ -925,7 +925,15 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) itmp = SelectLayer( getActiveLayer(), UNDEFINED_LAYER, UNDEFINED_LAYER ); itmp = SelectLayer( getActiveLayer(), UNDEFINED_LAYER, UNDEFINED_LAYER ); if( itmp >= 0 ) if( itmp >= 0 ) { // if user changed colors and we are in high contrast mode, then redraw // because the PAD_SMD pads may change color. if( DisplayOpt.ContrastModeDisplay && getActiveLayer() != itmp ) { m_canvas->Refresh(); } setActiveLayer( itmp ); setActiveLayer( itmp ); } m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair(); break; break; Loading Loading
common/class_layer_box_selector.cpp +42 −40 Original line number Original line Diff line number Diff line Loading @@ -11,6 +11,46 @@ #include <class_layer_box_selector.h> #include <class_layer_box_selector.h> LAYER_SELECTOR::LAYER_SELECTOR() { m_layerorder = true; m_layerhotkeys = true; m_hotkeys = NULL; } bool LAYER_SELECTOR::SetLayersOrdered( bool value ) { m_layerorder = value; return m_layerorder; } bool LAYER_SELECTOR::SetLayersHotkeys( bool value ) { m_layerhotkeys = value; return m_layerhotkeys; } void LAYER_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer ) { wxMemoryDC bmpDC; wxBrush brush; // Prepare Bitmap bmpDC.SelectObject( aLayerbmp ); brush.SetColour( MakeColour( GetLayerColor( aLayer ) ) ); brush.SetStyle( wxSOLID ); bmpDC.SetBrush( brush ); bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() ); bmpDC.SetBrush( *wxTRANSPARENT_BRUSH ); bmpDC.SetPen( *wxBLACK_PEN ); bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() ); } /* class to display a layer list. /* class to display a layer list. * * */ */ Loading @@ -18,12 +58,9 @@ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size, int n, const wxString choices[] ) : int n, const wxString choices[] ) : LAYER_SELECTOR(), wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ) wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ) { { m_layerorder = true; m_layerhotkeys = true; m_hotkeys = NULL; if( choices != NULL ) if( choices != NULL ) ResyncBitmapOnly(); ResyncBitmapOnly(); } } Loading @@ -32,31 +69,14 @@ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size, const wxArrayString& choices ) : const wxArrayString& choices ) : LAYER_SELECTOR(), wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ) wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ) { { m_layerorder = true; m_layerhotkeys = true; m_hotkeys = NULL; if( !choices.IsEmpty() ) if( !choices.IsEmpty() ) ResyncBitmapOnly(); ResyncBitmapOnly(); } } bool LAYER_BOX_SELECTOR::SetLayersOrdered( bool value ) { m_layerorder = value; return m_layerorder; } bool LAYER_BOX_SELECTOR::SetLayersHotkeys( bool value ) { m_layerhotkeys = value; return m_layerhotkeys; } // Get Current Item # // Get Current Item # int LAYER_BOX_SELECTOR::GetChoice() int LAYER_BOX_SELECTOR::GetChoice() { { Loading Loading @@ -104,21 +124,3 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly() SetBitmapLayer( layerbmp, i ); SetBitmapLayer( layerbmp, i ); } } } } void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer ) { wxMemoryDC bmpDC; wxBrush brush; // Prepare Bitmap bmpDC.SelectObject( aLayerbmp ); brush.SetColour( MakeColour( GetLayerColor( aLayer ) ) ); brush.SetStyle( wxSOLID ); bmpDC.SetBrush( brush ); bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() ); bmpDC.SetBrush( *wxTRANSPARENT_BRUSH ); bmpDC.SetPen( *wxBLACK_PEN ); bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() ); }
include/class_layer_box_selector.h +32 −20 Original line number Original line Diff line number Diff line Loading @@ -9,11 +9,11 @@ class wxAuiToolBar; class wxAuiToolBar; /* class to display a layer list. /* Basic class to build a layer list. * * this is an basic abstract class to build a layer list selector. * To display this list, you should therefore derive this class */ */ class LAYER_SELECTOR class LAYER_BOX_SELECTOR : public wxBitmapComboBox { { protected: protected: bool m_layerhotkeys; bool m_layerhotkeys; Loading @@ -24,14 +24,7 @@ public: struct EDA_HOTKEY_CONFIG* m_hotkeys; struct EDA_HOTKEY_CONFIG* m_hotkeys; public: public: LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, LAYER_SELECTOR(); const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL ); LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices ); // Returns a color index from the layer id // Returns a color index from the layer id // Virtual function because GerbView uses its own functions in a derived class // Virtual function because GerbView uses its own functions in a derived class Loading @@ -45,6 +38,32 @@ public: // Virtual function pure because GerbView uses its own functions in a derived class // Virtual function pure because GerbView uses its own functions in a derived class virtual bool IsLayerEnabled( LAYER_NUM aLayer ) const = 0; virtual bool IsLayerEnabled( LAYER_NUM aLayer ) const = 0; bool SetLayersOrdered(bool value); bool SetLayersHotkeys(bool value); protected: // Fills the layer bitmap aLayerbmp with the layer color void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer ); }; /* class to display a layer list in a wxBitmapComboBox. */ class LAYER_BOX_SELECTOR : public LAYER_SELECTOR, public wxBitmapComboBox { public: // Hotkey Info struct EDA_HOTKEY_CONFIG* m_hotkeys; public: LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL ); LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices ); // Get Current Item # // Get Current Item # int GetChoice(); int GetChoice(); Loading @@ -60,13 +79,6 @@ public: // Reload the Layers bitmaps colors // Reload the Layers bitmaps colors void ResyncBitmapOnly(); void ResyncBitmapOnly(); bool SetLayersOrdered(bool value); bool SetLayersHotkeys(bool value); protected: // Fills the layer bitmap aLayerbmp with the layer color void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer ); }; }; #define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \ #define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \ Loading
pagelayout_editor/files.cpp +7 −2 Original line number Original line Diff line number Diff line Loading @@ -186,9 +186,14 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event ) filename = openFileDialog.GetPath(); filename = openFileDialog.GetPath(); // Ensure the file has the right extension: // Ensure the file has the right extension: // because a name like name.subname.subsubname is legal, // add the right extension without replacing the wxFileName // extension wxFileName fn(filename); wxFileName fn(filename); fn.SetExt( PageLayoutDescrFileExtension ); filename = fn.GetFullPath(); if( fn.GetExt() != PageLayoutDescrFileExtension ) filename << wxT(".") << PageLayoutDescrFileExtension; if( !SavePageLayoutDescrFile( filename ) ) if( !SavePageLayoutDescrFile( filename ) ) { { wxString msg; wxString msg; Loading
pcbnew/CMakeLists.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -76,6 +76,7 @@ set( PCBNEW_DIALOGS dialogs/dialog_global_deletion_base.cpp dialogs/dialog_global_deletion_base.cpp dialogs/dialog_keepout_area_properties.cpp dialogs/dialog_keepout_area_properties.cpp dialogs/dialog_keepout_area_properties_base.cpp dialogs/dialog_keepout_area_properties_base.cpp dialogs/dialog_layer_selection_base.cpp dialogs/dialog_layers_setup.cpp dialogs/dialog_layers_setup.cpp dialogs/dialog_layers_setup_base.cpp dialogs/dialog_layers_setup_base.cpp dialogs/dialog_netlist.cpp dialogs/dialog_netlist.cpp Loading
pcbnew/edit.cpp +8 −0 Original line number Original line Diff line number Diff line Loading @@ -925,7 +925,15 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) itmp = SelectLayer( getActiveLayer(), UNDEFINED_LAYER, UNDEFINED_LAYER ); itmp = SelectLayer( getActiveLayer(), UNDEFINED_LAYER, UNDEFINED_LAYER ); if( itmp >= 0 ) if( itmp >= 0 ) { // if user changed colors and we are in high contrast mode, then redraw // because the PAD_SMD pads may change color. if( DisplayOpt.ContrastModeDisplay && getActiveLayer() != itmp ) { m_canvas->Refresh(); } setActiveLayer( itmp ); setActiveLayer( itmp ); } m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair(); break; break; Loading