Loading...
Searching...
No Matches
gx_stackbox_builder.h
Go to the documentation of this file.
/*
* Copyright (C) 2011, 2012 Andreas Degert, Hermann Meyer
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "guitarix.h" // NOLINT
#include <glibmm/i18n.h> // NOLINT
namespace gx_gui {
/****************************************************************/
class WidgetStack {
private:
std::vector<Gtk::Widget*> stack;
Gtk::Widget *top() { return stack.back(); }
public:
WidgetStack(): stack() {}
~WidgetStack() {}
bool empty() { return stack.empty(); }
void push(Gtk::Widget *w) { stack.push_back(w); }
void pop() { return stack.pop_back(); }
void container_add(Gtk::Widget *w);
void box_pack_start(Gtk::Widget *w, bool expand=true, bool fill=true, int padding=0);
void notebook_append_page(Gtk::Widget *w, Gtk::Widget *label);
bool top_is_notebook() { return dynamic_cast<Gtk::Notebook*>(top()) != 0; }
Gtk::Widget *add(Gtk::Widget *w, const Glib::ustring& label = Glib::ustring());
};
class StackBoxBuilder {
private:
WidgetStack fBox;
gx_engine::GxMachineBase& machine;
Gtk::HBox *widget;
Glib::RefPtr<Gtk::AccelGroup> accels;
Glib::RefPtr<Gdk::Pixbuf> window_icon;
int next_flags;
PluginUI *current_plugin;
std::vector<Glib::ustring> nam_file_names;
std::vector<Glib::ustring> snam_file_names;
std::vector<Glib::ustring> mnam_afile_names;
std::vector<Glib::ustring> mnam_bfile_names;
std::vector<Glib::ustring> rtneural_file_names;
std::vector<Glib::ustring> srtneural_file_names;
std::vector<Glib::ustring> mrtneural_afile_names;
std::vector<Glib::ustring> mrtneural_bfile_names;
private:
void loadRackFromBuilder(const Glib::RefPtr<GxBuilder>& bld);
// functions used in interfaces
void create_master_slider(const std::string& id, const char *label);
void closeBox();
void insertSpacer();
void check_set_flags(Gxw::Regler *r);
void create_simple_meter(const std::string& id);
void create_simple_c_meter(const std::string& id, const std::string& idl, const char *label);
void create_mid_rackknob(const std::string& id, const char *label);
void create_small_rackknob(const std::string& id, const char *label);
void create_small_rackknobr(const std::string& id, const char *label);
void create_big_rackknob(const std::string& id, const char *label);
void openVerticalBox(const char* label = "");
void openFrameBox(const char* label);
void openHorizontalBox(const char* label = "");
void openHorizontalhideBox(const char* label = "");
void openHorizontalTableBox(const char* label);
void create_switch_no_caption(const char *sw_type, const std::string& id);
void create_v_switch(const char *sw_type, const std::string& id, const char *label);
void openpaintampBox(const char* label = "");
void create_wheel(const std::string& id, const char *label=0);
void create_spin_value(const std::string& id, const char *label);
void create_simple_spin_value(const std::string& id);
void create_eq_rackslider_no_caption(const std::string& id);
void create_port_display(const std::string& id, const char *label);
void create_p_display(const std::string& id, const std::string& idl, const std::string& idh);
void create_feedback_switch(const char *sw_type, const std::string& id);
void create_feedback_slider(const std::string& id, const char *label);
void create_fload_switch(const char *sw_type, const char *id, const std::string& idf);
void create_selector(const std::string& id, const char *widget_name=0);
void create_selector_with_caption(const std::string& id, const char *label);
void openFlipLabelBox(const char* = 0);
void openVerticalBox1(const char* label = 0);
void openVerticalBox2(const char* label = 0);
void openTabBox(const char* label = 0);
void set_next_flags(int flags);
private:
// functions used indirectly
void addwidget(Gtk::Widget *widget);
bool ui_connect(Gtk::Widget *widget, const std::string& id);
void add_regler(CpBaseCaption *w, Gxw::Regler *r, const std::string& id, const char *label);
void load_file(const std::string& id, const std::string& idf);
void on_file_chooser_response(int response_id, Gtk::FileChooserDialog *d,
const std::string& id, const std::string& idf);
void load_file_f(const std::string& id, const std::string& idf);
void loadRackFromGladeData(const char *xmldesc);
void loadRackFromGladeFile(const char *fname);
friend class UiBuilderImpl;
public:
StackBoxBuilder(
gx_engine::GxMachineBase& machine_, Glib::RefPtr<Gdk::Pixbuf> window_icon);
~StackBoxBuilder();
void set_neural_filelist(Gxw::Selector *sel, std::string id, std::string fileid, std::string pathid);
void set_neural_file(std::string id, std::string fileid);
void set_accelgroup(Glib::RefPtr<Gtk::AccelGroup> accels_) { accels = accels_; }
void prepare();
void fetch(Gtk::Widget*& mainbox, Gtk::Widget*& minibox);
void set_current_plugin(PluginUI *p) { current_plugin = p; }
void connect_signals(Glib::RefPtr<GxBuilder> builder, Glib::RefPtr<Glib::Object> object,
const char *signal_name, const char *handler_name);
};
} // end namespace gx_gui
PluginUI
Definition gx_main_window.h:410
gx_engine::GxMachineBase
Definition machine.h:59
gx_gui::CpBaseCaption
Definition gx_main_interface.h:77
gx_gui::StackBoxBuilder::create_switch_no_caption
void create_switch_no_caption(const char *sw_type, const std::string &id)
gx_gui::StackBoxBuilder::add_regler
void add_regler(CpBaseCaption *w, Gxw::Regler *r, const std::string &id, const char *label)
gx_gui::StackBoxBuilder::create_mid_rackknob
void create_mid_rackknob(const std::string &id, const char *label)
gx_gui::StackBoxBuilder::openVerticalBox1
void openVerticalBox1(const char *label=0)
gx_gui::StackBoxBuilder::create_selector_with_caption
void create_selector_with_caption(const std::string &id, const char *label)
gx_gui::StackBoxBuilder::fBox
WidgetStack fBox
Definition gx_stackbox_builder.h:46
gx_gui::StackBoxBuilder::set_neural_filelist
void set_neural_filelist(Gxw::Selector *sel, std::string id, std::string fileid, std::string pathid)
gx_gui::StackBoxBuilder::UiBuilderImpl
friend class UiBuilderImpl
Definition gx_stackbox_builder.h:113
gx_gui::StackBoxBuilder::nam_file_names
std::vector< Glib::ustring > nam_file_names
Definition gx_stackbox_builder.h:53
gx_gui::StackBoxBuilder::openVerticalBox
void openVerticalBox(const char *label="")
gx_gui::StackBoxBuilder::create_wheel
void create_wheel(const std::string &id, const char *label=0)
gx_gui::StackBoxBuilder::set_next_flags
void set_next_flags(int flags)
gx_gui::StackBoxBuilder::openHorizontalhideBox
void openHorizontalhideBox(const char *label="")
gx_gui::StackBoxBuilder::load_file
void load_file(const std::string &id, const std::string &idf)
gx_gui::StackBoxBuilder::StackBoxBuilder
StackBoxBuilder(gx_engine::GxMachineBase &machine_, Glib::RefPtr< Gdk::Pixbuf > window_icon)
gx_gui::StackBoxBuilder::create_feedback_switch
void create_feedback_switch(const char *sw_type, const std::string &id)
gx_gui::StackBoxBuilder::create_selector
void create_selector(const std::string &id, const char *widget_name=0)
gx_gui::StackBoxBuilder::create_big_rackknob
void create_big_rackknob(const std::string &id, const char *label)
gx_gui::StackBoxBuilder::prepare
void prepare()
gx_gui::StackBoxBuilder::create_spin_value
void create_spin_value(const std::string &id, const char *label)
gx_gui::StackBoxBuilder::openHorizontalTableBox
void openHorizontalTableBox(const char *label)
gx_gui::StackBoxBuilder::openFlipLabelBox
void openFlipLabelBox(const char *=0)
gx_gui::StackBoxBuilder::snam_file_names
std::vector< Glib::ustring > snam_file_names
Definition gx_stackbox_builder.h:54
gx_gui::StackBoxBuilder::current_plugin
PluginUI * current_plugin
Definition gx_stackbox_builder.h:52
gx_gui::StackBoxBuilder::create_fload_switch
void create_fload_switch(const char *sw_type, const char *id, const std::string &idf)
gx_gui::StackBoxBuilder::mrtneural_afile_names
std::vector< Glib::ustring > mrtneural_afile_names
Definition gx_stackbox_builder.h:59
gx_gui::StackBoxBuilder::connect_signals
void connect_signals(Glib::RefPtr< GxBuilder > builder, Glib::RefPtr< Glib::Object > object, const char *signal_name, const char *handler_name)
gx_gui::StackBoxBuilder::create_p_display
void create_p_display(const std::string &id, const std::string &idl, const std::string &idh)
gx_gui::StackBoxBuilder::insertSpacer
void insertSpacer()
gx_gui::StackBoxBuilder::loadRackFromGladeData
void loadRackFromGladeData(const char *xmldesc)
gx_gui::StackBoxBuilder::mnam_bfile_names
std::vector< Glib::ustring > mnam_bfile_names
Definition gx_stackbox_builder.h:56
gx_gui::StackBoxBuilder::~StackBoxBuilder
~StackBoxBuilder()
gx_gui::StackBoxBuilder::create_simple_spin_value
void create_simple_spin_value(const std::string &id)
gx_gui::StackBoxBuilder::loadRackFromBuilder
void loadRackFromBuilder(const Glib::RefPtr< GxBuilder > &bld)
gx_gui::StackBoxBuilder::openFrameBox
void openFrameBox(const char *label)
gx_gui::StackBoxBuilder::loadRackFromGladeFile
void loadRackFromGladeFile(const char *fname)
gx_gui::StackBoxBuilder::openpaintampBox
void openpaintampBox(const char *label="")
gx_gui::StackBoxBuilder::closeBox
void closeBox()
gx_gui::StackBoxBuilder::next_flags
int next_flags
Definition gx_stackbox_builder.h:51
gx_gui::StackBoxBuilder::addwidget
void addwidget(Gtk::Widget *widget)
gx_gui::StackBoxBuilder::set_accelgroup
void set_accelgroup(Glib::RefPtr< Gtk::AccelGroup > accels_)
Definition gx_stackbox_builder.h:121
gx_gui::StackBoxBuilder::fetch
void fetch(Gtk::Widget *&mainbox, Gtk::Widget *&minibox)
gx_gui::StackBoxBuilder::create_simple_c_meter
void create_simple_c_meter(const std::string &id, const std::string &idl, const char *label)
gx_gui::StackBoxBuilder::widget
Gtk::HBox * widget
Definition gx_stackbox_builder.h:48
gx_gui::StackBoxBuilder::create_small_rackknobr
void create_small_rackknobr(const std::string &id, const char *label)
gx_gui::StackBoxBuilder::mrtneural_bfile_names
std::vector< Glib::ustring > mrtneural_bfile_names
Definition gx_stackbox_builder.h:60
gx_gui::StackBoxBuilder::create_v_switch
void create_v_switch(const char *sw_type, const std::string &id, const char *label)
gx_gui::StackBoxBuilder::rtneural_file_names
std::vector< Glib::ustring > rtneural_file_names
Definition gx_stackbox_builder.h:57
gx_gui::StackBoxBuilder::ui_connect
bool ui_connect(Gtk::Widget *widget, const std::string &id)
gx_gui::StackBoxBuilder::openHorizontalBox
void openHorizontalBox(const char *label="")
gx_gui::StackBoxBuilder::check_set_flags
void check_set_flags(Gxw::Regler *r)
gx_gui::StackBoxBuilder::machine
gx_engine::GxMachineBase & machine
Definition gx_stackbox_builder.h:47
gx_gui::StackBoxBuilder::mnam_afile_names
std::vector< Glib::ustring > mnam_afile_names
Definition gx_stackbox_builder.h:55
gx_gui::StackBoxBuilder::srtneural_file_names
std::vector< Glib::ustring > srtneural_file_names
Definition gx_stackbox_builder.h:58
gx_gui::StackBoxBuilder::set_current_plugin
void set_current_plugin(PluginUI *p)
Definition gx_stackbox_builder.h:124
gx_gui::StackBoxBuilder::set_neural_file
void set_neural_file(std::string id, std::string fileid)
gx_gui::StackBoxBuilder::load_file_f
void load_file_f(const std::string &id, const std::string &idf)
gx_gui::StackBoxBuilder::create_eq_rackslider_no_caption
void create_eq_rackslider_no_caption(const std::string &id)
gx_gui::StackBoxBuilder::window_icon
Glib::RefPtr< Gdk::Pixbuf > window_icon
Definition gx_stackbox_builder.h:50
gx_gui::StackBoxBuilder::create_feedback_slider
void create_feedback_slider(const std::string &id, const char *label)
gx_gui::StackBoxBuilder::create_simple_meter
void create_simple_meter(const std::string &id)
gx_gui::StackBoxBuilder::openTabBox
void openTabBox(const char *label=0)
gx_gui::StackBoxBuilder::create_port_display
void create_port_display(const std::string &id, const char *label)
gx_gui::StackBoxBuilder::openVerticalBox2
void openVerticalBox2(const char *label=0)
gx_gui::StackBoxBuilder::create_small_rackknob
void create_small_rackknob(const std::string &id, const char *label)
gx_gui::StackBoxBuilder::on_file_chooser_response
void on_file_chooser_response(int response_id, Gtk::FileChooserDialog *d, const std::string &id, const std::string &idf)
gx_gui::StackBoxBuilder::create_master_slider
void create_master_slider(const std::string &id, const char *label)
gx_gui::StackBoxBuilder::accels
Glib::RefPtr< Gtk::AccelGroup > accels
Definition gx_stackbox_builder.h:49
gx_gui::WidgetStack
Definition gx_stackbox_builder.h:27
gx_gui::WidgetStack::push
void push(Gtk::Widget *w)
Definition gx_stackbox_builder.h:35
gx_gui::WidgetStack::box_pack_start
void box_pack_start(Gtk::Widget *w, bool expand=true, bool fill=true, int padding=0)
gx_gui::WidgetStack::notebook_append_page
void notebook_append_page(Gtk::Widget *w, Gtk::Widget *label)
gx_gui::WidgetStack::top
Gtk::Widget * top()
Definition gx_stackbox_builder.h:30
gx_gui::WidgetStack::container_add
void container_add(Gtk::Widget *w)
gx_gui::WidgetStack::add
Gtk::Widget * add(Gtk::Widget *w, const Glib::ustring &label=Glib::ustring())
gx_gui::WidgetStack::stack
std::vector< Gtk::Widget * > stack
Definition gx_stackbox_builder.h:29
gx_gui::WidgetStack::pop
void pop()
Definition gx_stackbox_builder.h:36
gx_gui::WidgetStack::top_is_notebook
bool top_is_notebook()
Definition gx_stackbox_builder.h:40
gx_gui::WidgetStack::empty
bool empty()
Definition gx_stackbox_builder.h:34
gx_gui::WidgetStack::WidgetStack
WidgetStack()
Definition gx_stackbox_builder.h:32
gx_gui::WidgetStack::~WidgetStack
~WidgetStack()
Definition gx_stackbox_builder.h:33
guitarix.h
gx_gui
Definition gx_gui_helpers.h:28