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) // Local variables:
// Is there a better way to determine how many elements CurrentColor requires? int CurrentColor[NB_BUTT]; // Holds color for each layer while dialog box open
int CurrentColor[COLOR_COUNT]; // Holds color for each layer while dialog box open
/* Fonctions locales: */
/* Macro utile : */ IMPLEMENT_DYNAMIC_CLASS( WinEDA_SetColorsFrame, wxDialog )
#define ADR(numlayer) &g_DesignSettings.m_LayerColor[(numlayer)]
enum col_sel_id { // Table of events for WinEDA_SetColorsFrame
ID_COLOR_RESET_SHOW_LAYER_ON = 1800, BEGIN_EVENT_TABLE( WinEDA_SetColorsFrame, wxDialog )
ID_COLOR_RESET_SHOW_LAYER_OFF, EVT_BUTTON( ID_COLOR_RESET_SHOW_LAYER_OFF, WinEDA_SetColorsFrame::ResetDisplayLayersCu )
ID_COLOR_CHECKBOX_ONOFF, EVT_BUTTON( ID_COLOR_RESET_SHOW_LAYER_ON, WinEDA_SetColorsFrame::ResetDisplayLayersCu )
ID_COLOR_SETUP 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 */ void DisplayColorSetupFrame( WinEDA_DrawFrame* parent,
/**********************************/ const wxPoint& framepos )
struct ColorButton /*****************************************************/
{ {
wxString m_Name; WinEDA_SetColorsFrame* frame =
int * m_Color; // Pointeur sur la variable couleur new WinEDA_SetColorsFrame( parent, framepos );
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 frame->ShowModal();
// n'est pas la var Color frame->Destroy();
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 */
// Default Constructor (whose provision is mandated by the inclusion
// of DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame ) within set_color.h)
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame()
{
Init();
}
/*************************************************************/
/* classe derivee pour la frame de Configuration des couleurs*/
/*************************************************************/
class WinEDA_SetColorsFrame: public wxDialog // Standard Constructor
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent,
const wxPoint& framepos )
{ {
private: m_Parent = parent;
WinEDA_DrawFrame *m_Parent; Init();
Create( parent,
SYMBOL_WINEDA_SETCOLORSFRAME_IDNAME,
SYMBOL_WINEDA_SETCOLORSFRAME_TITLE,
framepos,
wxDefaultSize,
SYMBOL_WINEDA_SETCOLORSFRAME_STYLE );
}
public:
// Constructor and destructor // Destructor
WinEDA_SetColorsFrame(WinEDA_DrawFrame *parent, const wxPoint& framepos); WinEDA_SetColorsFrame::~WinEDA_SetColorsFrame() { }
~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() /**********************************************************/
}; 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 );
CreateControls();
if (GetSizer())
{
GetSizer()->SetSizeHints(this);
}
return true;
}
/* Table des evenements pour WinEDA_SetColorsFrame */ /**********************************************************/
BEGIN_EVENT_TABLE( WinEDA_SetColorsFrame, wxDialog ) void WinEDA_SetColorsFrame::Init()
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 ) OuterBoxSizer = NULL;
EVT_BUTTON( wxID_CANCEL, WinEDA_SetColorsFrame::OnCancelClick ) MainBoxSizer = NULL;
EVT_BUTTON( wxID_APPLY, WinEDA_SetColorsFrame::OnApplyClick ) FlexColumnBoxSizer = NULL;
EVT_BUTTON( ID_COLOR_SETUP, WinEDA_SetColorsFrame::SetColor ) Label = NULL;
EVT_BUTTON( ID_COLOR_SETUP + 1, WinEDA_SetColorsFrame::SetColor ) RowBoxSizer = NULL;
EVT_BUTTON( ID_COLOR_SETUP + 2, WinEDA_SetColorsFrame::SetColor ) BitmapButton = NULL;
EVT_BUTTON( ID_COLOR_SETUP + 3, WinEDA_SetColorsFrame::SetColor ) CheckBox = NULL;
EVT_BUTTON( ID_COLOR_SETUP + 4, WinEDA_SetColorsFrame::SetColor ) Button = NULL;
EVT_BUTTON( ID_COLOR_SETUP + 5, WinEDA_SetColorsFrame::SetColor ) Line = NULL;
EVT_BUTTON( ID_COLOR_SETUP + 6, WinEDA_SetColorsFrame::SetColor ) StdDialogButtonSizer = NULL;
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 ) void WinEDA_SetColorsFrame::CreateControls()
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 ) int lyr, cln, butt_ID, buttcolor;
EVT_BUTTON( ID_COLOR_SETUP + 15, WinEDA_SetColorsFrame::SetColor ) wxString msg;
EVT_BUTTON( ID_COLOR_SETUP + 16, WinEDA_SetColorsFrame::SetColor ) wxSize CorrectSize; // Used while specifying sizes of buttons and spacers
EVT_BUTTON( ID_COLOR_SETUP + 17, WinEDA_SetColorsFrame::SetColor ) int ButtonHeight; // Also used for the same reason
EVT_BUTTON( ID_COLOR_SETUP + 18, WinEDA_SetColorsFrame::SetColor )
EVT_BUTTON( ID_COLOR_SETUP + 19, WinEDA_SetColorsFrame::SetColor ) SetFont( *g_DialogFont );
EVT_BUTTON( ID_COLOR_SETUP + 20, WinEDA_SetColorsFrame::SetColor )
EVT_BUTTON( ID_COLOR_SETUP + 21, WinEDA_SetColorsFrame::SetColor ) OuterBoxSizer = new wxBoxSizer(wxVERTICAL);
EVT_BUTTON( ID_COLOR_SETUP + 22, WinEDA_SetColorsFrame::SetColor ) SetSizer(OuterBoxSizer);
EVT_BUTTON( ID_COLOR_SETUP + 23, WinEDA_SetColorsFrame::SetColor )
EVT_BUTTON( ID_COLOR_SETUP + 24, WinEDA_SetColorsFrame::SetColor ) MainBoxSizer = new wxBoxSizer(wxHORIZONTAL);
EVT_BUTTON( ID_COLOR_SETUP + 25, WinEDA_SetColorsFrame::SetColor ) OuterBoxSizer->Add(MainBoxSizer, 1, wxGROW|wxLEFT|wxRIGHT, 5);
EVT_BUTTON( ID_COLOR_SETUP + 26, WinEDA_SetColorsFrame::SetColor )
EVT_BUTTON( ID_COLOR_SETUP + 27, WinEDA_SetColorsFrame::SetColor ) // Add various items to the dialog box, as determined by the
EVT_BUTTON( ID_COLOR_SETUP + 28, WinEDA_SetColorsFrame::SetColor ) // details of each element contained within laytool_list[]
EVT_BUTTON( ID_COLOR_SETUP + 29, WinEDA_SetColorsFrame::SetColor ) for( lyr = 0, cln = 0; lyr < NB_BUTT; lyr++ )
EVT_BUTTON( ID_COLOR_SETUP + 30, WinEDA_SetColorsFrame::SetColor ) {
EVT_BUTTON( ID_COLOR_SETUP + 31, WinEDA_SetColorsFrame::SetColor ) // Look for the first set of controls within each column.
EVT_BUTTON( ID_COLOR_SETUP + 32, WinEDA_SetColorsFrame::SetColor ) if( lyr == 0 || lyr == laytool_index[cln]->m_Index + 1 )
EVT_BUTTON( ID_COLOR_SETUP + 33, WinEDA_SetColorsFrame::SetColor ) {
EVT_BUTTON( ID_COLOR_SETUP + 34, WinEDA_SetColorsFrame::SetColor ) if( lyr != 0 )
EVT_BUTTON( ID_COLOR_SETUP + 35, WinEDA_SetColorsFrame::SetColor ) cln++;
EVT_BUTTON( ID_COLOR_SETUP + 36, WinEDA_SetColorsFrame::SetColor )
// EVT_BUTTON( ID_COLOR_SETUP + 37, WinEDA_SetColorsFrame::SetColor ) // Specify a FlexGrid sizer with seventeen rows and one column.
// EVT_BUTTON( ID_COLOR_SETUP + 38, WinEDA_SetColorsFrame::SetColor ) FlexColumnBoxSizer = new wxFlexGridSizer(17, 1, 0, 0);
// EVT_BUTTON( ID_COLOR_SETUP + 39, WinEDA_SetColorsFrame::SetColor )
// EVT_BUTTON( ID_COLOR_SETUP + 40, WinEDA_SetColorsFrame::SetColor ) // Specify that all of the rows can be expanded.
// EVT_BUTTON( ID_COLOR_SETUP + 41, WinEDA_SetColorsFrame::SetColor ) for( int ii = 0; ii < 17; ii++ )
// EVT_BUTTON( ID_COLOR_SETUP + 42, WinEDA_SetColorsFrame::SetColor ) {
// EVT_BUTTON( ID_COLOR_SETUP + 43, WinEDA_SetColorsFrame::SetColor ) FlexColumnBoxSizer->AddGrowableRow(ii);
// EVT_BUTTON( ID_COLOR_SETUP + 44, WinEDA_SetColorsFrame::SetColor ) }
END_EVENT_TABLE()
// 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;
}
/**************************************************************/
/* void DisplayColorSetupFrame(WinEDA_DrawFrame * parent, */
/* const wxPoint & pos) */
/**************************************************************/
void DisplayColorSetupFrame(WinEDA_DrawFrame * parent, /**********************************************************/
const wxPoint & framepos) wxBitmap WinEDA_SetColorsFrame::GetBitmapResource( const wxString& name )
/**********************************************************/
{ {
WinEDA_SetColorsFrame * frame = wxUnusedVar(name);
new WinEDA_SetColorsFrame(parent, framepos); return wxNullBitmap;
frame->ShowModal();
frame->Destroy();
} }
/**********************************************************************/ /**********************************************************/
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame(WinEDA_DrawFrame *parent, wxIcon WinEDA_SetColorsFrame::GetIconResource( const wxString& name )
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; wxUnusedVar(name);
int ii, butt_ID, buttcolor; return wxNullIcon;
wxString msg;
wxStaticText * text;
wxBoxSizer * CurrBoxSizer = NULL;
m_Parent = parent;
SetFont(*g_DialogFont);
wxBoxSizer * MainBoxSizer = new wxBoxSizer(wxHORIZONTAL);
SetSizer(MainBoxSizer);
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;
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);
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);
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);
}
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);
Button = new wxButton( this, ID_COLOR_RESET_SHOW_LAYER_OFF,
_("Show None") );
Button->SetForegroundColour(*wxRED);
CurrBoxSizer->Add(Button, 0, wxALIGN_TOP|wxGROW|wxALL, 5);
// Following stretch spacer ensures "OK", "Cancel", and "Apply"
// buttons will be located at lower right corner of dialog box
CurrBoxSizer->AddStretchSpacer();
Button = new wxButton( this, wxID_OK, _("OK") );
Button->SetForegroundColour(*wxRED);
CurrBoxSizer->Add(Button, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5);
Button = new wxButton( this, wxID_CANCEL, _("Cancel") );
Button->SetForegroundColour(*wxBLUE);
CurrBoxSizer->Add(Button, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5);
Button = new wxButton( this, wxID_APPLY, _("Apply") );
CurrBoxSizer->Add(Button, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5);
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
} }
...@@ -293,49 +396,42 @@ void WinEDA_SetColorsFrame::OnApplyClick(wxCommandEvent& WXUNUSED(event)) ...@@ -293,49 +396,42 @@ 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,
CurrentColor[id - ID_COLOR_SETUP] ); color = DisplayColorFrame( this,
if ( color < 0 ) CurrentColor[id - ID_COLOR_SETUP] );
return;
if( color < 0 )
for ( ii = 0; laytool_list[ii] != NULL; ii++ ) return;
{
if( laytool_list[ii]->m_Id != id ) if( CurrentColor[id - ID_COLOR_SETUP] == color )
continue; return;
if( laytool_list[ii]->m_Color == NULL ) CurrentColor[id - ID_COLOR_SETUP] = color;
continue; wxMemoryDC iconDC;
if( CurrentColor[ii] == color ) Button = laytool_list[id - ID_COLOR_SETUP]->m_Button;
break;
wxBitmap ButtBitmap = Button->GetBitmapLabel();
CurrentColor[ii] = color; iconDC.SelectObject( ButtBitmap );
wxMemoryDC iconDC; wxBrush Brush;
iconDC.SetPen( *wxBLACK_PEN );
wxBitmapButton * Button = laytool_list[ii]->m_Button; Brush.SetColour(
ColorRefs[color].m_Red,
wxBitmap ButtBitmap = Button->GetBitmapLabel(); ColorRefs[color].m_Green,
iconDC.SelectObject( ButtBitmap ); ColorRefs[color].m_Blue
int buttcolor = CurrentColor[ii]; );
wxBrush Brush; Brush.SetStyle( wxSOLID );
iconDC.SelectObject( ButtBitmap );
iconDC.SetPen(*wxBLACK_PEN); iconDC.SetBrush( Brush );
Brush.SetColour( iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
ColorRefs[buttcolor].m_Red, Button->SetBitmapLabel( ButtBitmap );
ColorRefs[buttcolor].m_Green, Button->Refresh();
ColorRefs[buttcolor].m_Blue
); Refresh( FALSE );
Brush.SetStyle(wxSOLID);
iconDC.SetBrush(Brush);
iconDC.DrawRectangle(0, 0, BUTT_SIZE_X, BUTT_SIZE_Y);
Button->SetBitmapLabel(ButtBitmap);
}
Refresh( FALSE );
} }
...@@ -343,40 +439,24 @@ int color; ...@@ -343,40 +439,24 @@ 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[lyr]->m_CheckBox->GetValue() )
*laytool_list[lyr]->m_Color = CurrentColor[lyr] & ~ITEM_NOT_SHOW;
if ( laytool_list[ii]->m_NoDisplayIsColor ) else
{ *laytool_list[lyr]->m_Color = CurrentColor[lyr] | ITEM_NOT_SHOW;
if ( laytool_list[ii]->m_CheckBox->GetValue() ) }
*laytool_list[ii]->m_Color = CurrentColor[ii] & ~ITEM_NOT_SHOW; else
else {
*laytool_list[ii]->m_Color = CurrentColor[ii] | ITEM_NOT_SHOW; // (As a bitmap button and a checkbox have been provided for *every*
} // layer, it is not necessary to check whether each of those items
else // actually has been provided for each of those layers.)
{ *laytool_list[lyr]->m_Color = CurrentColor[lyr];
// if( laytool_list[ii]->m_Color ) *laytool_list[lyr]->m_NoDisplay = laytool_list[lyr]->m_CheckBox->GetValue();
// *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();
}
}
// Additional command required for updating visibility of grid. // Additional command required for updating visibility of grid.
m_Parent->m_Draw_Grid = g_ShowGrid; m_Parent->m_Draw_Grid = g_ShowGrid;
} }
...@@ -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
for ( int ii = 1; ii < 34; ii++ ) : FALSE;
{
if ( laytool_list[ii]->m_CheckBox == NULL ) for( int lyr = 0; lyr < 32; lyr++ )
continue; {
laytool_list[ii]->m_CheckBox->SetValue(NewState); // (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 );
}
} }
/* 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
{
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 */ _( "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, &Layer_4_Butt,
&Layer_4_Butt, &Layer_5_Butt,
&Layer_5_Butt, &Layer_6_Butt,
&Layer_6_Butt, &Layer_7_Butt,
&Layer_7_Butt, &Layer_8_Butt,
&Layer_8_Butt, &Layer_9_Butt,
&Layer_9_Butt, &Layer_10_Butt,
&Layer_10_Butt, &Layer_11_Butt,
&Layer_11_Butt, &Layer_12_Butt,
&Layer_12_Butt, &Layer_13_Butt,
&Layer_13_Butt, &Layer_14_Butt,
&Layer_14_Butt, &Layer_15_Butt,
&Layer_15_Butt, &Layer_16_Butt,
&Layer_16_Butt,
&Layer_17_Butt,
&Msg_Layers_Tech, &Layer_18_Butt,
&Layer_17_Butt, &Layer_19_Butt,
&Layer_18_Butt, &Layer_20_Butt,
&Layer_19_Butt, &Layer_21_Butt,
&Layer_20_Butt, &Layer_22_Butt,
&Layer_21_Butt, &Layer_23_Butt,
&Layer_22_Butt, &Layer_24_Butt,
&Layer_23_Butt, &Layer_25_Butt,
&Layer_24_Butt, &Layer_26_Butt,
&Layer_25_Butt, &Layer_27_Butt,
&Layer_26_Butt, &Layer_28_Butt,
&Layer_27_Butt, &Layer_29_Butt,
&Layer_28_Butt, &Layer_30_Butt,
&Layer_29_Butt, &Layer_31_Butt,
&Layer_30_Butt, &Layer_32_Butt,
&Layer_31_Butt,
&Layer_32_Butt, &Grid_Butt,
&Show_DCodes_Butt,
&Msg_Others_Items, };
&Grid_Butt,
&Show_DCodes_Butt,
static ButtonIndex* laytool_index[BUTTON_GROUPS] = {
NULL &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