projects
/
ardour.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
avoid doing needless duplicate work in Selection::add (TimeAxisView*)
[ardour.git]
/
gtk2_ardour
/
color_theme_manager.cc
diff --git
a/gtk2_ardour/color_theme_manager.cc
b/gtk2_ardour/color_theme_manager.cc
index b7dc9b303ac8de6c4987ee16e17b95e6176574f4..013a0764d0360748dec3c9aca1d5aeb125e24d0d 100644
(file)
--- a/
gtk2_ardour/color_theme_manager.cc
+++ b/
gtk2_ardour/color_theme_manager.cc
@@
-1,5
+1,5
@@
/*
/*
- Copyright (C) 2000-20
07
Paul Davis
+ Copyright (C) 2000-20
16
Paul Davis
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
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
@@
-27,8
+27,9
@@
#include "gtkmm2ext/cell_renderer_color_selector.h"
#include "gtkmm2ext/utils.h"
#include "gtkmm2ext/cell_renderer_color_selector.h"
#include "gtkmm2ext/utils.h"
-#include "pbd/file_utils.h"
#include "pbd/compose.h"
#include "pbd/compose.h"
+#include "pbd/file_utils.h"
+#include "pbd/replace_all.h"
#include "ardour/filesystem_paths.h"
#include "ardour/profile.h"
#include "ardour/filesystem_paths.h"
#include "ardour/profile.h"
@@
-45,7
+46,7
@@
#include "ui_config.h"
#include "utils.h"
#include "ui_config.h"
#include "utils.h"
-#include "i18n.h"
+#include "
pbd/
i18n.h"
using namespace std;
using namespace Gtk;
using namespace std;
using namespace Gtk;
@@
-60,11
+61,10
@@
ColorThemeManager::ColorThemeManager ()
, palette_window (0)
, color_theme_label (_("Color Theme"))
{
, palette_window (0)
, color_theme_label (_("Color Theme"))
{
- set_spacing (12);
-
std::map<string,string> color_themes;
get_color_themes (color_themes);
std::map<string,string> color_themes;
get_color_themes (color_themes);
+ int n = 0;
if (color_themes.size() > 1) {
theme_list = TreeStore::create (color_theme_columns);
if (color_themes.size() > 1) {
theme_list = TreeStore::create (color_theme_columns);
@@
-76,13
+76,16
@@
ColorThemeManager::ColorThemeManager ()
row = *(theme_list->append());
row[color_theme_columns.name] = c->first;
row = *(theme_list->append());
row[color_theme_columns.name] = c->first;
- row[color_theme_columns.path] = c->second;
+
+ string color_file_name = c->second;
+
+ row[color_theme_columns.path] = color_file_name;
/* match second (path; really basename) since that is
what we store/restore.
*/
/* match second (path; really basename) since that is
what we store/restore.
*/
- if (UIConfiguration::instance().get_color_file() == c
->second
) {
+ if (UIConfiguration::instance().get_color_file() == c
olor_file_name
) {
selected_iter = row;
}
}
selected_iter = row;
}
}
@@
-101,8
+104,9
@@
ColorThemeManager::ColorThemeManager ()
hbox->set_spacing (6);
hbox->pack_start (color_theme_label, false, false);
hbox->pack_start (*align, true, true);
hbox->set_spacing (6);
hbox->pack_start (color_theme_label, false, false);
hbox->pack_start (*align, true, true);
- pack_start (*hbox, PACK_SHRINK);
hbox->show_all ();
hbox->show_all ();
+ table.attach (*hbox, 0, 3, n, n + 1);
+ ++n;
}
reset_button.signal_clicked().connect (sigc::mem_fun (*this, &ColorThemeManager::reset_canvas_colors));
}
reset_button.signal_clicked().connect (sigc::mem_fun (*this, &ColorThemeManager::reset_canvas_colors));
@@
-131,7
+135,7
@@
ColorThemeManager::ColorThemeManager ()
palette_group = initialize_palette_canvas (*palette_viewport.canvas());
palette_viewport.signal_size_allocate().connect (sigc::bind (sigc::mem_fun (*this, &ColorThemeManager::palette_canvas_allocated), palette_group, palette_viewport.canvas(),
palette_group = initialize_palette_canvas (*palette_viewport.canvas());
palette_viewport.signal_size_allocate().connect (sigc::bind (sigc::mem_fun (*this, &ColorThemeManager::palette_canvas_allocated), palette_group, palette_viewport.canvas(),
- sigc::mem_fun (*this, &ColorThemeManager::palette_event)));
+ sigc::mem_fun (*this, &ColorThemeManager::palette_event)));
palette_scroller.add (palette_viewport);
modifier_scroller.add (modifier_vbox);
palette_scroller.add (palette_viewport);
modifier_scroller.add (modifier_vbox);
@@
-142,8
+146,9
@@
ColorThemeManager::ColorThemeManager ()
notebook.set_size_request (400, 400);
notebook.set_size_request (400, 400);
- pack_start (notebook, true, true);
- pack_start (reset_button, false, false);
+ table.attach (notebook, 0, 3, n, n + 1);
+ ++n;
+ table.attach (reset_button, 0, 3, n, n + 1);
color_dialog.get_colorsel()->set_has_opacity_control (true);
color_dialog.get_colorsel()->set_has_palette (true);
color_dialog.get_colorsel()->set_has_opacity_control (true);
color_dialog.get_colorsel()->set_has_palette (true);
@@
-157,10
+162,18
@@
ColorThemeManager::ColorThemeManager ()
setup_modifiers ();
UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ColorThemeManager::colors_changed));
setup_modifiers ();
UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &ColorThemeManager::colors_changed));
+}
+
- show_all ();
+ColorThemeManager::~ColorThemeManager ()
+{
+ if (palette_group) {
+ palette_group->clear (true);
+ delete palette_group;
+ }
}
}
+
void
ColorThemeManager::setup_modifiers ()
{
void
ColorThemeManager::setup_modifiers ()
{
@@
-219,7
+232,9
@@
ColorThemeManager::reset_canvas_colors()
string cfile;
string basename;
string cfile;
string basename;
- basename = UIConfiguration::instance().color_file_name (true, true, true);
+ /* look for a versioned user-owned color file, and try to rename it */
+
+ basename = UIConfiguration::instance().color_file_name (true, true);
if (find_file (ardour_config_search_path(), basename, cfile)) {
string backup = cfile + string (X_(".old"));
if (find_file (ardour_config_search_path(), basename, cfile)) {
string backup = cfile + string (X_(".old"));
@@
-227,7
+242,7
@@
ColorThemeManager::reset_canvas_colors()
/* don't really care if it fails */
}
/* don't really care if it fails */
}
- UIConfiguration::instance().load_
defaults(
);
+ UIConfiguration::instance().load_
color_theme (false
);
UIConfiguration::instance().save_state ();
}
UIConfiguration::instance().save_state ();
}
@@
-305,7
+320,6
@@
ColorThemeManager::build_palette_canvas (ArdourCanvas::Canvas& canvas, ArdourCan
for (uint32_t y = 0; y < height - box_size && color_num < color_limit; y += box_size) {
for (uint32_t x = 0; x < width - box_size && color_num < color_limit; x += box_size) {
ArdourCanvas::Rectangle* r = new ArdourCanvas::Rectangle (&group, ArdourCanvas::Rect (x, y, x + box_size, y + box_size));
for (uint32_t y = 0; y < height - box_size && color_num < color_limit; y += box_size) {
for (uint32_t x = 0; x < width - box_size && color_num < color_limit; x += box_size) {
ArdourCanvas::Rectangle* r = new ArdourCanvas::Rectangle (&group, ArdourCanvas::Rect (x, y, x + box_size, y + box_size));
-
string name = nc[color_num++].name;
UIConfiguration::Colors::iterator c = colors.find (name);
string name = nc[color_num++].name;
UIConfiguration::Colors::iterator c = colors.find (name);
@@
-589,9
+603,16
@@
ColorThemeManager::set_state_from_config ()
}
void
}
void
-ColorThemeManager::add_to_page (OptionEditorPage* p
age
)
+ColorThemeManager::add_to_page (OptionEditorPage* p)
{
{
- add_widget_to_page (page, this);
+ int const n = p->table.property_n_rows();
+ int m = n + 1;
+ if (!_note.empty ()) {
+ ++m;
+ }
+ p->table.resize (m, 3);
+ p->table.attach (box, 1, 3, n, n + 1, FILL | EXPAND, SHRINK, 0, 0);
+ maybe_add_note (p, n + 1);
}
Gtk::Widget&
}
Gtk::Widget&
@@
-614,4
+635,3
@@
ColorThemeManager::on_color_theme_changed ()
}
}
}
}
}
}
-