2010-11-27 13:09:18 +00:00
|
|
|
/*
|
2011-09-30 18:15:37 +00:00
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
2010-11-27 13:09:18 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2004-2010 Jean-Pierre Charras <jean-pierre.charras@gpisa-lab.inpg.fr>
|
2016-04-12 23:18:33 +00:00
|
|
|
* Copyright (C) 2010-2016 KiCad Developers, see change_log.txt for contributors.
|
2010-11-27 13:09:18 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2008-12-20 17:28:25 +00:00
|
|
|
/***************************************************************************/
|
|
|
|
/* Dialog editor for text on copper and technical layers (TEXTE_PCB class) */
|
|
|
|
/***************************************************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <gr_basic.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <wxPcbStruct.h>
|
|
|
|
#include <drawtxt.h>
|
|
|
|
#include <confirm.h>
|
2012-04-13 18:51:24 +00:00
|
|
|
#include <base_units.h>
|
2016-04-12 23:18:33 +00:00
|
|
|
#include <wx/valnum.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_board.h>
|
|
|
|
#include <class_pcb_text.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-03-19 20:57:19 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <wx/wx.h>
|
|
|
|
#include <dialog_pcb_text_properties_base.h>
|
2013-09-03 12:48:38 +00:00
|
|
|
#include <class_pcb_layer_box_selector.h>
|
2016-06-20 13:46:58 +00:00
|
|
|
#include <board_commit.h>
|
2012-03-19 20:57:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
class PCB_EDIT_FRAME;
|
|
|
|
class TEXTE_PCB;
|
|
|
|
|
|
|
|
|
2012-03-22 18:36:20 +00:00
|
|
|
class DIALOG_PCB_TEXT_PROPERTIES : public DIALOG_PCB_TEXT_PROPERTIES_BASE
|
2012-03-19 20:57:19 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-04-22 15:45:32 +00:00
|
|
|
DIALOG_PCB_TEXT_PROPERTIES( PCB_EDIT_FRAME* parent, TEXTE_PCB* passedTextPCB, wxDC* DC = nullptr );
|
2012-03-19 20:57:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
PCB_EDIT_FRAME* m_Parent;
|
|
|
|
wxDC* m_DC;
|
|
|
|
TEXTE_PCB* m_SelectedPCBText;
|
|
|
|
|
2016-04-12 23:18:33 +00:00
|
|
|
wxFloatingPointValidator<double> m_OrientValidator;
|
|
|
|
double m_OrientValue;
|
2012-03-19 20:57:19 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
bool TransferDataFromWindow() override;
|
2016-07-02 09:35:52 +00:00
|
|
|
|
|
|
|
// Virtual event handler
|
2016-09-25 17:06:49 +00:00
|
|
|
virtual void OnInitDlg( wxInitDialogEvent& event ) override
|
2016-07-02 09:35:52 +00:00
|
|
|
{
|
|
|
|
// Call the default wxDialog handler of a wxInitDialogEvent
|
|
|
|
TransferDataToWindow();
|
|
|
|
|
|
|
|
// Now all widgets have the size fixed, call FinishDialogSettings
|
|
|
|
FinishDialogSettings();
|
|
|
|
}
|
2012-03-19 20:57:19 +00:00
|
|
|
};
|
2011-09-23 13:57:12 +00:00
|
|
|
|
|
|
|
|
2010-11-27 13:09:18 +00:00
|
|
|
/**
|
|
|
|
* DIALOG_PCB_TEXT_PROPERTIES, derived from DIALOG_PCB_TEXT_PROPERTIES_BASE
|
|
|
|
* @see dialog_dialog_pcb_text_properties_base.h and
|
|
|
|
* dialog_dialog_pcb_text_properties_base.cpp, automatically created by
|
|
|
|
* wxFormBuilder.
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
DIALOG_PCB_TEXT_PROPERTIES::DIALOG_PCB_TEXT_PROPERTIES( PCB_EDIT_FRAME* parent,
|
2016-04-12 23:18:33 +00:00
|
|
|
TEXTE_PCB* passedTextPCB, wxDC* DC ) :
|
|
|
|
DIALOG_PCB_TEXT_PROPERTIES_BASE( parent ),
|
|
|
|
m_OrientValidator( 1, &m_OrientValue )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2010-11-27 13:09:18 +00:00
|
|
|
m_Parent = parent;
|
|
|
|
m_DC = DC;
|
|
|
|
m_SelectedPCBText = passedTextPCB;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2016-04-12 23:18:33 +00:00
|
|
|
m_OrientValue = 0.0;
|
|
|
|
m_OrientValidator.SetRange( -360.0, 360.0 );
|
|
|
|
m_OrientCtrl->SetValidator( m_OrientValidator );
|
|
|
|
m_OrientValidator.SetWindow( m_OrientCtrl );
|
|
|
|
|
2011-03-14 15:17:18 +00:00
|
|
|
m_StandardSizerOK->SetDefault();
|
2016-07-15 10:05:13 +00:00
|
|
|
|
2010-11-27 13:09:18 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-07-04 21:32:49 +00:00
|
|
|
|
2010-11-27 13:09:18 +00:00
|
|
|
/**
|
|
|
|
* Routine for main window class to launch text properties dialog.
|
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::InstallTextPCBOptionsFrame( TEXTE_PCB* TextPCB, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetIgnoreMouseEvents( true );
|
2012-11-24 22:03:30 +00:00
|
|
|
#ifndef __WXMAC__
|
2010-11-27 13:09:18 +00:00
|
|
|
DIALOG_PCB_TEXT_PROPERTIES dlg( this, TextPCB, DC );
|
2012-11-24 22:03:30 +00:00
|
|
|
#else
|
|
|
|
// Avoid "writes" in the dialog, creates errors with WxOverlay and NSView
|
|
|
|
// Raising an Exception - Fixes #891347
|
|
|
|
DIALOG_PCB_TEXT_PROPERTIES dlg( this, TextPCB, NULL );
|
|
|
|
#endif
|
2010-11-27 13:09:18 +00:00
|
|
|
dlg.ShowModal();
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetIgnoreMouseEvents( false );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2011-07-04 21:32:49 +00:00
|
|
|
|
2016-04-12 23:18:33 +00:00
|
|
|
bool DIALOG_PCB_TEXT_PROPERTIES::TransferDataToWindow()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2010-11-27 13:09:18 +00:00
|
|
|
// Put units symbols to text labels where appropriate
|
|
|
|
AddUnitSymbol( *m_SizeXLabel );
|
|
|
|
AddUnitSymbol( *m_SizeYLabel );
|
|
|
|
AddUnitSymbol( *m_ThicknessLabel );
|
|
|
|
AddUnitSymbol( *m_PositionXLabel );
|
|
|
|
AddUnitSymbol( *m_PositionYLabel );
|
|
|
|
|
|
|
|
// Fill fields with current values
|
2013-03-18 19:36:07 +00:00
|
|
|
*m_TextContentCtrl << m_SelectedPCBText->GetText();
|
2010-11-27 13:09:18 +00:00
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
PutValueInLocalUnits( *m_SizeXCtrl, m_SelectedPCBText->GetTextWidth() );
|
|
|
|
PutValueInLocalUnits( *m_SizeYCtrl, m_SelectedPCBText->GetTextHeight() );
|
2013-03-18 19:36:07 +00:00
|
|
|
PutValueInLocalUnits( *m_ThicknessCtrl, m_SelectedPCBText->GetThickness() );
|
2017-01-23 20:30:11 +00:00
|
|
|
PutValueInLocalUnits( *m_PositionXCtrl, m_SelectedPCBText->GetTextPos().x );
|
|
|
|
PutValueInLocalUnits( *m_PositionYCtrl, m_SelectedPCBText->GetTextPos().y );
|
2010-11-27 13:09:18 +00:00
|
|
|
|
2013-09-03 12:48:38 +00:00
|
|
|
// Configure the layers list selector
|
|
|
|
m_LayerSelectionCtrl->SetLayersHotkeys( false );
|
2014-06-24 16:17:18 +00:00
|
|
|
|
2013-09-03 12:48:38 +00:00
|
|
|
// A text has no sense on edge cut layer
|
2014-06-24 16:17:18 +00:00
|
|
|
m_LayerSelectionCtrl->SetLayerSet( Edge_Cuts );
|
2013-09-03 12:48:38 +00:00
|
|
|
m_LayerSelectionCtrl->SetBoardFrame( m_Parent );
|
|
|
|
m_LayerSelectionCtrl->Resync();
|
|
|
|
m_LayerSelectionCtrl->SetLayerSelection( m_SelectedPCBText->GetLayer() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
m_OrientValue = m_SelectedPCBText->GetTextAngleDegrees();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2013-03-18 19:36:07 +00:00
|
|
|
if( m_SelectedPCBText->IsMirrored() )
|
2010-11-27 13:09:18 +00:00
|
|
|
m_DisplayCtrl->SetSelection( 1 );
|
|
|
|
else
|
|
|
|
m_DisplayCtrl->SetSelection( 0 );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2013-03-18 19:36:07 +00:00
|
|
|
if( m_SelectedPCBText->IsItalic() )
|
2010-11-27 13:09:18 +00:00
|
|
|
m_StyleCtrl->SetSelection( 1 );
|
|
|
|
else
|
|
|
|
m_StyleCtrl->SetSelection( 0 );
|
2008-12-20 17:28:25 +00:00
|
|
|
|
2011-07-04 21:32:49 +00:00
|
|
|
// Set justification
|
2012-01-03 17:14:17 +00:00
|
|
|
EDA_TEXT_HJUSTIFY_T hJustify = m_SelectedPCBText->GetHorizJustify();
|
2011-07-04 21:32:49 +00:00
|
|
|
m_justifyChoice->SetSelection( (int) hJustify + 1 );
|
|
|
|
|
2015-04-10 23:28:25 +00:00
|
|
|
// Manually set tab order
|
|
|
|
m_SizeXCtrl->MoveAfterInTabOrder( m_TextContentCtrl );
|
|
|
|
m_SizeYCtrl->MoveAfterInTabOrder( m_SizeXCtrl );
|
|
|
|
m_ThicknessCtrl->MoveAfterInTabOrder( m_SizeYCtrl );
|
|
|
|
m_PositionXCtrl->MoveAfterInTabOrder( m_ThicknessCtrl );
|
|
|
|
m_PositionYCtrl->MoveAfterInTabOrder( m_PositionXCtrl );
|
2016-04-12 23:18:33 +00:00
|
|
|
m_OrientCtrl->MoveAfterInTabOrder( m_PositionYCtrl );
|
|
|
|
m_LayerSelectionCtrl->MoveAfterInTabOrder( m_OrientCtrl );
|
2015-04-10 23:28:25 +00:00
|
|
|
m_StyleCtrl->MoveAfterInTabOrder( m_LayerSelectionCtrl );
|
|
|
|
m_DisplayCtrl->MoveAfterInTabOrder( m_StyleCtrl );
|
|
|
|
m_justifyChoice->MoveAfterInTabOrder( m_DisplayCtrl );
|
|
|
|
|
2010-11-27 13:09:18 +00:00
|
|
|
// Set focus on most important control
|
|
|
|
m_TextContentCtrl->SetFocus();
|
|
|
|
m_TextContentCtrl->SetSelection( -1, -1 );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2016-04-12 23:18:33 +00:00
|
|
|
return DIALOG_PCB_TEXT_PROPERTIES_BASE::TransferDataToWindow();
|
2011-07-04 21:32:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-04-12 23:18:33 +00:00
|
|
|
bool DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2016-04-12 23:18:33 +00:00
|
|
|
if( !DIALOG_PCB_TEXT_PROPERTIES_BASE::TransferDataFromWindow() )
|
|
|
|
return false;
|
2011-07-04 21:32:49 +00:00
|
|
|
|
2016-06-20 13:46:58 +00:00
|
|
|
BOARD_COMMIT commit( m_Parent );
|
|
|
|
commit.Modify( m_SelectedPCBText );
|
|
|
|
|
2014-01-26 17:30:20 +00:00
|
|
|
// Test for acceptable layer.
|
|
|
|
// Incorrect layer can happen for old boards,
|
|
|
|
// having texts on edge cut layer for instance
|
|
|
|
if( m_LayerSelectionCtrl->GetLayerSelection() < 0 )
|
|
|
|
{
|
2015-04-10 23:28:25 +00:00
|
|
|
wxMessageBox( _( "No layer selected, Please select the text layer" ) );
|
2016-04-12 23:18:33 +00:00
|
|
|
return false;
|
2014-01-26 17:30:20 +00:00
|
|
|
}
|
|
|
|
|
2010-11-27 13:09:18 +00:00
|
|
|
wxPoint newPosition;
|
|
|
|
wxSize newSize;
|
|
|
|
|
2009-08-03 07:55:08 +00:00
|
|
|
// If no other command in progress, prepare undo command
|
|
|
|
// (for a command in progress, will be made later, at the completion of command)
|
2016-06-20 13:46:58 +00:00
|
|
|
bool pushCommit = ( m_SelectedPCBText->GetFlags() == 0 );
|
2009-08-03 07:55:08 +00:00
|
|
|
|
|
|
|
/* set flag in edit to force undo/redo/abort proper operation,
|
|
|
|
* and avoid new calls to SaveCopyInUndoList for the same text
|
|
|
|
* this can occurs when a text is moved, and then rotated, edited ..
|
|
|
|
*/
|
2011-12-21 13:42:02 +00:00
|
|
|
if( m_SelectedPCBText->GetFlags() != 0 )
|
|
|
|
m_SelectedPCBText->SetFlags( IN_EDIT );
|
2009-08-03 07:55:08 +00:00
|
|
|
|
2013-12-22 17:39:37 +00:00
|
|
|
#ifndef USE_WX_OVERLAY
|
2010-11-27 13:09:18 +00:00
|
|
|
// Erase old text on screen if context is available
|
|
|
|
if( m_DC )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
m_SelectedPCBText->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2013-12-22 17:39:37 +00:00
|
|
|
#endif
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-11-27 13:09:18 +00:00
|
|
|
// Set the new text content
|
|
|
|
if( !m_TextContentCtrl->GetValue().IsEmpty() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2013-03-18 19:36:07 +00:00
|
|
|
m_SelectedPCBText->SetText( m_TextContentCtrl->GetValue() );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2008-03-24 20:54:45 +00:00
|
|
|
|
2010-11-27 13:09:18 +00:00
|
|
|
// Set PCB Text position
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
newPosition.x = ValueFromString( g_UserUnit, m_PositionXCtrl->GetValue() );
|
|
|
|
newPosition.y = ValueFromString( g_UserUnit, m_PositionYCtrl->GetValue() );
|
2017-01-23 20:30:11 +00:00
|
|
|
m_SelectedPCBText->SetTextPos( newPosition );
|
2010-11-27 13:09:18 +00:00
|
|
|
|
|
|
|
// Check constraints and set PCB Text size
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
newSize.x = ValueFromString( g_UserUnit, m_SizeXCtrl->GetValue() );
|
|
|
|
newSize.y = ValueFromString( g_UserUnit, m_SizeYCtrl->GetValue() );
|
2011-07-04 21:32:49 +00:00
|
|
|
|
2010-11-27 13:09:18 +00:00
|
|
|
if( newSize.x < TEXTS_MIN_SIZE )
|
|
|
|
newSize.x = TEXTS_MIN_SIZE;
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2010-11-27 13:09:18 +00:00
|
|
|
if( newSize.y < TEXTS_MIN_SIZE )
|
|
|
|
newSize.y = TEXTS_MIN_SIZE;
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2010-11-27 13:09:18 +00:00
|
|
|
if( newSize.x > TEXTS_MAX_WIDTH )
|
|
|
|
newSize.x = TEXTS_MAX_WIDTH;
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2010-11-27 13:09:18 +00:00
|
|
|
if( newSize.y > TEXTS_MAX_WIDTH )
|
|
|
|
newSize.y = TEXTS_MAX_WIDTH;
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
m_SelectedPCBText->SetTextSize( newSize );
|
2010-11-27 13:09:18 +00:00
|
|
|
|
|
|
|
// Set the new thickness
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
m_SelectedPCBText->SetThickness( ValueFromString( g_UserUnit,
|
2015-04-10 23:28:25 +00:00
|
|
|
m_ThicknessCtrl->GetValue() ) );
|
2010-11-27 13:09:18 +00:00
|
|
|
|
|
|
|
// Test for acceptable values for thickness and size and clamp if fails
|
2013-03-18 19:36:07 +00:00
|
|
|
int maxthickness = Clamp_Text_PenSize( m_SelectedPCBText->GetThickness(),
|
2017-01-23 20:30:11 +00:00
|
|
|
m_SelectedPCBText->GetTextSize() );
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2013-03-18 19:36:07 +00:00
|
|
|
if( m_SelectedPCBText->GetThickness() > maxthickness )
|
2009-05-30 16:06:01 +00:00
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
DisplayError( NULL,
|
|
|
|
_( "The text thickness is too large for the text size. It will be clamped" ) );
|
2013-03-18 19:36:07 +00:00
|
|
|
m_SelectedPCBText->SetThickness( maxthickness );
|
2009-05-30 16:06:01 +00:00
|
|
|
}
|
2008-03-24 20:54:45 +00:00
|
|
|
|
2010-11-27 13:09:18 +00:00
|
|
|
// Set the layer on which the PCB text is laying
|
2014-06-29 13:05:51 +00:00
|
|
|
m_SelectedPCBText->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) );
|
2010-11-27 13:09:18 +00:00
|
|
|
|
|
|
|
// Set whether the PCB text is mirrored (faced down from layer face perspective)
|
2013-03-18 19:36:07 +00:00
|
|
|
m_SelectedPCBText->SetMirrored( m_DisplayCtrl->GetSelection() == 1 );
|
2010-11-27 13:09:18 +00:00
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
// Set the text angle
|
|
|
|
m_SelectedPCBText->SetTextAngle( m_OrientValue * 10.0 );
|
2010-11-27 13:09:18 +00:00
|
|
|
|
|
|
|
// Set whether the PCB text is slanted (it is not italics, as italics has additional curves in style)
|
2013-03-18 19:36:07 +00:00
|
|
|
m_SelectedPCBText->SetItalic( m_StyleCtrl->GetSelection() );
|
2008-03-24 20:54:45 +00:00
|
|
|
|
2011-07-04 21:32:49 +00:00
|
|
|
// Set justification
|
|
|
|
switch( m_justifyChoice->GetSelection() )
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
m_SelectedPCBText->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
m_SelectedPCBText->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
m_SelectedPCBText->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-12-22 17:39:37 +00:00
|
|
|
#ifndef USE_WX_OVERLAY
|
2010-11-27 13:09:18 +00:00
|
|
|
// Finally, display new text if there is a context to do so
|
|
|
|
if( m_DC )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
m_SelectedPCBText->Draw( m_Parent->GetCanvas(), m_DC, GR_OR );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2013-12-22 17:39:37 +00:00
|
|
|
#else
|
2016-06-20 13:46:58 +00:00
|
|
|
m_Parent->Refresh();
|
2013-12-22 17:39:37 +00:00
|
|
|
#endif
|
2016-06-20 13:46:58 +00:00
|
|
|
|
|
|
|
if( pushCommit )
|
|
|
|
commit.Push( _( "Change text properties" ) );
|
2016-04-12 23:18:33 +00:00
|
|
|
|
|
|
|
return true;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|