34 Glib::RefPtr<gx_gui::GxBuilder> bld = gx_gui::GxBuilder::create_from_file(
41 return new SEQWindow(bld, tomp, kickp, snarep, hatp, machine);
58 bld->get_toplevel(
"SequencerWindow", gtk_window);
65 void SEQWindow::init_connect() {
68 builder->find_widget(
"hbox1", tom_box);
69 builder->find_widget(
"hbox2", kick_box);
70 builder->find_widget(
"hbox3", snare_box);
71 builder->find_widget(
"hbox4", hat_box);
72 builder->find_widget(
"gxplayhead1", seq_pos);
73 builder->find_widget(
"gxsmallknob6", seq_count);
74 builder->find_widget(
"hbox12", preset_button);
76 on_sec_length_changed(
false);
78 make_preset_button(preset_button);
81 sigc::mem_fun(
this, &SEQWindow::seq_changed), tom_box));
83 sigc::mem_fun(
this, &SEQWindow::seq_changed), kick_box));
85 sigc::mem_fun(
this, &SEQWindow::seq_changed), snare_box));
87 sigc::mem_fun(
this, &SEQWindow::seq_changed), hat_box));
89 Glib::ListHandle<Gtk::Widget*> tomList = tom_box->get_children();
90 for (Glib::ListHandle<Gtk::Widget*>::iterator itt = tomList.begin();itt != tomList.end(); ++itt) {
91 dynamic_cast<Gtk::ToggleButton*
>((*itt))->signal_clicked().connect(
92 sigc::bind(sigc::bind(sigc::mem_fun(
this, &SEQWindow::on_seq_button_clicked),tomp),tom_box));
95 Glib::ListHandle<Gtk::Widget*> kickList = kick_box->get_children();
96 for (Glib::ListHandle<Gtk::Widget*>::iterator itt = kickList.begin();itt != kickList.end(); ++itt) {
97 dynamic_cast<Gtk::ToggleButton*
>((*itt))->signal_clicked().connect(
98 sigc::bind(sigc::bind(sigc::mem_fun(
this, &SEQWindow::on_seq_button_clicked),kickp),kick_box));
101 Glib::ListHandle<Gtk::Widget*> snareList = snare_box->get_children();
102 for (Glib::ListHandle<Gtk::Widget*>::iterator itt = snareList.begin();itt != snareList.end(); ++itt) {
103 dynamic_cast<Gtk::ToggleButton*
>((*itt))->signal_clicked().connect(
104 sigc::bind(sigc::bind(sigc::mem_fun(
this, &SEQWindow::on_seq_button_clicked),snarep),snare_box));
107 Glib::ListHandle<Gtk::Widget*> hatList = hat_box->get_children();
108 for (Glib::ListHandle<Gtk::Widget*>::iterator itt = hatList.begin();itt != hatList.end(); ++itt) {
109 dynamic_cast<Gtk::ToggleButton*
>((*itt))->signal_clicked().connect(
110 sigc::bind(sigc::bind(sigc::mem_fun(
this, &SEQWindow::on_seq_button_clicked),hatp),hat_box));
115 seq_pos->get_property(
"var_id",
id);
116 Glib::signal_timeout().connect(sigc::bind<Gxw::Regler*>(sigc::bind<const std::string>(
117 sigc::mem_fun(*
this, &SEQWindow::get_sequencer_pos),
id), seq_pos), 60);
119 seq_count->signal_value_changed().connect(sigc::bind(sigc::mem_fun(*
this,
120 &SEQWindow::on_sec_length_changed),
true));
122 gtk_window->signal_key_press_event().connect(
123 sigc::mem_fun(
this, &SEQWindow::on_key_press_event));
126 void SEQWindow::make_preset_button(Gtk::HBox * box) {
127 Gtk::Button *p =
new Gtk::Button();
129 p->add(*Gtk::manage(l));
130 p->set_can_default(
false);
131 p->set_can_focus(
false);
132 p->set_tooltip_text(_(
"manage effect unit presets"));
133 p->set_name(
"effect_on_off");
134 box->pack_start(*Gtk::manage(p),Gtk::PACK_SHRINK);
135 p->signal_clicked().connect(
136 sigc::mem_fun(*
this, &SEQWindow::on_preset_popup_clicked));
140 void SEQWindow::on_preset_popup_clicked() {
144 void SEQWindow::on_sec_length_changed(
bool update) {
145 static int r_save = 24;
148 remove_seq_block(tom_box, r);
149 remove_seq_block(kick_box, r);
150 remove_seq_block(snare_box, r);
151 remove_seq_block(hat_box, r);
153 }
else if( r_save < r) {
154 append_seq_block(tom_box,tomp, r,r_save);
155 append_seq_block(kick_box,kickp, r,r_save);
156 append_seq_block(snare_box,snarep, r,r_save);
157 append_seq_block(hat_box,hatp, r,r_save);
161 on_seq_button_clicked(tom_box,tomp);
162 on_seq_button_clicked(kick_box,kickp);
163 on_seq_button_clicked(snare_box,snarep);
164 on_seq_button_clicked(hat_box,hatp);
170 Gtk::ToggleButton * ab;
171 for(
int j = r_save; j<r; ++j) {
172 ab =
new Gtk::ToggleButton();
173 box->pack_start(*Gtk::manage(ab),Gtk::PACK_EXPAND_WIDGET);
174 ab->signal_clicked().connect(
175 sigc::bind(sigc::bind(sigc::mem_fun(
this, &SEQWindow::on_seq_button_clicked),p),box));
180 void SEQWindow::remove_seq_block(Gtk::HBox * box,
int r) {
181 Glib::ListHandle<Gtk::Widget*> boxList = box->get_children();
183 for (Glib::ListHandle<Gtk::Widget*>::iterator itt = boxList.begin();itt != boxList.end(); ++itt) {
185 box->remove(*(*itt));
192 bool SEQWindow::get_sequencer_pos(
Gxw::Regler * regler,
const std::string
id) {
203 bool SEQWindow::on_key_press_event(GdkEventKey *event) {
208 std::vector<int> sequence;
210 Glib::ListHandle<Gtk::Widget*> seqList = box->get_children();
211 for (Glib::ListHandle<Gtk::Widget*>::iterator itt = seqList.begin();itt != seqList.end(); ++itt) {
212 sequence.push_back(dynamic_cast<Gtk::ToggleButton*>((*itt))->get_active());
220 Glib::ListHandle<Gtk::Widget*> seqList = box->get_children();
221 Glib::ListHandle<Gtk::Widget*>::iterator itt = seqList.begin();
222 std::vector<int> sequence = seqc->
getseqline();
223 for (std::vector<int>::const_iterator i = sequence.begin(); i != sequence.end(); ++i) {
224 if (itt == seqList.end())
break;
225 dynamic_cast<Gtk::ToggleButton*
>((*itt))->set_active(*i);
231 if (gtk_window->get_visible() && !(gtk_window->get_window()->get_state() & Gdk::WINDOW_STATE_ICONIFIED)) {
234 seq_changed(&tomp->
get_value(), tom_box);
235 seq_changed(&kickp->
get_value(), kick_box);
236 seq_changed(&snarep->
get_value(), snare_box);
237 seq_changed(&hatp->
get_value(), hat_box);
238 gtk_window->present();
242 SEQWindow::~SEQWindow() {
void setseqline(const std::vector< int > &seq)
const std::vector< int > & getseqline() const
std::string get_builder_filepath(const std::string &basename) const
virtual Parameter & get_parameter(const std::string &id)=0
static SEQWindow * create(const std::string &unit_id, gx_engine::GxMachineBase &machine)
bool set(const GxSeqSettings &val) const
std::string get_style_filepath(const std::string &basename) const
void cp_set_value(double value)
T get_parameter_value(const std::string &id)
virtual bool parameter_hasId(const char *p)=0
virtual gx_system::CmdlineOptions & get_options() const =0
virtual Plugin * pluginlist_lookup_plugin(const std::string &id) const =0
sigc::signal< void, const GxSeqSettings * > & signal_changed()
sigc::signal< void, T > & signal_parameter_value(const std::string &id)
const GxSeqSettings & get_value() const