Loading common/class_layer_box_selector.cpp +44 −43 Original line number Original line Diff line number Diff line Loading @@ -7,53 +7,72 @@ #include <wx/wx.h> #include <wx/wx.h> #include <wx/ownerdrw.h> #include <wx/ownerdrw.h> #include <wx/menuitem.h> #include <wx/menuitem.h> #include <wx/aui/aui.h> #include <class_layer_box_selector.h> #include <class_layer_box_selector.h> /* class to display a layer list. * */ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, LAYER_SELECTOR::LAYER_SELECTOR() const wxPoint& pos, const wxSize& size, int n, const wxString choices[] ) : wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ) { { m_layerorder = true; m_layerorder = true; m_layerhotkeys = true; m_layerhotkeys = true; m_hotkeys = NULL; m_hotkeys = NULL; } if( choices != NULL ) ResyncBitmapOnly(); bool LAYER_SELECTOR::SetLayersOrdered( bool value ) { m_layerorder = value; return m_layerorder; } } LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, bool LAYER_SELECTOR::SetLayersHotkeys( bool value ) const wxPoint& pos, const wxSize& size, const wxArrayString& choices ) : wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ) { { m_layerorder = true; m_layerhotkeys = value; m_layerhotkeys = true; return m_layerhotkeys; m_hotkeys = NULL; } if( !choices.IsEmpty() ) ResyncBitmapOnly(); 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. * */ bool LAYER_BOX_SELECTOR::SetLayersOrdered( bool value ) LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[] ) : LAYER_SELECTOR(), wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ) { { m_layerorder = value; if( choices != NULL ) return m_layerorder; ResyncBitmapOnly(); } } bool LAYER_BOX_SELECTOR::SetLayersHotkeys( bool value ) LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices ) : LAYER_SELECTOR(), wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ) { { m_layerhotkeys = value; if( !choices.IsEmpty() ) return m_layerhotkeys; ResyncBitmapOnly(); } } Loading Loading @@ -104,21 +123,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() ); } gerbview/class_gbr_layer_box_selector.cpp +0 −6 Original line number Original line Diff line number Diff line Loading @@ -32,14 +32,8 @@ #include <common.h> #include <common.h> #include <colors_selection.h> #include <colors_selection.h> #include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h> #include <gerbview_frame.h> #include <gerbview_frame.h> #include <wx/ownerdrw.h> #include <wx/menuitem.h> #include <wx/bmpcbox.h> #include <wx/wx.h> #include <class_gbr_layer_box_selector.h> #include <class_gbr_layer_box_selector.h> void GBR_LAYER_BOX_SELECTOR::Resync() void GBR_LAYER_BOX_SELECTOR::Resync() Loading gerbview/class_gbr_layer_box_selector.h +2 −15 Original line number Original line Diff line number Diff line Loading @@ -4,14 +4,11 @@ #include <class_layer_box_selector.h> #include <class_layer_box_selector.h> /* class to display a layer list in GerbView. // class to display a layer list in GerbView. * */ class GBR_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR class GBR_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR { { public: public: GBR_LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, GBR_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL ) int n = 0, const wxString choices[] = NULL ) Loading @@ -21,16 +18,6 @@ public: m_layerorder = false; m_layerorder = false; } } GBR_LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices ) :LAYER_BOX_SELECTOR( parent, id, pos, size, choices ) { m_layerhotkeys = false; m_layerorder = false; } // Reload the Layers names and bitmaps // Reload the Layers names and bitmaps // Virtual function // Virtual function void Resync(); void Resync(); Loading include/class_layer_box_selector.h +34 −24 Original line number Original line Diff line number Diff line #ifndef CLASS_LAYER_BOX_SELECTOR_H #ifndef CLASS_LAYER_BOX_SELECTOR_H #define CLASS_LAYER_BOX_SELECTOR_H 1 #define CLASS_LAYER_BOX_SELECTOR_H 1 #include <hotkeys_basic.h> #include <wx/bmpcbox.h> #include <wx/bmpcbox.h> #include <colors.h> // EDA_COLOR_T definition #include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h> class EDA_HOTKEY_CONFIG; class wxAuiToolBar; /* 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 to display a layer list. * */ */ class LAYER_SELECTOR class LAYER_BOX_SELECTOR : public wxBitmapComboBox { { protected: protected: bool m_layerhotkeys; bool m_layerhotkeys; Loading @@ -24,14 +22,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 +36,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( wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL ); LAYER_BOX_SELECTOR( wxWindow* 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 +77,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 Loading
common/class_layer_box_selector.cpp +44 −43 Original line number Original line Diff line number Diff line Loading @@ -7,53 +7,72 @@ #include <wx/wx.h> #include <wx/wx.h> #include <wx/ownerdrw.h> #include <wx/ownerdrw.h> #include <wx/menuitem.h> #include <wx/menuitem.h> #include <wx/aui/aui.h> #include <class_layer_box_selector.h> #include <class_layer_box_selector.h> /* class to display a layer list. * */ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, LAYER_SELECTOR::LAYER_SELECTOR() const wxPoint& pos, const wxSize& size, int n, const wxString choices[] ) : wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ) { { m_layerorder = true; m_layerorder = true; m_layerhotkeys = true; m_layerhotkeys = true; m_hotkeys = NULL; m_hotkeys = NULL; } if( choices != NULL ) ResyncBitmapOnly(); bool LAYER_SELECTOR::SetLayersOrdered( bool value ) { m_layerorder = value; return m_layerorder; } } LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, bool LAYER_SELECTOR::SetLayersHotkeys( bool value ) const wxPoint& pos, const wxSize& size, const wxArrayString& choices ) : wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ) { { m_layerorder = true; m_layerhotkeys = value; m_layerhotkeys = true; return m_layerhotkeys; m_hotkeys = NULL; } if( !choices.IsEmpty() ) ResyncBitmapOnly(); 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. * */ bool LAYER_BOX_SELECTOR::SetLayersOrdered( bool value ) LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[] ) : LAYER_SELECTOR(), wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ) { { m_layerorder = value; if( choices != NULL ) return m_layerorder; ResyncBitmapOnly(); } } bool LAYER_BOX_SELECTOR::SetLayersHotkeys( bool value ) LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices ) : LAYER_SELECTOR(), wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ) { { m_layerhotkeys = value; if( !choices.IsEmpty() ) return m_layerhotkeys; ResyncBitmapOnly(); } } Loading Loading @@ -104,21 +123,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() ); }
gerbview/class_gbr_layer_box_selector.cpp +0 −6 Original line number Original line Diff line number Diff line Loading @@ -32,14 +32,8 @@ #include <common.h> #include <common.h> #include <colors_selection.h> #include <colors_selection.h> #include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h> #include <gerbview_frame.h> #include <gerbview_frame.h> #include <wx/ownerdrw.h> #include <wx/menuitem.h> #include <wx/bmpcbox.h> #include <wx/wx.h> #include <class_gbr_layer_box_selector.h> #include <class_gbr_layer_box_selector.h> void GBR_LAYER_BOX_SELECTOR::Resync() void GBR_LAYER_BOX_SELECTOR::Resync() Loading
gerbview/class_gbr_layer_box_selector.h +2 −15 Original line number Original line Diff line number Diff line Loading @@ -4,14 +4,11 @@ #include <class_layer_box_selector.h> #include <class_layer_box_selector.h> /* class to display a layer list in GerbView. // class to display a layer list in GerbView. * */ class GBR_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR class GBR_LAYER_BOX_SELECTOR : public LAYER_BOX_SELECTOR { { public: public: GBR_LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, GBR_LAYER_BOX_SELECTOR( wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL ) int n = 0, const wxString choices[] = NULL ) Loading @@ -21,16 +18,6 @@ public: m_layerorder = false; m_layerorder = false; } } GBR_LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices ) :LAYER_BOX_SELECTOR( parent, id, pos, size, choices ) { m_layerhotkeys = false; m_layerorder = false; } // Reload the Layers names and bitmaps // Reload the Layers names and bitmaps // Virtual function // Virtual function void Resync(); void Resync(); Loading
include/class_layer_box_selector.h +34 −24 Original line number Original line Diff line number Diff line #ifndef CLASS_LAYER_BOX_SELECTOR_H #ifndef CLASS_LAYER_BOX_SELECTOR_H #define CLASS_LAYER_BOX_SELECTOR_H 1 #define CLASS_LAYER_BOX_SELECTOR_H 1 #include <hotkeys_basic.h> #include <wx/bmpcbox.h> #include <wx/bmpcbox.h> #include <colors.h> // EDA_COLOR_T definition #include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h> class EDA_HOTKEY_CONFIG; class wxAuiToolBar; /* 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 to display a layer list. * */ */ class LAYER_SELECTOR class LAYER_BOX_SELECTOR : public wxBitmapComboBox { { protected: protected: bool m_layerhotkeys; bool m_layerhotkeys; Loading @@ -24,14 +22,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 +36,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( wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL ); LAYER_BOX_SELECTOR( wxWindow* 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 +77,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