Coding style policy fixes and dead code removal.

This commit is contained in:
Wayne Stambaugh 2011-09-06 15:42:46 -04:00
parent ebc7259a91
commit 750f84c19a
27 changed files with 284 additions and 354 deletions

View File

@ -175,7 +175,7 @@ Info_3D_Visu::~Info_3D_Visu()
* units */
WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
wxBoxSizer* BoxSizer,
UserUnitType units, int internal_unit )
EDA_UNITS_T units, int internal_unit )
{
wxString text;
wxStaticText* msgtitle;

View File

@ -123,7 +123,7 @@ private:
public:
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();

View File

@ -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;
wxRealPoint new_size;

View File

@ -78,7 +78,7 @@ wxString g_Prj_Default_Config_FullFilename;
wxString g_Prj_Config_LocalFilename;
/* Current user unit of measure */
UserUnitType g_UserUnit;
EDA_UNITS_T g_UserUnit;
/* Draw color for moving objects: */
int g_GhostColor;
@ -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 label;
@ -249,7 +249,7 @@ wxString ReturnUnitSymbol( UserUnitType aUnit, const wxString& formatString )
}
wxString GetUnitsLabel( UserUnitType aUnit )
wxString GetUnitsLabel( EDA_UNITS_T aUnit )
{
wxString label;
@ -272,7 +272,7 @@ wxString GetUnitsLabel( UserUnitType aUnit )
}
wxString GetAbbreviatedUnitsLabel( UserUnitType aUnit )
wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit )
{
wxString label;
@ -298,7 +298,7 @@ wxString GetAbbreviatedUnitsLabel( UserUnitType aUnit )
* Add string " (mm):" or " ("):" to the static text Stext.
* 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();
@ -346,7 +346,7 @@ int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit )
* @return a wxString what contains value and optionally the symbol unit
* (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 )
{
wxString StringValue;
@ -384,7 +384,7 @@ wxString ReturnStringFromValue( UserUnitType aUnit, int aValue, int aInternal_Un
* Value = text
* 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 Value;
@ -479,7 +479,7 @@ wxArrayString* wxStringSplit( wxString txt, wxChar splitter )
* @param val : double : the given value
* @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 )
{
@ -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
*/
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;

View File

@ -16,14 +16,14 @@ enum listbox {
};
BEGIN_EVENT_TABLE( WinEDAListBox, wxDialog )
EVT_BUTTON( wxID_OK, WinEDAListBox::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDAListBox::OnCancelClick )
EVT_LISTBOX( ID_LISTBOX_LIST, WinEDAListBox::ClickOnList )
EVT_LISTBOX_DCLICK( ID_LISTBOX_LIST, WinEDAListBox::D_ClickOnList )
EVT_CHAR( WinEDAListBox::OnKeyEvent )
EVT_CHAR_HOOK( WinEDAListBox::OnKeyEvent )
EVT_CLOSE( WinEDAListBox::OnClose )
BEGIN_EVENT_TABLE( EDA_LIST_DIALOG, wxDialog )
EVT_BUTTON( wxID_OK, EDA_LIST_DIALOG::OnOkClick )
EVT_BUTTON( wxID_CANCEL, EDA_LIST_DIALOG::OnCancelClick )
EVT_LISTBOX( ID_LISTBOX_LIST, EDA_LIST_DIALOG::ClickOnList )
EVT_LISTBOX_DCLICK( ID_LISTBOX_LIST, EDA_LIST_DIALOG::D_ClickOnList )
EVT_CHAR( EDA_LIST_DIALOG::OnKeyEvent )
EVT_CHAR_HOOK( EDA_LIST_DIALOG::OnKeyEvent )
EVT_CLOSE( EDA_LIST_DIALOG::OnClose )
END_EVENT_TABLE()
@ -37,9 +37,9 @@ END_EVENT_TABLE()
* @param aCallBackFunction callback function to display comments
* @param aPos = position of the dialog.
*/
WinEDAListBox::WinEDAListBox( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
const wxArrayString& aItemList, const wxString& aRefText,
void(* aCallBackFunction)(wxString& Text), wxPoint aPos ) :
EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
const wxArrayString& aItemList, const wxString& aRefText,
void(* aCallBackFunction)(wxString& Text), wxPoint aPos ) :
wxDialog( aParent, wxID_ANY, aTitle, aPos, wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | MAYBE_RESIZE_BORDER )
{
@ -61,8 +61,8 @@ WinEDAListBox::WinEDAListBox( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
if( m_callBackFct )
{
m_messages = new wxTextCtrl( this, -1, wxEmptyString,
wxDefaultPosition, wxSize( -1, 60 ),
wxTE_READONLY | wxTE_MULTILINE );
wxDefaultPosition, wxSize( -1, 60 ),
wxTE_READONLY | wxTE_MULTILINE );
GeneralBoxSizer->Add( m_messages, 0, wxGROW | wxALL, 5 );
}
@ -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;
wxSize list_size = m_listBox->GetSize();
@ -96,32 +96,32 @@ void WinEDAListBox::MoveMouseToOrigin()
}
wxString WinEDAListBox::GetTextSelection()
wxString EDA_LIST_DIALOG::GetTextSelection()
{
wxString text = m_listBox->GetStringSelection();
return text;
}
void WinEDAListBox::Append( const wxString& item )
void EDA_LIST_DIALOG::Append( const wxString& 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 );
}
void WinEDAListBox::OnCancelClick( wxCommandEvent& event )
void EDA_LIST_DIALOG::OnCancelClick( wxCommandEvent& event )
{
EndModal( wxID_CANCEL );
}
void WinEDAListBox::ClickOnList( wxCommandEvent& event )
void EDA_LIST_DIALOG::ClickOnList( wxCommandEvent& event )
{
wxString text;
@ -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 );
}
void WinEDAListBox::OnOkClick( wxCommandEvent& event )
void EDA_LIST_DIALOG::OnOkClick( wxCommandEvent& event )
{
EndModal( wxID_OK );
}
void WinEDAListBox::OnClose( wxCloseEvent& event )
void EDA_LIST_DIALOG::OnClose( wxCloseEvent& event )
{
EndModal( wxID_CANCEL );
}
@ -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();
const wxString** BufList;
@ -170,6 +170,7 @@ void WinEDAListBox:: SortList()
return;
BufList = (const wxString**) MyZMalloc( 100 * NbItems * sizeof(wxString*) );
for( ii = 0; ii < NbItems; ii++ )
{
BufList[ii] = new wxString( m_listBox->GetString( ii ) );
@ -179,6 +180,7 @@ void WinEDAListBox:: SortList()
( int( * ) ( const void*, const void* ) )SortItems );
m_listBox->Clear();
for( ii = 0; ii < NbItems; ii++ )
{
m_listBox->Append( *BufList[ii] );
@ -189,7 +191,7 @@ void WinEDAListBox:: SortList()
}
void WinEDAListBox::OnKeyEvent( wxKeyEvent& event )
void EDA_LIST_DIALOG::OnKeyEvent( wxKeyEvent& event )
{
event.Skip();
}

View File

@ -1,94 +1,23 @@
/***************/
/* wxwineda.cpp */
/****************/
/**
* @file wxwineda.cpp
*/
#include "fctsys.h"
#include "common.h"
#include "wxstruct.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 */
/*******************************************************/
WinEDA_GraphicTextCtrl::WinEDA_GraphicTextCtrl( wxWindow* parent,
const wxString& Title,
const wxString& TextToEdit,
int textsize,
UserUnitType user_unit,
wxBoxSizer* BoxSizer,
int framelen,
int internal_unit )
EDA_GRAPHIC_TEXT_CTRL::EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent,
const wxString& Title,
const wxString& TextToEdit,
int textsize,
EDA_UNITS_T user_unit,
wxBoxSizer* BoxSizer,
int framelen,
int internal_unit )
{
m_UserUnit = user_unit;
m_Internal_Unit = internal_unit;
@ -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
delete m_FrameText;
@ -130,8 +59,8 @@ WinEDA_GraphicTextCtrl::~WinEDA_GraphicTextCtrl()
}
wxString WinEDA_GraphicTextCtrl::FormatSize( int internalUnit, UserUnitType aUnit,
int textSize )
wxString EDA_GRAPHIC_TEXT_CTRL::FormatSize( int internalUnit, EDA_UNITS_T aUnit,
int textSize )
{
wxString value;
@ -143,40 +72,40 @@ wxString WinEDA_GraphicTextCtrl::FormatSize( int internalUnit, UserUnitType aUni
textSize = 3000;
value.Printf( ( internalUnit > 1000 ) ? wxT( "%.4f" ) : wxT( "%.3f" ),
To_User_Unit( aUnit, textSize, internalUnit ) );
To_User_Unit( aUnit, textSize, internalUnit ) );
return value;
}
void WinEDA_GraphicTextCtrl::SetTitle( const wxString& title )
void EDA_GRAPHIC_TEXT_CTRL::SetTitle( const wxString& 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 );
}
void WinEDA_GraphicTextCtrl::SetValue( int textSize )
void EDA_GRAPHIC_TEXT_CTRL::SetValue( int textSize )
{
wxString value = FormatSize( m_Internal_Unit, m_UserUnit, textSize );
m_FrameSize->SetValue( value );
}
wxString WinEDA_GraphicTextCtrl::GetText()
wxString EDA_GRAPHIC_TEXT_CTRL::GetText()
{
wxString text = m_FrameText->GetValue();
return text;
}
int WinEDA_GraphicTextCtrl::ParseSize( const wxString& sizeText,
int internalUnit, UserUnitType aUnit )
int EDA_GRAPHIC_TEXT_CTRL::ParseSize( const wxString& sizeText,
int internalUnit, EDA_UNITS_T aUnit )
{
int textsize;
@ -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 );
}
void WinEDA_GraphicTextCtrl::Enable( bool state )
void EDA_GRAPHIC_TEXT_CTRL::Enable( bool state )
{
m_FrameText->Enable( state );
}
@ -208,21 +137,23 @@ void WinEDA_GraphicTextCtrl::Enable( bool state )
/********************************************************/
/* Class to display and edit a coordinated INCHES or MM */
/********************************************************/
WinEDA_PositionCtrl::WinEDA_PositionCtrl( wxWindow* parent,
const wxString& title,
const wxPoint& pos_to_edit,
UserUnitType user_unit,
wxBoxSizer* BoxSizer,
int internal_unit )
EDA_POSITION_CTRL::EDA_POSITION_CTRL( wxWindow* parent,
const wxString& title,
const wxPoint& pos_to_edit,
EDA_UNITS_T user_unit,
wxBoxSizer* BoxSizer,
int internal_unit )
{
wxString text;
m_UserUnit = user_unit;
m_Internal_Unit = internal_unit;
if( title.IsEmpty() )
text = _( "Pos " );
else
text = title;
text += _( "X" ) + ReturnUnitSymbol( m_UserUnit );
m_TextX = new wxStaticText( parent, -1, text );
@ -239,6 +170,7 @@ WinEDA_PositionCtrl::WinEDA_PositionCtrl( wxWindow* parent,
else
text = title;
text += _( "Y" ) + ReturnUnitSymbol( m_UserUnit );
m_TextY = new wxStaticText( parent, -1, text );
BoxSizer->Add( m_TextY, 0,
@ -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_TextY;
@ -263,7 +195,7 @@ WinEDA_PositionCtrl::~WinEDA_PositionCtrl()
/* Returns (in internal units) to coordinate between (in user units)
*/
wxPoint WinEDA_PositionCtrl::GetValue()
wxPoint EDA_POSITION_CTRL::GetValue()
{
wxPoint coord;
@ -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_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;
@ -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,
const wxSize& size_to_edit,
UserUnitType aUnit, wxBoxSizer* BoxSizer,
int internal_unit ) :
WinEDA_PositionCtrl( parent, title,
wxPoint( size_to_edit.x, size_to_edit.y ),
aUnit, BoxSizer, internal_unit )
EDA_SIZE_CTRL::EDA_SIZE_CTRL( wxWindow* parent, const wxString& title,
const wxSize& size_to_edit,
EDA_UNITS_T aUnit, wxBoxSizer* aBoxSizer,
int internal_unit ) :
EDA_POSITION_CTRL( parent, title,
wxPoint( size_to_edit.x, size_to_edit.y ),
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;
size.x = pos.x;
@ -326,9 +258,9 @@ wxSize WinEDA_SizeCtrl::GetValue()
/**************************************************************/
/* Class to display and edit a dimension INCHES, MM, or other */
/**************************************************************/
WinEDA_ValueCtrl::WinEDA_ValueCtrl( wxWindow* parent, const wxString& title,
int value, UserUnitType user_unit, wxBoxSizer* BoxSizer,
int internal_unit )
EDA_VALUE_CTRL::EDA_VALUE_CTRL( wxWindow* parent, const wxString& title,
int value, EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer,
int internal_unit )
{
wxString label = 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_Text;
}
int WinEDA_ValueCtrl::GetValue()
int EDA_VALUE_CTRL::GetValue()
{
int coord;
wxString txtvalue = m_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;
@ -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_Text->Enable( enbl );

View File

@ -49,9 +49,11 @@ wxString DataBaseGetName( EDA_DRAW_FRAME* frame, wxString& Keys, wxString& BufNa
if( nameList.IsEmpty() )
{
msg = _( "No components found matching " );
if( !BufName.IsEmpty() )
{
msg += _( "name search criteria <" ) + BufName + wxT( "> " );
if( !Keys.IsEmpty() )
msg += _( "and " );
}
@ -66,8 +68,8 @@ wxString DataBaseGetName( EDA_DRAW_FRAME* frame, wxString& Keys, wxString& BufNa
// Show candidate list:
wxString cmpname;
WinEDAListBox dlg( frame, _( "Select Component" ),
nameList, cmpname, DisplayCmpDoc );
EDA_LIST_DIALOG dlg( frame, _( "Select Component" ), nameList, cmpname, DisplayCmpDoc );
if( dlg.ShowModal() != wxID_OK )
return wxEmptyString;

View File

@ -632,9 +632,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
else
fieldValueTextCtrl->Enable( true );
textSizeTextCtrl->SetValue(
WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT,
g_UserUnit, field.m_Size.x ) );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( EESCHEMA_INTERNAL_UNIT,
g_UserUnit, field.m_Size.x ) );
wxPoint coord = field.m_Pos;
wxPoint zero = -m_Cmp->m_Pos; // relative zero
@ -713,8 +712,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
setRowItem( fieldNdx, field ); // update fieldListCtrl
field.m_Size.x = WinEDA_GraphicTextCtrl::ParseSize(
textSizeTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT, g_UserUnit );
field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(),
EESCHEMA_INTERNAL_UNIT, g_UserUnit );
field.m_Size.y = field.m_Size.x;
int style = m_StyleRadioBox->GetSelection();

View File

@ -657,8 +657,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
fieldValueTextCtrl->SetValue( field.m_Text );
textSizeTextCtrl->SetValue(
WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT, g_UserUnit, field.m_Size.x ) );
textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( EESCHEMA_INTERNAL_UNIT,
g_UserUnit, field.m_Size.x ) );
wxPoint coord = field.m_Pos;
wxPoint zero;
@ -744,8 +744,8 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
setRowItem( fieldNdx, field ); // update fieldListCtrl
field.m_Size.x = WinEDA_GraphicTextCtrl::ParseSize(
textSizeTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT, g_UserUnit );
field.m_Size.x = EDA_GRAPHIC_TEXT_CTRL::ParseSize( textSizeTextCtrl->GetValue(),
EESCHEMA_INTERNAL_UNIT, g_UserUnit );
field.m_Size.y = field.m_Size.x;

View File

@ -210,7 +210,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_CANCEL )
return;
g_UserUnit = (UserUnitType)dlg.GetUnitsSelection();
g_UserUnit = (EDA_UNITS_T)dlg.GetUnitsSelection();
GetScreen()->SetGrid( grid_list[ (size_t) dlg.GetGridSelection() ].m_Size );

View File

@ -254,16 +254,23 @@ void NETLIST_DIALOG::InstallPageSpice()
wxDefaultPosition, wxDefaultSize,
2, netlist_opt, 1,
wxRA_SPECIFY_COLS );
if( !g_OptNetListUseNames )
m_UseNetNamesInNetlist->SetSelection( 1 );
page->m_LeftBoxSizer->Add( m_UseNetNamesInNetlist, 0, wxGROW | wxALL, 5 );
page->m_CommandStringCtrl = new WinEDA_EnterText( page,
_( "Simulator command:" ),
m_Parent->GetSimulatorCommand(),
page->m_LowBoxSizer,
wxDefaultSize );
page->m_LowBoxSizer->Add( new wxStaticText( page, -1, _( "Simulator command:" ) ), 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
page->m_CommandStringCtrl = new wxTextCtrl( page, -1, m_Parent->GetSimulatorCommand(),
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
Button = new wxButton( page, ID_CREATE_NETLIST, _( "Netlist" ) );
@ -301,6 +308,7 @@ void NETLIST_DIALOG::InstallCustomPages()
/* Install the panel "Add Plugin" after
* the last initialized panel */
previoustitle = title;
if( title.IsEmpty() )
CurrPage =
@ -324,17 +332,32 @@ void NETLIST_DIALOG::InstallCustomPages()
msg = CUSTOM_NETLIST_COMMAND;
msg << ii + 1;
wxString Command = wxGetApp().m_EDA_Config->Read( msg );
CurrPage->m_CommandStringCtrl =
new WinEDA_EnterText( CurrPage,
_( "Netlist command:" ), Command,
CurrPage->m_LowBoxSizer,
wxDefaultSize );
CurrPage->m_TitleStringCtrl =
new WinEDA_EnterText( CurrPage,
_( "Title:" ), title,
CurrPage->m_LowBoxSizer,
wxDefaultSize );
CurrPage->m_LowBoxSizer->Add( new wxStaticText( CurrPage,
-1, _( "Netlist command:" ) ), 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
CurrPage->m_CommandStringCtrl = new wxTextCtrl( CurrPage, -1, Command,
wxDefaultPosition, wxDefaultSize );
CurrPage->m_CommandStringCtrl->SetInsertionPoint( 1 );
CurrPage->m_LowBoxSizer->Add( CurrPage->m_CommandStringCtrl,
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 )
/* Get a title for this page */
wxString title = CurrPage->m_TitleStringCtrl->GetValue();
if( title.IsEmpty() )
DisplayInfoMessage( this,
_( "Do not forget to choose a title for this netlist control page" ) );

View File

@ -48,8 +48,8 @@ public:
int m_IdNetType;
wxCheckBox* m_IsCurrentFormat;
wxCheckBox* m_AddSubPrefix;
WinEDA_EnterText* m_CommandStringCtrl;
WinEDA_EnterText* m_TitleStringCtrl;
wxTextCtrl* m_CommandStringCtrl;
wxTextCtrl* m_TitleStringCtrl;
wxButton* m_ButtonCancel;
wxBoxSizer* m_LeftBoxSizer;
wxBoxSizer* m_RightBoxSizer;

View File

@ -64,7 +64,7 @@ int DisplayComponentsNamesInLib( EDA_DRAW_FRAME* frame,
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 )
return 0;

View File

@ -327,7 +327,7 @@ public:
void SetGridList( GRIDS& sizelist );
void AddGrid( const GRID_TYPE& grid );
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().

View File

@ -13,7 +13,6 @@
class wxAboutDialogInfo;
class BASE_SCREEN;
class EDA_DRAW_FRAME;
class WinEDAListBox;
class EDA_DRAW_PANEL;
/* Flag for special keys */
@ -81,7 +80,8 @@ enum pseudokeys {
#define ON 1
#define OFF 0
enum UserUnitType {
enum EDA_UNITS_T {
INCHES = 0,
MILLIMETRES = 1,
UNSCALED_UNITS = 2
@ -163,7 +163,7 @@ extern wxString g_Prj_Default_Config_FullFilename;
// Name of local configuration file. (<curr projet>.pro)
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: */
extern int g_GhostColor;
@ -285,7 +285,7 @@ wxString CoordinateToString( int aValue, int aInternalUnits, bool aConvertToMils
* the format string must contain the %s format specifier.
* @return The formatted units symbol.
*/
wxString ReturnUnitSymbol( UserUnitType aUnits = g_UserUnit,
wxString ReturnUnitSymbol( EDA_UNITS_T aUnits = g_UserUnit,
const wxString& aFormatString = _( " (%s):" ) );
/**
@ -297,10 +297,10 @@ wxString ReturnUnitSymbol( UserUnitType aUnits = g_UserUnit,
* @param aUnits - The units text to return.
* @return The human readable units string.
*/
wxString GetUnitsLabel( UserUnitType aUnits );
wxString GetAbbreviatedUnitsLabel( UserUnitType aUnit = g_UserUnit );
wxString GetUnitsLabel( EDA_UNITS_T aUnits );
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 );
/**
@ -314,12 +314,12 @@ int ReturnValueFromString( UserUnitType aUnit, const wxString& TextV
* @return a wxString what contains value and optionally the symbol unit (like
* 2.000 mm)
*/
wxString ReturnStringFromValue( UserUnitType aUnit,
wxString ReturnStringFromValue( EDA_UNITS_T aUnit,
int aValue,
int aInternal_Unit,
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.
* Used in dialog boxes for entering values depending on selected units */
@ -343,11 +343,11 @@ wxArrayString* wxStringSplit( wxString txt, wxChar splitter );
* @param val : double : the given value
* @param internal_unit_value = internal units per inch
*/
double To_User_Unit( UserUnitType aUnit,
double To_User_Unit( EDA_UNITS_T aUnit,
double val,
int internal_unit_value );
int From_User_Unit( UserUnitType aUnit,
int From_User_Unit( EDA_UNITS_T aUnit,
double val,
int internal_unit_value );
wxString GenDate();

View File

@ -1,20 +1,20 @@
// 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_
#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
* about the selected item.
*/
class WinEDAListBox : public wxDialog
class EDA_LIST_DIALOG : public wxDialog
{
private:
wxListBox* m_listBox;
@ -24,18 +24,18 @@ private:
public:
/**
* Constructor:
* @param aParent = apointeur to the parent window
* @param aTitle = the title shown on top.
* @param aItemList = a wxArrayStrin: the list of elements.
* @param aRefText = an item name if an item must be preselected.
* @param aParent Pointer to the parent window.
* @param aTitle The title shown on top.
* @param aItemList A wxArrayString of the list of elements.
* @param aRefText An item name if an item must be preselected.
* @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,
const wxArrayString& aItemList, const wxString& aRefText,
void(* aCallBackFunction)(wxString& Text) = NULL,
wxPoint aPos = wxDefaultPosition );
~WinEDAListBox();
EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
const wxArrayString& aItemList, const wxString& aRefText,
void(* aCallBackFunction)(wxString& Text) = NULL,
wxPoint aPos = wxDefaultPosition );
~EDA_LIST_DIALOG();
void SortList();
void Append( const wxString& aItemStr );
@ -55,50 +55,14 @@ private:
};
/************************************************/
/* Class to enter a line, is some dialog frames */
/************************************************/
class WinEDA_EnterText
/**
* Class EDA_GRAPHIC_TEXT_CTRL
* is a custom text edit control to edit/enter Kicad dimensions ( INCHES or MM )
*/
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:
UserUnitType m_UserUnit;
EDA_UNITS_T m_UserUnit;
int m_Internal_Unit;
wxTextCtrl* m_FrameText;
@ -107,12 +71,12 @@ private:
wxStaticText* m_Title;
public:
WinEDA_GraphicTextCtrl( wxWindow* parent, const wxString& Title,
const wxString& TextToEdit, int textsize,
UserUnitType user_unit, wxBoxSizer* BoxSizer, int framelen = 200,
int internal_unit = EESCHEMA_INTERNAL_UNIT );
EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent, const wxString& Title,
const wxString& TextToEdit, int textsize,
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer, int framelen = 200,
int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_GraphicTextCtrl();
~EDA_GRAPHIC_TEXT_CTRL();
wxString GetText();
int GetTextSize();
@ -127,10 +91,10 @@ public:
* Function FormatSize
* 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,
UserUnitType user_unit );
EDA_UNITS_T user_unit );
};
@ -138,10 +102,10 @@ public:
/* Class to edit/enter a coordinate (pair of values) ( INCHES or MM ) in */
/* dialog boxes, */
/**************************************************************************/
class WinEDA_PositionCtrl
class EDA_POSITION_CTRL
{
public:
UserUnitType m_UserUnit;
EDA_UNITS_T m_UserUnit;
int m_Internal_Unit;
wxPoint m_Pos_To_Edit;
@ -151,12 +115,12 @@ private:
wxStaticText* m_TextX, * m_TextY;
public:
WinEDA_PositionCtrl( wxWindow* parent, const wxString& title,
EDA_POSITION_CTRL( wxWindow* parent, const wxString& title,
const wxPoint& pos_to_edit,
UserUnitType user_unit, wxBoxSizer* BoxSizer,
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_PositionCtrl();
~EDA_POSITION_CTRL();
void Enable( bool x_win_on, bool y_win_on );
void SetValue( int x_value, int y_value );
@ -168,15 +132,15 @@ public:
* Class to edit/enter a size (pair of values for X and Y size)
* ( INCHES or MM ) in dialog boxes
***************************************************************/
class WinEDA_SizeCtrl : public WinEDA_PositionCtrl
class EDA_SIZE_CTRL : public EDA_POSITION_CTRL
{
public:
WinEDA_SizeCtrl( wxWindow* parent, const wxString& title,
const wxSize& size_to_edit,
UserUnitType user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT );
EDA_SIZE_CTRL( wxWindow* parent, const wxString& title,
const wxSize& size_to_edit,
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_SizeCtrl() { }
~EDA_SIZE_CTRL() { }
wxSize GetValue();
};
@ -184,10 +148,10 @@ public:
/****************************************************************/
/* Class to edit/enter a value ( INCHES or MM ) in dialog boxes */
/****************************************************************/
class WinEDA_ValueCtrl
class EDA_VALUE_CTRL
{
public:
UserUnitType m_UserUnit;
EDA_UNITS_T m_UserUnit;
int m_Value;
wxTextCtrl* m_ValueCtrl;
private:
@ -195,11 +159,11 @@ private:
wxStaticText* m_Text;
public:
WinEDA_ValueCtrl( wxWindow* parent, const wxString& title, int value,
UserUnitType user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT );
EDA_VALUE_CTRL( wxWindow* parent, const wxString& title, int value,
EDA_UNITS_T user_unit, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_ValueCtrl();
~EDA_VALUE_CTRL();
int GetValue();
void SetValue( int new_value );
@ -212,4 +176,4 @@ public:
};
#endif
#endif // _DIALOG_HELPERS_H_

View File

@ -13,7 +13,7 @@
/* Forward class declarations. */
class WinEDAListBox;
class EDA_LIST_DIALOG;
/**
@ -54,7 +54,7 @@ wxString MakeReducedFileName( const wxString& fullfilename,
const wxString& default_path,
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,

View File

@ -57,7 +57,7 @@ public:
int m_DisplayModText; // How to display module texts (line/ filled / sketch)
bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode,
* TRUE = filled */
UserUnitType m_UserGridUnit;
EDA_UNITS_T m_UserGridUnit;
wxRealPoint m_UserGridSize;
EDA_3D_FRAME* m_Draw3DFrame;

View File

@ -476,7 +476,7 @@ void PCB_BASE_FRAME::LoadSettings()
long itmp;
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 + DisplayViaFillEntry, &m_DisplayViaFill, true );
cfg->Read( m_FrameName + DisplayPadNumberEntry, &m_DisplayPadNum, true );

View File

@ -69,12 +69,13 @@ void Dialog_GeneralOptions::OnCancelClick( wxCommandEvent& event )
void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
{
UserUnitType ii;
EDA_UNITS_T ii;
DisplayOpt.DisplayPolarCood =
( m_PolarDisplay->GetSelection() == 0 ) ? false : true;
ii = g_UserUnit;
g_UserUnit = ( m_UnitsSelection->GetSelection() == 0 ) ? INCHES : MILLIMETRES;
if( ii != g_UserUnit )
m_Parent->ReCreateAuxiliaryToolbar();
@ -84,11 +85,13 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
/* Updating the combobox to display the active layer. */
g_MaxLinksShowed = m_MaxShowLinks->GetValue();
Drc_On = m_DrcOn->GetValue();
if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() )
{
m_Parent->SetElementVisibility(RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() );
m_Parent->DrawPanel->Refresh( );
}
g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue();
g_AutoDeleteOldTrack = m_TrackAutodel->GetValue();
Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue();

View File

@ -1,6 +1,7 @@
/*****************************************/
/* Edition du pcb: Gestion des dimensions */
/*****************************************/
/**
* @file dimension.cpp
* @brief Dialog and code for editing a deminsion object.
*/
#include "fctsys.h"
#include "confirm.h"
@ -11,7 +12,7 @@
#include "drawtxt.h"
#include "dialog_helpers.h"
/* Loca functions */
/* Local functions */
static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase );
@ -33,22 +34,22 @@ static int status_dimension; /* Used in cimension creation:
*/
/************************************/
/*********************************/
/* class DIMENSION_EDITOR_DIALOG */
/************************************/
/*********************************/
class DIMENSION_EDITOR_DIALOG : public wxDialog
{
private:
PCB_EDIT_FRAME* m_Parent;
wxDC* m_DC;
DIMENSION* CurrentDimension;
WinEDA_EnterText* m_Name;
WinEDA_SizeCtrl* m_TxtSizeCtrl;
WinEDA_ValueCtrl* m_TxtWidthCtrl;
wxRadioBox* m_Mirror;
wxComboBox* m_SelLayerBox;
PCB_EDIT_FRAME* m_Parent;
wxDC* m_DC;
DIMENSION* CurrentDimension;
wxTextCtrl* m_Name;
EDA_SIZE_CTRL* m_TxtSizeCtrl;
EDA_VALUE_CTRL* m_TxtWidthCtrl;
wxRadioBox* m_Mirror;
wxComboBox* m_SelLayerBox;
public:
@ -103,22 +104,33 @@ DIMENSION_EDITOR_DIALOG::DIMENSION_EDITOR_DIALOG( PCB_EDIT_FRAME* parent,
m_Mirror = new wxRadioBox( this, -1, _( "Display" ),
wxDefaultPosition, wxSize( -1, -1 ), 2, display_msg,
1, wxRA_SPECIFY_COLS );
if( Dimension->m_Text->m_Mirror )
m_Mirror->SetSelection( 1 );
RightBoxSizer->Add( m_Mirror, 0, wxGROW | wxALL, 5 );
m_Name = new WinEDA_EnterText( this, wxT( "Text:" ),
Dimension->m_Text->m_Text,
LeftBoxSizer, wxSize( 200, -1 ) );
LeftBoxSizer->Add( new wxStaticText( this, -1, _( "Text:" ) ),
0, wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
m_TxtSizeCtrl = new WinEDA_SizeCtrl( this, _( "Size" ),
Dimension->m_Text->m_Size,
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 EDA_SIZE_CTRL( this, _( "Size" ),
Dimension->m_Text->m_Size,
g_UserUnit, LeftBoxSizer, m_Parent->m_InternalUnits );
m_TxtWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ),
Dimension->m_Width,
g_UserUnit, LeftBoxSizer, m_Parent->m_InternalUnits );
m_TxtWidthCtrl = new WinEDA_ValueCtrl( this, _( "Width" ),
Dimension->m_Width,
g_UserUnit, LeftBoxSizer, m_Parent->m_InternalUnits );
wxStaticText* text = new wxStaticText( this, -1, _( "Layer:" ) );
LeftBoxSizer->Add( text, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
m_SelLayerBox = new wxComboBox( this, wxID_ANY, wxEmptyString,
@ -138,24 +150,21 @@ DIMENSION_EDITOR_DIALOG::DIMENSION_EDITOR_DIALOG( PCB_EDIT_FRAME* parent,
}
/**********************************************************************/
void DIMENSION_EDITOR_DIALOG::OnCancelClick( wxCommandEvent& event )
/**********************************************************************/
{
EndModal( -1 );
}
/***********************************************************************************/
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 );
}
m_Parent->SaveCopyInUndoList(CurrentDimension, UR_CHANGED);
if( m_Name->GetValue() != wxEmptyString )
{
CurrentDimension->SetText( m_Name->GetValue() );
@ -165,12 +174,14 @@ void DIMENSION_EDITOR_DIALOG::OnOkClick( wxCommandEvent& event )
int width = m_TxtWidthCtrl->GetValue();
int maxthickness = Clamp_Text_PenSize( width, CurrentDimension->m_Text->m_Size );
if( width > maxthickness )
{
DisplayError( NULL,
_( "The text thickness is too large for the text size. It will be clamped") );
width = maxthickness;
}
CurrentDimension->m_Text->m_Thickness = CurrentDimension->m_Width = width ;
CurrentDimension->m_Text->m_Mirror = ( m_Mirror->GetSelection() == 1 ) ? true : false;
@ -179,9 +190,8 @@ void DIMENSION_EDITOR_DIALOG::OnOkClick( wxCommandEvent& event )
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 );
}
@ -190,9 +200,7 @@ void DIMENSION_EDITOR_DIALOG::OnOkClick( wxCommandEvent& event )
}
/**************************************************************/
static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC )
/**************************************************************/
{
DIMENSION* Dimension = (DIMENSION*) Panel->GetScreen()->GetCurItem();
@ -214,9 +222,7 @@ static void Exit_EditDimension( EDA_DRAW_PANEL* Panel, wxDC* DC )
}
/*************************************************************************/
DIMENSION* PCB_EDIT_FRAME::Begin_Dimension( DIMENSION* Dimension, wxDC* DC )
/*************************************************************************/
{
wxPoint pos;
@ -254,10 +260,12 @@ DIMENSION* PCB_EDIT_FRAME::Begin_Dimension( DIMENSION* Dimension, wxDC* DC )
Dimension->m_Text->m_Size = GetBoard()->GetBoardDesignSettings()->m_PcbTextSize;
int width = GetBoard()->GetBoardDesignSettings()->m_PcbTextWidth;
int maxthickness = Clamp_Text_PenSize(width, Dimension->m_Text->m_Size );
if( width > maxthickness )
{
width = maxthickness;
}
Dimension->m_Text->m_Thickness = Dimension->m_Width = width ;
Dimension->AdjustDimensionDetails( );
@ -324,8 +332,7 @@ static void Montre_Position_New_Dimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
deltax = Dimension->TraitD_ox - Dimension->TraitG_ox;
deltay = Dimension->TraitD_oy - Dimension->TraitG_oy;
/* Calcul de la direction de deplacement
* ( perpendiculaire a l'axe de la cote ) */
/* Calculating the direction of travel perpendicular to the selected axis. */
angle = atan2( (double)deltay, (double)deltax ) + (M_PI / 2);
deltax = pos.x - Dimension->TraitD_ox;
@ -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 )
/***************************************************************/
{
if( Dimension == NULL )
return;
@ -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 )
/*******************************************************************/
{
if( Dimension == NULL )
return;
@ -372,4 +375,3 @@ void PCB_EDIT_FRAME::Delete_Dimension( DIMENSION* Dimension, wxDC* DC )
Dimension->UnLink();
OnModify();
}

View File

@ -694,7 +694,7 @@ void FOOTPRINT_EDIT_FRAME::Select_Active_Library()
if( g_LibName_List.GetCount() == 0 )
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 )
return;

View File

@ -357,8 +357,8 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow,
if( footprint_names_list.GetCount() )
{
msg.Printf( _( "Modules [%d items]" ), footprint_names_list.GetCount() );
WinEDAListBox dlg( aWindow, msg, footprint_names_list, OldName,
DisplayCmpDoc, GetComponentDialogPosition() );
EDA_LIST_DIALOG dlg( aWindow, msg, footprint_names_list, OldName,
DisplayCmpDoc, GetComponentDialogPosition() );
if( dlg.ShowModal() == wxID_OK )
CmpName = dlg.GetTextSelection();
@ -411,7 +411,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Select_1_Module_From_BOARD( BOARD* aPcb )
msg.Printf( _( "Modules [%d items]" ), listnames.GetCount() );
WinEDAListBox dlg( this, msg, listnames, wxEmptyString );
EDA_LIST_DIALOG dlg( this, msg, listnames, wxEmptyString );
dlg.SortList();
if( dlg.ShowModal() == wxID_OK )

View File

@ -39,8 +39,8 @@ private:
PCB_EDIT_FRAME* m_Parent;
wxDC* m_DC;
MIREPCB* m_MirePcb;
WinEDA_ValueCtrl* m_MireWidthCtrl;
WinEDA_ValueCtrl* m_MireSizeCtrl;
EDA_VALUE_CTRL* m_MireWidthCtrl;
EDA_VALUE_CTRL* m_MireSizeCtrl;
wxRadioBox* m_MireShape;
public:
@ -99,16 +99,16 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
// Size:
m_MireSizeCtrl = new WinEDA_ValueCtrl( this, _( "Size" ),
m_MirePcb->m_Size,
g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits );
m_MireSizeCtrl = new EDA_VALUE_CTRL( this, _( "Size" ),
m_MirePcb->m_Size,
g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits );
// Width:
m_MireWidthCtrl = new WinEDA_ValueCtrl( this, _( "Width" ),
m_MirePcb->m_Width,
g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits );
m_MireWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ),
m_MirePcb->m_Width,
g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits );
// Shape
wxString shape_list[2] = { _( "shape +" ), _( "shape X" ) };

View File

@ -724,7 +724,7 @@ class WinEDA_SetParamShapeFrame : public wxDialog
private:
PCB_EDIT_FRAME* m_Parent;
wxRadioBox* m_ShapeOptionCtrl;
WinEDA_SizeCtrl* m_SizeCtrl;
EDA_SIZE_CTRL* m_SizeCtrl;
public: WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent, const wxPoint& pos );
~WinEDA_SetParamShapeFrame() { };
@ -740,12 +740,12 @@ private:
BEGIN_EVENT_TABLE( WinEDA_SetParamShapeFrame, wxDialog )
EVT_BUTTON( wxID_OK, WinEDA_SetParamShapeFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_SetParamShapeFrame::OnCancelClick )
EVT_BUTTON( ID_READ_SHAPE_FILE,
WinEDA_SetParamShapeFrame::ReadDataShapeDescr )
EVT_BUTTON( wxID_OK, WinEDA_SetParamShapeFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_SetParamShapeFrame::OnCancelClick )
EVT_BUTTON( ID_READ_SHAPE_FILE, WinEDA_SetParamShapeFrame::ReadDataShapeDescr )
END_EVENT_TABLE()
WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent,
const wxPoint& framepos ) :
wxDialog( parent, -1, _( "Complex shape" ), framepos, wxSize( 350, 280 ),
@ -755,6 +755,7 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent,
if( PolyEdges )
free( PolyEdges );
PolyEdges = NULL;
PolyEdgesCount = 0;
@ -787,9 +788,9 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent,
wxRA_SPECIFY_COLS );
LeftBoxSizer->Add( m_ShapeOptionCtrl, 0, wxGROW | wxALL, 5 );
m_SizeCtrl = new WinEDA_SizeCtrl( this, _( "Size" ), ShapeSize,
g_UserUnit, LeftBoxSizer,
PCB_INTERNAL_UNIT );
m_SizeCtrl = new EDA_SIZE_CTRL( this, _( "Size" ), ShapeSize,
g_UserUnit, LeftBoxSizer,
PCB_INTERNAL_UNIT );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );

View File

@ -729,13 +729,14 @@ MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName( void )
for( ; Module != NULL; Module = (MODULE*) Module->Next() )
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 )
return NULL;
wxString ref = dlg.GetTextSelection();
Module = (MODULE*) GetBoard()->m_Modules;
for( ; Module != NULL; Module = Module->Next() )
{
if( Module->m_Reference->m_Text == ref )

View File

@ -48,7 +48,7 @@ void PCB_BASE_FRAME::InstallGridFrame( const wxPoint& pos )
return;
m_UserGridSize = dlg.GetGridSize();
m_UserGridUnit = (UserUnitType) dlg.GetGridUnits();
m_UserGridUnit = (EDA_UNITS_T) dlg.GetGridUnits();
GetScreen()->m_GridOrigin = dlg.GetGridOrigin();
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );