Commit d5a0a4fd authored by g_harland's avatar g_harland

The "GerbView Layer Colors:" dialog box has been updated

parent cf918c05
...@@ -4,6 +4,14 @@ Started 2007-June-11 ...@@ -4,6 +4,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Nov-11 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
+ 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 <jean-pierre.charras@inpg.fr> 2007-Nov-10 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+eeschema: +eeschema:
......
/* 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 "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -9,256 +29,339 @@ ...@@ -9,256 +29,339 @@
#include "protos.h" #include "protos.h"
/* Variables locales */ #include "set_color.h" // Header file associated with this file
const int BUTT_SIZE_X = 20;
const int BUTT_SIZE_Y = 16;
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: */ // Local variables:
int CurrentColor[NB_BUTT]; // Holds color for each layer while dialog box open
/* Macro utile : */
#define ADR(numlayer) &g_DesignSettings.m_LayerColor[(numlayer)]
enum col_sel_id { IMPLEMENT_DYNAMIC_CLASS( WinEDA_SetColorsFrame, wxDialog )
ID_COLOR_RESET_SHOW_LAYER_ON = 1800,
ID_COLOR_RESET_SHOW_LAYER_OFF,
ID_COLOR_CHECKBOX_ONOFF,
ID_COLOR_SETUP
};
// 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_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()
/**********************************/
/* 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
};
#include "set_color.h" /* include description and list of tools and buttons */ /*****************************************************/
void DisplayColorSetupFrame( WinEDA_DrawFrame* parent,
const wxPoint& framepos )
/*****************************************************/
{
WinEDA_SetColorsFrame* frame =
new WinEDA_SetColorsFrame( parent, framepos );
frame->ShowModal();
frame->Destroy();
}
/*************************************************************/
/* classe derivee pour la frame de Configuration des couleurs*/
/*************************************************************/
class WinEDA_SetColorsFrame: public wxDialog // Default Constructor (whose provision is mandated by the inclusion
// of DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame ) within set_color.h)
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame()
{ {
private: Init();
WinEDA_DrawFrame *m_Parent; }
public:
// Constructor and destructor // Standard Constructor
WinEDA_SetColorsFrame(WinEDA_DrawFrame *parent, const wxPoint& framepos); WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent,
~WinEDA_SetColorsFrame() {}; const wxPoint& framepos )
{
m_Parent = parent;
Init();
Create( parent,
SYMBOL_WINEDA_SETCOLORSFRAME_IDNAME,
SYMBOL_WINEDA_SETCOLORSFRAME_TITLE,
framepos,
wxDefaultSize,
SYMBOL_WINEDA_SETCOLORSFRAME_STYLE );
}
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() // Destructor
}; WinEDA_SetColorsFrame::~WinEDA_SetColorsFrame() { }
/* Table des evenements pour WinEDA_SetColorsFrame */ /**********************************************************/
BEGIN_EVENT_TABLE( WinEDA_SetColorsFrame, wxDialog ) bool WinEDA_SetColorsFrame::Create( wxWindow* parent, wxWindowID id,
EVT_BUTTON( ID_COLOR_RESET_SHOW_LAYER_OFF, WinEDA_SetColorsFrame::ResetDisplayLayersCu ) const wxString& caption, const wxPoint& pos,
EVT_BUTTON( ID_COLOR_RESET_SHOW_LAYER_ON, WinEDA_SetColorsFrame::ResetDisplayLayersCu ) const wxSize& size, long style )
EVT_BUTTON( wxID_OK, WinEDA_SetColorsFrame::OnOkClick ) /**********************************************************/
EVT_BUTTON( wxID_CANCEL, WinEDA_SetColorsFrame::OnCancelClick ) {
EVT_BUTTON( wxID_APPLY, WinEDA_SetColorsFrame::OnApplyClick ) SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
EVT_BUTTON( ID_COLOR_SETUP, WinEDA_SetColorsFrame::SetColor ) wxDialog::Create( parent, id, caption, pos, size, style );
EVT_BUTTON( ID_COLOR_SETUP + 1, WinEDA_SetColorsFrame::SetColor )
EVT_BUTTON( ID_COLOR_SETUP + 2, WinEDA_SetColorsFrame::SetColor ) CreateControls();
EVT_BUTTON( ID_COLOR_SETUP + 3, WinEDA_SetColorsFrame::SetColor ) if (GetSizer())
EVT_BUTTON( ID_COLOR_SETUP + 4, WinEDA_SetColorsFrame::SetColor ) {
EVT_BUTTON( ID_COLOR_SETUP + 5, WinEDA_SetColorsFrame::SetColor ) GetSizer()->SetSizeHints(this);
EVT_BUTTON( ID_COLOR_SETUP + 6, WinEDA_SetColorsFrame::SetColor ) }
EVT_BUTTON( ID_COLOR_SETUP + 7, WinEDA_SetColorsFrame::SetColor ) return true;
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 )
END_EVENT_TABLE()
/**************************************************************/
/* void DisplayColorSetupFrame(WinEDA_DrawFrame * parent, */
/* const wxPoint & pos) */
/**************************************************************/
void DisplayColorSetupFrame(WinEDA_DrawFrame * parent, /**********************************************************/
const wxPoint & framepos) void WinEDA_SetColorsFrame::Init()
/**********************************************************/
{ {
WinEDA_SetColorsFrame * frame = OuterBoxSizer = NULL;
new WinEDA_SetColorsFrame(parent, framepos); MainBoxSizer = NULL;
frame->ShowModal(); FlexColumnBoxSizer = NULL;
frame->Destroy(); Label = NULL;
RowBoxSizer = NULL;
BitmapButton = NULL;
CheckBox = NULL;
Button = NULL;
Line = NULL;
StdDialogButtonSizer = NULL;
} }
/**********************************************************************/ /**********************************************************/
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame(WinEDA_DrawFrame *parent, void WinEDA_SetColorsFrame::CreateControls()
const wxPoint& framepos): /**********************************************************/
wxDialog(parent, -1, _("GerbView Layer Colors:"), framepos,
wxSize(390, 380),
wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT|
MAYBE_RESIZE_BORDER )
/**********************************************************************/
{ {
wxBitmapButton * ButtonB; int lyr, cln, butt_ID, buttcolor;
int ii, butt_ID, buttcolor; wxString msg;
wxString msg; wxSize CorrectSize; // Used while specifying sizes of buttons and spacers
wxStaticText * text; int ButtonHeight; // Also used for the same reason
wxBoxSizer * CurrBoxSizer = NULL;
m_Parent = parent; SetFont( *g_DialogFont );
SetFont(*g_DialogFont);
wxBoxSizer * MainBoxSizer = new wxBoxSizer(wxHORIZONTAL); OuterBoxSizer = new wxBoxSizer(wxVERTICAL);
SetSizer(MainBoxSizer); SetSizer(OuterBoxSizer);
for ( ii = 0; laytool_list[ii] != NULL; ii++ ) MainBoxSizer = new wxBoxSizer(wxHORIZONTAL);
OuterBoxSizer->Add(MainBoxSizer, 1, wxGROW|wxLEFT|wxRIGHT, 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++ )
{ {
if( ! CurrBoxSizer || ! laytool_list[ii]->m_Color && ! laytool_list[ii]->m_NoDisplay ) // Look for the first set of controls within each column.
if( lyr == 0 || lyr == laytool_index[cln]->m_Index + 1 )
{ {
CurrBoxSizer = new wxBoxSizer(wxVERTICAL); if( lyr != 0 )
MainBoxSizer->Add(CurrBoxSizer, 0, wxGROW|wxALL, 5); cln++;
msg = wxGetTranslation(laytool_list[ii]->m_Name.GetData());
text = new wxStaticText( this, -1, msg ); // Specify a FlexGrid sizer with seventeen rows and one column.
CurrBoxSizer->Add(text, 0, wxGROW|wxALL, 5); FlexColumnBoxSizer = new wxFlexGridSizer(17, 1, 0, 0);
continue;
// Specify that all of the rows can be expanded.
for( int ii = 0; ii < 17; ii++ )
{
FlexColumnBoxSizer->AddGrowableRow(ii);
} }
if ( laytool_list[ii]->m_Id == 0 ) // Specify that the column can also be expanded.
laytool_list[ii]->m_Id = ID_COLOR_SETUP + ii; FlexColumnBoxSizer->AddGrowableCol(0);
butt_ID = laytool_list[ii]->m_Id;
wxBoxSizer * LineBoxSizer = new wxBoxSizer(wxHORIZONTAL); MainBoxSizer->Add(FlexColumnBoxSizer, 1, wxGROW|wxLEFT, 5);
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 ) // Add a text string to identify the controls within this column.
{ Label = new wxStaticText( this, wxID_STATIC, laytool_index[cln]->m_Name,
if ( *laytool_list[ii]->m_Color & ITEM_NOT_SHOW ) wxDefaultPosition, wxDefaultSize, 0 );
laytool_list[ii]->m_CheckBox->SetValue(FALSE);
else // Make this text string bold (so that it stands out better).
laytool_list[ii]->m_CheckBox->SetValue(TRUE); 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);
} }
else if ( laytool_list[ii]->m_NoDisplay )
laytool_list[ii]->m_CheckBox->SetValue(*laytool_list[ii]->m_NoDisplay);
if( laytool_list[ii]->m_Color ) // 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; 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 & MASKCOLOR; buttcolor = *laytool_list[lyr]->m_Color & MASKCOLOR;
CurrentColor[ii] = buttcolor; CurrentColor[lyr] = buttcolor;
wxBrush Brush; wxBrush Brush;
iconDC.SelectObject( ButtBitmap ); iconDC.SelectObject( ButtBitmap );
iconDC.SetPen(*wxBLACK_PEN); iconDC.SetPen( *wxBLACK_PEN );
Brush.SetColour( Brush.SetColour(
ColorRefs[buttcolor].m_Red, ColorRefs[buttcolor].m_Red,
ColorRefs[buttcolor].m_Green, ColorRefs[buttcolor].m_Green,
ColorRefs[buttcolor].m_Blue ColorRefs[buttcolor].m_Blue
); );
Brush.SetStyle(wxSOLID); Brush.SetStyle( wxSOLID );
iconDC.SetBrush(Brush); iconDC.SetBrush( Brush );
iconDC.DrawRectangle(0, 0, BUTT_SIZE_X, BUTT_SIZE_Y); iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
ButtonB = new wxBitmapButton( this, butt_ID, BitmapButton = new wxBitmapButton( this, butt_ID,
ButtBitmap, wxDefaultPosition, ButtBitmap,
wxDefaultPosition,
wxSize(BUTT_SIZE_X, BUTT_SIZE_Y) ); wxSize(BUTT_SIZE_X, BUTT_SIZE_Y) );
laytool_list[ii]->m_Button = ButtonB; laytool_list[lyr]->m_Button = BitmapButton;
LineBoxSizer->Add(ButtonB, 0, wxALIGN_CENTER_VERTICAL|wxALL, 1);
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 );
msg = wxGetTranslation(laytool_list[ii]->m_Name.GetData()); RowBoxSizer->Add(CheckBox, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5);
text = new wxStaticText( this, -1, msg );
LineBoxSizer->Add(text, 0, wxGROW|wxALL, 1);
} }
CurrBoxSizer->AddSpacer(20); // Now provide two (standard/non-bitmap) buttons within the third column, along with a number
wxButton * Button = new wxButton( this, ID_COLOR_RESET_SHOW_LAYER_ON, // of spacers (so that if the dialog box is resized by the user, each of the controls within
_("Show All") ); // each of the columns will be repositioned in an aesthetically-acceptable manner).
Button->SetForegroundColour(*wxBLUE); //
CurrBoxSizer->Add(Button, 0, wxALIGN_TOP|wxGROW|wxALL, 5); // 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);
}
Button = new wxButton( this, ID_COLOR_RESET_SHOW_LAYER_OFF, // Provide a line to separate the controls which have been provided so far from
_("Show None") ); // the OK, Cancel, and Apply buttons (which will be provided after this line)
Button->SetForegroundColour(*wxRED); Line = new wxStaticLine( this, -1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
CurrBoxSizer->Add(Button, 0, wxALIGN_TOP|wxGROW|wxALL, 5); OuterBoxSizer->Add(Line, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5);
// Following stretch spacer ensures "OK", "Cancel", and "Apply" // Provide a StdDialogButtonSizer to accommodate the OK, Cancel, and Apply
// buttons will be located at lower right corner of dialog box // buttons; using that type of sizer results in those buttons being
CurrBoxSizer->AddStretchSpacer(); // 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") ); Button = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
Button->SetForegroundColour(*wxRED); Button->SetForegroundColour( *wxRED );
CurrBoxSizer->Add(Button, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5); StdDialogButtonSizer->AddButton(Button);
Button = new wxButton( this, wxID_CANCEL, _("Cancel") ); Button = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
Button->SetForegroundColour(*wxBLUE); Button->SetForegroundColour( *wxBLUE );
CurrBoxSizer->Add(Button, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5); StdDialogButtonSizer->AddButton(Button);
Button = new wxButton( this, wxID_APPLY, _("Apply") ); Button = new wxButton( this, wxID_APPLY, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 );
CurrBoxSizer->Add(Button, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5); StdDialogButtonSizer->AddButton(Button);
GetSizer()->Fit(this); StdDialogButtonSizer->Realize();
GetSizer()->SetSizeHints(this);
// (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,48 +396,41 @@ void WinEDA_SetColorsFrame::OnApplyClick(wxCommandEvent& WXUNUSED(event)) ...@@ -293,48 +396,41 @@ void WinEDA_SetColorsFrame::OnApplyClick(wxCommandEvent& WXUNUSED(event))
void WinEDA_SetColorsFrame::SetColor(wxCommandEvent& event) void WinEDA_SetColorsFrame::SetColor(wxCommandEvent& event)
/***********************************************************/ /***********************************************************/
{ {
int ii; int id = event.GetId();
int id = event.GetId(); int color;
int color;
wxBitmapButton* Button;
color = DisplayColorFrame( this, color = DisplayColorFrame( this,
CurrentColor[id - ID_COLOR_SETUP] ); CurrentColor[id - ID_COLOR_SETUP] );
if ( color < 0 )
return;
for ( ii = 0; laytool_list[ii] != NULL; ii++ )
{
if( laytool_list[ii]->m_Id != id )
continue;
if( laytool_list[ii]->m_Color == NULL ) if( color < 0 )
continue; return;
if( CurrentColor[ii] == color ) if( CurrentColor[id - ID_COLOR_SETUP] == color )
break; return;
CurrentColor[ii] = color; CurrentColor[id - ID_COLOR_SETUP] = color;
wxMemoryDC iconDC; wxMemoryDC iconDC;
wxBitmapButton * Button = laytool_list[ii]->m_Button; Button = laytool_list[id - ID_COLOR_SETUP]->m_Button;
wxBitmap ButtBitmap = Button->GetBitmapLabel(); wxBitmap ButtBitmap = Button->GetBitmapLabel();
iconDC.SelectObject( ButtBitmap ); iconDC.SelectObject( ButtBitmap );
int buttcolor = CurrentColor[ii];
wxBrush Brush; wxBrush Brush;
iconDC.SelectObject( ButtBitmap ); iconDC.SetPen( *wxBLACK_PEN );
iconDC.SetPen(*wxBLACK_PEN);
Brush.SetColour( Brush.SetColour(
ColorRefs[buttcolor].m_Red, ColorRefs[color].m_Red,
ColorRefs[buttcolor].m_Green, ColorRefs[color].m_Green,
ColorRefs[buttcolor].m_Blue ColorRefs[color].m_Blue
); );
Brush.SetStyle(wxSOLID); Brush.SetStyle( wxSOLID );
iconDC.SetBrush( Brush );
iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
Button->SetBitmapLabel( ButtBitmap );
Button->Refresh();
iconDC.SetBrush(Brush);
iconDC.DrawRectangle(0, 0, BUTT_SIZE_X, BUTT_SIZE_Y);
Button->SetBitmapLabel(ButtBitmap);
}
Refresh( FALSE ); Refresh( FALSE );
} }
...@@ -343,38 +439,22 @@ int color; ...@@ -343,38 +439,22 @@ int color;
void WinEDA_SetColorsFrame::UpdateLayerSettings() void WinEDA_SetColorsFrame::UpdateLayerSettings()
/******************************************************************/ /******************************************************************/
{ {
for( int ii = 0; laytool_list[ii] != NULL; ii++ ) for( int lyr = 0; lyr < NB_BUTT; lyr++ )
{ {
if ( ! laytool_list[ii]->m_NoDisplayIsColor && if( laytool_list[lyr]->m_NoDisplayIsColor )
(laytool_list[ii]->m_NoDisplay == NULL) )
continue;
if ( laytool_list[ii]->m_NoDisplayIsColor )
{ {
if ( laytool_list[ii]->m_CheckBox->GetValue() ) if( laytool_list[lyr]->m_CheckBox->GetValue() )
*laytool_list[ii]->m_Color = CurrentColor[ii] & ~ITEM_NOT_SHOW; *laytool_list[lyr]->m_Color = CurrentColor[lyr] & ~ITEM_NOT_SHOW;
else else
*laytool_list[ii]->m_Color = CurrentColor[ii] | ITEM_NOT_SHOW; *laytool_list[lyr]->m_Color = CurrentColor[lyr] | ITEM_NOT_SHOW;
} }
else else
{ {
// if( laytool_list[ii]->m_Color ) // (As a bitmap button and a checkbox have been provided for *every*
// *laytool_list[ii]->m_Color = CurrentColor[ii]; // layer, it is not necessary to check whether each of those items
// actually has been provided for each of those layers.)
// As there is a button associated with every layer listed *laytool_list[lyr]->m_Color = CurrentColor[lyr];
// within this particular dialog box, the previous command *laytool_list[lyr]->m_NoDisplay = laytool_list[lyr]->m_CheckBox->GetValue();
// 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();
} }
} }
// Additional command required for updating visibility of grid. // Additional command required for updating visibility of grid.
...@@ -386,12 +466,15 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings() ...@@ -386,12 +466,15 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
void WinEDA_SetColorsFrame::ResetDisplayLayersCu(wxCommandEvent& event) 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++ ) for( int lyr = 0; lyr < 32; lyr++ )
{ {
if ( laytool_list[ii]->m_CheckBox == NULL ) // (As a checkbox has been provided for *every* layer, it is not
continue; // necessary to check whether it actually has been provided for
laytool_list[ii]->m_CheckBox->SetValue(NewState); // each of those layers.)
laytool_list[lyr]->m_CheckBox->SetValue( NewState );
} }
} }
/* 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= static ColorButton Layer_1_Butt=
{ {
_("Layer 1"), /* Title */ _("Layer 1"), // Title
ADR(0), /* adr du parametre optionnel */ ADR(0), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_2_Butt= static ColorButton Layer_2_Butt=
{ {
_("Layer 2"), /* Title */ _("Layer 2"), // Title
ADR(1), /* adr du parametre optionnel */ ADR(1), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_3_Butt= static ColorButton Layer_3_Butt=
{ {
_("Layer 3"), /* Title */ _("Layer 3"), // Title
ADR(2), /* adr du parametre optionnel */ ADR(2), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_4_Butt= static ColorButton Layer_4_Butt=
{ {
_("Layer 4"), /* Title */ _("Layer 4"), // Title
ADR(3), /* adr du parametre optionnel */ ADR(3), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_5_Butt= static ColorButton Layer_5_Butt=
{ {
_("Layer 5"), /* Title */ _("Layer 5"), // Title
ADR(4), /* adr du parametre optionnel */ ADR(4), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_6_Butt= static ColorButton Layer_6_Butt=
{ {
_("Layer 6"), /* Title */ _("Layer 6"), // Title
ADR(5), /* adr du parametre optionnel */ ADR(5), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_7_Butt= static ColorButton Layer_7_Butt=
{ {
_("Layer 7"), /* Title */ _("Layer 7"), // Title
ADR(6), /* adr du parametre optionnel */ ADR(6), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_8_Butt= static ColorButton Layer_8_Butt=
{ {
_("Layer 8"), /* Title */ _("Layer 8"), // Title
ADR(7), /* adr du parametre optionnel */ ADR(7), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_9_Butt= static ColorButton Layer_9_Butt=
{ {
_("Layer 9"), /* Title */ _("Layer 9"), // Title
ADR(8), /* adr du parametre optionnel */ ADR(8), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_10_Butt= static ColorButton Layer_10_Butt=
{ {
_("Layer 10"), /* Title */ _("Layer 10"), // Title
ADR(9), /* adr du parametre optionnel */ ADR(9), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_11_Butt= static ColorButton Layer_11_Butt=
{ {
_("Layer 11"), /* Title */ _("Layer 11"), // Title
ADR(10), /* adr du parametre optionnel */ ADR(10), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_12_Butt= static ColorButton Layer_12_Butt=
{ {
_("Layer 12"), /* Title */ _("Layer 12"), // Title
ADR(11), /* adr du parametre optionnel */ ADR(11), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_13_Butt= static ColorButton Layer_13_Butt=
{ {
_("Layer 13"), /* Title */ _("Layer 13"), // Title
ADR(12), /* adr du parametre optionnel */ ADR(12), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_14_Butt= static ColorButton Layer_14_Butt=
{ {
_("Layer 14"), /* Title */ _("Layer 14"), // Title
ADR(13), /* adr du parametre optionnel */ ADR(13), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_15_Butt= static ColorButton Layer_15_Butt=
{ {
_("Layer 15"), /* Title */ _("Layer 15"), // Title
ADR(14), /* adr du parametre optionnel */ ADR(14), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_16_Butt= static ColorButton Layer_16_Butt=
{ {
_("Layer 16"), /* Title */ _("Layer 16"), // Title
ADR(15), /* adr du parametre optionnel */ ADR(15), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ 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= static ColorButton Layer_17_Butt=
{ {
_("Layer 17"), /* Title */ _("Layer 17"), // Title
ADR(16), /* adr du parametre optionnel */ ADR(16), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_18_Butt= static ColorButton Layer_18_Butt=
{ {
_("Layer 18"), /* Title */ _("Layer 18"), // Title
ADR(17), /* adr du parametre optionnel */ ADR(17), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_19_Butt= static ColorButton Layer_19_Butt=
{ {
_("Layer 19"), /* Title */ _("Layer 19"), // Title
ADR(18), /* adr du parametre optionnel */ ADR(18), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_20_Butt= static ColorButton Layer_20_Butt=
{ {
_("Layer 20"), /* Title */ _("Layer 20"), // Title
ADR(19), /* adr du parametre optionnel */ ADR(19), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_21_Butt= static ColorButton Layer_21_Butt=
{ {
_("Layer 21"), /* Title */ _("Layer 21"), // Title
ADR(20), /* adr du parametre optionnel */ ADR(20), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_22_Butt= static ColorButton Layer_22_Butt=
{ {
_("Layer 22"), /* Title */ _("Layer 22"), // Title
ADR(21), /* adr du parametre optionnel */ ADR(21), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_23_Butt= static ColorButton Layer_23_Butt=
{ {
_("Layer 23"), /* Title */ _("Layer 23"), // Title
ADR(22), /* adr du parametre optionnel */ ADR(22), // Address of optional parameter
TRUE /* adr du parametre display on/off */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_24_Butt= static ColorButton Layer_24_Butt=
{ {
_("Layer 24"), /* Title */ _("Layer 24"), // Title
ADR(23), /* adr du parametre optionnel */ ADR(23), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_25_Butt= static ColorButton Layer_25_Butt=
{ {
_("Layer 25"), /* Title */ _("Layer 25"), // Title
ADR(24), /* adr du parametre optionnel */ ADR(24), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_26_Butt= static ColorButton Layer_26_Butt=
{ {
_("Layer 26"), /* Title */ _("Layer 26"), // Title
ADR(25), /* adr du parametre optionnel */ ADR(25), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_27_Butt= static ColorButton Layer_27_Butt=
{ {
_("Layer 27"), /* Title */ _("Layer 27"), // Title
ADR(26), /* adr du parametre optionnel */ ADR(26), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_28_Butt= static ColorButton Layer_28_Butt=
{ {
_("Layer 28"), /* Title */ _("Layer 28"), // Title
ADR(27), /* adr du parametre optionnel */ ADR(27), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_29_Butt= static ColorButton Layer_29_Butt=
{ {
_("Layer 29"), /* Title */ _("Layer 29"), // Title
ADR(28), /* adr du parametre optionnel */ ADR(28), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_30_Butt= static ColorButton Layer_30_Butt=
{ {
_("Layer 30"), /* Title */ _("Layer 30"), // Title
ADR(29), /* adr du parametre optionnel */ ADR(29), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_31_Butt= static ColorButton Layer_31_Butt=
{ {
_("Layer 31"), /* Title */ _("Layer 31"), // Title
ADR(30), /* adr du parametre optionnel */ ADR(30), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ TRUE // Toggle ITEM_NOT_SHOW bit of the color variable
}; };
static ColorButton Layer_32_Butt= static ColorButton Layer_32_Butt=
{ {
_("Layer 32"), /* Title */ _("Layer 32"), // Title
ADR(31), /* adr du parametre optionnel */ ADR(31), // Address of optional parameter
TRUE /* parametre display on/off = bit ITEM_NON_VISIBLE */ 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= static ColorButton Grid_Butt=
{ {
_("Grid"), /* Title */ _("Grid"), // Title
&g_GridColor, /* adr du parametre optionnel */ &g_GridColor, // Address of optional parameter
FALSE, FALSE,
&g_ShowGrid /* parametre display on/off = bool */ &g_ShowGrid // Address of boolean display control parameter to toggle
}; };
static ColorButton Show_DCodes_Butt= static ColorButton Show_DCodes_Butt=
{ {
_("D codes id."), /* Title */ _("D codes id."), // Title
&g_DCodesColor, /* adr du parametre optionnel */ &g_DCodesColor, // Address of optional parameter
FALSE, FALSE,
&DisplayOpt.DisplayPadNum /* parametre display on/off = bool */ &DisplayOpt.DisplayPadNum // Address of boolean display control parameter to toggle
}; };
static ColorButton * laytool_list[] = { static ColorButton * laytool_list[] = {
&Msg_Layers_Cu,
&Layer_1_Butt, &Layer_1_Butt,
&Layer_2_Butt, &Layer_2_Butt,
&Layer_3_Butt, &Layer_3_Butt,
...@@ -276,7 +354,6 @@ static ColorButton * laytool_list[] = { ...@@ -276,7 +354,6 @@ static ColorButton * laytool_list[] = {
&Layer_15_Butt, &Layer_15_Butt,
&Layer_16_Butt, &Layer_16_Butt,
&Msg_Layers_Tech,
&Layer_17_Butt, &Layer_17_Butt,
&Layer_18_Butt, &Layer_18_Butt,
&Layer_19_Butt, &Layer_19_Butt,
...@@ -294,9 +371,71 @@ static ColorButton * laytool_list[] = { ...@@ -294,9 +371,71 @@ static ColorButton * laytool_list[] = {
&Layer_31_Butt, &Layer_31_Butt,
&Layer_32_Butt, &Layer_32_Butt,
&Msg_Others_Items,
&Grid_Butt, &Grid_Butt,
&Show_DCodes_Butt, &Show_DCodes_Butt,
NULL
}; };
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
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