Commit f52d03fb authored by dickelbeck's avatar dickelbeck

position column titles

parent f69b3844
......@@ -9,6 +9,9 @@ email address.
++pcbnew
Renamed dialog_layers_setup* files.
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>
......
......@@ -69,7 +69,10 @@ private:
BOARD* m_Pcb;
void init();
wxStaticText* m_NameStaticText;
wxStaticText* m_EnabledStaticText;
wxStaticText* m_TypeStaticText;
void setLayerCheckBox( int layer, bool isChecked );
void setCopperLayerCheckBoxes( int copperCount );
......@@ -117,6 +120,26 @@ private:
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:
DIALOG_LAYERS_SETUP( WinEDA_PcbFrame* parent );
......@@ -124,6 +147,18 @@ public:
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_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 );
// 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();
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 layerMaskResult = 0;
......@@ -609,7 +643,6 @@ bool DIALOG_LAYERS_SETUP::testLayerNames()
}
void DisplayDialogLayerSetup( WinEDA_PcbFrame* parent )
{
DIALOG_LAYERS_SETUP frame( parent );
......@@ -617,4 +650,3 @@ void DisplayDialogLayerSetup( WinEDA_PcbFrame* parent )
frame.ShowModal();
frame.Destroy();
}
......@@ -49,25 +49,12 @@ DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* bCaptionsSizer;
bCaptionsSizer = new wxBoxSizer( wxHORIZONTAL );
m_LayerNameCaption = new wxStaticText( this, wxID_ANY, _("Name"), wxDefaultPosition, wxSize( -1,-1 ), wxALIGN_CENTRE );
m_LayerNameCaption->Wrap( -1 );
m_LayerNameCaption->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
m_TitlePanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxRAISED_BORDER|wxTAB_TRAVERSAL );
m_TitlePanel->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_ACTIVECAPTION ) );
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 );
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 );
sbLayersSizer->Add( bCaptionsSizer, 0, wxALIGN_CENTER|wxEXPAND, 5 );
m_LayersListPanel = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxALWAYS_SHOW_SB|wxRAISED_BORDER|wxTAB_TRAVERSAL|wxVSCROLL );
m_LayersListPanel->SetScrollRate( 0, 5 );
......
This diff is collapsed.
......@@ -18,9 +18,9 @@
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/panel.h>
#include <wx/stattext.h>
#include <wx/checkbox.h>
#include <wx/panel.h>
#include <wx/textctrl.h>
#include <wx/scrolwin.h>
#include <wx/button.h>
......@@ -126,9 +126,7 @@ class DIALOG_LAYERS_SETUP_BASE : public wxDialog
protected:
wxChoice* m_PresetsChoice;
wxChoice* m_CopperLayersChoice;
wxStaticText* m_LayerNameCaption;
wxStaticText* m_LayerEnabledCaption;
wxStaticText* m_LayerTypeCaption;
wxPanel* m_TitlePanel;
wxScrolledWindow* m_LayersListPanel;
wxFlexGridSizer* m_LayerListFlexGridSizer;
wxStaticText* m_AdhesFrontName;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment