From b1fd93125142ba2480e4eee77c8b36e34504d298 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sun, 23 Feb 2020 22:39:15 -0500 Subject: [PATCH] Use grid color for worksheet page borders --- common/page_layout/ws_painter.cpp | 8 +++++--- common/page_layout/ws_proxy_view_item.cpp | 5 +++-- include/ws_painter.h | 2 ++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common/page_layout/ws_painter.cpp b/common/page_layout/ws_painter.cpp index c30ea666ef..1dfc96c8c9 100644 --- a/common/page_layout/ws_painter.cpp +++ b/common/page_layout/ws_painter.cpp @@ -48,6 +48,7 @@ WS_RENDER_SETTINGS::WS_RENDER_SETTINGS() m_normalColor = RED; m_selectedColor = m_normalColor.Brightened( 0.5 ); m_brightenedColor = COLOR4D( 0.0, 1.0, 0.0, 0.9 ); + m_pageBorderColor = COLOR4D( 0.4, 0.4, 0.4, 1.0 ); update(); } @@ -62,6 +63,7 @@ void WS_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings ) m_layerColors[ layer ] = aSettings->GetColor( layer ); m_backgroundColor = aSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND ); + m_pageBorderColor = aSettings->GetColor( LAYER_SCHEMATIC_GRID ); } @@ -370,14 +372,14 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_PAGE* aItem, int aLayer ) const m_gal->SetIsStroke( true ); // Use a gray color for the border color - m_gal->SetStrokeColor( COLOR4D( 0.4, 0.4, 0.4, 1.0 ) ); + m_gal->SetStrokeColor( m_renderSettings.m_pageBorderColor ); m_gal->SetIsFill( false ); m_gal->DrawRectangle( origin, end ); // Draw the corner marker double marker_size = aItem->GetMarkerSize(); - m_gal->SetStrokeColor( COLOR4D( 0.4, 0.4, 1.0, 1.0 ) ); + m_gal->SetStrokeColor( m_renderSettings.m_pageBorderColor ); VECTOR2D pos = VECTOR2D( aItem->GetMarkerPos().x, aItem->GetMarkerPos().y ); // Draw a cirle and a X @@ -397,7 +399,7 @@ void KIGFX::WS_PAINTER::DrawBorder( const PAGE_INFO* aPageInfo, int aScaleFactor m_gal->SetIsStroke( true ); // Use a gray color for the border color - m_gal->SetStrokeColor( COLOR4D( 0.4, 0.4, 0.4, 1.0 ) ); + m_gal->SetStrokeColor( m_renderSettings.m_pageBorderColor ); m_gal->SetIsFill( false ); m_gal->DrawRectangle( origin, end ); } diff --git a/common/page_layout/ws_proxy_view_item.cpp b/common/page_layout/ws_proxy_view_item.cpp index 5ebd4d2a70..4e97c25310 100644 --- a/common/page_layout/ws_proxy_view_item.cpp +++ b/common/page_layout/ws_proxy_view_item.cpp @@ -108,12 +108,13 @@ void WS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const gal->Scale( VECTOR2D( -1.0, 1.0 ) ); } - WS_PAINTER ws_painter( gal ); - WS_RENDER_SETTINGS* ws_settings =static_cast( ws_painter.GetSettings() ); + WS_PAINTER ws_painter( gal ); + auto ws_settings = static_cast( ws_painter.GetSettings() ); ws_settings->SetNormalColor( settings->GetLayerColor( m_colorLayer ) ); ws_settings->SetSelectedColor( settings->GetLayerColor( LAYER_SELECT_OVERLAY ) ); ws_settings->SetBrightenedColor( settings->GetLayerColor( LAYER_BRIGHTENED ) ); + ws_settings->SetPageBorderColor( settings->GetLayerColor( LAYER_SCHEMATIC_GRID ) ); // Draw all the components that make the page layout for( WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() ) diff --git a/include/ws_painter.h b/include/ws_painter.h index 121ff48293..1731eab68a 100644 --- a/include/ws_painter.h +++ b/include/ws_painter.h @@ -67,6 +67,7 @@ public: void SetNormalColor( const COLOR4D& aColor ) { m_normalColor = aColor; } void SetSelectedColor( const COLOR4D& aColor ) { m_selectedColor = aColor; } void SetBrightenedColor( const COLOR4D& aColor ) { m_brightenedColor = aColor; } + void SetPageBorderColor( const COLOR4D& aColor ) { m_pageBorderColor = aColor; } const COLOR4D& GetGridColor() override { @@ -87,6 +88,7 @@ private: COLOR4D m_gridColor; COLOR4D m_cursorColor; + COLOR4D m_pageBorderColor; };