本文整理汇总了C++中DIMENSION::SetUnits方法的典型用法代码示例。如果您正苦于以下问题:C++ DIMENSION::SetUnits方法的具体用法?C++ DIMENSION::SetUnits怎么用?C++ DIMENSION::SetUnits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIMENSION
的用法示例。
在下文中一共展示了DIMENSION::SetUnits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TransferDataFromWindow
bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
{
if( !DIALOG_TEXT_PROPERTIES_BASE::TransferDataFromWindow() )
return false;
if( !m_textWidth.Validate( TEXTS_MIN_SIZE, TEXTS_MAX_SIZE )
|| !m_textHeight.Validate( TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) )
return false;
BOARD_COMMIT commit( m_Parent );
commit.Modify( m_item );
// If no other command in progress, prepare undo command
// (for a command in progress, will be made later, at the completion of command)
bool pushCommit = ( m_item->GetEditFlags() == 0 );
/* 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 ..
*/
if( !pushCommit )
m_item->SetFlags( IN_EDIT );
// Set the new text content
if( m_SingleLineText->IsShown() )
{
if( !m_SingleLineText->GetValue().IsEmpty() )
m_edaText->SetText( m_SingleLineText->GetValue() );
}
else if( m_MultiLineText->IsShown() )
{
if( !m_MultiLineText->GetValue().IsEmpty() )
m_edaText->SetText( m_MultiLineText->GetValue() );
}
else if( m_DimensionText->IsShown() )
{
if( !m_DimensionText->GetValue().IsEmpty() )
m_edaText->SetText( m_DimensionText->GetValue() );
DIMENSION* dimension = (DIMENSION*) m_item;
switch( m_DimensionUnitsOpt->GetSelection() )
{
case 0: dimension->SetUnits( INCHES, false ); break;
case 1: dimension->SetUnits( INCHES, true ); break;
case 2: dimension->SetUnits( MILLIMETRES, false ); break;
default: break;
}
}
m_item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) );
m_edaText->SetTextSize( wxSize( m_textWidth.GetValue(), m_textHeight.GetValue() ) );
m_edaText->SetThickness( m_thickness.GetValue() );
m_edaText->SetTextPos( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
if( m_modText )
m_modText->SetLocalCoord();
// Test for acceptable values for thickness and size and clamp if fails
int maxthickness = Clamp_Text_PenSize( m_edaText->GetThickness(), m_edaText->GetTextSize() );
if( m_edaText->GetThickness() > maxthickness )
{
DisplayError( this, _( "The text thickness is too large for the text size.\n"
"It will be clamped." ) );
m_edaText->SetThickness( maxthickness );
}
m_edaText->SetVisible( m_Visible->GetValue() );
m_edaText->SetItalic( m_Italic->GetValue() );
m_edaText->SetTextAngle( KiROUND( m_OrientValue * 10.0 ) );
m_edaText->SetMirrored( m_Mirrored->GetValue() );
if( m_modText )
m_modText->SetKeepUpright( m_KeepUpright->GetValue() );
switch( m_JustifyChoice->GetSelection() )
{
case 0: m_edaText->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT ); break;
case 1: m_edaText->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER ); break;
case 2: m_edaText->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT ); break;
default: break;
}
m_Parent->Refresh();
if( pushCommit )
commit.Push( _( "Change text properties" ) );
return true;
}