Fix color issues with cursor and sheet pins.
This commit is contained in:
parent
4a92a5e628
commit
9dfcc839a4
|
@ -184,7 +184,8 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
|
|||
|
||||
m_gal->BeginDrawing();
|
||||
m_gal->SetClearColor( settings->GetBackgroundColor() );
|
||||
m_gal->SetCursorColor( settings->GetLayerColor( LAYER_CURSOR ) );
|
||||
m_gal->SetGridColor( settings->GetGridColor() );
|
||||
m_gal->SetCursorColor( settings->GetCursorColor() );
|
||||
|
||||
// TODO: find why ClearScreen() must be called here in opengl mode
|
||||
// and only if m_view->IsDirty() in Cairo mode to avoid distaly artifacts
|
||||
|
|
|
@ -593,17 +593,9 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
|
|||
|
||||
switch( m_UserUnits )
|
||||
{
|
||||
case INCHES:
|
||||
msg = _( "Inches" );
|
||||
break;
|
||||
|
||||
case MILLIMETRES:
|
||||
msg = _( "mm" );
|
||||
break;
|
||||
|
||||
default:
|
||||
msg = _( "Units" );
|
||||
break;
|
||||
case INCHES: msg = _( "Inches" ); break;
|
||||
case MILLIMETRES: msg = _( "mm" ); break;
|
||||
default: msg = _( "Units" ); break;
|
||||
}
|
||||
|
||||
SetStatusText( msg, 4 );
|
||||
|
@ -776,7 +768,7 @@ const wxString EDA_DRAW_FRAME::GetZoomLevelIndicator() const
|
|||
}
|
||||
else if( BASE_SCREEN* screen = GetScreen() )
|
||||
{
|
||||
level = m_zoomLevelCoeff / (double) screen->GetZoom();
|
||||
level = m_zoomLevelCoeff / screen->GetZoom();
|
||||
}
|
||||
|
||||
// returns a human readable value which can be displayed as zoom
|
||||
|
@ -807,12 +799,6 @@ void EDA_DRAW_FRAME::LoadSettings( wxConfigBase* aCfg )
|
|||
if( aCfg->Read( baseCfgName + ShowGridEntryKeyword, &btmp ) )
|
||||
SetGridVisibility( btmp );
|
||||
|
||||
// Read grid color:
|
||||
COLOR4D wtmp = COLOR4D::UNSPECIFIED;
|
||||
|
||||
if( wtmp.SetFromWxString( aCfg->Read( baseCfgName + GridColorEntryKeyword, wxT( "NONE" ) ) ) )
|
||||
SetGridColor( wtmp );
|
||||
|
||||
aCfg->Read( baseCfgName + LastGridSizeIdKeyword, &m_LastGridSizeId, 0L );
|
||||
|
||||
// m_LastGridSizeId is an offset, expected to be >= 0
|
||||
|
@ -841,8 +827,6 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
|
|||
|
||||
aCfg->Write( baseCfgName + UserUnitsEntryKeyword, (int) m_UserUnits );
|
||||
aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() );
|
||||
aCfg->Write( baseCfgName + GridColorEntryKeyword,
|
||||
GetGridColor().ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
|
||||
aCfg->Write( baseCfgName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId );
|
||||
aCfg->Write( baseCfgName + FirstRunShownKeyword, m_firstRunDialogSetting );
|
||||
|
||||
|
@ -1020,11 +1004,6 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
|||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||
}
|
||||
|
||||
// fixme-gal
|
||||
gal->SetGridVisibility( true );
|
||||
gal->SetGridColor( COLOR4D(0.0,0.0,0.0,1.0));
|
||||
|
||||
|
||||
// Transfer EDA_DRAW_PANEL settings
|
||||
GetGalCanvas()->GetViewControls()->EnableCursorWarping( !m_canvas->GetEnableZoomNoCenter() );
|
||||
GetGalCanvas()->GetViewControls()->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
|
||||
|
@ -1033,7 +1012,6 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
|||
|
||||
GetGalCanvas()->SetEvtHandlerEnabled( aEnable );
|
||||
|
||||
|
||||
// Reset current tool on switch();
|
||||
SetNoToolSelected();
|
||||
|
||||
|
|
|
@ -230,6 +230,7 @@ static PARAM_CFG_ARRAY& cfg_params()
|
|||
CLR( "Color4DErcEEx", LAYER_ERC_ERR, COLOR4D( RED ).WithAlpha(0.8 ) )
|
||||
CLR( "Color4DGridEx", LAYER_SCHEMATIC_GRID, COLOR4D( DARKGRAY ) )
|
||||
CLR( "Color4DBgCanvasEx", LAYER_SCHEMATIC_BACKGROUND, COLOR4D( WHITE ) )
|
||||
CLR( "Color4DCursorEx", LAYER_SCHEMATIC_CURSOR, COLOR4D( BLACK ) )
|
||||
CLR( "Color4DBrightenedEx", LAYER_BRIGHTENED, COLOR4D( PUREMAGENTA ) )
|
||||
CLR( "Color4DHiddenEx", LAYER_HIDDEN, COLOR4D( LIGHTGRAY ) )
|
||||
CLR( "Color4DWorksheetEx", LAYER_WORKSHEET, COLOR4D( RED ) )
|
||||
|
@ -253,6 +254,7 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
|||
SetLayerColor( COLOR4D( DARKGRAY ), ii );
|
||||
|
||||
SetLayerColor( COLOR4D::WHITE, LAYER_SCHEMATIC_BACKGROUND );
|
||||
SetLayerColor( COLOR4D::BLACK, LAYER_SCHEMATIC_CURSOR );
|
||||
|
||||
// Must be called before creating the main frame in order to
|
||||
// display the real hotkeys in menus or tool tips
|
||||
|
|
|
@ -391,10 +391,6 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
|
|||
ReadHotkeyConfig( SCH_EDIT_FRAME_NAME, g_Schematic_Hokeys_Descr );
|
||||
wxConfigLoadSetups( aCfg, GetConfigurationSettings() );
|
||||
|
||||
SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
|
||||
GetGalCanvas()->GetView()->GetGAL()->SetGridColor( GetGridColor() );
|
||||
SetDrawBgColor( GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
|
||||
|
||||
SetDefaultBusThickness( (int) aCfg->Read( DefaultBusWidthEntry, DEFAULTBUSTHICKNESS ) );
|
||||
SetDefaultLineThickness( (int) aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
|
||||
SCH_JUNCTION::SetSymbolSize( (int) aCfg->Read( DefaultJctSizeEntry, SCH_JUNCTION::GetSymbolSize() ) );
|
||||
|
@ -521,9 +517,6 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
|
|||
|
||||
ReadHotkeyConfig( LIB_EDIT_FRAME_NAME, g_Libedit_Hokeys_Descr );
|
||||
|
||||
SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
|
||||
SetDrawBgColor( GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
|
||||
|
||||
SetDefaultLineThickness( (int) aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
|
||||
SetDefaultPinLength( (int) aCfg->Read( DefaultPinLengthEntry, DEFAULTPINLENGTH ) );
|
||||
m_textPinNumDefaultSize = (int) aCfg->Read( defaultPinNumSizeEntry, DEFAULTPINNUMSIZE );
|
||||
|
|
|
@ -163,23 +163,6 @@ void SCH_BASE_FRAME::OnOpenLibraryViewer( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
// Virtual from EDA_DRAW_FRAME
|
||||
COLOR4D SCH_BASE_FRAME::GetDrawBgColor() const
|
||||
{
|
||||
return GetLayerColor( LAYER_SCHEMATIC_BACKGROUND );
|
||||
}
|
||||
|
||||
|
||||
void SCH_BASE_FRAME::SetDrawBgColor( COLOR4D aColor )
|
||||
{
|
||||
m_drawBgColor= aColor;
|
||||
SetLayerColor( aColor, LAYER_SCHEMATIC_BACKGROUND );
|
||||
|
||||
if( m_auimgr.GetManagedWindow() )
|
||||
m_auimgr.Update();
|
||||
}
|
||||
|
||||
|
||||
SCH_SCREEN* SCH_BASE_FRAME::GetScreen() const
|
||||
{
|
||||
return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen();
|
||||
|
|
|
@ -170,11 +170,6 @@ public:
|
|||
|
||||
void OnGridSettings( wxCommandEvent& aEvent );
|
||||
|
||||
// Virtual from EDA_DRAW_FRAME
|
||||
// the background color of the draw canvas:
|
||||
COLOR4D GetDrawBgColor() const override;
|
||||
void SetDrawBgColor( COLOR4D aColor) override;
|
||||
|
||||
const TITLE_BLOCK& GetTitleBlock() const override;
|
||||
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
|
||||
|
||||
|
@ -282,8 +277,7 @@ public:
|
|||
* @param aConvert preselected deMorgan conversion
|
||||
* @return the selected component
|
||||
*/
|
||||
COMPONENT_SELECTION SelectComponentFromLibBrowser(
|
||||
wxTopLevelWindow* aParent,
|
||||
COMPONENT_SELECTION SelectComponentFromLibBrowser( wxTopLevelWindow* aParent,
|
||||
const SCHLIB_FILTER* aFilter,
|
||||
const LIB_ID& aPreselectedLibid,
|
||||
int aUnit, int aConvert );
|
||||
|
|
|
@ -135,9 +135,6 @@ SCH_DRAW_PANEL::SCH_DRAW_PANEL( wxWindow* aParentWindow, wxWindowID aWindowId,
|
|||
|
||||
m_doubleClickInterval = 250;
|
||||
|
||||
m_gal->SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
|
||||
m_gal->SetCursorColor( COLOR4D(0.0, 0.0, 0.0, 1.0) );
|
||||
|
||||
m_viewControls->SetSnapping( true );
|
||||
|
||||
SetEvtHandlerEnabled( true );
|
||||
|
@ -201,7 +198,6 @@ bool SCH_DRAW_PANEL::SwitchBackend( GAL_TYPE aGalType )
|
|||
setDefaultLayerDeps();
|
||||
m_gal->SetWorldUnitLength( IU_2_GAL_WORLD_UNIT );
|
||||
m_gal->SetGridSize( grid_size );
|
||||
m_gal->SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -949,7 +949,8 @@ void SCH_PAINTER::draw( SCH_TEXT *aText, int aLayer )
|
|||
|
||||
switch( aText->Type() )
|
||||
{
|
||||
case SCH_HIERARCHICAL_LABEL_T: color = m_schSettings.GetLayerColor( LAYER_SHEETLABEL ); break;
|
||||
case SCH_SHEET_PIN_T: color = m_schSettings.GetLayerColor( LAYER_SHEETLABEL ); break;
|
||||
case SCH_HIERARCHICAL_LABEL_T: color = m_schSettings.GetLayerColor( LAYER_HIERLABEL ); break;
|
||||
case SCH_GLOBAL_LABEL_T: color = m_schSettings.GetLayerColor( LAYER_GLOBLABEL ); break;
|
||||
case SCH_LABEL_T: color = m_schSettings.GetLayerColor( LAYER_LOCLABEL ); break;
|
||||
default: color = m_schSettings.GetLayerColor( LAYER_NOTES ); break;
|
||||
|
|
|
@ -83,6 +83,12 @@ public:
|
|||
return luma < 0.5;
|
||||
}
|
||||
|
||||
const COLOR4D& GetBackgroundColor() override { return m_layerColors[ LAYER_SCHEMATIC_BACKGROUND ]; }
|
||||
|
||||
const COLOR4D& GetGridColor() override { return m_layerColors[ LAYER_SCHEMATIC_GRID ]; }
|
||||
|
||||
const COLOR4D& GetCursorColor() override { return m_layerColors[ LAYER_SCHEMATIC_CURSOR ]; }
|
||||
|
||||
int m_ShowUnit; // Show all units if 0
|
||||
int m_ShowConvert; // Show all conversions if 0
|
||||
|
||||
|
|
|
@ -69,8 +69,8 @@ SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL( wxWindow* aParentWindow, wxWindowID aWindo
|
|||
// on updated viewport data.
|
||||
m_viewControls = new KIGFX::WX_VIEW_CONTROLS( m_view, this );
|
||||
|
||||
m_gal->SetGridColor( COLOR4D(0.0, 0.0, 0.0, 1.0) );
|
||||
m_gal->SetCursorColor( COLOR4D(0.0, 0.0, 0.0, 1.0) );
|
||||
m_gal->SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
|
||||
m_gal->SetCursorColor( GetLayerColor( LAYER_SCHEMATIC_CURSOR ) );
|
||||
m_gal->SetGridSize( VECTOR2D( 50.0, 50.0 ) );
|
||||
|
||||
m_viewControls->SetSnapping( true );
|
||||
|
|
|
@ -670,19 +670,11 @@ void LIB_VIEW_FRAME::ExportToSchematicLibraryPart( wxCommandEvent& event )
|
|||
#define CMPLIST_WIDTH_KEY "ViewCmplistWidth"
|
||||
#define CMPVIEW_SHOW_PINELECTRICALTYPE_KEY "ViewCmpShowPinElectricalType"
|
||||
|
||||
// Currently, the library viewer has no dialog to change the background color
|
||||
// of the draw canvas. Therefore the background color is here just
|
||||
// in case of this option is added to some library viewer config dialog
|
||||
#define LIBVIEW_BGCOLOR "LibviewBgColor"
|
||||
|
||||
|
||||
void LIB_VIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||
{
|
||||
EDA_DRAW_FRAME::LoadSettings( aCfg );
|
||||
|
||||
SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
|
||||
SetDrawBgColor( GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
|
||||
|
||||
aCfg->Read( LIBLIST_WIDTH_KEY, &m_libListWidth, 150 );
|
||||
aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );
|
||||
aCfg->Read( CMPLIST_WIDTH_KEY, &m_cmpListWidth, 150 );
|
||||
|
|
|
@ -90,9 +90,11 @@ static COLORBUTTON sheetColorButtons[] = {
|
|||
static COLORBUTTON miscColorButtons[] = {
|
||||
{ _( "ERC warning" ), LAYER_ERC_WARN },
|
||||
{ _( "ERC error" ), LAYER_ERC_ERR },
|
||||
{ _( "Cursor" ), LAYER_SCHEMATIC_CURSOR },
|
||||
{ _( "Grid" ), LAYER_SCHEMATIC_GRID },
|
||||
{ _( "Brightened" ), LAYER_BRIGHTENED },
|
||||
{ _( "Hidden items" ), LAYER_HIDDEN },
|
||||
{ _( "Background" ), LAYER_SCHEMATIC_BACKGROUND },
|
||||
{ wxT( "" ), -1 } // Sentinel marking end of list.
|
||||
};
|
||||
|
||||
|
@ -186,42 +188,7 @@ void WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls()
|
|||
groups++;
|
||||
}
|
||||
|
||||
COLOR4D bgColor = GetDrawFrame()->GetDrawBgColor();
|
||||
wxMemoryDC iconDC;
|
||||
wxBitmap bitmap( m_butt_size_pix );
|
||||
|
||||
iconDC.SelectObject( bitmap );
|
||||
iconDC.SetPen( *wxBLACK_PEN );
|
||||
|
||||
wxBrush brush;
|
||||
brush.SetColour( bgColor.ToColour() );
|
||||
brush.SetStyle( wxBRUSHSTYLE_SOLID );
|
||||
iconDC.SetBrush( brush );
|
||||
iconDC.DrawRectangle( 0, 0, m_butt_size_pix.x, m_butt_size_pix.y );
|
||||
|
||||
buttonId++;
|
||||
wxBitmapButton* selBgColorBtn = new wxBitmapButton(
|
||||
this, buttonId, bitmap, wxDefaultPosition,
|
||||
m_butt_size_pix + m_butt_border_pix + wxSize( 1, 1 ) );
|
||||
selBgColorBtn->SetClientData( (void*) &bgColorButton );
|
||||
|
||||
Connect( 1800, buttonId, wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
wxCommandEventHandler( WIDGET_EESCHEMA_COLOR_CONFIG::SetColor ) );
|
||||
|
||||
wxStaticText* bgColorLabel = new wxStaticText( this, wxID_ANY, _( "Background Color" ) );
|
||||
wxFont font( bgColorLabel->GetFont() );
|
||||
font.SetWeight( wxFONTWEIGHT_BOLD );
|
||||
bgColorLabel->SetFont( font );
|
||||
|
||||
if( columnBoxSizer )
|
||||
{
|
||||
// Add a spacer to improve appearance.
|
||||
columnBoxSizer->AddSpacer( 5 );
|
||||
columnBoxSizer->Add( bgColorLabel, 1, wxALL, 5 );
|
||||
columnBoxSizer->Add( selBgColorBtn, 1, wxRIGHT | wxBOTTOM, 5 );
|
||||
}
|
||||
|
||||
currentColors[ LAYER_SCHEMATIC_BACKGROUND ] = bgColor;
|
||||
Connect( 1800, buttonId, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( WIDGET_EESCHEMA_COLOR_CONFIG::SetColor ) );
|
||||
|
||||
// Dialog now needs to be resized, but the associated command is found elsewhere.
|
||||
}
|
||||
|
@ -291,17 +258,9 @@ bool WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl()
|
|||
}
|
||||
}
|
||||
|
||||
// Update color of background
|
||||
GetDrawFrame()->SetDrawBgColor( bgcolor );
|
||||
currentColors[ LAYER_SCHEMATIC_BACKGROUND ] = bgcolor;
|
||||
|
||||
for( SCH_LAYER_ID clyr = SCH_LAYER_ID_START; clyr < SCH_LAYER_ID_END; ++clyr )
|
||||
SetLayerColor( currentColors[ clyr ], clyr );
|
||||
|
||||
m_drawFrame->SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
|
||||
m_drawFrame->GetGalCanvas()->GetView()->GetGAL()->SetGridColor( m_drawFrame->GetGridColor() );
|
||||
m_drawFrame->GetGalCanvas()->Refresh();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,8 +72,6 @@ void GERBVIEW_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS*
|
|||
for( int i = GAL_LAYER_ID_START; i < GAL_LAYER_ID_END; i++ )
|
||||
m_layerColors[i] = aSettings->GetLayerColor( i );
|
||||
|
||||
SetBackgroundColor( aSettings->GetItemColor( LAYER_PCB_BACKGROUND ) );
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,12 @@ public:
|
|||
update(); // recompute other shades of the color
|
||||
}
|
||||
|
||||
const COLOR4D& GetBackgroundColor() override { return m_layerColors[ LAYER_PCB_BACKGROUND ]; }
|
||||
|
||||
const COLOR4D& GetGridColor() override { return m_layerColors[ LAYER_GRID ]; }
|
||||
|
||||
const COLOR4D& GetCursorColor() override { return m_layerColors[ LAYER_CURSOR ]; }
|
||||
|
||||
inline bool IsSpotFill() const
|
||||
{
|
||||
return m_spotFill;
|
||||
|
|
|
@ -254,6 +254,7 @@ enum SCH_LAYER_ID: int
|
|||
LAYER_DEVICE_BACKGROUND,
|
||||
LAYER_SCHEMATIC_GRID,
|
||||
LAYER_SCHEMATIC_BACKGROUND,
|
||||
LAYER_SCHEMATIC_CURSOR,
|
||||
LAYER_BRIGHTENED,
|
||||
LAYER_HIDDEN,
|
||||
|
||||
|
|
|
@ -191,22 +191,20 @@ public:
|
|||
/**
|
||||
* Function GetBackgroundColor
|
||||
* Returns current background color settings.
|
||||
* @return Background color.
|
||||
*/
|
||||
inline const COLOR4D& GetBackgroundColor() const
|
||||
{
|
||||
return m_backgroundColor;
|
||||
}
|
||||
virtual const COLOR4D& GetBackgroundColor() = 0;
|
||||
|
||||
/**
|
||||
* Function SetBackgroundColor
|
||||
* Sets new color for background.
|
||||
* @param aColor is the new background color.
|
||||
* Function GetGridColor
|
||||
* Returns current grid color settings.
|
||||
*/
|
||||
inline void SetBackgroundColor( const COLOR4D& aColor )
|
||||
{
|
||||
m_backgroundColor = aColor;
|
||||
}
|
||||
virtual const COLOR4D& GetGridColor() = 0;
|
||||
|
||||
/**
|
||||
* Function GetCursorColor
|
||||
* Returns current cursor color settings.
|
||||
*/
|
||||
virtual const COLOR4D& GetCursorColor() = 0;
|
||||
|
||||
/**
|
||||
* Function GetLayerColor
|
||||
|
|
|
@ -118,8 +118,6 @@ void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSet
|
|||
m_layerColors[GetNetnameLayer( layer )] = lightLabel;
|
||||
}
|
||||
|
||||
SetBackgroundColor ( aSettings->GetItemColor( LAYER_PCB_BACKGROUND ) );
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
|
@ -143,6 +143,12 @@ public:
|
|||
return luma < 0.5;
|
||||
}
|
||||
|
||||
const COLOR4D& GetBackgroundColor() override { return m_layerColors[ LAYER_PCB_BACKGROUND ]; }
|
||||
|
||||
const COLOR4D& GetGridColor() override { return m_layerColors[ LAYER_GRID ]; }
|
||||
|
||||
const COLOR4D& GetCursorColor() override { return m_layerColors[ LAYER_CURSOR ]; }
|
||||
|
||||
protected:
|
||||
///> Flag determining if items on a given layer should be drawn as an outline or a filled item
|
||||
bool m_sketchMode[GAL_LAYER_ID_END];
|
||||
|
|
Loading…
Reference in New Issue