Commit 1ca89458 authored by Dick Hollenbeck's avatar Dick Hollenbeck
Browse files

put module text configuration variables into the BOARD

parent 2b3b2fc0
Loading
Loading
Loading
Loading
+27 −21
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ protected:
    int     m_VisibleLayers;                ///< Bit-mask for layer visibility
    int     m_VisibleElements;              ///< Bit-mask for element category visibility


public:
    bool    m_MicroViasAllowed;             ///< true to allow micro vias
    int     m_CurrentViaType;               ///< via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
@@ -39,6 +40,11 @@ public:
                                            ///< The final margin is the sum of these 2 values
    int     m_BoardThickness;               ///< Board Thickness for 3D viewer

    // Variables used in footprint handling
    wxSize  m_ModuleTextSize;               ///< Default footprint texts size
    int     m_ModuleTextWidth;
    int     m_ModuleSegmentWidth;

public:
    BOARD_DESIGN_SETTINGS();

+5 −0
Original line number Diff line number Diff line
@@ -45,6 +45,11 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
                                                // The final margin is the sum of these 2 values
                                                // Usually < 0 because the mask is smaller than pad

    m_ModuleTextSize = wxSize( 500, 500 );
    m_ModuleTextWidth = 100;
    m_ModuleSegmentWidth = 100;


    // Layer thickness for 3D viewer
    m_BoardThickness = (int)(1.6 * PCB_INTERNAL_UNIT / 25.4);
}
+8 −8
Original line number Diff line number Diff line
@@ -86,20 +86,20 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::initValues()
    /* Modules: Edges width */
    AddUnitSymbol( *m_EdgeModWidthTitle );
    PutValueInLocalUnits( *m_OptModuleEdgesWidth,
                          g_ModuleSegmentWidth, PCB_INTERNAL_UNIT );
                          m_BrdSettings.m_ModuleSegmentWidth, PCB_INTERNAL_UNIT );

    /* Modules: Texts: Size & width */
    AddUnitSymbol( *m_TextModWidthTitle );
    PutValueInLocalUnits( *m_OptModuleTextWidth,
                          g_ModuleTextWidth, PCB_INTERNAL_UNIT );
                          m_BrdSettings.m_ModuleTextWidth, PCB_INTERNAL_UNIT );

    AddUnitSymbol( *m_TextModSizeVTitle );
    PutValueInLocalUnits( *m_OptModuleTextVSize,
                          g_ModuleTextSize.y, PCB_INTERNAL_UNIT );
                          m_BrdSettings.m_ModuleTextSize.y, PCB_INTERNAL_UNIT );

    AddUnitSymbol( *m_TextModSizeHTitle );
    PutValueInLocalUnits( *m_OptModuleTextHSize,
                          g_ModuleTextSize.x, PCB_INTERNAL_UNIT );
                          m_BrdSettings.m_ModuleTextSize.x, PCB_INTERNAL_UNIT );

    AddUnitSymbol( *m_DefaultPenSizeTitle );
    PutValueInLocalUnits( *m_DefaultPenSizeCtrl,
@@ -122,13 +122,13 @@ void DIALOG_GRAPHIC_ITEMS_OPTIONS::OnOkClick( wxCommandEvent& event )

    m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings );

    g_ModuleSegmentWidth =
    m_BrdSettings.m_ModuleSegmentWidth =
        ReturnValueFromTextCtrl( *m_OptModuleEdgesWidth, PCB_INTERNAL_UNIT );
    g_ModuleTextWidth =
    m_BrdSettings.m_ModuleTextWidth =
        ReturnValueFromTextCtrl( *m_OptModuleTextWidth, PCB_INTERNAL_UNIT );
    g_ModuleTextSize.y =
    m_BrdSettings.m_ModuleTextSize.y =
        ReturnValueFromTextCtrl( *m_OptModuleTextVSize, PCB_INTERNAL_UNIT );
    g_ModuleTextSize.x =
    m_BrdSettings.m_ModuleTextSize.x =
        ReturnValueFromTextCtrl( *m_OptModuleTextHSize, PCB_INTERNAL_UNIT );

    g_DrawDefaultLineThickness =
+26 −26
Original line number Diff line number Diff line
@@ -159,40 +159,40 @@ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&

void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge )
{
    MODULE* Module = GetBoard()->m_Modules;
    MODULE* module = GetBoard()->m_Modules;

    SaveCopyInUndoList( Module, UR_MODEDIT );
    SaveCopyInUndoList( module, UR_MODEDIT );

    if( aEdge == NULL )
    {
        aEdge = (EDGE_MODULE*) (BOARD_ITEM*) Module->m_Drawings;
        aEdge = (EDGE_MODULE*) (BOARD_ITEM*) module->m_Drawings;

        for( ; aEdge != NULL; aEdge = aEdge->Next() )
        {
            if( aEdge->Type() != PCB_MODULE_EDGE_T )
                continue;

            aEdge->SetWidth( g_ModuleSegmentWidth );
            aEdge->SetWidth( GetBoard()->GetDesignSettings().m_ModuleSegmentWidth );
        }
    }
    else
    {
        aEdge->SetWidth( g_ModuleSegmentWidth );
        aEdge->SetWidth( GetBoard()->GetDesignSettings().m_ModuleSegmentWidth );
    }

    OnModify();
    Module->CalculateBoundingBox();
    Module->m_LastEdit_Time = time( NULL );
    module->CalculateBoundingBox();
    module->m_LastEdit_Time = time( NULL );
}


void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* Edge )
void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge )
{
    MODULE* Module    = GetBoard()->m_Modules;
    MODULE* module    = GetBoard()->m_Modules;
    int     new_layer = SILKSCREEN_N_FRONT;

    if( Edge != NULL )
        new_layer = Edge->GetLayer();
    if( aEdge )
        new_layer = aEdge->GetLayer();

    /* Ask for the new layer */
    new_layer = SelectLayer( new_layer, FIRST_COPPER_LAYER, LAST_NO_COPPER_LAYER );
@@ -209,28 +209,28 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* Edge )
            return;
    }

    SaveCopyInUndoList( Module, UR_MODEDIT );
    SaveCopyInUndoList( module, UR_MODEDIT );

    if( Edge == NULL )
    if( aEdge == NULL )
    {
        Edge = (EDGE_MODULE*) (BOARD_ITEM*) Module->m_Drawings;
        aEdge = (EDGE_MODULE*) (BOARD_ITEM*) module->m_Drawings;

        for( ; Edge != NULL; Edge = Edge->Next() )
        for( ; aEdge != NULL; aEdge = aEdge->Next() )
        {
            if( Edge->Type() != PCB_MODULE_EDGE_T )
            if( aEdge->Type() != PCB_MODULE_EDGE_T )
                continue;

            Edge->SetLayer( new_layer );
            aEdge->SetLayer( new_layer );
        }
    }
    else
    {
        Edge->SetLayer( new_layer );
        aEdge->SetLayer( new_layer );
    }

    OnModify();
    Module->CalculateBoundingBox();
    Module->m_LastEdit_Time = time( NULL );
    module->CalculateBoundingBox();
    module->m_LastEdit_Time = time( NULL );
}


@@ -238,7 +238,7 @@ void FOOTPRINT_EDIT_FRAME::Enter_Edge_Width( EDGE_MODULE* aEdge )
{
    wxString buffer;

    buffer = ReturnStringFromValue( g_UserUnit, g_ModuleSegmentWidth,
    buffer = ReturnStringFromValue( g_UserUnit, GetBoard()->GetDesignSettings().m_ModuleSegmentWidth,
                                    GetScreen()->GetInternalUnits() );
    wxTextEntryDialog dlg( this, _( "New Width:" ), _( "Edge Width" ), buffer );

@@ -246,13 +246,13 @@ void FOOTPRINT_EDIT_FRAME::Enter_Edge_Width( EDGE_MODULE* aEdge )
        return; // canceled by user

    buffer = dlg.GetValue( );
    g_ModuleSegmentWidth = ReturnValueFromString( g_UserUnit, buffer,
                                                  GetScreen()->GetInternalUnits() );
    GetBoard()->GetDesignSettings().m_ModuleSegmentWidth =
            ReturnValueFromString( g_UserUnit, buffer, GetScreen()->GetInternalUnits() );

    if( aEdge )
    {
        MODULE* module = GetBoard()->m_Modules;
        aEdge->SetWidth( g_ModuleSegmentWidth );
        aEdge->SetWidth( GetBoard()->GetDesignSettings().m_ModuleSegmentWidth );
        module->CalculateBoundingBox();
        OnModify();
    }
@@ -337,7 +337,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
        if( Edge->GetShape() == S_ARC )
            Edge->SetAngle( ArcValue );

        Edge->SetWidth( g_ModuleSegmentWidth );
        Edge->SetWidth( GetBoard()->GetDesignSettings().m_ModuleSegmentWidth );
        Edge->SetLayer( module->GetLayer() );

        if( module->GetLayer() == LAYER_N_FRONT )
@@ -383,7 +383,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* Edge,
                Edge = newedge;     // point now new item

                Edge->SetFlags( IS_NEW );
                Edge->SetWidth( g_ModuleSegmentWidth );
                Edge->SetWidth( GetBoard()->GetDesignSettings().m_ModuleSegmentWidth );
                Edge->SetStart( GetScreen()->GetCrossHairPosition() );
                Edge->SetEnd( Edge->GetStart() );

+16 −16
Original line number Diff line number Diff line
@@ -76,10 +76,10 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )

    Text->m_Text = wxT( "text" );

    g_ModuleTextWidth = Clamp_Text_PenSize( g_ModuleTextWidth,
                                            MIN( g_ModuleTextSize.x, g_ModuleTextSize.y ), true );
    Text->m_Size  = g_ModuleTextSize;
    Text->m_Thickness = g_ModuleTextWidth;
    GetBoard()->GetDesignSettings().m_ModuleTextWidth = Clamp_Text_PenSize( GetBoard()->GetDesignSettings().m_ModuleTextWidth,
                                            MIN( GetBoard()->GetDesignSettings().m_ModuleTextSize.x, GetBoard()->GetDesignSettings().m_ModuleTextSize.y ), true );
    Text->m_Size  = GetBoard()->GetDesignSettings().m_ModuleTextSize;
    Text->m_Thickness = GetBoard()->GetDesignSettings().m_ModuleTextWidth;
    Text->m_Pos   = GetScreen()->GetCrossHairPosition();
    Text->SetLocalCoord();

@@ -316,8 +316,8 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC )
        break;

    case PCB_MODULE_TEXT_T:
        newSize = g_ModuleTextSize;
        newThickness = g_ModuleTextWidth;
        newSize = GetBoard()->GetDesignSettings().m_ModuleTextSize;
        newThickness = GetBoard()->GetDesignSettings().m_ModuleTextWidth;
        moduleText = (TEXTE_MODULE*) aItem;
        text = (EDA_TEXT*) moduleText;
        break;
@@ -380,7 +380,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
        case TEXT_is_REFERENCE:
            item = module->m_Reference;

            if( item->GetSize() != g_ModuleTextSize || item->GetThickness() != g_ModuleTextWidth )
            if( item->GetSize() != GetBoard()->GetDesignSettings().m_ModuleTextSize || item->GetThickness() != GetBoard()->GetDesignSettings().m_ModuleTextWidth )
                undoItemList.PushItem( itemWrapper );

            break;
@@ -388,7 +388,7 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
        case TEXT_is_VALUE:
            item = module->m_Value;

            if( item->GetSize() != g_ModuleTextSize || item->GetThickness() != g_ModuleTextWidth )
            if( item->GetSize() != GetBoard()->GetDesignSettings().m_ModuleTextSize || item->GetThickness() != GetBoard()->GetDesignSettings().m_ModuleTextWidth )
                undoItemList.PushItem( itemWrapper );

            break;
@@ -401,8 +401,8 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
                {
                    item = (TEXTE_MODULE*) boardItem;

                    if( item->GetSize() != g_ModuleTextSize
                        || item->GetThickness() != g_ModuleTextWidth )
                    if( item->GetSize() != GetBoard()->GetDesignSettings().m_ModuleTextSize
                        || item->GetThickness() != GetBoard()->GetDesignSettings().m_ModuleTextWidth )
                    {
                        undoItemList.PushItem( itemWrapper );
                        break;
@@ -432,13 +432,13 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
        switch( aType )
        {
        case TEXT_is_REFERENCE:
            module->m_Reference->SetThickness( g_ModuleTextWidth );
            module->m_Reference->SetSize( g_ModuleTextSize );
            module->m_Reference->SetThickness( GetBoard()->GetDesignSettings().m_ModuleTextWidth );
            module->m_Reference->SetSize( GetBoard()->GetDesignSettings().m_ModuleTextSize );
            break;

        case TEXT_is_VALUE:
            module->m_Value->SetThickness( g_ModuleTextWidth );
            module->m_Value->SetSize( g_ModuleTextSize );
            module->m_Value->SetThickness( GetBoard()->GetDesignSettings().m_ModuleTextWidth );
            module->m_Value->SetSize( GetBoard()->GetDesignSettings().m_ModuleTextSize );
            break;

        case TEXT_is_DIVERS:
@@ -447,8 +447,8 @@ void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC )
                if( boardItem->Type() == PCB_MODULE_TEXT_T )
                {
                    item = (TEXTE_MODULE*) boardItem;
                    item->SetThickness( g_ModuleTextWidth );
                    item->SetSize( g_ModuleTextSize );
                    item->SetThickness( GetBoard()->GetDesignSettings().m_ModuleTextWidth );
                    item->SetSize( GetBoard()->GetDesignSettings().m_ModuleTextSize );
                }
            }

Loading