diff --git a/change_log.txt b/change_log.txt index 65fb4c578b..22d0d8598c 100644 --- a/change_log.txt +++ b/change_log.txt @@ -4,6 +4,14 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2007-Nov-11 UPDATE Geoff Harland +================================================================================ ++ gerbview + * 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 + have also been provided for the "Show All" and "Show None" buttons. + + 2007-Nov-10 UPDATE Jean-Pierre Charras ================================================================================ +eeschema: diff --git a/gerbview/set_color.cpp b/gerbview/set_color.cpp index 53fea7e719..4862792287 100644 --- a/gerbview/set_color.cpp +++ b/gerbview/set_color.cpp @@ -1,4 +1,24 @@ - /* Set up the basic primitives for Layer control */ +/*****************/ +/* set_color.cpp */ +/*****************/ + +/*Set up the items and layer colors and show/no show options + */ + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma implementation "set_color.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif #include "fctsys.h" #include "gr_basic.h" @@ -9,256 +29,339 @@ #include "protos.h" -/* Variables locales */ -const int BUTT_SIZE_X = 20; -const int BUTT_SIZE_Y = 16; +#include "set_color.h" // Header file associated with this file -const int COLOR_COUNT = 37; // 37 = 32 (layers) + 2 (others) + 3 (headings) - // Is there a better way to determine how many elements CurrentColor requires? -int CurrentColor[COLOR_COUNT]; // Holds color for each layer while dialog box open - -/* Fonctions locales: */ - -/* Macro utile : */ -#define ADR(numlayer) &g_DesignSettings.m_LayerColor[(numlayer)] - -enum col_sel_id { - ID_COLOR_RESET_SHOW_LAYER_ON = 1800, - ID_COLOR_RESET_SHOW_LAYER_OFF, - ID_COLOR_CHECKBOX_ONOFF, - ID_COLOR_SETUP -}; +// Local variables: +int CurrentColor[NB_BUTT]; // Holds color for each layer while dialog box open - /**********************************/ - /* Liste des menus de Menu_Layers */ - /**********************************/ -struct ColorButton - { - wxString m_Name; - int * m_Color; // Pointeur sur la variable couleur - bool m_NoDisplayIsColor; // TRUE si bit ITEM_NON_VISIBLE de la variable Color - bool * m_NoDisplay; // Pointeur sur la variable Display on/off si ce - // n'est pas la var Color - int m_Id; - wxBitmapButton * m_Button; // Button to display/change color assigned to this layer - int m_State; - wxCheckBox * m_CheckBox; // Option Display ON/OFF -}; +IMPLEMENT_DYNAMIC_CLASS( WinEDA_SetColorsFrame, wxDialog ) -#include "set_color.h" /* include description and list of tools and buttons */ - - -/*************************************************************/ -/* classe derivee pour la frame de Configuration des couleurs*/ -/*************************************************************/ - -class WinEDA_SetColorsFrame: public wxDialog -{ -private: - WinEDA_DrawFrame *m_Parent; - -public: - - // Constructor and destructor - WinEDA_SetColorsFrame(WinEDA_DrawFrame *parent, const wxPoint& framepos); - ~WinEDA_SetColorsFrame() {}; - -private: - void SetColor( wxCommandEvent& event ); - void OnOkClick( wxCommandEvent& event ); - void OnCancelClick( wxCommandEvent& event ); - void OnApplyClick( wxCommandEvent& event ); - void UpdateLayerSettings(); - void ResetDisplayLayersCu( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE() -}; - - -/* Table des evenements pour WinEDA_SetColorsFrame */ +// Table of events for WinEDA_SetColorsFrame BEGIN_EVENT_TABLE( WinEDA_SetColorsFrame, wxDialog ) - EVT_BUTTON( ID_COLOR_RESET_SHOW_LAYER_OFF, WinEDA_SetColorsFrame::ResetDisplayLayersCu ) - EVT_BUTTON( ID_COLOR_RESET_SHOW_LAYER_ON, WinEDA_SetColorsFrame::ResetDisplayLayersCu ) - EVT_BUTTON( wxID_OK, WinEDA_SetColorsFrame::OnOkClick ) - EVT_BUTTON( wxID_CANCEL, WinEDA_SetColorsFrame::OnCancelClick ) - EVT_BUTTON( wxID_APPLY, WinEDA_SetColorsFrame::OnApplyClick ) - EVT_BUTTON( ID_COLOR_SETUP, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 1, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 2, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 3, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 4, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 5, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 6, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 7, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 8, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 9, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 10, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 11, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 12, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 13, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 14, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 15, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 16, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 17, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 18, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 19, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 20, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 21, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 22, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 23, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 24, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 25, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 26, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 27, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 28, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 29, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 30, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 31, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 32, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 33, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 34, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 35, WinEDA_SetColorsFrame::SetColor ) - EVT_BUTTON( ID_COLOR_SETUP + 36, WinEDA_SetColorsFrame::SetColor ) -// EVT_BUTTON( ID_COLOR_SETUP + 37, WinEDA_SetColorsFrame::SetColor ) -// EVT_BUTTON( ID_COLOR_SETUP + 38, WinEDA_SetColorsFrame::SetColor ) -// EVT_BUTTON( ID_COLOR_SETUP + 39, WinEDA_SetColorsFrame::SetColor ) -// EVT_BUTTON( ID_COLOR_SETUP + 40, WinEDA_SetColorsFrame::SetColor ) -// EVT_BUTTON( ID_COLOR_SETUP + 41, WinEDA_SetColorsFrame::SetColor ) -// EVT_BUTTON( ID_COLOR_SETUP + 42, WinEDA_SetColorsFrame::SetColor ) -// EVT_BUTTON( ID_COLOR_SETUP + 43, WinEDA_SetColorsFrame::SetColor ) -// EVT_BUTTON( ID_COLOR_SETUP + 44, WinEDA_SetColorsFrame::SetColor ) + EVT_BUTTON( ID_COLOR_RESET_SHOW_LAYER_OFF, WinEDA_SetColorsFrame::ResetDisplayLayersCu ) + EVT_BUTTON( ID_COLOR_RESET_SHOW_LAYER_ON, WinEDA_SetColorsFrame::ResetDisplayLayersCu ) + EVT_COMMAND_RANGE( ID_COLOR_SETUP, ID_COLOR_SETUP + NB_BUTT - 1, + wxEVT_COMMAND_BUTTON_CLICKED, + WinEDA_SetColorsFrame::SetColor ) + EVT_BUTTON( wxID_OK, WinEDA_SetColorsFrame::OnOkClick ) + EVT_BUTTON( wxID_CANCEL, WinEDA_SetColorsFrame::OnCancelClick ) + EVT_BUTTON( wxID_APPLY, WinEDA_SetColorsFrame::OnApplyClick ) END_EVENT_TABLE() -/**************************************************************/ -/* void DisplayColorSetupFrame(WinEDA_DrawFrame * parent, */ -/* const wxPoint & pos) */ -/**************************************************************/ -void DisplayColorSetupFrame(WinEDA_DrawFrame * parent, - const wxPoint & framepos) +/*****************************************************/ +void DisplayColorSetupFrame( WinEDA_DrawFrame* parent, + const wxPoint& framepos ) +/*****************************************************/ { - WinEDA_SetColorsFrame * frame = - new WinEDA_SetColorsFrame(parent, framepos); - frame->ShowModal(); - frame->Destroy(); + WinEDA_SetColorsFrame* frame = + new WinEDA_SetColorsFrame( parent, framepos ); + + frame->ShowModal(); + frame->Destroy(); } -/**********************************************************************/ -WinEDA_SetColorsFrame::WinEDA_SetColorsFrame(WinEDA_DrawFrame *parent, - const wxPoint& framepos): - wxDialog(parent, -1, _("GerbView Layer Colors:"), framepos, - wxSize(390, 380), - wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT| - MAYBE_RESIZE_BORDER ) -/**********************************************************************/ +// Default Constructor (whose provision is mandated by the inclusion +// of DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame ) within set_color.h) +WinEDA_SetColorsFrame::WinEDA_SetColorsFrame() { -wxBitmapButton * ButtonB; -int ii, butt_ID, buttcolor; -wxString msg; -wxStaticText * text; -wxBoxSizer * CurrBoxSizer = NULL; + Init(); +} - m_Parent = parent; - SetFont(*g_DialogFont); - wxBoxSizer * MainBoxSizer = new wxBoxSizer(wxHORIZONTAL); - SetSizer(MainBoxSizer); +// Standard Constructor +WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent, + const wxPoint& framepos ) +{ + m_Parent = parent; + Init(); + Create( parent, + SYMBOL_WINEDA_SETCOLORSFRAME_IDNAME, + SYMBOL_WINEDA_SETCOLORSFRAME_TITLE, + framepos, + wxDefaultSize, + SYMBOL_WINEDA_SETCOLORSFRAME_STYLE ); +} - for ( ii = 0; laytool_list[ii] != NULL; ii++ ) - { - if( ! CurrBoxSizer || ! laytool_list[ii]->m_Color && ! laytool_list[ii]->m_NoDisplay ) - { - CurrBoxSizer = new wxBoxSizer(wxVERTICAL); - MainBoxSizer->Add(CurrBoxSizer, 0, wxGROW|wxALL, 5); - msg = wxGetTranslation(laytool_list[ii]->m_Name.GetData()); - text = new wxStaticText( this, -1, msg ); - CurrBoxSizer->Add(text, 0, wxGROW|wxALL, 5); - continue; - } - if ( laytool_list[ii]->m_Id == 0 ) - laytool_list[ii]->m_Id = ID_COLOR_SETUP + ii; - butt_ID = laytool_list[ii]->m_Id; +// Destructor +WinEDA_SetColorsFrame::~WinEDA_SetColorsFrame() { } - wxBoxSizer * LineBoxSizer = new wxBoxSizer(wxHORIZONTAL); - wxCheckBox * Checkb; - CurrBoxSizer->Add(LineBoxSizer, 0, wxGROW|wxALL, 0); - laytool_list[ii]->m_CheckBox = Checkb = new wxCheckBox( this, - ID_COLOR_CHECKBOX_ONOFF, wxEmptyString ); - LineBoxSizer->Add(Checkb, 0, wxGROW|wxALL, 1); - if ( laytool_list[ii]->m_NoDisplayIsColor ) - { - if ( *laytool_list[ii]->m_Color & ITEM_NOT_SHOW ) - laytool_list[ii]->m_CheckBox->SetValue(FALSE); - else - laytool_list[ii]->m_CheckBox->SetValue(TRUE); - } - else if ( laytool_list[ii]->m_NoDisplay ) - laytool_list[ii]->m_CheckBox->SetValue(*laytool_list[ii]->m_NoDisplay); +/**********************************************************/ +bool WinEDA_SetColorsFrame::Create( wxWindow* parent, wxWindowID id, + const wxString& caption, const wxPoint& pos, + const wxSize& size, long style ) +/**********************************************************/ +{ + SetExtraStyle(wxWS_EX_BLOCK_EVENTS); + wxDialog::Create( parent, id, caption, pos, size, style ); - if( laytool_list[ii]->m_Color ) - { - wxMemoryDC iconDC; - wxBitmap ButtBitmap( BUTT_SIZE_X, BUTT_SIZE_Y ); - iconDC.SelectObject( ButtBitmap ); - buttcolor = *laytool_list[ii]->m_Color & MASKCOLOR; - CurrentColor[ii] = buttcolor; - wxBrush Brush; - iconDC.SelectObject( ButtBitmap ); - iconDC.SetPen(*wxBLACK_PEN); - Brush.SetColour( - ColorRefs[buttcolor].m_Red, - ColorRefs[buttcolor].m_Green, - ColorRefs[buttcolor].m_Blue - ); - Brush.SetStyle(wxSOLID); + CreateControls(); + if (GetSizer()) + { + GetSizer()->SetSizeHints(this); + } + return true; +} - iconDC.SetBrush(Brush); - iconDC.DrawRectangle(0, 0, BUTT_SIZE_X, BUTT_SIZE_Y); - ButtonB = new wxBitmapButton( this, butt_ID, - ButtBitmap, wxDefaultPosition, - wxSize(BUTT_SIZE_X, BUTT_SIZE_Y) ); - laytool_list[ii]->m_Button = ButtonB; - LineBoxSizer->Add(ButtonB, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1); - } +/**********************************************************/ +void WinEDA_SetColorsFrame::Init() +/**********************************************************/ +{ + OuterBoxSizer = NULL; + MainBoxSizer = NULL; + FlexColumnBoxSizer = NULL; + Label = NULL; + RowBoxSizer = NULL; + BitmapButton = NULL; + CheckBox = NULL; + Button = NULL; + Line = NULL; + StdDialogButtonSizer = NULL; +} - msg = wxGetTranslation(laytool_list[ii]->m_Name.GetData()); - text = new wxStaticText( this, -1, msg ); - LineBoxSizer->Add(text, 0, wxGROW|wxALL, 1); - } - CurrBoxSizer->AddSpacer(20); - wxButton * Button = new wxButton( this, ID_COLOR_RESET_SHOW_LAYER_ON, - _("Show All") ); - Button->SetForegroundColour(*wxBLUE); - CurrBoxSizer->Add(Button, 0, wxALIGN_TOP|wxGROW|wxALL, 5); +/**********************************************************/ +void WinEDA_SetColorsFrame::CreateControls() +/**********************************************************/ +{ + int lyr, cln, butt_ID, buttcolor; + wxString msg; + wxSize CorrectSize; // Used while specifying sizes of buttons and spacers + int ButtonHeight; // Also used for the same reason - Button = new wxButton( this, ID_COLOR_RESET_SHOW_LAYER_OFF, - _("Show None") ); - Button->SetForegroundColour(*wxRED); - CurrBoxSizer->Add(Button, 0, wxALIGN_TOP|wxGROW|wxALL, 5); + SetFont( *g_DialogFont ); - // Following stretch spacer ensures "OK", "Cancel", and "Apply" - // buttons will be located at lower right corner of dialog box - CurrBoxSizer->AddStretchSpacer(); + OuterBoxSizer = new wxBoxSizer(wxVERTICAL); + SetSizer(OuterBoxSizer); - Button = new wxButton( this, wxID_OK, _("OK") ); - Button->SetForegroundColour(*wxRED); - CurrBoxSizer->Add(Button, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5); + MainBoxSizer = new wxBoxSizer(wxHORIZONTAL); + OuterBoxSizer->Add(MainBoxSizer, 1, wxGROW|wxLEFT|wxRIGHT, 5); - Button = new wxButton( this, wxID_CANCEL, _("Cancel") ); - Button->SetForegroundColour(*wxBLUE); - CurrBoxSizer->Add(Button, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5); + // Add various items to the dialog box, as determined by the + // details of each element contained within laytool_list[] + for( lyr = 0, cln = 0; lyr < NB_BUTT; lyr++ ) + { + // Look for the first set of controls within each column. + if( lyr == 0 || lyr == laytool_index[cln]->m_Index + 1 ) + { + if( lyr != 0 ) + cln++; - Button = new wxButton( this, wxID_APPLY, _("Apply") ); - CurrBoxSizer->Add(Button, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5); + // Specify a FlexGrid sizer with seventeen rows and one column. + FlexColumnBoxSizer = new wxFlexGridSizer(17, 1, 0, 0); - GetSizer()->Fit(this); - GetSizer()->SetSizeHints(this); + // Specify that all of the rows can be expanded. + for( int ii = 0; ii < 17; ii++ ) + { + FlexColumnBoxSizer->AddGrowableRow(ii); + } + + // Specify that the column can also be expanded. + FlexColumnBoxSizer->AddGrowableCol(0); + + MainBoxSizer->Add(FlexColumnBoxSizer, 1, wxGROW|wxLEFT, 5); + + // Add a text string to identify the controls within this column. + Label = new wxStaticText( this, wxID_STATIC, laytool_index[cln]->m_Name, + wxDefaultPosition, wxDefaultSize, 0 ); + + // Make this text string bold (so that it stands out better). + Label->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxNORMAL_FONT->GetFamily(), + wxNORMAL, wxBOLD, false, wxNORMAL_FONT->GetFaceName() ) ); + + FlexColumnBoxSizer->Add(Label, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5); + } + + // Provide a sizer for each layer to accomodate its associated bitmap button and checkbox. + RowBoxSizer = new wxBoxSizer(wxHORIZONTAL); + FlexColumnBoxSizer->Add(RowBoxSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5); + + butt_ID = ID_COLOR_SETUP + lyr; + laytool_list[lyr]->m_Id = butt_ID; + + // Provide a bitmap button, and "paint" this with the appropriate color. + wxMemoryDC iconDC; + wxBitmap ButtBitmap( BUTT_SIZE_X, BUTT_SIZE_Y ); + iconDC.SelectObject( ButtBitmap ); + buttcolor = *laytool_list[lyr]->m_Color & MASKCOLOR; + CurrentColor[lyr] = buttcolor; + wxBrush Brush; + iconDC.SelectObject( ButtBitmap ); + iconDC.SetPen( *wxBLACK_PEN ); + Brush.SetColour( + ColorRefs[buttcolor].m_Red, + ColorRefs[buttcolor].m_Green, + ColorRefs[buttcolor].m_Blue + ); + Brush.SetStyle( wxSOLID ); + + iconDC.SetBrush( Brush ); + iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y ); + + BitmapButton = new wxBitmapButton( this, butt_ID, + ButtBitmap, + wxDefaultPosition, + wxSize(BUTT_SIZE_X, BUTT_SIZE_Y) ); + laytool_list[lyr]->m_Button = BitmapButton; + + RowBoxSizer->Add(BitmapButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxBOTTOM, 5); + + // Provide a checkbox, and specify the appropriate caption and checked state. + msg = wxGetTranslation( laytool_list[lyr]->m_Name.GetData() ); + + CheckBox = new wxCheckBox( this, ID_COLOR_CHECKBOX_ONOFF, msg, + wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); + + laytool_list[lyr]->m_CheckBox = CheckBox; + + if( laytool_list[lyr]->m_NoDisplayIsColor ) + { + if( *laytool_list[lyr]->m_Color & ITEM_NOT_SHOW ) + CheckBox->SetValue( FALSE ); + else + CheckBox->SetValue( TRUE ); + } + else + CheckBox->SetValue( *laytool_list[lyr]->m_NoDisplay ); + + RowBoxSizer->Add(CheckBox, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5); + } + + // Now provide two (standard/non-bitmap) buttons within the third column, along with a number + // of spacers (so that if the dialog box is resized by the user, each of the controls within + // each of the columns will be repositioned in an aesthetically-acceptable manner). + // + // Before adding either of those buttons, provide a spacer to properly separate them from the + // bitmap buttons and checkboxes located above them. The height of that spacer should match + // the height of each "RowBox" sizer that has already been provided (to accomodate a bitmap + // button and checkbox), so that the top edge of the first button will line up with the top + // edge of the fourth checkbox provided within each of the first and second columns. (Hence + // that height is the larger of each bitmap button's height and each checkbox'es height.) + CorrectSize = CheckBox->GetSize(); + if( CorrectSize.y < BUTT_SIZE_Y ) + CorrectSize.y = BUTT_SIZE_Y; + + FlexColumnBoxSizer->Add(5, CorrectSize.y, 1, wxBOTTOM, 5); + + // For aesthetic reasons, both of the buttons will be made equally wide; hence the width + // required for each of those buttons needs to be determined before the appropriate width + // for both of them can be specified. + int width0; + + // Specify the relevent details for the first button, but in the first instance, + // specify the caption which will be used by the second of these buttons. + Button = new wxButton( this, ID_COLOR_RESET_SHOW_LAYER_ON, _("Show None"), + wxDefaultPosition, wxDefaultSize, 0 ); + + // Note the width of the button required for the initially specified caption. + // Also note the height of this button, as that detail will be required later while specifying + // the height of yet more spacers that will subsequently be provided beneath both buttons. + Button->GetSize( &width0, &ButtonHeight ); + + // Now change the caption of this button to what is really wanted for it. + Button->SetLabel( _("Show All") ); + + // Also note the width of the button required for the updated caption. + Button->GetSize( &CorrectSize.x, &ButtonHeight ); + + // Upate the value of CorrectSize.x if required (as that value will subsequently + // be used to specify the (minimum) width for both of these buttons). + if( CorrectSize.x < width0 ) + CorrectSize.x = width0; + + // Complete the steps necessary for providing the first button. + if (WinEDA_SetColorsFrame::ShowToolTips()) + Button->SetToolTip( _("Switch on all of the Gerber layers") ); + Button->SetMinSize( wxSize( CorrectSize.x, ButtonHeight ) ); + Button->SetForegroundColour( wxColor( 0, 100, 0 ) ); + FlexColumnBoxSizer->Add(Button, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxBOTTOM, 5); + + // Now do everything required for providing the second button. + Button = new wxButton( this, ID_COLOR_RESET_SHOW_LAYER_OFF, _("Show None"), + wxDefaultPosition, wxDefaultSize, 0 ); + if (WinEDA_SetColorsFrame::ShowToolTips()) + Button->SetToolTip( _("Switch off all of the Gerber layers") ); + Button->SetMinSize( wxSize( CorrectSize.x, ButtonHeight ) ); + Button->SetForegroundColour( wxColor( 100, 0, 0 ) ); + FlexColumnBoxSizer->Add(Button, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxBOTTOM, 5); + + // As each column contains seventeen rows, and only six rows of the third column have been + // occupied so far, spacers still need to be provided to occupy each of the remaining eleven + // rows within that column. So determine the collective height required for those spacers, + // so that the appropriate height for each of those spacers can subsequently be determined. + // + // Collective height required by the 11 spacers = 13 * CorrectSize.y - 2 * ButtonHeight + // + // As the height of a spacer is always an integral number, some of the spacers will probably + // need to be one unit taller than the remaining spacers; thus the remainder (modulus) will + // also determine what height should subsequently be assigned to each of those spacers. + // (Reuse width0 to hold value of remainder, rather than defining another new variable.) + width0 = (13 * CorrectSize.y - 2 * ButtonHeight) % 11; + CorrectSize.y = (13 * CorrectSize.y - 2 * ButtonHeight) / 11; + for( int ii = 1; ii < 12; ii++ ) + { + if( ii <= width0 ) + FlexColumnBoxSizer->Add(5, CorrectSize.y + 1, 1, wxBOTTOM, 5); + else + FlexColumnBoxSizer->Add(5, CorrectSize.y, 1, wxBOTTOM, 5); + } + + // Provide a line to separate the controls which have been provided so far from + // the OK, Cancel, and Apply buttons (which will be provided after this line) + Line = new wxStaticLine( this, -1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + OuterBoxSizer->Add(Line, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); + + // Provide a StdDialogButtonSizer to accommodate the OK, Cancel, and Apply + // 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->SetForegroundColour( *wxRED ); + StdDialogButtonSizer->AddButton(Button); + + Button = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + Button->SetForegroundColour( *wxBLUE ); + StdDialogButtonSizer->AddButton(Button); + + Button = new wxButton( this, wxID_APPLY, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 ); + StdDialogButtonSizer->AddButton(Button); + + StdDialogButtonSizer->Realize(); + + // (Dialog now needs to be resized, but the associated command is provided elsewhere.) +} + + +/**********************************************************/ +bool WinEDA_SetColorsFrame::ShowToolTips() +/**********************************************************/ +{ + return true; +} + + +/**********************************************************/ +wxBitmap WinEDA_SetColorsFrame::GetBitmapResource( const wxString& name ) +/**********************************************************/ +{ + wxUnusedVar(name); + return wxNullBitmap; +} + + +/**********************************************************/ +wxIcon WinEDA_SetColorsFrame::GetIconResource( const wxString& name ) +/**********************************************************/ +{ + wxUnusedVar(name); + return wxNullIcon; } @@ -293,49 +396,42 @@ void WinEDA_SetColorsFrame::OnApplyClick(wxCommandEvent& WXUNUSED(event)) void WinEDA_SetColorsFrame::SetColor(wxCommandEvent& event) /***********************************************************/ { -int ii; -int id = event.GetId(); -int color; + int id = event.GetId(); + int color; - color = DisplayColorFrame( this, - CurrentColor[id - ID_COLOR_SETUP] ); - if ( color < 0 ) - return; + wxBitmapButton* Button; - for ( ii = 0; laytool_list[ii] != NULL; ii++ ) - { - if( laytool_list[ii]->m_Id != id ) - continue; + color = DisplayColorFrame( this, + CurrentColor[id - ID_COLOR_SETUP] ); - if( laytool_list[ii]->m_Color == NULL ) - continue; + if( color < 0 ) + return; - if( CurrentColor[ii] == color ) - break; + if( CurrentColor[id - ID_COLOR_SETUP] == color ) + return; - CurrentColor[ii] = color; - wxMemoryDC iconDC; + CurrentColor[id - ID_COLOR_SETUP] = color; + wxMemoryDC iconDC; - wxBitmapButton * Button = laytool_list[ii]->m_Button; + Button = laytool_list[id - ID_COLOR_SETUP]->m_Button; - wxBitmap ButtBitmap = Button->GetBitmapLabel(); - iconDC.SelectObject( ButtBitmap ); - int buttcolor = CurrentColor[ii]; - wxBrush Brush; - iconDC.SelectObject( ButtBitmap ); - iconDC.SetPen(*wxBLACK_PEN); - Brush.SetColour( - ColorRefs[buttcolor].m_Red, - ColorRefs[buttcolor].m_Green, - ColorRefs[buttcolor].m_Blue - ); - Brush.SetStyle(wxSOLID); + wxBitmap ButtBitmap = Button->GetBitmapLabel(); + iconDC.SelectObject( ButtBitmap ); + wxBrush Brush; + iconDC.SetPen( *wxBLACK_PEN ); + Brush.SetColour( + ColorRefs[color].m_Red, + ColorRefs[color].m_Green, + ColorRefs[color].m_Blue + ); + Brush.SetStyle( wxSOLID ); - iconDC.SetBrush(Brush); - iconDC.DrawRectangle(0, 0, BUTT_SIZE_X, BUTT_SIZE_Y); - Button->SetBitmapLabel(ButtBitmap); - } - Refresh( FALSE ); + iconDC.SetBrush( Brush ); + iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y ); + Button->SetBitmapLabel( ButtBitmap ); + Button->Refresh(); + + Refresh( FALSE ); } @@ -343,40 +439,24 @@ int color; void WinEDA_SetColorsFrame::UpdateLayerSettings() /******************************************************************/ { - for( int ii = 0; laytool_list[ii] != NULL; ii++ ) - { - if ( ! laytool_list[ii]->m_NoDisplayIsColor && - (laytool_list[ii]->m_NoDisplay == NULL) ) - continue; - - if ( laytool_list[ii]->m_NoDisplayIsColor ) - { - if ( laytool_list[ii]->m_CheckBox->GetValue() ) - *laytool_list[ii]->m_Color = CurrentColor[ii] & ~ITEM_NOT_SHOW; - else - *laytool_list[ii]->m_Color = CurrentColor[ii] | ITEM_NOT_SHOW; - } - else - { -// if( laytool_list[ii]->m_Color ) -// *laytool_list[ii]->m_Color = CurrentColor[ii]; - - // As there is a button associated with every layer listed - // within this particular dialog box, the previous command - // can be replaced with this following command. - - *laytool_list[ii]->m_Color = CurrentColor[ii]; - -// if( laytool_list[ii]->m_CheckBox ) -// *laytool_list[ii]->m_NoDisplay = laytool_list[ii]->m_CheckBox->GetValue(); - - // As there is a checkbox associated with every layer listed - // within this particular dialog box, the previous command - // can be replaced with this following command. - - *laytool_list[ii]->m_NoDisplay = laytool_list[ii]->m_CheckBox->GetValue(); - } - } + for( int lyr = 0; lyr < NB_BUTT; lyr++ ) + { + if( laytool_list[lyr]->m_NoDisplayIsColor ) + { + if( laytool_list[lyr]->m_CheckBox->GetValue() ) + *laytool_list[lyr]->m_Color = CurrentColor[lyr] & ~ITEM_NOT_SHOW; + else + *laytool_list[lyr]->m_Color = CurrentColor[lyr] | ITEM_NOT_SHOW; + } + else + { + // (As a bitmap button and a checkbox have been provided for *every* + // layer, it is not necessary to check whether each of those items + // actually has been provided for each of those layers.) + *laytool_list[lyr]->m_Color = CurrentColor[lyr]; + *laytool_list[lyr]->m_NoDisplay = laytool_list[lyr]->m_CheckBox->GetValue(); + } + } // Additional command required for updating visibility of grid. m_Parent->m_Draw_Grid = g_ShowGrid; } @@ -386,12 +466,15 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings() void WinEDA_SetColorsFrame::ResetDisplayLayersCu(wxCommandEvent& event) /***********************************************************************/ { -bool NewState = (event.GetId() == ID_COLOR_RESET_SHOW_LAYER_ON) ? TRUE : FALSE; + bool NewState = ( event.GetId() == ID_COLOR_RESET_SHOW_LAYER_ON ) + ? TRUE + : FALSE; - for ( int ii = 1; ii < 34; ii++ ) - { - if ( laytool_list[ii]->m_CheckBox == NULL ) - continue; - laytool_list[ii]->m_CheckBox->SetValue(NewState); - } + for( int lyr = 0; lyr < 32; lyr++ ) + { + // (As a checkbox has been provided for *every* layer, it is not + // necessary to check whether it actually has been provided for + // each of those layers.) + laytool_list[lyr]->m_CheckBox->SetValue( NewState ); + } } diff --git a/gerbview/set_color.h b/gerbview/set_color.h index f78e8152ed..300732c2d5 100644 --- a/gerbview/set_color.h +++ b/gerbview/set_color.h @@ -1,302 +1,441 @@ - /* Set up the button list for the color selection for gerbview layers */ +/***************/ +/* set_color.h */ +/***************/ -static ColorButton Msg_Layers_Cu= +#ifndef SET_COLOR_H +#define SET_COLOR_H + +#if defined(__GNUG__) && !defined(__APPLE__) +#pragma interface "set_color.cpp" +#endif + +#include "wx/statline.h" + +class wxBoxSizer; +class wxFlexGridSizer; +class wxStaticLine; +class wxStdDialogButtonSizer; + + +// Specify how many elements are contained within laytool_list[] +const int NB_BUTT = 34; + +// Specify how many elements are contained within laytool_index[] +const int BUTTON_GROUPS = 3; + +// Specify the numbers associated with assorted controls +enum col_sel_id { + ID_DIALOG = 1800, + ID_COLOR_RESET_SHOW_LAYER_ON, + ID_COLOR_RESET_SHOW_LAYER_OFF, + ID_COLOR_CHECKBOX_ONOFF, + ID_COLOR_SETUP +}; + +// Control identifiers +// #define SYMBOL_WINEDA_SETCOLORSFRAME_STYLE wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER +#define SYMBOL_WINEDA_SETCOLORSFRAME_STYLE wxDEFAULT_DIALOG_STYLE|MAYBE_RESIZE_BORDER +#define SYMBOL_WINEDA_SETCOLORSFRAME_TITLE _("GerbView Layer Colors:") +#define SYMBOL_WINEDA_SETCOLORSFRAME_IDNAME ID_DIALOG +// #define SYMBOL_WINEDA_SETCOLORSFRAME_SIZE wxSize(400, 300) +// #define SYMBOL_WINEDA_SETCOLORSFRAME_POSITION wxDefaultPosition + +#ifndef wxCLOSE_BOX +#define wxCLOSE_BOX 0x1000 +#endif + +// Specify the width and height of every (color-displaying / bitmap) button +const int BUTT_SIZE_X = 20; +const int BUTT_SIZE_Y = 16; + +/* Macro utile : */ +#define ADR(numlayer) &g_DesignSettings.m_LayerColor[(numlayer)] + + +/**********************************/ +/* Liste des menus de Menu_Layers */ +/**********************************/ +struct ColorButton { - _("Layers 1-16") /* Title */ + wxString m_Name; + int * m_Color; // Pointeur sur la variable couleur + bool m_NoDisplayIsColor; // TRUE si bit ITEM_NON_VISIBLE de la variable Color + bool * m_NoDisplay; // Pointeur sur la variable Display on/off si ce + // n'est pas la var Color + int m_Id; + wxBitmapButton * m_Button; // Button to display/change color assigned to this layer +// int m_State; // (Commented out until when it is actually used.) + wxCheckBox * m_CheckBox; // Option Display ON/OFF +}; + +struct ButtonIndex +{ + wxString m_Name; // Title + int m_Index; // Index to last bitmap button in group +}; + + +static ButtonIndex Msg_Layers_Cu = +{ + _( "Layers 1-16" ), // Title + 15 // Index to last bitmap button in group }; static ColorButton Layer_1_Butt= { - _("Layer 1"), /* Title */ - ADR(0), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 1"), // Title + ADR(0), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_2_Butt= { - _("Layer 2"), /* Title */ - ADR(1), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 2"), // Title + ADR(1), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_3_Butt= { - _("Layer 3"), /* Title */ - ADR(2), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 3"), // Title + ADR(2), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_4_Butt= { - _("Layer 4"), /* Title */ - ADR(3), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 4"), // Title + ADR(3), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_5_Butt= { - _("Layer 5"), /* Title */ - ADR(4), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 5"), // Title + ADR(4), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_6_Butt= { - _("Layer 6"), /* Title */ - ADR(5), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 6"), // Title + ADR(5), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_7_Butt= { - _("Layer 7"), /* Title */ - ADR(6), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 7"), // Title + ADR(6), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_8_Butt= { - _("Layer 8"), /* Title */ - ADR(7), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 8"), // Title + ADR(7), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_9_Butt= { - _("Layer 9"), /* Title */ - ADR(8), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 9"), // Title + ADR(8), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_10_Butt= { - _("Layer 10"), /* Title */ - ADR(9), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 10"), // Title + ADR(9), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_11_Butt= { - _("Layer 11"), /* Title */ - ADR(10), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 11"), // Title + ADR(10), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_12_Butt= { - _("Layer 12"), /* Title */ - ADR(11), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 12"), // Title + ADR(11), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_13_Butt= { - _("Layer 13"), /* Title */ - ADR(12), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 13"), // Title + ADR(12), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_14_Butt= { - _("Layer 14"), /* Title */ - ADR(13), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 14"), // Title + ADR(13), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_15_Butt= { - _("Layer 15"), /* Title */ - ADR(14), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 15"), // Title + ADR(14), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_16_Butt= { - _("Layer 16"), /* Title */ - ADR(15), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 16"), // Title + ADR(15), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; -static ColorButton Msg_Layers_Tech= + +static ButtonIndex Msg_Layers_Tech = { - _("Layers 17-32") /* Title */ + _( "Layers 17-32" ), // Title + 31 // Index to last bitmap button in group }; static ColorButton Layer_17_Butt= { - _("Layer 17"), /* Title */ - ADR(16), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 17"), // Title + ADR(16), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_18_Butt= { - _("Layer 18"), /* Title */ - ADR(17), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 18"), // Title + ADR(17), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_19_Butt= { - _("Layer 19"), /* Title */ - ADR(18), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 19"), // Title + ADR(18), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_20_Butt= { - _("Layer 20"), /* Title */ - ADR(19), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 20"), // Title + ADR(19), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_21_Butt= { - _("Layer 21"), /* Title */ - ADR(20), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 21"), // Title + ADR(20), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_22_Butt= { - _("Layer 22"), /* Title */ - ADR(21), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 22"), // Title + ADR(21), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_23_Butt= { - _("Layer 23"), /* Title */ - ADR(22), /* adr du parametre optionnel */ - TRUE /* adr du parametre display on/off */ + _("Layer 23"), // Title + ADR(22), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_24_Butt= { - _("Layer 24"), /* Title */ - ADR(23), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 24"), // Title + ADR(23), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_25_Butt= { - _("Layer 25"), /* Title */ - ADR(24), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 25"), // Title + ADR(24), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_26_Butt= { - _("Layer 26"), /* Title */ - ADR(25), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 26"), // Title + ADR(25), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_27_Butt= { - _("Layer 27"), /* Title */ - ADR(26), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 27"), // Title + ADR(26), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_28_Butt= { - _("Layer 28"), /* Title */ - ADR(27), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 28"), // Title + ADR(27), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_29_Butt= { - _("Layer 29"), /* Title */ - ADR(28), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 29"), // Title + ADR(28), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_30_Butt= { - _("Layer 30"), /* Title */ - ADR(29), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 30"), // Title + ADR(29), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_31_Butt= { - _("Layer 31"), /* Title */ - ADR(30), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 31"), // Title + ADR(30), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; static ColorButton Layer_32_Butt= { - _("Layer 32"), /* Title */ - ADR(31), /* adr du parametre optionnel */ - TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ + _("Layer 32"), // Title + ADR(31), // Address of optional parameter + TRUE // Toggle ITEM_NOT_SHOW bit of the color variable }; -static ColorButton Msg_Others_Items= +static ButtonIndex Msg_Others_Items = { - _("Others") /* Title */ + _( "Others" ), // Title + 33 // Index to last bitmap button in group }; - static ColorButton Grid_Butt= { - _("Grid"), /* Title */ - &g_GridColor, /* adr du parametre optionnel */ - FALSE, - &g_ShowGrid /* parametre display on/off = bool */ + _("Grid"), // Title + &g_GridColor, // Address of optional parameter + FALSE, + &g_ShowGrid // Address of boolean display control parameter to toggle }; static ColorButton Show_DCodes_Butt= { - _("D codes id."), /* Title */ - &g_DCodesColor, /* adr du parametre optionnel */ - FALSE, - &DisplayOpt.DisplayPadNum /* parametre display on/off = bool */ + _("D codes id."), // Title + &g_DCodesColor, // Address of optional parameter + FALSE, + &DisplayOpt.DisplayPadNum // Address of boolean display control parameter to toggle }; + static ColorButton * laytool_list[] = { - &Msg_Layers_Cu, - &Layer_1_Butt, - &Layer_2_Butt, - &Layer_3_Butt, - &Layer_4_Butt, - &Layer_5_Butt, - &Layer_6_Butt, - &Layer_7_Butt, - &Layer_8_Butt, - &Layer_9_Butt, - &Layer_10_Butt, - &Layer_11_Butt, - &Layer_12_Butt, - &Layer_13_Butt, - &Layer_14_Butt, - &Layer_15_Butt, - &Layer_16_Butt, + &Layer_1_Butt, + &Layer_2_Butt, + &Layer_3_Butt, + &Layer_4_Butt, + &Layer_5_Butt, + &Layer_6_Butt, + &Layer_7_Butt, + &Layer_8_Butt, + &Layer_9_Butt, + &Layer_10_Butt, + &Layer_11_Butt, + &Layer_12_Butt, + &Layer_13_Butt, + &Layer_14_Butt, + &Layer_15_Butt, + &Layer_16_Butt, - &Msg_Layers_Tech, - &Layer_17_Butt, - &Layer_18_Butt, - &Layer_19_Butt, - &Layer_20_Butt, - &Layer_21_Butt, - &Layer_22_Butt, - &Layer_23_Butt, - &Layer_24_Butt, - &Layer_25_Butt, - &Layer_26_Butt, - &Layer_27_Butt, - &Layer_28_Butt, - &Layer_29_Butt, - &Layer_30_Butt, - &Layer_31_Butt, - &Layer_32_Butt, + &Layer_17_Butt, + &Layer_18_Butt, + &Layer_19_Butt, + &Layer_20_Butt, + &Layer_21_Butt, + &Layer_22_Butt, + &Layer_23_Butt, + &Layer_24_Butt, + &Layer_25_Butt, + &Layer_26_Butt, + &Layer_27_Butt, + &Layer_28_Butt, + &Layer_29_Butt, + &Layer_30_Butt, + &Layer_31_Butt, + &Layer_32_Butt, - &Msg_Others_Items, - &Grid_Butt, - &Show_DCodes_Butt, - - NULL + &Grid_Butt, + &Show_DCodes_Butt, }; + + +static ButtonIndex* laytool_index[BUTTON_GROUPS] = { + &Msg_Layers_Cu, + &Msg_Layers_Tech, + &Msg_Others_Items +}; + + +/**************************************************************/ +/* classe derivee pour la frame de Configuration des couleurs */ +/**************************************************************/ + +class WinEDA_SetColorsFrame: public wxDialog +{ +private: + DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame ) + DECLARE_EVENT_TABLE() + + WinEDA_DrawFrame* m_Parent; + wxBoxSizer* OuterBoxSizer; + wxBoxSizer* MainBoxSizer; + wxFlexGridSizer* FlexColumnBoxSizer; + wxStaticText* Label; + wxBoxSizer* RowBoxSizer; + wxBitmapButton* BitmapButton; + wxCheckBox* CheckBox; + wxButton* Button; + wxStaticLine* Line; + wxStdDialogButtonSizer* StdDialogButtonSizer; + + // Creation + bool Create( wxWindow* parent, + wxWindowID id = SYMBOL_WINEDA_SETCOLORSFRAME_IDNAME, + const wxString& caption = SYMBOL_WINEDA_SETCOLORSFRAME_TITLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = SYMBOL_WINEDA_SETCOLORSFRAME_STYLE ); + + // Initialises member variables + void Init(); + + // Creates the controls and sizers + void CreateControls(); + + wxBitmap GetBitmapResource( const wxString& name ); + wxIcon GetIconResource( const wxString& name ); + static bool ShowToolTips(); + + void SetColor( wxCommandEvent& event ); + void OnOkClick( wxCommandEvent& event ); + void OnCancelClick( wxCommandEvent& event ); + void OnApplyClick( wxCommandEvent& event ); + void UpdateLayerSettings(); + void ResetDisplayLayersCu( wxCommandEvent& event ); + +public: + // Constructors and destructor + WinEDA_SetColorsFrame(); + WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent, const wxPoint& framepos ); + ~WinEDA_SetColorsFrame(); +}; + +#endif + // SET_COLOR_H