Added general purpose overlay layer and moved selection box to it.

This commit is contained in:
Maciej Suminski 2013-08-08 11:43:56 +02:00
parent 8c37e70889
commit 16437e5d45
5 changed files with 15 additions and 16 deletions

View File

@ -240,6 +240,8 @@ enum PCB_VISIBLE
PAD_BK_NETNAMES_VISIBLE, PAD_BK_NETNAMES_VISIBLE,
PADS_NETNAMES_VISIBLE, PADS_NETNAMES_VISIBLE,
GP_OVERLAY, // General purpose overlay
END_PCB_VISIBLE_LIST // sentinel 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). /// means that layer is displayed closer to the user, ie. on the top).
const LAYER_NUM GalLayerOrder[] = const LAYER_NUM GalLayerOrder[] =
{ {
ITEM_GAL_LAYER( GP_OVERLAY ),
ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_NETNAMES_VISIBLE ),
DRAW_N, COMMENT_N, ECO1_N, ECO2_N, EDGE_N, DRAW_N, COMMENT_N, ECO1_N, ECO2_N, EDGE_N,
UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31, UNUSED_LAYER_29, UNUSED_LAYER_30, UNUSED_LAYER_31,

View File

@ -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( 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_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->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 // Apply layer coloring scheme & display options
if( view->GetPainter() ) if( view->GetPainter() )

View File

@ -33,8 +33,8 @@ using namespace KiGfx;
const BOX2I SELECTION_AREA::ViewBBox() const const BOX2I SELECTION_AREA::ViewBBox() const
{ {
BOX2I tmp; BOX2I tmp;
tmp.SetOrigin(m_origin); tmp.SetOrigin( m_origin );
tmp.SetEnd(m_end); tmp.SetEnd( m_end );
tmp.Normalize(); tmp.Normalize();
return tmp; 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 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( 1.0 );
aGal->SetLineWidth( width.x ); aGal->SetStrokeColor( COLOR4D( 1.0, 1.0, 0.4, 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->SetFillColor(COLOR4D(0.3, 0.3, 0.5, 0.3)); aGal->SetIsStroke( true );
aGal->SetIsStroke(true); aGal->SetIsFill( true );
aGal->SetIsFill(true); aGal->DrawRectangle( m_origin, m_end );
aGal->SetLayerDepth(100.0);
aGal->DrawRectangle(m_origin, m_end);
} }

View File

@ -33,6 +33,7 @@
#include <view/view.h> #include <view/view.h>
#include <gal/graphics_abstraction_layer.h> #include <gal/graphics_abstraction_layer.h>
#include <base_struct.h> #include <base_struct.h>
#include <layers_id_colors_and_visibility.h>
/** /**
* Class SELECTION_AREA * Class SELECTION_AREA
@ -42,7 +43,7 @@
class SELECTION_AREA : public EDA_ITEM class SELECTION_AREA : public EDA_ITEM
{ {
public: public:
static const int SelectionLayer = 126; // fixme: define globally static const int SelectionLayer = ITEM_GAL_LAYER( GP_OVERLAY );
SELECTION_AREA(); SELECTION_AREA();
~SELECTION_AREA() {}; ~SELECTION_AREA() {};
@ -62,7 +63,7 @@ public:
m_end = aEnd; m_end = aEnd;
} }
void Show(int x, std::ostream& st) const void Show( int x, std::ostream& st) const
{ {
} }

View File

@ -199,10 +199,6 @@ void SELECTION_TOOL::selectMultiple()
m_selArea->SetEnd( evt->Position() ); m_selArea->SetEnd( evt->Position() );
m_selArea->ViewSetVisible( true ); m_selArea->ViewSetVisible( true );
m_selArea->ViewUpdate( VIEW_ITEM::APPEARANCE | VIEW_ITEM::GEOMETRY ); 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 ) ) if( evt->IsMouseUp( MB_Left ) )