本文整理汇总了C++中TEXTE_MODULE::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ TEXTE_MODULE::Draw方法的具体用法?C++ TEXTE_MODULE::Draw怎么用?C++ TEXTE_MODULE::Draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TEXTE_MODULE
的用法示例。
在下文中一共展示了TEXTE_MODULE::Draw方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Show_MoveTexte_Module
static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
BASE_SCREEN* screen = aPanel->GetScreen();
TEXTE_MODULE* Text = static_cast<TEXTE_MODULE*>( screen->GetCurItem() );
if( Text == NULL )
return;
// Erase umbilical and text if necessary
if( aErase )
{
Text->DrawUmbilical( aPanel, aDC, GR_XOR, -MoveVector );
Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
}
MoveVector = TextInitialPosition - aPanel->GetParent()->GetCrossHairPosition();
// Draw umbilical if text moved
if( MoveVector.x || MoveVector.y )
Text->DrawUmbilical( aPanel, aDC, GR_XOR, -MoveVector );
// Redraw text
Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
}
示例2: CreateTextModule
/* Add a new graphical text to the active module (footprint)
* Note there always are 2 mandatory texts: reference and value.
* New texts have the member TEXTE_MODULE.GetType() set to TEXT_is_DIVERS
*/
TEXTE_MODULE* FOOTPRINT_EDIT_FRAME::CreateTextModule( MODULE* aModule, wxDC* aDC )
{
TEXTE_MODULE* text = new TEXTE_MODULE( aModule );
text->SetFlags( IS_NEW );
if( LSET::AllTechMask().test( GetActiveLayer() ) ) // i.e. a possible layer for a text
text->SetLayer( GetActiveLayer() );
InstallTextOptionsFrame( text, NULL );
if( text->GetText().IsEmpty() )
{
delete text;
return NULL;
}
// Add the new text object to the beginning of the footprint draw list.
if( aModule )
aModule->GraphicalItemsList().PushFront( text );
text->ClearFlags();
if( aDC )
text->Draw( m_canvas, aDC, GR_OR );
SetMsgPanel( text );
return text;
}
示例3: AbortMoveTextModule
/**
* Abort text move in progress.
*
* If a text is selected, its initial coordinates are regenerated.
*/
static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
BASE_SCREEN* screen = Panel->GetScreen();
TEXTE_MODULE* Text = static_cast<TEXTE_MODULE*>( screen->GetCurItem() );
MODULE* Module;
Panel->SetMouseCapture( NULL, NULL );
if( Text == NULL )
return;
Module = static_cast<MODULE*>( Text->GetParent() );
Text->DrawUmbilical( Panel, DC, GR_XOR, -MoveVector );
Text->Draw( Panel, DC, GR_XOR, MoveVector );
// If the text was moved (the move does not change internal data)
// it could be rotated while moving. So set old value for orientation
if( Text->IsMoving() )
Text->SetTextAngle( TextInitialOrientation );
// Redraw the text
Panel->RefreshDrawingRect( Text->GetBoundingBox() );
// leave it at (0,0) so we can use it Rotate when not moving.
MoveVector.x = MoveVector.y = 0;
Text->ClearFlags();
Module->ClearFlags();
screen->SetCurItem( NULL );
}
示例4: CreateTextModule
/* Add a new graphical text to the active module (footprint)
* Note there always are 2 mandatory texts: reference and value.
* New texts have the member TEXTE_MODULE.GetType() set to TEXT_is_DIVERS
*/
TEXTE_MODULE* FOOTPRINT_EDIT_FRAME::CreateTextModule( MODULE* aModule, wxDC* aDC )
{
TEXTE_MODULE* text = new TEXTE_MODULE( aModule );
text->SetFlags( IS_NEW );
GetDesignSettings().m_ModuleTextWidth = Clamp_Text_PenSize( GetDesignSettings().m_ModuleTextWidth,
std::min( GetDesignSettings().m_ModuleTextSize.x, GetDesignSettings().m_ModuleTextSize.y ), true );
text->SetTextSize( GetDesignSettings().m_ModuleTextSize );
text->SetThickness( GetDesignSettings().m_ModuleTextWidth );
text->SetPosition( GetCrossHairPosition() );
if( LSET::AllTechMask().test( GetActiveLayer() ) ) // i.e. a possible layer for a text
text->SetLayer( GetActiveLayer() );
InstallTextModOptionsFrame( text, NULL );
m_canvas->MoveCursorToCrossHair();
if( text->GetText().IsEmpty() )
{
delete text;
return NULL;
}
// Add the new text object to the beginning of the footprint draw list.
if( aModule )
aModule->GraphicalItems().PushFront( text );
text->ClearFlags();
if( aDC )
text->Draw( m_canvas, aDC, GR_OR );
SetMsgPanel( text );
return text;
}
示例5: Print_Module
static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule,
GR_DRAWMODE aDraw_mode, LSET aMask,
PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt )
{
// Print pads
for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() )
{
if( !( pad->GetLayerSet() & aMask ).any() )
continue;
// Manage hole according to the print drill option
wxSize drill_tmp = pad->GetDrillSize();
switch( aDrillShapeOpt )
{
case PRINT_PARAMETERS::NO_DRILL_SHAPE:
pad->SetDrillSize( wxSize(0,0) );
break;
case PRINT_PARAMETERS::SMALL_DRILL_SHAPE:
{
wxSize sz( std::min( SMALL_DRILL, pad->GetDrillSize().x ),
std::min( SMALL_DRILL, pad->GetDrillSize().y ) );
pad->SetDrillSize( sz );
}
break;
case PRINT_PARAMETERS::FULL_DRILL_SHAPE:
// Do nothing
break;
}
pad->Draw( aPanel, aDC, aDraw_mode );
pad->SetDrillSize( drill_tmp );
}
// Print footprint graphic shapes
LSET mlayer( aModule->GetLayer() );
if( aModule->GetLayer() == B_Cu )
mlayer = LSET( B_SilkS );
else if( aModule->GetLayer() == F_Cu )
mlayer = LSET( F_SilkS );
if( ( mlayer & aMask ).any() )
{
if( aModule->Reference().IsVisible() )
aModule->Reference().Draw( aPanel, aDC, aDraw_mode );
if( aModule->Value().IsVisible() )
aModule->Value().Draw( aPanel, aDC, aDraw_mode );
}
for( EDA_ITEM* item = aModule->GraphicalItems(); item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
{
if( !( mlayer & aMask ).any() )
break;
TEXTE_MODULE* textMod = static_cast<TEXTE_MODULE*>( item );
textMod->Draw( aPanel, aDC, aDraw_mode );
break;
}
case PCB_MODULE_EDGE_T:
{
EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item );
if( !aMask[edge->GetLayer()] )
break;
edge->Draw( aPanel, aDC, aDraw_mode );
}
break;
default:
break;
}
}
}
示例6: OnOkClick
void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
{
wxString msg;
if ( m_module)
m_parent->SaveCopyInUndoList( m_module, UR_CHANGED );
#ifndef USE_WX_OVERLAY
if( m_dc ) //Erase old text on screen
{
m_currentText->Draw( m_parent->GetCanvas(), m_dc, GR_XOR,
(m_currentText->IsMoving()) ? MoveVector : wxPoint( 0, 0 ) );
}
#endif
m_currentText->SetText( m_Name->GetValue() );
m_currentText->SetItalic( m_Style->GetSelection() == 1 );
wxPoint tmp;
msg = m_TxtPosCtrlX->GetValue();
tmp.x = ValueFromString( g_UserUnit, msg );
msg = m_TxtPosCtrlY->GetValue();
tmp.y = ValueFromString( g_UserUnit, msg );
m_currentText->SetPos0( tmp );
wxSize textSize( wxSize( ValueFromString( g_UserUnit, m_TxtSizeCtrlX->GetValue() ),
ValueFromString( g_UserUnit, m_TxtSizeCtrlY->GetValue() ) ) );
// Test for a reasonnable size:
if( textSize.x < TEXTS_MIN_SIZE )
textSize.x = TEXTS_MIN_SIZE;
if( textSize.y < TEXTS_MIN_SIZE )
textSize.y = TEXTS_MIN_SIZE;
m_currentText->SetSize( textSize ),
msg = m_TxtWidthCtlr->GetValue();
int width = ValueFromString( g_UserUnit, msg );
// Test for a reasonnable width:
if( width <= 1 )
width = 1;
int maxthickness = Clamp_Text_PenSize(width, m_currentText->GetSize() );
if( width > maxthickness )
{
DisplayError( NULL,
_( "The text thickness is too large for the text size. It will be clamped" ) );
width = maxthickness;
}
m_currentText->SetThickness( width );
m_currentText->SetVisible( m_Show->GetSelection() == 0 );
int text_orient = (m_Orient->GetSelection() == 0) ? 0 : 900;
m_currentText->SetOrientation( text_orient );
m_currentText->SetDrawCoord();
#ifndef USE_WX_OVERLAY
if( m_dc ) // Display new text
{
m_currentText->Draw( m_parent->GetCanvas(), m_dc, GR_XOR,
(m_currentText->IsMoving()) ? MoveVector : wxPoint( 0, 0 ) );
}
#else
m_parent->Refresh();
#endif
m_parent->OnModify();
if( m_module )
m_module->SetLastEditTime();
EndModal(1);
}