Make menu elements do things
git-svn-id: file:///home/vcs/svn/jsweeper/trunk@8 6611ac79-6612-48ef-a1e9-b906f853523emaster
parent
a3bc38d0c1
commit
f9298c351d
|
@ -20,6 +20,8 @@ Colour::Colour(std::string Code)
|
|||
p[0] = Code[5];
|
||||
p[1] = Code[6];
|
||||
b = (float)strtol(p, NULL, 16) / 0xFF;
|
||||
|
||||
colour.set_rgb_p(r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
#ifndef COLOUR_H
|
||||
#define COLOUR_H
|
||||
|
||||
#include <gdkmm/color.h>
|
||||
|
||||
struct Colour
|
||||
{
|
||||
Gdk::Color colour;
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
|
|
71
src/gui.cpp
71
src/gui.cpp
|
@ -22,8 +22,16 @@ Gui::Gui(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &builder)
|
|||
|
||||
Glib::signal_idle().connect(sigc::mem_fun(*this, &Gui::on_idle));
|
||||
|
||||
Preferences *p = Preferences::Open();
|
||||
p->show();
|
||||
Glib::RefPtr<Gtk::UIManager> uim = Glib::RefPtr<Gtk::UIManager>::cast_static(builder->get_object("uimanager1"));
|
||||
uim->get_action("/menubar1/menuitem1/menu_quit")->signal_activate().connect(sigc::mem_fun(*this, &Gui::on_quit));
|
||||
uim->get_action("/menubar1/menuitem5/menu_session_open")->signal_activate().connect(sigc::mem_fun(*this, &Gui::on_session_open));
|
||||
uim->get_action("/menubar1/menuitem5/menu_session_save")->signal_activate().connect(sigc::mem_fun(*this, &Gui::on_session_save));
|
||||
uim->get_action("/menubar1/menuitem5/menu_session_save_as")->signal_activate().connect(sigc::mem_fun(*this, &Gui::on_session_save_as));
|
||||
uim->get_action("/menubar1/menuitem5/menu_session_close")->signal_activate().connect(sigc::mem_fun(*this, &Gui::on_session_close));
|
||||
uim->get_action("/menubar1/menuitem2/menu_preferences")->signal_activate().connect(sigc::mem_fun(*this, &Gui::on_preferences));
|
||||
uim->get_action("/menubar1/menuitem3/menu_connect")->signal_activate().connect(sigc::mem_fun(*this, &Gui::on_connect));
|
||||
uim->get_action("/menubar1/menuitem3/menu_disconnect")->signal_activate().connect(sigc::mem_fun(*this, &Gui::on_disconnect));
|
||||
uim->get_action("/menubar1/menuitem4/menu_about")->signal_activate().connect(sigc::mem_fun(*this, &Gui::on_about));
|
||||
}
|
||||
|
||||
Gui::~Gui()
|
||||
|
@ -146,6 +154,43 @@ void Gui::on_notebook_switch_page(GtkNotebookPage * /* page */, guint /* page_nu
|
|||
Refresh();
|
||||
}
|
||||
|
||||
void Gui::on_quit()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
void Gui::on_session_open()
|
||||
{
|
||||
}
|
||||
void Gui::on_session_save()
|
||||
{
|
||||
}
|
||||
void Gui::on_session_save_as()
|
||||
{
|
||||
}
|
||||
void Gui::on_session_close()
|
||||
{
|
||||
}
|
||||
void Gui::on_preferences()
|
||||
{
|
||||
Preferences *p = Preferences::Open();
|
||||
p->show();
|
||||
}
|
||||
void Gui::on_connect()
|
||||
{
|
||||
jack.Connect();
|
||||
Refresh();
|
||||
}
|
||||
void Gui::on_disconnect()
|
||||
{
|
||||
jack.Disconnect();
|
||||
Refresh();
|
||||
}
|
||||
void Gui::on_about()
|
||||
{
|
||||
Gtk::AboutDialog *about; g_builder->get_widget("aboutdialog1", about);
|
||||
about->show();
|
||||
}
|
||||
|
||||
Preferences::Preferences(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builder> &builder)
|
||||
: Gtk::Dialog(cobject)
|
||||
{
|
||||
|
@ -191,14 +236,28 @@ Preferences::Preferences(BaseObjectType *cobject, const Glib::RefPtr<Gtk::Builde
|
|||
check_expand_clients->set_active(cfg.ExpandClients);
|
||||
check_expand_groups->set_active(cfg.ExpandGroups);
|
||||
|
||||
fontbutton_font->set_font_name(cfg.FontFace);
|
||||
char font[256];
|
||||
snprintf(font, sizeof font, "%s %d", cfg.FontFace.c_str(), cfg.FontSize);
|
||||
fontbutton_font->set_font_name(font);
|
||||
spin_cell_padding->set_value(cfg.CellPadding);
|
||||
|
||||
colour_background->set_color(cfg.Background.colour);
|
||||
colour_clients->set_color(cfg.TabClient.colour);
|
||||
colour_port_groups->set_color(cfg.TabGroup.colour);
|
||||
colour_ports_audio->set_color(cfg.TabPortAudio.colour);
|
||||
colour_ports_midi->set_color(cfg.TabPortMidi.colour);
|
||||
colour_text->set_color(cfg.Text.colour);
|
||||
colour_grid_client->set_color(cfg.GridLinesClient.colour);
|
||||
colour_grid_group->set_color(cfg.GridLinesGroup.colour);
|
||||
colour_grid_port->set_color(cfg.GridLinesPort.colour);
|
||||
|
||||
button_preferences_close->signal_clicked().connect(sigc::mem_fun(*this, &Preferences::on_preferences_close_click));
|
||||
|
||||
check_separate_port_type->signal_clicked().connect(sigc::mem_fun(*this, &Preferences::on_check_separate_port_type_click));
|
||||
check_expand_clients->signal_clicked().connect(sigc::mem_fun(*this, &Preferences::on_check_expand_clients_click));
|
||||
check_expand_groups->signal_clicked().connect(sigc::mem_fun(*this, &Preferences::on_check_expand_groups_click));
|
||||
|
||||
spin_cell_padding->signal_value_changed().connect(sigc::mem_fun(*this, &Preferences::on_spin_cell_padding_click));
|
||||
}
|
||||
|
||||
Preferences *Preferences::Open()
|
||||
|
@ -229,3 +288,9 @@ void Preferences::on_check_expand_groups_click()
|
|||
{
|
||||
cfg.ExpandGroups = check_expand_groups->get_active();
|
||||
}
|
||||
|
||||
void Preferences::on_spin_cell_padding_click()
|
||||
{
|
||||
cfg.CellPadding = spin_cell_padding->get_value();
|
||||
g->Refresh();
|
||||
}
|
||||
|
|
12
src/gui.h
12
src/gui.h
|
@ -31,6 +31,16 @@ public:
|
|||
protected:
|
||||
bool on_idle();
|
||||
void on_notebook_switch_page(GtkNotebookPage * /* page */, guint /* page_num */);
|
||||
|
||||
void on_quit();
|
||||
void on_session_open();
|
||||
void on_session_save();
|
||||
void on_session_save_as();
|
||||
void on_session_close();
|
||||
void on_preferences();
|
||||
void on_connect();
|
||||
void on_disconnect();
|
||||
void on_about();
|
||||
};
|
||||
|
||||
class Preferences : public Gtk::Dialog
|
||||
|
@ -90,6 +100,8 @@ protected:
|
|||
void on_check_separate_port_type_click();
|
||||
void on_check_expand_clients_click();
|
||||
void on_check_expand_groups_click();
|
||||
|
||||
void on_spin_cell_padding_click();
|
||||
};
|
||||
|
||||
extern Gui *g;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <stdlib.h>
|
||||
#include "jack.h"
|
||||
#include "portmanager.h"
|
||||
#include "gui.h"
|
||||
|
||||
JackDriver::JackDriver()
|
||||
{
|
||||
|
@ -54,11 +55,18 @@ void JackDriver::Disconnect()
|
|||
jack_client_close(m_client);
|
||||
|
||||
jack_ringbuffer_free(m_buffer);
|
||||
|
||||
pm.Refresh();
|
||||
}
|
||||
|
||||
void JackDriver::ShutdownCallback()
|
||||
{
|
||||
m_connected = false;
|
||||
|
||||
jack_ringbuffer_free(m_buffer);
|
||||
|
||||
pm.Refresh();
|
||||
if (g) g->Refresh();
|
||||
}
|
||||
|
||||
void JackDriver::PortRegistrationCallback(jack_port_id_t port_id, int reg)
|
||||
|
|
|
@ -11,6 +11,8 @@ void PortManager::Refresh()
|
|||
m_clients.clear();
|
||||
m_ports.clear();
|
||||
|
||||
if (!jack.IsConnected()) return;
|
||||
|
||||
jack_client_t *client = jack.GetClient();
|
||||
|
||||
const char **ports = jack_get_ports(client, NULL, NULL, 0);
|
||||
|
|
Loading…
Reference in New Issue