Changed 3D module author after mail contact. Cleanup of function implementions. WinEDA_TextFrame color change (text black, background, white)

This commit is contained in:
jerryjacobs 2009-03-02 13:43:52 +00:00
parent 8a5da43c69
commit fa9230e2e5
6 changed files with 326 additions and 195 deletions

View File

@ -41,4 +41,4 @@ Remy Halvick, David Briscoe, Dominique Laigle, Paul Burke
== Programm credits for icons and others == Programm credits for icons and others
Icons by Iñigo Zuluagaz <inigo_zuluaga@yahoo.es> Icons by Iñigo Zuluagaz <inigo_zuluaga@yahoo.es>
3D modules by Renie Marquet <reniemarquet@uol.com.br> 3D modules by Renie Marquet <reniemarquet@uol.com.br>
3D modules by Cyril Frausti <cyril.frausti@gmail.com> 3D modules by Christophe Boschat <nox454@hotmail.fr>

View File

@ -140,5 +140,5 @@ void InitKiCadAbout( wxAboutDialogInfo& info )
/* Add programm credits for icons */ /* Add programm credits for icons */
info.AddArtist( wxT( "Icons by Iñigo Zuluagaz <inigo_zuluaga@yahoo.es>" ) ); info.AddArtist( wxT( "Icons by Iñigo Zuluagaz <inigo_zuluaga@yahoo.es>" ) );
info.AddArtist( SetMsg( wxT( "3D modules by Renie Marquet <reniemarquet@uol.com.br>" ) ) ); info.AddArtist( SetMsg( wxT( "3D modules by Renie Marquet <reniemarquet@uol.com.br>" ) ) );
info.AddArtist( SetMsg( wxT( "3D modules by Cyril Frausti <cyril.frausti@gmail.com>" ) ) ); info.AddArtist( SetMsg( wxT( "3D modules by Christophe Boschat <nox454@hotmail.fr>" ) ) );
} }

View File

@ -53,7 +53,8 @@ BASE_SCREEN::~BASE_SCREEN()
/*******************************/ /*******************************/
void BASE_SCREEN::InitDatas() void
BASE_SCREEN::InitDatas()
/*******************************/ /*******************************/
{ {
if( m_Center ) if( m_Center )
@ -79,19 +80,23 @@ void BASE_SCREEN::InitDatas()
m_FlagSave = 1; // Used in auto save: set when an auto save is made m_FlagSave = 1; // Used in auto save: set when an auto save is made
} }
/* /**
* Get screen units scalar. * Get screen units scalar.
* *
* Default implimentation returns scalar used for schematic screen. The * Default implimentation returns scalar used for schematic screen. The
* internal units used by the schematic screen is 1 mil (0.001"). Override * internal units used by the schematic screen is 1 mil (0.001"). Override
* this in derived classes that require internal units other than 1 mil. * this in derived classes that require internal units other than 1 mil.
*/ */
int BASE_SCREEN::GetInternalUnits( void ) int
BASE_SCREEN::GetInternalUnits( void )
{ {
return EESCHEMA_INTERNAL_UNIT; return EESCHEMA_INTERNAL_UNIT;
} }
wxSize BASE_SCREEN::ReturnPageSize( void ) /************************************/
wxSize
BASE_SCREEN::ReturnPageSize( void )
/************************************/
{ {
int internal_units = GetInternalUnits(); int internal_units = GetInternalUnits();
@ -99,13 +104,16 @@ wxSize BASE_SCREEN::ReturnPageSize( void )
( m_CurrentSheetDesc->m_Size.y * internal_units ) / 1000 ); ( m_CurrentSheetDesc->m_Size.y * internal_units ) / 1000 );
} }
/******************************************************************/
wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos ) /**
/******************************************************************/ * Function CursorRealPosition
/** Function CursorRealPosition
* @return the position in user units of location ScreenPos * @return the position in user units of location ScreenPos
* @param ScreenPos = the screen (in pixel) position co convert * @param ScreenPos = the screen (in pixel) position co convert
*/ */
/******************************************************************/
wxPoint
BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
/******************************************************************/
{ {
wxPoint curpos = ScreenPos; wxPoint curpos = ScreenPos;
Unscale( curpos ); Unscale( curpos );

View File

@ -1,16 +1,17 @@
/******************************************************************/ /**
/* basicframe.cpp - fonctions des classes du type WinEDA_BasicFrame */ * WinEDA_BasicFrame Class Functions
/******************************************************************/ * @file basicframe.cpp
*/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation # pragma implementation
#endif #endif
/* wxWidgets about dialog */
#include <wx/aboutdlg.h> #include <wx/aboutdlg.h>
#include <wx/fontdlg.h>
#include "wx/statline.h" #include "wx/statline.h"
#include "wx/generic/aboutdlgg.h" #include "wx/generic/aboutdlgg.h"
#include <wx/fontdlg.h>
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
@ -22,15 +23,18 @@
#include "wxstruct.h" #include "wxstruct.h"
/*******************************************************/ /*
/* Constructeur de WinEDA_BasicFrame: la fenetre generale */ * Class constructor for WinEDA_BasicFrame general options
/*******************************************************/ */
/**********************************************************/
WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, int idtype, WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father,
int idtype,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos,
const wxSize& size,
long style ) : long style ) :
wxFrame( father, -1, title, pos, size, style ) wxFrame( father, -1, title, pos, size, style )
/**********************************************************/
{ {
wxSize minsize; wxSize minsize;
@ -56,6 +60,9 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow* father, int idtype,
} }
/*
*
*/
/******************************************/ /******************************************/
WinEDA_BasicFrame::~WinEDA_BasicFrame() WinEDA_BasicFrame::~WinEDA_BasicFrame()
/******************************************/ /******************************************/
@ -66,18 +73,22 @@ WinEDA_BasicFrame::~WinEDA_BasicFrame()
} }
/********************************************/ /*
void WinEDA_BasicFrame::ReCreateMenuBar() * Virtual function
/********************************************/ */
/***********************************/
// Virtual function void
WinEDA_BasicFrame::ReCreateMenuBar()
/***********************************/
{ {
} }
/*********************************************/ /*******************************/
void WinEDA_BasicFrame::GetSettings() void
/*********************************************/ WinEDA_BasicFrame::GetSettings()
/*******************************/
{ {
wxString text; wxString text;
int Ypos_min; int Ypos_min;
@ -110,9 +121,10 @@ void WinEDA_BasicFrame::GetSettings()
} }
/*****************************************/ /********************************/
void WinEDA_BasicFrame::SaveSettings() void
/*****************************************/ WinEDA_BasicFrame::SaveSettings()
/********************************/
{ {
wxString text; wxString text;
wxConfig* config; wxConfig* config;
@ -137,19 +149,22 @@ void WinEDA_BasicFrame::SaveSettings()
/******************************************************/ /******************************************************/
void WinEDA_BasicFrame::PrintMsg( const wxString& text ) void
WinEDA_BasicFrame::PrintMsg( const wxString& text )
/******************************************************/ /******************************************************/
{ {
SetStatusText( text ); SetStatusText( text );
} }
/*************************************************************************/ /*
void WinEDA_BasicFrame::DisplayActivity( int PerCent, const wxString& Text ) * Display a bargraph (0 to 50 point length) for a PerCent value from 0 to 100
/*************************************************************************/
/* Display a bargraph (0 to 50 point length) for a PerCent value from 0 to 100
*/ */
/*************************************************************************/
void
WinEDA_BasicFrame::DisplayActivity( int PerCent,
const wxString& Text )
/*************************************************************************/
{ {
wxString Line; wxString Line;
@ -165,23 +180,26 @@ void WinEDA_BasicFrame::DisplayActivity( int PerCent, const wxString& Text )
} }
/*******************************************************************/ /*
void WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName ) * Met a jour la liste des anciens projets
/*******************************************************************/
/* Met a jour la liste des anciens projets
*/ */
/*******************************************************************/
void
WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName )
/*******************************************************************/
{ {
wxGetApp().m_fileHistory.AddFileToHistory( FullFileName ); wxGetApp().m_fileHistory.AddFileToHistory( FullFileName );
ReCreateMenuBar(); ReCreateMenuBar();
} }
/** /*
* Fetch the file name from the file history list. * Fetch the file name from the file history list.
*/ */
/*********************************************************************/
wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId, wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId,
const wxString& type ) const wxString& type )
/*********************************************************************/
{ {
wxString fn, msg; wxString fn, msg;
size_t i; size_t i;
@ -209,12 +227,18 @@ wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId,
} }
/*
*
*/
/**************************************************************/ /**************************************************************/
void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event ) void
WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
/**************************************************************/ /**************************************************************/
{ {
wxString msg; wxString msg;
#if defined ONLINE_HELP_FILES_FORMAT_IS_HTML #if defined ONLINE_HELP_FILES_FORMAT_IS_HTML
if( wxGetApp().m_HtmlCtrl == NULL ) if( wxGetApp().m_HtmlCtrl == NULL )
{ {
wxGetApp().InitOnLineHelp(); wxGetApp().InitOnLineHelp();
@ -231,6 +255,7 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
msg.Printf( _( "Help file %s not found" ), wxGetApp().m_HelpFileName.GetData() ); msg.Printf( _( "Help file %s not found" ), wxGetApp().m_HelpFileName.GetData() );
DisplayError( this, msg ); DisplayError( this, msg );
} }
#elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF #elif defined ONLINE_HELP_FILES_FORMAT_IS_PDF
// wxString fullfilename = FindKicadHelpPath() + wxGetApp().m_HelpFileName; // wxString fullfilename = FindKicadHelpPath() + wxGetApp().m_HelpFileName;
// if ( wxFileExists(fullfilename) ) // if ( wxFileExists(fullfilename) )
@ -252,12 +277,17 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
GetAssociatedDocument( this, wxEmptyString, helpFile ); GetAssociatedDocument( this, wxEmptyString, helpFile );
#else #else
#error Help files format not defined # error Help files format not defined
#endif #endif
} }
/*
*
*/
/***********************************************************************/ /***********************************************************************/
void WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& WXUNUSED(event) ) void
WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& WXUNUSED(event) )
/***********************************************************************/ /***********************************************************************/
{ {
wxAboutDialogInfo info; wxAboutDialogInfo info;
@ -266,8 +296,12 @@ void WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& WXUNUSED(event) )
} }
/*
*
*/
/********************************************************************/ /********************************************************************/
void WinEDA_BasicFrame::ProcessFontPreferences( int id ) void
WinEDA_BasicFrame::ProcessFontPreferences( int id )
/********************************************************************/ /********************************************************************/
{ {
wxFont font; wxFont font;
@ -308,3 +342,4 @@ void WinEDA_BasicFrame::ProcessFontPreferences( int id )
break; break;
} }
} }

View File

@ -1,9 +1,6 @@
/**********************************************************/ /**********************************************************/
/* Routines d'affichage de parametres et caracteristiques */ /* Routines d'affichage de parametres et caracteristiques */
/**********************************************************/ /**********************************************************/
/* Fichier common.cpp */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "trigo.h" #include "trigo.h"
@ -15,50 +12,49 @@
#include "confirm.h" #include "confirm.h"
#include <wx/process.h> #include <wx/process.h>
/*****************************/
wxString GetBuildVersion()
/*****************************/
/* Return the build date /*
* Return the build date
*/ */
/****************/
wxString
GetBuildVersion()
/****************/
{ {
return g_BuildVersion; return g_BuildVersion;
} }
/*********************************************/ /*
/* Return custom build date for about dialog */ * Return custom build date for about dialog
/*********************************************/ */
wxString GetAboutBuildVersion() wxString
GetAboutBuildVersion()
/*********************************************/ /*********************************************/
{ {
return g_BuildAboutVersion; return g_BuildAboutVersion;
} }
/********************************/
void SetLocaleTo_C_standard( void )
/********************************/
/** function SetLocaleTo_C_standard /** function SetLocaleTo_C_standard
* because kicad is internationalized, switch internatization to "C" standard * because kicad is internationalized, switch internatization to "C" standard
* i.e. uses the . (dot) as separator in print/read float numbers * i.e. uses the . (dot) as separator in print/read float numbers
* (some contries (France, Germany ..) use , (comma) as separator) * (some contries (France, Germany ..) use , (comma) as separator)
* This function must be called before read or write ascii files using float numbers in data * This function must be called before read or write ascii files using float numbers in data
* the SetLocaleTo_C_standard function must be called after reading or writing the file * the SetLocaleTo_C_standard function must be called after reading or writing the file
* *
* This is wrapper to the C setlocale( LC_NUMERIC, "C" ) function, * This is wrapper to the C setlocale( LC_NUMERIC, "C" ) function,
* but could make more easier an optional use of locale in kicad * but could make more easier an optional use of locale in kicad
*/ */
/********************************/
void
SetLocaleTo_C_standard( void )
/********************************/
{ {
setlocale( LC_NUMERIC, "C" ); // Switch the locale to standard C setlocale( LC_NUMERIC, "C" ); // Switch the locale to standard C
} }
/********************************/
void SetLocaleTo_Default( void )
/********************************/
/** function SetLocaleTo_Default /** function SetLocaleTo_Default
* because kicad is internationalized, switch internatization to default * because kicad is internationalized, switch internatization to default
* to use the default separator in print/read float numbers * to use the default separator in print/read float numbers
@ -68,13 +64,18 @@ void SetLocaleTo_Default( void )
* This is wrapper to the C setlocale( LC_NUMERIC, "" ) function, * This is wrapper to the C setlocale( LC_NUMERIC, "" ) function,
* but could make more easier an optional use of locale in kicad * but could make more easier an optional use of locale in kicad
*/ */
/********************************/
void SetLocaleTo_Default( void )
/********************************/
{ {
setlocale( LC_NUMERIC, "" ); // revert to the current locale setlocale( LC_NUMERIC, "" ); // revert to the current locale
} }
/********************************************************************/ /********************************************************************/
bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString ) bool
EnsureTextCtrlWidth(wxTextCtrl* aCtrl,
const wxString* aString )
/********************************************************************/ /********************************************************************/
{ {
wxWindow* window = aCtrl->GetParent(); wxWindow* window = aCtrl->GetParent();
@ -110,7 +111,9 @@ bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString )
/*********************************************************************************************/ /*********************************************************************************************/
Ki_PageDescr::Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxString& name ) Ki_PageDescr::Ki_PageDescr(const wxSize& size,
const wxPoint& offset,
const wxString& name )
/*********************************************************************************************/ /*********************************************************************************************/
{ {
// All sizes are in 1/1000 inch // All sizes are in 1/1000 inch
@ -131,7 +134,8 @@ Ki_PageDescr::Ki_PageDescr( const wxSize& size, const wxPoint& offset, const wxS
/************************************/ /************************************/
wxString ReturnUnitSymbol( int Units ) wxString
ReturnUnitSymbol( int Units )
/************************************/ /************************************/
{ {
wxString label; wxString label;
@ -154,13 +158,15 @@ wxString ReturnUnitSymbol( int Units )
} }
/**************************************************/ /*
void AddUnitSymbol( wxStaticText& Stext, int Units ) * Add string " (mm):" or " ("):" to the static text Stext.
/**************************************************/
/* Add string " (mm):" or " ("):" to the static text Stext.
* Used in dialog boxes for entering values depending on selected units * Used in dialog boxes for entering values depending on selected units
*/ */
/**************************************************/
void
AddUnitSymbol(wxStaticText& Stext,
int Units )
/**************************************************/
{ {
wxString msg = Stext.GetLabel() + ReturnUnitSymbol( Units ); wxString msg = Stext.GetLabel() + ReturnUnitSymbol( Units );
@ -168,13 +174,16 @@ void AddUnitSymbol( wxStaticText& Stext, int Units )
} }
/****************************************************************************/ /*
void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value, int Internal_Unit ) * Convert the number Value in a string according to the internal units
/****************************************************************************/
/* Convert the number Value in a string according to the internal units
* and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl * and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl
*/ */
/******************************************/
void
PutValueInLocalUnits( wxTextCtrl& TextCtr,
int Value,
int Internal_Unit )
/*****************************************/
{ {
wxString msg = ReturnStringFromValue( g_UnitMetric, Value, Internal_Unit ); wxString msg = ReturnStringFromValue( g_UnitMetric, Value, Internal_Unit );
@ -182,13 +191,15 @@ void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value, int Internal_Unit )
} }
/*******************************************************************/ /*
int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit ) * Convert the Value in the wxTextCtrl TextCtrl in an integer,
/********************************************************************/
/* Convert the Value in the wxTextCtrl TextCtrl in an integer,
* according to the internal units and the selected unit (g_UnitMetric) * according to the internal units and the selected unit (g_UnitMetric)
*/ */
/***************************************************/
int
ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr,
int Internal_Unit )
/***************************************************/
{ {
int value; int value;
wxString msg = TextCtr.GetValue(); wxString msg = TextCtr.GetValue();
@ -199,10 +210,6 @@ int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit )
} }
/**************************************************************************************************/
wxString ReturnStringFromValue( int aUnits, int aValue, int aInternal_Unit, bool aAdd_unit_symbol )
/**************************************************************************************************/
/** Function ReturnStringFromValue /** Function ReturnStringFromValue
* Return the string from Value, according to units (inch, mm ...) for display, * Return the string from Value, according to units (inch, mm ...) for display,
* and the initial unit for value * and the initial unit for value
@ -212,6 +219,13 @@ wxString ReturnStringFromValue( int aUnits, int aValue, int aInternal_Unit, boo
* @param aAdd_unit_symbol = true to add symbol unit to the string value * @param aAdd_unit_symbol = true to add symbol unit to the string value
* @return a wxString what contains value and optionnaly the sumbol unit (like 2.000 mm) * @return a wxString what contains value and optionnaly the sumbol unit (like 2.000 mm)
*/ */
/*******************************************/
wxString
ReturnStringFromValue(int aUnits,
int aValue,
int aInternal_Unit,
bool aAdd_unit_symbol)
/*******************************************/
{ {
wxString StringValue; wxString StringValue;
double value_to_print; double value_to_print;
@ -244,16 +258,19 @@ wxString ReturnStringFromValue( int aUnits, int aValue, int aInternal_Unit, boo
} }
/****************************************************************************/ /*
int ReturnValueFromString( int Units, const wxString& TextValue, int Internal_Unit ) * Return the string from Value, according to units (inch, mm ...) for display,
/****************************************************************************/
/* Return the string from Value, according to units (inch, mm ...) for display,
* and the initial unit for value * and the initial unit for value
* Unit = display units (INCH, MM ..) * Unit = display units (INCH, MM ..)
* Value = text * Value = text
* Internal_Unit = units per inch for computed value * Internal_Unit = units per inch for computed value
*/ */
/****************************************************************************/
int
ReturnValueFromString( int Units,
const wxString& TextValue,
int Internal_Unit )
/****************************************************************************/
{ {
int Value; int Value;
double dtmp = 0; double dtmp = 0;
@ -268,12 +285,15 @@ int ReturnValueFromString( int Units, const wxString& TextValue, int Internal_Un
} }
/******************************************************************/ /*
double To_User_Unit( bool is_metric, int val, int internal_unit_value ) * Convert in inch or mm the variable "val" given in internal units
/******************************************************************/
/* Convert in inch or mm the variable "val" given in internal units
*/ */
/******************************************************************/
double
To_User_Unit( bool is_metric,
int val,
int internal_unit_value )
/******************************************************************/
{ {
double value; double value;
@ -286,12 +306,15 @@ double To_User_Unit( bool is_metric, int val, int internal_unit_value )
} }
/**********************************************************************/ /*
int From_User_Unit( bool is_metric, double val, int internal_unit_value ) * Return in internal units the value "val" given in inch or mm
/**********************************************************************/
/* Return in internal units the value "val" given in inch or mm
*/ */
/*****************************************/
int
From_User_Unit( bool is_metric,
double val,
int internal_unit_value )
/*****************************************/
{ {
double value; double value;
@ -304,12 +327,13 @@ int From_User_Unit( bool is_metric, double val, int internal_unit_value )
} }
/**********************/ /*
wxString GenDate() * Return the string date "day month year" like "23 jun 2005"
/**********************/
/* Return the string date "day month year" like "23 jun 2005"
*/ */
/********/
wxString
GenDate()
/********/
{ {
static const wxString mois[12] = static const wxString mois[12] =
{ {
@ -330,10 +354,13 @@ wxString GenDate()
} }
/*
* My memory allocation
*/
/***********************************/ /***********************************/
void* MyMalloc( size_t nb_octets ) void*
MyMalloc( size_t nb_octets )
/***********************************/ /***********************************/
/* My memory allocation */
{ {
void* pt_mem; void* pt_mem;
@ -353,10 +380,6 @@ void* MyMalloc( size_t nb_octets )
} }
/**************************************************************/
bool ProcessExecute( const wxString& aCommandLine, int aFlags )
/**************************************************************/
/** /**
* Function ProcessExecute * Function ProcessExecute
* runs a child process. * runs a child process.
@ -364,6 +387,11 @@ bool ProcessExecute( const wxString& aCommandLine, int aFlags )
* @param aFlags The same args as allowed for wxExecute() * @param aFlags The same args as allowed for wxExecute()
* @return bool - true if success, else false * @return bool - true if success, else false
*/ */
/********************************************/
bool
ProcessExecute( const wxString& aCommandLine,
int aFlags )
/********************************************/
{ {
#ifdef __WINDOWS__ #ifdef __WINDOWS__
int pid = wxExecute( aCommandLine ); int pid = wxExecute( aCommandLine );
@ -375,12 +403,13 @@ bool ProcessExecute( const wxString& aCommandLine, int aFlags )
} }
/************************************/ /*
void* MyZMalloc( size_t nb_octets ) * My memory allocation, memory space is cleared
/************************************/
/* My memory allocation, memory space is cleared
*/ */
/*****************************/
void*
MyZMalloc( size_t nb_octets )
/*****************************/
{ {
void* pt_mem = MyMalloc( nb_octets ); void* pt_mem = MyMalloc( nb_octets );
@ -391,7 +420,8 @@ void* MyZMalloc( size_t nb_octets )
/*******************************/ /*******************************/
void MyFree( void* pt_mem ) void
MyFree( void* pt_mem )
/*******************************/ /*******************************/
{ {
if( pt_mem ) if( pt_mem )
@ -399,14 +429,16 @@ void MyFree( void* pt_mem )
} }
/**************************************************************/ /*
wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding ) * Return the name of the layer number "layer_number".
/**************************************************************/
/* Return the name of the layer number "layer_number".
* if omitSpacePadding == TRUE, the name can be used for a file name * if omitSpacePadding == TRUE, the name can be used for a file name
* (no spaces, replaced by _) * (no spaces, replaced by _)
*/ */
/**************************************************************/
wxString
ReturnPcbLayerName( int layer_number,
bool omitSpacePadding )
/**************************************************************/
{ {
const unsigned LAYER_LIMIT = 29; const unsigned LAYER_LIMIT = 29;
@ -455,11 +487,23 @@ EVT_CLOSE( WinEDA_TextFrame::OnClose )
END_EVENT_TABLE() END_EVENT_TABLE()
/***************************************************************************/ /***************************************************************************/
WinEDA_TextFrame::WinEDA_TextFrame( wxWindow* parent, const wxString& title ) : WinEDA_TextFrame::WinEDA_TextFrame( wxWindow* parent,
wxDialog( parent, -1, title, wxPoint( -1, -1 ), wxSize( 250, 350 ), const wxString& title ) :
wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER ) wxDialog( parent,
-1, title,
wxPoint( -1, -1 ),
wxSize( 250, 350 ),
wxDEFAULT_DIALOG_STYLE |
wxFRAME_FLOAT_ON_PARENT |
MAYBE_RESIZE_BORDER )
/***************************************************************************/ /***************************************************************************/
{ {
/*
* TODO background and foreground colors of WinEDA_TextFrame should be
* controllable / settable with project settings or config file and not
* hardcoded in binairy !
*/
wxSize size; wxSize size;
m_Parent = parent; m_Parent = parent;
@ -467,18 +511,26 @@ WinEDA_TextFrame::WinEDA_TextFrame( wxWindow* parent, const wxString& title ) :
CentreOnParent(); CentreOnParent();
size = GetClientSize(); size = GetClientSize();
m_List = new wxListBox( this, ID_TEXTBOX_LIST, m_List = new wxListBox( this,
wxPoint( 0, 0 ), size, ID_TEXTBOX_LIST,
0, NULL, wxPoint( 0, 0 ),
wxLB_ALWAYS_SB | wxLB_SINGLE ); size,
0, NULL,
wxLB_ALWAYS_SB | wxLB_SINGLE );
/* The color of the text in the wxListBox (black) */
m_List->SetBackgroundColour( wxColour( 255, 255, 255 ) );
/* The foreground color of the wxListBox (white) */
m_List->SetForegroundColour( wxColour( 0, 0, 0 ) );
m_List->SetBackgroundColour( wxColour( 200, 255, 255 ) );
SetReturnCode( -1 ); SetReturnCode( -1 );
} }
/***************************************************/ /***************************************************/
void WinEDA_TextFrame::Append( const wxString& text ) void
WinEDA_TextFrame::Append( const wxString& text )
/***************************************************/ /***************************************************/
{ {
m_List->Append( text ); m_List->Append( text );
@ -486,7 +538,8 @@ void WinEDA_TextFrame::Append( const wxString& text )
/**********************************************************/ /**********************************************************/
void WinEDA_TextFrame::D_ClickOnList( wxCommandEvent& event ) void
WinEDA_TextFrame::D_ClickOnList( wxCommandEvent& event )
/**********************************************************/ /**********************************************************/
{ {
int ii = m_List->GetSelection(); int ii = m_List->GetSelection();
@ -496,19 +549,15 @@ void WinEDA_TextFrame::D_ClickOnList( wxCommandEvent& event )
/*************************************************/ /*************************************************/
void WinEDA_TextFrame::OnClose( wxCloseEvent& event ) void
WinEDA_TextFrame::OnClose( wxCloseEvent& event )
/*************************************************/ /*************************************************/
{ {
EndModal( -1 ); EndModal( -1 );
} }
/*****************************************************************************/ /**
void Affiche_1_Parametre( WinEDA_DrawFrame* frame, int pos_X,
const wxString& texte_H, const wxString& texte_L, int color )
/*****************************************************************************/
/*
* Routine d'affichage d'un parametre. * Routine d'affichage d'un parametre.
* pos_X = cadrage horizontal * pos_X = cadrage horizontal
* si pos_X < 0 : la position horizontale est la derniere * si pos_X < 0 : la position horizontale est la derniere
@ -519,18 +568,28 @@ void Affiche_1_Parametre( WinEDA_DrawFrame* frame, int pos_X,
* si "", par d'affichage sur cette ligne * si "", par d'affichage sur cette ligne
* color = couleur d'affichage * color = couleur d'affichage
*/ */
/*****************************************************************************/
void Affiche_1_Parametre( WinEDA_DrawFrame* frame,
int pos_X,
const wxString& texte_H,
const wxString& texte_L,
int color )
/*****************************************************************************/
{ {
frame->MsgPanel->Affiche_1_Parametre( pos_X, texte_H, texte_L, color ); frame->MsgPanel->Affiche_1_Parametre( pos_X,
texte_H,
texte_L,
color );
} }
/****************************************************************************/
void AfficheDoc( WinEDA_DrawFrame* frame, const wxString& Doc, const wxString& KeyW )
/****************************************************************************/
/* /*
* Routine d'affichage de la documentation associee a un composant * Routine d'affichage de la documentation associee a un composant
*/ */
/****************************************************************************/
void
AfficheDoc( WinEDA_DrawFrame* frame, const wxString& Doc, const wxString& KeyW )
/****************************************************************************/
{ {
wxString Line1( wxT( "Doc: " ) ), Line2( wxT( "KeyW: " ) ); wxString Line1( wxT( "Doc: " ) ), Line2( wxT( "KeyW: " ) );
@ -564,17 +623,18 @@ int GetTimeStamp()
} }
/**************************************************************/
const wxString& valeur_param( int valeur, wxString& buf_texte )
/**************************************************************/
/** /**
* @todo replace this obsolete funtion by ReturnStringFromValue * TODO replace this obsolete funtion by ReturnStringFromValue
* Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies * Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies
* entree : valeur en mils , buffer de texte * entree : valeur en mils , buffer de texte
* retourne en buffer : texte : valeur exprimee en pouces ou millimetres * retourne en buffer : texte : valeur exprimee en pouces ou millimetres
* suivie de " ou mm * suivie de " ou mm
*/ */
/*********************************************/
const
wxString& valeur_param( int valeur,
wxString& buf_texte )
/*********************************************/
{ {
if( g_UnitMetric ) if( g_UnitMetric )
{ {
@ -589,7 +649,14 @@ const wxString& valeur_param( int valeur, wxString& buf_texte )
} }
wxString& operator <<( wxString& aString, const wxPoint& aPos ) /*
*
*/
/**********************************/
wxString&
operator <<( wxString& aString,
const wxPoint& aPos )
/*********************************/
{ {
wxString temp; wxString temp;
@ -601,11 +668,16 @@ wxString& operator <<( wxString& aString, const wxPoint& aPos )
} }
#ifdef __MSVC__ // compilers that does not have the round function (posix) /* compilers that does not have the round function (posix) */
/* return the nearest rounded ( equivalent to the nearest integer value) #ifdef __MSVC__
/*
* return the nearest rounded ( equivalent to the nearest integer value)
* from aNumber * from aNumber
*/ */
double round( double aNumber ) /**********************/
double
round( double aNumber )
/**********************/
{ {
return floor( aNumber + 0.5 ); return floor( aNumber + 0.5 );
} }

View File

@ -1,7 +1,7 @@
/*************************************************/ /**
/* drawtxt.cpp : Function to draw and plot texts */ * Functions to draw and plot text on screen
/*************************************************/ * @file drawtxt.cpp
*/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -14,24 +14,12 @@
#include "class_base_screen.h" #include "class_base_screen.h"
#ifndef DEFAULT_SIZE_TEXT #ifndef DEFAULT_SIZE_TEXT
#define DEFAULT_SIZE_TEXT 50 # define DEFAULT_SIZE_TEXT 50
#endif #endif
#define EDA_DRAWBASE #define EDA_DRAWBASE
#include "grfonte.h" #include "grfonte.h"
/* fonctions locales : */
/****************************************************************************************************/
void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aPos, EDA_Colors aColor, const wxString& aText,
int aOrient, const wxSize& aSize,
enum GRTextHorizJustifyType aH_justify,
enum GRTextVertJustifyType aV_justify,
int aWidth, bool aItalic,
void (* aCallback) (int x0, int y0, int xf, int yf))
/****************************************************************************************************/
/** Function DrawGraphicText /** Function DrawGraphicText
* Draw a graphic text (like module texts) * Draw a graphic text (like module texts)
@ -50,6 +38,20 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* @param aCallback() = function called (if non null) to draw each segment. * @param aCallback() = function called (if non null) to draw each segment.
* used to draw 3D texts or for plotting, NULL for normal drawings * used to draw 3D texts or for plotting, NULL for normal drawings
*/ */
/****************************************************************************************************/
void DrawGraphicText( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
const wxPoint& aPos,
EDA_Colors aColor,
const wxString& aText,
int aOrient,
const wxSize& aSize,
enum GRTextHorizJustifyType aH_justify,
enum GRTextVertJustifyType aV_justify,
int aWidth,
bool aItalic,
void (* aCallback) (int x0, int y0, int xf, int yf))
/****************************************************************************************************/
{ {
int ii, kk, char_count, AsciiCode, endcar; int ii, kk, char_count, AsciiCode, endcar;
int x0, y0; int x0, y0;
@ -313,8 +315,18 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, wxDC* aDC,
/* functions used to plot texts, using DrawGraphicText() with a call back function */ /* functions used to plot texts, using DrawGraphicText() with a call back function */
static void (*MovePenFct)( wxPoint pos, int state ); // a pointer to actual plot function (HPGL, PS, ..) static void (*MovePenFct)( wxPoint pos, int state ); // a pointer to actual plot function (HPGL, PS, ..)
static bool s_Plotbegin; // Flag to init plot static bool s_Plotbegin; // Flag to init plot
/* The call back function */
static void s_Callback_plot(int x0, int y0, int xf, int yf)
/*
* The call back function
*/
/**********************/
static void
s_Callback_plot(int x0,
int y0,
int xf,
int yf)
/**********************/
{ {
static wxPoint PenLastPos; static wxPoint PenLastPos;
wxPoint pstart; wxPoint pstart;
@ -347,15 +359,6 @@ static void s_Callback_plot(int x0, int y0, int xf, int yf)
} }
/******************************************************************************************/
void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aColor,
const wxString& aText,
int aOrient, const wxSize& aSize,
enum GRTextHorizJustifyType aH_justify,
enum GRTextVertJustifyType aV_justify,
int aWidth, bool aItalic )
/******************************************************************************************/
/** Function PlotGraphicText /** Function PlotGraphicText
* same as DrawGraphicText, but plot graphic text insteed of draw it * same as DrawGraphicText, but plot graphic text insteed of draw it
* @param aFormat_plot = plot format (PLOT_FORMAT_POST, PLOT_FORMAT_HPGL, PLOT_FORMAT_GERBER) * @param aFormat_plot = plot format (PLOT_FORMAT_POST, PLOT_FORMAT_HPGL, PLOT_FORMAT_GERBER)
@ -370,6 +373,18 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
* if width < 0 : draw segments in sketch mode, width = abs(width) * if width < 0 : draw segments in sketch mode, width = abs(width)
* @param aItalic = true to simulate an italic font * @param aItalic = true to simulate an italic font
*/ */
/******************************************************************************************/
void PlotGraphicText( int aFormat_plot,
const wxPoint& aPos,
enum EDA_Colors aColor,
const wxString& aText,
int aOrient,
const wxSize& aSize,
enum GRTextHorizJustifyType aH_justify,
enum GRTextVertJustifyType aV_justify,
int aWidth,
bool aItalic )
/******************************************************************************************/
{ {
// Initialise the actual function used to plot lines: // Initialise the actual function used to plot lines:
switch( aFormat_plot ) switch( aFormat_plot )
@ -403,3 +418,4 @@ void PlotGraphicText( int aFormat_plot, const wxPoint& aPos, enum EDA_Colors aCo
/* end text : pen UP ,no move */ /* end text : pen UP ,no move */
MovePenFct( wxPoint( 0, 0 ), 'Z' ); MovePenFct( wxPoint( 0, 0 ), 'Z' );
} }