2007-10-23 00:36:43 +00:00
|
|
|
/***************/
|
|
|
|
/* eelayer.cpp */
|
|
|
|
/***************/
|
|
|
|
|
|
|
|
/* Set up color Layers for EESchema
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
|
|
|
#pragma implementation "eelayer.h"
|
|
|
|
#endif
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
#include "common.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "eeschema_id.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "program.h"
|
|
|
|
#include "general.h"
|
|
|
|
#include "protos.h"
|
|
|
|
|
2007-11-11 06:57:44 +00:00
|
|
|
#include "eelayer.h" // Header file associated with this file
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
// Local variables:
|
|
|
|
int CurrentColor[NB_BUTT]; // Holds color for each layer while dialog box open
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS( WinEDA_SetColorsFrame, wxDialog )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
// Table of events for WinEDA_SetColorsFrame
|
|
|
|
BEGIN_EVENT_TABLE( WinEDA_SetColorsFrame, wxDialog )
|
|
|
|
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()
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
/**************************************************************/
|
|
|
|
void DisplayColorSetupFrame( WinEDA_DrawFrame* parent,
|
|
|
|
const wxPoint& framepos )
|
|
|
|
/**************************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-10-23 00:36:43 +00:00
|
|
|
WinEDA_SetColorsFrame* frame =
|
|
|
|
new WinEDA_SetColorsFrame( parent, framepos );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
frame->ShowModal();
|
|
|
|
frame->Destroy();
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
// Default Constructor (whose provision is mandated by the inclusion
|
|
|
|
// of DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame ) within eelayer.h)
|
|
|
|
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-10-23 00:36:43 +00:00
|
|
|
Init();
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
// Standard Constructor
|
|
|
|
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent,
|
|
|
|
const wxPoint& framepos )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-10-23 00:36:43 +00:00
|
|
|
m_Parent = parent;
|
|
|
|
Init();
|
|
|
|
Create( parent,
|
|
|
|
SYMBOL_WINEDA_SETCOLORSFRAME_IDNAME,
|
|
|
|
SYMBOL_WINEDA_SETCOLORSFRAME_TITLE,
|
|
|
|
framepos,
|
|
|
|
wxDefaultSize,
|
|
|
|
SYMBOL_WINEDA_SETCOLORSFRAME_STYLE );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
// Destructor
|
|
|
|
WinEDA_SetColorsFrame::~WinEDA_SetColorsFrame() { }
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
/**********************************************************/
|
|
|
|
bool WinEDA_SetColorsFrame::Create( wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& caption, const wxPoint& pos,
|
|
|
|
const wxSize& size, long style )
|
|
|
|
/**********************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-10-23 00:36:43 +00:00
|
|
|
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
|
|
|
|
wxDialog::Create( parent, id, caption, pos, size, style );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
CreateControls();
|
|
|
|
if (GetSizer())
|
|
|
|
{
|
|
|
|
GetSizer()->SetSizeHints(this);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
/**********************************************************/
|
|
|
|
void WinEDA_SetColorsFrame::Init()
|
|
|
|
/**********************************************************/
|
|
|
|
{
|
2007-11-11 06:57:44 +00:00
|
|
|
OuterBoxSizer = NULL;
|
|
|
|
MainBoxSizer = NULL;
|
|
|
|
ColumnBoxSizer = NULL;
|
|
|
|
RowBoxSizer = NULL;
|
|
|
|
Label = NULL;
|
|
|
|
BitmapButton = NULL;
|
|
|
|
m_ShowGrid = NULL;
|
|
|
|
m_SelBgColor = NULL;
|
|
|
|
Line = NULL;
|
|
|
|
StdDialogButtonSizer = NULL;
|
|
|
|
Button = NULL;
|
2007-10-23 00:36:43 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
/**********************************************************/
|
|
|
|
void WinEDA_SetColorsFrame::CreateControls()
|
|
|
|
/**********************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-11-11 06:57:44 +00:00
|
|
|
int lyr, grp, butt_ID, buttcolor;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
OuterBoxSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
SetSizer(OuterBoxSizer);
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
MainBoxSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
OuterBoxSizer->Add(MainBoxSizer, 1, wxGROW|wxLEFT|wxRIGHT, 5);
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
// Add various items to the dialog box, as determined by the
|
|
|
|
// details of each element contained within laytool_list[]
|
2007-11-11 06:57:44 +00:00
|
|
|
for( lyr = 0, grp = 0; lyr < NB_BUTT; lyr++ )
|
2007-10-23 00:36:43 +00:00
|
|
|
{
|
|
|
|
// Look for the initial button of each group of controls.
|
2007-11-11 06:57:44 +00:00
|
|
|
if( lyr == 0 || lyr == laytool_index[grp]->m_Index + 1 )
|
2007-10-23 00:36:43 +00:00
|
|
|
{
|
2007-11-11 06:57:44 +00:00
|
|
|
if( lyr != 0 )
|
|
|
|
grp++;
|
|
|
|
|
|
|
|
// Add another column sizer, unless the current value of
|
|
|
|
// grp is BUTTON_GROUPS - 1. (The very last group of controls
|
2007-10-23 00:36:43 +00:00
|
|
|
// differs from the previous groups in that its associated
|
|
|
|
// controls are located in the same column as the controls
|
|
|
|
// associated with the preceeding group.)
|
2007-11-11 06:57:44 +00:00
|
|
|
if( grp < BUTTON_GROUPS - 1 )
|
2007-10-23 00:36:43 +00:00
|
|
|
{
|
|
|
|
ColumnBoxSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
MainBoxSizer->Add(ColumnBoxSizer, 1, wxALIGN_TOP|wxLEFT|wxTOP, 5);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Add a spacer to better separate the text string (which is
|
|
|
|
// about to be added) from the items located above it.
|
|
|
|
ColumnBoxSizer->AddSpacer(5);
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
RowBoxSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
ColumnBoxSizer->Add(RowBoxSizer, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
// Add a text string to identify the following set of controls
|
2007-11-11 06:57:44 +00:00
|
|
|
Label = new wxStaticText( this, -1, laytool_index[grp]->m_Name,
|
|
|
|
wxDefaultPosition, wxDefaultSize, 0 );
|
2007-10-23 00:36:43 +00:00
|
|
|
// Make this text string bold (so that it stands out better)
|
2007-11-11 06:57:44 +00:00
|
|
|
Label->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxNORMAL_FONT->GetFamily(),
|
|
|
|
wxNORMAL, wxBOLD, false, wxNORMAL_FONT->GetFaceName() ) );
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2007-11-11 06:57:44 +00:00
|
|
|
RowBoxSizer->Add(Label, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2007-10-23 00:36:43 +00:00
|
|
|
}
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
RowBoxSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
ColumnBoxSizer->Add(RowBoxSizer, 0, wxGROW|wxALL, 0);
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2007-11-11 06:57:44 +00:00
|
|
|
butt_ID = ID_COLOR_SETUP + lyr;
|
|
|
|
laytool_list[lyr]->m_Id = butt_ID;
|
2007-09-13 11:55:46 +00:00
|
|
|
wxMemoryDC iconDC;
|
2007-10-23 00:36:43 +00:00
|
|
|
wxBitmap ButtBitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
|
2007-09-13 11:55:46 +00:00
|
|
|
|
|
|
|
iconDC.SelectObject( ButtBitmap );
|
2007-11-11 06:57:44 +00:00
|
|
|
buttcolor = *laytool_list[lyr]->m_Color;
|
|
|
|
CurrentColor[lyr] = buttcolor;
|
2007-09-13 11:55:46 +00:00
|
|
|
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 );
|
2007-10-23 00:36:43 +00:00
|
|
|
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) );
|
|
|
|
RowBoxSizer->Add(BitmapButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxBOTTOM, 5);
|
|
|
|
|
2007-11-11 06:57:44 +00:00
|
|
|
laytool_list[lyr]->m_Button = BitmapButton;
|
2007-10-23 00:36:43 +00:00
|
|
|
|
2007-11-11 06:57:44 +00:00
|
|
|
// Add a text string, unless the current value of lyr is NB_BUTT - 1
|
|
|
|
if( lyr < NB_BUTT - 1 )
|
2007-10-23 00:36:43 +00:00
|
|
|
{
|
2007-11-11 06:57:44 +00:00
|
|
|
Label = new wxStaticText( this, wxID_STATIC, wxGetTranslation( laytool_list[lyr]->m_Name ),
|
|
|
|
wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
RowBoxSizer->Add(Label, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5);
|
2007-10-23 00:36:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Special case; provide a checkbox instead (rather than a text string).
|
|
|
|
m_ShowGrid = new wxCheckBox( this, ID_CHECKBOX_SHOW_GRID, _("Grid"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
m_ShowGrid->SetValue( m_Parent->m_Draw_Grid );
|
|
|
|
RowBoxSizer->Add(m_ShowGrid, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5);
|
|
|
|
}
|
2007-09-13 11:55:46 +00:00
|
|
|
}
|
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
// Add a spacer to improve appearance.
|
|
|
|
ColumnBoxSizer->AddSpacer(5);
|
|
|
|
|
|
|
|
wxArrayString m_SelBgColorStrings;
|
2007-11-06 07:14:31 +00:00
|
|
|
m_SelBgColorStrings.Add(_("White"));
|
|
|
|
m_SelBgColorStrings.Add(_("Black"));
|
|
|
|
m_SelBgColor = new wxRadioBox( this, ID_RADIOBOX_BACKGROUND_COLOR, _("Background Color:"),
|
2007-10-23 00:36:43 +00:00
|
|
|
wxDefaultPosition, wxDefaultSize, m_SelBgColorStrings, 1, wxRA_SPECIFY_COLS );
|
|
|
|
m_SelBgColor->SetSelection( ( g_DrawBgColor == BLACK ) ? 1 : 0 );
|
|
|
|
ColumnBoxSizer->Add(m_SelBgColor, 1, wxGROW|wxRIGHT|wxTOP|wxBOTTOM, 5);
|
|
|
|
|
|
|
|
// Provide a line to separate all of the controls added so far from the
|
|
|
|
// "OK", "Cancel", and "Apply" buttons (which will be added after that line).
|
|
|
|
Line = new wxStaticLine( this, -1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
|
|
|
OuterBoxSizer->Add(Line, 0, wxGROW|wxALL, 5);
|
|
|
|
|
2007-11-11 06:57:44 +00:00
|
|
|
// 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);
|
2007-10-23 00:36:43 +00:00
|
|
|
|
2007-11-11 06:57:44 +00:00
|
|
|
Button = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
StdDialogButtonSizer->AddButton(Button);
|
2007-10-23 00:36:43 +00:00
|
|
|
|
2007-11-11 06:57:44 +00:00
|
|
|
Button = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
StdDialogButtonSizer->AddButton(Button);
|
2008-04-30 11:52:34 +00:00
|
|
|
Button->SetFocus();
|
2007-10-23 00:36:43 +00:00
|
|
|
|
2007-11-11 06:57:44 +00:00
|
|
|
Button = new wxButton( this, wxID_APPLY, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
StdDialogButtonSizer->AddButton(Button);
|
|
|
|
|
|
|
|
StdDialogButtonSizer->Realize();
|
2007-10-23 00:36:43 +00:00
|
|
|
|
|
|
|
// (Dialog now needs to be resized, but the associated command is found elsewhere.)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************/
|
|
|
|
bool WinEDA_SetColorsFrame::ShowToolTips()
|
|
|
|
/**********************************************************/
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************/
|
|
|
|
wxBitmap WinEDA_SetColorsFrame::GetBitmapResource( const wxString& name )
|
|
|
|
/**********************************************************/
|
|
|
|
{
|
|
|
|
wxUnusedVar(name);
|
|
|
|
return wxNullBitmap;
|
|
|
|
}
|
2007-09-13 11:55:46 +00:00
|
|
|
|
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
/**********************************************************/
|
|
|
|
wxIcon WinEDA_SetColorsFrame::GetIconResource( const wxString& name )
|
|
|
|
/**********************************************************/
|
|
|
|
{
|
|
|
|
wxUnusedVar(name);
|
|
|
|
return wxNullIcon;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
/**********************************************************/
|
2007-09-13 11:55:46 +00:00
|
|
|
void WinEDA_SetColorsFrame::SetColor( wxCommandEvent& event )
|
2007-10-23 00:36:43 +00:00
|
|
|
/**********************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-09-13 11:55:46 +00:00
|
|
|
int id = event.GetId();
|
|
|
|
int color;
|
2007-10-23 00:36:43 +00:00
|
|
|
|
|
|
|
wxBitmapButton* Button;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
|
|
|
color = DisplayColorFrame( this,
|
2007-10-23 00:36:43 +00:00
|
|
|
CurrentColor[id - ID_COLOR_SETUP] );
|
2007-11-11 06:57:44 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
if( color < 0 )
|
|
|
|
return;
|
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
if( CurrentColor[id - ID_COLOR_SETUP] == color )
|
|
|
|
return;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
CurrentColor[id - ID_COLOR_SETUP] = color;
|
|
|
|
wxMemoryDC iconDC;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
Button = laytool_list[id - ID_COLOR_SETUP]->m_Button;
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
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 );
|
2007-09-13 11:55:46 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
iconDC.SetBrush( Brush );
|
|
|
|
iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
|
|
|
|
Button->SetBitmapLabel( ButtBitmap );
|
|
|
|
Button->Refresh();
|
2007-09-13 11:55:46 +00:00
|
|
|
|
|
|
|
Refresh( FALSE );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
/******************************************************************/
|
|
|
|
void WinEDA_SetColorsFrame::UpdateLayerSettings()
|
|
|
|
/******************************************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-10-23 00:36:43 +00:00
|
|
|
// Update colors for each layer
|
2007-11-11 06:57:44 +00:00
|
|
|
for( int lyr = 0; lyr < NB_BUTT; lyr++ )
|
2007-10-23 00:36:43 +00:00
|
|
|
{
|
2007-11-11 06:57:44 +00:00
|
|
|
// (As a bitmap button 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_Color = CurrentColor[lyr];
|
2007-10-23 00:36:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Update whether grid is actually displayed or otherwise
|
2007-10-23 23:59:33 +00:00
|
|
|
// The previous command compiles OK, but to prevent a warning
|
|
|
|
// from being generated when the Linux version is being compiled,
|
|
|
|
// the next two commands are provided instead.
|
2009-04-05 20:49:15 +00:00
|
|
|
m_Parent->m_Draw_Grid = m_ShowGrid->GetValue();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
// Update color of background
|
2007-09-13 11:55:46 +00:00
|
|
|
if( m_SelBgColor->GetSelection() == 0 )
|
2007-10-23 00:36:43 +00:00
|
|
|
g_DrawBgColor = WHITE;
|
2007-09-13 11:55:46 +00:00
|
|
|
else
|
2007-10-23 00:36:43 +00:00
|
|
|
g_DrawBgColor = BLACK;
|
|
|
|
m_Parent->SetDrawBgColor( g_DrawBgColor );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
|
|
|
|
/**********************************************************************/
|
|
|
|
void WinEDA_SetColorsFrame::OnOkClick( wxCommandEvent& WXUNUSED (event) )
|
|
|
|
/**********************************************************************/
|
|
|
|
{
|
|
|
|
UpdateLayerSettings();
|
2008-12-20 13:12:57 +00:00
|
|
|
m_Parent->DrawPanel->Refresh();
|
2007-10-23 00:36:43 +00:00
|
|
|
EndModal( 1 );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-23 00:36:43 +00:00
|
|
|
/*******************************************************************/
|
|
|
|
void WinEDA_SetColorsFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event) )
|
|
|
|
/*******************************************************************/
|
|
|
|
{
|
|
|
|
EndModal( -1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************/
|
|
|
|
void WinEDA_SetColorsFrame::OnApplyClick( wxCommandEvent& WXUNUSED (event) )
|
|
|
|
/*******************************************************************/
|
|
|
|
{
|
|
|
|
UpdateLayerSettings();
|
2008-12-20 13:12:57 +00:00
|
|
|
m_Parent->DrawPanel->Refresh();
|
2007-10-23 00:36:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************/
|
2007-09-13 11:55:46 +00:00
|
|
|
void SeedLayers()
|
2007-06-05 12:10:51 +00:00
|
|
|
/*************************/
|
|
|
|
{
|
2007-09-13 11:55:46 +00:00
|
|
|
LayerStruct* LayerPointer = &g_LayerDescr;
|
|
|
|
int pt;
|
|
|
|
|
|
|
|
LayerPointer->CommonColor = WHITE;
|
|
|
|
LayerPointer->Flags = 0;
|
|
|
|
pt = 0;
|
|
|
|
LayerPointer->CurrentWidth = 1;
|
|
|
|
|
|
|
|
/* seed Up the Layer colours, set all user layers off */
|
|
|
|
for( pt = 0; pt < MAX_LAYERS; pt++ )
|
|
|
|
{
|
|
|
|
LayerPointer->LayerStatus[pt] = 0;
|
|
|
|
LayerPointer->LayerColor[pt] = DARKGRAY;
|
|
|
|
}
|
|
|
|
|
|
|
|
LayerPointer->NumberOfLayers = pt - 1;
|
|
|
|
/* Couleurs specifiques: Mise a jour par la lecture de la config */
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-12-14 19:45:05 +00:00
|
|
|
/***************************************/
|
|
|
|
EDA_Colors ReturnLayerColor( int Layer )
|
|
|
|
/****************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-10-23 00:36:43 +00:00
|
|
|
if( g_LayerDescr.Flags == 0 )
|
2008-12-14 19:45:05 +00:00
|
|
|
return (EDA_Colors) g_LayerDescr.LayerColor[Layer];
|
2007-09-13 11:55:46 +00:00
|
|
|
else
|
2008-12-14 19:45:05 +00:00
|
|
|
return (EDA_Colors) g_LayerDescr.CommonColor;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|