Commit 750f84c1 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Coding style policy fixes and dead code removal.

parent ebc7259a
...@@ -175,7 +175,7 @@ Info_3D_Visu::~Info_3D_Visu() ...@@ -175,7 +175,7 @@ Info_3D_Visu::~Info_3D_Visu()
* units */ * units */
WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title, WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
wxBoxSizer* BoxSizer, wxBoxSizer* BoxSizer,
UserUnitType units, int internal_unit ) EDA_UNITS_T units, int internal_unit )
{ {
wxString text; wxString text;
wxStaticText* msgtitle; wxStaticText* msgtitle;
......
...@@ -123,7 +123,7 @@ private: ...@@ -123,7 +123,7 @@ private:
public: public:
WinEDA_VertexCtrl( wxWindow* parent, const wxString& title, WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
wxBoxSizer* BoxSizer, UserUnitType units, int internal_unit ); wxBoxSizer* BoxSizer, EDA_UNITS_T units, int internal_unit );
~WinEDA_VertexCtrl(); ~WinEDA_VertexCtrl();
......
...@@ -334,7 +334,7 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id ) ...@@ -334,7 +334,7 @@ void BASE_SCREEN::AddGrid( const wxRealPoint& size, int id )
} }
void BASE_SCREEN::AddGrid( const wxRealPoint& size, UserUnitType aUnit, int id ) void BASE_SCREEN::AddGrid( const wxRealPoint& size, EDA_UNITS_T aUnit, int id )
{ {
double x, y; double x, y;
wxRealPoint new_size; wxRealPoint new_size;
......
...@@ -78,7 +78,7 @@ wxString g_Prj_Default_Config_FullFilename; ...@@ -78,7 +78,7 @@ wxString g_Prj_Default_Config_FullFilename;
wxString g_Prj_Config_LocalFilename; wxString g_Prj_Config_LocalFilename;
/* Current user unit of measure */ /* Current user unit of measure */
UserUnitType g_UserUnit; EDA_UNITS_T g_UserUnit;
/* Draw color for moving objects: */ /* Draw color for moving objects: */
int g_GhostColor; int g_GhostColor;
...@@ -221,7 +221,7 @@ Ki_PageDescr::Ki_PageDescr( const wxSize& size, ...@@ -221,7 +221,7 @@ Ki_PageDescr::Ki_PageDescr( const wxSize& size,
} }
wxString ReturnUnitSymbol( UserUnitType aUnit, const wxString& formatString ) wxString ReturnUnitSymbol( EDA_UNITS_T aUnit, const wxString& formatString )
{ {
wxString tmp; wxString tmp;
wxString label; wxString label;
...@@ -249,7 +249,7 @@ wxString ReturnUnitSymbol( UserUnitType aUnit, const wxString& formatString ) ...@@ -249,7 +249,7 @@ wxString ReturnUnitSymbol( UserUnitType aUnit, const wxString& formatString )
} }
wxString GetUnitsLabel( UserUnitType aUnit ) wxString GetUnitsLabel( EDA_UNITS_T aUnit )
{ {
wxString label; wxString label;
...@@ -272,7 +272,7 @@ wxString GetUnitsLabel( UserUnitType aUnit ) ...@@ -272,7 +272,7 @@ wxString GetUnitsLabel( UserUnitType aUnit )
} }
wxString GetAbbreviatedUnitsLabel( UserUnitType aUnit ) wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit )
{ {
wxString label; wxString label;
...@@ -298,7 +298,7 @@ wxString GetAbbreviatedUnitsLabel( UserUnitType aUnit ) ...@@ -298,7 +298,7 @@ wxString GetAbbreviatedUnitsLabel( UserUnitType aUnit )
* 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, UserUnitType aUnit ) void AddUnitSymbol( wxStaticText& Stext, EDA_UNITS_T aUnit )
{ {
wxString msg = Stext.GetLabel(); wxString msg = Stext.GetLabel();
...@@ -346,7 +346,7 @@ int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit ) ...@@ -346,7 +346,7 @@ int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit )
* @return a wxString what contains value and optionally the symbol unit * @return a wxString what contains value and optionally the symbol unit
* (like 2.000 mm) * (like 2.000 mm)
*/ */
wxString ReturnStringFromValue( UserUnitType aUnit, int aValue, int aInternal_Unit, wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, int aInternal_Unit,
bool aAdd_unit_symbol ) bool aAdd_unit_symbol )
{ {
wxString StringValue; wxString StringValue;
...@@ -384,7 +384,7 @@ wxString ReturnStringFromValue( UserUnitType aUnit, int aValue, int aInternal_Un ...@@ -384,7 +384,7 @@ wxString ReturnStringFromValue( UserUnitType aUnit, int aValue, int aInternal_Un
* Value = text * Value = text
* Internal_Unit = units per inch for computed value * Internal_Unit = units per inch for computed value
*/ */
int ReturnValueFromString( UserUnitType aUnit, const wxString& TextValue, int ReturnValueFromString( EDA_UNITS_T aUnit, const wxString& TextValue,
int Internal_Unit ) int Internal_Unit )
{ {
int Value; int Value;
...@@ -479,7 +479,7 @@ wxArrayString* wxStringSplit( wxString txt, wxChar splitter ) ...@@ -479,7 +479,7 @@ wxArrayString* wxStringSplit( wxString txt, wxChar splitter )
* @param val : double : the given value * @param val : double : the given value
* @param internal_unit_value = internal units per inch * @param internal_unit_value = internal units per inch
*/ */
double To_User_Unit( UserUnitType aUnit, double val, int internal_unit_value ) double To_User_Unit( EDA_UNITS_T aUnit, double val, int internal_unit_value )
{ {
switch( aUnit ) switch( aUnit )
{ {
...@@ -498,7 +498,7 @@ double To_User_Unit( UserUnitType aUnit, double val, int internal_unit_value ) ...@@ -498,7 +498,7 @@ double To_User_Unit( UserUnitType aUnit, 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( UserUnitType aUnit, double val, int internal_unit_value ) int From_User_Unit( EDA_UNITS_T aUnit, double val, int internal_unit_value )
{ {
double value; double value;
......
...@@ -16,14 +16,14 @@ enum listbox { ...@@ -16,14 +16,14 @@ enum listbox {
}; };
BEGIN_EVENT_TABLE( WinEDAListBox, wxDialog ) BEGIN_EVENT_TABLE( EDA_LIST_DIALOG, wxDialog )
EVT_BUTTON( wxID_OK, WinEDAListBox::OnOkClick ) EVT_BUTTON( wxID_OK, EDA_LIST_DIALOG::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDAListBox::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, EDA_LIST_DIALOG::OnCancelClick )
EVT_LISTBOX( ID_LISTBOX_LIST, WinEDAListBox::ClickOnList ) EVT_LISTBOX( ID_LISTBOX_LIST, EDA_LIST_DIALOG::ClickOnList )
EVT_LISTBOX_DCLICK( ID_LISTBOX_LIST, WinEDAListBox::D_ClickOnList ) EVT_LISTBOX_DCLICK( ID_LISTBOX_LIST, EDA_LIST_DIALOG::D_ClickOnList )
EVT_CHAR( WinEDAListBox::OnKeyEvent ) EVT_CHAR( EDA_LIST_DIALOG::OnKeyEvent )
EVT_CHAR_HOOK( WinEDAListBox::OnKeyEvent ) EVT_CHAR_HOOK( EDA_LIST_DIALOG::OnKeyEvent )
EVT_CLOSE( WinEDAListBox::OnClose ) EVT_CLOSE( EDA_LIST_DIALOG::OnClose )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -37,7 +37,7 @@ END_EVENT_TABLE() ...@@ -37,7 +37,7 @@ END_EVENT_TABLE()
* @param aCallBackFunction callback function to display comments * @param aCallBackFunction callback function to display comments
* @param aPos = position of the dialog. * @param aPos = position of the dialog.
*/ */
WinEDAListBox::WinEDAListBox( EDA_DRAW_FRAME* aParent, const wxString& aTitle, EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
const wxArrayString& aItemList, const wxString& aRefText, const wxArrayString& aItemList, const wxString& aRefText,
void(* aCallBackFunction)(wxString& Text), wxPoint aPos ) : void(* aCallBackFunction)(wxString& Text), wxPoint aPos ) :
wxDialog( aParent, wxID_ANY, aTitle, aPos, wxDefaultSize, wxDialog( aParent, wxID_ANY, aTitle, aPos, wxDefaultSize,
...@@ -78,12 +78,12 @@ WinEDAListBox::WinEDAListBox( EDA_DRAW_FRAME* aParent, const wxString& aTitle, ...@@ -78,12 +78,12 @@ WinEDAListBox::WinEDAListBox( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
} }
WinEDAListBox::~WinEDAListBox() EDA_LIST_DIALOG::~EDA_LIST_DIALOG()
{ {
} }
void WinEDAListBox::MoveMouseToOrigin() void EDA_LIST_DIALOG::MoveMouseToOrigin()
{ {
int x, y, w, h; int x, y, w, h;
wxSize list_size = m_listBox->GetSize(); wxSize list_size = m_listBox->GetSize();
...@@ -96,32 +96,32 @@ void WinEDAListBox::MoveMouseToOrigin() ...@@ -96,32 +96,32 @@ void WinEDAListBox::MoveMouseToOrigin()
} }
wxString WinEDAListBox::GetTextSelection() wxString EDA_LIST_DIALOG::GetTextSelection()
{ {
wxString text = m_listBox->GetStringSelection(); wxString text = m_listBox->GetStringSelection();
return text; return text;
} }
void WinEDAListBox::Append( const wxString& item ) void EDA_LIST_DIALOG::Append( const wxString& item )
{ {
m_listBox->Append( item ); m_listBox->Append( item );
} }
void WinEDAListBox::InsertItems( const wxArrayString& itemlist, int position ) void EDA_LIST_DIALOG::InsertItems( const wxArrayString& itemlist, int position )
{ {
m_listBox->InsertItems( itemlist, position ); m_listBox->InsertItems( itemlist, position );
} }
void WinEDAListBox::OnCancelClick( wxCommandEvent& event ) void EDA_LIST_DIALOG::OnCancelClick( wxCommandEvent& event )
{ {
EndModal( wxID_CANCEL ); EndModal( wxID_CANCEL );
} }
void WinEDAListBox::ClickOnList( wxCommandEvent& event ) void EDA_LIST_DIALOG::ClickOnList( wxCommandEvent& event )
{ {
wxString text; wxString text;
...@@ -135,19 +135,19 @@ void WinEDAListBox::ClickOnList( wxCommandEvent& event ) ...@@ -135,19 +135,19 @@ void WinEDAListBox::ClickOnList( wxCommandEvent& event )
} }
void WinEDAListBox::D_ClickOnList( wxCommandEvent& event ) void EDA_LIST_DIALOG::D_ClickOnList( wxCommandEvent& event )
{ {
EndModal( wxID_OK ); EndModal( wxID_OK );
} }
void WinEDAListBox::OnOkClick( wxCommandEvent& event ) void EDA_LIST_DIALOG::OnOkClick( wxCommandEvent& event )
{ {
EndModal( wxID_OK ); EndModal( wxID_OK );
} }
void WinEDAListBox::OnClose( wxCloseEvent& event ) void EDA_LIST_DIALOG::OnClose( wxCloseEvent& event )
{ {
EndModal( wxID_CANCEL ); EndModal( wxID_CANCEL );
} }
...@@ -161,7 +161,7 @@ static int SortItems( const wxString** ptr1, const wxString** ptr2 ) ...@@ -161,7 +161,7 @@ static int SortItems( const wxString** ptr1, const wxString** ptr2 )
} }
void WinEDAListBox:: SortList() void EDA_LIST_DIALOG:: SortList()
{ {
int ii, NbItems = m_listBox->GetCount(); int ii, NbItems = m_listBox->GetCount();
const wxString** BufList; const wxString** BufList;
...@@ -170,6 +170,7 @@ void WinEDAListBox:: SortList() ...@@ -170,6 +170,7 @@ void WinEDAListBox:: SortList()
return; return;
BufList = (const wxString**) MyZMalloc( 100 * NbItems * sizeof(wxString*) ); BufList = (const wxString**) MyZMalloc( 100 * NbItems * sizeof(wxString*) );
for( ii = 0; ii < NbItems; ii++ ) for( ii = 0; ii < NbItems; ii++ )
{ {
BufList[ii] = new wxString( m_listBox->GetString( ii ) ); BufList[ii] = new wxString( m_listBox->GetString( ii ) );
...@@ -179,6 +180,7 @@ void WinEDAListBox:: SortList() ...@@ -179,6 +180,7 @@ void WinEDAListBox:: SortList()
( int( * ) ( const void*, const void* ) )SortItems ); ( int( * ) ( const void*, const void* ) )SortItems );
m_listBox->Clear(); m_listBox->Clear();
for( ii = 0; ii < NbItems; ii++ ) for( ii = 0; ii < NbItems; ii++ )
{ {
m_listBox->Append( *BufList[ii] ); m_listBox->Append( *BufList[ii] );
...@@ -189,7 +191,7 @@ void WinEDAListBox:: SortList() ...@@ -189,7 +191,7 @@ void WinEDAListBox:: SortList()
} }
void WinEDAListBox::OnKeyEvent( wxKeyEvent& event ) void EDA_LIST_DIALOG::OnKeyEvent( wxKeyEvent& event )
{ {
event.Skip(); event.Skip();
} }
/***************/ /**
/* wxwineda.cpp */ * @file wxwineda.cpp
/****************/ */
#include "fctsys.h" #include "fctsys.h"
#include "common.h"
#include "wxstruct.h" #include "wxstruct.h"
#include "dialog_helpers.h" #include "dialog_helpers.h"
/*
* Text entry dialog to enter one or more lines of text.
*/
WinEDA_EnterText::WinEDA_EnterText( wxWindow* parent,
const wxString& Title,
const wxString& TextToEdit,
wxBoxSizer* BoxSizer,
const wxSize& Size, bool Multiline )
{
m_Modify = FALSE;
if( ! TextToEdit.IsEmpty() )
m_NewText = TextToEdit;
m_Title = new wxStaticText( parent, -1, Title );
BoxSizer->Add( m_Title, 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
long style = 0;
if (Multiline)
style = wxTE_MULTILINE;
m_FrameText = new wxTextCtrl( parent, -1, TextToEdit, wxDefaultPosition,
Size,style );
m_FrameText->SetInsertionPoint( 1 );
BoxSizer->Add( m_FrameText,
0,
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
}
wxString WinEDA_EnterText::GetValue()
{
m_Modify = m_FrameText->IsModified();
m_NewText = m_FrameText->GetValue();
return m_NewText;
}
void WinEDA_EnterText::GetValue( char* buffer, int lenmax )
{
m_Modify = m_FrameText->IsModified();
if( buffer )
{
m_NewText = m_FrameText->GetValue();
int ii, ll = m_NewText.Len();
for( ii = 0; ii < ll && ii < (lenmax - 1); ii++ )
;
buffer[ii] = m_NewText.GetChar( ii );
buffer[lenmax - 1] = 0;
}
}
void WinEDA_EnterText::SetValue( const wxString& new_text )
{
m_FrameText->SetValue( new_text );
}
void WinEDA_EnterText::Enable( bool enbl )
{
m_Title->Enable( enbl );
m_FrameText->Enable( enbl );
}
/*******************************************************/ /*******************************************************/
/* Class to edit a graphic + text size in INCHES or MM */ /* Class to edit a graphic + text size in INCHES or MM */
/*******************************************************/ /*******************************************************/
WinEDA_GraphicTextCtrl::WinEDA_GraphicTextCtrl( wxWindow* parent, EDA_GRAPHIC_TEXT_CTRL::EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent,
const wxString& Title, const wxString& Title,
const wxString& TextToEdit, const wxString& TextToEdit,
int textsize, int textsize,
UserUnitType user_unit, EDA_UNITS_T user_unit,
wxBoxSizer* BoxSizer, wxBoxSizer* BoxSizer,
int framelen, int framelen,
int internal_unit ) int internal_unit )
...@@ -121,7 +50,7 @@ WinEDA_GraphicTextCtrl::WinEDA_GraphicTextCtrl( wxWindow* parent, ...@@ -121,7 +50,7 @@ WinEDA_GraphicTextCtrl::WinEDA_GraphicTextCtrl( wxWindow* parent,
} }
WinEDA_GraphicTextCtrl::~WinEDA_GraphicTextCtrl() EDA_GRAPHIC_TEXT_CTRL::~EDA_GRAPHIC_TEXT_CTRL()
{ {
/* no, these are deleted by the BoxSizer /* no, these are deleted by the BoxSizer
delete m_FrameText; delete m_FrameText;
...@@ -130,7 +59,7 @@ WinEDA_GraphicTextCtrl::~WinEDA_GraphicTextCtrl() ...@@ -130,7 +59,7 @@ WinEDA_GraphicTextCtrl::~WinEDA_GraphicTextCtrl()
} }
wxString WinEDA_GraphicTextCtrl::FormatSize( int internalUnit, UserUnitType aUnit, wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( int internalUnit, EDA_UNITS_T aUnit,
int textSize ) int textSize )
{ {
wxString value; wxString value;
...@@ -149,34 +78,34 @@ wxString WinEDA_GraphicTextCtrl::FormatSize( int internalUnit, UserUnitType aUni ...@@ -149,34 +78,34 @@ wxString WinEDA_GraphicTextCtrl::FormatSize( int internalUnit, UserUnitType aUni
} }
void WinEDA_GraphicTextCtrl::SetTitle( const wxString& title ) void EDA_GRAPHIC_TEXT_CTRL::SetTitle( const wxString& title )
{ {
m_Title->SetLabel( title ); m_Title->SetLabel( title );
} }
void WinEDA_GraphicTextCtrl::SetValue( const wxString& value ) void EDA_GRAPHIC_TEXT_CTRL::SetValue( const wxString& value )
{ {
m_FrameText->SetValue( value ); m_FrameText->SetValue( value );
} }
void WinEDA_GraphicTextCtrl::SetValue( int textSize ) void EDA_GRAPHIC_TEXT_CTRL::SetValue( int textSize )
{ {
wxString value = FormatSize( m_Internal_Unit, m_UserUnit, textSize ); wxString value = FormatSize( m_Internal_Unit, m_UserUnit, textSize );
m_FrameSize->SetValue( value ); m_FrameSize->SetValue( value );
} }
wxString WinEDA_GraphicTextCtrl::GetText() wxString EDA_GRAPHIC_TEXT_CTRL::GetText()
{ {
wxString text = m_FrameText->GetValue(); wxString text = m_FrameText->GetValue();
return text; return text;
} }
int WinEDA_GraphicTextCtrl::ParseSize( const wxString& sizeText, int EDA_GRAPHIC_TEXT_CTRL::ParseSize( const wxString& sizeText,
int internalUnit, UserUnitType aUnit ) int internalUnit, EDA_UNITS_T aUnit )
{ {
int textsize; int textsize;
...@@ -193,13 +122,13 @@ int WinEDA_GraphicTextCtrl::ParseSize( const wxString& sizeText, ...@@ -193,13 +122,13 @@ int WinEDA_GraphicTextCtrl::ParseSize( const wxString& sizeText,
} }
int WinEDA_GraphicTextCtrl::GetTextSize() int EDA_GRAPHIC_TEXT_CTRL::GetTextSize()
{ {
return ParseSize( m_FrameSize->GetValue(), m_Internal_Unit, m_UserUnit ); return ParseSize( m_FrameSize->GetValue(), m_Internal_Unit, m_UserUnit );
} }
void WinEDA_GraphicTextCtrl::Enable( bool state ) void EDA_GRAPHIC_TEXT_CTRL::Enable( bool state )
{ {
m_FrameText->Enable( state ); m_FrameText->Enable( state );
} }
...@@ -208,10 +137,10 @@ void WinEDA_GraphicTextCtrl::Enable( bool state ) ...@@ -208,10 +137,10 @@ void WinEDA_GraphicTextCtrl::Enable( bool state )
/********************************************************/ /********************************************************/
/* Class to display and edit a coordinated INCHES or MM */ /* Class to display and edit a coordinated INCHES or MM */
/********************************************************/ /********************************************************/
WinEDA_PositionCtrl::WinEDA_PositionCtrl( wxWindow* parent, EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent,
const wxString& title, const wxString& title,
const wxPoint& pos_to_edit, const wxPoint& pos_to_edit,
UserUnitType user_unit, EDA_UNITS_T user_unit,
wxBoxSizer* BoxSizer, wxBoxSizer* BoxSizer,
int internal_unit ) int internal_unit )
{ {
...@@ -219,10 +148,12 @@ WinEDA_PositionCtrl::WinEDA_PositionCtrl( wxWindow* parent, ...@@ -219,10 +148,12 @@ WinEDA_PositionCtrl::WinEDA_PositionCtrl( wxWindow* parent,
m_UserUnit = user_unit; m_UserUnit = user_unit;
m_Internal_Unit = internal_unit; m_Internal_Unit = internal_unit;
if( title.IsEmpty() ) if( title.IsEmpty() )
text = _( "Pos " ); text = _( "Pos " );
else else
text = title; text = title;
text += _( "X" ) + ReturnUnitSymbol( m_UserUnit ); text += _( "X" ) + ReturnUnitSymbol( m_UserUnit );
m_TextX = new wxStaticText( parent, -1, text ); m_TextX = new wxStaticText( parent, -1, text );
...@@ -239,6 +170,7 @@ WinEDA_PositionCtrl::WinEDA_PositionCtrl( wxWindow* parent, ...@@ -239,6 +170,7 @@ WinEDA_PositionCtrl::WinEDA_PositionCtrl( wxWindow* parent,
else else
text = title; text = title;
text += _( "Y" ) + ReturnUnitSymbol( m_UserUnit ); text += _( "Y" ) + ReturnUnitSymbol( m_UserUnit );
m_TextY = new wxStaticText( parent, -1, text ); m_TextY = new wxStaticText( parent, -1, text );
BoxSizer->Add( m_TextY, 0, BoxSizer->Add( m_TextY, 0,
...@@ -252,7 +184,7 @@ WinEDA_PositionCtrl::WinEDA_PositionCtrl( wxWindow* parent, ...@@ -252,7 +184,7 @@ WinEDA_PositionCtrl::WinEDA_PositionCtrl( wxWindow* parent,
} }
WinEDA_PositionCtrl::~WinEDA_PositionCtrl() EDA_POSITION_CTRL::~EDA_POSITION_CTRL()
{ {
delete m_TextX; delete m_TextX;
delete m_TextY; delete m_TextY;
...@@ -263,7 +195,7 @@ WinEDA_PositionCtrl::~WinEDA_PositionCtrl() ...@@ -263,7 +195,7 @@ WinEDA_PositionCtrl::~WinEDA_PositionCtrl()
/* Returns (in internal units) to coordinate between (in user units) /* Returns (in internal units) to coordinate between (in user units)
*/ */
wxPoint WinEDA_PositionCtrl::GetValue() wxPoint EDA_POSITION_CTRL::GetValue()
{ {
wxPoint coord; wxPoint coord;
...@@ -274,14 +206,14 @@ wxPoint WinEDA_PositionCtrl::GetValue() ...@@ -274,14 +206,14 @@ wxPoint WinEDA_PositionCtrl::GetValue()
} }
void WinEDA_PositionCtrl::Enable( bool x_win_on, bool y_win_on ) void EDA_POSITION_CTRL::Enable( bool x_win_on, bool y_win_on )
{ {
m_FramePosX->Enable( x_win_on ); m_FramePosX->Enable( x_win_on );
m_FramePosY->Enable( y_win_on ); m_FramePosY->Enable( y_win_on );
} }
void WinEDA_PositionCtrl::SetValue( int x_value, int y_value ) void EDA_POSITION_CTRL::SetValue( int x_value, int y_value )
{ {
wxString msg; wxString msg;
...@@ -299,22 +231,22 @@ void WinEDA_PositionCtrl::SetValue( int x_value, int y_value ) ...@@ -299,22 +231,22 @@ void WinEDA_PositionCtrl::SetValue( int x_value, int y_value )
/*******************/ /*******************/
/* WinEDA_SizeCtrl */ /* EDA_SIZE_CTRL */
/*******************/ /*******************/
WinEDA_SizeCtrl::WinEDA_SizeCtrl( wxWindow* parent, const wxString& title, EDA_SIZE_CTRL::EDA_SIZE_CTRL( wxWindow* parent, const wxString& title,
const wxSize& size_to_edit, const wxSize& size_to_edit,
UserUnitType aUnit, wxBoxSizer* BoxSizer, EDA_UNITS_T aUnit, wxBoxSizer* aBoxSizer,
int internal_unit ) : int internal_unit ) :
WinEDA_PositionCtrl( parent, title, EDA_POSITION_CTRL( parent, title,
wxPoint( size_to_edit.x, size_to_edit.y ), wxPoint( size_to_edit.x, size_to_edit.y ),
aUnit, BoxSizer, internal_unit ) aUnit, aBoxSizer, internal_unit )
{ {
} }
wxSize WinEDA_SizeCtrl::GetValue() wxSize EDA_SIZE_CTRL::GetValue()
{ {
wxPoint pos = WinEDA_PositionCtrl::GetValue(); wxPoint pos = EDA_POSITION_CTRL::GetValue();
wxSize size; wxSize size;
size.x = pos.x; size.x = pos.x;
...@@ -326,8 +258,8 @@ wxSize WinEDA_SizeCtrl::GetValue() ...@@ -326,8 +258,8 @@ wxSize WinEDA_SizeCtrl::GetValue()
/**************************************************************/ /**************************************************************/
/* Class to display and edit a dimension INCHES, MM, or other */ /* Class to display and edit a dimension INCHES, MM, or other */
/**************************************************************/ /**************************************************************/
WinEDA_ValueCtrl::WinEDA_ValueCtrl( wxWindow* parent, const wxString& title, EDA_VALUE_CTRL::EDA_VALUE_CTRL( wxWindow* parent, const wxString& title,
int value, UserUnitType user_unit, wxBoxSizer* BoxSizer, int value, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer,
int internal_unit ) int internal_unit )
{ {
wxString label = title; wxString label = title;
...@@ -353,14 +285,14 @@ WinEDA_ValueCtrl::WinEDA_ValueCtrl( wxWindow* parent, const wxString& title, ...@@ -353,14 +285,14 @@ WinEDA_ValueCtrl::WinEDA_ValueCtrl( wxWindow* parent, const wxString& title,
} }
WinEDA_ValueCtrl::~WinEDA_ValueCtrl() EDA_VALUE_CTRL::~EDA_VALUE_CTRL()
{ {
delete m_ValueCtrl; delete m_ValueCtrl;
delete m_Text; delete m_Text;
} }
int WinEDA_ValueCtrl::GetValue() int EDA_VALUE_CTRL::GetValue()
{ {
int coord; int coord;
wxString txtvalue = m_ValueCtrl->GetValue(); wxString txtvalue = m_ValueCtrl->GetValue();
...@@ -370,7 +302,7 @@ int WinEDA_ValueCtrl::GetValue() ...@@ -370,7 +302,7 @@ int WinEDA_ValueCtrl::GetValue()
} }
void WinEDA_ValueCtrl::SetValue( int new_value ) void EDA_VALUE_CTRL::SetValue( int new_value )
{ {
wxString buffer; wxString buffer;
...@@ -381,7 +313,7 @@ void WinEDA_ValueCtrl::SetValue( int new_value ) ...@@ -381,7 +313,7 @@ void WinEDA_ValueCtrl::SetValue( int new_value )
} }
void WinEDA_ValueCtrl::Enable( bool enbl ) void EDA_VALUE_CTRL::Enable( bool enbl )
{ {
m_ValueCtrl->Enable( enbl ); m_ValueCtrl->Enable( enbl );
m_Text->Enable( enbl ); m_Text->Enable( enbl );
......
...@@ -49,9 +49,11 @@ wxString DataBaseGetName( EDA_DRAW_FRAME* frame, wxString& Keys, wxString& BufNa ...@@ -49,9 +49,11 @@ wxString DataBaseGetName( EDA_DRAW_FRAME* frame, wxString& Keys, wxString& BufNa
if( nameList.IsEmpty() ) if( nameList.IsEmpty() )
{ {
msg = _( "No components found matching " ); msg = _( "No components found matching " );
if( !BufName.IsEmpty() ) if( !BufName.IsEmpty() )
{ {
msg += _( "name search criteria <" ) + BufName + wxT( "> " ); msg += _( "name search criteria <" ) + BufName + wxT( "> " );
if( !Keys.IsEmpty() ) if( !Keys.IsEmpty() )
msg += _( "and " ); msg += _( "and " );
} }
...@@ -66,8 +68,8 @@ wxString DataBaseGetName( EDA_DRAW_FRAME* frame, wxString& Keys, wxString& BufNa ...@@ -66,8 +68,8 @@ wxString DataBaseGetName( EDA_DRAW_FRAME* frame, wxString& Keys, wxString& BufNa
// Show candidate list: // Show candidate list:
wxString cmpname; wxString cmpname;
WinEDAListBox dlg( frame, _( "Select Component" ), EDA_LIST_DIALOG dlg( frame, _( "Select Component" ), nameList, cmpname, DisplayCmpDoc );
nameList, cmpname, DisplayCmpDoc );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return wxEmptyString; return wxEmptyString;
......
...@@ -632,8 +632,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel() ...@@ -632,8 +632,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
else else
fieldValueTextCtrl->Enable( true ); fieldValueTextCtrl->Enable( true );
textSizeTextCtrl->SetValue( textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( EESCHEMA_INTERNAL_UNIT,
WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT,
g_UserUnit, field.m_Size.x ) ); g_UserUnit, field.m_Size.x ) );
wxPoint coord = field.m_Pos; wxPoint coord = field.m_Pos;
...@@ -713,8 +712,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField() ...@@ -713,8 +712,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
setRowItem( fieldNdx, field ); // update fieldListCtrl setRowItem( fieldNdx, field ); // update fieldListCtrl
field.m_Size.x = WinEDA_GraphicTextCtrl::ParseSize( field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(),
textSizeTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT, g_UserUnit ); EESCHEMA_INTERNAL_UNIT, g_UserUnit );
field.m_Size.y = field.m_Size.x; field.m_Size.y = field.m_Size.x;
int style = m_StyleRadioBox->GetSelection(); int style = m_StyleRadioBox->GetSelection();
......
...@@ -657,8 +657,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel() ...@@ -657,8 +657,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
fieldValueTextCtrl->SetValue( field.m_Text ); fieldValueTextCtrl->SetValue( field.m_Text );
textSizeTextCtrl->SetValue( textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( EESCHEMA_INTERNAL_UNIT,
WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT, g_UserUnit, field.m_Size.x ) ); g_UserUnit, field.m_Size.x ) );
wxPoint coord = field.m_Pos; wxPoint coord = field.m_Pos;
wxPoint zero; wxPoint zero;
...@@ -744,8 +744,8 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField() ...@@ -744,8 +744,8 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
setRowItem( fieldNdx, field ); // update fieldListCtrl setRowItem( fieldNdx, field ); // update fieldListCtrl
field.m_Size.x = WinEDA_GraphicTextCtrl::ParseSize( field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(),
textSizeTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT, g_UserUnit ); EESCHEMA_INTERNAL_UNIT, g_UserUnit );
field.m_Size.y = field.m_Size.x; field.m_Size.y = field.m_Size.x;
......
...@@ -210,7 +210,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event ) ...@@ -210,7 +210,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
g_UserUnit = (UserUnitType)dlg.GetUnitsSelection(); g_UserUnit = (EDA_UNITS_T)dlg.GetUnitsSelection();
GetScreen()->SetGrid( grid_list[ (size_t) dlg.GetGridSelection() ].m_Size ); GetScreen()->SetGrid( grid_list[ (size_t) dlg.GetGridSelection() ].m_Size );
......
...@@ -254,16 +254,23 @@ void NETLIST_DIALOG::InstallPageSpice() ...@@ -254,16 +254,23 @@ void NETLIST_DIALOG::InstallPageSpice()
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
2, netlist_opt, 1, 2, netlist_opt, 1,
wxRA_SPECIFY_COLS ); wxRA_SPECIFY_COLS );
if( !g_OptNetListUseNames ) if( !g_OptNetListUseNames )
m_UseNetNamesInNetlist->SetSelection( 1 ); m_UseNetNamesInNetlist->SetSelection( 1 );
page->m_LeftBoxSizer->Add( m_UseNetNamesInNetlist, 0, wxGROW | wxALL, 5 ); page->m_LeftBoxSizer->Add( m_UseNetNamesInNetlist, 0, wxGROW | wxALL, 5 );
page->m_CommandStringCtrl = new WinEDA_EnterText( page, page->m_LowBoxSizer->Add( new wxStaticText( page, -1, _( "Simulator command:" ) ), 0,
_( "Simulator command:" ), wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
m_Parent->GetSimulatorCommand(),
page->m_LowBoxSizer, page->m_CommandStringCtrl = new wxTextCtrl( page, -1, m_Parent->GetSimulatorCommand(),
wxDefaultSize ); wxDefaultPosition, wxDefaultSize );
page->m_CommandStringCtrl->SetInsertionPoint( 1 );
page->m_LowBoxSizer->Add( page->m_CommandStringCtrl,
0,
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
// Add buttons // Add buttons
Button = new wxButton( page, ID_CREATE_NETLIST, _( "Netlist" ) ); Button = new wxButton( page, ID_CREATE_NETLIST, _( "Netlist" ) );
...@@ -301,6 +308,7 @@ void NETLIST_DIALOG::InstallCustomPages() ...@@ -301,6 +308,7 @@ void NETLIST_DIALOG::InstallCustomPages()
/* Install the panel "Add Plugin" after /* Install the panel "Add Plugin" after
* the last initialized panel */ * the last initialized panel */
previoustitle = title; previoustitle = title;
if( title.IsEmpty() ) if( title.IsEmpty() )
CurrPage = CurrPage =
...@@ -324,17 +332,32 @@ void NETLIST_DIALOG::InstallCustomPages() ...@@ -324,17 +332,32 @@ void NETLIST_DIALOG::InstallCustomPages()
msg = CUSTOM_NETLIST_COMMAND; msg = CUSTOM_NETLIST_COMMAND;
msg << ii + 1; msg << ii + 1;
wxString Command = wxGetApp().m_EDA_Config->Read( msg ); wxString Command = wxGetApp().m_EDA_Config->Read( msg );
CurrPage->m_CommandStringCtrl =
new WinEDA_EnterText( CurrPage, CurrPage->m_LowBoxSizer->Add( new wxStaticText( CurrPage,
_( "Netlist command:" ), Command, -1, _( "Netlist command:" ) ), 0,
CurrPage->m_LowBoxSizer, wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
wxDefaultSize );
CurrPage->m_CommandStringCtrl = new wxTextCtrl( CurrPage, -1, Command,
CurrPage->m_TitleStringCtrl = wxDefaultPosition, wxDefaultSize );
new WinEDA_EnterText( CurrPage,
_( "Title:" ), title, CurrPage->m_CommandStringCtrl->SetInsertionPoint( 1 );
CurrPage->m_LowBoxSizer, CurrPage->m_LowBoxSizer->Add( CurrPage->m_CommandStringCtrl,
wxDefaultSize ); 0,
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
CurrPage->m_LowBoxSizer->Add( new wxStaticText( CurrPage,
-1, _( "Title:" ) ), 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
CurrPage->m_TitleStringCtrl = new wxTextCtrl( CurrPage, -1, title,
wxDefaultPosition, wxDefaultSize );
CurrPage->m_TitleStringCtrl->SetInsertionPoint( 1 );
CurrPage->m_LowBoxSizer->Add( CurrPage->m_TitleStringCtrl,
0,
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
} }
} }
...@@ -384,6 +407,7 @@ void NETLIST_DIALOG::AddNewPluginPanel( wxCommandEvent& event ) ...@@ -384,6 +407,7 @@ void NETLIST_DIALOG::AddNewPluginPanel( wxCommandEvent& event )
/* Get a title for this page */ /* Get a title for this page */
wxString title = CurrPage->m_TitleStringCtrl->GetValue(); wxString title = CurrPage->m_TitleStringCtrl->GetValue();
if( title.IsEmpty() ) if( title.IsEmpty() )
DisplayInfoMessage( this, DisplayInfoMessage( this,
_( "Do not forget to choose a title for this netlist control page" ) ); _( "Do not forget to choose a title for this netlist control page" ) );
......
...@@ -48,8 +48,8 @@ public: ...@@ -48,8 +48,8 @@ public:
int m_IdNetType; int m_IdNetType;
wxCheckBox* m_IsCurrentFormat; wxCheckBox* m_IsCurrentFormat;
wxCheckBox* m_AddSubPrefix; wxCheckBox* m_AddSubPrefix;
WinEDA_EnterText* m_CommandStringCtrl; wxTextCtrl* m_CommandStringCtrl;
WinEDA_EnterText* m_TitleStringCtrl; wxTextCtrl* m_TitleStringCtrl;
wxButton* m_ButtonCancel; wxButton* m_ButtonCancel;
wxBoxSizer* m_LeftBoxSizer; wxBoxSizer* m_LeftBoxSizer;
wxBoxSizer* m_RightBoxSizer; wxBoxSizer* m_RightBoxSizer;
......
...@@ -64,7 +64,7 @@ int DisplayComponentsNamesInLib( EDA_DRAW_FRAME* frame, ...@@ -64,7 +64,7 @@ int DisplayComponentsNamesInLib( EDA_DRAW_FRAME* frame,
Library->GetEntryNames( nameList ); Library->GetEntryNames( nameList );
WinEDAListBox dlg( frame, _( "Select Component" ), nameList, OldName, DisplayCmpDoc ); EDA_LIST_DIALOG dlg( frame, _( "Select Component" ), nameList, OldName, DisplayCmpDoc );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return 0; return 0;
......
...@@ -327,7 +327,7 @@ public: ...@@ -327,7 +327,7 @@ public:
void SetGridList( GRIDS& sizelist ); void SetGridList( GRIDS& sizelist );
void AddGrid( const GRID_TYPE& grid ); void AddGrid( const GRID_TYPE& grid );
void AddGrid( const wxRealPoint& size, int id ); void AddGrid( const wxRealPoint& size, int id );
void AddGrid( const wxRealPoint& size, UserUnitType aUnit, int id ); void AddGrid( const wxRealPoint& size, EDA_UNITS_T aUnit, int id );
/** /**
* Function GetGridCount(). * Function GetGridCount().
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
class wxAboutDialogInfo; class wxAboutDialogInfo;
class BASE_SCREEN; class BASE_SCREEN;
class EDA_DRAW_FRAME; class EDA_DRAW_FRAME;
class WinEDAListBox;
class EDA_DRAW_PANEL; class EDA_DRAW_PANEL;
/* Flag for special keys */ /* Flag for special keys */
...@@ -81,7 +80,8 @@ enum pseudokeys { ...@@ -81,7 +80,8 @@ enum pseudokeys {
#define ON 1 #define ON 1
#define OFF 0 #define OFF 0
enum UserUnitType {
enum EDA_UNITS_T {
INCHES = 0, INCHES = 0,
MILLIMETRES = 1, MILLIMETRES = 1,
UNSCALED_UNITS = 2 UNSCALED_UNITS = 2
...@@ -163,7 +163,7 @@ extern wxString g_Prj_Default_Config_FullFilename; ...@@ -163,7 +163,7 @@ extern wxString g_Prj_Default_Config_FullFilename;
// Name of local configuration file. (<curr projet>.pro) // Name of local configuration file. (<curr projet>.pro)
extern wxString g_Prj_Config_LocalFilename; extern wxString g_Prj_Config_LocalFilename;
extern UserUnitType g_UserUnit; ///< display units extern EDA_UNITS_T g_UserUnit; ///< display units
/* Draw color for moving objects: */ /* Draw color for moving objects: */
extern int g_GhostColor; extern int g_GhostColor;
...@@ -285,7 +285,7 @@ wxString CoordinateToString( int aValue, int aInternalUnits, bool aConvertToMils ...@@ -285,7 +285,7 @@ wxString CoordinateToString( int aValue, int aInternalUnits, bool aConvertToMils
* the format string must contain the %s format specifier. * the format string must contain the %s format specifier.
* @return The formatted units symbol. * @return The formatted units symbol.
*/ */
wxString ReturnUnitSymbol( UserUnitType aUnits = g_UserUnit, wxString ReturnUnitSymbol( EDA_UNITS_T aUnits = g_UserUnit,
const wxString& aFormatString = _( " (%s):" ) ); const wxString& aFormatString = _( " (%s):" ) );
/** /**
...@@ -297,10 +297,10 @@ wxString ReturnUnitSymbol( UserUnitType aUnits = g_UserUnit, ...@@ -297,10 +297,10 @@ wxString ReturnUnitSymbol( UserUnitType aUnits = g_UserUnit,
* @param aUnits - The units text to return. * @param aUnits - The units text to return.
* @return The human readable units string. * @return The human readable units string.
*/ */
wxString GetUnitsLabel( UserUnitType aUnits ); wxString GetUnitsLabel( EDA_UNITS_T aUnits );
wxString GetAbbreviatedUnitsLabel( UserUnitType aUnit = g_UserUnit ); wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit = g_UserUnit );
int ReturnValueFromString( UserUnitType aUnit, const wxString& TextValue, int ReturnValueFromString( EDA_UNITS_T aUnit, const wxString& TextValue,
int Internal_Unit ); int Internal_Unit );
/** /**
...@@ -314,12 +314,12 @@ int ReturnValueFromString( UserUnitType aUnit, const wxString& TextV ...@@ -314,12 +314,12 @@ int ReturnValueFromString( UserUnitType aUnit, const wxString& TextV
* @return a wxString what contains value and optionally the symbol unit (like * @return a wxString what contains value and optionally the symbol unit (like
* 2.000 mm) * 2.000 mm)
*/ */
wxString ReturnStringFromValue( UserUnitType aUnit, wxString ReturnStringFromValue( EDA_UNITS_T aUnit,
int aValue, int aValue,
int aInternal_Unit, int aInternal_Unit,
bool aAdd_unit_symbol = false ); bool aAdd_unit_symbol = false );
void AddUnitSymbol( wxStaticText& Stext, UserUnitType aUnit = g_UserUnit ); void AddUnitSymbol( wxStaticText& Stext, EDA_UNITS_T aUnit = g_UserUnit );
/* 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 */
...@@ -343,11 +343,11 @@ wxArrayString* wxStringSplit( wxString txt, wxChar splitter ); ...@@ -343,11 +343,11 @@ wxArrayString* wxStringSplit( wxString txt, wxChar splitter );
* @param val : double : the given value * @param val : double : the given value
* @param internal_unit_value = internal units per inch * @param internal_unit_value = internal units per inch
*/ */
double To_User_Unit( UserUnitType aUnit, double To_User_Unit( EDA_UNITS_T aUnit,
double val, double val,
int internal_unit_value ); int internal_unit_value );
int From_User_Unit( UserUnitType aUnit, int From_User_Unit( EDA_UNITS_T aUnit,
double val, double val,
int internal_unit_value ); int internal_unit_value );
wxString GenDate(); wxString GenDate();
......
// file dialog_helpers.h /**
* @file dialog_helpers.h
* @brief Helper dialog and control classes.
* @note Due to use of wxFormBuilder to create dialogs many of them should be removed.
*/
#ifndef _DIALOG_HELPERS_H_ #ifndef _DIALOG_HELPERS_H_
#define _DIALOG_HELPERS_H_ #define _DIALOG_HELPERS_H_
/* some small helper classes used in dialogs
* Due to use of wxFormBuilder to create dialogs
* Many of them should be removed
*/
/** /**
* class WinEDAListBox * class EDA_LIST_DIALOG
* *
* Used to display a list of elements for selection, and an help of info line * Used to display a list of elements for selection, and an help of info line
* about the selected item. * about the selected item.
*/ */
class WinEDAListBox : public wxDialog class EDA_LIST_DIALOG : public wxDialog
{ {
private: private:
wxListBox* m_listBox; wxListBox* m_listBox;
...@@ -24,18 +24,18 @@ private: ...@@ -24,18 +24,18 @@ private:
public: public:
/** /**
* Constructor: * Constructor:
* @param aParent = apointeur to the parent window * @param aParent Pointer to the parent window.
* @param aTitle = the title shown on top. * @param aTitle The title shown on top.
* @param aItemList = a wxArrayStrin: the list of elements. * @param aItemList A wxArrayString of the list of elements.
* @param aRefText = an item name if an item must be preselected. * @param aRefText An item name if an item must be preselected.
* @param aCallBackFunction callback function to display comments * @param aCallBackFunction callback function to display comments
* @param aPos = position of the dialog. * @param aPos The position of the dialog.
*/ */
WinEDAListBox( EDA_DRAW_FRAME* aParent, const wxString& aTitle, EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
const wxArrayString& aItemList, const wxString& aRefText, const wxArrayString& aItemList, const wxString& aRefText,
void(* aCallBackFunction)(wxString& Text) = NULL, void(* aCallBackFunction)(wxString& Text) = NULL,
wxPoint aPos = wxDefaultPosition ); wxPoint aPos = wxDefaultPosition );
~WinEDAListBox(); ~EDA_LIST_DIALOG();
void SortList(); void SortList();
void Append( const wxString& aItemStr ); void Append( const wxString& aItemStr );
...@@ -55,50 +55,14 @@ private: ...@@ -55,50 +55,14 @@ private:
}; };
/************************************************/ /**
/* Class to enter a line, is some dialog frames */ * Class EDA_GRAPHIC_TEXT_CTRL
/************************************************/ * is a custom text edit control to edit/enter Kicad dimensions ( INCHES or MM )
class WinEDA_EnterText */
{ class EDA_GRAPHIC_TEXT_CTRL
public:
bool m_Modify;
private:
wxString m_NewText;
wxTextCtrl* m_FrameText;
wxStaticText* m_Title;
public:
WinEDA_EnterText( wxWindow* parent, const wxString& Title,
const wxString& TextToEdit, wxBoxSizer* BoxSizer,
const wxSize& Size, bool Multiline = false );
~WinEDA_EnterText()
{
}
wxString GetValue();
void GetValue( char* buffer, int lenmax );
void SetValue( const wxString& new_text );
void Enable( bool enbl );
void SetFocus() { m_FrameText->SetFocus(); }
void SetInsertionPoint( int n ) { m_FrameText->SetInsertionPoint( n ); }
void SetSelection( int n, int m )
{
m_FrameText->SetSelection( n, m );
}
};
/************************************************************************/
/* Class to edit/enter a graphic text and its dimension ( INCHES or MM )*/
/************************************************************************/
class WinEDA_GraphicTextCtrl
{ {
public: public:
UserUnitType m_UserUnit; EDA_UNITS_T m_UserUnit;
int m_Internal_Unit; int m_Internal_Unit;
wxTextCtrl* m_FrameText; wxTextCtrl* m_FrameText;
...@@ -107,12 +71,12 @@ private: ...@@ -107,12 +71,12 @@ private:
wxStaticText* m_Title; wxStaticText* m_Title;
public: public:
WinEDA_GraphicTextCtrl( wxWindow* parent, const wxString& Title, EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent, const wxString& Title,
const wxString& TextToEdit, int textsize, const wxString& TextToEdit, int textsize,
UserUnitType user_unit, wxBoxSizer* BoxSizer, int framelen = 200, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer, int framelen = 200,
int internal_unit = EESCHEMA_INTERNAL_UNIT ); int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_GraphicTextCtrl(); ~EDA_GRAPHIC_TEXT_CTRL();
wxString GetText(); wxString GetText();
int GetTextSize(); int GetTextSize();
...@@ -127,10 +91,10 @@ public: ...@@ -127,10 +91,10 @@ public:
* Function FormatSize * Function FormatSize
* formats a string containing the size in the desired units. * formats a string containing the size in the desired units.
*/ */
static wxString FormatSize( int internalUnit, UserUnitType user_unit, int textSize ); static wxString FormatSize( int internalUnit, EDA_UNITS_T user_unit, int textSize );
static int ParseSize( const wxString& sizeText, int internalUnit, static int ParseSize( const wxString& sizeText, int internalUnit,
UserUnitType user_unit ); EDA_UNITS_T user_unit );
}; };
...@@ -138,10 +102,10 @@ public: ...@@ -138,10 +102,10 @@ public:
/* Class to edit/enter a coordinate (pair of values) ( INCHES or MM ) in */ /* Class to edit/enter a coordinate (pair of values) ( INCHES or MM ) in */
/* dialog boxes, */ /* dialog boxes, */
/**************************************************************************/ /**************************************************************************/
class WinEDA_PositionCtrl class EDA_POSITION_CTRL
{ {
public: public:
UserUnitType m_UserUnit; EDA_UNITS_T m_UserUnit;
int m_Internal_Unit; int m_Internal_Unit;
wxPoint m_Pos_To_Edit; wxPoint m_Pos_To_Edit;
...@@ -151,12 +115,12 @@ private: ...@@ -151,12 +115,12 @@ private:
wxStaticText* m_TextX, * m_TextY; wxStaticText* m_TextX, * m_TextY;
public: public:
WinEDA_PositionCtrl( wxWindow* parent, const wxString& title, EDA_POSITION_CTRL( wxWindow* parent, const wxString& title,
const wxPoint& pos_to_edit, const wxPoint& pos_to_edit,
UserUnitType user_unit, wxBoxSizer* BoxSizer, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT ); int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_PositionCtrl(); ~EDA_POSITION_CTRL();
void Enable( bool x_win_on, bool y_win_on ); void Enable( bool x_win_on, bool y_win_on );
void SetValue( int x_value, int y_value ); void SetValue( int x_value, int y_value );
...@@ -168,15 +132,15 @@ public: ...@@ -168,15 +132,15 @@ public:
* Class to edit/enter a size (pair of values for X and Y size) * Class to edit/enter a size (pair of values for X and Y size)
* ( INCHES or MM ) in dialog boxes * ( INCHES or MM ) in dialog boxes
***************************************************************/ ***************************************************************/
class WinEDA_SizeCtrl : public WinEDA_PositionCtrl class EDA_SIZE_CTRL : public EDA_POSITION_CTRL
{ {
public: public:
WinEDA_SizeCtrl( wxWindow* parent, const wxString& title, EDA_SIZE_CTRL( wxWindow* parent, const wxString& title,
const wxSize& size_to_edit, const wxSize& size_to_edit,
UserUnitType user_unit, wxBoxSizer* BoxSizer, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT ); int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_SizeCtrl() { } ~EDA_SIZE_CTRL() { }
wxSize GetValue(); wxSize GetValue();
}; };
...@@ -184,10 +148,10 @@ public: ...@@ -184,10 +148,10 @@ public:
/****************************************************************/ /****************************************************************/
/* Class to edit/enter a value ( INCHES or MM ) in dialog boxes */ /* Class to edit/enter a value ( INCHES or MM ) in dialog boxes */
/****************************************************************/ /****************************************************************/
class WinEDA_ValueCtrl class EDA_VALUE_CTRL
{ {
public: public:
UserUnitType m_UserUnit; EDA_UNITS_T m_UserUnit;
int m_Value; int m_Value;
wxTextCtrl* m_ValueCtrl; wxTextCtrl* m_ValueCtrl;
private: private:
...@@ -195,11 +159,11 @@ private: ...@@ -195,11 +159,11 @@ private:
wxStaticText* m_Text; wxStaticText* m_Text;
public: public:
WinEDA_ValueCtrl( wxWindow* parent, const wxString& title, int value, EDA_VALUE_CTRL( wxWindow* parent, const wxString& title, int value,
UserUnitType user_unit, wxBoxSizer* BoxSizer, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT ); int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_ValueCtrl(); ~EDA_VALUE_CTRL();
int GetValue(); int GetValue();
void SetValue( int new_value ); void SetValue( int new_value );
...@@ -212,4 +176,4 @@ public: ...@@ -212,4 +176,4 @@ public:
}; };
#endif #endif // _DIALOG_HELPERS_H_
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
/* Forward class declarations. */ /* Forward class declarations. */
class WinEDAListBox; class EDA_LIST_DIALOG;
/** /**
...@@ -54,7 +54,7 @@ wxString MakeReducedFileName( const wxString& fullfilename, ...@@ -54,7 +54,7 @@ wxString MakeReducedFileName( const wxString& fullfilename,
const wxString& default_path, const wxString& default_path,
const wxString& default_ext ); const wxString& default_ext );
WinEDAListBox* GetFileNames( char* Directory, char* Mask ); EDA_LIST_DIALOG* GetFileNames( char* Directory, char* Mask );
int ExecuteFile( wxWindow* frame, const wxString& ExecFile, int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
......
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
int m_DisplayModText; // How to display module texts (line/ filled / sketch) int m_DisplayModText; // How to display module texts (line/ filled / sketch)
bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode, bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode,
* TRUE = filled */ * TRUE = filled */
UserUnitType m_UserGridUnit; EDA_UNITS_T m_UserGridUnit;
wxRealPoint m_UserGridSize; wxRealPoint m_UserGridSize;
EDA_3D_FRAME* m_Draw3DFrame; EDA_3D_FRAME* m_Draw3DFrame;
......
...@@ -476,7 +476,7 @@ void PCB_BASE_FRAME::LoadSettings() ...@@ -476,7 +476,7 @@ void PCB_BASE_FRAME::LoadSettings()
long itmp; long itmp;
cfg->Read( m_FrameName + UserGridUnitsEntry, &itmp, ( long )INCHES ); cfg->Read( m_FrameName + UserGridUnitsEntry, &itmp, ( long )INCHES );
m_UserGridUnit = (UserUnitType) itmp; m_UserGridUnit = (EDA_UNITS_T) itmp;
cfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true ); cfg->Read( m_FrameName + DisplayPadFillEntry, &m_DisplayPadFill, true );
cfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true ); cfg->Read( m_FrameName + DisplayViaFillEntry, &m_DisplayViaFill, true );
cfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true ); cfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true );
......
...@@ -69,12 +69,13 @@ void Dialog_GeneralOptions::OnCancelClick( wxCommandEvent& event ) ...@@ -69,12 +69,13 @@ void Dialog_GeneralOptions::OnCancelClick( wxCommandEvent& event )
void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
{ {
UserUnitType ii; EDA_UNITS_T ii;
DisplayOpt.DisplayPolarCood = DisplayOpt.DisplayPolarCood =
( m_PolarDisplay->GetSelection() == 0 ) ? false : true; ( m_PolarDisplay->GetSelection() == 0 ) ? false : true;
ii = g_UserUnit; ii = g_UserUnit;
g_UserUnit = ( m_UnitsSelection->GetSelection() == 0 ) ? INCHES : MILLIMETRES; g_UserUnit = ( m_UnitsSelection->GetSelection() == 0 ) ? INCHES : MILLIMETRES;
if( ii != g_UserUnit ) if( ii != g_UserUnit )
m_Parent->ReCreateAuxiliaryToolbar(); m_Parent->ReCreateAuxiliaryToolbar();
...@@ -84,11 +85,13 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) ...@@ -84,11 +85,13 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
/* Updating the combobox to display the active layer. */ /* Updating the combobox to display the active layer. */
g_MaxLinksShowed = m_MaxShowLinks->GetValue(); g_MaxLinksShowed = m_MaxShowLinks->GetValue();
Drc_On = m_DrcOn->GetValue(); Drc_On = m_DrcOn->GetValue();
if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() ) if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() )
{ {
m_Parent->SetElementVisibility(RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() ); m_Parent->SetElementVisibility(RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() );
m_Parent->DrawPanel->Refresh( ); m_Parent->DrawPanel->Refresh( );
} }
g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue(); g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue();
g_AutoDeleteOldTrack = m_TrackAutodel->GetValue(); g_AutoDeleteOldTrack = m_TrackAutodel->GetValue();
Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue(); Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue();
......
/*****************************************/ /**
/* Edition du pcb: Gestion des dimensions */ * @file dimension.cpp
/*****************************************/ * @brief Dialog and code for editing a deminsion object.
*/
#include "fctsys.h" #include "fctsys.h"
#include "confirm.h" #include "confirm.h"
...@@ -11,7 +12,7 @@ ...@@ -11,7 +12,7 @@
#include "drawtxt.h" #include "drawtxt.h"
#include "dialog_helpers.h" #include "dialog_helpers.h"
/* Loca functions */ /* Local functions */
static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC ); static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC, static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase ); const wxPoint& aPosition, bool aErase );
...@@ -33,9 +34,9 @@ static int status_dimension; /* Used in cimension creation: ...@@ -33,9 +34,9 @@ static int status_dimension; /* Used in cimension creation:
*/ */
/************************************/ /*********************************/
/* class DIMENSION_EDITOR_DIALOG */ /* class DIMENSION_EDITOR_DIALOG */
/************************************/ /*********************************/
class DIMENSION_EDITOR_DIALOG : public wxDialog class DIMENSION_EDITOR_DIALOG : public wxDialog
{ {
...@@ -44,9 +45,9 @@ private: ...@@ -44,9 +45,9 @@ private:
PCB_EDIT_FRAME* m_Parent; PCB_EDIT_FRAME* m_Parent;
wxDC* m_DC; wxDC* m_DC;
DIMENSION* CurrentDimension; DIMENSION* CurrentDimension;
WinEDA_EnterText* m_Name; wxTextCtrl* m_Name;
WinEDA_SizeCtrl* m_TxtSizeCtrl; EDA_SIZE_CTRL* m_TxtSizeCtrl;
WinEDA_ValueCtrl* m_TxtWidthCtrl; EDA_VALUE_CTRL* m_TxtWidthCtrl;
wxRadioBox* m_Mirror; wxRadioBox* m_Mirror;
wxComboBox* m_SelLayerBox; wxComboBox* m_SelLayerBox;
...@@ -103,19 +104,30 @@ DIMENSION_EDITOR_DIALOG::DIMENSION_EDITOR_DIALOG( PCB_EDIT_FRAME* parent, ...@@ -103,19 +104,30 @@ DIMENSION_EDITOR_DIALOG::DIMENSION_EDITOR_DIALOG( PCB_EDIT_FRAME* parent,
m_Mirror = new wxRadioBox( this, -1, _( "Display" ), m_Mirror = new wxRadioBox( this, -1, _( "Display" ),
wxDefaultPosition, wxSize( -1, -1 ), 2, display_msg, wxDefaultPosition, wxSize( -1, -1 ), 2, display_msg,
1, wxRA_SPECIFY_COLS ); 1, wxRA_SPECIFY_COLS );
if( Dimension->m_Text->m_Mirror ) if( Dimension->m_Text->m_Mirror )
m_Mirror->SetSelection( 1 ); m_Mirror->SetSelection( 1 );
RightBoxSizer->Add( m_Mirror, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( m_Mirror, 0, wxGROW | wxALL, 5 );
m_Name = new WinEDA_EnterText( this, wxT( "Text:" ), LeftBoxSizer->Add( new wxStaticText( this, -1, _( "Text:" ) ),
Dimension->m_Text->m_Text, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
LeftBoxSizer, wxSize( 200, -1 ) );
m_Name = new wxTextCtrl( this, -1, Dimension->m_Text->m_Text,
wxDefaultPosition, wxSize( 200, -1 ) );
m_Name->SetInsertionPoint( 1 );
LeftBoxSizer->Add( m_Name,
0,
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
5 );
m_TxtSizeCtrl = new WinEDA_SizeCtrl( this, _( "Size" ), m_TxtSizeCtrl = new EDA_SIZE_CTRL( this, _( "Size" ),
Dimension->m_Text->m_Size, Dimension->m_Text->m_Size,
g_UserUnit, LeftBoxSizer, m_Parent->m_InternalUnits ); g_UserUnit, LeftBoxSizer, m_Parent->m_InternalUnits );
m_TxtWidthCtrl = new WinEDA_ValueCtrl( this, _( "Width" ), m_TxtWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ),
Dimension->m_Width, Dimension->m_Width,
g_UserUnit, LeftBoxSizer, m_Parent->m_InternalUnits ); g_UserUnit, LeftBoxSizer, m_Parent->m_InternalUnits );
...@@ -138,24 +150,21 @@ DIMENSION_EDITOR_DIALOG::DIMENSION_EDITOR_DIALOG( PCB_EDIT_FRAME* parent, ...@@ -138,24 +150,21 @@ DIMENSION_EDITOR_DIALOG::DIMENSION_EDITOR_DIALOG( PCB_EDIT_FRAME* parent,
} }
/**********************************************************************/
void DIMENSION_EDITOR_DIALOG::OnCancelClick( wxCommandEvent& event ) void DIMENSION_EDITOR_DIALOG::OnCancelClick( wxCommandEvent& event )
/**********************************************************************/
{ {
EndModal( -1 ); EndModal( -1 );
} }
/***********************************************************************************/
void DIMENSION_EDITOR_DIALOG::OnOkClick( wxCommandEvent& event ) void DIMENSION_EDITOR_DIALOG::OnOkClick( wxCommandEvent& event )
/***********************************************************************************/
{ {
if( m_DC ) // Effacement ancien texte if( m_DC ) // Delete old text.
{ {
CurrentDimension->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); CurrentDimension->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
} }
m_Parent->SaveCopyInUndoList(CurrentDimension, UR_CHANGED); m_Parent->SaveCopyInUndoList(CurrentDimension, UR_CHANGED);
if( m_Name->GetValue() != wxEmptyString ) if( m_Name->GetValue() != wxEmptyString )
{ {
CurrentDimension->SetText( m_Name->GetValue() ); CurrentDimension->SetText( m_Name->GetValue() );
...@@ -165,12 +174,14 @@ void DIMENSION_EDITOR_DIALOG::OnOkClick( wxCommandEvent& event ) ...@@ -165,12 +174,14 @@ void DIMENSION_EDITOR_DIALOG::OnOkClick( wxCommandEvent& event )
int width = m_TxtWidthCtrl->GetValue(); int width = m_TxtWidthCtrl->GetValue();
int maxthickness = Clamp_Text_PenSize( width, CurrentDimension->m_Text->m_Size ); int maxthickness = Clamp_Text_PenSize( width, CurrentDimension->m_Text->m_Size );
if( width > maxthickness ) if( width > maxthickness )
{ {
DisplayError( NULL, DisplayError( NULL,
_( "The text thickness is too large for the text size. It will be clamped") ); _( "The text thickness is too large for the text size. It will be clamped") );
width = maxthickness; width = maxthickness;
} }
CurrentDimension->m_Text->m_Thickness = CurrentDimension->m_Width = width ; CurrentDimension->m_Text->m_Thickness = CurrentDimension->m_Width = width ;
CurrentDimension->m_Text->m_Mirror = ( m_Mirror->GetSelection() == 1 ) ? true : false; CurrentDimension->m_Text->m_Mirror = ( m_Mirror->GetSelection() == 1 ) ? true : false;
...@@ -179,9 +190,8 @@ void DIMENSION_EDITOR_DIALOG::OnOkClick( wxCommandEvent& event ) ...@@ -179,9 +190,8 @@ void DIMENSION_EDITOR_DIALOG::OnOkClick( wxCommandEvent& event )
CurrentDimension->AdjustDimensionDetails( true ); CurrentDimension->AdjustDimensionDetails( true );
if( m_DC ) // Affichage nouveau texte if( m_DC ) // Display new text
{ {
/* Redessin du Texte */
CurrentDimension->Draw( m_Parent->DrawPanel, m_DC, GR_OR ); CurrentDimension->Draw( m_Parent->DrawPanel, m_DC, GR_OR );
} }
...@@ -190,9 +200,7 @@ void DIMENSION_EDITOR_DIALOG::OnOkClick( wxCommandEvent& event ) ...@@ -190,9 +200,7 @@ void DIMENSION_EDITOR_DIALOG::OnOkClick( wxCommandEvent& event )
} }
/**************************************************************/
static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC ) static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC )
/**************************************************************/
{ {
DIMENSION* Dimension = (DIMENSION*) Panel->GetScreen()->GetCurItem(); DIMENSION* Dimension = (DIMENSION*) Panel->GetScreen()->GetCurItem();
...@@ -214,9 +222,7 @@ static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -214,9 +222,7 @@ static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC )
} }
/*************************************************************************/
DIMENSION* PCB_EDIT_FRAME::Begin_Dimension( DIMENSION* Dimension, wxDC* DC ) DIMENSION* PCB_EDIT_FRAME::Begin_Dimension( DIMENSION* Dimension, wxDC* DC )
/*************************************************************************/
{ {
wxPoint pos; wxPoint pos;
...@@ -254,10 +260,12 @@ DIMENSION* PCB_EDIT_FRAME::Begin_Dimension( DIMENSION* Dimension, wxDC* DC ) ...@@ -254,10 +260,12 @@ DIMENSION* PCB_EDIT_FRAME::Begin_Dimension( DIMENSION* Dimension, wxDC* DC )
Dimension->m_Text->m_Size = GetBoard()->GetBoardDesignSettings()->m_PcbTextSize; Dimension->m_Text->m_Size = GetBoard()->GetBoardDesignSettings()->m_PcbTextSize;
int width = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth; int width = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth;
int maxthickness = Clamp_Text_PenSize(width, Dimension->m_Text->m_Size ); int maxthickness = Clamp_Text_PenSize(width, Dimension->m_Text->m_Size );
if( width > maxthickness ) if( width > maxthickness )
{ {
width = maxthickness; width = maxthickness;
} }
Dimension->m_Text->m_Thickness = Dimension->m_Width = width ; Dimension->m_Text->m_Thickness = Dimension->m_Width = width ;
Dimension->AdjustDimensionDetails( ); Dimension->AdjustDimensionDetails( );
...@@ -324,8 +332,7 @@ static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -324,8 +332,7 @@ static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
deltax = Dimension->TraitD_ox - Dimension->TraitG_ox; deltax = Dimension->TraitD_ox - Dimension->TraitG_ox;
deltay = Dimension->TraitD_oy - Dimension->TraitG_oy; deltay = Dimension->TraitD_oy - Dimension->TraitG_oy;
/* Calcul de la direction de deplacement /* Calculating the direction of travel perpendicular to the selected axis. */
* ( perpendiculaire a l'axe de la cote ) */
angle = atan2( (double)deltay, (double)deltax ) + (M_PI / 2); angle = atan2( (double)deltay, (double)deltax ) + (M_PI / 2);
deltax = pos.x - Dimension->TraitD_ox; deltax = pos.x - Dimension->TraitD_ox;
...@@ -345,9 +352,7 @@ static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -345,9 +352,7 @@ static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
} }
/***************************************************************/
void PCB_EDIT_FRAME::Install_Edit_Dimension( DIMENSION* Dimension, wxDC* DC ) void PCB_EDIT_FRAME::Install_Edit_Dimension( DIMENSION* Dimension, wxDC* DC )
/***************************************************************/
{ {
if( Dimension == NULL ) if( Dimension == NULL )
return; return;
...@@ -358,9 +363,7 @@ void PCB_EDIT_FRAME::Install_Edit_Dimension( DIMENSION* Dimension, wxDC* DC ) ...@@ -358,9 +363,7 @@ void PCB_EDIT_FRAME::Install_Edit_Dimension( DIMENSION* Dimension, wxDC* DC )
} }
/*******************************************************************/
void PCB_EDIT_FRAME::Delete_Dimension( DIMENSION* Dimension, wxDC* DC ) void PCB_EDIT_FRAME::Delete_Dimension( DIMENSION* Dimension, wxDC* DC )
/*******************************************************************/
{ {
if( Dimension == NULL ) if( Dimension == NULL )
return; return;
...@@ -372,4 +375,3 @@ void PCB_EDIT_FRAME::Delete_Dimension( DIMENSION* Dimension, wxDC* DC ) ...@@ -372,4 +375,3 @@ void PCB_EDIT_FRAME::Delete_Dimension( DIMENSION* Dimension, wxDC* DC )
Dimension->UnLink(); Dimension->UnLink();
OnModify(); OnModify();
} }
...@@ -694,7 +694,7 @@ void FOOTPRINT_EDIT_FRAME::Select_Active_Library() ...@@ -694,7 +694,7 @@ void FOOTPRINT_EDIT_FRAME::Select_Active_Library()
if( g_LibName_List.GetCount() == 0 ) if( g_LibName_List.GetCount() == 0 )
return; return;
WinEDAListBox dlg( this, _( "Select Active Library:" ), g_LibName_List, m_CurrentLib ); EDA_LIST_DIALOG dlg( this, _( "Select Active Library:" ), g_LibName_List, m_CurrentLib );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return; return;
......
...@@ -357,7 +357,7 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow, ...@@ -357,7 +357,7 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow,
if( footprint_names_list.GetCount() ) if( footprint_names_list.GetCount() )
{ {
msg.Printf( _( "Modules [%d items]" ), footprint_names_list.GetCount() ); msg.Printf( _( "Modules [%d items]" ), footprint_names_list.GetCount() );
WinEDAListBox dlg( aWindow, msg, footprint_names_list, OldName, EDA_LIST_DIALOG dlg( aWindow, msg, footprint_names_list, OldName,
DisplayCmpDoc, GetComponentDialogPosition() ); DisplayCmpDoc, GetComponentDialogPosition() );
if( dlg.ShowModal() == wxID_OK ) if( dlg.ShowModal() == wxID_OK )
...@@ -411,7 +411,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Select_1_Module_From_BOARD( BOARD* aPcb ) ...@@ -411,7 +411,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Select_1_Module_From_BOARD( BOARD* aPcb )
msg.Printf( _( "Modules [%d items]" ), listnames.GetCount() ); msg.Printf( _( "Modules [%d items]" ), listnames.GetCount() );
WinEDAListBox dlg( this, msg, listnames, wxEmptyString ); EDA_LIST_DIALOG dlg( this, msg, listnames, wxEmptyString );
dlg.SortList(); dlg.SortList();
if( dlg.ShowModal() == wxID_OK ) if( dlg.ShowModal() == wxID_OK )
......
...@@ -39,8 +39,8 @@ private: ...@@ -39,8 +39,8 @@ private:
PCB_EDIT_FRAME* m_Parent; PCB_EDIT_FRAME* m_Parent;
wxDC* m_DC; wxDC* m_DC;
MIREPCB* m_MirePcb; MIREPCB* m_MirePcb;
WinEDA_ValueCtrl* m_MireWidthCtrl; EDA_VALUE_CTRL* m_MireWidthCtrl;
WinEDA_ValueCtrl* m_MireSizeCtrl; EDA_VALUE_CTRL* m_MireSizeCtrl;
wxRadioBox* m_MireShape; wxRadioBox* m_MireShape;
public: public:
...@@ -99,13 +99,13 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( ...@@ -99,13 +99,13 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
// Size: // Size:
m_MireSizeCtrl = new WinEDA_ValueCtrl( this, _( "Size" ), m_MireSizeCtrl = new EDA_VALUE_CTRL( this, _( "Size" ),
m_MirePcb->m_Size, m_MirePcb->m_Size,
g_UserUnit, LeftBoxSizer, g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
// Width: // Width:
m_MireWidthCtrl = new WinEDA_ValueCtrl( this, _( "Width" ), m_MireWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ),
m_MirePcb->m_Width, m_MirePcb->m_Width,
g_UserUnit, LeftBoxSizer, g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits ); m_Parent->m_InternalUnits );
......
...@@ -724,7 +724,7 @@ class WinEDA_SetParamShapeFrame : public wxDialog ...@@ -724,7 +724,7 @@ class WinEDA_SetParamShapeFrame : public wxDialog
private: private:
PCB_EDIT_FRAME* m_Parent; PCB_EDIT_FRAME* m_Parent;
wxRadioBox* m_ShapeOptionCtrl; wxRadioBox* m_ShapeOptionCtrl;
WinEDA_SizeCtrl* m_SizeCtrl; EDA_SIZE_CTRL* m_SizeCtrl;
public: WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent, const wxPoint& pos ); public: WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent, const wxPoint& pos );
~WinEDA_SetParamShapeFrame() { }; ~WinEDA_SetParamShapeFrame() { };
...@@ -740,12 +740,12 @@ private: ...@@ -740,12 +740,12 @@ private:
BEGIN_EVENT_TABLE( WinEDA_SetParamShapeFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_SetParamShapeFrame, wxDialog )
EVT_BUTTON( wxID_OK, WinEDA_SetParamShapeFrame::OnOkClick ) EVT_BUTTON( wxID_OK, WinEDA_SetParamShapeFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_SetParamShapeFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, WinEDA_SetParamShapeFrame::OnCancelClick )
EVT_BUTTON( ID_READ_SHAPE_FILE, EVT_BUTTON( ID_READ_SHAPE_FILE, WinEDA_SetParamShapeFrame::ReadDataShapeDescr )
WinEDA_SetParamShapeFrame::ReadDataShapeDescr )
END_EVENT_TABLE() END_EVENT_TABLE()
WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent, WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent,
const wxPoint& framepos ) : const wxPoint& framepos ) :
wxDialog( parent, -1, _( "Complex shape" ), framepos, wxSize( 350, 280 ), wxDialog( parent, -1, _( "Complex shape" ), framepos, wxSize( 350, 280 ),
...@@ -755,6 +755,7 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent, ...@@ -755,6 +755,7 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent,
if( PolyEdges ) if( PolyEdges )
free( PolyEdges ); free( PolyEdges );
PolyEdges = NULL; PolyEdges = NULL;
PolyEdgesCount = 0; PolyEdgesCount = 0;
...@@ -787,7 +788,7 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent, ...@@ -787,7 +788,7 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent,
wxRA_SPECIFY_COLS ); wxRA_SPECIFY_COLS );
LeftBoxSizer->Add( m_ShapeOptionCtrl, 0, wxGROW | wxALL, 5 ); LeftBoxSizer->Add( m_ShapeOptionCtrl, 0, wxGROW | wxALL, 5 );
m_SizeCtrl = new WinEDA_SizeCtrl( this, _( "Size" ), ShapeSize, m_SizeCtrl = new EDA_SIZE_CTRL( this, _( "Size" ), ShapeSize,
g_UserUnit, LeftBoxSizer, g_UserUnit, LeftBoxSizer,
PCB_INTERNAL_UNIT ); PCB_INTERNAL_UNIT );
......
...@@ -729,13 +729,14 @@ MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName( void ) ...@@ -729,13 +729,14 @@ MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName( void )
for( ; Module != NULL; Module = (MODULE*) Module->Next() ) for( ; Module != NULL; Module = (MODULE*) Module->Next() )
listnames.Add( Module->m_Reference->m_Text ); listnames.Add( Module->m_Reference->m_Text );
WinEDAListBox dlg( this, _( "Components" ), listnames, wxEmptyString ); EDA_LIST_DIALOG dlg( this, _( "Components" ), listnames, wxEmptyString );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return NULL; return NULL;
wxString ref = dlg.GetTextSelection(); wxString ref = dlg.GetTextSelection();
Module = (MODULE*) GetBoard()->m_Modules; Module = (MODULE*) GetBoard()->m_Modules;
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
{ {
if( Module->m_Reference->m_Text == ref ) if( Module->m_Reference->m_Text == ref )
......
...@@ -48,7 +48,7 @@ void PCB_BASE_FRAME::InstallGridFrame( const wxPoint& pos ) ...@@ -48,7 +48,7 @@ void PCB_BASE_FRAME::InstallGridFrame( const wxPoint& pos )
return; return;
m_UserGridSize = dlg.GetGridSize(); m_UserGridSize = dlg.GetGridSize();
m_UserGridUnit = (UserUnitType) dlg.GetGridUnits(); m_UserGridUnit = (EDA_UNITS_T) dlg.GetGridUnits();
GetScreen()->m_GridOrigin = dlg.GetGridOrigin(); GetScreen()->m_GridOrigin = dlg.GetGridOrigin();
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER ); GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
......
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