Commit 8497178f authored by charras's avatar charras

removed unused files. Switch to RC5

parent 52dbb13c
/* XPM */
#ifndef XPMMAIN
extern const char * icon_python_xpm[];
#else
const char * icon_python_xpm[] = {
"32 32 72 1",
" c None",
". c #7EA5C6",
"+ c #6495BD",
"@ c #4383B6",
"# c #437FB2",
"$ c #6491B5",
"% c #7DA1BF",
"& c #3882BE",
"* c #387CB5",
"= c #3779AF",
"- c #3776AB",
"; c #4988BB",
"> c #CDDFEE",
", c #F7F7FF",
"' c #82ADD1",
") c #3773A5",
"! c #7096B5",
"~ c #4385BB",
"{ c #FFFFFF",
"] c #F6F5F5",
"^ c #3C729E",
"/ c #9BBDDA",
"( c #366D9C",
"_ c #387FBA",
": c #5A91BF",
"< c #376A94",
"[ c #FFED60",
"} c #FFE659",
"| c #F8E16E",
"1 c #FFEB5E",
"2 c #FFE354",
"3 c #4489C0",
"4 c #3885C3",
"5 c #FFDB4C",
"6 c #FBCE47",
"7 c #FFD544",
"8 c #72A0C5",
"9 c #507CA1",
"0 c #FFE052",
"a c #FFD040",
"b c #F5D98D",
"c c #7F9EB8",
"d c #F1ECDA",
"e c #FFCC3B",
"f c #FBC840",
"g c #FBD54F",
"h c #FCC539",
"i c #4379A7",
"j c #DCE1E7",
"k c #FAE262",
"l c #FFC532",
"m c #FBC037",
"n c #80A6C6",
"o c #FFBC29",
"p c #F7CD74",
"q c #427DAE",
"r c #FABE40",
"s c #FFB521",
"t c #497FAC",
"u c #FFCD57",
"v c #FFE097",
"w c #FFD67B",
"x c #FFD849",
"y c #FFFBF2",
"z c #F7DE92",
"A c #FFCF6A",
"B c #FFEDC8",
"C c #FFE4AC",
"D c #F7D284",
"E c #FFB531",
"F c #F7D47B",
"G c #FDBE2E",
" ",
" ",
" .+@###$% ",
" &&&**==--- ",
" ;&>,'*===))))! ",
" ~&{{]==--))))^ ",
" &&'/@===)))((( ",
" __**===)))(((( ",
" ((((( ",
" :&&&**====)))(((<<[[}}| ",
" &&&&&**===)))(((<<<11}22 ",
" 34&__***---))(((<<<<222556 ",
" 4&&&**====)))((<<<<<225557 ",
" 84&&***==--))(((<<<<900577ab ",
" ~&&&**===)))(((<<<<cd5577aef ",
" ___**====)))((<<<<9dg577eeeh ",
" __***==ijk[[[[[}225557aeelll ",
" @_**===j|[[[[[}}00577aeelllm ",
" n*==---k[[[[}}225577aellllop ",
" **=---}[[[[}225577eelllloo ",
" q===))[[[[}225577aeellloor ",
" --)))[[}}00577aeelllooos ",
" tiii11}005566fffffmmmmp ",
" 22255 ",
" 225557aeelllom ",
" 00557aeeeuvwoo ",
" gx77aeelly{{sm ",
" z77aellllABCsD ",
" 6ellloossE ",
" FmGoop ",
" ",
" "};
#endif
/* XPM */
#ifndef XPMMAIN
extern const char * icon_python_small_xpm[];
#else
const char *icon_python_small_xpm[] = {
"16 16 98 2",
" c None",
". c #5490C0",
"+ c #3E7EB4",
"@ c #3D7CB0",
"# c #5488B2",
"$ c #4686BB",
"% c #8FB8DA",
"& c #DCE6F1",
"* c #377AB0",
"= c #3778AD",
"- c #3773A5",
"; c #5684AA",
"> c #3880BC",
", c #4A8AC0",
"' c #538DBD",
") c #3779AF",
"! c #3774A8",
"~ c #3772A3",
"{ c #366D9C",
"] c #366C9A",
"^ c #799785",
"/ c #FFEA5C",
"( c #FCE464",
"_ c #3883BF",
": c #387EB7",
"< c #387AB1",
"[ c #366E9E",
"} c #376A94",
"| c #9BA876",
"1 c #FFE658",
"2 c #FFDF50",
"3 c #4B8EC4",
"4 c #3882BE",
"5 c #387AB2",
"6 c #3778AE",
"7 c #3775A9",
"8 c #A1AA77",
"9 c #FFDE50",
"0 c #FFD848",
"a c #FCD55B",
"b c #3B81BB",
"c c #3880BB",
"d c #387BB4",
"e c #3776AA",
"f c #376B96",
"g c #7E9CB2",
"h c #FADE70",
"i c #FFD646",
"j c #FFCF3E",
"k c #FDC93C",
"l c #3B80B9",
"m c #387CB5",
"n c #6393BB",
"o c #F3E486",
"p c #FFED60",
"q c #FFE85B",
"r c #FFE253",
"s c #FFDA4A",
"t c #FFD545",
"u c #FFCD3C",
"v c #FFC734",
"w c #FEC433",
"x c #508ABB",
"y c #3776AB",
"z c #9AAD84",
"A c #FFE558",
"B c #FFE152",
"C c #FFD342",
"D c #FFCB3A",
"E c #FFC532",
"F c #FFC330",
"G c #FCC242",
"H c #9BB082",
"I c #FFEB5E",
"J c #FFE659",
"K c #FFE052",
"L c #FFD241",
"M c #FFC02E",
"N c #FFBA27",
"O c #4379A7",
"P c #C0C273",
"Q c #FFDE4F",
"R c #FFDB4C",
"S c #FFD040",
"T c #FFCC3B",
"U c #FFCE54",
"V c #FFC540",
"W c #FDBE30",
"X c #F9DA70",
"Y c #FFD645",
"Z c #FFC836",
"` c #FFEEC9",
" . c #FFD37B",
".. c #F9C95E",
"+. c #FCCC4D",
"@. c #FEC232",
"#. c #FFBC29",
"$. c #FCBD3D",
" ",
" . + @ # ",
" $ % & * = - - ; ",
" > , ' ) ! ~ { { ",
" { ] ^ / ( ",
" _ > : < = - [ ] } | 1 2 ",
" 3 4 : 5 6 7 ~ { } } 8 9 0 a ",
" b c d ) e - { f } g h i j k ",
" l m * n o p p q r s t u v w ",
" x * y z p p A B s C D E F G ",
" = ! H I J K 0 L D v M N ",
" O P 1 Q R ",
" r 9 s S T U V W ",
" X Y S Z E ` ... ",
" +.@.#.$. ",
" "
};
#endif
/* XPM */
#ifndef XPMMAIN
extern const char * new_python_xpm[];
#else
const char * new_python_xpm[] = {
"16 16 112 2",
" c None",
". c #000000",
"+ c #FEFEFE",
"@ c #090909",
"# c #EEEEEE",
"$ c #F1F1F1",
"% c #FBFBFB",
"& c #DAE2E8",
"* c #CDDBE7",
"= c #528DBD",
"- c #3C7BB0",
"; c #5689B2",
"> c #DAE1E7",
", c #E9EBED",
"' c #767676",
") c #5590C1",
"! c #79A9D1",
"~ c #709FC6",
"{ c #3777AC",
"] c #3672A4",
"^ c #3C73A2",
"/ c #B2C4D4",
"( c #161616",
"_ c #C1D2E1",
": c #C2D3E2",
"< c #BFD0DE",
"[ c #BBCCDB",
"} c #366E9D",
"| c #467695",
"1 c #C4C787",
"2 c #F8E78A",
"3 c #C4C4C4",
"4 c #B7CDDF",
"5 c #3881BD",
"6 c #387EB7",
"7 c #3779B0",
"8 c #3775A9",
"9 c #366F9F",
"0 c #366B99",
"a c #597F89",
"b c #DACF62",
"c c #FFDF50",
"d c #EEEDEC",
"e c #ECECEC",
"f c #4287C0",
"g c #387EB8",
"h c #377AB1",
"i c #3776AB",
"j c #366D9B",
"k c #386A94",
"l c #728F8F",
"m c #E6CF5B",
"n c #FFD545",
"o c #F8D774",
"p c #EBEBEB",
"q c #3A7FB9",
"r c #377BB4",
"s c #4E86B5",
"t c #A8B890",
"u c #AEBA7A",
"v c #AEB674",
"w c #AFB26D",
"x c #DCC969",
"y c #FED348",
"z c #FFCA38",
"A c #F8CE5E",
"B c #EAEAEA",
"C c #4784B7",
"D c #3778AD",
"E c #88A38E",
"F c #FDEC63",
"G c #FFE95C",
"H c #FFE254",
"I c #FFDA4A",
"J c #FFD140",
"K c #FFC836",
"L c #FFC330",
"M c #F7CA65",
"N c #E8E8E8",
"O c #C1D1DE",
"P c #457EAE",
"Q c #95AB84",
"R c #FFE95B",
"S c #FBDB5F",
"T c #FBD55E",
"U c #FACE56",
"V c #FAC851",
"W c #FAC249",
"X c #E7E7E7",
"Y c #B9C9D7",
"Z c #D4CD6F",
"` c #FFE152",
" . c #FFD949",
".. c #F4D881",
"+. c #F1DA9F",
"@. c #F1D494",
"#. c #E9DFC6",
"$. c #E6E6E6",
"%. c #E5E5E5",
"&. c #F8DD79",
"*. c #FFD646",
"=. c #FFCE3D",
"-. c #FFC735",
";. c #FFE5AA",
">. c #FDCC64",
",. c #ECD9AF",
"'. c #E4E4E4",
"). c #F0E8D3",
"!. c #FBC94A",
"~. c #FDBF36",
"{. c #F9C150",
"]. c #E3E3E3",
" . . . . . . . . . . . . ",
". + + + + + + + + + + @ + . ",
". + # # # $ $ $ $ $ $ @ % + . ",
". + # # & * = - ; > , @ ' + + . ",
". + # # ) ! ~ { ] ^ / @ @ @ ( . ",
". + # # _ : < [ } | 1 2 # # 3 . ",
". + 4 5 6 7 8 9 0 a b c d e 3 . ",
". + f g h i ] j k l m n o p 3 . ",
". + q r s t u v w x y z A B 3 . ",
". + C D E F G H I J K L M N 3 . ",
". + O P Q R H S T U V W X X 3 . ",
". + # Y Z ` ...+.@.#.$.$.%.3 . ",
". + # # &.*.=.-.;.>.,.%.'.'.3 . ",
". + # # # ).!.~.{.# '.].].].3 . ",
". 3 3 3 3 3 3 3 3 3 3 3 3 3 3 . ",
" . . . . . . . . . . . . . . "};
#endif
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#endif #endif
#ifndef KICAD_BUILD_VERSION #ifndef KICAD_BUILD_VERSION
#define KICAD_BUILD_VERSION "(2010-02-26)" #define KICAD_BUILD_VERSION "(2010-02-28)"
#endif #endif
#define VERSION_STABILITY "RC5" #define VERSION_STABILITY "RC5"
......
#include "fctsys.h"
#include "common.h"
#include <id.h>
#include <wx/dir.h>
#include <pyhandler.h>
#include <iostream>
using namespace boost::python;
/*****************************************************************************/
/* Common Python Binding */
/*****************************************************************************/
static int GetLastID() { return ID_END_LIST; }
static object ChooseFile( str objTitle, str objMask, object objOpen )
{
wxString mask = PyHandler::MakeStr( objMask );
int open = extract<int>( objOpen );
wxString script = EDA_FileSelector( PyHandler::MakeStr( objTitle ),
wxEmptyString,
wxEmptyString,
mask,
mask,
NULL,
open ? wxFD_OPEN : wxFD_SAVE,
TRUE );
return PyHandler::Convert( script );
}
static void Print( str message )
{
std::cout << extract<char *>(message) << std::endl;
}
static void Clear() {}
static void RegisterCb( str objKey, object callback )
{
PyHandler::GetInstance()->RegisterCallback( PyHandler::MakeStr(objKey),
callback );
}
static void UnRegisterCb( str objKey, object callback )
{
PyHandler::GetInstance()->UnRegisterCallback( PyHandler::MakeStr(objKey),
callback );
}
static void init_base_utils()
{
def ( "ChooseFile", &ChooseFile );
def ( "RegisterCallback", &RegisterCb );
def ( "UnRegisterCallback", &UnRegisterCb );
def ( "GetLastID", &GetLastID );
def ( "Print", &Print );
def ( "Clear", &Clear);
}
// Dummy boost callback
static void InitPyModules()
{
PyHandler::GetInstance()->InitNextModule();
}
/*****************************************************************************/
/* PyHandler */
/*****************************************************************************/
// std::vector< T > -> python object implicit conversion
template <typename T> struct std_vector_to_tuple
{
static PyObject * makeItem( const wxString & str )
{
return boost::python::incref( PyHandler::Convert( str ).ptr() );
}
static PyObject * makeItem( const std::string & str )
{
return boost::python::incref(
boost::python::str( str.c_str() ).ptr() );
}
static PyObject * makeItem( int item )
{
return boost::python::incref( PyInt_FromLong( item ) );
}
static PyObject * convert( const T& vect )
{
PyObject * tuple = PyTuple_New( vect.size() );
for ( unsigned int i = 0; i < vect.size() ; i++ )
{
PyTuple_SET_ITEM( tuple, i, makeItem( vect[i] ) );
}
return tuple;
}
};
PyHandler* PyHandler::m_instance = NULL;
/* Singleton implementation */
PyHandler * PyHandler::GetInstance()
{
if( !PyHandler::m_instance )
{
PyHandler::m_instance = new PyHandler();
}
return PyHandler::m_instance;
}
/* Init the Python env */
PyHandler::PyHandler()
{
Py_Initialize();
PyEval_InitThreads();
m_ModulesLoaded = false;
m_current = 0;
if( !wxPyCoreAPI_IMPORT() )
{
std::cerr << "Can't get wx Python binding\n" ;
PyErr_Print();
}
// m_mainTState = wxPyBeginAllowThreads(); // I can't figure out why this make py crash ...
m_mainTState = NULL;
// Make the console appear in a window:
wxString initConsole;
initConsole += wxT( "import sys\n" );
initConsole += wxT( "import wx\n" );
initConsole += wxT( "output = wx.PyOnDemandOutputWindow()\n" );
initConsole += wxT( "sys.stdout = sys.stderr = output\n" );
RunSimpleString( initConsole );
AddToModule ( wxT( "common" ), &init_base_utils );
// Register converters
to_python_converter < std::vector< std::string >,
std_vector_to_tuple< const std::vector < std::string > > > ();
to_python_converter < std::vector< wxString >,
std_vector_to_tuple< const std::vector < wxString > > > ();
}
void PyHandler::DoInitModules()
{
if ( m_ModulesLoaded )
return;
m_ModulesLoaded = true;
for ( unsigned int i = 0; i < m_ModuleRegistry.size(); i ++ )
{
detail::init_module( m_ModuleRegistry[i].name.mb_str(),
&InitPyModules );
}
}
/* Returns the module index in the registry, -1 if not found*/
int PyHandler::GetModuleIndex( const wxString & name ) const
{
for ( unsigned int i = 0; i < m_ModuleRegistry.size(); i ++ )
{
if ( m_ModuleRegistry[i].name == name ) return i;
}
return -1;
}
/* Adds an init function to a python module */
void PyHandler::AddToModule( const wxString & name,
PyHandler::initfunc_t initfunc )
{
if (!initfunc)
return;
int i = GetModuleIndex( name );
if ( -1 == i )
{
m_ModuleRegistry.push_back( ModuleRecord( name ) );
i = m_ModuleRegistry.size() - 1;
}
m_ModuleRegistry[i].registry.push_back( initfunc );
}
/* Called to initialize a module on py 'import module' */
void PyHandler::InitNextModule()
{
for ( unsigned int j = 0;
j < m_ModuleRegistry[m_current].registry.size();
j++ )
{
m_ModuleRegistry[m_current].registry[j]();
}
m_current++;
}
/* Closes the Python env */
PyHandler::~PyHandler()
{
wxPyEndAllowThreads(m_mainTState);
Py_Finalize();
}
/* Run scripts looking in 'base' directory */
void PyHandler::RunBaseScripts( const wxString & base )
{
const wxString sep = wxFileName().GetPathSeparator();
// check if we can have a kicad_startup.py around ?
wxString script = base + wxT( "scripts" ) + sep + wxT( "kicad_startup.py" );
if ( wxFileExists( script ) )
RunScript( script );
// First find scripts/<name>.py and run it if found :
script = base + wxString::FromAscii( "scripts" ) + sep + m_appName
+ wxString::FromAscii(".py");
if ( wxFileExists( script ) )
RunScript( script );
// Now lets see if we can find a suitable plugin directory
// (plugin/<name>) somewhere
wxString pluginDir = base + wxT( "plugins" ) + sep + m_appName;
if ( wxDirExists( pluginDir ) )
{
// We do have a systemwide plugin dir, let's find files in it
wxArrayString pluginList;
wxDir::GetAllFiles( pluginDir, &pluginList, wxT("*.py") );
for ( unsigned int i = 0; i < pluginList.Count() ; i++ )
{
RunScript( pluginList[i] );
}
}
}
/* Run application startup scripts */
void PyHandler::RunScripts()
{
// SYSTEMWIDE:
const wxString sep = wxFileName().GetPathSeparator();
wxString dataPath = ReturnKicadDatasPath();
if ( wxDirExists( dataPath ) ) RunBaseScripts( dataPath );
// USER Scripts:
wxString userDir = wxGetUserHome() + sep
+ wxString::FromAscii(".kicad.d") + sep;
if ( wxDirExists( userDir ) )
RunBaseScripts( userDir );
userDir = wxGetUserHome() + sep + wxString::FromAscii("_kicad_d") + sep;
if ( wxDirExists( userDir ) )
RunBaseScripts( userDir );
}
/* Run the script specified by 'name' */
bool PyHandler::RunScript( const wxString & name )
{
DoInitModules();
object module( handle<>(borrowed(PyImport_AddModule("__main__"))));
object ns = module.attr( "__dict__" );
bool ret = true;
FILE * file = fopen( name.mb_str(), "r" );
wxPyBlock_t blocked = wxPyBeginBlockThreads();
if ( !file )
{
// do something
std::cout << "Unable to Load " << name.mb_str() << "\n";
ret = false;
}
else
{
wxString currDir = wxGetCwd();
wxFileName fname( name );
wxString pyDir = fname.GetPath();
wxSetWorkingDirectory( pyDir );
try
{
ns["currentScript"] = Convert( name );
handle<> ignored( PyRun_File( file, name.mb_str(), Py_file_input,
ns.ptr(), ns.ptr() ) );
}
catch ( error_already_set )
{
PyErr_Print(); // should be printed into an error message ...
ret = false;
}
wxSetWorkingDirectory( currDir );
}
fclose( file );
wxPyEndBlockThreads(blocked);
return ret;
}
bool PyHandler::RunSimpleString( const wxString & code )
/* Run the code in 'code' */
{
wxPyBlock_t blocked = wxPyBeginBlockThreads();
try
{
PyRun_SimpleString( code.mb_str() );
}
catch ( error_already_set )
{
PyErr_Print(); // should be printed into an error message ...
wxPyEndBlockThreads(blocked);
return false;
}
wxPyEndBlockThreads(blocked);
return true;
}
void PyHandler::SetAppName( const wxString & name )
/* Set the application name in the python scope */
{
m_appName = name;
object module( ( handle<>( borrowed( PyImport_AddModule( "__main__") ) ) ) );
object ns = module.attr( "__dict__" );
try
{
ns["kicadApp"] = std::string( name.ToAscii() );
}
catch( error_already_set )
{
PyErr_Print();
}
}
const char * PyHandler::GetVersion() { return Py_GetVersion(); }
// Event handling :
void PyHandler::DeclareEvent( const wxString & key )
{
m_EventRegistry.push_back( Event( key ) );
}
int PyHandler::GetEventIndex( const wxString & key )
{
for ( unsigned int i = 0; i < m_EventRegistry.size(); i ++ )
{
if ( m_EventRegistry[i].key == key )
return i;
}
return -1;
}
void PyHandler::TriggerEvent( const wxString & key )
{
TriggerEvent( key, str( "" ) );
}
void PyHandler::TriggerEvent( const wxString & key, const object & param )
{
int i = GetEventIndex( key );
if ( -1 == i )
return;
wxPyBlock_t blocked = wxPyBeginBlockThreads();
for( unsigned int j = 0; j < m_EventRegistry[i].functors.size(); j++ )
{
try
{
m_EventRegistry[i].functors[j]( param );
}
catch( error_already_set )
{
std::cout << "Error in event " << key.mb_str() << " callback"
<< std::endl;
PyErr_Print();
}
}
wxPyEndBlockThreads( blocked );
}
void PyHandler::RegisterCallback( const wxString & key,
const object & callback )
{
int i = GetEventIndex( key );
if( -1 == i )
return;
m_EventRegistry[i].functors.push_back( callback );
}
void PyHandler::UnRegisterCallback( const wxString & key,
const object & callback )
{
int i = GetEventIndex( key );
if( -1 == i )
return;
for( unsigned int j = 0; j < m_EventRegistry[i].functors.size() ; j++ )
{
if ( callback == m_EventRegistry[i].functors[j] )
{
m_EventRegistry[i].functors.erase(
m_EventRegistry[i].functors.begin() + j );
break;
}
}
}
// Object conversion:
wxString PyHandler::MakeStr( const object & objStr )
{
return wxString( extract<const char *>( objStr ), wxConvLocal );
}
object PyHandler::Convert( const wxString & wxStr )
{
return str( std::string( wxStr.mb_str() ).c_str() );
}
/*****************/
/* set_color.cpp */
/*****************/
/*Set up the items and layer colors and show/no show options
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "class_drawpanel.h"
#include "gerbview.h"
#include "pcbnew.h"
#include "class_board_design_settings.h"
#include "protos.h"
// variable used to handle grid visibility:
bool s_showGrid;
int s_gridColor;
#include "set_color.h" // Header file associated with this file
// Local variables:
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_BUTTON( ID_COLOR_RESET_SHOW_LAYER_OFF, WinEDA_SetColorsFrame::ResetDisplayLayersCu )
EVT_BUTTON( ID_COLOR_RESET_SHOW_LAYER_ON, WinEDA_SetColorsFrame::ResetDisplayLayersCu )
EVT_COMMAND_RANGE( ID_COLOR_SETUP, ID_COLOR_SETUP + NB_BUTT - 1,
wxEVT_COMMAND_BUTTON_CLICKED,
WinEDA_SetColorsFrame::SetColor )
EVT_BUTTON( wxID_OK, WinEDA_SetColorsFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_SetColorsFrame::OnCancelClick )
EVT_BUTTON( wxID_APPLY, WinEDA_SetColorsFrame::OnApplyClick )
END_EVENT_TABLE()
/*****************************************************/
void DisplayColorSetupFrame( WinEDA_GerberFrame* 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 set_color.h)
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame()
{
Init();
}
// Standard Constructor
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_GerberFrame* 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;
FlexColumnBoxSizer = NULL;
Label = NULL;
RowBoxSizer = NULL;
BitmapButton = NULL;
CheckBox = NULL;
Button = NULL;
Line = NULL;
StdDialogButtonSizer = NULL;
}
/**********************************************************/
void WinEDA_SetColorsFrame::CreateControls()
/**********************************************************/
{
int lyr, cln, butt_ID, buttcolor;
wxString msg;
wxSize CorrectSize; // Used while specifying sizes of buttons and spacers
int ButtonHeight; // Also used for the same reason
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[]
s_showGrid = m_Parent->IsGridVisible();
s_gridColor = m_Parent->GetGridColor();
for( lyr = 0, cln = 0; lyr < NB_BUTT; lyr++ )
{
// Look for the first set of controls within each column.
if( lyr == 0 || lyr == laytool_index[cln]->m_Index + 1 )
{
if( lyr != 0 )
cln++;
// Specify a FlexGrid sizer with seventeen rows and one column.
FlexColumnBoxSizer = new wxFlexGridSizer(17, 1, 0, 0);
// Specify that all of the rows can be expanded.
for( int ii = 0; ii < 17; ii++ )
{
FlexColumnBoxSizer->AddGrowableRow(ii);
}
// Specify that the column can also be expanded.
FlexColumnBoxSizer->AddGrowableCol(0);
MainBoxSizer->Add(FlexColumnBoxSizer, 1, wxGROW|wxLEFT, 5);
// Add a text string to identify the controls within this column.
Label = new wxStaticText( this, wxID_STATIC, laytool_index[cln]->m_Name,
wxDefaultPosition, wxDefaultSize, 0 );
// Make this text string bold (so that it stands out better).
Label->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxNORMAL_FONT->GetFamily(),
wxNORMAL, wxBOLD, false, wxNORMAL_FONT->GetFaceName() ) );
FlexColumnBoxSizer->Add(Label, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
}
// Provide a sizer for each layer to accomodate its associated bitmap button and checkbox.
RowBoxSizer = new wxBoxSizer(wxHORIZONTAL);
FlexColumnBoxSizer->Add(RowBoxSizer, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT, 5);
butt_ID = ID_COLOR_SETUP + lyr;
laytool_list[lyr]->m_Id = butt_ID;
// Provide a bitmap button, and "paint" this with the appropriate color.
wxMemoryDC iconDC;
wxBitmap ButtBitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
iconDC.SelectObject( ButtBitmap );
buttcolor = *laytool_list[lyr]->m_Color & MASKCOLOR;
CurrentColor[lyr] = buttcolor;
wxBrush Brush;
iconDC.SelectObject( ButtBitmap );
iconDC.SetPen( *wxBLACK_PEN );
Brush.SetColour(
ColorRefs[buttcolor].m_Red,
ColorRefs[buttcolor].m_Green,
ColorRefs[buttcolor].m_Blue
);
Brush.SetStyle( wxSOLID );
iconDC.SetBrush( Brush );
iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
BitmapButton = new wxBitmapButton( this, butt_ID,
ButtBitmap,
wxDefaultPosition,
wxSize(BUTT_SIZE_X, BUTT_SIZE_Y) );
laytool_list[lyr]->m_Button = BitmapButton;
RowBoxSizer->Add(BitmapButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxBOTTOM, 5);
// Provide a checkbox, and specify the appropriate caption and checked state.
msg = wxGetTranslation( laytool_list[lyr]->m_Name.GetData() );
CheckBox = new wxCheckBox( this, ID_COLOR_CHECKBOX_ONOFF, msg,
wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
laytool_list[lyr]->m_CheckBox = CheckBox;
if( laytool_list[lyr]->m_NoDisplayIsColor )
{
if( m_Parent->GetBoard()->IsLayerVisible( lyr ))
CheckBox->SetValue( TRUE );
else
CheckBox->SetValue( FALSE );
}
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 ) );
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 ) );
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 );
StdDialogButtonSizer->AddButton(Button);
Button = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
StdDialogButtonSizer->AddButton(Button);
Button = new wxButton( this, wxID_APPLY, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 );
StdDialogButtonSizer->AddButton(Button);
StdDialogButtonSizer->Realize();
// (Dialog now needs to be resized, but the associated command is provided elsewhere.)
}
/**********************************************************/
bool WinEDA_SetColorsFrame::ShowToolTips()
/**********************************************************/
{
return true;
}
/**********************************************************/
wxBitmap WinEDA_SetColorsFrame::GetBitmapResource( const wxString& name )
/**********************************************************/
{
wxUnusedVar(name);
return wxNullBitmap;
}
/**********************************************************/
wxIcon WinEDA_SetColorsFrame::GetIconResource( const wxString& name )
/**********************************************************/
{
wxUnusedVar(name);
return wxNullIcon;
}
/*******************************************************************/
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 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()
/******************************************************************/
{
for( int lyr = 0; lyr < NB_BUTT - 2; lyr++ )
{
m_Parent->GetBoard()->GetBoardDesignSettings()->SetLayerVisibility( lyr, laytool_list[lyr]->m_CheckBox->GetValue() );
*laytool_list[lyr]->m_Color = CurrentColor[lyr];
}
// (As a bitmap button and a checkbox have been provided for *every*
// layer, it is not necessary to check whether each of those items
// actually has been provided for each of those layers.)
s_gridColor = CurrentColor[32];
s_showGrid = laytool_list[32]->m_CheckBox->GetValue();
g_ColorsSettings.SetItemColor(DCODES_VISIBLE, CurrentColor[33] );
DisplayOpt.DisplayPadNum = laytool_list[33]->m_CheckBox->GetValue();
// Additional command required for updating visibility of grid.
m_Parent->SetGridVisibility( s_showGrid );
m_Parent->SetGridColor( s_gridColor );
}
/***********************************************************************/
void WinEDA_SetColorsFrame::ResetDisplayLayersCu(wxCommandEvent& event)
/***********************************************************************/
{
bool NewState = ( event.GetId() == ID_COLOR_RESET_SHOW_LAYER_ON )
? TRUE
: FALSE;
for( int lyr = 0; lyr < 32; lyr++ )
{
// (As a checkbox has been provided for *every* layer, it is not
// necessary to check whether it actually has been provided for
// each of those layers.)
laytool_list[lyr]->m_CheckBox->SetValue( NewState );
}
}
/***************/
/* set_color.h */
/***************/
#ifndef SET_COLOR_H
#define SET_COLOR_H
#include "wx/statline.h"
#include "colors_selection.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;
/* Useful macro : */
#define LOC_COLOR(numlayer) &g_ColorsSettings.m_LayersColors[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
15 // Index to last bitmap button in group
};
static ColorButton Layer_1_Butt=
{
_("Layer 1"), // Title
LOC_COLOR(0), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_2_Butt=
{
_("Layer 2"), // Title
LOC_COLOR(1), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_3_Butt=
{
_("Layer 3"), // Title
LOC_COLOR(2), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_4_Butt=
{
_("Layer 4"), // Title
LOC_COLOR(3), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_5_Butt=
{
_("Layer 5"), // Title
LOC_COLOR(4), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_6_Butt=
{
_("Layer 6"), // Title
LOC_COLOR(5), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_7_Butt=
{
_("Layer 7"), // Title
LOC_COLOR(6), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_8_Butt=
{
_("Layer 8"), // Title
LOC_COLOR(7), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_9_Butt=
{
_("Layer 9"), // Title
LOC_COLOR(8), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_10_Butt=
{
_("Layer 10"), // Title
LOC_COLOR(9), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_11_Butt=
{
_("Layer 11"), // Title
LOC_COLOR(10), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_12_Butt=
{
_("Layer 12"), // Title
LOC_COLOR(11), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_13_Butt=
{
_("Layer 13"), // Title
LOC_COLOR(12), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_14_Butt=
{
_("Layer 14"), // Title
LOC_COLOR(13), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_15_Butt=
{
_("Layer 15"), // Title
LOC_COLOR(14), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_16_Butt=
{
_("Layer 16"), // Title
LOC_COLOR(15), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ButtonIndex Msg_Layers_Tech =
{
_( "Layers 17-32" ), // Title
31 // Index to last bitmap button in group
};
static ColorButton Layer_17_Butt=
{
_("Layer 17"), // Title
LOC_COLOR(16), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_18_Butt=
{
_("Layer 18"), // Title
LOC_COLOR(17), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_19_Butt=
{
_("Layer 19"), // Title
LOC_COLOR(18), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_20_Butt=
{
_("Layer 20"), // Title
LOC_COLOR(19), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_21_Butt=
{
_("Layer 21"), // Title
LOC_COLOR(20), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_22_Butt=
{
_("Layer 22"), // Title
LOC_COLOR(21), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_23_Butt=
{
_("Layer 23"), // Title
LOC_COLOR(22), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_24_Butt=
{
_("Layer 24"), // Title
LOC_COLOR(23), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_25_Butt=
{
_("Layer 25"), // Title
LOC_COLOR(24), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_26_Butt=
{
_("Layer 26"), // Title
LOC_COLOR(25), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_27_Butt=
{
_("Layer 27"), // Title
LOC_COLOR(26), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_28_Butt=
{
_("Layer 28"), // Title
LOC_COLOR(27), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_29_Butt=
{
_("Layer 29"), // Title
LOC_COLOR(28), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_30_Butt=
{
_("Layer 30"), // Title
LOC_COLOR(29), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_31_Butt=
{
_("Layer 31"), // Title
LOC_COLOR(30), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ColorButton Layer_32_Butt=
{
_("Layer 32"), // Title
LOC_COLOR(31), // Address of optional parameter
TRUE // Toggle ITEM*NOT*SHOW bit of the color variable
};
static ButtonIndex Msg_Others_Items =
{
_( "Others" ), // Title
33 // Index to last bitmap button in group
};
static ColorButton Grid_Butt=
{
_("Grid"), // Title
&s_gridColor, // Address of optional parameter
FALSE,
&s_showGrid // Address of boolean display control parameter to toggle
};
static ColorButton Show_DCodes_Butt=
{
_("D codes id."), // Title
&g_ColorsSettings.m_ItemsColors[DCODES_VISIBLE], // Address of optional parameter
FALSE,
&DisplayOpt.DisplayPadNum // Address of boolean display control parameter to toggle
};
static ColorButton * laytool_list[] = {
&Layer_1_Butt,
&Layer_2_Butt,
&Layer_3_Butt,
&Layer_4_Butt,
&Layer_5_Butt,
&Layer_6_Butt,
&Layer_7_Butt,
&Layer_8_Butt,
&Layer_9_Butt,
&Layer_10_Butt,
&Layer_11_Butt,
&Layer_12_Butt,
&Layer_13_Butt,
&Layer_14_Butt,
&Layer_15_Butt,
&Layer_16_Butt,
&Layer_17_Butt,
&Layer_18_Butt,
&Layer_19_Butt,
&Layer_20_Butt,
&Layer_21_Butt,
&Layer_22_Butt,
&Layer_23_Butt,
&Layer_24_Butt,
&Layer_25_Butt,
&Layer_26_Butt,
&Layer_27_Butt,
&Layer_28_Butt,
&Layer_29_Butt,
&Layer_30_Butt,
&Layer_31_Butt,
&Layer_32_Butt,
&Grid_Butt,
&Show_DCodes_Butt,
};
static ButtonIndex* laytool_index[BUTTON_GROUPS] = {
&Msg_Layers_Cu,
&Msg_Layers_Tech,
&Msg_Others_Items
};
/**************************************************************/
/* classe derivee pour la frame de Configuration des couleurs */
/**************************************************************/
class WinEDA_SetColorsFrame: public wxDialog
{
private:
DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame )
DECLARE_EVENT_TABLE()
WinEDA_GerberFrame* 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_GerberFrame* parent, const wxPoint& framepos );
~WinEDA_SetColorsFrame();
};
#endif
// SET_COLOR_H
/****************************/
/* pyhandler.h */
/****************************/
#ifndef PYHANDLER_H
#define PYHANDLER_H
#include <wx/string.h>
#include <Python.h>
#include <wx/wxPython/wxPython.h>
#include <vector>
/* Use the boost library : */
#include <boost/python.hpp>
class PyHandler
{
typedef void (*initfunc_t )();
private:
static PyHandler* m_instance;
bool m_ModulesLoaded;
int m_current;
PyThreadState* m_mainTState;
protected:
PyHandler();
wxString m_appName;
void RunBaseScripts( const wxString& base );
// Modules
struct ModuleRecord
{
wxString name;
std::vector< initfunc_t > registry;
ModuleRecord( const wxString &modName ) :
name( modName )
{
}
};
std::vector< ModuleRecord > m_ModuleRegistry;
void DoInitModules();
// Events
struct Event
{
wxString key;
std::vector< boost::python::object > functors;
Event( const wxString &strKey ) :
key( strKey )
{
}
};
std::vector< Event > m_EventRegistry;
public:
// Singleton handling:
static PyHandler* GetInstance();
~PyHandler();
// Scope params/handling:
void SetAppName( const wxString& name );
void AddToModule( const wxString& name, initfunc_t initfunc );
int GetModuleIndex( const wxString& name ) const;
// Script and direct call
void RunScripts();
bool RunScript( const wxString& name );
bool RunSimpleString( const wxString& code );
// Common Informations
const char* GetVersion();
void InitNextModule();
// Event triggering
// - C++ interface
void DeclareEvent( const wxString& key );
void TriggerEvent( const wxString& key );
void TriggerEvent( const wxString& key,
const boost::python::object& param );
int GetEventIndex( const wxString& key );
// - Py Interface
void RegisterCallback( const wxString& key,
const boost::python::object& obj );
void UnRegisterCallback( const wxString& key,
const boost::python::object& obj );
// Object conversions
// - Py -> C++
static wxString MakeStr( const boost::python::object& objStr );
// - C++ -> Py
static boost::python::object Convert( const wxString& wxStr );
};
#define KICAD_PY_BIND_MODULE( mod ) PyHandler::GetInstance()->AddModule( init # mod )
#endif //PYHANDLER_H
No preview for this file type
...@@ -2,8 +2,8 @@ msgid "" ...@@ -2,8 +2,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: kicad\n" "Project-Id-Version: kicad\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-02-26 16:50+0100\n" "POT-Creation-Date: 2010-02-28 15:06+0100\n"
"PO-Revision-Date: 2010-02-26 16:50+0100\n" "PO-Revision-Date: 2010-02-28 15:06+0100\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: kicad team <jean-pierre.charras@ujf-grenoble.fr>\n" "Language-Team: kicad team <jean-pierre.charras@ujf-grenoble.fr>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
...@@ -11192,7 +11192,7 @@ msgid "File <" ...@@ -11192,7 +11192,7 @@ msgid "File <"
msgstr "Fichier <" msgstr "Fichier <"
#: cvpcb/readschematicnetlist.cpp:115 #: cvpcb/readschematicnetlist.cpp:115
#: kicad/prjconfig.cpp:108 #: kicad/prjconfig.cpp:105
msgid "> not found" msgid "> not found"
msgstr "> non trouvé" msgstr "> non trouvé"
...@@ -11322,136 +11322,136 @@ msgstr "Redessin de l'écran (F3)" ...@@ -11322,136 +11322,136 @@ msgstr "Redessin de l'écran (F3)"
msgid "Zoom auto (Home)" msgid "Zoom auto (Home)"
msgstr "Zoom Automatique (Home)" msgstr "Zoom Automatique (Home)"
#: kicad/menubar.cpp:94 #: kicad/menubar.cpp:90
msgid "Open an existing project" msgid "Open an existing project"
msgstr "Ouvrir un projet existant" msgstr "Ouvrir un projet existant"
#: kicad/menubar.cpp:108 #: kicad/menubar.cpp:104
#: kicad/menubar.cpp:276 #: kicad/menubar.cpp:272
msgid "Start a new project" msgid "Start a new project"
msgstr "Créer un nouveau projet" msgstr "Créer un nouveau projet"
#: kicad/menubar.cpp:114 #: kicad/menubar.cpp:110
#: kicad/menubar.cpp:286 #: kicad/menubar.cpp:282
msgid "Save current project" msgid "Save current project"
msgstr "Sauver le projet courrant" msgstr "Sauver le projet courrant"
#: kicad/menubar.cpp:122 #: kicad/menubar.cpp:118
msgid "&Archive" msgid "&Archive"
msgstr "Archiver" msgstr "Archiver"
#: kicad/menubar.cpp:123 #: kicad/menubar.cpp:119
msgid "Archive project files in zip archive" msgid "Archive project files in zip archive"
msgstr "Archive fichiers projet dans un fichier zip" msgstr "Archive fichiers projet dans un fichier zip"
#: kicad/menubar.cpp:128 #: kicad/menubar.cpp:124
msgid "&Unarchive" msgid "&Unarchive"
msgstr "&Désarchiver" msgstr "&Désarchiver"
#: kicad/menubar.cpp:129 #: kicad/menubar.cpp:125
msgid "Unarchive project files from zip file" msgid "Unarchive project files from zip file"
msgstr "Désarchiver les fichiers du projet" msgstr "Désarchiver les fichiers du projet"
#: kicad/menubar.cpp:138 #: kicad/menubar.cpp:134
msgid "Quit KiCad" msgid "Quit KiCad"
msgstr "Quitter KiCad" msgstr "Quitter KiCad"
#: kicad/menubar.cpp:152 #: kicad/menubar.cpp:148
msgid "Text E&ditor" msgid "Text E&ditor"
msgstr "&Editeur de Texte" msgstr "&Editeur de Texte"
#: kicad/menubar.cpp:153 #: kicad/menubar.cpp:149
msgid "Open prefered text editor" msgid "Open prefered text editor"
msgstr "Lancer l'éditeur de texte préféré" msgstr "Lancer l'éditeur de texte préféré"
#: kicad/menubar.cpp:159 #: kicad/menubar.cpp:155
msgid "&View File" msgid "&View File"
msgstr "&Voir Fichier" msgstr "&Voir Fichier"
#: kicad/menubar.cpp:160 #: kicad/menubar.cpp:156
msgid "View, read or edit file with a text editor" msgid "View, read or edit file with a text editor"
msgstr "Examiner, lire ou éditer des fichiers avec l'éditeur de texte" msgstr "Examiner, lire ou éditer des fichiers avec l'éditeur de texte"
#: kicad/menubar.cpp:173 #: kicad/menubar.cpp:169
msgid "&Text Editor" msgid "&Text Editor"
msgstr "&Editeur de Texte" msgstr "&Editeur de Texte"
#: kicad/menubar.cpp:174 #: kicad/menubar.cpp:170
msgid "Select your prefered text editor" msgid "Select your prefered text editor"
msgstr "Choisir son éditeur de texte préféré" msgstr "Choisir son éditeur de texte préféré"
#: kicad/menubar.cpp:188 #: kicad/menubar.cpp:184
msgid "Use system default PDF viewer used to browse datasheets" msgid "Use system default PDF viewer used to browse datasheets"
msgstr "Utiliser le visualisateur PDF par défaut pour afficher les documentations" msgstr "Utiliser le visualisateur PDF par défaut pour afficher les documentations"
#: kicad/menubar.cpp:198 #: kicad/menubar.cpp:194
msgid "Favourite" msgid "Favourite"
msgstr "Visualisateur PDF préféré" msgstr "Visualisateur PDF préféré"
#: kicad/menubar.cpp:199 #: kicad/menubar.cpp:195
msgid "Use your favourite PDF viewer used to browse datasheets" msgid "Use your favourite PDF viewer used to browse datasheets"
msgstr "Utiliser le visualisateur PDF préféré pour afficher les documentations" msgstr "Utiliser le visualisateur PDF préféré pour afficher les documentations"
#: kicad/menubar.cpp:210 #: kicad/menubar.cpp:206
#: kicad/menubar.cpp:217 #: kicad/menubar.cpp:213
msgid "PDF Viewer" msgid "PDF Viewer"
msgstr "Visualisateur PDF" msgstr "Visualisateur PDF"
#: kicad/menubar.cpp:211 #: kicad/menubar.cpp:207
msgid "Select your favourite PDF viewer used to browse datasheets" msgid "Select your favourite PDF viewer used to browse datasheets"
msgstr "Sélectionner le visualisateur PDF favori pour afficher les documents" msgstr "Sélectionner le visualisateur PDF favori pour afficher les documents"
#: kicad/menubar.cpp:218 #: kicad/menubar.cpp:214
msgid "PDF viewer preferences" msgid "PDF viewer preferences"
msgstr "Préférences pour le visualisateur PDF" msgstr "Préférences pour le visualisateur PDF"
#: kicad/menubar.cpp:233 #: kicad/menubar.cpp:229
msgid "Open the kicad manual" msgid "Open the kicad manual"
msgstr "Ouvrir la documentation de kicad" msgstr "Ouvrir la documentation de kicad"
#: kicad/menubar.cpp:242 #: kicad/menubar.cpp:238
msgid "About kicad project manager" msgid "About kicad project manager"
msgstr "Au sujet de Kicad, gestionnaire de projet" msgstr "Au sujet de Kicad, gestionnaire de projet"
#: kicad/menubar.cpp:252 #: kicad/menubar.cpp:248
msgid "&Browse" msgid "&Browse"
msgstr "&Examiner" msgstr "&Examiner"
#: kicad/menubar.cpp:281 #: kicad/menubar.cpp:277
msgid "Load existing project" msgid "Load existing project"
msgstr "Ouvrir un projet existant" msgstr "Ouvrir un projet existant"
#: kicad/menubar.cpp:294 #: kicad/menubar.cpp:290
msgid "Archive all project files" msgid "Archive all project files"
msgstr "Archiver les fichiers du projet" msgstr "Archiver les fichiers du projet"
#: kicad/menubar.cpp:302 #: kicad/menubar.cpp:298
msgid "Refresh project tree" msgid "Refresh project tree"
msgstr "Mettre à jour l'affichage du projet" msgstr "Mettre à jour l'affichage du projet"
#: kicad/prjconfig.cpp:42 #: kicad/prjconfig.cpp:39
msgid "Project template file <kicad.pro> not found " msgid "Project template file <kicad.pro> not found "
msgstr "Fichier modèle <kicad.pro> non trouvé" msgstr "Fichier modèle <kicad.pro> non trouvé"
#: kicad/prjconfig.cpp:73 #: kicad/prjconfig.cpp:70
msgid "Create New Project" msgid "Create New Project"
msgstr "Créer un Nouveau Projet" msgstr "Créer un Nouveau Projet"
#: kicad/prjconfig.cpp:78 #: kicad/prjconfig.cpp:75
msgid "Open Existing Project" msgid "Open Existing Project"
msgstr "Ouvrir un Projet Existant" msgstr "Ouvrir un Projet Existant"
#: kicad/prjconfig.cpp:107 #: kicad/prjconfig.cpp:104
msgid "Kicad project file <" msgid "Kicad project file <"
msgstr "Fichier projet Kicad <" msgstr "Fichier projet Kicad <"
#: kicad/prjconfig.cpp:121 #: kicad/prjconfig.cpp:118
#: kicad/kicad.cpp:74 #: kicad/kicad.cpp:69
msgid "Working dir: " msgid "Working dir: "
msgstr "Répertoire de travail: " msgstr "Répertoire de travail: "
#: kicad/prjconfig.cpp:122 #: kicad/prjconfig.cpp:119
#: kicad/kicad.cpp:75 #: kicad/kicad.cpp:70
msgid "" msgid ""
"\n" "\n"
"Project: " "Project: "
...@@ -11508,7 +11508,7 @@ msgstr "" ...@@ -11508,7 +11508,7 @@ msgstr ""
"\n" "\n"
"Créer Archive zippée <%s>" "Créer Archive zippée <%s>"
#: kicad/mainframe.cpp:72 #: kicad/mainframe.cpp:68
#, c-format #, c-format
msgid "" msgid ""
"Ready\n" "Ready\n"
...@@ -11517,11 +11517,11 @@ msgstr "" ...@@ -11517,11 +11517,11 @@ msgstr ""
"Prêt\n" "Prêt\n"
"Répertoire de travail: %s\n" "Répertoire de travail: %s\n"
#: kicad/mainframe.cpp:253 #: kicad/mainframe.cpp:228
msgid "Text file (" msgid "Text file ("
msgstr "Fichier Texte (" msgstr "Fichier Texte ("
#: kicad/mainframe.cpp:255 #: kicad/mainframe.cpp:230
msgid "Load File to Edit" msgid "Load File to Edit"
msgstr "Fichier à Editer" msgstr "Fichier à Editer"
...@@ -11561,113 +11561,100 @@ msgstr "Fichier exécutable (" ...@@ -11561,113 +11561,100 @@ msgstr "Fichier exécutable ("
msgid "Select Prefered Editor" msgid "Select Prefered Editor"
msgstr "Sélection Editeur Préféré" msgstr "Sélection Editeur Préféré"
#: kicad/tree_project_frame.cpp:157 #: kicad/class_treeproject_item.cpp:128
msgid "&Run" msgid "Unable to move file ... "
msgstr "Exécute&r" msgstr "Impossible de déplacer le fichier "
#: kicad/tree_project_frame.cpp:167 #: kicad/class_treeproject_item.cpp:129
#: kicad/tree_project_frame.cpp:224 #: kicad/class_treeproject_item.cpp:204
msgid "&Edit in a text editor" msgid "Permission error ?"
msgstr "Editer avec un éditeur de Texte" msgstr "Erreur de permission ?"
#: kicad/class_treeproject_item.cpp:187
msgid ""
"Changing file extension will change file type.\n"
" Do you want to continue ?"
msgstr ""
"Changer l'extension changera le type de fichier.\n"
"Voulez vous continuer ?"
#: kicad/class_treeproject_item.cpp:189
msgid "Rename File"
msgstr "Renommer Fichier"
#: kicad/tree_project_frame.cpp:168 #: kicad/class_treeproject_item.cpp:203
msgid "&Open the file in a Text Editor" msgid "Unable to rename file ... "
msgstr "&Ouvrir le fichier avec un Editeur de texte" msgstr "Impossible de renommer le fichier... "
#: kicad/tree_project_frame.cpp:185 #: kicad/class_treeproject_item.cpp:219
msgid "Do you really want to delete "
msgstr "Voulez vous réellement effacer"
#: kicad/class_treeproject_item.cpp:220
msgid "Delete File"
msgstr "Supprimer Fichier"
#: kicad/tree_project_frame.cpp:141
msgid "New D&irectory" msgid "New D&irectory"
msgstr "&Nouveau Répertoire" msgstr "&Nouveau Répertoire"
#: kicad/tree_project_frame.cpp:186 #: kicad/tree_project_frame.cpp:142
msgid "Create a New Directory" msgid "Create a New Directory"
msgstr "Créer un nouveau Répertoire" msgstr "Créer un nouveau Répertoire"
#: kicad/tree_project_frame.cpp:195 #: kicad/tree_project_frame.cpp:157
msgid "New P&ython Script"
msgstr "Nouveau Script P&ython"
#: kicad/tree_project_frame.cpp:211
msgid "&Rename file" msgid "&Rename file"
msgstr "&Renommer fichier" msgstr "&Renommer fichier"
#: kicad/tree_project_frame.cpp:212 #: kicad/tree_project_frame.cpp:158
#: kicad/tree_project_frame.cpp:214 #: kicad/tree_project_frame.cpp:160
msgid "&Rename directory" msgid "&Rename directory"
msgstr "&Renommer répertoire" msgstr "&Renommer répertoire"
#: kicad/tree_project_frame.cpp:213 #: kicad/tree_project_frame.cpp:159
msgid "Rename file" msgid "Rename file"
msgstr "Renommer fichier" msgstr "Renommer fichier"
#: kicad/tree_project_frame.cpp:225 #: kicad/tree_project_frame.cpp:170
msgid "&Edit in a text editor"
msgstr "Editer avec un éditeur de Texte"
#: kicad/tree_project_frame.cpp:171
msgid "Open the file in a Text Editor" msgid "Open the file in a Text Editor"
msgstr "Ouvrir le fichier avec un Editeur de texte" msgstr "Ouvrir le fichier avec un Editeur de texte"
#: kicad/tree_project_frame.cpp:233 #: kicad/tree_project_frame.cpp:179
msgid "&Delete File" msgid "&Delete File"
msgstr "&Supprimer Fichier" msgstr "&Supprimer Fichier"
#: kicad/tree_project_frame.cpp:234 #: kicad/tree_project_frame.cpp:180
msgid "&Delete Directory" msgid "&Delete Directory"
msgstr "&Supprimer le Répertoire" msgstr "&Supprimer le Répertoire"
#: kicad/tree_project_frame.cpp:235 #: kicad/tree_project_frame.cpp:181
msgid "Delete the File" msgid "Delete the File"
msgstr "Supprimer le fichier" msgstr "Supprimer le fichier"
#: kicad/tree_project_frame.cpp:236 #: kicad/tree_project_frame.cpp:182
msgid "&Delete the Directory and its content" msgid "&Delete the Directory and its content"
msgstr "Effacer le Répertoire et son contenu" msgstr "Effacer le Répertoire et son contenu"
#: kicad/tree_project_frame.cpp:511 #: kicad/tree_project_frame.cpp:349
msgid "Create New File" msgid "Create New File"
msgstr "Créer un Nouveau Fichier" msgstr "Créer un Nouveau Fichier"
#: kicad/tree_project_frame.cpp:512 #: kicad/tree_project_frame.cpp:350
msgid "Create New Directory" msgid "Create New Directory"
msgstr "Créer un nouveau Répertoire" msgstr "Créer un nouveau Répertoire"
#: kicad/tree_project_frame.cpp:1057 #: kicad/tree_project_frame.cpp:854
msgid "Change filename: " msgid "Change filename: "
msgstr "Changer Nom Fichier: " msgstr "Changer Nom Fichier: "
#: kicad/tree_project_frame.cpp:1059 #: kicad/tree_project_frame.cpp:856
msgid "Change filename" msgid "Change filename"
msgstr "Changer Nom Fichier" msgstr "Changer Nom Fichier"
#: kicad/class_treeproject_item.cpp:148
msgid "Unable to move file ... "
msgstr "Impossible de déplacer le fichier "
#: kicad/class_treeproject_item.cpp:149
#: kicad/class_treeproject_item.cpp:230
msgid "Permission error ?"
msgstr "Erreur de permission ?"
#: kicad/class_treeproject_item.cpp:213
msgid ""
"Changing file extension will change file type.\n"
" Do you want to continue ?"
msgstr ""
"Changer l'extension changera le type de fichier.\n"
"Voulez vous continuer ?"
#: kicad/class_treeproject_item.cpp:215
msgid "Rename File"
msgstr "Renommer Fichier"
#: kicad/class_treeproject_item.cpp:229
msgid "Unable to rename file ... "
msgstr "Impossible de renommer le fichier... "
#: kicad/class_treeproject_item.cpp:250
msgid "Do you really want to delete "
msgstr "Voulez vous réellement effacer"
#: kicad/class_treeproject_item.cpp:251
msgid "Delete File"
msgstr "Supprimer Fichier"
#: gerbview/options.cpp:167 #: gerbview/options.cpp:167
msgid "Gerbview Options" msgid "Gerbview Options"
msgstr "Gerbview Options " msgstr "Gerbview Options "
...@@ -12187,123 +12174,123 @@ msgstr "Couleurs" ...@@ -12187,123 +12174,123 @@ msgstr "Couleurs"
msgid "Error" msgid "Error"
msgstr "Erreur" msgstr "Erreur"
#: common/zoom.cpp:185 #: common/edaappl.cpp:108
msgid "Center"
msgstr "Centrer"
#: common/zoom.cpp:199
msgid "Zoom select"
msgstr "Sélection Zoom"
#: common/zoom.cpp:218
msgid "Zoom: "
msgstr "Zoom: "
#: common/zoom.cpp:229
msgid "Grid Select"
msgstr "Sélection Grille"
#: common/richio.cpp:67
msgid "Line length exceeded"
msgstr "Longueur de ligne dépassée"
#: common/richio.cpp:177
msgid "Error writing to STRINGFORMATTER"
msgstr "Erreur d'écriture à STRINGFORMATTER"
#: common/eda_doc.cpp:149
msgid "Doc File "
msgstr "Fichier de Doc "
#: common/eda_doc.cpp:190
#, c-format
msgid "Unknown MIME type for doc file <%s>"
msgstr "MIME type inconnu pour fichier Doc <%s>"
#: common/pcbcommon.cpp:61
msgid "??? Via"
msgstr "??? Via"
#: common/pcbcommon.cpp:64
msgid "Blind/Buried Via"
msgstr "Via Aveugle/Enterrée"
#: common/pcbcommon.cpp:84
msgid "Kicad footprint library files (*.mod)|*.mod"
msgstr "Fichiers Modules Kicad (*.mod)|*.mod"
#: common/pcbcommon.cpp:87
msgid "Printed circuit board files (*.brd)|*.brd"
msgstr "Fichiers circuits imprimés (*.brd)|*.brd"
#: common/edaappl.cpp:112
msgid "French" msgid "French"
msgstr "Français" msgstr "Français"
#: common/edaappl.cpp:120 #: common/edaappl.cpp:116
msgid "Finnish" msgid "Finnish"
msgstr "Finlandais" msgstr "Finlandais"
#: common/edaappl.cpp:128 #: common/edaappl.cpp:124
msgid "Spanish" msgid "Spanish"
msgstr "Espagnol" msgstr "Espagnol"
#: common/edaappl.cpp:136 #: common/edaappl.cpp:132
msgid "Portuguese" msgid "Portuguese"
msgstr "Portugais" msgstr "Portugais"
#: common/edaappl.cpp:144 #: common/edaappl.cpp:140
msgid "Italian" msgid "Italian"
msgstr "Italien" msgstr "Italien"
#: common/edaappl.cpp:152 #: common/edaappl.cpp:148
msgid "German" msgid "German"
msgstr "Allemand" msgstr "Allemand"
#: common/edaappl.cpp:160 #: common/edaappl.cpp:156
msgid "Slovenian" msgid "Slovenian"
msgstr "Slovène" msgstr "Slovène"
#: common/edaappl.cpp:168 #: common/edaappl.cpp:164
msgid "Hungarian" msgid "Hungarian"
msgstr "Hongrois" msgstr "Hongrois"
#: common/edaappl.cpp:176 #: common/edaappl.cpp:172
msgid "Polish" msgid "Polish"
msgstr "Polonais" msgstr "Polonais"
#: common/edaappl.cpp:184 #: common/edaappl.cpp:180
msgid "Czech" msgid "Czech"
msgstr "Tchèque" msgstr "Tchèque"
#: common/edaappl.cpp:192 #: common/edaappl.cpp:188
msgid "Russian" msgid "Russian"
msgstr "Russe" msgstr "Russe"
#: common/edaappl.cpp:200 #: common/edaappl.cpp:196
msgid "Korean" msgid "Korean"
msgstr "Coréen" msgstr "Coréen"
#: common/edaappl.cpp:208 #: common/edaappl.cpp:204
msgid "Chinese simplified" msgid "Chinese simplified"
msgstr "Chinois Simplifié" msgstr "Chinois Simplifié"
#: common/edaappl.cpp:216 #: common/edaappl.cpp:212
msgid "Catalan" msgid "Catalan"
msgstr "Catalan" msgstr "Catalan"
#: common/edaappl.cpp:224 #: common/edaappl.cpp:220
msgid "Dutch" msgid "Dutch"
msgstr "Hollandais" msgstr "Hollandais"
#: common/edaappl.cpp:824 #: common/edaappl.cpp:817
msgid "Language" msgid "Language"
msgstr "Langue" msgstr "Langue"
#: common/edaappl.cpp:825 #: common/edaappl.cpp:818
msgid "Select application language (only for testing!)" msgid "Select application language (only for testing!)"
msgstr "Choisir la langue (seulement pour tests!)" msgstr "Choisir la langue (seulement pour tests!)"
#: common/zoom.cpp:185
msgid "Center"
msgstr "Centrer"
#: common/zoom.cpp:199
msgid "Zoom select"
msgstr "Sélection Zoom"
#: common/zoom.cpp:218
msgid "Zoom: "
msgstr "Zoom: "
#: common/zoom.cpp:229
msgid "Grid Select"
msgstr "Sélection Grille"
#: common/richio.cpp:67
msgid "Line length exceeded"
msgstr "Longueur de ligne dépassée"
#: common/richio.cpp:177
msgid "Error writing to STRINGFORMATTER"
msgstr "Erreur d'écriture à STRINGFORMATTER"
#: common/eda_doc.cpp:149
msgid "Doc File "
msgstr "Fichier de Doc "
#: common/eda_doc.cpp:190
#, c-format
msgid "Unknown MIME type for doc file <%s>"
msgstr "MIME type inconnu pour fichier Doc <%s>"
#: common/pcbcommon.cpp:61
msgid "??? Via"
msgstr "??? Via"
#: common/pcbcommon.cpp:64
msgid "Blind/Buried Via"
msgstr "Via Aveugle/Enterrée"
#: common/pcbcommon.cpp:84
msgid "Kicad footprint library files (*.mod)|*.mod"
msgstr "Fichiers Modules Kicad (*.mod)|*.mod"
#: common/pcbcommon.cpp:87
msgid "Printed circuit board files (*.brd)|*.brd"
msgstr "Fichiers circuits imprimés (*.brd)|*.brd"
#: common/dsnlexer.cpp:168 #: common/dsnlexer.cpp:168
msgid "in file" msgid "in file"
msgstr "dans le fichier" msgstr "dans le fichier"
...@@ -13002,6 +12989,12 @@ msgstr "Options d'Affichage" ...@@ -13002,6 +12989,12 @@ msgstr "Options d'Affichage"
msgid "Page Settings" msgid "Page Settings"
msgstr "Ajustage opt Page" msgstr "Ajustage opt Page"
#~ msgid "&Run"
#~ msgstr "Exécute&r"
#~ msgid "&Open the file in a Text Editor"
#~ msgstr "&Ouvrir le fichier avec un Editeur de texte"
#~ msgid "New P&ython Script"
#~ msgstr "Nouveau Script P&ython"
#~ msgid "noname" #~ msgid "noname"
#~ msgstr "noname" #~ msgstr "noname"
#~ msgid "noname." #~ msgid "noname."
......
/*****************************************************************************/
/**
* @file kicad.cpp
* @brief Main kicad library manager file
*/
/*****************************************************************************/
#ifdef __GNUG__
#pragma implementation
#endif
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "common.h"
#include "bitmaps.h"
#include "colors.h"
#include "kicad.h"
#include "macros.h"
#ifdef KICAD_PYTHON
#include <pyhandler.h>
#endif
/* Import functions */
char* GetFileName( char* FullPathName );
#ifdef KICAD_PYTHON
using namespace boost::python;
/*****************************************************************************/
// Global functions:
/*****************************************************************************/
static WinEDA_MainFrame& GetMainFrame()
{
return *( wxGetApp().m_MainFrame );
}
static void WinEDAPrint( str msg )
{
GetMainFrame().PrintMsg( PyHandler::MakeStr( msg ) + wxT( "\n" ) );
}
static void WinEDAClear()
{
GetMainFrame().ClearMsg();
}
static object GetTypeExt( enum TreeFileType type )
{
return PyHandler::Convert( TREE_PROJECT_FRAME::GetFileExt( type ) );
}
/*****************************************************************************/
// WinEDA_MainFrame Special binding functions:
// (one line functions are simple wrappers)
/*****************************************************************************/
object WinEDA_MainFrame::GetPrjName() const
{
return PyHandler::Convert( m_PrjFileName );
}
object WinEDA_MainFrame::ToWx()
{
return object( handle<>( borrowed( wxPyMake_wxObject( this, false ) ) ) );
}
TREE_PROJECT_FRAME* WinEDA_MainFrame::GetTree() const
{
return m_LeftWin;
}
/**
* @brief TODO
*/
/*****************************************************************************/
void WinEDA_MainFrame::AddFastLaunchPy( object& button )
/*****************************************************************************/
{
wxBitmapButton* btn;
bool success = wxPyConvertSwigPtr( button.ptr(),
(void**) &btn, _T( "wxBitmapButton" ) );
if( !success )
return;
Py_INCREF( button.ptr() );
btn->Reparent( m_CommandWin );
m_CommandWin->AddFastLaunch( btn );
}
/*****************************************************************************/
// TREE_PROJECT_FRAME Special binding functions:
// (one line functions are simple wrappers)
/*****************************************************************************/
// TODO To WxWidgets ?
object TREE_PROJECT_FRAME::ToWx()
{
return object( handle<>( borrowed( wxPyMake_wxObject( this, false ) ) ) );
}
// TODO Get ?
object TREE_PROJECT_FRAME::GetFtExPy( enum TreeFileType type ) const
{
return PyHandler::Convert( GetFileExt( type ) );
}
// Get python menu
object TREE_PROJECT_FRAME::GetMenuPy( enum TreeFileType type )
{
return object( handle<>( borrowed( wxPyMake_wxObject( GetContextMenu( (int) type ), false ) ) ) );
}
// Get tree control
object TREE_PROJECT_FRAME::GetTreeCtrl()
{
return object( handle<>( borrowed( wxPyMake_wxObject( m_TreeProject, false ) ) ) );
}
// Get current menu
object TREE_PROJECT_FRAME::GetCurrentMenu()
{
return object( handle<>( borrowed( wxPyMake_wxObject( m_PopupMenu, false ) ) ) );
}
/**
* @brief TODO
*/
/*****************************************************************************/
void TREE_PROJECT_FRAME::NewFilePy( const str& name,
enum TreeFileType type,
object& id )
/*****************************************************************************/
{
wxTreeItemId root;
if( !wxPyConvertSwigPtr( id.ptr(), (void**) &root, _T( "wxTreeItemId" ) ) )
return;
NewFile( PyHandler::MakeStr( name ), type, root );
}
/**
* @brief Add a file to the tree under root, or m_root if conversion is wrong
*/
/*****************************************************************************/
void TREE_PROJECT_FRAME::AddFilePy( const str& file, object& root )
/*****************************************************************************/
{
wxTreeItemId* theroot = &m_root;
if( !wxPyConvertSwigPtr( root.ptr(), (void**) &root, _T( "wxTreeItemId" ) ) )
{
theroot = &m_root;
}
AddFile( PyHandler::MakeStr( file ), *theroot );
}
/**
* @brief convert wxTreeItem into TREEPROJECT_ITEM
*/
/*****************************************************************************/
TREEPROJECT_ITEM* TREE_PROJECT_FRAME::GetItemData( const object& item )
/*****************************************************************************/
{
wxTreeItemId* id = NULL;
if( !wxPyConvertSwigPtr( item.ptr(), (void**) &id, _T( "wxTreeItemId" ) ) )
{
return NULL;
}
return dynamic_cast<TREEPROJECT_ITEM*>( m_TreeProject->GetItemData( *id ) );
}
/*****************************************************************************/
// TREEPROJECT_ITEM Special binding functions
// (one line functions are simple wrappers)
/*****************************************************************************/
// Python rename
bool TREEPROJECT_ITEM::RenamePy( const str& newname, bool check )
{
return Rename( PyHandler::MakeStr( newname ), check );
}
// Get python directory
object TREEPROJECT_ITEM::GetDirPy() const
{
return PyHandler::Convert( GetDir() );
}
// Get python filename
object TREEPROJECT_ITEM::GetFileNamePy() const
{
return PyHandler::Convert( GetFileName() );
}
// Get python menu
object TREEPROJECT_ITEM::GetMenuPy()
{
return object( handle<>( borrowed( wxPyMake_wxObject( &m_fileMenu, false ) ) ) );
}
/**
* @brief KiCad python module init, \n
* This function is called from PyHandler to init the kicad module
*/
/*****************************************************************************/
static void py_kicad_init()
/*****************************************************************************/
{
def( "GetMainFrame", &GetMainFrame,
return_value_policy< reference_existing_object >() );
def( "GetTypeExtension", &GetTypeExt );
class_<TREEPROJECT_ITEM>( "PrjItem" )
// Internal data:
.def( "GetFileName", &TREEPROJECT_ITEM::GetFileNamePy )
.def( "GetDir", &TREEPROJECT_ITEM::GetDirPy )
.def( "GetType", &TREEPROJECT_ITEM::GetType )
.def( "GetId", &TREEPROJECT_ITEM::GetIdPy )
.def( "GetMenu", &TREEPROJECT_ITEM::GetMenuPy )
// Item control
.def( "SetState", &TREEPROJECT_ITEM::SetState )
.def( "Rename", &TREEPROJECT_ITEM::RenamePy )
.def( "Move", &TREEPROJECT_ITEM::Move )
.def( "Delete", &TREEPROJECT_ITEM::Delete )
.def( "Activate", &TREEPROJECT_ITEM::Activate )
;
enum_<TreeFileType>( "FileType" )
.value( "PROJECT", TREE_PROJECT )
.value( "SCHEMA", TREE_SCHEMA )
.value( "BOARD", TREE_PCB )
.value( "PYSCRIPT", TREE_PY )
.value( "GERBER", TREE_GERBER )
.value( "PDF", TREE_PDF )
.value( "TXT", TREE_TXT )
.value( "NETLIST", TREE_NET )
.value( "UNKNOWN", TREE_UNKNOWN )
.value( "DIRECTORY", TREE_DIRECTORY )
.value( "MAX", TREE_MAX );
class_<TREE_PROJECT_FRAME>( "TreeWindow" )
// wx Interface
.def( "ToWx", &TREE_PROJECT_FRAME::ToWx )
// common features
.def( "GetContextMenu", &TREE_PROJECT_FRAME::GetMenuPy )
.def( "GetFileExtension", &TREE_PROJECT_FRAME::GetFtExPy )
// file filters control
.def( "AddFilter", &TREE_PROJECT_FRAME::AddFilter )
.def( "ClearFilters", &TREE_PROJECT_FRAME::ClearFilters )
.def( "RemoveFilter", &TREE_PROJECT_FRAME::RemoveFilterPy )
.def( "GetFilters", &TREE_PROJECT_FRAME::GetFilters,
return_value_policy < copy_const_reference >() )
.def( "GetCurrentMenu", &TREE_PROJECT_FRAME::GetCurrentMenu )
/** Project tree control **/
// AddState
.def( "AddState",
&TREE_PROJECT_FRAME::AddStatePy )
// GetTreeCtrl
.def( "GetTreeCtrl",
&TREE_PROJECT_FRAME::GetTreeCtrl )
// GetItemData
.def( "GetItemData",
&TREE_PROJECT_FRAME::GetItemData,
return_value_policy < reference_existing_object >() )
// FindItemData
.def( "FindItemData",
&TREE_PROJECT_FRAME::FindItemData,
return_value_policy < reference_existing_object >() )
// NewFile
.def( "NewFile",
&TREE_PROJECT_FRAME::NewFilePy )
// AddFile
.def( "AddFile",
&TREE_PROJECT_FRAME::AddFilePy )
; /* ENDOF class_<TREE_PROJECT_FRAME>( "TreeWindow" ) */
class_<WinEDA_MainFrame>( "MainFrame" )
// Wx interface
.def( "ToWx", &WinEDA_MainFrame::ToWx )
// Common controls
.def( "AddFastLaunch", &WinEDA_MainFrame::AddFastLaunchPy )
.def( "Refresh", &WinEDA_MainFrame::OnRefreshPy )
.def( "GetProjectName", &WinEDA_MainFrame::GetPrjName )
.def( "GetProjectWindow", &WinEDA_MainFrame::GetTree,
return_value_policy< reference_existing_object >() );
}
/**
* @brief Common python module init
*/
/*****************************************************************************/
static void py_common_init()
/*****************************************************************************/
{
def( "Print", &WinEDAPrint );
def( "Clear", &WinEDAClear );
}
#endif
/*****************/
/* set_color.cpp */
/*****************/
/*Set up the items and layer colors and show/no show options
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "class_drawpanel.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
//#include "protos.h"
// temporary variable used to handle grid visibility:
bool s_showGrid;
#include "set_color.h" // Header file associated with this file
// Local variables:
const int COLOR_COUNT = 40; // 40 = 29 (layers) + 11 (others)
int CurrentColor[COLOR_COUNT]; // 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_BUTTON( ID_COLOR_RESET_SHOW_LAYER_OFF, WinEDA_SetColorsFrame::ResetDisplayLayersCu )
EVT_BUTTON( ID_COLOR_RESET_SHOW_LAYER_ON, WinEDA_SetColorsFrame::ResetDisplayLayersCu )
EVT_COMMAND_RANGE( ID_COLOR_SETUP, ID_COLOR_SETUP + NB_BUTT - 1,
wxEVT_COMMAND_BUTTON_CLICKED,
WinEDA_SetColorsFrame::SetColor )
EVT_BUTTON( wxID_OK, WinEDA_SetColorsFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_SetColorsFrame::OnCancelClick )
EVT_BUTTON( wxID_APPLY, WinEDA_SetColorsFrame::OnApplyClick )
END_EVENT_TABLE()
/*****************************************************/
void DisplayColorSetupFrame( WinEDA_PcbFrame* 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 set_color.h)
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame()
{
Init();
}
// Standard Constructor
WinEDA_SetColorsFrame::WinEDA_SetColorsFrame( WinEDA_PcbFrame* 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;
FlexColumnBoxSizer = NULL;
Label = NULL;
RowBoxSizer = NULL;
BitmapButton = NULL;
CheckBox = NULL;
Button = NULL;
Line = NULL;
StdDialogButtonSizer = NULL;
}
/**********************************************************/
void WinEDA_SetColorsFrame::CreateControls()
/**********************************************************/
{
int lyr, cln, butt_ID, buttcolor;
wxString msg;
wxSize CorrectRowSize; // Used while specifying height of various spacers
int ButtonHeight; // Used while specifying height of other spacers
OuterBoxSizer = new wxBoxSizer(wxVERTICAL);
SetSizer(OuterBoxSizer);
MainBoxSizer = new wxBoxSizer(wxHORIZONTAL);
OuterBoxSizer->Add(MainBoxSizer, 1, wxGROW|wxLEFT|wxRIGHT, 5);
s_showGrid = m_Parent->m_Draw_Grid;
// Add various items to the dialog box, as determined by the
// details of each element contained within laytool_list[]
for( lyr = 0, cln = 0; lyr < NB_BUTT; lyr++ )
{
// Look for the first set of controls within each column.
if( lyr == 0 || lyr == laytool_index[cln]->m_Index + 1 )
{
if( lyr != 0 )
cln++;
// Specify a FlexGrid sizer with nineteen rows and one column.
FlexColumnBoxSizer = new wxFlexGridSizer(19, 1, 0, 0);
// Specify that all of the rows can be expanded.
for( int ii = 0; ii < 19; ii++ )
{
FlexColumnBoxSizer->AddGrowableRow(ii);
}
// Specify that the column can also be expanded.
FlexColumnBoxSizer->AddGrowableCol(0);
MainBoxSizer->Add(FlexColumnBoxSizer, 1, wxGROW|wxLEFT|wxBOTTOM, 5);
// Add a text string to identify the controls within this column.
Label = new wxStaticText( this, wxID_STATIC, wxGetTranslation(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 to accomodate the (bitmap button and) checkbox associated with the
// current layer (while providing a spacer instead a button, when appropriate).
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;
if( laytool_list[lyr]->m_Color )
{
// 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);
}
else
{
// Provide a spacer instead (rather than a bitmap button).
RowBoxSizer->Add(BUTT_SIZE_X, BUTT_SIZE_Y, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxBOTTOM, 5);
}
//---------------------------------------------------------------
// Note: When setting texts, we must call wxGetTranslation( ) for all statically created texts
// if we want them translated
switch( laytool_list[lyr]->m_Type )
{
case type_layer:
msg = m_Parent->GetBoard()->GetLayerName( laytool_list[lyr]->m_LayerNumber );
break;
case type_via:
msg = wxGetTranslation( g_ViaType_Name[laytool_list[lyr]->m_LayerNumber] );
break;
default:
msg = wxGetTranslation( laytool_list[lyr]->m_Title );
break;
}
//---------------------------------------------------------------
CheckBox = new wxCheckBox( this, ID_COLOR_CHECKBOX_ONOFF, msg,
wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
laytool_list[lyr]->m_CheckBox = CheckBox;
//---------------------------------------------------------------
switch( laytool_list[lyr]->m_Type )
{
case type_layer:
CheckBox->SetValue( g_DesignSettings.IsLayerVisible( laytool_list[lyr]->m_LayerNumber ));
CheckBox->Enable(g_DesignSettings.IsLayerEnabled( laytool_list[lyr]->m_LayerNumber ) );
break;
case type_via:
case type_element:
CheckBox->SetValue( g_DesignSettings.IsElementVisible( laytool_list[lyr]->m_LayerNumber ));
break;
case type_visual:
CheckBox->SetValue( *laytool_list[lyr]->m_NoDisplay );
break;
}
RowBoxSizer->Add(CheckBox, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5);
// Check whether the last (bitmap button and) checkbox has been provided for this column.
if( lyr == laytool_index[cln]->m_Index )
{
// What happens now depends upon which column is currently being created. Another
// two (standard/non-bitmap) buttons are provided within the first column, while
// assorted spacers are added to each of the other two columns (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).
if( cln == 0 )
{
// Provide another two buttons; for aesthetic reasons, these will both be
// made equally wide.
int GoodWidth, 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 (with
// the objective being to determine how wide those buttons would need to be to
// be able to accomodate the caption provided for either of them).
Button = new wxButton( this, ID_COLOR_RESET_SHOW_LAYER_ON, _("Show None"),
wxDefaultPosition, wxDefaultSize, 0 );
// Note the height of this button, so that the same height can also be specified for
// the spacers occupying the corresponding cells within each of the other two columns.
// Also note the width of the button required for the initially specified caption.
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( &GoodWidth, &ButtonHeight );
// Upate the value of GoodWidth if required (as that variable will subsequently
// be used to specify the (minimum) width for both of these buttons).
if( GoodWidth < width0 )
GoodWidth = width0;
// Complete the steps necessary for providing the first button.
if (WinEDA_SetColorsFrame::ShowToolTips())
Button->SetToolTip( _("Switch on all of the copper layers") );
Button->SetMinSize( wxSize( GoodWidth, ButtonHeight ) );
FlexColumnBoxSizer->Add(Button, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP, 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 copper layers") );
Button->SetMinSize( wxSize( GoodWidth, ButtonHeight ) );
FlexColumnBoxSizer->Add(Button, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP, 5);
}
else
{
// Provide additional spacers within each other column to occupy any cells
// that would otherwise remain unoccupied.
//
// Provide a spacer, of appropriate height, for each row that
// would otherwise contain a (bitmap button and) checkbox.
//
// First determine what height is required for those spacers; i.e. the
// larger of each bitmap button's height and each checkbox'es height.
// (That only needs to be determined once, so do so after the last
// bitmap button and checkbox have been provided for the second column.)
if( cln == 1 )
{
CorrectRowSize = CheckBox->GetSize();
if( CorrectRowSize.y < BUTT_SIZE_Y )
CorrectRowSize.y = BUTT_SIZE_Y;
}
// The first column contains 16 checkboxes, while each of the other two columns
// contains a smaller number. Determine how many checkboxes have actually been
// provided within each of the other columns, then provide an appropriate number
// of sizers (to take the total count of checkboxes and substitute sizers to 16).
for( int ii = lyr; ii < 16 + laytool_index[cln - 1]->m_Index
+ lyr - laytool_index[cln]->m_Index; ii++ )
{
FlexColumnBoxSizer->Add(5, CorrectRowSize.y, 1, wxBOTTOM, 5);
}
// As the first column also contains two (standard/non-bitmap) buttons, while each of
// the other two columns doesn't, also provide yet another two spacers, each of button
// height, within each of the other two columns.
FlexColumnBoxSizer->Add(5, ButtonHeight, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP, 5);
FlexColumnBoxSizer->Add(5, ButtonHeight, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP, 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 );
StdDialogButtonSizer->AddButton(Button);
Button = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
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 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 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()
/******************************************************************/
{
for( int lyr = 0; lyr < NB_BUTT; lyr++ )
{
if( laytool_list[lyr]->m_Color )
*laytool_list[lyr]->m_Color = CurrentColor[lyr];
switch( laytool_list[lyr]->m_Type )
{
case type_layer:
g_DesignSettings.SetLayerVisibility( laytool_list[lyr]->m_LayerNumber,
laytool_list[lyr]->m_CheckBox->GetValue() );
break;
case type_via:
case type_element:
g_DesignSettings.SetElementVisibility( laytool_list[lyr]->m_LayerNumber,
laytool_list[lyr]->m_CheckBox->GetValue() );
break;
case type_visual:
*laytool_list[lyr]->m_NoDisplay = laytool_list[lyr]->m_CheckBox->GetValue();
break;
}
}
// Additional command required for updating visibility of grid.
m_Parent->m_Draw_Grid = s_showGrid;
}
/**********************************************************************/
void WinEDA_SetColorsFrame::ResetDisplayLayersCu( wxCommandEvent& event )
/**********************************************************************/
{
bool NewState = ( event.GetId() == ID_COLOR_RESET_SHOW_LAYER_ON )
? TRUE
: FALSE;
for( int lyr = 0; lyr < 16; lyr++ )
{
if( ! laytool_list[lyr]->m_CheckBox->IsEnabled() )
continue;
laytool_list[lyr]->m_CheckBox->SetValue( NewState );
}
}
/***************/
/* set_color.h */
/***************/
#ifndef SET_COLOR_H
#define SET_COLOR_H
#include "wx/statline.h"
class wxBoxSizer;
class wxFlexGridSizer;
class wxStaticLine;
class wxStdDialogButtonSizer;
// variable used to handle grid visibility:
extern bool s_showGrid;
// Specify how many elements are contained within laytool_list[]
const int NB_BUTT = 43;
// 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 _("Pcbnew 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 = 25;
const int BUTT_SIZE_Y = 20;
/* Macro utile : */
#define ADR( numlayer ) &g_DesignSettings.m_LayerColor[(numlayer)]
/**********************************/
/* Liste des menus de Menu_Layers */
/**********************************/
enum button_types
{
type_layer,
type_via,
type_element,
type_visual
};
struct ColorButton
{
int m_Type; ///
const wxString m_Title;
int m_LayerNumber;
int* m_Color; ///< pointer to color variable to manipulate
bool* m_NoDisplay; ///< pointer to the on/off display control variable, if it is not the color variable
int m_Id;
wxBitmapButton* m_Button;
// int m_State; // (Commented out until when it is actually used.)
wxCheckBox* m_CheckBox; ///< Display ON/OFF toggle
};
struct ButtonIndex
{
wxString m_Name; // Title
int m_Index; // Index to last bitmap button in group
};
static ButtonIndex Msg_Layers_Cu =
{
_( "Copper Layers" ), // Title
15 // Index to last bitmap button in group
};
static ColorButton Layer_1_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
LAYER_N_BACK, // Layer
ADR( LAYER_N_BACK ) // Address of optional parameter
};
static ColorButton Layer_2_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
1, // Layer
ADR( 1 ) // Address of optional parameter
};
static ColorButton Layer_3_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
2, // Layer
ADR( 2 ) // Address of optional parameter
};
static ColorButton Layer_4_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
3, // Layer
ADR( 3 ) // Address of optional parameter
};
static ColorButton Layer_5_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
4, // Layer
ADR( 4 ) // Address of optional parameter
};
static ColorButton Layer_6_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
5, // Layer
ADR( 5 ) // Address of optional parameter
};
static ColorButton Layer_7_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
6, // Layer
ADR( 6 ) // Address of optional parameter
};
static ColorButton Layer_8_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
7, // Layer
ADR( 7 ) // Address of optional parameter
};
static ColorButton Layer_9_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
8, // Layer
ADR( 8 ) // Address of optional parameter
};
static ColorButton Layer_10_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
9, // Layer
ADR( 9 ) // Address of optional parameter
};
static ColorButton Layer_11_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
10, // Layer
ADR( 10 ) // Address of optional parameter
};
static ColorButton Layer_12_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
11, // Layer
ADR( 11 ) // Address of optional parameter
};
static ColorButton Layer_13_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
12, // Layer
ADR( 12 ) // Address of optional parameter
};
static ColorButton Layer_14_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
13, // Layer
ADR( 13 ) // Address of optional parameter
};
static ColorButton Layer_15_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
14, // Layer
ADR( 14 ) // Address of optional parameter
};
static ColorButton Layer_16_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
LAYER_N_FRONT, // Layer
ADR( LAYER_N_FRONT ) // Address of optional parameter
};
static ButtonIndex Msg_Layers_Tech =
{
_( "Tech Layers" ), // Title
28 // Index to last bitmap button in group
};
static ColorButton Layer_17_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
ADHESIVE_N_BACK, // Layer
ADR( ADHESIVE_N_BACK ) // Address of optional parameter
};
static ColorButton Layer_18_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
ADHESIVE_N_FRONT, // Layer
ADR( ADHESIVE_N_FRONT ) // Address of optional parameter
};
static ColorButton Layer_19_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
SOLDERPASTE_N_BACK, // Layer
ADR( SOLDERPASTE_N_BACK ) // Address of optional parameter
};
static ColorButton Layer_20_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
SOLDERPASTE_N_FRONT, // Layer
ADR( SOLDERPASTE_N_FRONT ), // Address of optional parameter
};
static ColorButton Layer_21_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
SILKSCREEN_N_BACK, // Layer
ADR( SILKSCREEN_N_BACK ) // Address of optional parameter
};
static ColorButton Layer_22_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
SILKSCREEN_N_FRONT, // Layer
ADR( SILKSCREEN_N_FRONT ) // Address of optional parameter
};
static ColorButton Layer_23_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
SOLDERMASK_N_BACK, // Layer
ADR( SOLDERMASK_N_BACK ) // Address of optional parameter
};
static ColorButton Layer_24_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
SOLDERMASK_N_FRONT, // Layer
ADR( SOLDERMASK_N_FRONT ) // Address of optional parameter
};
static ColorButton Layer_25_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
DRAW_N, // Layer
ADR( DRAW_N ) // Address of optional parameter
};
static ColorButton Layer_26_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
COMMENT_N, // Layer
ADR( COMMENT_N ) // Address of optional parameter
};
static ColorButton Layer_27_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
ECO1_N, // Layer
ADR( ECO1_N ) // Address of optional parameter
};
static ColorButton Layer_28_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
ECO2_N, // Layer
ADR( ECO2_N ) // Address of optional parameter
};
static ColorButton Layer_29_Butt =
{
type_layer, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
EDGE_N, // Layer
ADR( EDGE_N ) // Address of optional parameter
};
static ButtonIndex Msg_Others_Items =
{
_( "Others" ), // Title
43 // Index to last bitmap button in group
};
static ColorButton VIA_THROUGH_Butt =
{
type_via, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
VIA_THROUGH, // Layer
&g_DesignSettings.m_ViaColor[VIA_THROUGH] // Address of optional parameter
};
static ColorButton VIA_BLIND_BURIED_Butt =
{
type_via, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
VIA_BLIND_BURIED, // Layer
&g_DesignSettings.m_ViaColor[VIA_BLIND_BURIED] // Address of optional parameter
};
static ColorButton MICRO_VIA_Butt =
{
type_via, // Toggle ITEM_NOT_SHOW bit of the color variable
wxEmptyString,
VIA_MICROVIA, // Layer
&g_DesignSettings.m_ViaColor[VIA_MICROVIA] // Address of optional parameter
};
static ColorButton Ratsnest_Butt =
{
type_visual,
_( "Ratsnest" ), // Title
-1,
&g_DesignSettings.m_RatsnestColor, // Address of optional parameter
&g_Show_Ratsnest // Address of boolean display control parameter to toggle
};
static ColorButton Pad_Cu_Butt =
{
type_element, // Toggle ITEM_NOT_SHOW bit of the color variable
_( "Pad Back" ), // Title
PAD_BK_VISIBLE,
&g_PadCUColor // Address of optional parameter
};
static ColorButton Pad_Cmp_Butt =
{
type_element, // Toggle ITEM_NOT_SHOW bit of the color variable
_( "Pad Front" ), // Title
PAD_FR_VISIBLE,
&g_PadCMPColor // Address of optional parameter
};
static ColorButton Text_Mod_Cu_Butt =
{
type_element, // Toggle ITEM_NOT_SHOW bit of the color variable
_( "Text Module Back" ), // Title
MOD_TEXT_BK_VISIBLE,
&g_ModuleTextCUColor // Address of optional parameter
};
static ColorButton Text_Mod_Cmp_Butt =
{
type_element, // Toggle ITEM_NOT_SHOW bit of the color variable
_( "Text Module Front" ), // Title
MOD_TEXT_FR_VISIBLE,
&g_ModuleTextCMPColor // Address of optional parameter
};
static ColorButton Text_Mod_NoVisible_Butt =
{
type_element, // Toggle ITEM_NOT_SHOW bit of the color variable
_( "Text Module invisible" ), // Title
MOD_TEXT_INVISIBLE,
&g_ModuleTextNOVColor // Address of optional parameter
};
static ColorButton Anchors_Butt =
{
type_element, // Toggle ITEM_NOT_SHOW bit of the color variableg_ModuleTextNOVColor
_( "Anchors" ), // Title
ANCHOR_VISIBLE,
&g_AnchorColor // Address of optional parameter
};
static ColorButton Grid_Butt =
{
type_visual,
_( "Grid" ), // Title
-1,
&g_GridColor, // Address of optional parameter
&s_showGrid // Address of boolean display control parameter to toggle
};
static ColorButton Show_Pads_Noconnect_Butt =
{
type_visual,
_( "Show Noconnect" ), // Title
-1,
NULL, // Address of optional parameter
&DisplayOpt.DisplayPadNoConn // Address of boolean display control parameter to toggle
};
static ColorButton Show_Modules_Cmp_Butt =
{
type_visual,
_( "Show Modules Front" ), // Title
-1,
NULL, // Address of optional parameter
&DisplayOpt.Show_Modules_Cmp // Address of boolean display control parameter to toggle
};
static ColorButton Show_Modules_Cu_Butt =
{
type_visual,
_( "Show Modules Back" ), // Title
-1,
NULL, // Address of optional parameter
&DisplayOpt.Show_Modules_Cu // Address of boolean display control parameter to toggle
};
static ColorButton* laytool_list[] = {
&Layer_1_Butt,
&Layer_2_Butt,
&Layer_3_Butt,
&Layer_4_Butt,
&Layer_5_Butt,
&Layer_6_Butt,
&Layer_7_Butt,
&Layer_8_Butt,
&Layer_9_Butt,
&Layer_10_Butt,
&Layer_11_Butt,
&Layer_12_Butt,
&Layer_13_Butt,
&Layer_14_Butt,
&Layer_15_Butt,
&Layer_16_Butt,
&Layer_17_Butt,
&Layer_18_Butt,
&Layer_19_Butt,
&Layer_20_Butt,
&Layer_21_Butt,
&Layer_22_Butt,
&Layer_23_Butt,
&Layer_24_Butt,
&Layer_25_Butt,
&Layer_26_Butt,
&Layer_27_Butt,
&Layer_28_Butt,
&Layer_29_Butt,
// &Layer_30_Butt,
// &Layer_31_Butt,
// &Layer_32_Butt,
&VIA_THROUGH_Butt,
&VIA_BLIND_BURIED_Butt,
&MICRO_VIA_Butt,
&Ratsnest_Butt,
&Pad_Cu_Butt,
&Pad_Cmp_Butt,
&Text_Mod_Cu_Butt,
&Text_Mod_Cmp_Butt,
&Text_Mod_NoVisible_Butt,
&Anchors_Butt,
&Grid_Butt,
&Show_Pads_Noconnect_Butt,
&Show_Modules_Cmp_Butt,
&Show_Modules_Cu_Butt,
};
static ButtonIndex* laytool_index[BUTTON_GROUPS] = {
&Msg_Layers_Cu,
&Msg_Layers_Tech,
&Msg_Others_Items
};
/**************************************************************/
/* classe derivee pour la frame de Configuration des couleurs */
/**************************************************************/
class WinEDA_SetColorsFrame: public wxDialog
{
private:
DECLARE_DYNAMIC_CLASS( WinEDA_SetColorsFrame )
DECLARE_EVENT_TABLE()
WinEDA_PcbFrame* 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_PcbFrame* parent, const wxPoint& framepos );
~WinEDA_SetColorsFrame();
};
#endif // SET_COLOR_H
/**********************************************/
/* vi_edit.cpp: some editing function for vias */
/**********************************************/
#include "fctsys.h"
#include "common.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "pcbnew_id.h"
/**********************************************************************************/
void WinEDA_PcbFrame::Via_Edit_Control( wxCommandEvent& event )
/**********************************************************************************/
/*
* Execute edit commands relative to vias
*/
{
TRACK* via_struct;
SEGVIA* via = (SEGVIA*) GetCurItem();
wxClientDC dc( DrawPanel );
DrawPanel->CursorOff( &dc );
DrawPanel->PrepareGraphicContext( &dc );
wxASSERT( via->Type() == TYPE_VIA);
PICKED_ITEMS_LIST itemsListPicker;
ITEM_PICKER picker( NULL, UR_CHANGED );
switch( event.GetId() )
{
case ID_POPUP_PCB_VIA_HOLE_TO_VALUE: // Set the via drill to custom
if( (GetBoard()->GetCurrentViaDrill() > 0) &&
(GetBoard()->GetCurrentViaDrill() < via->m_Width) )
{
SaveCopyInUndoList(via, UR_CHANGED);
via->Draw( DrawPanel, &dc, GR_XOR );
via->SetDrillValue( GetBoard()->GetCurrentViaDrill() );
via->Draw( DrawPanel, &dc, GR_OR );
GetScreen()->SetModify();
}
else
DisplayError( this, _( "Incorrect value for Via drill. No via drill change" ) );
break;
case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS: // Export the current drill value to via which have the same size
via_struct = GetBoard()->m_Track;
for( ; via_struct != NULL; via_struct = via_struct->Next() )
{
if( via_struct->Type() == TYPE_VIA ) /* mise a jour du diametre de la via */
{
if( via_struct->m_Width != via->m_Width )
continue;
picker.m_PickedItem = via_struct;
picker.m_Link = via_struct->Copy();
itemsListPicker.PushItem(picker);
via_struct->Draw( DrawPanel, &dc, GR_XOR );
via_struct->SetDrillValue( via->GetDrillValue() );
via_struct->Draw( DrawPanel, &dc, GR_OR );
}
}
SaveCopyInUndoList(itemsListPicker, UR_CHANGED);
GetScreen()->SetModify();
break;
case ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT:
SaveCopyInUndoList(via, UR_CHANGED);
via->Draw( DrawPanel, &dc, GR_XOR );
via->SetDrillDefault();
via->Draw( DrawPanel, &dc, GR_OR );
GetScreen()->SetModify();
break;
case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT: // Reset all via drill to default value
via_struct = GetBoard()->m_Track;
for( ; via_struct != NULL; via_struct = via_struct->Next() )
{
if( via_struct->Type() == TYPE_VIA ) /* Update via drill */
{
if( ! via_struct->IsDrillDefault() )
{
picker.m_PickedItem = via_struct;
picker.m_Link = via_struct->Copy();
itemsListPicker.PushItem(picker);
via_struct->Draw( DrawPanel, &dc, GR_XOR );
via_struct->SetDrillDefault();
via_struct->Draw( DrawPanel, &dc, GR_OR );
}
}
}
SaveCopyInUndoList(itemsListPicker, UR_CHANGED);
GetScreen()->SetModify();
break;
case ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE: // Enter a new alternate value for drill via
wxMessageBox( wxT( "WinEDA_PcbFrame::Via_Edit_Control(): obsolete command" ) );
break;
default:
wxMessageBox( wxT( "WinEDA_PcbFrame::Via_Edit_Control() error: unknown command" ) );
break;
}
DrawPanel->CursorOn( &dc );
DrawPanel->MouseToCursorSchema();
}
...@@ -577,7 +577,7 @@ void WinEDA_PcbFrame::RecreateCmpFileFromBoard( wxCommandEvent& aEvent ) ...@@ -577,7 +577,7 @@ void WinEDA_PcbFrame::RecreateCmpFileFromBoard( wxCommandEvent& aEvent )
wildcard = _( "Component files (." ) + NetCmpExtBuffer + wxT( ")|*." ) + wildcard = _( "Component files (." ) + NetCmpExtBuffer + wxT( ")|*." ) +
NetCmpExtBuffer; NetCmpExtBuffer;
wxFileDialog dlg( this, _( "Save Component Files" ), wxEmptyString, wxFileDialog dlg( this, _( "Save Component Files" ), wxGetCwd(),
fn.GetFullName(), wildcard, fn.GetFullName(), wildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
......
release version: release version:
2010 feb 26 2010 feb 28
files (.zip,.tgz): files (.zip,.tgz):
kicad-2010-02-26-RC5 kicad-2010-02-28-RC5
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