Exterminate another 0.1deg field

This commit is contained in:
Chris Pavlina 2016-04-12 19:18:33 -04:00
parent 95962cd2ba
commit 48573712e8
4 changed files with 39 additions and 66 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2010 Jean-Pierre Charras <jean-pierre.charras@gpisa-lab.inpg.fr>
* Copyright (C) 2010-2015 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2010-2016 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -34,6 +34,7 @@
#include <drawtxt.h>
#include <confirm.h>
#include <base_units.h>
#include <wx/valnum.h>
#include <class_board.h>
#include <class_pcb_text.h>
@ -58,12 +59,11 @@ private:
wxDC* m_DC;
TEXTE_PCB* m_SelectedPCBText;
void MyInit();
wxFloatingPointValidator<double> m_OrientValidator;
double m_OrientValue;
// Handlers for DIALOG_PCB_TEXT_PROPERTIES_BASE events.
void OnClose( wxCloseEvent& event );
void OnCancelClick( wxCommandEvent& event );
void OnOkClick( wxCommandEvent& event );
bool TransferDataToWindow();
bool TransferDataFromWindow();
};
@ -75,14 +75,19 @@ private:
*/
DIALOG_PCB_TEXT_PROPERTIES::DIALOG_PCB_TEXT_PROPERTIES( PCB_EDIT_FRAME* parent,
TEXTE_PCB* passedTextPCB, wxDC* DC )
: DIALOG_PCB_TEXT_PROPERTIES_BASE( parent )
TEXTE_PCB* passedTextPCB, wxDC* DC ) :
DIALOG_PCB_TEXT_PROPERTIES_BASE( parent ),
m_OrientValidator( 1, &m_OrientValue )
{
m_Parent = parent;
m_DC = DC;
m_SelectedPCBText = passedTextPCB;
MyInit();
m_OrientValue = 0.0;
m_OrientValidator.SetRange( -360.0, 360.0 );
m_OrientCtrl->SetValidator( m_OrientValidator );
m_OrientValidator.SetWindow( m_OrientCtrl );
m_StandardSizerOK->SetDefault();
GetSizer()->SetSizeHints( this );
Centre();
@ -108,7 +113,7 @@ void PCB_EDIT_FRAME::InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC )
}
void DIALOG_PCB_TEXT_PROPERTIES::MyInit()
bool DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow()
{
// Put units symbols to text labels where appropriate
AddUnitSymbol( *m_SizeXLabel );
@ -135,9 +140,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit()
m_LayerSelectionCtrl->Resync();
m_LayerSelectionCtrl->SetLayerSelection( m_SelectedPCBText->GetLayer() );
wxString orientationStr;
orientationStr << m_SelectedPCBText->GetOrientation();
m_OrientationCtrl->SetValue( orientationStr );
m_OrientValue = m_SelectedPCBText->GetOrientation() / 10.0;
if( m_SelectedPCBText->IsMirrored() )
m_DisplayCtrl->SetSelection( 1 );
@ -159,8 +162,8 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit()
m_ThicknessCtrl->MoveAfterInTabOrder( m_SizeYCtrl );
m_PositionXCtrl->MoveAfterInTabOrder( m_ThicknessCtrl );
m_PositionYCtrl->MoveAfterInTabOrder( m_PositionXCtrl );
m_OrientationCtrl->MoveAfterInTabOrder( m_PositionYCtrl );
m_LayerSelectionCtrl->MoveAfterInTabOrder( m_OrientationCtrl );
m_OrientCtrl->MoveAfterInTabOrder( m_PositionYCtrl );
m_LayerSelectionCtrl->MoveAfterInTabOrder( m_OrientCtrl );
m_StyleCtrl->MoveAfterInTabOrder( m_LayerSelectionCtrl );
m_DisplayCtrl->MoveAfterInTabOrder( m_StyleCtrl );
m_justifyChoice->MoveAfterInTabOrder( m_DisplayCtrl );
@ -168,30 +171,24 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit()
// Set focus on most important control
m_TextContentCtrl->SetFocus();
m_TextContentCtrl->SetSelection( -1, -1 );
return DIALOG_PCB_TEXT_PROPERTIES_BASE::TransferDataToWindow();
}
void DIALOG_PCB_TEXT_PROPERTIES::OnClose( wxCloseEvent& event )
bool DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow()
{
EndModal( 0 );
}
if( !DIALOG_PCB_TEXT_PROPERTIES_BASE::TransferDataFromWindow() )
return false;
void DIALOG_PCB_TEXT_PROPERTIES::OnCancelClick( wxCommandEvent& event )
{
EndModal( wxID_CANCEL );
}
void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event )
{
// Test for acceptable layer.
// Incorrect layer can happen for old boards,
// having texts on edge cut layer for instance
if( m_LayerSelectionCtrl->GetLayerSelection() < 0 )
{
wxMessageBox( _( "No layer selected, Please select the text layer" ) );
return;
return false;
}
wxPoint newPosition;
@ -268,10 +265,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event )
m_SelectedPCBText->SetMirrored( m_DisplayCtrl->GetSelection() == 1 );
// Set the text orientation
long orientation;
m_OrientationCtrl->GetValue().ToLong( &orientation );
orientation = orientation % 3600;
m_SelectedPCBText->SetOrientation( orientation );
m_SelectedPCBText->SetOrientation( m_OrientValue * 10.0 );
// Set whether the PCB text is slanted (it is not italics, as italics has additional curves in style)
m_SelectedPCBText->SetItalic( m_StyleCtrl->GetSelection() );
@ -302,5 +296,6 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event )
m_parent->Refresh();
#endif
m_Parent->OnModify();
EndModal( 1 );
return true;
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Apr 9 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -57,11 +57,9 @@ DIALOG_PCB_TEXT_PROPERTIES_BASE::DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* pare
fgSizer1->Add( m_staticText10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_SizeXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_SizeXCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_PositionXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_PositionXCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_PositionXCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
@ -90,11 +88,9 @@ DIALOG_PCB_TEXT_PROPERTIES_BASE::DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* pare
fgSizer1->Add( m_staticText11, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_SizeYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_SizeYCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_PositionYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_PositionYCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_PositionYCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
wxString m_StyleCtrlChoices[] = { _("Normal"), _("Italic") };
@ -113,7 +109,7 @@ DIALOG_PCB_TEXT_PROPERTIES_BASE::DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* pare
m_ThicknessLabel->Wrap( -1 );
fgSizer1->Add( m_ThicknessLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_orientationLabel = new wxStaticText( this, wxID_ANY, _("Orientation (0.1 deg):"), wxDefaultPosition, wxDefaultSize, 0 );
m_orientationLabel = new wxStaticText( this, wxID_ANY, _("Orientation (deg):"), wxDefaultPosition, wxDefaultSize, 0 );
m_orientationLabel->Wrap( -1 );
fgSizer1->Add( m_orientationLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
@ -124,12 +120,10 @@ DIALOG_PCB_TEXT_PROPERTIES_BASE::DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* pare
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
m_ThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ThicknessCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_ThicknessCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_OrientationCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_OrientationCtrl->SetMaxLength( 0 );
fgSizer1->Add( m_OrientationCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_OrientCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_OrientCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer9->Add( fgSizer1, 1, wxALL|wxEXPAND, 5 );
@ -152,18 +146,8 @@ DIALOG_PCB_TEXT_PROPERTIES_BASE::DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* pare
bMainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PCB_TEXT_PROPERTIES_BASE::OnClose ) );
m_StandardSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PCB_TEXT_PROPERTIES_BASE::OnCancelClick ), NULL, this );
m_StandardSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PCB_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this );
}
DIALOG_PCB_TEXT_PROPERTIES_BASE::~DIALOG_PCB_TEXT_PROPERTIES_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PCB_TEXT_PROPERTIES_BASE::OnClose ) );
m_StandardSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PCB_TEXT_PROPERTIES_BASE::OnCancelClick ), NULL, this );
m_StandardSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PCB_TEXT_PROPERTIES_BASE::OnOkClick ), NULL, this );
}

View File

@ -61,7 +61,7 @@
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose">OnClose</event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
@ -220,7 +220,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">400,60</property>
@ -1790,7 +1790,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Orientation (0.1 deg):</property>
<property name="label">Orientation (deg):</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -1992,7 +1992,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_OrientationCtrl</property>
<property name="name">m_OrientCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -2062,11 +2062,11 @@
<property name="name">m_StandardSizer</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">OnCancelClick</event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick">OnOkClick</event>
<event name="OnOKButtonClick"></event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Apr 9 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -60,17 +60,11 @@ class DIALOG_PCB_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_ThicknessLabel;
wxStaticText* m_orientationLabel;
wxTextCtrl* m_ThicknessCtrl;
wxTextCtrl* m_OrientationCtrl;
wxTextCtrl* m_OrientCtrl;
wxStdDialogButtonSizer* m_StandardSizer;
wxButton* m_StandardSizerOK;
wxButton* m_StandardSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PCB_TEXT_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU );