本文整理汇总了C++中TEXTE_MODULE类的典型用法代码示例。如果您正苦于以下问题:C++ TEXTE_MODULE类的具体用法?C++ TEXTE_MODULE怎么用?C++ TEXTE_MODULE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TEXTE_MODULE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: GetPosition
void MODULE::MoveAnchorPosition( const wxPoint& aMoveVector )
{
/* Move the reference point of the footprint
* the footprints elements (pads, outlines, edges .. ) are moved
* but:
* - the footprint position is not modified.
* - the relative (local) coordinates of these items are modified
*/
wxPoint footprintPos = GetPosition();
/* Update the relative coordinates:
* The coordinates are relative to the anchor point.
* Calculate deltaX and deltaY from the anchor. */
wxPoint moveVector = aMoveVector;
RotatePoint( &moveVector, -GetOrientation() );
// Update of the reference and value.
m_Reference->SetPos0( m_Reference->GetPos0() + moveVector );
m_Reference->SetDrawCoord();
m_Value->SetPos0( m_Value->GetPos0() + moveVector );
m_Value->SetDrawCoord();
// Update the pad local coordinates.
for( D_PAD* pad = Pads(); pad; pad = pad->Next() )
{
pad->SetPos0( pad->GetPos0() + moveVector );
pad->SetPosition( pad->GetPos0() + footprintPos );
}
// Update the draw element coordinates.
for( EDA_ITEM* item = GraphicalItems(); item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
{
EDGE_MODULE* edge = static_cast<EDGE_MODULE*>( item );
edge->m_Start0 += moveVector;
edge->m_End0 += moveVector;
edge->SetDrawCoord();
break;
}
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
text->SetPos0( text->GetPos0() + moveVector );
text->SetDrawCoord();
break;
}
default:
break;
}
}
CalculateBoundingBox();
}
示例3: MoveMarkedItems
/* Move marked items, at new position = old position + offset
*/
void MoveMarkedItems( MODULE* module, wxPoint offset )
{
EDA_ITEM* item;
if( module == NULL )
return;
D_PAD* pad = module->Pads();
for( ; pad != NULL; pad = pad->Next() )
{
if( !pad->IsSelected() )
continue;
pad->SetPosition( pad->GetPosition() + offset );
pad->SetPos0( pad->GetPos0() + offset );
}
item = module->GraphicalItems();
for( ; item != NULL; item = item->Next() )
{
if( !item->IsSelected() )
continue;
switch( item->Type() )
{
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
tm->Offset( offset );
tm->SetPos0( tm->GetPos0() + offset );
}
break;
case PCB_MODULE_EDGE_T:
{
EDGE_MODULE* em = (EDGE_MODULE*) item;
em->SetStart( em->GetStart() + offset );
em->SetEnd( em->GetEnd() + offset );
em->SetStart0( em->GetStart0() + offset );
em->SetEnd0( em->GetEnd0() + offset );
}
break;
default:
;
}
item->ClearFlags();
}
}
示例4: 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 );
}
示例5: switch
void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item )
{
if( Item == NULL )
return;
switch( Item->Type() )
{
case PCB_PAD_T:
DeletePad( (D_PAD*) Item, false );
break;
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( Item );
switch( text->GetType() )
{
case TEXTE_MODULE::TEXT_is_REFERENCE:
DisplayError( this, _( "Cannot delete REFERENCE!" ) );
break;
case TEXTE_MODULE::TEXT_is_VALUE:
DisplayError( this, _( "Cannot delete VALUE!" ) );
break;
case TEXTE_MODULE::TEXT_is_DIVERS:
DeleteTextModule( text );
}
}
break;
case PCB_MODULE_EDGE_T:
Delete_Edge_Module( (EDGE_MODULE*) Item );
m_canvas->Refresh();
break;
case PCB_MODULE_T:
break;
default:
{
wxString Line;
Line.Printf( wxT( " RemoveStruct: item type %d unknown." ), Item->Type() );
wxMessageBox( Line );
}
break;
}
}
示例6: switch
void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item )
{
if( Item == NULL )
return;
switch( Item->Type() )
{
case PCB_PAD_T:
DeletePad( (D_PAD*) Item, false );
break;
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* text = (TEXTE_MODULE*) Item;
if( text->GetType() == TEXT_is_REFERENCE )
{
DisplayError( this, _( "Text is REFERENCE!" ) );
break;
}
if( text->GetType() == TEXT_is_VALUE )
{
DisplayError( this, _( "Text is VALUE!" ) );
break;
}
DeleteTextModule( text );
}
break;
case PCB_MODULE_EDGE_T:
Delete_Edge_Module( (EDGE_MODULE*) Item );
m_canvas->Refresh();
break;
case PCB_MODULE_T:
break;
default:
{
wxString Line;
Line.Printf( wxT( " Remove: draw item type %d unknown." ), Item->Type() );
DisplayError( this, Line );
}
break;
}
}
示例7: NORMALIZE_ANGLE_POS
void MODULE::SetOrientation( double newangle )
{
double angleChange = newangle - m_Orient; // change in rotation
wxPoint pt;
NORMALIZE_ANGLE_POS( newangle );
m_Orient = newangle;
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
pt = pad->GetPos0();
pad->SetOrientation( pad->GetOrientation() + angleChange );
RotatePoint( &pt, m_Orient );
pad->SetPosition( GetPosition() + pt );
}
// Update of the reference and value.
m_Reference->SetDrawCoord();
m_Value->SetDrawCoord();
// Displace contours and text of the footprint.
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
{
if( item->Type() == PCB_MODULE_EDGE_T )
{
EDGE_MODULE* edge = (EDGE_MODULE*) item;
edge->SetDrawCoord();
}
else if( item->Type() == PCB_MODULE_TEXT_T )
{
TEXTE_MODULE* text = (TEXTE_MODULE*) item;
text->SetDrawCoord();
}
}
CalculateBoundingBox();
}
示例8: TEXTE_MODULE
/* 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;
}
示例9: switch
void MODULE::SetPosition( const wxPoint& newpos )
{
wxPoint delta = newpos - m_Pos;
m_Pos += delta;
m_Reference->SetTextPosition( m_Reference->GetTextPosition() + delta );
m_Value->SetTextPosition( m_Value->GetTextPosition() + delta );
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
pad->SetPosition( pad->GetPosition() + delta );
}
for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
{
EDGE_MODULE* pt_edgmod = (EDGE_MODULE*) item;
pt_edgmod->SetDrawCoord();
break;
}
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( item );
text->SetTextPosition( text->GetTextPosition() + delta );
break;
}
default:
wxMessageBox( wxT( "Draw type undefined." ) );
break;
}
}
CalculateBoundingBox();
}
示例10: TEXTE_MODULE
/* 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;
}
示例11: GetDesignSettings
void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
{
wxSize newSize = GetDesignSettings().GetTextSize( aItem->GetLayer() );
int newThickness = GetDesignSettings().GetTextThickness( aItem->GetLayer() );
bool newItalic = GetDesignSettings().GetTextItalic( aItem->GetLayer() );
if( aItem->Type() == PCB_TEXT_T )
{
TEXTE_PCB* text = static_cast<TEXTE_PCB*>( aItem );
// Exit if there's nothing to do
if( text->GetTextSize() == newSize && text->GetThickness() == newThickness )
return;
SaveCopyInUndoList( text, UR_CHANGED );
text->SetTextSize( newSize );
text->SetThickness( newThickness );
text->SetItalic( newItalic );
}
else if( aItem->Type() == PCB_MODULE_TEXT_T )
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( aItem );
// Exit if there's nothing to do
if( text->GetTextSize() == newSize && text->GetThickness() == newThickness )
return;
SaveCopyInUndoList( text->GetParent(), UR_CHANGED );
text->SetTextSize( newSize );
text->SetThickness( newThickness );
text->SetItalic( newItalic );
}
else
return;
if( aDC )
m_canvas->Refresh();
OnModify();
}
示例12: INSTALL_UNBUFFERED_DC
//.........这里部分代码省略.........
if( GetBoard()->m_Modules )
{
// CreateModuleLibrary() only creates a new library, does not save footprint
wxString libPath = CreateNewLibrary();
if( libPath.size() )
SaveCurrentModule( &libPath );
}
break;
case ID_MODEDIT_SHEET_SET:
break;
case ID_MODEDIT_LOAD_MODULE:
{
wxString libPath = getLibPath(); // might be empty
wxLogDebug( wxT( "Loading module from library " ) + libPath );
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
Clear_Pcb( true );
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
Load_Module_From_Library( libPath, true );
redraw = true;
}
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->ClearFlags();
// if either m_Reference or m_Value are gone, reinstall them -
// otherwise you cannot see what you are doing on board
if( GetBoard() && GetBoard()->m_Modules )
{
TEXTE_MODULE* ref = GetBoard()->m_Modules->m_Reference;
TEXTE_MODULE* val = GetBoard()->m_Modules->m_Value;
if( val && ref )
{
ref->SetType( TEXT_is_REFERENCE ); // just in case ...
if( ref->m_Text.Length() == 0 )
ref->m_Text = L"Ref**";
val->SetType( TEXT_is_VALUE ); // just in case ...
if( val->m_Text.Length() == 0 )
val->m_Text = L"Val**";
}
}
GetScreen()->ClrModify();
Zoom_Automatique( false );
if( m_Draw3DFrame )
m_Draw3DFrame->NewDisplay();
break;
case ID_MODEDIT_PAD_SETTINGS:
InstallPadOptionsFrame( NULL );
break;
case ID_MODEDIT_CHECK:
break;
case ID_MODEDIT_EDIT_MODULE_PROPERTIES:
示例13: MirrorMarkedItems
/** Mirror marked items, refer to a Vertical axis at position offset
* Note: because this function is used in global transform,
* if force_all is true, all items will be mirrored
*/
void MirrorMarkedItems( MODULE* module, wxPoint offset, bool force_all )
{
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
wxPoint tmp;
wxSize tmpz;
if( module == NULL )
return;
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
{
// Skip pads not selected, i.e. not inside the block to mirror:
if( !pad->IsSelected() && !force_all )
continue;
tmp = pad->GetPosition();
SETMIRROR( tmp.x );
pad->SetPosition( tmp );
pad->SetX0( pad->GetPosition().x );
tmp = pad->GetOffset();
NEGATE( tmp.x );
pad->SetOffset( tmp );
tmpz = pad->GetDelta();
NEGATE( tmpz.x );
pad->SetDelta( tmpz );
pad->SetOrientation( 1800 - pad->GetOrientation() );
}
for( EDA_ITEM* item = module->GraphicalItems(); item; item = item->Next() )
{
// Skip items not selected, i.e. not inside the block to mirror:
if( !item->IsSelected() && !force_all )
continue;
switch( item->Type() )
{
case PCB_MODULE_EDGE_T:
{
EDGE_MODULE* em = (EDGE_MODULE*) item;
tmp = em->GetStart0();
SETMIRROR( tmp.x );
em->SetStart0( tmp );
em->SetStartX( tmp.x );
tmp = em->GetEnd0();
SETMIRROR( tmp.x );
em->SetEnd0( tmp );
em->SetEndX( tmp.x );
em->SetAngle( -em->GetAngle() );
}
break;
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* tm = (TEXTE_MODULE*) item;
tmp = tm->GetTextPosition();
SETMIRROR( tmp.x );
tm->SetTextPosition( tmp );
tmp.y = tm->GetPos0().y;
tm->SetPos0( tmp );
}
break;
default:
break;
}
item->ClearFlags();
}
}
示例14: CreateComponentsSection
/* Creates the section $COMPONENTS (Footprints placement)
* Bottom side components are difficult to handle: shapes must be mirrored or
* flipped, silk layers need to be handled correctly and so on. Also it seems
* that *noone* follows the specs...
*/
static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
{
fputs( "$COMPONENTS\n", aFile );
int cu_count = aPcb->GetCopperLayerCount();
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
{
const char* mirror;
const char* flip;
double fp_orient = module->GetOrientation();
if( module->GetFlag() )
{
mirror = "0";
flip = "FLIP";
NEGATE_AND_NORMALIZE_ANGLE_POS( fp_orient );
}
else
{
mirror = "0";
flip = "0";
}
fprintf( aFile, "\nCOMPONENT %s\n",
TO_UTF8( module->GetReference() ) );
fprintf( aFile, "DEVICE %s_%s\n",
TO_UTF8( module->GetReference() ),
TO_UTF8( module->GetValue() ) );
fprintf( aFile, "PLACE %g %g\n",
MapXTo( module->GetPosition().x ),
MapYTo( module->GetPosition().y ) );
fprintf( aFile, "LAYER %s\n",
(module->GetFlag()) ? "BOTTOM" : "TOP" );
fprintf( aFile, "ROTATION %g\n",
fp_orient / 10.0 );
fprintf( aFile, "SHAPE %s %s %s\n",
TO_UTF8( module->GetReference() ),
mirror, flip );
// Text on silk layer: RefDes and value (are they actually useful?)
TEXTE_MODULE *textmod = &module->Reference();
for( int ii = 0; ii < 2; ii++ )
{
double txt_orient = textmod->GetOrientation();
std::string layer = GenCADLayerName( cu_count, module->GetFlag() ? B_SilkS : F_SilkS );
fprintf( aFile, "TEXT %g %g %g %g %s %s \"%s\"",
textmod->GetPos0().x / SCALE_FACTOR,
-textmod->GetPos0().y / SCALE_FACTOR,
textmod->GetSize().x / SCALE_FACTOR,
txt_orient / 10.0,
mirror,
layer.c_str(),
TO_UTF8( textmod->GetText() ) );
// Please note, the width is approx
fprintf( aFile, " 0 0 %g %g\n",
( textmod->GetSize().x * textmod->GetLength() ) / SCALE_FACTOR,
textmod->GetSize().y / SCALE_FACTOR );
textmod = &module->Value(); // Dirty trick for the second iteration
}
// The SHEET is a 'generic description' for referencing the component
fprintf( aFile, "SHEET \"RefDes: %s, Value: %s\"\n",
TO_UTF8( module->GetReference() ),
TO_UTF8( module->GetValue() ) );
}
fputs( "$ENDCOMPONENTS\n\n", aFile );
}
示例15: switch
void EDIT_TOOL::remove( BOARD_ITEM* aItem )
{
BOARD* board = getModel<BOARD>();
switch( aItem->Type() )
{
case PCB_MODULE_T:
{
MODULE* module = static_cast<MODULE*>( aItem );
module->ClearFlags();
module->RunOnChildren( boost::bind( &KIGFX::VIEW::Remove, getView(), _1 ) );
// Module itself is deleted after the switch scope is finished
// list of pads is rebuild by BOARD::BuildListOfNets()
// Clear flags to indicate, that the ratsnest, list of nets & pads are not valid anymore
board->m_Status_Pcb = 0;
}
break;
// Default removal procedure
case PCB_MODULE_TEXT_T:
{
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( aItem );
switch( text->GetType() )
{
case TEXTE_MODULE::TEXT_is_REFERENCE:
DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete component reference." ) );
return;
case TEXTE_MODULE::TEXT_is_VALUE:
DisplayError( getEditFrame<PCB_BASE_FRAME>(), _( "Cannot delete component value." ) );
return;
case TEXTE_MODULE::TEXT_is_DIVERS: // suppress warnings
break;
}
if( m_editModules )
{
MODULE* module = static_cast<MODULE*>( aItem->GetParent() );
module->SetLastEditTime();
board->m_Status_Pcb = 0; // it is done in the legacy view
aItem->DeleteStructure();
}
return;
}
case PCB_PAD_T:
case PCB_MODULE_EDGE_T:
{
MODULE* module = static_cast<MODULE*>( aItem->GetParent() );
module->SetLastEditTime();
board->m_Status_Pcb = 0; // it is done in the legacy view
if( !m_editModules )
{
getView()->Remove( aItem );
board->Remove( aItem );
}
aItem->DeleteStructure();
return;
}
case PCB_LINE_T: // a segment not on copper layers
case PCB_TEXT_T: // a text on a layer
case PCB_TRACE_T: // a track segment (segment on a copper layer)
case PCB_VIA_T: // a via (like track segment on a copper layer)
case PCB_DIMENSION_T: // a dimension (graphic item)
case PCB_TARGET_T: // a target (graphic item)
case PCB_MARKER_T: // a marker used to show something
case PCB_ZONE_T: // SEG_ZONE items are now deprecated
case PCB_ZONE_AREA_T:
break;
default: // other types do not need to (or should not) be handled
assert( false );
return;
}
getView()->Remove( aItem );
board->Remove( aItem );
}