2009-11-23 15:16:50 +00:00
|
|
|
/***************/
|
|
|
|
/* wxwineda.cpp */
|
|
|
|
/****************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "wxstruct.h"
|
2010-11-18 21:16:28 +00:00
|
|
|
#include "dialog_helpers.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/*
|
|
|
|
* Text entry dialog to enter one or more lines of text.
|
|
|
|
*/
|
2008-11-26 00:20:16 +00:00
|
|
|
WinEDA_EnterText::WinEDA_EnterText( wxWindow* parent,
|
|
|
|
const wxString& Title,
|
|
|
|
const wxString& TextToEdit,
|
|
|
|
wxBoxSizer* BoxSizer,
|
2009-04-28 19:34:42 +00:00
|
|
|
const wxSize& Size, bool Multiline )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
m_Modify = FALSE;
|
2009-04-13 05:58:11 +00:00
|
|
|
if( ! TextToEdit.IsEmpty() )
|
2008-11-26 00:20:16 +00:00
|
|
|
m_NewText = TextToEdit;
|
|
|
|
|
2009-02-04 15:25:03 +00:00
|
|
|
m_Title = new wxStaticText( parent, -1, Title );
|
2008-11-26 00:20:16 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
BoxSizer->Add( m_Title, 0,
|
|
|
|
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-04-28 19:34:42 +00:00
|
|
|
long style = 0;
|
2009-06-01 18:28:34 +00:00
|
|
|
|
2009-04-28 19:34:42 +00:00
|
|
|
if (Multiline)
|
|
|
|
style = wxTE_MULTILINE;
|
2009-06-01 18:28:34 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
m_FrameText = new wxTextCtrl( parent, -1, TextToEdit, wxDefaultPosition,
|
|
|
|
Size,style );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
m_FrameText->SetInsertionPoint( 1 );
|
|
|
|
BoxSizer->Add( m_FrameText,
|
2009-11-23 15:16:50 +00:00
|
|
|
0,
|
|
|
|
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
|
|
|
|
5 );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
wxString WinEDA_EnterText::GetValue()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
m_Modify = m_FrameText->IsModified();
|
|
|
|
m_NewText = m_FrameText->GetValue();
|
|
|
|
return m_NewText;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
void WinEDA_EnterText::GetValue( char* buffer, int lenmax )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
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;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
void WinEDA_EnterText::SetValue( const wxString& new_text )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
m_FrameText->SetValue( new_text );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
void WinEDA_EnterText::Enable( bool enbl )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
m_Title->Enable( enbl );
|
|
|
|
m_FrameText->Enable( enbl );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/*******************************************************/
|
|
|
|
/* Class to edit a graphic + text size in INCHES or MM */
|
|
|
|
/*******************************************************/
|
|
|
|
WinEDA_GraphicTextCtrl::WinEDA_GraphicTextCtrl( wxWindow* parent,
|
2008-11-26 00:20:16 +00:00
|
|
|
const wxString& Title,
|
2009-11-23 15:16:50 +00:00
|
|
|
const wxString& TextToEdit,
|
|
|
|
int textsize,
|
2010-07-12 14:07:09 +00:00
|
|
|
UserUnitType user_unit,
|
2009-11-23 15:16:50 +00:00
|
|
|
wxBoxSizer* BoxSizer,
|
|
|
|
int framelen,
|
|
|
|
int internal_unit )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-07-12 14:07:09 +00:00
|
|
|
m_UserUnit = user_unit;
|
2008-11-26 00:20:16 +00:00
|
|
|
m_Internal_Unit = internal_unit;
|
|
|
|
m_Title = NULL;
|
|
|
|
|
|
|
|
m_Title = new wxStaticText( parent, -1, Title );
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
BoxSizer->Add( m_Title, 0,
|
|
|
|
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
m_FrameText = new wxTextCtrl( parent, -1, TextToEdit );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
BoxSizer->Add( m_FrameText, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
if( !Title.IsEmpty() )
|
|
|
|
{
|
2010-07-12 14:07:09 +00:00
|
|
|
wxString msg = _( "Size" ) + ReturnUnitSymbol( m_UserUnit );
|
2008-11-26 00:20:16 +00:00
|
|
|
wxStaticText* text = new wxStaticText( parent, -1, msg );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
BoxSizer->Add( text, 0,
|
|
|
|
wxGROW | wxLEFT | wxRIGHT | wxADJUST_MINSIZE, 5 );
|
2008-11-26 00:20:16 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
wxString value = FormatSize( m_Internal_Unit, m_UserUnit, textsize );
|
2008-11-26 00:20:16 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
m_FrameSize = new wxTextCtrl( parent, -1, value, wxDefaultPosition,
|
|
|
|
wxSize( 70, -1 ) );
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
BoxSizer->Add( m_FrameSize, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
WinEDA_GraphicTextCtrl::~WinEDA_GraphicTextCtrl()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
/* no, these are deleted by the BoxSizer
|
|
|
|
delete m_FrameText;
|
|
|
|
delete m_Title;
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
wxString WinEDA_GraphicTextCtrl::FormatSize( int internalUnit, UserUnitType aUnit,
|
2009-11-23 15:16:50 +00:00
|
|
|
int textSize )
|
2008-11-26 00:20:16 +00:00
|
|
|
{
|
|
|
|
wxString value;
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
// Limiting the size of the text of reasonable values.
|
2008-11-26 00:20:16 +00:00
|
|
|
if( textSize < 10 )
|
|
|
|
textSize = 10;
|
|
|
|
|
|
|
|
if( textSize > 3000 )
|
|
|
|
textSize = 3000;
|
|
|
|
|
|
|
|
value.Printf( ( internalUnit > 1000 ) ? wxT( "%.4f" ) : wxT( "%.3f" ),
|
2010-07-12 14:07:09 +00:00
|
|
|
To_User_Unit( aUnit, textSize, internalUnit ) );
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
return value;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
void WinEDA_GraphicTextCtrl::SetTitle( const wxString& title )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
m_Title->SetLabel( title );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
void WinEDA_GraphicTextCtrl::SetValue( const wxString& value )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
m_FrameText->SetValue( value );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
void WinEDA_GraphicTextCtrl::SetValue( int textSize )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-07-12 14:07:09 +00:00
|
|
|
wxString value = FormatSize( m_Internal_Unit, m_UserUnit, textSize );
|
2008-11-26 00:20:16 +00:00
|
|
|
m_FrameSize->SetValue( value );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
wxString WinEDA_GraphicTextCtrl::GetText()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
wxString text = m_FrameText->GetValue();
|
|
|
|
return text;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
int WinEDA_GraphicTextCtrl::ParseSize( const wxString& sizeText,
|
2010-07-12 14:07:09 +00:00
|
|
|
int internalUnit, UserUnitType aUnit )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
int textsize;
|
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
textsize = ReturnValueFromString( aUnit, sizeText, internalUnit );
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
// Limit to reasonable size
|
|
|
|
if( textsize < 10 )
|
|
|
|
textsize = 10;
|
|
|
|
|
|
|
|
if( textsize > 3000 )
|
|
|
|
textsize = 3000;
|
|
|
|
|
|
|
|
return textsize;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
int WinEDA_GraphicTextCtrl::GetTextSize()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-07-12 14:07:09 +00:00
|
|
|
return ParseSize( m_FrameSize->GetValue(), m_Internal_Unit, m_UserUnit );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
void WinEDA_GraphicTextCtrl::Enable( bool state )
|
|
|
|
{
|
|
|
|
m_FrameText->Enable( state );
|
|
|
|
}
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/********************************************************/
|
|
|
|
/* Class to display and edit a coordinated INCHES or MM */
|
|
|
|
/********************************************************/
|
|
|
|
WinEDA_PositionCtrl::WinEDA_PositionCtrl( wxWindow* parent,
|
2008-11-26 00:20:16 +00:00
|
|
|
const wxString& title,
|
2009-11-23 15:16:50 +00:00
|
|
|
const wxPoint& pos_to_edit,
|
2010-07-12 14:07:09 +00:00
|
|
|
UserUnitType user_unit,
|
2009-11-23 15:16:50 +00:00
|
|
|
wxBoxSizer* BoxSizer,
|
|
|
|
int internal_unit )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
wxString text;
|
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
m_UserUnit = user_unit;
|
2008-11-26 00:20:16 +00:00
|
|
|
m_Internal_Unit = internal_unit;
|
|
|
|
if( title.IsEmpty() )
|
|
|
|
text = _( "Pos " );
|
|
|
|
else
|
|
|
|
text = title;
|
2010-07-12 14:07:09 +00:00
|
|
|
text += _( "X" ) + ReturnUnitSymbol( m_UserUnit );
|
2009-11-23 15:16:50 +00:00
|
|
|
m_TextX = new wxStaticText( parent, -1, text );
|
2008-11-26 00:20:16 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
BoxSizer->Add( m_TextX, 0,
|
|
|
|
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
|
|
|
|
m_FramePosX = new wxTextCtrl( parent, -1, wxEmptyString,
|
|
|
|
wxDefaultPosition );
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
BoxSizer->Add( m_FramePosX, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
if( title.IsEmpty() )
|
|
|
|
text = _( "Pos " );
|
|
|
|
else
|
|
|
|
text = title;
|
2010-07-12 14:07:09 +00:00
|
|
|
text += _( "Y" ) + ReturnUnitSymbol( m_UserUnit );
|
2009-11-23 15:16:50 +00:00
|
|
|
m_TextY = new wxStaticText( parent, -1, text );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
BoxSizer->Add( m_TextY, 0,
|
|
|
|
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
m_FramePosY = new wxTextCtrl( parent, -1, wxEmptyString );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
BoxSizer->Add( m_FramePosY, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
|
|
|
|
|
|
|
SetValue( pos_to_edit.x, pos_to_edit.y );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
WinEDA_PositionCtrl::~WinEDA_PositionCtrl()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
delete m_TextX;
|
|
|
|
delete m_TextY;
|
|
|
|
delete m_FramePosX;
|
|
|
|
delete m_FramePosY;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/* Returns (in internal units) to coordinate between (in user units)
|
2008-11-26 00:20:16 +00:00
|
|
|
*/
|
2009-11-23 15:16:50 +00:00
|
|
|
wxPoint WinEDA_PositionCtrl::GetValue()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
wxPoint coord;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
coord.x = ReturnValueFromString( m_UserUnit, m_FramePosX->GetValue(), m_Internal_Unit );
|
|
|
|
coord.y = ReturnValueFromString( m_UserUnit, m_FramePosY->GetValue(), m_Internal_Unit );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
return coord;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
void WinEDA_PositionCtrl::Enable( bool x_win_on, bool y_win_on )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
m_FramePosX->Enable( x_win_on );
|
|
|
|
m_FramePosY->Enable( y_win_on );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
void WinEDA_PositionCtrl::SetValue( int x_value, int y_value )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
m_Pos_To_Edit.x = x_value;
|
|
|
|
m_Pos_To_Edit.y = y_value;
|
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
msg = ReturnStringFromValue( m_UserUnit, m_Pos_To_Edit.x, m_Internal_Unit );
|
2008-11-26 00:20:16 +00:00
|
|
|
m_FramePosX->Clear();
|
|
|
|
m_FramePosX->SetValue( msg );
|
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
msg = ReturnStringFromValue( m_UserUnit, m_Pos_To_Edit.y, m_Internal_Unit );
|
2008-11-26 00:20:16 +00:00
|
|
|
m_FramePosY->Clear();
|
|
|
|
m_FramePosY->SetValue( msg );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************/
|
|
|
|
/* WinEDA_SizeCtrl */
|
|
|
|
/*******************/
|
|
|
|
WinEDA_SizeCtrl::WinEDA_SizeCtrl( wxWindow* parent, const wxString& title,
|
|
|
|
const wxSize& size_to_edit,
|
2010-07-12 14:07:09 +00:00
|
|
|
UserUnitType aUnit, wxBoxSizer* BoxSizer,
|
2008-11-26 00:20:16 +00:00
|
|
|
int internal_unit ) :
|
|
|
|
WinEDA_PositionCtrl( parent, title,
|
|
|
|
wxPoint( size_to_edit.x, size_to_edit.y ),
|
2010-07-12 14:07:09 +00:00
|
|
|
aUnit, BoxSizer, internal_unit )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
wxSize WinEDA_SizeCtrl::GetValue()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
wxPoint pos = WinEDA_PositionCtrl::GetValue();
|
|
|
|
wxSize size;
|
|
|
|
|
|
|
|
size.x = pos.x;
|
|
|
|
size.y = pos.y;
|
|
|
|
return size;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
/**************************************************************/
|
|
|
|
/* Class to display and edit a dimension INCHES, MM, or other */
|
|
|
|
/**************************************************************/
|
2008-11-26 00:20:16 +00:00
|
|
|
WinEDA_ValueCtrl::WinEDA_ValueCtrl( wxWindow* parent, const wxString& title,
|
2010-07-12 14:07:09 +00:00
|
|
|
int value, UserUnitType user_unit, wxBoxSizer* BoxSizer,
|
2008-11-26 00:20:16 +00:00
|
|
|
int internal_unit )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
wxString label = title;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
m_UserUnit = user_unit;
|
2008-11-26 00:20:16 +00:00
|
|
|
m_Internal_Unit = internal_unit;
|
|
|
|
m_Value = value;
|
2010-07-12 14:07:09 +00:00
|
|
|
label += ReturnUnitSymbol( m_UserUnit );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
m_Text = new wxStaticText( parent, -1, label );
|
2008-11-26 00:20:16 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
BoxSizer->Add( m_Text, 0,
|
|
|
|
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 );
|
2008-11-26 00:20:16 +00:00
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
wxString stringvalue = ReturnStringFromValue( m_UserUnit, m_Value,
|
2009-11-23 15:16:50 +00:00
|
|
|
m_Internal_Unit );
|
2008-11-26 00:20:16 +00:00
|
|
|
m_ValueCtrl = new wxTextCtrl( parent, -1, stringvalue );
|
|
|
|
|
|
|
|
BoxSizer->Add( m_ValueCtrl,
|
2009-11-23 15:16:50 +00:00
|
|
|
0,
|
|
|
|
wxGROW | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM,
|
|
|
|
5 );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
WinEDA_ValueCtrl::~WinEDA_ValueCtrl()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
delete m_ValueCtrl;
|
|
|
|
delete m_Text;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
2007-09-13 11:55:46 +00:00
|
|
|
int WinEDA_ValueCtrl::GetValue()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
int coord;
|
|
|
|
wxString txtvalue = m_ValueCtrl->GetValue();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
coord = ReturnValueFromString( m_UserUnit, txtvalue, m_Internal_Unit );
|
2008-11-26 00:20:16 +00:00
|
|
|
return coord;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
void WinEDA_ValueCtrl::SetValue( int new_value )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
wxString buffer;
|
|
|
|
|
|
|
|
m_Value = new_value;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-07-12 14:07:09 +00:00
|
|
|
buffer = ReturnStringFromValue( m_UserUnit, m_Value, m_Internal_Unit );
|
2008-11-26 00:20:16 +00:00
|
|
|
m_ValueCtrl->SetValue( buffer );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2008-11-26 00:20:16 +00:00
|
|
|
|
|
|
|
void WinEDA_ValueCtrl::Enable( bool enbl )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-11-26 00:20:16 +00:00
|
|
|
m_ValueCtrl->Enable( enbl );
|
|
|
|
m_Text->Enable( enbl );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|