Commit f52d03fb authored by dickelbeck's avatar dickelbeck
Browse files

position column titles

parent f69b3844
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -9,6 +9,9 @@ email address.
++pcbnew
++pcbnew
    Renamed dialog_layers_setup* files.
    Renamed dialog_layers_setup* files.
    Got rid of the header file since there was only one file including it.
    Got rid of the header file since there was only one file including it.
    Auto-position the column titles based on flexgridsizer colun widths.
    Added m_TitlePanel with contrasting background color (whose color value may not
    be ideal for all platforms).




2009-Dec-11 UPDATE Dick Hollenbeck <dick@softplc.com>
2009-Dec-11 UPDATE Dick Hollenbeck <dick@softplc.com>
+61 −29
Original line number Original line Diff line number Diff line
@@ -69,7 +69,10 @@ private:


    BOARD*              m_Pcb;
    BOARD*              m_Pcb;


    void init();
    wxStaticText*       m_NameStaticText;
    wxStaticText*       m_EnabledStaticText;
    wxStaticText*       m_TypeStaticText;



    void setLayerCheckBox( int layer, bool isChecked );
    void setLayerCheckBox( int layer, bool isChecked );
    void setCopperLayerCheckBoxes( int copperCount );
    void setCopperLayerCheckBoxes( int copperCount );
@@ -117,6 +120,26 @@ private:
        return (wxChoice*) getCTLs( aLayer ).choice;
        return (wxChoice*) getCTLs( aLayer ).choice;
    }
    }


    void moveTitles()
    {
        wxArrayInt widths = m_LayerListFlexGridSizer->GetColWidths();

        int offset = 0;
        wxSize txtz;

        txtz = m_NameStaticText->GetSize();
//        m_NameStaticText->Move( 0, 5 );
        m_NameStaticText->Move( offset + (widths[0] - txtz.x)/2, 5 );
        offset += widths[0];

        txtz = m_EnabledStaticText->GetSize();
        m_EnabledStaticText->Move( offset + (widths[1] - txtz.x)/2, 5 );
        offset += widths[1];

        txtz = m_TypeStaticText->GetSize();
        m_TypeStaticText->Move( offset + (widths[2] - txtz.x)/2, 5 );
    }



public:
public:
    DIALOG_LAYERS_SETUP( WinEDA_PcbFrame* parent );
    DIALOG_LAYERS_SETUP( WinEDA_PcbFrame* parent );
@@ -124,6 +147,18 @@ public:


    bool Show( bool show );     // overload stock function
    bool Show( bool show );     // overload stock function


    /**
     * Function Layout
     * overrides the standard Layout() function so that the column titles can
     * be positioned using information in the flexgridsizer.
     */
    bool Layout()
    {
        bool ret = DIALOG_LAYERS_SETUP_BASE::Layout();

        moveTitles();
        return ret;
    }
};
};




@@ -214,9 +249,33 @@ DIALOG_LAYERS_SETUP::DIALOG_LAYERS_SETUP( WinEDA_PcbFrame* parent ) :
    m_Parent    = parent;
    m_Parent    = parent;
    m_Pcb       = m_Parent->GetBoard();
    m_Pcb       = m_Parent->GetBoard();


    init();
    m_CopperLayerCount = m_Pcb->GetCopperLayerCount();
    showCopperChoice( m_CopperLayerCount );

    showBoardLayerNames();

    m_EnabledLayers = m_Pcb->GetEnabledLayers();
    showSelectedLayerCheckBoxes( m_EnabledLayers );
    showPresets( m_EnabledLayers );

    showLayerTypes();


    SetAutoLayout( true );
    SetAutoLayout( true );

    // these 3 controls are handled outside wxformbuilder so that we can add
    // them without a sizer.  Then we position them manually based on the column
    // widths from m_LayerListFexGridSizer->GetColWidths()
    m_NameStaticText = new wxStaticText( m_TitlePanel, -1, _("Name"), wxDefaultPosition, wxDefaultSize, 0 );
    m_TitlePanel->AddChild( m_NameStaticText );

    m_EnabledStaticText = new wxStaticText( m_TitlePanel, -1, _("Enabled"), wxDefaultPosition, wxDefaultSize, 0 );
    m_TitlePanel->AddChild( m_NameStaticText );

    m_TypeStaticText = new wxStaticText( m_TitlePanel, -1, _("Type"), wxDefaultPosition, wxDefaultSize, 0 );
    m_TitlePanel->AddChild( m_TypeStaticText );

    m_TitlePanel->SetMinSize( wxSize( -1, m_AdhesFrontName->GetSize().y+10 ) );

    Layout();
    Layout();


    Center();
    Center();
@@ -332,31 +391,6 @@ void DIALOG_LAYERS_SETUP::showLayerTypes()
}
}




/********************************************************************/
void DIALOG_LAYERS_SETUP::init()
/********************************************************************/
{
    m_CopperLayerCount = m_Pcb->GetCopperLayerCount();
    showCopperChoice( m_CopperLayerCount );

    showBoardLayerNames();

    m_EnabledLayers = m_Pcb->GetEnabledLayers();
    showSelectedLayerCheckBoxes( m_EnabledLayers );
    showPresets( m_EnabledLayers );

    showLayerTypes();

    // @todo overload a layout function so we can reposition the column titles,
    // which should probably not go in a sizer of their own so that we do not have
    // to fight to position them, Dick.  Will work this out next.


    // Adjust the vertical scroll rate so our list scrolls always one full line each time.
//    m_LayersListPanel->SetScrollRate( 0, m_textCtrl1[0]->GetSize().y );
}


int DIALOG_LAYERS_SETUP::getUILayerMask()
int DIALOG_LAYERS_SETUP::getUILayerMask()
{
{
    int layerMaskResult = 0;
    int layerMaskResult = 0;
@@ -609,7 +643,6 @@ bool DIALOG_LAYERS_SETUP::testLayerNames()
}
}





void DisplayDialogLayerSetup( WinEDA_PcbFrame* parent )
void DisplayDialogLayerSetup( WinEDA_PcbFrame* parent )
{
{
    DIALOG_LAYERS_SETUP frame( parent );
    DIALOG_LAYERS_SETUP frame( parent );
@@ -617,4 +650,3 @@ void DisplayDialogLayerSetup( WinEDA_PcbFrame* parent )
    frame.ShowModal();
    frame.ShowModal();
    frame.Destroy();
    frame.Destroy();
}
}
+4 −17
Original line number Original line Diff line number Diff line
@@ -49,25 +49,12 @@ DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID
	wxBoxSizer* bCaptionsSizer;
	wxBoxSizer* bCaptionsSizer;
	bCaptionsSizer = new wxBoxSizer( wxHORIZONTAL );
	bCaptionsSizer = new wxBoxSizer( wxHORIZONTAL );
	
	
	m_LayerNameCaption = new wxStaticText( this, wxID_ANY, _("Name"), wxDefaultPosition, wxSize( -1,-1 ), wxALIGN_CENTRE );
	m_TitlePanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER|wxTAB_TRAVERSAL );
	m_LayerNameCaption->Wrap( -1 );
	m_TitlePanel->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVECAPTION ) );
	m_LayerNameCaption->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
	
	
	bCaptionsSizer->Add( m_LayerNameCaption, 0, wxALIGN_CENTER_VERTICAL, 5 );
	bCaptionsSizer->Add( m_TitlePanel, 1, wxEXPAND, 5 );
	
	
	m_LayerEnabledCaption = new wxStaticText( this, wxID_ANY, _("Enabled"), wxDefaultPosition, wxSize( -1,-1 ), wxALIGN_CENTRE );
	sbLayersSizer->Add( bCaptionsSizer, 0, wxALIGN_CENTER|wxEXPAND, 5 );
	m_LayerEnabledCaption->Wrap( -1 );
	m_LayerEnabledCaption->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
	
	bCaptionsSizer->Add( m_LayerEnabledCaption, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
	
	m_LayerTypeCaption = new wxStaticText( this, wxID_ANY, _("Type"), wxDefaultPosition, wxSize( -1,-1 ), wxALIGN_CENTRE );
	m_LayerTypeCaption->Wrap( -1 );
	m_LayerTypeCaption->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
	
	bCaptionsSizer->Add( m_LayerTypeCaption, 0, wxALIGN_CENTER_VERTICAL, 5 );
	
	sbLayersSizer->Add( bCaptionsSizer, 0, wxALIGN_CENTER|wxLEFT|wxRIGHT, 5 );
	
	
	m_LayersListPanel = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxALWAYS_SHOW_SB|wxRAISED_BORDER|wxTAB_TRAVERSAL|wxVSCROLL );
	m_LayersListPanel = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxALWAYS_SHOW_SB|wxRAISED_BORDER|wxTAB_TRAVERSAL|wxVSCROLL );
	m_LayersListPanel->SetScrollRate( 0, 5 );
	m_LayersListPanel->SetScrollRate( 0, 5 );
+9 −114
Original line number Original line Diff line number Diff line
@@ -230,7 +230,7 @@
                        <event name="OnUpdateUI"></event>
                        <event name="OnUpdateUI"></event>
                        <object class="sizeritem" expanded="1">
                        <object class="sizeritem" expanded="1">
                            <property name="border">5</property>
                            <property name="border">5</property>
                            <property name="flag">wxALIGN_CENTER|wxLEFT|wxRIGHT</property>
                            <property name="flag">wxALIGN_CENTER|wxEXPAND</property>
                            <property name="proportion">0</property>
                            <property name="proportion">0</property>
                            <object class="wxBoxSizer" expanded="1">
                            <object class="wxBoxSizer" expanded="1">
                                <property name="minimum_size"></property>
                                <property name="minimum_size"></property>
@@ -239,132 +239,27 @@
                                <property name="permission">none</property>
                                <property name="permission">none</property>
                                <object class="sizeritem" expanded="1">
                                <object class="sizeritem" expanded="1">
                                    <property name="border">5</property>
                                    <property name="border">5</property>
                                    <property name="flag">wxALIGN_CENTER_VERTICAL</property>
                                    <property name="flag">wxEXPAND</property>
                                    <property name="proportion">0</property>
                                    <property name="proportion">1</property>
                                    <object class="wxStaticText" expanded="1">
                                    <object class="wxPanel" expanded="1">
                                        <property name="bg"></property>
                                        <property name="bg">wxSYS_COLOUR_ACTIVECAPTION</property>
                                        <property name="context_help"></property>
                                        <property name="enabled">1</property>
                                        <property name="fg"></property>
                                        <property name="font">,90,92,-1,70,0</property>
                                        <property name="hidden">0</property>
                                        <property name="id">wxID_ANY</property>
                                        <property name="label">Name</property>
                                        <property name="maximum_size"></property>
                                        <property name="minimum_size"></property>
                                        <property name="name">m_LayerNameCaption</property>
                                        <property name="permission">protected</property>
                                        <property name="pos"></property>
                                        <property name="size">-1,-1</property>
                                        <property name="style">wxALIGN_CENTRE</property>
                                        <property name="subclass"></property>
                                        <property name="tooltip"></property>
                                        <property name="window_extra_style"></property>
                                        <property name="window_name"></property>
                                        <property name="window_style"></property>
                                        <property name="wrap">-1</property>
                                        <event name="OnChar"></event>
                                        <event name="OnEnterWindow"></event>
                                        <event name="OnEraseBackground"></event>
                                        <event name="OnKeyDown"></event>
                                        <event name="OnKeyUp"></event>
                                        <event name="OnKillFocus"></event>
                                        <event name="OnLeaveWindow"></event>
                                        <event name="OnLeftDClick"></event>
                                        <event name="OnLeftDown"></event>
                                        <event name="OnLeftUp"></event>
                                        <event name="OnMiddleDClick"></event>
                                        <event name="OnMiddleDown"></event>
                                        <event name="OnMiddleUp"></event>
                                        <event name="OnMotion"></event>
                                        <event name="OnMouseEvents"></event>
                                        <event name="OnMouseWheel"></event>
                                        <event name="OnPaint"></event>
                                        <event name="OnRightDClick"></event>
                                        <event name="OnRightDown"></event>
                                        <event name="OnRightUp"></event>
                                        <event name="OnSetFocus"></event>
                                        <event name="OnSize"></event>
                                        <event name="OnUpdateUI"></event>
                                    </object>
                                </object>
                                <object class="sizeritem" expanded="1">
                                    <property name="border">5</property>
                                    <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
                                    <property name="proportion">0</property>
                                    <object class="wxStaticText" expanded="1">
                                        <property name="bg"></property>
                                        <property name="context_help"></property>
                                        <property name="enabled">1</property>
                                        <property name="fg"></property>
                                        <property name="font">,90,92,-1,70,0</property>
                                        <property name="hidden">0</property>
                                        <property name="id">wxID_ANY</property>
                                        <property name="label">Enabled</property>
                                        <property name="maximum_size"></property>
                                        <property name="minimum_size"></property>
                                        <property name="name">m_LayerEnabledCaption</property>
                                        <property name="permission">protected</property>
                                        <property name="pos"></property>
                                        <property name="size">-1,-1</property>
                                        <property name="style">wxALIGN_CENTRE</property>
                                        <property name="subclass"></property>
                                        <property name="tooltip"></property>
                                        <property name="window_extra_style"></property>
                                        <property name="window_name"></property>
                                        <property name="window_style"></property>
                                        <property name="wrap">-1</property>
                                        <event name="OnChar"></event>
                                        <event name="OnEnterWindow"></event>
                                        <event name="OnEraseBackground"></event>
                                        <event name="OnKeyDown"></event>
                                        <event name="OnKeyUp"></event>
                                        <event name="OnKillFocus"></event>
                                        <event name="OnLeaveWindow"></event>
                                        <event name="OnLeftDClick"></event>
                                        <event name="OnLeftDown"></event>
                                        <event name="OnLeftUp"></event>
                                        <event name="OnMiddleDClick"></event>
                                        <event name="OnMiddleDown"></event>
                                        <event name="OnMiddleUp"></event>
                                        <event name="OnMotion"></event>
                                        <event name="OnMouseEvents"></event>
                                        <event name="OnMouseWheel"></event>
                                        <event name="OnPaint"></event>
                                        <event name="OnRightDClick"></event>
                                        <event name="OnRightDown"></event>
                                        <event name="OnRightUp"></event>
                                        <event name="OnSetFocus"></event>
                                        <event name="OnSize"></event>
                                        <event name="OnUpdateUI"></event>
                                    </object>
                                </object>
                                <object class="sizeritem" expanded="1">
                                    <property name="border">5</property>
                                    <property name="flag">wxALIGN_CENTER_VERTICAL</property>
                                    <property name="proportion">0</property>
                                    <object class="wxStaticText" expanded="1">
                                        <property name="bg"></property>
                                        <property name="context_help"></property>
                                        <property name="context_help"></property>
                                        <property name="enabled">1</property>
                                        <property name="enabled">1</property>
                                        <property name="fg"></property>
                                        <property name="fg"></property>
                                        <property name="font">,90,92,-1,70,0</property>
                                        <property name="font"></property>
                                        <property name="hidden">0</property>
                                        <property name="hidden">0</property>
                                        <property name="id">wxID_ANY</property>
                                        <property name="id">wxID_ANY</property>
                                        <property name="label">Type</property>
                                        <property name="maximum_size"></property>
                                        <property name="maximum_size"></property>
                                        <property name="minimum_size"></property>
                                        <property name="minimum_size"></property>
                                        <property name="name">m_LayerTypeCaption</property>
                                        <property name="name">m_TitlePanel</property>
                                        <property name="permission">protected</property>
                                        <property name="permission">protected</property>
                                        <property name="pos"></property>
                                        <property name="pos"></property>
                                        <property name="size">-1,-1</property>
                                        <property name="size"></property>
                                        <property name="style">wxALIGN_CENTRE</property>
                                        <property name="subclass"></property>
                                        <property name="subclass"></property>
                                        <property name="tooltip"></property>
                                        <property name="tooltip"></property>
                                        <property name="window_extra_style"></property>
                                        <property name="window_extra_style"></property>
                                        <property name="window_name"></property>
                                        <property name="window_name"></property>
                                        <property name="window_style"></property>
                                        <property name="window_style">wxRAISED_BORDER|wxTAB_TRAVERSAL</property>
                                        <property name="wrap">-1</property>
                                        <event name="OnChar"></event>
                                        <event name="OnChar"></event>
                                        <event name="OnEnterWindow"></event>
                                        <event name="OnEnterWindow"></event>
                                        <event name="OnEraseBackground"></event>
                                        <event name="OnEraseBackground"></event>
+2 −4
Original line number Original line Diff line number Diff line
@@ -18,9 +18,9 @@
#include <wx/settings.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/statbox.h>
#include <wx/panel.h>
#include <wx/stattext.h>
#include <wx/stattext.h>
#include <wx/checkbox.h>
#include <wx/checkbox.h>
#include <wx/panel.h>
#include <wx/textctrl.h>
#include <wx/textctrl.h>
#include <wx/scrolwin.h>
#include <wx/scrolwin.h>
#include <wx/button.h>
#include <wx/button.h>
@@ -126,9 +126,7 @@ class DIALOG_LAYERS_SETUP_BASE : public wxDialog
	protected:
	protected:
		wxChoice* m_PresetsChoice;
		wxChoice* m_PresetsChoice;
		wxChoice* m_CopperLayersChoice;
		wxChoice* m_CopperLayersChoice;
		wxStaticText* m_LayerNameCaption;
		wxPanel* m_TitlePanel;
		wxStaticText* m_LayerEnabledCaption;
		wxStaticText* m_LayerTypeCaption;
		wxScrolledWindow* m_LayersListPanel;
		wxScrolledWindow* m_LayersListPanel;
		wxFlexGridSizer* m_LayerListFlexGridSizer;
		wxFlexGridSizer* m_LayerListFlexGridSizer;
		wxStaticText* m_AdhesFrontName;
		wxStaticText* m_AdhesFrontName;