From 16437e5d4520822052c7ab3d851a4911323b3d76 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 8 Aug 2013 11:43:56 +0200 Subject: [PATCH] Added general purpose overlay layer and moved selection box to it. --- include/layers_id_colors_and_visibility.h | 3 +++ pcbnew/basepcbframe.cpp | 1 + pcbnew/tools/selection_area.cpp | 18 ++++++++---------- pcbnew/tools/selection_area.h | 5 +++-- pcbnew/tools/selection_tool.cpp | 4 ---- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index f9331a0254..bb1b13a243 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -240,6 +240,8 @@ enum PCB_VISIBLE PAD_BK_NETNAMES_VISIBLE, PADS_NETNAMES_VISIBLE, + GP_OVERLAY, // General purpose overlay + END_PCB_VISIBLE_LIST // sentinel }; @@ -256,6 +258,7 @@ enum PCB_VISIBLE /// means that layer is displayed closer to the user, ie. on the top). const LAYER_NUM GalLayerOrder[] = { + ITEM_GAL_LAYER( GP_OVERLAY ), ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ), DRAW_N, COMMENT_N, ECO1_N, ECO2_N, EDGE_N, UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31, diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index b55ba8aabd..1308addc82 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -831,6 +831,7 @@ void PCB_BASE_FRAME::LoadSettings() view->SetRequired( ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) ); view->SetRequired( ITEM_GAL_LAYER( PAD_FR_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_FR_VISIBLE ) ); view->SetRequired( ITEM_GAL_LAYER( PAD_BK_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PAD_BK_VISIBLE ) ); + view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KiGfx::TARGET_OVERLAY ); // Apply layer coloring scheme & display options if( view->GetPainter() ) diff --git a/pcbnew/tools/selection_area.cpp b/pcbnew/tools/selection_area.cpp index 3b8c52d0e6..5c30de222c 100644 --- a/pcbnew/tools/selection_area.cpp +++ b/pcbnew/tools/selection_area.cpp @@ -33,8 +33,8 @@ using namespace KiGfx; const BOX2I SELECTION_AREA::ViewBBox() const { BOX2I tmp; - tmp.SetOrigin(m_origin); - tmp.SetEnd(m_end); + tmp.SetOrigin( m_origin ); + tmp.SetEnd( m_end ); tmp.Normalize(); return tmp; } @@ -49,14 +49,12 @@ void SELECTION_AREA::ViewGetLayers( int aLayers[], int& aCount ) const void SELECTION_AREA::ViewDraw( int aLayer, GAL* aGal, const BOX2I& aVisibleArea ) const { - VECTOR2D width = m_view->ToWorld( VECTOR2D( 1.0, 1.0 ), false ); // fixme: pixel-sized stroke width setting? - aGal->SetLineWidth( width.x ); - aGal->SetStrokeColor(COLOR4D(1.0, 1.0, 0.4, 1.0)); - aGal->SetFillColor(COLOR4D(0.3, 0.3, 0.5, 0.3)); - aGal->SetIsStroke(true); - aGal->SetIsFill(true); - aGal->SetLayerDepth(100.0); - aGal->DrawRectangle(m_origin, m_end); + aGal->SetLineWidth( 1.0 ); + aGal->SetStrokeColor( COLOR4D( 1.0, 1.0, 0.4, 1.0 ) ); + aGal->SetFillColor( COLOR4D( 0.3, 0.3, 0.5, 0.3 ) ); + aGal->SetIsStroke( true ); + aGal->SetIsFill( true ); + aGal->DrawRectangle( m_origin, m_end ); } diff --git a/pcbnew/tools/selection_area.h b/pcbnew/tools/selection_area.h index e004339d9b..8cc380b4ab 100644 --- a/pcbnew/tools/selection_area.h +++ b/pcbnew/tools/selection_area.h @@ -33,6 +33,7 @@ #include #include #include +#include /** * Class SELECTION_AREA @@ -42,7 +43,7 @@ class SELECTION_AREA : public EDA_ITEM { public: - static const int SelectionLayer = 126; // fixme: define globally + static const int SelectionLayer = ITEM_GAL_LAYER( GP_OVERLAY ); SELECTION_AREA(); ~SELECTION_AREA() {}; @@ -62,7 +63,7 @@ public: m_end = aEnd; } - void Show(int x, std::ostream& st) const + void Show( int x, std::ostream& st) const { } diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index acd33326d6..19d25b95e4 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -199,10 +199,6 @@ void SELECTION_TOOL::selectMultiple() m_selArea->SetEnd( evt->Position() ); m_selArea->ViewSetVisible( true ); m_selArea->ViewUpdate( VIEW_ITEM::APPEARANCE | VIEW_ITEM::GEOMETRY ); - - v->SetLayerVisible( SELECTION_AREA::SelectionLayer ); - v->SetLayerOrder( SELECTION_AREA::SelectionLayer, 1000 ); - v->SetLayerTarget( SELECTION_AREA::SelectionLayer, TARGET_OVERLAY ); } if( evt->IsMouseUp( MB_Left ) )