mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-08 22:55:44 +01:00
use a hash-table to cache gui properties
This commit is contained in:
parent
3e4c9fcea2
commit
8db5d93a35
3 changed files with 15 additions and 3 deletions
|
|
@ -66,7 +66,14 @@ AxisView::unique_random_color()
|
|||
string
|
||||
AxisView::gui_property (const string& property_name) const
|
||||
{
|
||||
return gui_object_state().get_string (state_id(), property_name);
|
||||
if (property_hashtable.count(property_name)) {
|
||||
return property_hashtable[property_name];
|
||||
} else {
|
||||
string rv = gui_object_state().get_string (state_id(), property_name);
|
||||
property_hashtable.erase(property_name);
|
||||
property_hashtable.emplace(property_name, rv);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -84,7 +91,6 @@ AxisView::set_marked_for_display (bool yn)
|
|||
set_gui_property ("visible", yn);
|
||||
return true; // things changed
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#define __ardour_gtk_axis_view_h__
|
||||
|
||||
#include <list>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
#include <gtkmm/label.h>
|
||||
#include <gdkmm/color.h>
|
||||
|
|
@ -63,6 +64,10 @@ class AxisView : public virtual Selectable, public PBD::ScopedConnectionList, pu
|
|||
std::string gui_property (const std::string& property_name) const;
|
||||
|
||||
template<typename T> void set_gui_property (const std::string& property_name, const T& value) {
|
||||
std::stringstream s;
|
||||
s << value;
|
||||
property_hashtable.erase(property_name);
|
||||
property_hashtable.emplace(property_name, s.str());
|
||||
gui_object_state().set_property<T> (state_id(), property_name, value);
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +94,7 @@ class AxisView : public virtual Selectable, public PBD::ScopedConnectionList, pu
|
|||
|
||||
Gtk::Label name_label;
|
||||
|
||||
bool _marked_for_display;
|
||||
mutable boost::unordered_map<std::string, std::string> property_hashtable;
|
||||
uint32_t _old_order_key;
|
||||
}; /* class AxisView */
|
||||
|
||||
|
|
|
|||
|
|
@ -413,6 +413,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD
|
|||
void center_screen (framepos_t);
|
||||
|
||||
TrackViewList axis_views_from_routes (boost::shared_ptr<ARDOUR::RouteList>) const;
|
||||
|
||||
Gtkmm2ext::TearOff* mouse_mode_tearoff () const { return _mouse_mode_tearoff; }
|
||||
Gtkmm2ext::TearOff* tools_tearoff () const { return _tools_tearoff; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue