Browse Source
Restore library editor value field rename behaviour and other minor fixes.
pull/1/head
Restore library editor value field rename behaviour and other minor fixes.
pull/1/head
22 changed files with 671 additions and 831 deletions
-
14CHANGELOG.txt
-
1bitmaps/CMakeLists.txt
-
38bitmaps/copyComponent.xpm
-
2eeschema/CMakeLists.txt
-
18eeschema/class_libentry.cpp
-
14eeschema/class_libentry.h
-
347eeschema/dialogs/dialog_color_config.cpp
-
86eeschema/dialogs/dialog_color_config.h
-
414eeschema/eelayer.cpp
-
335eeschema/eelayer.h
-
35eeschema/eeschema_config.cpp
-
3eeschema/eeschema_id.h
-
1eeschema/general.h
-
18eeschema/libedit.cpp
-
17eeschema/libeditframe.cpp
-
11eeschema/libeditframe.h
-
139eeschema/libfield.cpp
-
1eeschema/protos.h
-
2eeschema/schframe.cpp
-
4eeschema/tool_lib.cpp
-
1include/bitmaps.h
-
1include/wxEeschemaStruct.h
@ -0,0 +1,38 @@ |
|||||
|
/* XPM */ |
||||
|
const char *copyComponent_xpm[] = { |
||||
|
/* columns rows colors chars-per-pixel */ |
||||
|
"16 16 16 1", |
||||
|
"& c #080685", |
||||
|
"; c #CE3338", |
||||
|
". c #098409", |
||||
|
"+ c #ABAAAA", |
||||
|
": c #D44751", |
||||
|
"* c #885684", |
||||
|
"$ c #9794D7", |
||||
|
"@ c #BFB7ED", |
||||
|
"- c #640650", |
||||
|
" c None", |
||||
|
"= c #F80B0C", |
||||
|
"O c #ECECFC", |
||||
|
"# c #7F6CB6", |
||||
|
"% c #D3CFF7", |
||||
|
"o c #147A04", |
||||
|
"X c #4E9C54", |
||||
|
/* pixels */ |
||||
|
" .......X ", |
||||
|
" oOOOOO X.+ ", |
||||
|
"oo.OO@#$@%XX ", |
||||
|
" +oOO$&&&$+.+ ", |
||||
|
" oOO$&&&&@ooo+ ", |
||||
|
" .O%%@$&&*.++++", |
||||
|
" .%====-&-;+ ", |
||||
|
".oo@=O%@#&&*=+ ", |
||||
|
"++===O#&&&&&&: ", |
||||
|
" +=OO#&&&&#=++", |
||||
|
" + =OO%#&&$@===", |
||||
|
" =O%%%#$%#=++", |
||||
|
" +=%O%%%@%;;+ ", |
||||
|
" ===@@@@@$:=++ ", |
||||
|
" ++=======;++ ", |
||||
|
" ++++++++ " |
||||
|
}; |
||||
@ -0,0 +1,347 @@ |
|||||
|
|
||||
|
/* Set up color Layers for EESchema
|
||||
|
*/ |
||||
|
|
||||
|
#include "fctsys.h"
|
||||
|
#include "gr_basic.h"
|
||||
|
#include "common.h"
|
||||
|
#include "wxstruct.h"
|
||||
|
#include "class_drawpanel.h"
|
||||
|
|
||||
|
#include "general.h"
|
||||
|
#include "protos.h"
|
||||
|
|
||||
|
#include "dialog_color_config.h"
|
||||
|
|
||||
|
|
||||
|
#define ID_COLOR_SETUP 1800
|
||||
|
|
||||
|
|
||||
|
static ColorButton GeneralColorButtons[] = { |
||||
|
{ _( "Wire" ), LAYER_WIRE }, |
||||
|
{ _( "Bus" ), LAYER_BUS }, |
||||
|
{ _( "Junction" ), LAYER_JUNCTION }, |
||||
|
{ _( "Label" ), LAYER_LOCLABEL }, |
||||
|
{ _( "Global label" ), LAYER_GLOBLABEL }, |
||||
|
{ _( "Net name" ), LAYER_NETNAM }, |
||||
|
{ _( "Notes" ), LAYER_NOTES }, |
||||
|
{ _( "No connection" ), LAYER_NOCONNECT }, |
||||
|
{ wxT( "" ), -1 } // Sentinel marking end of list.
|
||||
|
}; |
||||
|
|
||||
|
static ColorButton ComponentColorButtons[] = { |
||||
|
{ _( "Body" ), LAYER_DEVICE }, |
||||
|
{ _( "Body background" ), LAYER_DEVICE_BACKGROUND }, |
||||
|
{ _( "Pin" ), LAYER_PIN }, |
||||
|
{ _( "Pin number" ), LAYER_PINNUM }, |
||||
|
{ _( "Pin name" ), LAYER_PINNAM }, |
||||
|
{ _( "Reference" ), LAYER_REFERENCEPART }, |
||||
|
{ _( "Value" ), LAYER_VALUEPART }, |
||||
|
{ _( "Fields" ), LAYER_FIELDS }, |
||||
|
{ wxT( "" ), -1 } // Sentinel marking end of list.
|
||||
|
}; |
||||
|
|
||||
|
static ColorButton SheetColorButtons[] = { |
||||
|
{ _( "Sheet" ), LAYER_SHEET }, |
||||
|
{ _( "Sheet file name" ), LAYER_SHEETFILENAME }, |
||||
|
{ _( "Sheet name" ), LAYER_SHEETNAME }, |
||||
|
{ _( "Hierarchical label" ), LAYER_HIERLABEL }, |
||||
|
{ wxT( "" ), -1 } // Sentinel marking end of list.
|
||||
|
}; |
||||
|
|
||||
|
static ColorButton MiscColorButtons[] = { |
||||
|
{ _( "Erc warning" ), LAYER_ERC_WARN }, |
||||
|
{ _( "Erc error" ), LAYER_ERC_ERR }, |
||||
|
{ _( "Grid" ), LAYER_GRID }, |
||||
|
{ wxT( "" ), -1 } // Sentinel marking end of list.
|
||||
|
}; |
||||
|
|
||||
|
|
||||
|
static ButtonIndex buttonGroups[] = { |
||||
|
{ _( "General" ), GeneralColorButtons }, |
||||
|
{ _( "Component" ), ComponentColorButtons }, |
||||
|
{ _( "Sheet" ), SheetColorButtons }, |
||||
|
{ _( "Miscellaneous" ), MiscColorButtons }, |
||||
|
{ wxT( "" ), NULL } |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
static int currentColors[ MAX_LAYER ]; |
||||
|
|
||||
|
|
||||
|
IMPLEMENT_DYNAMIC_CLASS( DIALOG_COLOR_CONFIG, wxDialog ) |
||||
|
|
||||
|
|
||||
|
DIALOG_COLOR_CONFIG::DIALOG_COLOR_CONFIG() |
||||
|
{ |
||||
|
Init(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
DIALOG_COLOR_CONFIG::DIALOG_COLOR_CONFIG( WinEDA_DrawFrame* aParent ) |
||||
|
{ |
||||
|
m_Parent = aParent; |
||||
|
Init(); |
||||
|
Create( aParent ); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
DIALOG_COLOR_CONFIG::~DIALOG_COLOR_CONFIG() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
|
||||
|
bool DIALOG_COLOR_CONFIG::Create( wxWindow* aParent, |
||||
|
wxWindowID aId, |
||||
|
const wxString& aCaption, |
||||
|
const wxPoint& aPosition, |
||||
|
const wxSize& aSize, |
||||
|
long aStyle ) |
||||
|
{ |
||||
|
SetExtraStyle( wxWS_EX_BLOCK_EVENTS ); |
||||
|
wxDialog::Create( aParent, aId, aCaption, aPosition, aSize, aStyle ); |
||||
|
|
||||
|
CreateControls(); |
||||
|
|
||||
|
if( GetSizer() ) |
||||
|
{ |
||||
|
GetSizer()->SetSizeHints( this ); |
||||
|
} |
||||
|
|
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void DIALOG_COLOR_CONFIG::Init() |
||||
|
{ |
||||
|
OuterBoxSizer = NULL; |
||||
|
MainBoxSizer = NULL; |
||||
|
ColumnBoxSizer = NULL; |
||||
|
RowBoxSizer = NULL; |
||||
|
BitmapButton = NULL; |
||||
|
m_SelBgColor = NULL; |
||||
|
Line = NULL; |
||||
|
StdDialogButtonSizer = NULL; |
||||
|
Button = NULL; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void DIALOG_COLOR_CONFIG::CreateControls() |
||||
|
{ |
||||
|
wxStaticText* label; |
||||
|
int color; |
||||
|
int buttonId = 1800; |
||||
|
ButtonIndex* groups = buttonGroups; |
||||
|
|
||||
|
OuterBoxSizer = new wxBoxSizer( wxVERTICAL ); |
||||
|
SetSizer( OuterBoxSizer ); |
||||
|
|
||||
|
MainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); |
||||
|
OuterBoxSizer->Add( MainBoxSizer, 1, wxGROW | wxLEFT | wxRIGHT, 5 ); |
||||
|
|
||||
|
while( groups->m_Buttons != NULL ) |
||||
|
{ |
||||
|
ColorButton* buttons = groups->m_Buttons; |
||||
|
|
||||
|
ColumnBoxSizer = new wxBoxSizer( wxVERTICAL ); |
||||
|
MainBoxSizer->Add( ColumnBoxSizer, 1, wxALIGN_TOP | wxLEFT | wxTOP, 5 ); |
||||
|
RowBoxSizer = new wxBoxSizer( wxHORIZONTAL ); |
||||
|
ColumnBoxSizer->Add( RowBoxSizer, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); |
||||
|
|
||||
|
// Add a text string to identify the column of color select buttons.
|
||||
|
label = new wxStaticText( this, wxID_ANY, groups->m_Name ); |
||||
|
|
||||
|
// Make the column label font bold.
|
||||
|
wxFont font( label->GetFont() ); |
||||
|
font.SetWeight( wxFONTWEIGHT_BOLD ); |
||||
|
label->SetFont( font ); |
||||
|
|
||||
|
RowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); |
||||
|
|
||||
|
while( buttons->m_Layer >= 0 ) |
||||
|
{ |
||||
|
RowBoxSizer = new wxBoxSizer( wxHORIZONTAL ); |
||||
|
ColumnBoxSizer->Add( RowBoxSizer, 0, wxGROW | wxALL, 0 ); |
||||
|
|
||||
|
wxMemoryDC iconDC; |
||||
|
wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y ); |
||||
|
|
||||
|
iconDC.SelectObject( bitmap ); |
||||
|
color = currentColors[ buttons->m_Layer ] = g_LayerDescr.LayerColor[ buttons->m_Layer ]; |
||||
|
iconDC.SetPen( *wxBLACK_PEN ); |
||||
|
wxBrush brush; |
||||
|
brush.SetColour( ColorRefs[ color ].m_Red, |
||||
|
ColorRefs[ color ].m_Green, |
||||
|
ColorRefs[ color ].m_Blue ); |
||||
|
brush.SetStyle( wxSOLID ); |
||||
|
|
||||
|
iconDC.SetBrush( brush ); |
||||
|
iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y ); |
||||
|
|
||||
|
BitmapButton = new wxBitmapButton( this, buttonId, bitmap, wxDefaultPosition, |
||||
|
wxSize( BUTT_SIZE_X+8, BUTT_SIZE_Y+6 ) ); |
||||
|
BitmapButton->SetClientData( (void*) buttons ); |
||||
|
RowBoxSizer->Add( BitmapButton, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 ); |
||||
|
|
||||
|
label = new wxStaticText( this, wxID_ANY, wxGetTranslation( buttons->m_Name ) ); |
||||
|
RowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 ); |
||||
|
buttonId += 1; |
||||
|
buttons++; |
||||
|
} |
||||
|
|
||||
|
groups++; |
||||
|
} |
||||
|
|
||||
|
Connect( 1800, buttonId - 1, wxEVT_COMMAND_BUTTON_CLICKED, |
||||
|
wxCommandEventHandler( DIALOG_COLOR_CONFIG::SetColor ) ); |
||||
|
|
||||
|
// Add a spacer to improve appearance.
|
||||
|
ColumnBoxSizer->AddSpacer( 5 ); |
||||
|
|
||||
|
wxArrayString m_SelBgColorStrings; |
||||
|
m_SelBgColorStrings.Add( _( "White" ) ); |
||||
|
m_SelBgColorStrings.Add( _( "Black" ) ); |
||||
|
m_SelBgColor = new wxRadioBox( this, wxID_ANY, _( "Background Color" ), |
||||
|
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 ); |
||||
|
|
||||
|
// 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 ); |
||||
|
StdDialogButtonSizer->AddButton( Button ); |
||||
|
|
||||
|
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 ); |
||||
|
StdDialogButtonSizer->AddButton( Button ); |
||||
|
Button->SetFocus(); |
||||
|
|
||||
|
Button = new wxButton( this, wxID_APPLY, _( "Apply" ), wxDefaultPosition, wxDefaultSize, 0 ); |
||||
|
StdDialogButtonSizer->AddButton( Button ); |
||||
|
|
||||
|
Connect( wxID_OK, wxEVT_COMMAND_BUTTON_CLICKED, |
||||
|
wxCommandEventHandler( DIALOG_COLOR_CONFIG::OnOkClick ) ); |
||||
|
Connect( wxID_CANCEL, wxEVT_COMMAND_BUTTON_CLICKED, |
||||
|
wxCommandEventHandler( DIALOG_COLOR_CONFIG::OnCancelClick ) ); |
||||
|
Connect( wxID_APPLY, wxEVT_COMMAND_BUTTON_CLICKED, |
||||
|
wxCommandEventHandler( DIALOG_COLOR_CONFIG::OnApplyClick ) ); |
||||
|
|
||||
|
StdDialogButtonSizer->Realize(); |
||||
|
|
||||
|
// Dialog now needs to be resized, but the associated command is found elsewhere.
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event ) |
||||
|
{ |
||||
|
wxBitmapButton* button = (wxBitmapButton*) event.GetEventObject(); |
||||
|
|
||||
|
wxCHECK_RET( button != NULL, wxT( "Color button event object is NULL." ) ); |
||||
|
|
||||
|
ColorButton* colorButton = (ColorButton*) button->GetClientData(); |
||||
|
|
||||
|
wxCHECK_RET( colorButton != NULL, wxT( "Client data not set for color button." ) ); |
||||
|
|
||||
|
int color = DisplayColorFrame( this, colorButton->m_Layer ); |
||||
|
|
||||
|
if( color < 0 || currentColors[ colorButton->m_Layer ] == color ) |
||||
|
return; |
||||
|
|
||||
|
currentColors[ colorButton->m_Layer ] = color; |
||||
|
|
||||
|
wxMemoryDC iconDC; |
||||
|
|
||||
|
wxBitmap bitmap = button->GetBitmapLabel(); |
||||
|
iconDC.SelectObject( bitmap ); |
||||
|
wxBrush brush; |
||||
|
iconDC.SetPen( *wxBLACK_PEN ); |
||||
|
brush.SetColour( ColorRefs[ color ].m_Red, |
||||
|
ColorRefs[ color ].m_Green, |
||||
|
ColorRefs[ color ].m_Blue ); |
||||
|
brush.SetStyle( wxSOLID ); |
||||
|
|
||||
|
iconDC.SetBrush( brush ); |
||||
|
iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y ); |
||||
|
button->SetBitmapLabel( bitmap ); |
||||
|
button->Refresh(); |
||||
|
|
||||
|
Refresh( false ); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void DIALOG_COLOR_CONFIG::UpdateLayerSettings() |
||||
|
{ |
||||
|
for( int i = 0; i < MAX_LAYERS; i++ ) |
||||
|
g_LayerDescr.LayerColor[ i ] = currentColors[ i ]; |
||||
|
|
||||
|
// Update color of background
|
||||
|
if( m_SelBgColor->GetSelection() == 0 ) |
||||
|
g_DrawBgColor = WHITE; |
||||
|
else |
||||
|
g_DrawBgColor = BLACK; |
||||
|
|
||||
|
m_Parent->Refresh(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void DIALOG_COLOR_CONFIG::OnOkClick( wxCommandEvent& WXUNUSED( event ) ) |
||||
|
{ |
||||
|
UpdateLayerSettings(); |
||||
|
m_Parent->DrawPanel->Refresh(); |
||||
|
EndModal( 1 ); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void DIALOG_COLOR_CONFIG::OnCancelClick( wxCommandEvent& WXUNUSED( event ) ) |
||||
|
{ |
||||
|
EndModal( -1 ); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void DIALOG_COLOR_CONFIG::OnApplyClick( wxCommandEvent& WXUNUSED( event ) ) |
||||
|
{ |
||||
|
UpdateLayerSettings(); |
||||
|
m_Parent->DrawPanel->Refresh(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void SeedLayers() |
||||
|
{ |
||||
|
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; |
||||
|
/* Specific colors: update by reading the config. */ |
||||
|
} |
||||
|
|
||||
|
|
||||
|
EDA_Colors ReturnLayerColor( int Layer ) |
||||
|
{ |
||||
|
if( g_LayerDescr.Flags == 0 ) |
||||
|
return (EDA_Colors) g_LayerDescr.LayerColor[Layer]; |
||||
|
else |
||||
|
return (EDA_Colors) g_LayerDescr.CommonColor; |
||||
|
} |
||||
@ -0,0 +1,86 @@ |
|||||
|
|
||||
|
#ifndef _DIALOG_COLOR_CONFIG_H_ |
||||
|
#define _DIALOG_COLOR_CONFIG_H_ |
||||
|
|
||||
|
#include "wx/statline.h" |
||||
|
|
||||
|
|
||||
|
class wxBoxSizer; |
||||
|
class wxStaticLine; |
||||
|
class wxStdDialogButtonSizer; |
||||
|
|
||||
|
|
||||
|
// Specify the width and height of every (color-displaying / bitmap) button |
||||
|
const int BUTT_SIZE_X = 16; |
||||
|
const int BUTT_SIZE_Y = 16; |
||||
|
|
||||
|
|
||||
|
/********************/ |
||||
|
/* Layer menu list. */ |
||||
|
/********************/ |
||||
|
|
||||
|
struct ColorButton |
||||
|
{ |
||||
|
wxString m_Name; |
||||
|
int m_Layer; |
||||
|
}; |
||||
|
|
||||
|
struct ButtonIndex |
||||
|
{ |
||||
|
wxString m_Name; |
||||
|
ColorButton* m_Buttons; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
/***********************************************/ |
||||
|
/* Derived class for the frame color settings. */ |
||||
|
/***********************************************/ |
||||
|
|
||||
|
class DIALOG_COLOR_CONFIG: public wxDialog |
||||
|
{ |
||||
|
private: |
||||
|
DECLARE_DYNAMIC_CLASS( DIALOG_COLOR_CONFIG ) |
||||
|
|
||||
|
WinEDA_DrawFrame* m_Parent; |
||||
|
wxBoxSizer* OuterBoxSizer; |
||||
|
wxBoxSizer* MainBoxSizer; |
||||
|
wxBoxSizer* ColumnBoxSizer; |
||||
|
wxBoxSizer* RowBoxSizer; |
||||
|
wxBitmapButton* BitmapButton; |
||||
|
wxRadioBox* m_SelBgColor; |
||||
|
wxStaticLine* Line; |
||||
|
wxStdDialogButtonSizer* StdDialogButtonSizer; |
||||
|
wxButton* Button; |
||||
|
|
||||
|
// Creation |
||||
|
bool Create( wxWindow* aParent, |
||||
|
wxWindowID aId = wxID_ANY, |
||||
|
const wxString& aCaption = _( "EESchema Colors" ), |
||||
|
const wxPoint& aPosition = wxDefaultPosition, |
||||
|
const wxSize& aSize = wxDefaultSize, |
||||
|
long aStyle = wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER ); |
||||
|
|
||||
|
// Initializes member variables |
||||
|
void Init(); |
||||
|
|
||||
|
// Creates the controls and sizers |
||||
|
void CreateControls(); |
||||
|
|
||||
|
wxBitmap GetBitmapResource( const wxString& aName ); |
||||
|
wxIcon GetIconResource( const wxString& aName ); |
||||
|
static bool ShowToolTips(); |
||||
|
|
||||
|
void UpdateLayerSettings(); |
||||
|
void SetColor( wxCommandEvent& aEvent ); |
||||
|
void OnOkClick( wxCommandEvent& aEvent ); |
||||
|
void OnCancelClick( wxCommandEvent& aEvent ); |
||||
|
void OnApplyClick( wxCommandEvent& aEvent ); |
||||
|
|
||||
|
public: |
||||
|
// Constructors and destructor |
||||
|
DIALOG_COLOR_CONFIG(); |
||||
|
DIALOG_COLOR_CONFIG( WinEDA_DrawFrame* aParent ); |
||||
|
~DIALOG_COLOR_CONFIG(); |
||||
|
}; |
||||
|
|
||||
|
#endif // _DIALOG_COLOR_CONFIG_H_ |
||||
@ -1,414 +0,0 @@ |
|||||
/***************/ |
|
||||
/* eelayer.cpp */ |
|
||||
/***************/ |
|
||||
|
|
||||
/* Set up color Layers for EESchema
|
|
||||
*/ |
|
||||
|
|
||||
#include "fctsys.h"
|
|
||||
#include "gr_basic.h"
|
|
||||
#include "common.h"
|
|
||||
#include "eeschema_id.h"
|
|
||||
#include "wxstruct.h"
|
|
||||
#include "class_drawpanel.h"
|
|
||||
|
|
||||
#include "general.h"
|
|
||||
#include "protos.h"
|
|
||||
|
|
||||
#include "eelayer.h" // Header file associated with this file
|
|
||||
|
|
||||
// Local variables:
|
|
||||
static int CurrentColor[NB_BUTT]; // Holds color for each layer while dialog box open
|
|
||||
|
|
||||
IMPLEMENT_DYNAMIC_CLASS( WinEDA_SetColorsFrame, wxDialog ) |
|
||||
|
|
||||
// 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() |
|
||||
|
|
||||
|
|
||||
/**************************************************************/ |
|
||||
void DisplayColorSetupFrame( WinEDA_DrawFrame* parent, |
|
||||
const wxPoint& framepos ) |
|
||||
{ |
|
||||
/**************************************************************/ |
|
||||
WinEDA_SetColorsFrame* frame = |
|
||||
new WinEDA_SetColorsFrame( parent, framepos ); |
|
||||
|
|
||||
frame->ShowModal(); |
|
||||
frame->Destroy(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
// Default Constructor (whose provision is mandated by the inclusion
|
|
||||
// of DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame ) within eelayer.h)
|
|
||||
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame() |
|
||||
{ |
|
||||
Init(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
// Standard Constructor
|
|
||||
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent, |
|
||||
const wxPoint& framepos ) |
|
||||
{ |
|
||||
m_Parent = parent; |
|
||||
Init(); |
|
||||
Create( parent, |
|
||||
SYMBOL_WINEDA_SETCOLORSFRAME_IDNAME, |
|
||||
SYMBOL_WINEDA_SETCOLORSFRAME_TITLE, |
|
||||
framepos, |
|
||||
wxDefaultSize, |
|
||||
SYMBOL_WINEDA_SETCOLORSFRAME_STYLE ); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
// Destructor
|
|
||||
WinEDA_SetColorsFrame::~WinEDA_SetColorsFrame() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/**********************************************************/ |
|
||||
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; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/**********************************************************/ |
|
||||
void WinEDA_SetColorsFrame::Init() |
|
||||
{ |
|
||||
/**********************************************************/ |
|
||||
OuterBoxSizer = NULL; |
|
||||
MainBoxSizer = NULL; |
|
||||
ColumnBoxSizer = NULL; |
|
||||
RowBoxSizer = NULL; |
|
||||
Label = NULL; |
|
||||
BitmapButton = NULL; |
|
||||
m_ShowGrid = NULL; |
|
||||
m_SelBgColor = NULL; |
|
||||
Line = NULL; |
|
||||
StdDialogButtonSizer = NULL; |
|
||||
Button = NULL; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/**********************************************************/ |
|
||||
void WinEDA_SetColorsFrame::CreateControls() |
|
||||
{ |
|
||||
/**********************************************************/ |
|
||||
int lyr, grp, butt_ID, buttcolor; |
|
||||
|
|
||||
OuterBoxSizer = new wxBoxSizer( wxVERTICAL ); |
|
||||
SetSizer( OuterBoxSizer ); |
|
||||
|
|
||||
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, grp = 0; lyr < NB_BUTT; lyr++ ) |
|
||||
{ |
|
||||
// Look for the initial button of each group of controls.
|
|
||||
if( lyr == 0 || lyr == laytool_index[grp]->m_Index + 1 ) |
|
||||
{ |
|
||||
if( lyr != 0 ) |
|
||||
grp++; |
|
||||
|
|
||||
// Add another column sizer, unless the current value of
|
|
||||
// grp is BUTTON_GROUPS - 1. (The very last group of controls
|
|
||||
// differs from the previous groups in that its associated
|
|
||||
// controls are located in the same column as the controls
|
|
||||
// associated with the preceeding group.)
|
|
||||
if( grp < BUTTON_GROUPS - 1 ) |
|
||||
{ |
|
||||
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 ); |
|
||||
} |
|
||||
|
|
||||
RowBoxSizer = new wxBoxSizer( wxHORIZONTAL ); |
|
||||
ColumnBoxSizer->Add( RowBoxSizer, |
|
||||
0, |
|
||||
wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, |
|
||||
5 ); |
|
||||
|
|
||||
// Add a text string to identify the following set of controls
|
|
||||
Label = new wxStaticText( this, -1, laytool_index[grp]->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() ) ); |
|
||||
|
|
||||
RowBoxSizer->Add( Label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); |
|
||||
} |
|
||||
|
|
||||
RowBoxSizer = new wxBoxSizer( wxHORIZONTAL ); |
|
||||
ColumnBoxSizer->Add( RowBoxSizer, 0, wxGROW | wxALL, 0 ); |
|
||||
|
|
||||
butt_ID = ID_COLOR_SETUP + lyr; |
|
||||
laytool_list[lyr]->m_Id = butt_ID; |
|
||||
wxMemoryDC iconDC; |
|
||||
wxBitmap ButtBitmap( BUTT_SIZE_X, BUTT_SIZE_Y ); |
|
||||
|
|
||||
iconDC.SelectObject( ButtBitmap ); |
|
||||
buttcolor = *laytool_list[lyr]->m_Color; |
|
||||
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+8, BUTT_SIZE_Y+6 ) ); |
|
||||
RowBoxSizer->Add( BitmapButton, |
|
||||
0, |
|
||||
wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, |
|
||||
5 ); |
|
||||
|
|
||||
laytool_list[lyr]->m_Button = BitmapButton; |
|
||||
|
|
||||
// Add a text string, unless the current value of lyr is NB_BUTT - 1
|
|
||||
if( lyr < NB_BUTT - 1 ) |
|
||||
{ |
|
||||
Label = |
|
||||
new wxStaticText( this, wxID_STATIC, |
|
||||
wxGetTranslation( laytool_list[lyr]->m_Name ), |
|
||||
wxDefaultPosition, wxDefaultSize, 0 ); |
|
||||
RowBoxSizer->Add( Label, 1, wxALIGN_CENTER_VERTICAL | wxBOTTOM, 5 ); |
|
||||
} |
|
||||
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->IsGridVisible() ); |
|
||||
RowBoxSizer->Add( m_ShowGrid, |
|
||||
1, |
|
||||
wxALIGN_CENTER_VERTICAL | wxBOTTOM, |
|
||||
5 ); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
// Add a spacer to improve appearance.
|
|
||||
ColumnBoxSizer->AddSpacer( 5 ); |
|
||||
|
|
||||
wxArrayString m_SelBgColorStrings; |
|
||||
m_SelBgColorStrings.Add( _( "White" ) ); |
|
||||
m_SelBgColorStrings.Add( _( "Black" ) ); |
|
||||
m_SelBgColor = |
|
||||
new wxRadioBox( this, ID_RADIOBOX_BACKGROUND_COLOR, |
|
||||
_( "Background Color:" ), |
|
||||
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 ); |
|
||||
|
|
||||
// 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 ); |
|
||||
StdDialogButtonSizer->AddButton( Button ); |
|
||||
|
|
||||
Button = new wxButton( this, wxID_CANCEL, _( "Cancel" ), |
|
||||
wxDefaultPosition, wxDefaultSize, 0 ); |
|
||||
StdDialogButtonSizer->AddButton( Button ); |
|
||||
Button->SetFocus(); |
|
||||
|
|
||||
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 found
|
|
||||
// elsewhere.)
|
|
||||
} |
|
||||
|
|
||||
|
|
||||
/**********************************************************/ |
|
||||
void WinEDA_SetColorsFrame::SetColor( wxCommandEvent& event ) |
|
||||
{ |
|
||||
/**********************************************************/ |
|
||||
int id = event.GetId(); |
|
||||
int color; |
|
||||
|
|
||||
wxBitmapButton* Button; |
|
||||
|
|
||||
color = DisplayColorFrame( this, |
|
||||
CurrentColor[id - ID_COLOR_SETUP] ); |
|
||||
|
|
||||
if( color < 0 ) |
|
||||
return; |
|
||||
|
|
||||
if( CurrentColor[id - ID_COLOR_SETUP] == color ) |
|
||||
return; |
|
||||
|
|
||||
CurrentColor[id - ID_COLOR_SETUP] = color; |
|
||||
wxMemoryDC iconDC; |
|
||||
|
|
||||
Button = laytool_list[id - ID_COLOR_SETUP]->m_Button; |
|
||||
|
|
||||
wxBitmap ButtBitmap = Button->GetBitmapLabel(); |
|
||||
iconDC.SelectObject( ButtBitmap ); |
|
||||
wxBrush Brush; |
|
||||
iconDC.SetPen( *wxBLACK_PEN ); |
|
||||
Brush.SetColour( ColorRefs[color].m_Red, |
|
||||
ColorRefs[color].m_Green, |
|
||||
ColorRefs[color].m_Blue ); |
|
||||
Brush.SetStyle( wxSOLID ); |
|
||||
|
|
||||
iconDC.SetBrush( Brush ); |
|
||||
iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y ); |
|
||||
Button->SetBitmapLabel( ButtBitmap ); |
|
||||
Button->Refresh(); |
|
||||
|
|
||||
Refresh( FALSE ); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/******************************************************************/ |
|
||||
void WinEDA_SetColorsFrame::UpdateLayerSettings() |
|
||||
{ |
|
||||
/******************************************************************/ |
|
||||
// Update colors for each layer
|
|
||||
for( int lyr = 0; lyr < NB_BUTT; lyr++ ) |
|
||||
{ |
|
||||
// (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]; |
|
||||
} |
|
||||
|
|
||||
// Update whether grid is actually displayed or otherwise
|
|
||||
// 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.
|
|
||||
m_Parent->SetGridVisibility( m_ShowGrid->GetValue() ); |
|
||||
|
|
||||
// Update color of background
|
|
||||
if( m_SelBgColor->GetSelection() == 0 ) |
|
||||
g_DrawBgColor = WHITE; |
|
||||
else |
|
||||
g_DrawBgColor = BLACK; |
|
||||
|
|
||||
m_Parent->Refresh(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/**********************************************************************/ |
|
||||
void WinEDA_SetColorsFrame::OnOkClick( wxCommandEvent& WXUNUSED( event ) ) |
|
||||
{ |
|
||||
/**********************************************************************/ |
|
||||
UpdateLayerSettings(); |
|
||||
m_Parent->DrawPanel->Refresh(); |
|
||||
EndModal( 1 ); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/*******************************************************************/ |
|
||||
void WinEDA_SetColorsFrame::OnCancelClick( wxCommandEvent& WXUNUSED( event ) ) |
|
||||
{ |
|
||||
/*******************************************************************/ |
|
||||
EndModal( -1 ); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/*******************************************************************/ |
|
||||
void WinEDA_SetColorsFrame::OnApplyClick( wxCommandEvent& WXUNUSED( event ) ) |
|
||||
{ |
|
||||
/*******************************************************************/ |
|
||||
UpdateLayerSettings(); |
|
||||
m_Parent->DrawPanel->Refresh(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/*************************/ |
|
||||
void SeedLayers() |
|
||||
{ |
|
||||
/*************************/ |
|
||||
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; |
|
||||
/* Specific colors: update by reading the config. */ |
|
||||
} |
|
||||
|
|
||||
|
|
||||
/***************************************/ |
|
||||
EDA_Colors ReturnLayerColor( int Layer ) |
|
||||
{ |
|
||||
/****************************************/ |
|
||||
if( g_LayerDescr.Flags == 0 ) |
|
||||
return (EDA_Colors) g_LayerDescr.LayerColor[Layer]; |
|
||||
else |
|
||||
return (EDA_Colors) g_LayerDescr.CommonColor; |
|
||||
} |
|
||||
@ -1,335 +0,0 @@ |
|||||
/*************/ |
|
||||
/* eelayer.h */ |
|
||||
/*************/ |
|
||||
|
|
||||
#ifndef _EELAYER_H_ |
|
||||
#define _EELAYER_H_ |
|
||||
|
|
||||
#include "wx/statline.h" |
|
||||
|
|
||||
#include "general.h" |
|
||||
|
|
||||
|
|
||||
class wxBoxSizer; |
|
||||
class wxStaticLine; |
|
||||
class wxStdDialogButtonSizer; |
|
||||
|
|
||||
|
|
||||
// Specify how many elements are contained within laytool_list[] |
|
||||
const int NB_BUTT = 23; // Includes an element associated with the grid |
|
||||
|
|
||||
// Specify how many elements are contained within laytool_index[] |
|
||||
const int BUTTON_GROUPS = 5; |
|
||||
|
|
||||
// Specify the numbers associated with assorted controls |
|
||||
enum col_sel_id { |
|
||||
ID_DIALOG = 1800, |
|
||||
ID_CHECKBOX_SHOW_GRID, |
|
||||
ID_RADIOBOX_BACKGROUND_COLOR, |
|
||||
ID_COLOR_SETUP |
|
||||
}; |
|
||||
|
|
||||
// #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 _("EESchema 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 = 16; |
|
||||
const int BUTT_SIZE_Y = 16; |
|
||||
|
|
||||
// Macro utile : |
|
||||
#define ADR( numlayer ) & (g_LayerDescr.LayerColor[numlayer]) |
|
||||
|
|
||||
|
|
||||
/********************/ |
|
||||
/* Layer menu list. */ |
|
||||
/********************/ |
|
||||
|
|
||||
struct ColorButton |
|
||||
{ |
|
||||
wxString m_Name; |
|
||||
int* m_Color; |
|
||||
int m_Id; |
|
||||
wxBitmapButton* m_Button; |
|
||||
}; |
|
||||
|
|
||||
struct ButtonIndex |
|
||||
{ |
|
||||
wxString m_Name; // Title |
|
||||
int m_Index; // Index to last bitmap button in group |
|
||||
}; |
|
||||
|
|
||||
|
|
||||
static ColorButton Layer_Wire_Item = |
|
||||
{ |
|
||||
_( "Wire" ), // Title |
|
||||
ADR( LAYER_WIRE ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_Bus_Item = |
|
||||
{ |
|
||||
_( "Bus" ), // Title |
|
||||
ADR( LAYER_BUS ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_Junction_Item = |
|
||||
{ |
|
||||
_( "Junction" ), // Title |
|
||||
ADR( LAYER_JUNCTION ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_LocalLabel_Item = |
|
||||
{ |
|
||||
_( "Label" ), // Title |
|
||||
ADR( LAYER_LOCLABEL ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_GlobLabel_Item = |
|
||||
{ |
|
||||
_( "GlobLabel" ), // Title |
|
||||
ADR( LAYER_GLOBLABEL ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_NetNam_Item = |
|
||||
{ |
|
||||
_( "Netname" ), // Title |
|
||||
ADR( LAYER_NETNAM ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_Notes_Item = |
|
||||
{ |
|
||||
_( "Notes" ), // Title |
|
||||
ADR( LAYER_NOTES ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_NoConnect_Item = |
|
||||
{ |
|
||||
_( "NoConn" ), // Title |
|
||||
ADR( LAYER_NOCONNECT ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
|
|
||||
static ColorButton Layer_BodyDevice_Item = |
|
||||
{ |
|
||||
_( "Body" ), // Title |
|
||||
ADR( LAYER_DEVICE ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_BodyBackgroundDevice_Item = |
|
||||
{ |
|
||||
_( "Body Bg" ), // Title |
|
||||
ADR( LAYER_DEVICE_BACKGROUND ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_Pin_Item = |
|
||||
{ |
|
||||
_( "Pin" ), // Title |
|
||||
ADR( LAYER_PIN ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_PinNum_Item = |
|
||||
{ |
|
||||
_( "PinNum" ), // Title |
|
||||
ADR( LAYER_PINNUM ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_PinNam_Item = |
|
||||
{ |
|
||||
_( "PinNam" ), // Title |
|
||||
ADR( LAYER_PINNAM ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_Reference_Item = |
|
||||
{ |
|
||||
_( "Reference" ), // Title |
|
||||
ADR( LAYER_REFERENCEPART ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_Value_Item = |
|
||||
{ |
|
||||
_( "Value" ), // Title |
|
||||
ADR( LAYER_VALUEPART ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_Fields_Item = |
|
||||
{ |
|
||||
_( "Fields" ), // Title |
|
||||
ADR( LAYER_FIELDS ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
|
|
||||
static ColorButton Layer_Sheet_Item = |
|
||||
{ |
|
||||
_( "Sheet" ), // Title |
|
||||
ADR( LAYER_SHEET ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_SheetFileName_Item = |
|
||||
{ |
|
||||
_( "Sheetfile" ), // Title |
|
||||
ADR( LAYER_SHEETFILENAME ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_SheetName_Item = |
|
||||
{ |
|
||||
_( "SheetName" ), // Title |
|
||||
ADR( LAYER_SHEETNAME ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_SheetLabel_Item = |
|
||||
{ |
|
||||
_( "SheetLabel (Pin Sheet)" ), // Title |
|
||||
ADR( LAYER_SHEETLABEL ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_HierarchicalLabel_Item = |
|
||||
{ |
|
||||
_( "Hierarchical Label" ), // Title |
|
||||
ADR( LAYER_HIERLABEL ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_Erc_Warning_Item = |
|
||||
{ |
|
||||
_( "Erc Warning" ), // Title |
|
||||
ADR( LAYER_ERC_WARN ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
static ColorButton Layer_Erc_Error_Item = |
|
||||
{ |
|
||||
_( "Erc Error" ), // Title |
|
||||
ADR( LAYER_ERC_ERR ) // Adr of optional parameter |
|
||||
}; |
|
||||
|
|
||||
|
|
||||
static ColorButton* laytool_list[NB_BUTT] = { |
|
||||
&Layer_Wire_Item, |
|
||||
&Layer_Bus_Item, |
|
||||
&Layer_Junction_Item, |
|
||||
&Layer_LocalLabel_Item, |
|
||||
&Layer_GlobLabel_Item, |
|
||||
&Layer_NetNam_Item, |
|
||||
&Layer_Notes_Item, |
|
||||
&Layer_NoConnect_Item, |
|
||||
|
|
||||
&Layer_BodyDevice_Item, |
|
||||
&Layer_BodyBackgroundDevice_Item, |
|
||||
&Layer_Pin_Item, |
|
||||
&Layer_PinNum_Item, |
|
||||
&Layer_PinNam_Item, |
|
||||
&Layer_Reference_Item, |
|
||||
&Layer_Value_Item, |
|
||||
&Layer_Fields_Item, |
|
||||
|
|
||||
&Layer_Sheet_Item, |
|
||||
&Layer_SheetFileName_Item, |
|
||||
&Layer_SheetName_Item, |
|
||||
&Layer_SheetLabel_Item, |
|
||||
&Layer_HierarchicalLabel_Item, |
|
||||
|
|
||||
&Layer_Erc_Warning_Item, |
|
||||
&Layer_Erc_Error_Item, |
|
||||
}; |
|
||||
|
|
||||
|
|
||||
static ButtonIndex Msg_General = |
|
||||
{ |
|
||||
_( "General" ), // Title |
|
||||
7 // Index to first bitmap button in group |
|
||||
}; |
|
||||
|
|
||||
static ButtonIndex MsgDevice_Item = |
|
||||
{ |
|
||||
_( "Device" ), // Title |
|
||||
15 // Index to first bitmap button in group |
|
||||
}; |
|
||||
|
|
||||
static ButtonIndex Msg_Sheets = |
|
||||
{ |
|
||||
_( "Sheets" ), // Title |
|
||||
20 // Index to first bitmap button in group |
|
||||
}; |
|
||||
|
|
||||
static ButtonIndex Msg_ErcMarck = |
|
||||
{ |
|
||||
_( "Erc Mark" ), // Title |
|
||||
22 // Index to first bitmap button in group |
|
||||
}; |
|
||||
|
|
||||
static ButtonIndex Msg_Other = |
|
||||
{ |
|
||||
_( "Other" ), // Title |
|
||||
23 // Index to first bitmap button in group |
|
||||
}; |
|
||||
|
|
||||
|
|
||||
static ButtonIndex* laytool_index[BUTTON_GROUPS] = { |
|
||||
&Msg_General, |
|
||||
&MsgDevice_Item, |
|
||||
&Msg_Sheets, |
|
||||
&Msg_ErcMarck, |
|
||||
&Msg_Other |
|
||||
}; |
|
||||
|
|
||||
|
|
||||
/***********************************************/ |
|
||||
/* Derived class for the frame color settings. */ |
|
||||
/***********************************************/ |
|
||||
|
|
||||
class WinEDA_SetColorsFrame: public wxDialog |
|
||||
{ |
|
||||
private: |
|
||||
DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame ) |
|
||||
DECLARE_EVENT_TABLE() |
|
||||
|
|
||||
WinEDA_DrawFrame* m_Parent; |
|
||||
wxBoxSizer* OuterBoxSizer; |
|
||||
wxBoxSizer* MainBoxSizer; |
|
||||
wxBoxSizer* ColumnBoxSizer; |
|
||||
wxBoxSizer* RowBoxSizer; |
|
||||
wxStaticText* Label; |
|
||||
wxBitmapButton* BitmapButton; |
|
||||
wxCheckBox* m_ShowGrid; |
|
||||
wxRadioBox* m_SelBgColor; |
|
||||
wxStaticLine* Line; |
|
||||
wxStdDialogButtonSizer* StdDialogButtonSizer; |
|
||||
wxButton* Button; |
|
||||
|
|
||||
// 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 ); |
|
||||
|
|
||||
// Initializes 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 UpdateLayerSettings(); |
|
||||
void SetColor( wxCommandEvent& event ); |
|
||||
void OnOkClick( wxCommandEvent& event ); |
|
||||
void OnCancelClick( wxCommandEvent& event ); |
|
||||
void OnApplyClick( wxCommandEvent& event ); |
|
||||
|
|
||||
public: |
|
||||
// Constructors and destructor |
|
||||
WinEDA_SetColorsFrame(); |
|
||||
WinEDA_SetColorsFrame( WinEDA_DrawFrame* parent, const wxPoint& framepos ); |
|
||||
~WinEDA_SetColorsFrame(); |
|
||||
}; |
|
||||
|
|
||||
#endif // _EELAYER_H_ |
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue