diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/EdgeView.cpp | 12 | ||||
-rw-r--r-- | src/gui/EdgeView.hpp | 16 | ||||
-rw-r--r-- | src/gui/MachinaCanvas.cpp | 22 | ||||
-rw-r--r-- | src/gui/MachinaCanvas.hpp | 18 | ||||
-rw-r--r-- | src/gui/MachinaGUI.cpp | 24 | ||||
-rw-r--r-- | src/gui/MachinaGUI.hpp | 34 | ||||
-rw-r--r-- | src/gui/NodePropertiesWindow.cpp | 12 | ||||
-rw-r--r-- | src/gui/NodePropertiesWindow.hpp | 16 | ||||
-rw-r--r-- | src/gui/NodeView.cpp | 16 | ||||
-rw-r--r-- | src/gui/NodeView.hpp | 24 | ||||
-rw-r--r-- | src/gui/WidgetFactory.hpp | 8 | ||||
-rw-r--r-- | src/gui/main.cpp | 10 |
12 files changed, 106 insertions, 106 deletions
diff --git a/src/gui/EdgeView.cpp b/src/gui/EdgeView.cpp index dd28a41..ec77a7b 100644 --- a/src/gui/EdgeView.cpp +++ b/src/gui/EdgeView.cpp @@ -25,8 +25,8 @@ #include "MachinaGUI.hpp" #include "NodeView.hpp" -namespace Machina { -namespace GUI { +namespace machina { +namespace gui { /* probability colour stuff */ @@ -67,7 +67,7 @@ using namespace Ganv; EdgeView::EdgeView(Canvas& canvas, SPtr<NodeView> src, SPtr<NodeView> dst, - SPtr<Machina::Client::ClientObject> edge) + SPtr<machina::client::ClientObject> edge) : Ganv::Edge(canvas, src.get(), dst.get(), 0x9FA0A0F4, true, false) , _edge(edge) { @@ -127,12 +127,12 @@ EdgeView::on_event(GdkEvent* ev) } void -EdgeView::on_property(Machina::URIInt key, const Raul::Atom& value) +EdgeView::on_property(machina::URIInt key, const Raul::Atom& value) { if (key == URIs::instance().machina_probability) { set_color(edge_color(value.get_float())); } } -} // namespace Machina -} // namespace GUI +} // namespace machina +} // namespace gui diff --git a/src/gui/EdgeView.hpp b/src/gui/EdgeView.hpp index bafcb6b..6d51427 100644 --- a/src/gui/EdgeView.hpp +++ b/src/gui/EdgeView.hpp @@ -24,20 +24,20 @@ #include "machina/types.hpp" -namespace Machina { -namespace GUI { +namespace machina { +namespace gui { class NodeView; class EdgeView : public Ganv::Edge - , public Machina::Client::ClientObject::View + , public machina::client::ClientObject::View { public: EdgeView(Ganv::Canvas& canvas, SPtr<NodeView> src, SPtr<NodeView> dst, - SPtr<Machina::Client::ClientObject> edge); + SPtr<machina::client::ClientObject> edge); void show_label(bool show); @@ -45,14 +45,14 @@ public: private: bool on_event(GdkEvent* ev); - void on_property(Machina::URIInt key, const Raul::Atom& value); + void on_property(machina::URIInt key, const Raul::Atom& value); float probability() const; - SPtr<Machina::Client::ClientObject> _edge; + SPtr<machina::client::ClientObject> _edge; }; -} // namespace Machina -} // namespace GUI +} // namespace machina +} // namespace gui #endif // MACHINA_EDGEVIEW_HPP diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp index 95a3f14..7a26ef0 100644 --- a/src/gui/MachinaCanvas.cpp +++ b/src/gui/MachinaCanvas.cpp @@ -33,8 +33,8 @@ using namespace Raul; using namespace Ganv; -namespace Machina { -namespace GUI { +namespace machina { +namespace gui { MachinaCanvas::MachinaCanvas(MachinaGUI* app, int width, int height) : Canvas(width, height) @@ -103,9 +103,9 @@ MachinaCanvas::on_event(GdkEvent* event) } void -MachinaCanvas::on_new_object(SPtr<Client::ClientObject> object) +MachinaCanvas::on_new_object(SPtr<client::ClientObject> object) { - const Machina::URIs& uris = URIs::instance(); + const machina::URIs& uris = URIs::instance(); const Raul::Atom& type = object->get(uris.rdf_type); if (!type.is_valid()) { return; @@ -127,9 +127,9 @@ MachinaCanvas::on_new_object(SPtr<Client::ClientObject> object) object->set_view(view); } else if (type.get<URIInt>() == uris.machina_Edge) { - SPtr<Machina::Client::ClientObject> tail = _app->client_model()->find( + SPtr<machina::client::ClientObject> tail = _app->client_model()->find( object->get(uris.machina_tail_id).get_int32()); - SPtr<Machina::Client::ClientObject> head = _app->client_model()->find( + SPtr<machina::client::ClientObject> head = _app->client_model()->find( object->get(uris.machina_head_id).get_int32()); if (!tail || !head) { @@ -150,13 +150,13 @@ MachinaCanvas::on_new_object(SPtr<Client::ClientObject> object) } void -MachinaCanvas::on_erase_object(SPtr<Client::ClientObject> object) +MachinaCanvas::on_erase_object(SPtr<client::ClientObject> object) { const Raul::Atom& type = object->get(URIs::instance().rdf_type); if (type.get<URIInt>() == URIs::instance().machina_Node) { // Destruction of the view will remove from the canvas } else if (type.get<URIInt>() == URIs::instance().machina_Edge) { - object->set_view(SPtr<Client::ClientObject::View>()); + object->set_view(SPtr<client::ClientObject::View>()); } else { std::cerr << "Unknown object type" << std::endl; } @@ -165,7 +165,7 @@ MachinaCanvas::on_erase_object(SPtr<Client::ClientObject> object) void MachinaCanvas::action_create_node(double x, double y) { - Machina::Client::ClientObject obj(0); + machina::client::ClientObject obj(0); obj.set(URIs::instance().rdf_type, _app->forge().make_urid(URIs::instance().machina_Node)); obj.set(URIs::instance().machina_canvas_x, _app->forge().make((float)x)); @@ -188,5 +188,5 @@ MachinaCanvas::action_disconnect(SPtr<NodeView> src, _app->controller()->disconnect(src->node()->id(), head->node()->id()); } -} // namespace Machina -} // namespace GUI +} // namespace machina +} // namespace gui diff --git a/src/gui/MachinaCanvas.hpp b/src/gui/MachinaCanvas.hpp index a9ca5b9..c396931 100644 --- a/src/gui/MachinaCanvas.hpp +++ b/src/gui/MachinaCanvas.hpp @@ -25,11 +25,11 @@ using namespace Ganv; -namespace Machina { +namespace machina { -namespace Client { class ClientObject; } +namespace client { class ClientObject; } -namespace GUI { +namespace gui { class MachinaGUI; class NodeView; @@ -40,11 +40,11 @@ class MachinaCanvas public: MachinaCanvas(MachinaGUI* app, int width, int height); - //void build(SPtr<const Machina::Machine> machine, bool show_labels); + //void build(SPtr<const machina::Machine> machine, bool show_labels); //void update_edges(); - void on_new_object(SPtr<Machina::Client::ClientObject> object); - void on_erase_object(SPtr<Machina::Client::ClientObject> object); + void on_new_object(SPtr<machina::client::ClientObject> object); + void on_erase_object(SPtr<machina::client::ClientObject> object); MachinaGUI* app() { return _app; } @@ -54,7 +54,7 @@ protected: bool node_clicked(WPtr<NodeView> item, GdkEventButton* ev); private: - //SPtr<NodeView> create_node_view(SPtr<Machina::Node> node); + //SPtr<NodeView> create_node_view(SPtr<machina::Node> node); void action_create_node(double x, double y); @@ -68,7 +68,7 @@ private: WPtr<NodeView> _last_clicked; }; -} // namespace Machina -} // namespace GUI +} // namespace machina +} // namespace gui #endif // MACHINA_CANVAS_HPP_HPP diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp index f162ebd..376f42e 100644 --- a/src/gui/MachinaGUI.cpp +++ b/src/gui/MachinaGUI.cpp @@ -38,16 +38,16 @@ #include "machina/Evolver.hpp" #endif -namespace Machina { -namespace GUI { +namespace machina { +namespace gui { -MachinaGUI::MachinaGUI(SPtr<Machina::Engine> engine) +MachinaGUI::MachinaGUI(SPtr<machina::Engine> engine) : _refresh(false) , _evolve(false) , _unit(TimeUnit::BEATS, 19200) , _engine(engine) - , _client_model(new Machina::Client::ClientModel()) - , _controller(new Machina::Controller(_engine, *_client_model.get())) + , _client_model(new machina::client::ClientModel()) + , _controller(new machina::Controller(_engine, *_client_model.get())) , _maid(new Raul::Maid()) { _canvas = SPtr<MachinaCanvas>(new MachinaCanvas(this, 1600*2, 1200*2)); @@ -241,7 +241,7 @@ MachinaGUI::idle_callback() static void erase_node(GanvNode* node, void* data) { - Machina::Controller* controller = (Machina::Controller*)data; + machina::Controller* controller = (machina::Controller*)data; NodeView* const view = dynamic_cast<NodeView*>( Glib::wrap(GANV_NODE(node))); if (view) { @@ -429,7 +429,7 @@ MachinaGUI::menu_file_open() const int result = dialog.run(); if (result == Gtk::RESPONSE_OK) { - SPtr<Machina::Machine> new_machine = _engine->load_machine(dialog.get_uri()); + SPtr<machina::Machine> new_machine = _engine->load_machine(dialog.get_uri()); if (new_machine) { _canvas->destroy(); _controller->announce(new_machine); @@ -536,7 +536,7 @@ MachinaGUI::menu_import_midi() const double length_dbl = length_sb->get_value_as_int(); const Raul::TimeStamp length(_unit, length_dbl); - SPtr<Machina::Machine> machine = _engine->load_machine_midi( + SPtr<machina::Machine> machine = _engine->load_machine_midi( dialog.get_filename(), 0.0, length); if (machine) { @@ -695,16 +695,16 @@ MachinaGUI::play_toggled() } void -MachinaGUI::on_new_object(SPtr<Client::ClientObject> object) +MachinaGUI::on_new_object(SPtr<client::ClientObject> object) { _canvas->on_new_object(object); } void -MachinaGUI::on_erase_object(SPtr<Client::ClientObject> object) +MachinaGUI::on_erase_object(SPtr<client::ClientObject> object) { _canvas->on_erase_object(object); } -} // namespace Machina -} // namespace GUI +} // namespace machina +} // namespace gui diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp index f9b0857..2636051 100644 --- a/src/gui/MachinaGUI.hpp +++ b/src/gui/MachinaGUI.hpp @@ -29,30 +29,30 @@ using namespace std; -namespace Machina { +namespace machina { class Machine; class Engine; class Evolver; class Controller; -namespace Client { +namespace client { class ClientModel; class ClientObject; } -namespace GUI { +namespace gui { class MachinaCanvas; class MachinaGUI { public: - MachinaGUI(SPtr<Machina::Engine> engine); + MachinaGUI(SPtr<machina::Engine> engine); ~MachinaGUI(); SPtr<MachinaCanvas> canvas() { return _canvas; } - SPtr<Machina::Engine> engine() { return _engine; } + SPtr<machina::Engine> engine() { return _engine; } Raul::Forge& forge() { return _forge; } @@ -63,14 +63,14 @@ public: void attach(); void quit() { _main_window->hide(); } - SPtr<Machina::Controller> controller() { return _controller; } + SPtr<machina::Controller> controller() { return _controller; } inline void queue_refresh() { _refresh = true; } - void on_new_object(SPtr<Machina::Client::ClientObject> object); - void on_erase_object(SPtr<Machina::Client::ClientObject> object); + void on_new_object(SPtr<machina::client::ClientObject> object); + void on_erase_object(SPtr<machina::client::ClientObject> object); - SPtr<Machina::Client::ClientModel> client_model() { + SPtr<machina::client::ClientModel> client_model() { return _client_model; } @@ -91,8 +91,8 @@ protected: void arrange(); void load_target_clicked(); - void random_mutation(SPtr<Machina::Machine> machine); - void mutate(SPtr<Machina::Machine> machine, unsigned mutation); + void random_mutation(SPtr<machina::Machine> machine); + void mutate(SPtr<machina::Machine> machine, unsigned mutation); void zoom(double z); void update_toolbar(); @@ -120,12 +120,12 @@ protected: Raul::TimeUnit _unit; SPtr<MachinaCanvas> _canvas; - SPtr<Machina::Engine> _engine; - SPtr<Machina::Client::ClientModel> _client_model; - SPtr<Machina::Controller> _controller; + SPtr<machina::Engine> _engine; + SPtr<machina::client::ClientModel> _client_model; + SPtr<machina::Controller> _controller; SPtr<Raul::Maid> _maid; - SPtr<Machina::Evolver> _evolver; + SPtr<machina::Evolver> _evolver; Raul::Forge _forge; @@ -174,7 +174,7 @@ protected: Gtk::ToolButton* _adjust_edge_button; }; -} // namespace Machina -} // namespace GUI +} // namespace machina +} // namespace gui #endif // MACHINA_GUI_HPP diff --git a/src/gui/NodePropertiesWindow.cpp b/src/gui/NodePropertiesWindow.cpp index a58d649..bd275f5 100644 --- a/src/gui/NodePropertiesWindow.cpp +++ b/src/gui/NodePropertiesWindow.cpp @@ -21,8 +21,8 @@ using namespace std; -namespace Machina { -namespace GUI { +namespace machina { +namespace gui { NodePropertiesWindow* NodePropertiesWindow::_instance = NULL; @@ -88,7 +88,7 @@ NodePropertiesWindow::ok_clicked() } void -NodePropertiesWindow::set_node(SPtr<Machina::Client::ClientObject> node) +NodePropertiesWindow::set_node(SPtr<machina::client::ClientObject> node) { _node = node; #if 0 @@ -109,7 +109,7 @@ NodePropertiesWindow::set_node(SPtr<Machina::Client::ClientObject> node) void NodePropertiesWindow::present(Gtk::Window* parent, - SPtr<Machina::Client::ClientObject> node) + SPtr<machina::client::ClientObject> node) { if (!_instance) { Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create(); @@ -125,5 +125,5 @@ NodePropertiesWindow::present(Gtk::Window* parent, _instance->show(); } -} // namespace Machina -} // namespace GUI +} // namespace machina +} // namespace gui diff --git a/src/gui/NodePropertiesWindow.hpp b/src/gui/NodePropertiesWindow.hpp index 78a5285..002f0cd 100644 --- a/src/gui/NodePropertiesWindow.hpp +++ b/src/gui/NodePropertiesWindow.hpp @@ -22,11 +22,11 @@ #include "machina/types.hpp" -namespace Machina { +namespace machina { -namespace Client { class ClientObject; } +namespace client { class ClientObject; } -namespace GUI { +namespace gui { class NodePropertiesWindow : public Gtk::Dialog @@ -38,10 +38,10 @@ public: ~NodePropertiesWindow(); static void present(Gtk::Window* parent, - SPtr<Machina::Client::ClientObject> node); + SPtr<machina::client::ClientObject> node); private: - void set_node(SPtr<Machina::Client::ClientObject> node); + void set_node(SPtr<machina::client::ClientObject> node); void apply_clicked(); void cancel_clicked(); @@ -49,7 +49,7 @@ private: static NodePropertiesWindow* _instance; - SPtr<Machina::Client::ClientObject> _node; + SPtr<machina::client::ClientObject> _node; Gtk::SpinButton* _note_spinbutton; Gtk::SpinButton* _duration_spinbutton; @@ -58,7 +58,7 @@ private: Gtk::Button* _ok_button; }; -} // namespace Machina -} // namespace GUI +} // namespace machina +} // namespace gui #endif // NODEPROPERTIESWINDOW_HPP diff --git a/src/gui/NodeView.cpp b/src/gui/NodeView.cpp index 79258cd..674531c 100644 --- a/src/gui/NodeView.cpp +++ b/src/gui/NodeView.cpp @@ -28,12 +28,12 @@ using namespace std; -namespace Machina { -namespace GUI { +namespace machina { +namespace gui { NodeView::NodeView(Gtk::Window* window, Ganv::Canvas& canvas, - SPtr<Machina::Client::ClientObject> node, + SPtr<machina::client::ClientObject> node, double x, double y) : Ganv::Circle(canvas, "", x, y, 20, false) @@ -57,7 +57,7 @@ NodeView::on_double_click(GdkEventButton*) } bool -NodeView::node_is(Raul::Forge& forge, Machina::URIInt key) +NodeView::node_is(Raul::Forge& forge, machina::URIInt key) { const Raul::Atom& value = _node->get(key); return value.type() == forge.Bool && value.get_bool(); @@ -124,7 +124,7 @@ NodeView::show_label(bool show) } void -NodeView::on_property(Machina::URIInt key, const Raul::Atom& value) +NodeView::on_property(machina::URIInt key, const Raul::Atom& value) { static const uint32_t active_color = 0x408040FF; static const uint32_t active_border_color = 0x00FF00FF; @@ -161,7 +161,7 @@ NodeView::on_property(Machina::URIInt key, const Raul::Atom& value) } void -NodeView::on_action_property(Machina::URIInt key, const Raul::Atom& value) +NodeView::on_action_property(machina::URIInt key, const Raul::Atom& value) { if (key == URIs::instance().machina_note_number) { show_label(true); @@ -175,5 +175,5 @@ NodeView::set_default_colors() set_border_color(_default_border_color); } -} // namespace Machina -} // namespace GUI +} // namespace machina +} // namespace gui diff --git a/src/gui/NodeView.hpp b/src/gui/NodeView.hpp index 5507a75..815e9e2 100644 --- a/src/gui/NodeView.hpp +++ b/src/gui/NodeView.hpp @@ -24,21 +24,21 @@ #include "machina/types.hpp" -namespace Machina { -namespace GUI { +namespace machina { +namespace gui { class NodeView : public Ganv::Circle - , public Machina::Client::ClientObject::View + , public machina::client::ClientObject::View { public: NodeView(Gtk::Window* window, Canvas& canvas, - SPtr<Machina::Client::ClientObject> node, + SPtr<machina::client::ClientObject> node, double x, double y); - SPtr<Machina::Client::ClientObject> node() { return _node; } + SPtr<machina::client::ClientObject> node() { return _node; } void show_label(bool show); @@ -53,23 +53,23 @@ public: private: bool on_event(GdkEvent* ev); bool on_double_click(GdkEventButton* ev); - void on_property(Machina::URIInt key, const Raul::Atom& value); - void on_action_property(Machina::URIInt key, const Raul::Atom& value); + void on_property(machina::URIInt key, const Raul::Atom& value); + void on_action_property(machina::URIInt key, const Raul::Atom& value); - bool node_is(Raul::Forge& forge, Machina::URIInt key); + bool node_is(Raul::Forge& forge, machina::URIInt key); Gtk::Window* _window; - SPtr<Machina::Client::ClientObject> _node; + SPtr<machina::client::ClientObject> _node; uint32_t _default_border_color; uint32_t _default_fill_color; - SPtr<Machina::Client::ClientObject> _enter_action; + SPtr<machina::client::ClientObject> _enter_action; sigc::connection _enter_action_connection; sigc::signal<bool, GdkEventButton*> _signal_clicked; }; -} // namespace Machina -} // namespace GUI +} // namespace machina +} // namespace gui #endif // MACHINA_NODEVIEW_HPP diff --git a/src/gui/WidgetFactory.hpp b/src/gui/WidgetFactory.hpp index 4f54998..38ed809 100644 --- a/src/gui/WidgetFactory.hpp +++ b/src/gui/WidgetFactory.hpp @@ -23,8 +23,8 @@ #include "machina_config.h" -namespace Machina { -namespace GUI { +namespace machina { +namespace gui { class WidgetFactory { @@ -62,5 +62,5 @@ public: }; -} // namespace Machina -} // namespace GUI +} // namespace machina +} // namespace gui diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 25b1254..c61c7a3 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -27,7 +27,7 @@ #include "MachinaGUI.hpp" using namespace std; -using namespace Machina; +using namespace machina; int main(int argc, char** argv) @@ -38,16 +38,16 @@ main(int argc, char** argv) Sord::World rdf_world; - Machina::URIs::init(); + machina::URIs::init(); - SPtr<Machina::Machine> machine; + SPtr<machina::Machine> machine; // Load machine, if given #if 0 if (argc >= 2) { const string filename = argv[1]; cout << "Building machine from MIDI file " << filename << endl; - SPtr<Machina::SMFDriver> file_driver(new Machina::SMFDriver()); + SPtr<machina::SMFDriver> file_driver(new machina::SMFDriver()); if (argc >= 3) { float q = strtof(argv[2], NULL); @@ -83,7 +83,7 @@ main(int argc, char** argv) Gtk::Main app(argc, argv); driver->activate(); - GUI::MachinaGUI gui(engine); + gui::MachinaGUI gui(engine); app.run(*gui.window()); |