Esempio n. 1
0
/* abort function in moving outline.
 */
static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC )
{
    EDGE_MODULE* edge = (EDGE_MODULE*) Panel->GetScreen()->GetCurItem();

    Panel->SetMouseCapture( NULL, NULL );

    if( edge && ( edge->Type() == PCB_MODULE_EDGE_T ) )
    {
        if( edge->IsNew() )   // On aborting, delete new outline.
        {
            MODULE* module = (MODULE*) edge->GetParent();
            edge->Draw( Panel, DC, GR_XOR, MoveVector );
            edge->DeleteStructure();
            module->CalculateBoundingBox();
        }
        else   // On aborting, move existing outline to its initial position.
        {
            edge->Draw( Panel, DC, GR_XOR, MoveVector );
            edge->ClearFlags();
            edge->Draw( Panel, DC, GR_OR );
        }
    }

    Panel->GetScreen()->SetCurItem( NULL );
}
Esempio n. 2
0
/* Redraw the current graphic item during its creation
 * Use this function to show a new outline, in begin command
 */
static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
                               bool aErase )
{
    BASE_SCREEN* screen = aPanel->GetScreen();
    EDGE_MODULE* edge   = (EDGE_MODULE*) screen->GetCurItem();

    if( edge == NULL )
        return;

    MODULE* module = (MODULE*) edge->GetParent();

    //  if( erase )
    {
        edge->Draw( aPanel, aDC, GR_XOR );
    }

    edge->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );

    // Update relative coordinate.
    edge->SetEnd0( edge->GetEnd() - module->GetPosition() );

    wxPoint pt( edge->GetEnd0() );

    RotatePoint( &pt, -module->GetOrientation() );

    edge->SetEnd0( pt );

    edge->Draw( aPanel, aDC, GR_XOR );

    module->CalculateBoundingBox();
}
Esempio n. 3
0
static void Move_Segment(WinEDA_DrawPanel * panel, wxDC * DC, bool erase)
/************************************************************************/
/* redessin du contour du Segment Edge lors des deplacements de la souris */
{
BASE_SCREEN * screen = panel->GetScreen();
EDGE_MODULE * Edge = (EDGE_MODULE * ) screen->m_CurrentItem;

	if( Edge == NULL ) return;

MODULE * Module = (MODULE*) Edge->m_Parent;

	screen->Trace_Curseur(panel, DC);

	if( erase )
		{
		Edge->Draw(panel, DC, MoveVector, GR_XOR);
		}

	MoveVector.x = -(screen->m_Curseur.x - CursorInitialPosition.x);
	MoveVector.y = -(screen->m_Curseur.y - CursorInitialPosition.y);

 	Edge->Draw(panel, DC, MoveVector, GR_XOR);

	screen->Trace_Curseur(panel, DC);

	Module->Set_Rectangle_Encadrement();
}
Esempio n. 4
0
static void Exit_EditEdge_Module(WinEDA_DrawFrame * frame, wxDC * DC)
/******************************************************************/
{
EDGE_MODULE * Edge = (EDGE_MODULE * ) frame->GetScreen()->m_CurrentItem;

	if( Edge && (Edge->m_StructType == TYPEEDGEMODULE) )	/* error si non */
	{
		if (Edge->m_Flags & IS_NEW)	/* effacement du nouveau contour */
		{
			MODULE * Module = (MODULE *) Edge->m_Parent;
			Edge->Draw(frame->DrawPanel, DC, MoveVector, GR_XOR);
			DeleteStructure(Edge);
			Module->Set_Rectangle_Encadrement();
		}

		else
		{
			Edge->Draw(frame->DrawPanel, DC, MoveVector, GR_XOR);
			Edge->m_Flags = 0;
			Edge->Draw(frame->DrawPanel, DC, wxPoint(0, 0), GR_OR);
		}
	}
	frame->GetScreen()->ManageCurseur = NULL;
	frame->GetScreen()->ForceCloseManageCurseur = NULL;
	frame->GetScreen()->m_CurrentItem = NULL;
}
Esempio n. 5
0
static void ShowEdgeModule(WinEDA_DrawPanel * panel, wxDC * DC, bool erase)
/************************************************************************/
/* Affiche le segment Edge Module en cours de trace
*/
{
BASE_SCREEN * screen = panel->GetScreen();
EDGE_MODULE * Edge = (EDGE_MODULE * ) screen->m_CurrentItem;

	if( Edge == NULL ) return;

MODULE * Module = (MODULE*) Edge->m_Parent;

	screen->Trace_Curseur(panel, DC);

 //	if( erase )
		{
		Edge->Draw(panel, DC, wxPoint(0, 0), GR_XOR);
		}

	Edge->m_End = screen->m_Curseur;

	/* Mise a jour des coord relatives */
	Edge->m_End0.x = Edge->m_End.x - Module->m_Pos.x;
	Edge->m_End0.y = Edge->m_End.y - Module->m_Pos.y ;
	RotatePoint((int*)&Edge->m_End0.x,
				(int*)&Edge->m_End0.y, - Module->m_Orient);

 	Edge->Draw(panel, DC, wxPoint(0, 0), GR_XOR);

	screen->Trace_Curseur(panel, DC);

	Module->Set_Rectangle_Encadrement();
}
Esempio n. 6
0
/* Redraw the current moved graphic item when mouse is moving
 * Use this function to show an existing outline, in move command
*/
static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
                                           const wxPoint& aPosition, bool aErase )
{
    BASE_SCREEN* screen = aPanel->GetScreen();
    EDGE_MODULE* edge   = (EDGE_MODULE*) screen->GetCurItem();

    if( edge == NULL )
        return;

    MODULE* module = (MODULE*) edge->GetParent();

    if( aErase )
    {
        edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
    }

    MoveVector = -(aPanel->GetParent()->GetCrossHairPosition() - CursorInitialPosition);

    edge->Draw( aPanel, aDC, GR_XOR, MoveVector );

    module->CalculateBoundingBox();
}
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;
        }
    }
}