2007-05-06 16:03:28 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dialog_edit_label.cpp
|
|
|
|
// Author: jean-pierre Charras
|
2008-03-20 01:50:21 +00:00
|
|
|
// Modified by:
|
2008-12-19 20:40:08 +00:00
|
|
|
// Created: 18/12/2008 15:46:26
|
|
|
|
// Licence: GPL
|
2007-05-06 16:03:28 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-12-19 20:40:08 +00:00
|
|
|
#include "fctsys.h"
|
|
|
|
#include "wx/valgen.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-12-19 20:40:08 +00:00
|
|
|
#include "common.h"
|
|
|
|
#include "program.h"
|
|
|
|
#include "libcmp.h"
|
|
|
|
#include "general.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "dialog_edit_label.h"
|
|
|
|
|
2008-12-19 20:40:08 +00:00
|
|
|
DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText)
|
|
|
|
: DialogLabelEditor_Base ( parent )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2008-12-19 20:40:08 +00:00
|
|
|
m_Parent = parent;
|
|
|
|
m_CurrentText= CurrentText;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2008-12-19 20:40:08 +00:00
|
|
|
void DialogLabelEditor::OnInitDialog( wxInitDialogEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
wxString msg;
|
2008-03-20 01:50:21 +00:00
|
|
|
|
2008-12-20 17:28:25 +00:00
|
|
|
SetFont(*g_DialogFont);
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
m_TextLabel->SetValue(m_CurrentText->m_Text);
|
|
|
|
m_TextLabel->SetFocus();
|
2008-12-19 20:40:08 +00:00
|
|
|
|
|
|
|
// Set validators
|
|
|
|
m_TextOrient->SetSelection( m_CurrentText->m_Orient );
|
|
|
|
m_TextShape->SetSelection( m_CurrentText->m_Shape );
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
switch( m_CurrentText->Type() )
|
|
|
|
{
|
|
|
|
case TYPE_SCH_GLOBALLABEL:
|
|
|
|
SetTitle(_("Global Label properties"));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TYPE_SCH_HIERLABEL:
|
|
|
|
SetTitle(_("Hierarchal Label properties"));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TYPE_SCH_LABEL:
|
|
|
|
SetTitle(_("Label properties"));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
SetTitle(_("Text properties"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-12-19 20:40:08 +00:00
|
|
|
int style = 0;
|
|
|
|
if ( m_CurrentText->m_Italic )
|
|
|
|
style = 1;
|
|
|
|
if ( m_CurrentText->m_Width > 1 )
|
|
|
|
style += 2;
|
|
|
|
m_TextStyle->SetSelection(style);
|
2008-03-20 01:50:21 +00:00
|
|
|
|
|
|
|
msg = m_SizeTitle->GetLabel() + ReturnUnitSymbol();
|
|
|
|
m_SizeTitle->SetLabel(msg);
|
|
|
|
|
|
|
|
msg = ReturnStringFromValue(g_UnitMetric, m_CurrentText->m_Size.x, m_Parent->m_InternalUnits);
|
|
|
|
m_TextSize->SetValue(msg);
|
2008-12-20 17:28:25 +00:00
|
|
|
|
2008-12-19 20:40:08 +00:00
|
|
|
if (m_CurrentText->Type() != TYPE_SCH_GLOBALLABEL &&
|
|
|
|
m_CurrentText->Type() != TYPE_SCH_HIERLABEL)
|
|
|
|
m_TextShape->Show(false);
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2008-04-30 11:52:34 +00:00
|
|
|
if (GetSizer())
|
|
|
|
{
|
|
|
|
GetSizer()->SetSizeHints(this);
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
/*!
|
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
|
|
|
|
*/
|
|
|
|
|
2008-12-19 20:40:08 +00:00
|
|
|
void DialogLabelEditor::OnButtonOKClick( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
|
|
|
TextPropertiesAccept(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
2007-11-07 04:24:25 +00:00
|
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
|
2007-05-06 16:03:28 +00:00
|
|
|
*/
|
|
|
|
|
2008-12-19 20:40:08 +00:00
|
|
|
void DialogLabelEditor::OnButtonCANCEL_Click( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-11-07 04:24:25 +00:00
|
|
|
m_Parent->DrawPanel->MouseToCursorSchema();
|
|
|
|
EndModal( -1 );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|