mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-07 14:15:46 +01:00
Implementing UI Factory
[git-p4: depot-paths = "//Abdaw/dev_main/tracks/": change = 449336]
This commit is contained in:
parent
d0b8c648be
commit
0f6342cfc1
11 changed files with 284 additions and 1066 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -21,6 +21,7 @@
|
|||
#define __gtk2_ardour_session_dialog_h__
|
||||
|
||||
#include <string>
|
||||
#include "waves_dialog.h"
|
||||
|
||||
#include <gdkmm/pixbuf.h>
|
||||
#include <gtkmm/label.h>
|
||||
|
|
@ -44,8 +45,8 @@
|
|||
#include "ardour_dialog.h"
|
||||
|
||||
class EngineControl;
|
||||
|
||||
class SessionDialog : public ArdourDialog {
|
||||
#define MAX_RECENT_SESSION_COUNTS 10
|
||||
class SessionDialog : public WavesDialog {
|
||||
public:
|
||||
SessionDialog (bool require_new, const std::string& session_name, const std::string& session_path,
|
||||
const std::string& template_name, bool cancel_not_quit);
|
||||
|
|
@ -56,185 +57,65 @@ class SessionDialog : public ArdourDialog {
|
|||
std::string session_name (bool& should_be_new);
|
||||
std::string session_folder ();
|
||||
|
||||
bool use_session_template();
|
||||
std::string session_template_name();
|
||||
bool use_session_template() { return false; }
|
||||
std::string session_template_name() { return ""; }
|
||||
|
||||
// advanced session options
|
||||
|
||||
bool create_master_bus() const;
|
||||
int master_channel_count() const;
|
||||
bool create_master_bus() const { return true; }
|
||||
int master_channel_count() const { return 2; }
|
||||
|
||||
bool connect_inputs() const;
|
||||
bool limit_inputs_used_for_connection() const;
|
||||
int input_limit_count() const;
|
||||
bool connect_inputs() const { return true; }
|
||||
bool limit_inputs_used_for_connection() const { return false; }
|
||||
int input_limit_count() const { return 0; }
|
||||
|
||||
bool connect_outputs() const;
|
||||
bool limit_outputs_used_for_connection() const;
|
||||
int output_limit_count() const;
|
||||
bool connect_outputs() const { return true; }
|
||||
bool limit_outputs_used_for_connection() const { return false; }
|
||||
int output_limit_count() const { return 0; }
|
||||
|
||||
bool connect_outs_to_master() const;
|
||||
bool connect_outs_to_physical() const;
|
||||
bool connect_outs_to_master() const { return true; }
|
||||
bool connect_outs_to_physical() const { return false; }
|
||||
|
||||
private:
|
||||
WavesButton& quit_button;
|
||||
WavesButton& new_session_button;
|
||||
WavesButton& open_selected_button;
|
||||
WavesButton& open_saved_session_button;
|
||||
WavesButton* recent_session_button[MAX_RECENT_SESSION_COUNTS];
|
||||
|
||||
private: //app logic
|
||||
void on_quit (WavesButton*);
|
||||
void on_open_selected (WavesButton*);
|
||||
void on_open_saved_session (WavesButton*);
|
||||
void on_new_session (WavesButton*);
|
||||
void on_recent_session (WavesButton*);
|
||||
|
||||
int selected_recent_session;
|
||||
std::string recent_session_full_name[MAX_RECENT_SESSION_COUNTS];
|
||||
std::string selected_session_full_name;
|
||||
|
||||
private:
|
||||
bool new_only;
|
||||
std::string _provided_session_name;
|
||||
std::string _provided_session_path;
|
||||
std::string _provided_session_name;
|
||||
std::string _provided_session_path;
|
||||
|
||||
bool on_delete_event (GdkEventAny*);
|
||||
|
||||
Gtk::Button* cancel_button;
|
||||
Gtk::Button* open_button;
|
||||
Gtk::Button* back_button;
|
||||
Gtk::Button* quit_button;
|
||||
|
||||
bool back_button_pressed (GdkEventButton*);
|
||||
|
||||
Gtk::Frame info_frame;
|
||||
|
||||
/* initial choice page */
|
||||
|
||||
void setup_initial_choice_box ();
|
||||
Gtk::VBox ic_vbox;
|
||||
Gtk::Button ic_new_session_button;
|
||||
void new_session_button_clicked ();
|
||||
|
||||
/* recent sessions */
|
||||
|
||||
void setup_existing_session_page ();
|
||||
|
||||
struct RecentSessionsSorter {
|
||||
bool operator() (std::pair<std::string,std::string> a, std::pair<std::string,std::string> b) const {
|
||||
return cmp_nocase(a.first, b.first) == -1;
|
||||
}
|
||||
};
|
||||
|
||||
struct RecentSessionModelColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
RecentSessionModelColumns() {
|
||||
add (visible_name);
|
||||
add (tip);
|
||||
add (fullpath);
|
||||
add (sample_rate);
|
||||
add (disk_format);
|
||||
}
|
||||
Gtk::TreeModelColumn<std::string> visible_name;
|
||||
Gtk::TreeModelColumn<std::string> tip;
|
||||
Gtk::TreeModelColumn<std::string> fullpath;
|
||||
Gtk::TreeModelColumn<std::string> sample_rate;
|
||||
Gtk::TreeModelColumn<std::string> disk_format;
|
||||
};
|
||||
|
||||
RecentSessionModelColumns recent_session_columns;
|
||||
Gtk::TreeView recent_session_display;
|
||||
Glib::RefPtr<Gtk::TreeStore> recent_session_model;
|
||||
Gtk::ScrolledWindow recent_scroller;
|
||||
Gtk::Label recent_label;
|
||||
Gtk::FileChooserButton existing_session_chooser;
|
||||
int redisplay_recent_sessions ();
|
||||
void recent_session_row_selected ();
|
||||
void recent_row_activated (const Gtk::TreePath& path, Gtk::TreeViewColumn* col);
|
||||
|
||||
void existing_session_selected ();
|
||||
void session_selected ();
|
||||
|
||||
/* new sessions */
|
||||
|
||||
void setup_new_session_page ();
|
||||
Gtk::Entry new_name_entry;
|
||||
Gtk::FileChooserButton new_folder_chooser;
|
||||
|
||||
struct SessionTemplateColumns : public Gtk::TreeModel::ColumnRecord {
|
||||
SessionTemplateColumns () {
|
||||
add (name);
|
||||
add (path);
|
||||
}
|
||||
|
||||
Gtk::TreeModelColumn<std::string> name;
|
||||
Gtk::TreeModelColumn<std::string> path;
|
||||
};
|
||||
|
||||
SessionTemplateColumns session_template_columns;
|
||||
Glib::RefPtr<Gtk::ListStore> template_model;
|
||||
Gtk::ComboBox template_chooser;
|
||||
|
||||
Gtk::VBox session_new_vbox;
|
||||
Gtk::VBox session_existing_vbox;
|
||||
Gtk::Expander more_new_session_options_button;
|
||||
Gtk::CheckButton use_template_button;
|
||||
std::string load_template_override;
|
||||
|
||||
void more_new_session_options_button_clicked();
|
||||
void new_name_changed ();
|
||||
void new_name_activated ();
|
||||
void populate_session_templates ();
|
||||
|
||||
/* more options for new sessions */
|
||||
|
||||
Gtk::VBox more_options_vbox;
|
||||
|
||||
Gtk::Label chan_count_label_1;
|
||||
Gtk::Label chan_count_label_3;
|
||||
Gtk::Label chan_count_label_4;
|
||||
Gtk::Table advanced_table;
|
||||
Gtk::HBox input_port_limit_hbox;
|
||||
Gtk::VBox input_port_vbox;
|
||||
Gtk::Table input_table;
|
||||
Gtk::HBox input_hbox;
|
||||
|
||||
Gtk::Label bus_label;
|
||||
Gtk::Frame bus_frame;
|
||||
Gtk::Table bus_table;
|
||||
Gtk::HBox bus_hbox;
|
||||
|
||||
Gtk::Label input_label;
|
||||
Gtk::Frame input_frame;
|
||||
Gtk::HBox output_port_limit_hbox;
|
||||
Gtk::VBox output_port_vbox;
|
||||
Gtk::VBox output_conn_vbox;
|
||||
Gtk::VBox output_vbox;
|
||||
Gtk::HBox output_hbox;
|
||||
|
||||
Gtk::Label output_label;
|
||||
Gtk::Frame output_frame;
|
||||
Gtk::VBox advanced_vbox;
|
||||
Gtk::Label advanced_label;
|
||||
|
||||
Gtk::CheckButton _create_master_bus;
|
||||
Gtk::SpinButton _master_bus_channel_count;
|
||||
|
||||
Gtk::CheckButton _connect_inputs;
|
||||
Gtk::CheckButton _limit_input_ports;
|
||||
Gtk::SpinButton _input_limit_count;
|
||||
|
||||
Gtk::CheckButton _connect_outputs;
|
||||
Gtk::CheckButton _limit_output_ports;
|
||||
Gtk::SpinButton _output_limit_count;
|
||||
|
||||
Gtk::RadioButtonGroup connect_outputs_group;
|
||||
Gtk::RadioButton _connect_outputs_to_master;
|
||||
Gtk::RadioButton _connect_outputs_to_physical;
|
||||
|
||||
Gtk::Adjustment _output_limit_count_adj;
|
||||
Gtk::Adjustment _input_limit_count_adj;
|
||||
Gtk::Adjustment _master_bus_channel_count_adj;
|
||||
|
||||
void connect_inputs_clicked ();
|
||||
void connect_outputs_clicked ();
|
||||
void limit_inputs_clicked ();
|
||||
void limit_outputs_clicked ();
|
||||
void master_bus_button_clicked ();
|
||||
void setup_more_options_box ();
|
||||
|
||||
/* always there */
|
||||
|
||||
Glib::RefPtr<Pango::Layout> layout;
|
||||
void session_selected ();
|
||||
|
||||
bool _existing_session_chooser_used; ///< set to true when the existing session chooser has been used
|
||||
|
||||
Gtk::Label info_scroller_label;
|
||||
std::string::size_type info_scroller_count;
|
||||
bool info_scroller_update();
|
||||
std::string::size_type info_scroller_count;
|
||||
bool info_scroller_update();
|
||||
sigc::connection info_scroller_connection;
|
||||
void updates_button_clicked ();
|
||||
};
|
||||
|
||||
#endif /* __gtk2_ardour_session_dialog_h__ */
|
||||
|
|
|
|||
|
|
@ -64,13 +64,12 @@ using namespace Glib;
|
|||
void
|
||||
TracksControlPanel::init ()
|
||||
{
|
||||
ok_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_ok));
|
||||
audio_settings_tab_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_audio_settings));
|
||||
midi_settings_tab_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_midi_settings));
|
||||
|
||||
ok_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_ok));
|
||||
cancel_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_cancel));
|
||||
apply_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_apply));
|
||||
|
||||
audio_settings_tab_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_audio_settings));
|
||||
midi_settings_tab_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_midi_settings));
|
||||
control_panel_button.signal_clicked.connect (sigc::mem_fun (*this, &TracksControlPanel::on_control_panel));
|
||||
|
||||
ARDOUR::AudioEngine::instance ()->Running.connect (running_connection, MISSING_INVALIDATOR, boost::bind (&TracksControlPanel::engine_running, this), gui_context());
|
||||
|
|
@ -213,7 +212,7 @@ TracksControlPanel::populate_buffer_size_combo()
|
|||
}
|
||||
|
||||
void
|
||||
TracksControlPanel::on_control_panel()
|
||||
TracksControlPanel::on_control_panel(WavesButton*)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -404,7 +403,7 @@ TracksControlPanel::engine_stopped ()
|
|||
|
||||
|
||||
void
|
||||
TracksControlPanel::on_audio_settings()
|
||||
TracksControlPanel::on_audio_settings (WavesButton*)
|
||||
{
|
||||
midi_settings_layout.hide ();
|
||||
midi_settings_tab_button.set_active(false);
|
||||
|
|
@ -414,7 +413,7 @@ TracksControlPanel::on_audio_settings()
|
|||
|
||||
|
||||
void
|
||||
TracksControlPanel::on_midi_settings()
|
||||
TracksControlPanel::on_midi_settings (WavesButton*)
|
||||
{
|
||||
audio_settings_layout.hide ();
|
||||
audio_settings_tab_button.set_active(false);
|
||||
|
|
@ -424,7 +423,7 @@ TracksControlPanel::on_midi_settings()
|
|||
|
||||
|
||||
void
|
||||
TracksControlPanel::on_ok()
|
||||
TracksControlPanel::on_ok (WavesButton*)
|
||||
{
|
||||
hide();
|
||||
push_state_to_backend (true);
|
||||
|
|
@ -433,7 +432,7 @@ TracksControlPanel::on_ok()
|
|||
|
||||
|
||||
void
|
||||
TracksControlPanel::on_cancel()
|
||||
TracksControlPanel::on_cancel (WavesButton*)
|
||||
{
|
||||
hide();
|
||||
response(Gtk::RESPONSE_CANCEL);
|
||||
|
|
@ -441,7 +440,7 @@ TracksControlPanel::on_cancel()
|
|||
|
||||
|
||||
void
|
||||
TracksControlPanel::on_apply()
|
||||
TracksControlPanel::on_apply (WavesButton*)
|
||||
{
|
||||
//push_state_to_backend (true);
|
||||
response(Gtk::RESPONSE_APPLY);
|
||||
|
|
|
|||
|
|
@ -51,12 +51,12 @@
|
|||
|
||||
// methods
|
||||
virtual void init();
|
||||
void on_audio_settings();
|
||||
void on_midi_settings();
|
||||
void on_control_panel();
|
||||
void on_ok();
|
||||
void on_cancel();
|
||||
void on_apply();
|
||||
void on_audio_settings(WavesButton*);
|
||||
void on_midi_settings(WavesButton*);
|
||||
void on_control_panel(WavesButton*);
|
||||
void on_ok(WavesButton*);
|
||||
void on_cancel(WavesButton*);
|
||||
void on_apply(WavesButton*);
|
||||
void engine_changed ();
|
||||
void device_changed ();
|
||||
void buffer_size_changed();
|
||||
|
|
|
|||
84
gtk2_ardour/ui/session_dialog.xml
Normal file
84
gtk2_ardour/ui/session_dialog.xml
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Dialog title="Session" resizeable="false">
|
||||
<style name="generic_control" font ="Arial 10"/>
|
||||
<style name="generic_button"
|
||||
style="generic_control"
|
||||
fgnormal="#BFBFBF"
|
||||
bgnormal="#6C6C6C"
|
||||
fgactive="#BFBFBF"
|
||||
bgactive="#454545"
|
||||
fghover="#CCCCCC"
|
||||
bghover="#898989"
|
||||
fgdisabled ="#959595"
|
||||
bordercolor="#7E7E7E"
|
||||
borderwidth="1 1 0 0" />
|
||||
<style name="recent_session_button"
|
||||
style="generic_button"
|
||||
bgactive="#1CA3B6"
|
||||
fgnormal="#DDDDDD"
|
||||
fgactive="#DDDDDD"
|
||||
borderwidth="0 0 0 0"/>
|
||||
<Layout bgnormal="#000000" width="299" height="249">
|
||||
<Layout bgnormal="#404040" x="1" y="1" width="297" height="247">
|
||||
<Button style="generic_button"
|
||||
id="new_session_button"
|
||||
text="NEW SESSION"
|
||||
x="11" y="10" width="148" height="26"/>
|
||||
<Button style="generic_button"
|
||||
id="open_selected_button"
|
||||
text="OPEN SELECTED"
|
||||
x="11" y="38" width="148" height="26"/>
|
||||
<Button style="generic_button"
|
||||
id="open_saved_session_button"
|
||||
text="OPEN SAVED SESSION"
|
||||
x="11" y="66" width="148" height="26"/>
|
||||
<Button style="generic_button"
|
||||
id="system_configuration_button"
|
||||
text="SYSTEM CONFIGURATION"
|
||||
x="11" y="94" width="148" height="26"/>
|
||||
<Button style="generic_button"
|
||||
id="quit_button"
|
||||
text="QUIT"
|
||||
x="11" y="214" width="148" height="26"/>
|
||||
<Layout bgnormal="#404040" x="12" y="131" width="110" height="75">
|
||||
<Label style ="generic_control" text="Audio Interface:\nChannel Configuration:\nOperation Mode:\nFrame Rate:\nSample Rate:" x="0" y="0"/>
|
||||
</Layout>
|
||||
<Layout bgnormal="#646464" x="169" y="10" width="121" height="229">
|
||||
<Layout bgnormal="#383838" x="1" y="1" width="119" height="227">
|
||||
<Label style="generic_control"
|
||||
text="RECENT" x="37" y="6" font ="Arial 9"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_0"
|
||||
x="4" y="24" width="111" height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_1"
|
||||
x="4" y="44" width="111" height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_2"
|
||||
x="4" y="64" width="111" height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_3"
|
||||
x="4" y="84" width="111" height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_4"
|
||||
x="4" y="104" width="111" height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_5"
|
||||
x="4" y="124" width="111" height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_6"
|
||||
x="4" y="144" width="111" height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_7"
|
||||
x="4" y="164" width="111" height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_8"
|
||||
x="4" y="184" width="111" height="19"/>
|
||||
<Button style="recent_session_button"
|
||||
id="recent_session_button_9"
|
||||
x="4" y="204" width="111" height="19"/>
|
||||
</Layout>
|
||||
</Layout>
|
||||
</Layout>
|
||||
</Layout>
|
||||
</Dialog>
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Dialog
|
||||
title="Tracks Preferences">
|
||||
<Dialog title="Tracks Preferences" resizeable="false">
|
||||
<style name="generic_control" font ="Arial 10"/>
|
||||
<style name="generic_button"
|
||||
style="generic_control"
|
||||
|
|
@ -10,6 +9,7 @@
|
|||
bgactive="#454545"
|
||||
fghover="#CCCCCC"
|
||||
bghover="#898989"
|
||||
fgdisabled ="959595"
|
||||
bordercolor="#7E7E7E"
|
||||
borderwidth="1 1 0 0" />
|
||||
|
||||
|
|
|
|||
|
|
@ -135,13 +135,15 @@ WavesButton::render (cairo_t* cr)
|
|||
}
|
||||
|
||||
Glib::RefPtr<Gtk::Style> style = get_style();
|
||||
Gdk::Color bgcolor = style->get_bg (_hovering ?
|
||||
(_pushed ?
|
||||
Gtk::STATE_ACTIVE :
|
||||
Gtk::STATE_PRELIGHT ) :
|
||||
(get_active() ?
|
||||
Gtk::STATE_ACTIVE :
|
||||
Gtk::STATE_NORMAL));
|
||||
|
||||
Gdk::Color bgcolor = style->get_bg ((get_state() == Gtk::STATE_INSENSITIVE) ? Gtk::STATE_INSENSITIVE :
|
||||
(_hovering ?
|
||||
(_pushed ?
|
||||
Gtk::STATE_ACTIVE :
|
||||
Gtk::STATE_PRELIGHT ) :
|
||||
(get_active() ?
|
||||
Gtk::STATE_ACTIVE :
|
||||
Gtk::STATE_NORMAL)));
|
||||
|
||||
if ((_left_border_width != 0) ||
|
||||
(_top_border_width != 0) ||
|
||||
|
|
@ -165,13 +167,14 @@ WavesButton::render (cairo_t* cr)
|
|||
|
||||
cairo_new_path (cr);
|
||||
|
||||
Gdk::Color fgcolor = style->get_fg (_hovering ?
|
||||
Gdk::Color fgcolor = style->get_fg ((get_state() == Gtk::STATE_INSENSITIVE) ? Gtk::STATE_INSENSITIVE :
|
||||
(_hovering ?
|
||||
(_pushed ?
|
||||
Gtk::STATE_ACTIVE :
|
||||
Gtk::STATE_PRELIGHT ) :
|
||||
(get_active() ?
|
||||
Gtk::STATE_ACTIVE :
|
||||
Gtk::STATE_NORMAL));
|
||||
Gtk::STATE_NORMAL)));
|
||||
cairo_set_source_rgba (cr, fgcolor.get_red_p(), fgcolor.get_green_p(), fgcolor.get_blue_p(), 1);
|
||||
|
||||
/* align text */
|
||||
|
|
@ -298,7 +301,7 @@ WavesButton::on_button_release_event (GdkEventButton *ev)
|
|||
_pushed = false;
|
||||
queue_draw ();
|
||||
if (_hovering) {
|
||||
signal_clicked ();
|
||||
signal_clicked (this);
|
||||
|
||||
if (_act_on_release) {
|
||||
if (_action) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class WavesButton : public CairoWidget , public Gtkmm2ext::Activatable
|
|||
void set_border_color(const char*);
|
||||
Glib::RefPtr<Pango::Layout> layout() const { return _layout; }
|
||||
|
||||
sigc::signal<void> signal_clicked;
|
||||
sigc::signal1<void, WavesButton*> signal_clicked;
|
||||
|
||||
boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); }
|
||||
void set_controllable (boost::shared_ptr<PBD::Controllable> c);
|
||||
|
|
|
|||
|
|
@ -175,6 +175,10 @@ WavesDialog::read_layout (std::string file_name)
|
|||
|
||||
std::string title = WavesUI::xml_property (*root, "title", WavesUI::XMLNodeMap(), "");
|
||||
set_title(title);
|
||||
bool resizeable = WavesUI::xml_property (*root, "resizeable", WavesUI::XMLNodeMap(), false);
|
||||
property_allow_grow().set_value(resizeable);
|
||||
|
||||
set_border_width(0);
|
||||
|
||||
WavesUI::create_ui(layout, *get_vbox(), _children);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,20 +18,18 @@
|
|||
*/
|
||||
#include "waves_ui.h"
|
||||
|
||||
std::ofstream WavesUI::dbg_out("/users/WavesUILog.txt");
|
||||
//std::ofstream dbg_out("/users/WavesUILog.txt");
|
||||
|
||||
void
|
||||
WavesUI::get_styles(const XMLTree& layout, WavesUI::XMLNodeMap &styles)
|
||||
{
|
||||
XMLNode* root = layout.root();
|
||||
if (root != NULL) {
|
||||
WavesUI::dbg_out << "WavesUI::get_styles\n";
|
||||
|
||||
for (XMLNodeList::const_iterator i = root->children().begin(); i != root->children().end(); ++i) {
|
||||
if ( !strcasecmp((*i)->name().c_str(), "style")) {
|
||||
std::string style_name = ((*i)->property("name") ? (*i)->property("name")->value() : std::string(""));
|
||||
if (!style_name.empty()) {
|
||||
WavesUI::dbg_out << "\tstyle [" << style_name << "] added:" << *i << "\n";
|
||||
styles[style_name] = *i;
|
||||
}
|
||||
}
|
||||
|
|
@ -42,7 +40,6 @@ WavesUI::get_styles(const XMLTree& layout, WavesUI::XMLNodeMap &styles)
|
|||
double
|
||||
WavesUI::xml_property (const XMLNode &node, const char *prop_name, const XMLNodeMap& styles, double default_value)
|
||||
{
|
||||
WavesUI::dbg_out << "double xml_property ( " << prop_name << ")\n";
|
||||
std::string property = xml_property(node, prop_name, styles, "");
|
||||
if (property.empty()) {
|
||||
return default_value;
|
||||
|
|
@ -53,7 +50,6 @@ WavesUI::xml_property (const XMLNode &node, const char *prop_name, const XMLNode
|
|||
int
|
||||
WavesUI::xml_property (const XMLNode &node, const char *prop_name, const XMLNodeMap& styles, int default_value)
|
||||
{
|
||||
WavesUI::dbg_out << "int xml_property ( " << prop_name << ")\n";
|
||||
std::string property = xml_property(node, prop_name, styles, "");
|
||||
if (property.empty()) {
|
||||
return default_value;
|
||||
|
|
@ -65,7 +61,6 @@ WavesUI::xml_property (const XMLNode &node, const char *prop_name, const XMLNode
|
|||
bool
|
||||
WavesUI::xml_property (const XMLNode &node, const char *prop_name, const XMLNodeMap& styles, bool default_value)
|
||||
{
|
||||
WavesUI::dbg_out << "bool xml_property ( " << prop_name << ")\n";
|
||||
std::string property = xml_property(node, prop_name, styles, "");
|
||||
if (property.empty()) {
|
||||
return default_value;
|
||||
|
|
@ -77,20 +72,15 @@ WavesUI::xml_property (const XMLNode &node, const char *prop_name, const XMLNode
|
|||
std::string
|
||||
WavesUI::xml_property (const XMLNode &node, const char *prop_name, const XMLNodeMap& styles, const std::string default_value)
|
||||
{
|
||||
WavesUI::dbg_out << "std::string xml_property (<" << node.name() << ">, " << prop_name << " )\n";
|
||||
std::string property = node.property (prop_name) ? node.property(prop_name)->value() : "";
|
||||
if (property.empty()) {
|
||||
WavesUI::dbg_out << "\tlooking for style_name to read [" << prop_name << "]\n";
|
||||
std::string style_name = node.property ("style") ? node.property("style")->value() : "";
|
||||
if (!style_name.empty()) {
|
||||
WavesUI::dbg_out << "\tstyle_name [" << style_name << "] found\n";
|
||||
XMLNodeMap::const_iterator style = styles.find(style_name);
|
||||
if (style != styles.end()) {
|
||||
return WavesUI::xml_property (*style->second, prop_name, styles, default_value);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
WavesUI::dbg_out << "\t" << prop_name << " = [" << property << "]\n";
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -144,6 +134,11 @@ WavesUI::create_widget (const XMLNode& definition, const XMLNodeMap& styles, std
|
|||
child->modify_bg(Gtk::STATE_NORMAL, Gdk::Color(property));
|
||||
}
|
||||
|
||||
property = WavesUI::xml_property (definition, "bgdisabled", styles, property);
|
||||
if (!property.empty()) {
|
||||
child->modify_bg(Gtk::STATE_INSENSITIVE, Gdk::Color(property));
|
||||
}
|
||||
|
||||
property = WavesUI::xml_property (definition, "bgactive", styles, "");
|
||||
if (!property.empty()) {
|
||||
child->modify_bg(Gtk::STATE_ACTIVE, Gdk::Color(property));
|
||||
|
|
@ -159,6 +154,11 @@ WavesUI::create_widget (const XMLNode& definition, const XMLNodeMap& styles, std
|
|||
child->modify_fg(Gtk::STATE_NORMAL, Gdk::Color(property));
|
||||
}
|
||||
|
||||
property = WavesUI::xml_property (definition, "fgdisabled", styles, property);
|
||||
if (!property.empty()) {
|
||||
child->modify_fg(Gtk::STATE_INSENSITIVE, Gdk::Color(property));
|
||||
}
|
||||
|
||||
property = WavesUI::xml_property (definition, "fgactive", styles, "");
|
||||
if (!property.empty()) {
|
||||
child->modify_fg(Gtk::STATE_ACTIVE, Gdk::Color(property));
|
||||
|
|
@ -234,7 +234,6 @@ WavesUI::create_ui (const XMLNodeList& definition, const XMLNodeMap& styles, Gtk
|
|||
void
|
||||
WavesUI::create_ui (const XMLTree& layout, Gtk::Widget& root, std::map<std::string, Gtk::Widget*> &named_widgets)
|
||||
{
|
||||
WavesUI::dbg_out << "const XMLTree& layout, Gtk::Widget& root, std::map<std::string, Gtk::Widget*> &named_widgets):\n";
|
||||
XMLNodeMap styles;
|
||||
WavesUI::get_styles(layout, styles);
|
||||
const XMLNodeList& definition = layout.root()->children();
|
||||
|
|
|
|||
|
|
@ -45,5 +45,4 @@ namespace WavesUI {
|
|||
Gtk::Widget* add_widget (Gtk::Layout& parent, const XMLNode &definition, const XMLNodeMap& styles, std::map<std::string, Gtk::Widget*> &named_widgets);
|
||||
Gtk::Widget* add_widget (Gtk::Widget& parent, const XMLNode &definition, const XMLNodeMap& styles, std::map<std::string, Gtk::Widget*> &named_widgets);
|
||||
|
||||
extern std::ofstream dbg_out;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue