Move gerbview colors to preferences dialog.
This commit is contained in:
parent
bd919e57bd
commit
b95d9d660d
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -1078,6 +1078,7 @@ void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event )
|
|||
|
||||
book->AddPage( new wxPanel( book ), _( "Gerber Viewer" ) );
|
||||
book->AddSubPage( CREATE_PANEL( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) );
|
||||
book->AddSubPage( CREATE_PANEL( PANEL_GBR_COLORS ), _( "Colors" ) );
|
||||
book->AddSubPage( CREATE_PANEL( PANEL_GBR_EXCELLON_OPTIONS ), _( "Excellon Options" ) );
|
||||
}
|
||||
catch( ... )
|
||||
|
@ -1142,18 +1143,15 @@ bool EDA_BASE_FRAME::IsWritable( const wxFileName& aFileName, bool aVerbose )
|
|||
|
||||
if( fn.IsDir() && !fn.IsDirWritable() )
|
||||
{
|
||||
msg.Printf( _( "Insufficient permissions to folder '%s'." ),
|
||||
fn.GetPath() );
|
||||
msg.Printf( _( "Insufficient permissions to folder '%s'." ), fn.GetPath() );
|
||||
}
|
||||
else if( !fn.FileExists() && !fn.IsDirWritable() )
|
||||
{
|
||||
msg.Printf( _( "Insufficient permissions to save file '%s'." ),
|
||||
fn.GetFullName(), fn.GetPath() );
|
||||
msg.Printf( _( "Insufficient permissions to save file '%s'." ), fn.GetFullPath() );
|
||||
}
|
||||
else if( fn.FileExists() && !fn.IsFileWritable() )
|
||||
{
|
||||
msg.Printf( _( "Insufficient permissions to save file '%s'." ),
|
||||
fn.GetFullPath() );
|
||||
msg.Printf( _( "Insufficient permissions to save file '%s'." ), fn.GetFullPath() );
|
||||
}
|
||||
|
||||
if( !msg.IsEmpty() )
|
||||
|
|
|
@ -82,6 +82,67 @@ static const std::map<int, COLOR4D> s_defaultTheme =
|
|||
{ LAYER_GERBVIEW_DRAWINGSHEET, CSS_COLOR( 0, 0, 132, 1 ) },
|
||||
{ LAYER_GERBVIEW_PAGE_LIMITS, CSS_COLOR( 132, 132, 132, 1 ) },
|
||||
|
||||
{ GERBVIEW_LAYER_ID_START, CSS_COLOR( 200, 52, 52, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 1, CSS_COLOR( 127, 200, 127, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 2, CSS_COLOR( 206, 125, 44, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 3, CSS_COLOR( 79, 203, 203, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 4, CSS_COLOR( 219, 98, 139, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 5, CSS_COLOR( 167, 165, 198, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 6, CSS_COLOR( 40, 204, 217, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 7, CSS_COLOR( 232, 178, 167, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 8, CSS_COLOR( 242, 237, 161, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 9, CSS_COLOR( 141, 203, 129, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 10, CSS_COLOR( 237, 124, 51, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 11, CSS_COLOR( 91, 195, 235, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 12, CSS_COLOR( 247, 111, 142, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 13, CSS_COLOR( 77, 127, 196, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 14, CSS_COLOR( 200, 52, 52, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 15, CSS_COLOR( 127, 200, 127, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 16, CSS_COLOR( 206, 125, 44, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 17, CSS_COLOR( 79, 203, 203, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 18, CSS_COLOR( 219, 98, 139, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 19, CSS_COLOR( 167, 165, 198, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 20, CSS_COLOR( 40, 204, 217, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 21, CSS_COLOR( 232, 178, 167, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 22, CSS_COLOR( 242, 237, 161, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 23, CSS_COLOR( 141, 203, 129, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 24, CSS_COLOR( 237, 124, 51, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 25, CSS_COLOR( 91, 195, 235, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 26, CSS_COLOR( 247, 111, 142, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 27, CSS_COLOR( 77, 127, 196, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 28, CSS_COLOR( 200, 52, 52, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 29, CSS_COLOR( 127, 200, 127, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 30, CSS_COLOR( 206, 125, 44, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 31, CSS_COLOR( 79, 203, 203, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 32, CSS_COLOR( 219, 98, 139, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 33, CSS_COLOR( 167, 165, 198, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 34, CSS_COLOR( 40, 204, 217, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 35, CSS_COLOR( 232, 178, 167, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 36, CSS_COLOR( 242, 237, 161, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 37, CSS_COLOR( 141, 203, 129, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 38, CSS_COLOR( 237, 124, 51, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 39, CSS_COLOR( 91, 195, 235, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 40, CSS_COLOR( 247, 111, 142, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 41, CSS_COLOR( 77, 127, 196, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 42, CSS_COLOR( 200, 52, 52, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 43, CSS_COLOR( 127, 200, 127, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 44, CSS_COLOR( 206, 125, 44, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 45, CSS_COLOR( 79, 203, 203, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 46, CSS_COLOR( 219, 98, 139, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 47, CSS_COLOR( 167, 165, 198, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 48, CSS_COLOR( 40, 204, 217, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 49, CSS_COLOR( 232, 178, 167, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 50, CSS_COLOR( 242, 237, 161, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 51, CSS_COLOR( 141, 203, 129, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 52, CSS_COLOR( 237, 124, 51, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 53, CSS_COLOR( 91, 195, 235, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 54, CSS_COLOR( 247, 111, 142, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 55, CSS_COLOR( 77, 127, 196, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 56, CSS_COLOR( 200, 52, 52, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 57, CSS_COLOR( 127, 200, 127, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 58, CSS_COLOR( 206, 125, 44, 1 ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 59, CSS_COLOR( 79, 203, 203, 1 ) },
|
||||
|
||||
{ LAYER_ANCHOR, CSS_COLOR( 255, 38, 226, 1 ) },
|
||||
{ LAYER_LOCKED_ITEM_SHADOW, CSS_COLOR( 255, 38, 226, 0.5 ) },
|
||||
{ LAYER_CONFLICTS_SHADOW, CSS_COLOR( 255, 0, 05, 0.5 ) },
|
||||
|
@ -235,6 +296,67 @@ static const std::map<int, COLOR4D> s_classicTheme =
|
|||
{ LAYER_GERBVIEW_DRAWINGSHEET, COLOR4D( DARKRED ) },
|
||||
{ LAYER_GERBVIEW_PAGE_LIMITS, COLOR4D( MAGENTA ) },
|
||||
|
||||
{ GERBVIEW_LAYER_ID_START, COLOR4D( RED ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 1, COLOR4D( YELLOW ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 2, COLOR4D( LIGHTMAGENTA ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 3, COLOR4D( LIGHTRED ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 4, COLOR4D( CYAN ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 5, COLOR4D( GREEN ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 6, COLOR4D( BLUE ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 7, COLOR4D( DARKGRAY ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 8, COLOR4D( MAGENTA ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 9, COLOR4D( LIGHTGRAY ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 10, COLOR4D( MAGENTA ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 11, COLOR4D( RED ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 12, COLOR4D( BROWN ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 13, COLOR4D( LIGHTGRAY ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 14, COLOR4D( BLUE ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 15, COLOR4D( GREEN ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 16, COLOR4D( RED ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 17, COLOR4D( YELLOW ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 18, COLOR4D( LIGHTMAGENTA ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 19, COLOR4D( LIGHTRED ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 20, COLOR4D( CYAN ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 21, COLOR4D( GREEN ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 22, COLOR4D( BLUE ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 23, COLOR4D( DARKGRAY ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 24, COLOR4D( MAGENTA ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 25, COLOR4D( LIGHTGRAY ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 26, COLOR4D( MAGENTA ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 27, COLOR4D( RED ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 28, COLOR4D( BROWN ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 29, COLOR4D( LIGHTGRAY ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 30, COLOR4D( BLUE ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 31, COLOR4D( GREEN ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 32, COLOR4D( RED ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 33, COLOR4D( YELLOW ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 34, COLOR4D( LIGHTMAGENTA ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 35, COLOR4D( LIGHTRED ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 36, COLOR4D( CYAN ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 37, COLOR4D( GREEN ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 38, COLOR4D( BLUE ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 39, COLOR4D( DARKGRAY ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 40, COLOR4D( MAGENTA ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 41, COLOR4D( LIGHTGRAY ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 42, COLOR4D( MAGENTA ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 43, COLOR4D( RED ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 44, COLOR4D( BROWN ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 45, COLOR4D( LIGHTGRAY ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 46, COLOR4D( BLUE ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 47, COLOR4D( GREEN ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 48, COLOR4D( RED ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 49, COLOR4D( YELLOW ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 50, COLOR4D( LIGHTMAGENTA ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 51, COLOR4D( LIGHTRED ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 52, COLOR4D( CYAN ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 53, COLOR4D( GREEN ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 54, COLOR4D( BLUE ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 55, COLOR4D( DARKGRAY ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 56, COLOR4D( MAGENTA ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 57, COLOR4D( LIGHTGRAY ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 58, COLOR4D( MAGENTA ) },
|
||||
{ GERBVIEW_LAYER_ID_START + 59, COLOR4D( RED ) },
|
||||
|
||||
{ LAYER_ANCHOR, COLOR4D( BLUE ) },
|
||||
{ LAYER_LOCKED_ITEM_SHADOW, COLOR4D( BLUE ).WithAlpha( 0.6 ) },
|
||||
{ LAYER_CONFLICTS_SHADOW, COLOR4D( RED ).WithAlpha( 0.5 ) },
|
||||
|
|
|
@ -43,26 +43,6 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
|
|||
|
||||
m_params.emplace_back( new PARAM<wxString>( "meta.name", &m_displayName, "KiCad Default" ) );
|
||||
|
||||
std::vector<COLOR4D> default_palette = {
|
||||
CSS_COLOR( 200, 52, 52, 1 ),
|
||||
CSS_COLOR( 127, 200, 127, 1 ),
|
||||
CSS_COLOR( 206, 125, 44, 1 ),
|
||||
CSS_COLOR( 79, 203, 203, 1 ),
|
||||
CSS_COLOR( 219, 98, 139, 1 ),
|
||||
CSS_COLOR( 167, 165, 198, 1 ),
|
||||
CSS_COLOR( 40, 204, 217, 1 ),
|
||||
CSS_COLOR( 232, 178, 167, 1 ),
|
||||
CSS_COLOR( 242, 237, 161, 1 ),
|
||||
CSS_COLOR( 141, 203, 129, 1 ),
|
||||
CSS_COLOR( 237, 124, 51, 1 ),
|
||||
CSS_COLOR( 91, 195, 235, 1 ),
|
||||
CSS_COLOR( 247, 111, 142, 1 ),
|
||||
CSS_COLOR( 77, 127, 196, 1 )
|
||||
};
|
||||
|
||||
// TODO(JE) in actual usage, how long does the default palette need to be?
|
||||
m_params.emplace_back( new PARAM_LIST<COLOR4D>( "palette", &m_Palette, default_palette ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "schematic.override_item_colors",
|
||||
&m_overrideSchItemColors, false ) );
|
||||
|
||||
|
@ -127,8 +107,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
|
|||
id < GERBER_DRAWLAYERS_COUNT + GERBVIEW_LAYER_ID_START; ++i, ++id )
|
||||
{
|
||||
m_params.emplace_back( new COLOR_MAP_PARAM( "gerbview.layers." + std::to_string( i ), id,
|
||||
default_palette[ i % default_palette.size() ],
|
||||
&m_colors ) );
|
||||
s_defaultTheme.at( id ), &m_colors ) );
|
||||
}
|
||||
|
||||
CLR( "board.anchor", LAYER_ANCHOR );
|
||||
|
|
|
@ -17,6 +17,7 @@ include_directories(
|
|||
|
||||
|
||||
set( DIALOGS_SRCS
|
||||
dialogs/panel_gerbview_color_settings.cpp
|
||||
dialogs/panel_gerbview_display_options.cpp
|
||||
dialogs/panel_gerbview_display_options_base.cpp
|
||||
dialogs/panel_gerbview_excellon_settings.cpp
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <pgm_base.h>
|
||||
#include <layer_ids.h>
|
||||
#include <panel_gerbview_color_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <gerbview_settings.h>
|
||||
|
||||
PANEL_GERBVIEW_COLOR_SETTINGS::PANEL_GERBVIEW_COLOR_SETTINGS( wxWindow* aParent ) :
|
||||
PANEL_COLOR_SETTINGS( aParent )
|
||||
{
|
||||
m_colorNamespace = "gerbview";
|
||||
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
GERBVIEW_SETTINGS* app_settings = mgr.GetAppSettings<GERBVIEW_SETTINGS>();
|
||||
COLOR_SETTINGS* current = mgr.GetColorSettings( app_settings->m_ColorTheme );
|
||||
|
||||
// Saved theme doesn't exist? Reset to default
|
||||
if( current->GetFilename() != app_settings->m_ColorTheme )
|
||||
app_settings->m_ColorTheme = current->GetFilename();
|
||||
|
||||
createThemeList( app_settings->m_ColorTheme );
|
||||
|
||||
// Currently this only applies to eeschema
|
||||
m_optOverrideColors->Hide();
|
||||
|
||||
m_currentSettings = new COLOR_SETTINGS( *current );
|
||||
|
||||
for( int i = GERBVIEW_LAYER_ID_START; i < GERBVIEW_LAYER_ID_START + GERBER_DRAWLAYERS_COUNT; i++ )
|
||||
m_validLayers.push_back( i );
|
||||
|
||||
for( int i = LAYER_DCODES; i < GERBVIEW_LAYER_ID_END; i++ )
|
||||
m_validLayers.push_back( i );
|
||||
|
||||
m_backgroundLayer = LAYER_GERBVIEW_BACKGROUND;
|
||||
}
|
||||
|
||||
|
||||
PANEL_GERBVIEW_COLOR_SETTINGS::~PANEL_GERBVIEW_COLOR_SETTINGS()
|
||||
{
|
||||
delete m_currentSettings;
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_GERBVIEW_COLOR_SETTINGS::TransferDataFromWindow()
|
||||
{
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
GERBVIEW_SETTINGS* app_settings = mgr.GetAppSettings<GERBVIEW_SETTINGS>();
|
||||
app_settings->m_ColorTheme = m_currentSettings->GetFilename();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool PANEL_GERBVIEW_COLOR_SETTINGS::TransferDataToWindow()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void PANEL_GERBVIEW_COLOR_SETTINGS::createSwatches()
|
||||
{
|
||||
wxString layerName;
|
||||
|
||||
for( int layer : m_validLayers )
|
||||
{
|
||||
switch( layer )
|
||||
{
|
||||
case LAYER_DCODES: layerName = _( "DCodes" ); break;
|
||||
case LAYER_NEGATIVE_OBJECTS: layerName = _( "Negative Objects" ); break;
|
||||
case LAYER_GERBVIEW_GRID: layerName = _( "Grid" ); break;
|
||||
case LAYER_GERBVIEW_AXES: layerName = _( "Axes" ); break;
|
||||
case LAYER_GERBVIEW_DRAWINGSHEET: layerName = _( "Drawing Sheet" ); break;
|
||||
case LAYER_GERBVIEW_PAGE_LIMITS: layerName = _( "Page Limits" ); break;
|
||||
case LAYER_GERBVIEW_BACKGROUND: layerName = _( "Background" ); break;
|
||||
|
||||
default:
|
||||
layerName = wxString::Format( _( "Layer %d" ), layer + 1 - GERBVIEW_LAYER_ID_START );
|
||||
break;
|
||||
}
|
||||
|
||||
createSwatch( layer, layerName );
|
||||
}
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef PANEL_GERBVIEW_COLOR_SETTINGS_H
|
||||
#define PANEL_GERBVIEW_COLOR_SETTINGS_H
|
||||
|
||||
#include <dialogs/panel_color_settings.h>
|
||||
|
||||
class PAGE_INFO;
|
||||
class FOOTPRINT_PREVIEW_PANEL;
|
||||
class TITLE_BLOCK;
|
||||
|
||||
|
||||
class PANEL_GERBVIEW_COLOR_SETTINGS : public PANEL_COLOR_SETTINGS
|
||||
{
|
||||
public:
|
||||
PANEL_GERBVIEW_COLOR_SETTINGS( wxWindow* aParent );
|
||||
|
||||
~PANEL_GERBVIEW_COLOR_SETTINGS() override;
|
||||
|
||||
protected:
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
|
||||
void createSwatches() override;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -37,6 +37,7 @@
|
|||
#include <settings/settings_manager.h>
|
||||
#include <dialogs/panel_gerbview_display_options.h>
|
||||
#include <dialogs/panel_gerbview_excellon_settings.h>
|
||||
#include <dialogs/panel_gerbview_color_settings.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <wx/ffile.h>
|
||||
|
||||
|
@ -71,6 +72,9 @@ static struct IFACE : public KIFACE_BASE
|
|||
case PANEL_GBR_EXCELLON_OPTIONS:
|
||||
return new PANEL_GERBVIEW_EXCELLON_SETTINGS( aParent );
|
||||
|
||||
case PANEL_GBR_COLORS:
|
||||
return new PANEL_GERBVIEW_COLOR_SETTINGS( aParent );
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
|
|
@ -57,22 +57,14 @@ GERBVIEW_RENDER_SETTINGS::GERBVIEW_RENDER_SETTINGS()
|
|||
|
||||
void GERBVIEW_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
|
||||
{
|
||||
size_t palette_size = aSettings->m_Palette.size();
|
||||
size_t palette_idx = 0;
|
||||
|
||||
// Layers to draw gerber data read from gerber files:
|
||||
for( int i = GERBVIEW_LAYER_ID_START;
|
||||
i < GERBVIEW_LAYER_ID_START + GERBER_DRAWLAYERS_COUNT; i++ )
|
||||
{
|
||||
COLOR4D baseColor = aSettings->GetColor( i );
|
||||
|
||||
if( baseColor == COLOR4D::UNSPECIFIED )
|
||||
baseColor = aSettings->m_Palette[ ( palette_idx++ ) % palette_size ];
|
||||
|
||||
m_layerColors[i] = baseColor;
|
||||
m_layerColorsHi[i] = baseColor.Brightened( 0.5 );
|
||||
m_layerColorsSel[i] = baseColor.Brightened( 0.8 );
|
||||
m_layerColorsDark[i] = baseColor.Darkened( 0.25 );
|
||||
m_layerColors[i] = aSettings->GetColor( i );
|
||||
m_layerColorsHi[i] = m_layerColors[i].Brightened( 0.5 );
|
||||
m_layerColorsSel[i] = m_layerColors[i].Brightened( 0.8 );
|
||||
m_layerColorsDark[i] = m_layerColors[i].Darkened( 0.25 );
|
||||
}
|
||||
|
||||
// Draw layers specific to Gerbview:
|
||||
|
|
|
@ -94,6 +94,7 @@ enum FRAME_T
|
|||
PANEL_GBR_DISPLAY_OPTIONS,
|
||||
PANEL_GBR_EDIT_OPTIONS,
|
||||
PANEL_GBR_EXCELLON_OPTIONS,
|
||||
PANEL_GBR_COLORS,
|
||||
|
||||
PANEL_DS_DISPLAY_OPTIONS,
|
||||
PANEL_DS_COLORS,
|
||||
|
|
|
@ -51,13 +51,6 @@ using KIGFX::COLOR4D;
|
|||
class COLOR_SETTINGS : public JSON_SETTINGS
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* m_Pallete stores a list of colors that are used, in order, when a list of colors needs to
|
||||
* be generated for an application. For example, layer colors in GerbView, or default layer
|
||||
* colors in PcbNew.
|
||||
*/
|
||||
std::vector<COLOR4D> m_Palette;
|
||||
|
||||
explicit COLOR_SETTINGS( const wxString& aFilename = wxT( "user" ),
|
||||
bool aAbsolutePath = false );
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
|
@ -18,21 +18,15 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <regex>
|
||||
|
||||
#include <pgm_base.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <footprint_editor_settings.h>
|
||||
#include <layer_ids.h>
|
||||
#include <page_info.h>
|
||||
#include <title_block.h>
|
||||
#include <panel_fp_editor_color_settings.h>
|
||||
|
||||
|
||||
PANEL_FP_EDITOR_COLOR_SETTINGS::PANEL_FP_EDITOR_COLOR_SETTINGS( wxWindow* aParent ) :
|
||||
PANEL_COLOR_SETTINGS( aParent ),
|
||||
m_page( nullptr ),
|
||||
m_titleBlock( nullptr )
|
||||
PANEL_COLOR_SETTINGS( aParent )
|
||||
{
|
||||
// Currently this only applies to eeschema
|
||||
m_optOverrideColors->Hide();
|
||||
|
@ -81,8 +75,6 @@ PANEL_FP_EDITOR_COLOR_SETTINGS::PANEL_FP_EDITOR_COLOR_SETTINGS( wxWindow* aParen
|
|||
PANEL_FP_EDITOR_COLOR_SETTINGS::~PANEL_FP_EDITOR_COLOR_SETTINGS()
|
||||
{
|
||||
delete m_currentSettings;
|
||||
delete m_page;
|
||||
delete m_titleBlock;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 Jon Evans <jon@craftyjon.com>
|
||||
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
|
@ -40,17 +40,6 @@ protected:
|
|||
bool TransferDataToWindow() override;
|
||||
|
||||
void createSwatches() override;
|
||||
|
||||
enum COLOR_CONTEXT_ID
|
||||
{
|
||||
ID_COPY = wxID_HIGHEST + 1,
|
||||
ID_PASTE,
|
||||
ID_REVERT
|
||||
};
|
||||
|
||||
private:
|
||||
PAGE_INFO* m_page;
|
||||
TITLE_BLOCK* m_titleBlock;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue