Commit db0d7083 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Simplified code for switching layers in GAL view. Tools are notified of layer change event.

parent c0a96141
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -828,8 +828,11 @@ void PCB_EDIT_FRAME::SetActiveLayer( LAYER_ID aLayer )
    syncLayerWidgetLayer();

    if( IsGalCanvasActive() )
    {
        m_toolManager->RunAction( COMMON_ACTIONS::layerChanged );       // notify other tools
        GetGalCanvas()->Refresh();
    }
}


void PCB_EDIT_FRAME::syncLayerWidgetLayer()
+4 −0
Original line number Diff line number Diff line
@@ -222,6 +222,10 @@ TOOL_ACTION COMMON_ACTIONS::layerAlphaDec( "pcbnew.Control.layerAlphaDec",
        AS_GLOBAL, '{',
        "", "" );

TOOL_ACTION COMMON_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
        AS_GLOBAL, 0,
        "", "", AF_NOTIFY );


// Grid control
TOOL_ACTION COMMON_ACTIONS::gridFast1( "pcbnew.Control.gridFast1",
+2 −0
Original line number Diff line number Diff line
@@ -157,6 +157,8 @@ public:
    static TOOL_ACTION layerAlphaInc;
    static TOOL_ACTION layerAlphaDec;

    static TOOL_ACTION layerChanged;        // notification

    // Grid control
    static TOOL_ACTION gridFast1;
    static TOOL_ACTION gridFast2;
+1 −1
Original line number Diff line number Diff line
@@ -889,7 +889,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,

    if( aStartingPoint )
    {
        LAYER_NUM layer = m_frame->GetScreen()->m_Active_Layer;
        LAYER_ID layer = m_frame->GetScreen()->m_Active_Layer;

        // Init the new item attributes
        aGraphic->SetShape( (STROKE_T) aShape );
+3 −8
Original line number Diff line number Diff line
@@ -576,14 +576,9 @@ int MODULE_TOOLS::ModuleEdgeOutlines( TOOL_EVENT& aEvent )
    KIGFX::PCB_RENDER_SETTINGS* settings =
            static_cast<KIGFX::PCB_RENDER_SETTINGS*>( painter->GetSettings() );

    const LAYER_NUM layers[] = { ADHESIVE_N_FRONT, ADHESIVE_N_BACK,\
            SOLDERPASTE_N_FRONT, SOLDERPASTE_N_BACK,\
            SILKSCREEN_N_FRONT, SILKSCREEN_N_BACK,\
            SOLDERMASK_N_FRONT, SOLDERMASK_N_BACK,\
            DRAW_N,\
            COMMENT_N,\
            ECO1_N, ECO2_N,\
            EDGE_N };
    const LAYER_ID layers[] = { F_Adhes, B_Adhes, F_Paste, B_Paste,
            F_SilkS, B_SilkS, F_Mask, B_Mask,
            Dwgs_User, Cmts_User, Eco1_User, Eco2_User, Edge_Cuts };

    bool enable = !settings->GetSketchMode( layers[0] );

Loading