Skip to content

Commit 39e99a4

Browse files
committed
Add preference for 3d view copper color
1 parent 6a7696e commit 39e99a4

6 files changed

Lines changed: 18 additions & 6 deletions

File tree

src/canvas3d/canvas3d_base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Color Canvas3DBase::get_layer_color(int layer) const
3838
if (use_layer_colors && appearance.layer_colors.count(layer)) {
3939
return appearance.layer_colors.at(layer);
4040
}
41-
return {1, .8, 0};
41+
return copper_color;
4242
}
4343

4444
if (layer == BoardLayers::TOP_MASK || layer == BoardLayers::BOTTOM_MASK)

src/canvas3d/canvas3d_base.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class Canvas3DBase {
5656
GET_SET_PICK(show_copper, bool)
5757
GET_SET_PICK(show_points, bool)
5858
GET_SET(use_layer_colors, bool)
59+
GET_SET(copper_color, Color)
5960
GET_SET(solder_mask_color, Color)
6061
GET_SET(silkscreen_color, Color)
6162
GET_SET(substrate_color, Color)
@@ -127,6 +128,7 @@ class Canvas3DBase {
127128
bool show_copper = true;
128129
bool show_points = false;
129130
Color solder_mask_color = {0, .5, 0};
131+
Color copper_color = {1, .8, 0};
130132
Color silkscreen_color = {1, 1, 1};
131133
Color substrate_color = {.2, .15, 0};
132134
float explode = 0;

src/imp/3d/3d_view.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ void View3DWindow::apply_preferences(const Preferences &prefs)
633633
canvas->set_background_top_color(prefs.view_3d.bg_top_color);
634634
set_color_button_color(background_bottom_color_button, prefs.view_3d.bg_bottom_color);
635635
canvas->set_background_bottom_color(prefs.view_3d.bg_bottom_color);
636+
canvas->set_copper_color(prefs.view_3d.copper_color);
636637

637638
spnav_buttons = prefs.spacenav.buttons;
638639
const auto av = ActionCatalogItem::AVAILABLE_IN_3D;

src/pool-prj-mgr/preferences/preferences_window_misc.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ MiscPreferencesEditor::MiscPreferencesEditor(Preferences &prefs) : preferences(p
106106
preferences, preferences.view_3d.silkscreen_color));
107107
gr->add_row(*r);
108108
}
109+
{
110+
auto r = Gtk::manage(new PreferencesRowColorButton("Copper color", "Default copper color", preferences,
111+
preferences.view_3d.copper_color));
112+
gr->add_row(*r);
113+
}
109114
{
110115
auto r = Gtk::manage(new PreferencesRowColorButton("Substrate color", "Default substrate color",
111116
preferences, preferences.view_3d.substrate_color));

src/preferences/preferences.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ json View3DPreferences::serialize() const
220220
json j;
221221
j["use_ortho_projection"] = use_ortho_projection;
222222
j["solder_mask_color"] = color_to_json(solder_mask_color);
223+
j["copper_color"] = color_to_json(copper_color);
223224
j["silkscreen_color"] = color_to_json(silkscreen_color);
224225
j["substrate_color"] = color_to_json(substrate_color);
225226
j["bg_top_color"] = color_to_json(bg_top_color);
@@ -232,6 +233,8 @@ void View3DPreferences::load_from_json(const json &j)
232233
use_ortho_projection = j.value("use_ortho_projection", false);
233234
if (j.count("solder_mask_color"))
234235
solder_mask_color = color_from_json(j.at("solder_mask_color"));
236+
if (j.count("copper_color"))
237+
copper_color = color_from_json(j.at("copper_color"));
235238
if (j.count("silkscreen_color"))
236239
silkscreen_color = color_from_json(j.at("silkscreen_color"));
237240
if (j.count("substrate_color"))

src/preferences/preferences.hpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ class BoardPreferences {
4848
class View3DPreferences {
4949
public:
5050
bool use_ortho_projection = false;
51-
Color solder_mask_color = Color(0, .5, 0);
52-
Color silkscreen_color = Color(1, 1, 1);
53-
Color substrate_color = Color(.2, .15, 0);
54-
Color bg_top_color = Color(.2, .2, .4);
55-
Color bg_bottom_color = Color(.59, .59, .66);
51+
Color solder_mask_color = {0, .5, 0};
52+
Color copper_color = {1, .8, 0};
53+
Color silkscreen_color = {1, 1, 1};
54+
Color substrate_color = {.2, .15, 0};
55+
Color bg_top_color = {.2, .2, .4};
56+
Color bg_bottom_color = {.59, .59, .66};
5657

5758
void load_from_json(const json &j);
5859
json serialize() const;

0 commit comments

Comments
 (0)