Commit 51773b3e authored by g_harland's avatar g_harland

A wxStdDialogButtonSizer now provided within the "EESchema Colors" dialog box

parent d5a0a4fd
...@@ -6,6 +6,14 @@ email address. ...@@ -6,6 +6,14 @@ email address.
2007-Nov-11 UPDATE Geoff Harland <gharlandau@yahoo.com.au> 2007-Nov-11 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================ ================================================================================
+ eeschema
* A wxStdDialogButtonSizer is now used within the "EESchema Colors" dialog box,
meaning that the sequence of the "OK", "Cancel", and "Apply" buttons within
that dialog now depends upon which (OS) version of KiCad is being used (and
thus matching the nature of the corresponding dialogs within Pcbnew and GerbView
in that regard). (As of yet, the vertical distance between adjacent controls
does not increase when this dialog is resized, but that aspect will also be
implemented when time permits.)
+ gerbview + gerbview
* The "GerbView Layer Colors:" dialog box has been updated, and is now similar * The "GerbView Layer Colors:" dialog box has been updated, and is now similar
in nature to the corresponding dialogs within EESchema and Pcbnew. Tool tips in nature to the corresponding dialogs within EESchema and Pcbnew. Tool tips
......
...@@ -32,10 +32,9 @@ ...@@ -32,10 +32,9 @@
#include "protos.h" #include "protos.h"
#include "eelayer.h" #include "eelayer.h" // Header file associated with this file
// Local variables: // Local variables:
int CurrentColor[NB_BUTT]; // Holds color for each layer while dialog box open int CurrentColor[NB_BUTT]; // Holds color for each layer while dialog box open
...@@ -114,17 +113,17 @@ bool WinEDA_SetColorsFrame::Create( wxWindow* parent, wxWindowID id, ...@@ -114,17 +113,17 @@ bool WinEDA_SetColorsFrame::Create( wxWindow* parent, wxWindowID id,
void WinEDA_SetColorsFrame::Init() void WinEDA_SetColorsFrame::Init()
/**********************************************************/ /**********************************************************/
{ {
OuterBoxSizer = NULL; OuterBoxSizer = NULL;
MainBoxSizer = NULL; MainBoxSizer = NULL;
ColumnBoxSizer = NULL; ColumnBoxSizer = NULL;
RowBoxSizer = NULL; RowBoxSizer = NULL;
BitmapButton = NULL; Label = NULL;
text = NULL; BitmapButton = NULL;
m_ShowGrid = NULL; m_ShowGrid = NULL;
m_SelBgColor = NULL; m_SelBgColor = NULL;
Line = NULL; Line = NULL;
BottomBoxSizer = NULL; StdDialogButtonSizer = NULL;
Button = NULL; Button = NULL;
} }
...@@ -132,7 +131,7 @@ void WinEDA_SetColorsFrame::Init() ...@@ -132,7 +131,7 @@ void WinEDA_SetColorsFrame::Init()
void WinEDA_SetColorsFrame::CreateControls() void WinEDA_SetColorsFrame::CreateControls()
/**********************************************************/ /**********************************************************/
{ {
int ii, jj, butt_ID, buttcolor; int lyr, grp, butt_ID, buttcolor;
SetFont( *g_DialogFont ); SetFont( *g_DialogFont );
...@@ -144,17 +143,20 @@ void WinEDA_SetColorsFrame::CreateControls() ...@@ -144,17 +143,20 @@ void WinEDA_SetColorsFrame::CreateControls()
// Add various items to the dialog box, as determined by the // Add various items to the dialog box, as determined by the
// details of each element contained within laytool_list[] // details of each element contained within laytool_list[]
for( ii = 0, jj = 0; ii < NB_BUTT; ii++ ) for( lyr = 0, grp = 0; lyr < NB_BUTT; lyr++ )
{ {
// Look for the initial button of each group of controls. // Look for the initial button of each group of controls.
if( ii == laytool_index[jj]->m_Index ) if( lyr == 0 || lyr == laytool_index[grp]->m_Index + 1 )
{ {
// Add another column spacer, unless the current value of if( lyr != 0 )
// jj is BUTTON_GROUPS - 1. (The very last group of controls grp++;
// Add another column sizer, unless the current value of
// grp is BUTTON_GROUPS - 1. (The very last group of controls
// differs from the previous groups in that its associated // differs from the previous groups in that its associated
// controls are located in the same column as the controls // controls are located in the same column as the controls
// associated with the preceeding group.) // associated with the preceeding group.)
if( jj < BUTTON_GROUPS - 1 ) if( grp < BUTTON_GROUPS - 1 )
{ {
ColumnBoxSizer = new wxBoxSizer(wxVERTICAL); ColumnBoxSizer = new wxBoxSizer(wxVERTICAL);
MainBoxSizer->Add(ColumnBoxSizer, 1, wxALIGN_TOP|wxLEFT|wxTOP, 5); MainBoxSizer->Add(ColumnBoxSizer, 1, wxALIGN_TOP|wxLEFT|wxTOP, 5);
...@@ -170,28 +172,26 @@ void WinEDA_SetColorsFrame::CreateControls() ...@@ -170,28 +172,26 @@ void WinEDA_SetColorsFrame::CreateControls()
ColumnBoxSizer->Add(RowBoxSizer, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); ColumnBoxSizer->Add(RowBoxSizer, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
// Add a text string to identify the following set of controls // Add a text string to identify the following set of controls
text = new wxStaticText( this, -1, laytool_index[jj]->m_Name, Label = new wxStaticText( this, -1, laytool_index[grp]->m_Name,
wxDefaultPosition, wxDefaultSize, 0 ); wxDefaultPosition, wxDefaultSize, 0 );
// Make this text string bold (so that it stands out better) // Make this text string bold (so that it stands out better)
text->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxNORMAL_FONT->GetFamily(), Label->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxNORMAL_FONT->GetFamily(),
wxNORMAL, wxBOLD, false, wxNORMAL_FONT->GetFaceName() ) ); wxNORMAL, wxBOLD, false, wxNORMAL_FONT->GetFaceName() ) );
RowBoxSizer->Add(text, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
jj++; RowBoxSizer->Add(Label, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
} }
RowBoxSizer = new wxBoxSizer(wxHORIZONTAL); RowBoxSizer = new wxBoxSizer(wxHORIZONTAL);
ColumnBoxSizer->Add(RowBoxSizer, 0, wxGROW|wxALL, 0); ColumnBoxSizer->Add(RowBoxSizer, 0, wxGROW|wxALL, 0);
butt_ID = ID_COLOR_SETUP + ii; butt_ID = ID_COLOR_SETUP + lyr;
laytool_list[ii]->m_Id = butt_ID; laytool_list[lyr]->m_Id = butt_ID;
wxMemoryDC iconDC; wxMemoryDC iconDC;
wxBitmap ButtBitmap( BUTT_SIZE_X, BUTT_SIZE_Y ); wxBitmap ButtBitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
iconDC.SelectObject( ButtBitmap ); iconDC.SelectObject( ButtBitmap );
buttcolor = *laytool_list[ii]->m_Color; buttcolor = *laytool_list[lyr]->m_Color;
CurrentColor[ii] = buttcolor; CurrentColor[lyr] = buttcolor;
wxBrush Brush; wxBrush Brush;
iconDC.SelectObject( ButtBitmap ); iconDC.SelectObject( ButtBitmap );
iconDC.SetPen( *wxBLACK_PEN ); iconDC.SetPen( *wxBLACK_PEN );
...@@ -208,14 +208,14 @@ void WinEDA_SetColorsFrame::CreateControls() ...@@ -208,14 +208,14 @@ void WinEDA_SetColorsFrame::CreateControls()
BitmapButton = new wxBitmapButton( this, butt_ID, ButtBitmap, wxDefaultPosition, wxSize(BUTT_SIZE_X, BUTT_SIZE_Y) ); BitmapButton = new wxBitmapButton( this, butt_ID, ButtBitmap, wxDefaultPosition, wxSize(BUTT_SIZE_X, BUTT_SIZE_Y) );
RowBoxSizer->Add(BitmapButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxBOTTOM, 5); RowBoxSizer->Add(BitmapButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxBOTTOM, 5);
laytool_list[ii]->m_Button = BitmapButton; laytool_list[lyr]->m_Button = BitmapButton;
// Add a text string, unless the current value of ii is NB_BUTT - 1 // Add a text string, unless the current value of lyr is NB_BUTT - 1
if( ii < NB_BUTT - 1 ) if( lyr < NB_BUTT - 1 )
{ {
text = new wxStaticText( this, wxID_STATIC, wxGetTranslation( laytool_list[ii]->m_Name ), Label = new wxStaticText( this, wxID_STATIC, wxGetTranslation( laytool_list[lyr]->m_Name ),
wxDefaultPosition, wxDefaultSize, 0 ); wxDefaultPosition, wxDefaultSize, 0 );
RowBoxSizer->Add(text, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5); RowBoxSizer->Add(Label, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5);
} }
else else
{ {
...@@ -242,19 +242,24 @@ void WinEDA_SetColorsFrame::CreateControls() ...@@ -242,19 +242,24 @@ void WinEDA_SetColorsFrame::CreateControls()
Line = new wxStaticLine( this, -1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); Line = new wxStaticLine( this, -1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
OuterBoxSizer->Add(Line, 0, wxGROW|wxALL, 5); OuterBoxSizer->Add(Line, 0, wxGROW|wxALL, 5);
BottomBoxSizer = new wxBoxSizer(wxHORIZONTAL); // Provide a StdDialogButtonSizer to accommodate the OK, Cancel, and Apply
OuterBoxSizer->Add(BottomBoxSizer, 0, wxALIGN_RIGHT|wxLEFT|wxRIGHT|wxBOTTOM, 5); // buttons; using that type of sizer results in those buttons being
// automatically located in positions appropriate for each (OS) version of KiCad.
StdDialogButtonSizer = new wxStdDialogButtonSizer;
OuterBoxSizer->Add(StdDialogButtonSizer, 0, wxGROW|wxALL, 10);
Button = new wxButton( this, wxID_OK, _( "OK" ), wxDefaultPosition, wxDefaultSize, 0 ); Button = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
Button->SetForegroundColour( *wxRED ); Button->SetForegroundColour( *wxRED );
BottomBoxSizer->Add(Button, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); StdDialogButtonSizer->AddButton(Button);
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 ); Button = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
Button->SetForegroundColour( *wxBLUE ); Button->SetForegroundColour( *wxBLUE );
BottomBoxSizer->Add(Button, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); StdDialogButtonSizer->AddButton(Button);
Button = new wxButton( this, wxID_APPLY, _( "&Apply" ), wxDefaultPosition, wxDefaultSize, 0 ); Button = new wxButton( this, wxID_APPLY, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 );
BottomBoxSizer->Add(Button, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); StdDialogButtonSizer->AddButton(Button);
StdDialogButtonSizer->Realize();
// (Dialog now needs to be resized, but the associated command is found elsewhere.) // (Dialog now needs to be resized, but the associated command is found elsewhere.)
} }
...@@ -297,6 +302,7 @@ void WinEDA_SetColorsFrame::SetColor( wxCommandEvent& event ) ...@@ -297,6 +302,7 @@ void WinEDA_SetColorsFrame::SetColor( wxCommandEvent& event )
color = DisplayColorFrame( this, color = DisplayColorFrame( this,
CurrentColor[id - ID_COLOR_SETUP] ); CurrentColor[id - ID_COLOR_SETUP] );
if( color < 0 ) if( color < 0 )
return; return;
...@@ -333,10 +339,12 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings() ...@@ -333,10 +339,12 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
/******************************************************************/ /******************************************************************/
{ {
// Update colors for each layer // Update colors for each layer
for( int ii = 0; ii < NB_BUTT; ii++ ) for( int lyr = 0; lyr < NB_BUTT; lyr++ )
{ {
if( laytool_list[ii]->m_Color ) // (As a bitmap button has been provided for *every* layer,
*laytool_list[ii]->m_Color = CurrentColor[ii]; // it is not necessary to check whether it actually has been
// provided for each of those layers.)
*laytool_list[lyr]->m_Color = CurrentColor[lyr];
} }
// Update whether grid is actually displayed or otherwise // Update whether grid is actually displayed or otherwise
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
class wxBoxSizer; class wxBoxSizer;
class wxStaticLine; class wxStaticLine;
class wxStdDialogButtonSizer;
// Specify how many elements are contained within laytool_list[] // Specify how many elements are contained within laytool_list[]
...@@ -58,13 +59,13 @@ struct ColorButton ...@@ -58,13 +59,13 @@ struct ColorButton
int* m_Color; int* m_Color;
int m_Id; int m_Id;
wxBitmapButton* m_Button; wxBitmapButton* m_Button;
// int m_State; // This is not used at present (so commented // int m_State; // (Commented out until when it is actually used.)
}; // out until such a time that it actually is used) };
struct ButtonIndex struct ButtonIndex
{ {
wxString m_Name; wxString m_Name; // Title
int m_Index; int m_Index; // Index to last bitmap button in group
}; };
...@@ -245,25 +246,25 @@ static ColorButton* laytool_list[NB_BUTT] = { ...@@ -245,25 +246,25 @@ static ColorButton* laytool_list[NB_BUTT] = {
static ButtonIndex Msg_General = static ButtonIndex Msg_General =
{ {
_( "General" ), // Title _( "General" ), // Title
0 // Index to first bitmap button in group 7 // Index to first bitmap button in group
}; };
static ButtonIndex MsgDevice_Item = static ButtonIndex MsgDevice_Item =
{ {
_( "Device" ), // Title _( "Device" ), // Title
8 // Index to first bitmap button in group 15 // Index to first bitmap button in group
}; };
static ButtonIndex Msg_Sheets = static ButtonIndex Msg_Sheets =
{ {
_( "Sheets" ), // Title _( "Sheets" ), // Title
16 // Index to first bitmap button in group 19 // Index to first bitmap button in group
}; };
static ButtonIndex Msg_ErcMarck = static ButtonIndex Msg_ErcMarck =
{ {
_( "Erc Mark" ), // Title _( "Erc Mark" ), // Title
20 // Index to first bitmap button in group 21 // Index to first bitmap button in group
}; };
static ButtonIndex Msg_Other = static ButtonIndex Msg_Other =
...@@ -292,18 +293,18 @@ private: ...@@ -292,18 +293,18 @@ private:
DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame ) DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame )
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
WinEDA_DrawFrame* m_Parent; WinEDA_DrawFrame* m_Parent;
wxBoxSizer* OuterBoxSizer; wxBoxSizer* OuterBoxSizer;
wxBoxSizer* MainBoxSizer; wxBoxSizer* MainBoxSizer;
wxBoxSizer* ColumnBoxSizer; wxBoxSizer* ColumnBoxSizer;
wxBoxSizer* RowBoxSizer; wxBoxSizer* RowBoxSizer;
wxBitmapButton* BitmapButton; wxStaticText* Label;
wxStaticText* text; wxBitmapButton* BitmapButton;
wxCheckBox* m_ShowGrid; wxCheckBox* m_ShowGrid;
wxRadioBox* m_SelBgColor; wxRadioBox* m_SelBgColor;
wxStaticLine* Line; wxStaticLine* Line;
wxBoxSizer* BottomBoxSizer; wxStdDialogButtonSizer* StdDialogButtonSizer;
wxButton* Button; wxButton* Button;
// Creation // Creation
bool Create( wxWindow* parent, bool Create( wxWindow* parent,
......
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