Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
KiCad
KiCad Source Code
kicad
Commits
8660b4c1
Commit
8660b4c1
authored
Feb 03, 2020
by
Jon Evans
🎸
Browse files
ADDED: New color theme editor and multi-theme support
parent
1e104d5b
Changes
40
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
2552 additions
and
491 deletions
+2552
-491
common/CMakeLists.txt
common/CMakeLists.txt
+3
-0
common/dialogs/panel_color_settings.cpp
common/dialogs/panel_color_settings.cpp
+39
-0
common/dialogs/panel_color_settings.h
common/dialogs/panel_color_settings.h
+39
-0
common/dialogs/panel_color_settings_base.cpp
common/dialogs/panel_color_settings_base.cpp
+163
-0
common/dialogs/panel_color_settings_base.fbp
common/dialogs/panel_color_settings_base.fbp
+1043
-0
common/dialogs/panel_color_settings_base.h
common/dialogs/panel_color_settings_base.h
+77
-0
common/eda_draw_frame.cpp
common/eda_draw_frame.cpp
+6
-2
common/layer_id.cpp
common/layer_id.cpp
+124
-0
common/settings/app_settings.cpp
common/settings/app_settings.cpp
+2
-0
common/settings/color_settings.cpp
common/settings/color_settings.cpp
+0
-1
common/settings/settings_manager.cpp
common/settings/settings_manager.cpp
+103
-7
eeschema/CMakeLists.txt
eeschema/CMakeLists.txt
+1
-1
eeschema/class_libentry.cpp
eeschema/class_libentry.cpp
+3
-2
eeschema/dialogs/dialog_edit_line_style.cpp
eeschema/dialogs/dialog_edit_line_style.cpp
+13
-6
eeschema/dialogs/panel_eeschema_color_settings.cpp
eeschema/dialogs/panel_eeschema_color_settings.cpp
+674
-0
eeschema/dialogs/panel_eeschema_color_settings.h
eeschema/dialogs/panel_eeschema_color_settings.h
+130
-0
eeschema/eeschema.cpp
eeschema/eeschema.cpp
+0
-22
eeschema/eeschema_config.cpp
eeschema/eeschema_config.cpp
+8
-5
eeschema/general.h
eeschema/general.h
+3
-11
eeschema/lib_bezier.cpp
eeschema/lib_bezier.cpp
+3
-2
eeschema/plot_schematic_DXF.cpp
eeschema/plot_schematic_DXF.cpp
+3
-0
eeschema/plot_schematic_HPGL.cpp
eeschema/plot_schematic_HPGL.cpp
+3
-0
eeschema/plot_schematic_PDF.cpp
eeschema/plot_schematic_PDF.cpp
+3
-0
eeschema/plot_schematic_PS.cpp
eeschema/plot_schematic_PS.cpp
+3
-0
eeschema/plot_schematic_SVG.cpp
eeschema/plot_schematic_SVG.cpp
+2
-0
eeschema/sch_base_frame.cpp
eeschema/sch_base_frame.cpp
+19
-0
eeschema/sch_base_frame.h
eeschema/sch_base_frame.h
+7
-0
eeschema/sch_draw_panel.cpp
eeschema/sch_draw_panel.cpp
+10
-1
eeschema/sch_legacy_plugin.cpp
eeschema/sch_legacy_plugin.cpp
+1
-1
eeschema/sch_line.cpp
eeschema/sch_line.cpp
+3
-14
eeschema/sch_line.h
eeschema/sch_line.h
+1
-2
eeschema/sch_painter.cpp
eeschema/sch_painter.cpp
+6
-1
eeschema/widgets/widget_eeschema_color_config.cpp
eeschema/widgets/widget_eeschema_color_config.cpp
+0
-310
eeschema/widgets/widget_eeschema_color_config.h
eeschema/widgets/widget_eeschema_color_config.h
+0
-77
include/eda_draw_frame.h
include/eda_draw_frame.h
+5
-4
include/layers_id_colors_and_visibility.h
include/layers_id_colors_and_visibility.h
+4
-0
include/settings/app_settings.h
include/settings/app_settings.h
+3
-0
include/settings/color_settings.h
include/settings/color_settings.h
+10
-0
include/settings/settings_manager.h
include/settings/settings_manager.h
+35
-3
qa/eeschema/mocks_eeschema.cpp
qa/eeschema/mocks_eeschema.cpp
+0
-19
No files found.
common/CMakeLists.txt
View file @
8660b4c1
...
...
@@ -179,6 +179,8 @@ set( COMMON_DLG_SRCS
dialogs/dialog_print_generic.cpp
dialogs/dialog_print_generic_base.cpp
dialogs/dialog_text_entry.cpp
dialogs/panel_color_settings_base.cpp
dialogs/panel_color_settings.cpp
dialogs/panel_common_settings.cpp
dialogs/panel_common_settings_base.cpp
dialogs/panel_hotkeys_editor.cpp
...
...
@@ -310,6 +312,7 @@ set( COMMON_SRCS
kiway_player.cpp
languages_menu.cpp
launch_ext.cpp
layer_id.cpp
lib_id.cpp
lib_table_base.cpp
lib_tree_model.cpp
...
...
common/dialogs/panel_color_settings.cpp
0 → 100644
View file @
8660b4c1
/*
* 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 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 <confirm.h>
#include <launch_ext.h>
#include <panel_color_settings.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
PANEL_COLOR_SETTINGS
::
PANEL_COLOR_SETTINGS
(
wxWindow
*
aParent
)
:
PANEL_COLOR_SETTINGS_BASE
(
aParent
)
{
}
void
PANEL_COLOR_SETTINGS
::
OnBtnOpenThemeFolderClicked
(
wxCommandEvent
&
event
)
{
wxString
cmd
;
wxString
dir
(
Pgm
().
GetSettingsManager
().
GetColorSettingsPath
()
);
LaunchExternal
(
dir
);
}
common/dialogs/panel_color_settings.h
0 → 100644
View file @
8660b4c1
/*
* 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 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_COLOR_SETTINGS_H
#define PANEL_COLOR_SETTINGS_H
#include <panel_color_settings_base.h>
class
PANEL_COLOR_SETTINGS
:
public
PANEL_COLOR_SETTINGS_BASE
{
public:
PANEL_COLOR_SETTINGS
(
wxWindow
*
aParent
);
~
PANEL_COLOR_SETTINGS
()
=
default
;
protected:
void
OnBtnOpenThemeFolderClicked
(
wxCommandEvent
&
event
)
override
;
};
#endif
common/dialogs/panel_color_settings_base.cpp
0 → 100644
View file @
8660b4c1
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "panel_color_settings_base.h"
///////////////////////////////////////////////////////////////////////////
PANEL_COLOR_SETTINGS_BASE
::
PANEL_COLOR_SETTINGS_BASE
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
,
const
wxString
&
name
)
:
wxPanel
(
parent
,
id
,
pos
,
size
,
style
,
name
)
{
m_mainSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
wxBoxSizer
*
bControlSizer
;
bControlSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
m_staticText9
=
new
wxStaticText
(
this
,
wxID_ANY
,
_
(
"Theme:"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticText9
->
Wrap
(
-
1
);
bControlSizer
->
Add
(
m_staticText9
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
wxString
m_cbThemeChoices
[]
=
{
_
(
"User"
)
};
int
m_cbThemeNChoices
=
sizeof
(
m_cbThemeChoices
)
/
sizeof
(
wxString
);
m_cbTheme
=
new
wxChoice
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
m_cbThemeNChoices
,
m_cbThemeChoices
,
0
);
m_cbTheme
->
SetSelection
(
0
);
m_cbTheme
->
SetMinSize
(
wxSize
(
150
,
-
1
)
);
bControlSizer
->
Add
(
m_cbTheme
,
0
,
wxALL
,
5
);
m_btnSave
=
new
wxButton
(
this
,
wxID_ANY
,
_
(
"&Save"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_btnSave
->
Enable
(
false
);
m_btnSave
->
SetToolTip
(
_
(
"Save the active color theme"
)
);
bControlSizer
->
Add
(
m_btnSave
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
m_btnNew
=
new
wxButton
(
this
,
wxID_ANY
,
_
(
"&New"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_btnNew
->
SetToolTip
(
_
(
"Create a new color theme based on the current one"
)
);
bControlSizer
->
Add
(
m_btnNew
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
m_btnRename
=
new
wxButton
(
this
,
wxID_ANY
,
_
(
"Rename"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_btnRename
->
Enable
(
false
);
m_btnRename
->
SetToolTip
(
_
(
"The
\"
User
\"
theme cannot be renamed"
)
);
bControlSizer
->
Add
(
m_btnRename
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
bControlSizer
->
Add
(
0
,
0
,
1
,
wxEXPAND
,
5
);
m_btnReset
=
new
wxButton
(
this
,
wxID_ANY
,
_
(
"&Reset colors to default"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_btnReset
->
SetToolTip
(
_
(
"Reset all colors in this theme to the KiCad defaults"
)
);
bControlSizer
->
Add
(
m_btnReset
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
m_btnOpenFolder
=
new
wxButton
(
this
,
wxID_ANY
,
_
(
"Open theme folder"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_btnOpenFolder
->
SetToolTip
(
_
(
"Open the folder containing color themes"
)
);
bControlSizer
->
Add
(
m_btnOpenFolder
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
m_mainSizer
->
Add
(
bControlSizer
,
0
,
wxEXPAND
,
5
);
m_panelThemeProperties
=
new
wxPanel
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxTAB_TRAVERSAL
);
m_panelThemeProperties
->
Hide
();
m_sizerThemeProperties
=
new
wxBoxSizer
(
wxHORIZONTAL
);
m_staticText6
=
new
wxStaticText
(
m_panelThemeProperties
,
wxID_ANY
,
_
(
"Theme name:"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticText6
->
Wrap
(
-
1
);
m_sizerThemeProperties
->
Add
(
m_staticText6
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
m_txtThemeName
=
new
wxTextCtrl
(
m_panelThemeProperties
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
#ifdef __WXGTK__
if
(
!
m_txtThemeName
->
HasFlag
(
wxTE_MULTILINE
)
)
{
m_txtThemeName
->
SetMaxLength
(
48
);
}
#else
m_txtThemeName
->
SetMaxLength
(
48
);
#endif
m_txtThemeName
->
SetToolTip
(
_
(
"Name of the theme"
)
);
m_txtThemeName
->
SetMinSize
(
wxSize
(
200
,
-
1
)
);
m_sizerThemeProperties
->
Add
(
m_txtThemeName
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
m_sizerThemeProperties
->
Add
(
24
,
0
,
0
,
wxEXPAND
,
5
);
m_staticText7
=
new
wxStaticText
(
m_panelThemeProperties
,
wxID_ANY
,
_
(
"Filename:"
),
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_staticText7
->
Wrap
(
-
1
);
m_sizerThemeProperties
->
Add
(
m_staticText7
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
m_txtFilename
=
new
wxTextCtrl
(
m_panelThemeProperties
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_txtFilename
->
SetToolTip
(
_
(
"Filename to save the theme to (must end in .json)"
)
);
m_txtFilename
->
SetMinSize
(
wxSize
(
200
,
-
1
)
);
m_sizerThemeProperties
->
Add
(
m_txtFilename
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
m_lblThemePropertiesError
=
new
wxStaticText
(
m_panelThemeProperties
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
m_lblThemePropertiesError
->
Wrap
(
-
1
);
m_lblThemePropertiesError
->
SetForegroundColour
(
wxColour
(
255
,
0
,
0
)
);
m_sizerThemeProperties
->
Add
(
m_lblThemePropertiesError
,
1
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
m_panelThemeProperties
->
SetSizer
(
m_sizerThemeProperties
);
m_panelThemeProperties
->
Layout
();
m_sizerThemeProperties
->
Fit
(
m_panelThemeProperties
);
m_mainSizer
->
Add
(
m_panelThemeProperties
,
0
,
wxEXPAND
|
wxALL
,
0
);
m_colorsMainSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
m_colorsListWindow
=
new
wxScrolledWindow
(
this
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
wxVSCROLL
);
m_colorsListWindow
->
SetScrollRate
(
5
,
5
);
m_colorsListWindow
->
SetMinSize
(
wxSize
(
240
,
-
1
)
);
m_colorsGridSizer
=
new
wxFlexGridSizer
(
0
,
2
,
5
,
5
);
m_colorsGridSizer
->
AddGrowableCol
(
0
);
m_colorsGridSizer
->
SetFlexibleDirection
(
wxHORIZONTAL
);
m_colorsGridSizer
->
SetNonFlexibleGrowMode
(
wxFLEX_GROWMODE_NONE
);
m_colorsListWindow
->
SetSizer
(
m_colorsGridSizer
);
m_colorsListWindow
->
Layout
();
m_colorsGridSizer
->
Fit
(
m_colorsListWindow
);
m_colorsMainSizer
->
Add
(
m_colorsListWindow
,
0
,
wxEXPAND
|
wxALL
,
5
);
m_mainSizer
->
Add
(
m_colorsMainSizer
,
1
,
wxEXPAND
,
5
);
this
->
SetSizer
(
m_mainSizer
);
this
->
Layout
();
// Connect Events
this
->
Connect
(
wxEVT_SIZE
,
wxSizeEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnSize
)
);
m_cbTheme
->
Connect
(
wxEVT_COMMAND_CHOICE_SELECTED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnThemeChanged
),
NULL
,
this
);
m_btnSave
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnBtnSaveClicked
),
NULL
,
this
);
m_btnNew
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnBtnNewClicked
),
NULL
,
this
);
m_btnRename
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnBtnRenameClicked
),
NULL
,
this
);
m_btnReset
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnBtnResetClicked
),
NULL
,
this
);
m_btnOpenFolder
->
Connect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnBtnOpenThemeFolderClicked
),
NULL
,
this
);
m_txtThemeName
->
Connect
(
wxEVT_COMMAND_TEXT_UPDATED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnThemeNameChanged
),
NULL
,
this
);
m_txtFilename
->
Connect
(
wxEVT_CHAR
,
wxKeyEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnFilenameChar
),
NULL
,
this
);
m_txtFilename
->
Connect
(
wxEVT_COMMAND_TEXT_UPDATED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnFilenameChanged
),
NULL
,
this
);
}
PANEL_COLOR_SETTINGS_BASE
::~
PANEL_COLOR_SETTINGS_BASE
()
{
// Disconnect Events
this
->
Disconnect
(
wxEVT_SIZE
,
wxSizeEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnSize
)
);
m_cbTheme
->
Disconnect
(
wxEVT_COMMAND_CHOICE_SELECTED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnThemeChanged
),
NULL
,
this
);
m_btnSave
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnBtnSaveClicked
),
NULL
,
this
);
m_btnNew
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnBtnNewClicked
),
NULL
,
this
);
m_btnRename
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnBtnRenameClicked
),
NULL
,
this
);
m_btnReset
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnBtnResetClicked
),
NULL
,
this
);
m_btnOpenFolder
->
Disconnect
(
wxEVT_COMMAND_BUTTON_CLICKED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnBtnOpenThemeFolderClicked
),
NULL
,
this
);
m_txtThemeName
->
Disconnect
(
wxEVT_COMMAND_TEXT_UPDATED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnThemeNameChanged
),
NULL
,
this
);
m_txtFilename
->
Disconnect
(
wxEVT_CHAR
,
wxKeyEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnFilenameChar
),
NULL
,
this
);
m_txtFilename
->
Disconnect
(
wxEVT_COMMAND_TEXT_UPDATED
,
wxCommandEventHandler
(
PANEL_COLOR_SETTINGS_BASE
::
OnFilenameChanged
),
NULL
,
this
);
}
common/dialogs/panel_color_settings_base.fbp
0 → 100644
View file @
8660b4c1
This diff is collapsed.
Click to expand it.
common/dialogs/panel_color_settings_base.h
0 → 100644
View file @
8660b4c1
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/panel.h>
#include <wx/scrolwin.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class PANEL_COLOR_SETTINGS_BASE
///////////////////////////////////////////////////////////////////////////////
class
PANEL_COLOR_SETTINGS_BASE
:
public
wxPanel
{
private:
protected:
wxBoxSizer
*
m_mainSizer
;
wxStaticText
*
m_staticText9
;
wxChoice
*
m_cbTheme
;
wxButton
*
m_btnSave
;
wxButton
*
m_btnNew
;
wxButton
*
m_btnRename
;
wxButton
*
m_btnReset
;
wxButton
*
m_btnOpenFolder
;
wxPanel
*
m_panelThemeProperties
;
wxBoxSizer
*
m_sizerThemeProperties
;
wxStaticText
*
m_staticText6
;
wxTextCtrl
*
m_txtThemeName
;
wxStaticText
*
m_staticText7
;
wxTextCtrl
*
m_txtFilename
;
wxStaticText
*
m_lblThemePropertiesError
;
wxBoxSizer
*
m_colorsMainSizer
;
wxScrolledWindow
*
m_colorsListWindow
;
wxFlexGridSizer
*
m_colorsGridSizer
;
// Virtual event handlers, overide them in your derived class
virtual
void
OnSize
(
wxSizeEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnThemeChanged
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnBtnSaveClicked
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnBtnNewClicked
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnBtnRenameClicked
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnBtnResetClicked
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnBtnOpenThemeFolderClicked
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnThemeNameChanged
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnFilenameChar
(
wxKeyEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
OnFilenameChanged
(
wxCommandEvent
&
event
)
{
event
.
Skip
();
}
public:
PANEL_COLOR_SETTINGS_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
826
,
300
),
long
style
=
wxTAB_TRAVERSAL
,
const
wxString
&
name
=
wxEmptyString
);
~
PANEL_COLOR_SETTINGS_BASE
();
};
common/eda_draw_frame.cpp
View file @
8660b4c1
...
...
@@ -88,6 +88,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_showPageLimits
=
false
;
m_drawBgColor
=
COLOR4D
(
BLACK
);
// the background color of the draw canvas:
// BLACK for Pcbnew, BLACK or WHITE for eeschema
m_colorSettings
=
nullptr
;
m_MsgFrameHeight
=
EDA_MSG_PANEL
::
GetRequiredHeight
();
m_zoomLevelCoeff
=
1.0
;
m_userUnits
=
EDA_UNITS
::
MILLIMETRES
;
...
...
@@ -839,7 +840,10 @@ void EDA_DRAW_FRAME::RecreateToolbars()
}
COLOR
4D
EDA_DRAW_FRAME
::
Get
LayerColor
(
SCH_LAYER_ID
aLayer
)
COLOR
_SETTINGS
*
EDA_DRAW_FRAME
::
Get
ColorSettings
(
)
{
return
Pgm
().
GetSettingsManager
().
GetColorSettings
()
->
GetColor
(
aLayer
);
if
(
!
m_colorSettings
)
m_colorSettings
=
Pgm
().
GetSettingsManager
().
GetColorSettings
();
return
m_colorSettings
;
}
common/layer_id.cpp
0 → 100644
View file @
8660b4c1
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 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 <layers_id_colors_and_visibility.h>
#include <wx/wx.h>
wxString
LayerName
(
SCH_LAYER_ID
aLayer
)
{
switch
(
aLayer
)
{
case
LAYER_WIRE
:
return
_
(
"Wire"
);
case
LAYER_BUS
:
return
_
(
"Bus"
);
case
LAYER_JUNCTION
:
return
_
(
"Junction"
);
case
LAYER_LOCLABEL
:
return
_
(
"Label"
);
case
LAYER_GLOBLABEL
:
return
_
(
"Global label"
);
case
LAYER_HIERLABEL
:
return
_
(
"Hierarchical label"
);
case
LAYER_PINNUM
:
return
_
(
"Pin number"
);
case
LAYER_PINNAM
:
return
_
(
"Pin name"
);
case
LAYER_REFERENCEPART
:
return
_
(
"Reference"
);
case
LAYER_VALUEPART
:
return
_
(
"Value"
);
case
LAYER_FIELDS
:
return
_
(
"Fields"
);
case
LAYER_DEVICE
:
return
_
(
"Body outline"
);
case
LAYER_NOTES
:
return
_
(
"Notes"
);
case
LAYER_NETNAM
:
return
_
(
"Net name"
);
case
LAYER_PIN
:
return
_
(
"Pin"
);
case
LAYER_SHEET
:
return
_
(
"Sheet"
);
case
LAYER_SHEETNAME
:
return
_
(
"Sheet name"
);
case
LAYER_SHEETFILENAME
:
return
_
(
"Sheet file name"
);
case
LAYER_SHEETLABEL
:
return
_
(
"Sheet label"
);
case
LAYER_NOCONNECT
:
return
_
(
"No connect symbol"
);
case
LAYER_ERC_WARN
:
return
_
(
"ERC warning"
);
case
LAYER_ERC_ERR
:
return
_
(
"ERC error"
);
case
LAYER_DEVICE_BACKGROUND
:
return
_
(
"Body background"
);
case
LAYER_SHEET_BACKGROUND
:
return
_
(
"Sheet background"
);
case
LAYER_SCHEMATIC_GRID
:
return
_
(
"Grid"
);
case
LAYER_SCHEMATIC_BACKGROUND
:
return
_
(
"Background"
);
case
LAYER_SCHEMATIC_CURSOR
:
return
_
(
"Cursor"
);
case
LAYER_BRIGHTENED
:
return
_
(
"Highlighted items"
);
case
LAYER_HIDDEN
:
return
_
(
"Hidden item"
);
case
LAYER_SELECTION_SHADOWS
:
return
_
(
"Selection highlight"
);
case
LAYER_SCHEMATIC_WORKSHEET
:
return
_
(
"Worksheet"
);
default:
return
wxEmptyString
;
}
}
\ No newline at end of file
common/settings/app_settings.cpp
View file @
8660b4c1
...
...
@@ -82,6 +82,8 @@ APP_SETTINGS_BASE::APP_SETTINGS_BASE( std::string aFilename, int aSchemaVersion
m_params
.
emplace_back
(
new
PARAM
<
int
>
(
"system.units"
,
&
m_System
.
units
,
static_cast
<
int
>
(
EDA_UNITS
::
MILLIMETRES
)
)
);
m_params
.
emplace_back
(
new
PARAM
<
wxString
>
(
"appearance.color_theme"
,
&
m_ColorTheme
,
"user"
)
);
addParamsForWindow
(
&
m_Window
,
"window"
);
}
...
...
common/settings/color_settings.cpp
View file @
8660b4c1
...
...
@@ -120,7 +120,6 @@ COLOR_SETTINGS::COLOR_SETTINGS( std::string aFilename ) :
CLR
(
"board.footprint_text_invisible"
,
LAYER_MOD_TEXT_INVISIBLE
,
COLOR4D
(
LIGHTGRAY
)
);
CLR
(
"board.grid"
,
LAYER_GRID
,
COLOR4D
(
DARKGRAY
)
);
CLR
(
"board.grid_axes"
,
LAYER_GRID_AXES
,
COLOR4D
(
LIGHTGRAY
)
);
CLR
(
"board.microvia"
,
LAYER_VIA_MICROVIA
,
COLOR4D
(
LIGHTGRAY
)
);
CLR
(
"board.no_connect"
,
LAYER_NO_CONNECTS
,
COLOR4D
(
BLUE
)
);
CLR
(
"board.pad_back"
,
LAYER_PAD_BK
,
COLOR4D
(
GREEN
)
);
CLR
(
"board.pad_front"
,
LAYER_PAD_FR
,
COLOR4D
(
RED
)
);
...
...
common/settings/settings_manager.cpp
View file @
8660b4c1
...
...
@@ -58,9 +58,7 @@ SETTINGS_MANAGER::SETTINGS_MANAGER() :
m_common_settings
=
static_cast
<
COMMON_SETTINGS
*>
(
RegisterSettings
(
new
COMMON_SETTINGS
,
false
)
);
// create the default color settings
m_color_settings
[
"default"
]
=
static_cast
<
COLOR_SETTINGS
*>
(
RegisterSettings
(
new
COLOR_SETTINGS
)
);
loadAllColorSettings
();
}
SETTINGS_MANAGER
::~
SETTINGS_MANAGER
()
...
...
@@ -150,7 +148,7 @@ void SETTINGS_MANAGER::FlushAndRelease( JSON_SETTINGS* aSettings )
}
COLOR_SETTINGS
*
SETTINGS_MANAGER
::
GetColorSettings
(
std
::
s
tring
aName
)
COLOR_SETTINGS
*
SETTINGS_MANAGER
::
GetColorSettings
(
const
wxS
tring
&
aName
)
{
COLOR_SETTINGS
*
ret
=
nullptr
;
...
...
@@ -160,14 +158,112 @@ COLOR_SETTINGS* SETTINGS_MANAGER::GetColorSettings( std::string aName )
}
catch
(
std
::
out_of_range
&
)
{
if
(
!
aName
.
empty
()
)
ret
=
loadColorSettingsByName
(
aName
);
// This had better work
ret
=
m_color_settings
.
at
(
"default"
);
if
(
!
ret
)
ret
=
m_color_settings
.
at
(
"user"
);
}
return
ret
;
}
COLOR_SETTINGS
*
SETTINGS_MANAGER
::
loadColorSettingsByName
(
const
wxString
&
aName
)
{
wxLogTrace
(
traceSettings
,
"Attempting to load color theme %s"
,
aName
);
wxFileName
fn
(
GetColorSettingsPath
(),
aName
,
"json"
);
if
(
!
fn
.
IsOk
()
||
!
fn
.
Exists
()
)
{
wxLogTrace
(
traceSettings
,
"Theme file %s.json not found, falling back to user"
,
aName
);
return
nullptr
;
}
auto
cs
=
static_cast
<
COLOR_SETTINGS
*>
(
RegisterSettings
(
new
COLOR_SETTINGS
(
aName
.
ToStdString
()
)
)
);
if
(
cs
->
GetFilename
()
!=
aName
.
ToStdString
()
)
{
wxLogTrace
(
traceSettings
,
"Warning: stored filename is actually %s, "
,
cs
->
GetFilename
()
);
}
m_color_settings
[
aName
]
=
cs
;
return
cs
;
}
class
COLOR_SETTINGS_LOADER
:
public
wxDirTraverser
{
private:
std
::
function
<
void
(
const
wxString
&
)
>
m_action
;
public:
explicit
COLOR_SETTINGS_LOADER
(
std
::
function
<
void
(
const
wxString
&
)
>
aAction
)
:
m_action
(
std
::
move
(
aAction
)
)
{
}
wxDirTraverseResult
OnFile
(
const
wxString
&
aFilePath
)
override