Bug fixes.

git-svn-id: http://svn.drobilla.net/lad@134 a436a847-0d15-0410-975c-d299462d15a1
This commit is contained in:
dave 2006-09-14 06:30:26 +00:00
parent 1653b9dfdd
commit c87d84b448
13 changed files with 39 additions and 71 deletions

View File

@ -56,14 +56,14 @@ ModelEngineInterface::create_node_with_data(const string& plugin_uri,
/** Create a patch.
*/
void
ModelEngineInterface::create_patch_from_model(const PatchModel* pm)
ModelEngineInterface::create_patch_with_data(const Path& path, size_t poly, const MetadataMap& data)
{
create_patch(pm->path().c_str(), pm->poly());
set_metadata_map(pm->path(), pm->metadata());
create_patch(path, poly);
set_metadata_map(path, data);
}
/** Set all pieces of metadata in a model.
/** Set all pieces of metadata in a map.
*/
void
ModelEngineInterface::set_metadata_map(const Path& subject, const MetadataMap& data)

View File

@ -44,7 +44,9 @@ class ModelEngineInterface : public virtual Shared::EngineInterface
public:
virtual ~ModelEngineInterface() {}
virtual void create_patch_from_model(const PatchModel* pm);
virtual void create_patch_with_data(const Path& path,
size_t poly,
const MetadataMap& initial_data);
virtual void create_node_with_data(const string& plugin_uri,
const Path& path,

View File

@ -122,6 +122,9 @@ NodeModel::add_port(CountedPtr<PortModel> pm)
// Store should have handled this by merging the two
assert(existing == m_ports.end());
m_ports.push_back(pm);
new_port_sig.emit(pm);
}

View File

@ -479,7 +479,8 @@ PatchLibrarian::load_patch(CountedPtr<PatchModel> pm, bool wait, bool existing)
if (wait) {
//int id = _engine->get_next_request_id();
//_engine->set_wait_response_id(id);
_engine->create_patch_from_model(pm.get());
cerr << "FIXME: create patch\n";
//_engine->create_patch_from_model(pm.get());
//bool succeeded = _engine->wait_for_response();
// If creating the patch failed, bail out so we don't load all these nodes
@ -489,7 +490,8 @@ PatchLibrarian::load_patch(CountedPtr<PatchModel> pm, bool wait, bool existing)
return "";
}*/ // FIXME
} else {
_engine->create_patch_from_model(pm.get());
cerr << "FIXME: create patch (2)\n";
//_engine->create_patch_from_model(pm.get());
}
}

View File

@ -35,9 +35,7 @@ namespace Ingenuity {
LoadPluginWindow::LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml)
: Gtk::Window(cobject),
m_has_shown(false),
m_plugin_name_offset(0),
m_new_module_x(0),
m_new_module_y(0)
m_plugin_name_offset(0)
{
xml->get_widget("load_plugin_plugins_treeview", m_plugins_treeview);
xml->get_widget("load_plugin_polyphonic_checkbutton", m_polyphonic_checkbutton);
@ -183,15 +181,6 @@ LoadPluginWindow::on_show()
}
void
LoadPluginWindow::on_hide()
{
m_new_module_x = 0;
m_new_module_y = 0;
Gtk::Window::on_hide();
}
void
LoadPluginWindow::set_plugin_list(const std::map<string, CountedPtr<PluginModel> >& m)
{
@ -319,8 +308,9 @@ LoadPluginWindow::add_clicked()
m_node_name_entry->set_text(generate_module_name(m_plugin_name_offset));
// Set the next module location 20 over, for a cascade effect
m_new_module_x += 20;
m_new_module_y += 20;
cerr << "FIXME: cascade\n";
//m_new_module_x += 20;
//m_new_module_y += 20;
}
}
}

View File

@ -98,7 +98,6 @@ public:
protected:
void on_show();
void on_hide();
bool on_key_press_event(GdkEventKey* event);
private:
@ -129,9 +128,6 @@ private:
int m_plugin_name_offset; // see comments for generate_plugin_name
double m_new_module_x;
double m_new_module_y;
Gtk::TreeView* m_plugins_treeview;
Gtk::CheckButton* m_polyphonic_checkbutton;
Gtk::Entry* m_node_name_entry;

View File

@ -30,9 +30,7 @@ namespace Ingenuity {
LoadSubpatchWindow::LoadSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml)
: Gtk::FileChooserDialog(cobject),
m_new_module_x(0),
m_new_module_y(0)
: Gtk::FileChooserDialog(cobject)
{
xml->get_widget("load_subpatch_name_from_file_radio", m_name_from_file_radio);
xml->get_widget("load_subpatch_name_from_user_radio", m_name_from_user_radio);
@ -152,12 +150,6 @@ LoadSubpatchWindow::ok_clicked()
else if (m_poly_from_parent_radio->get_active())
poly = m_patch->poly();
if (m_new_module_x == 0 && m_new_module_y == 0) {
throw; // FIXME
//m_patch_controller->get_view()->canvas()->get_new_module_location(
// m_new_module_x, m_new_module_y);
}
/*CountedPtr<PatchModel> pm(new PatchModel(m_patch->path().base() + name, poly));
pm->filename(filename);

View File

@ -59,9 +59,6 @@ private:
CountedPtr<PatchModel> m_patch;
double m_new_module_x;
double m_new_module_y;
Gtk::RadioButton* m_name_from_file_radio;
Gtk::RadioButton* m_name_from_user_radio;
Gtk::Entry* m_name_entry;

View File

@ -25,9 +25,7 @@ namespace Ingenuity {
NewSubpatchWindow::NewSubpatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml)
: Gtk::Window(cobject),
m_new_module_x(0),
m_new_module_y(0)
: Gtk::Window(cobject)
{
xml->get_widget("new_subpatch_name_entry", m_name_entry);
xml->get_widget("new_subpatch_message_label", m_message_label);
@ -87,24 +85,11 @@ NewSubpatchWindow::name_changed()
void
NewSubpatchWindow::ok_clicked()
{
cerr << "FIXME: new subpatch\n";
#if 0
PatchModel* pm = new PatchModel(
m_patch->path().base() + m_name_entry->get_text(),
m_poly_spinbutton->get_value_as_int());
const Path path = m_patch->path().base() + Path::nameify(m_name_entry->get_text());
const size_t poly = m_poly_spinbutton->get_value_as_int();
if (m_new_module_x == 0 && m_new_module_y == 0) {
throw; // FIXME
//m_patch_controller->get_view()->canvas()->get_new_module_location(
// m_new_module_x, m_new_module_y);
}
// FIXME: necessary?
//pm->set_parent(m_patch);
pm->set_metadata("module-x", (float)m_new_module_x);
pm->set_metadata("module-y", (float)m_new_module_y);
App::instance().engine()->create_patch_from_model(pm);
#endif
App::instance().engine()->create_patch_with_data(path, poly, m_initial_data);
hide();
}

View File

@ -51,9 +51,6 @@ private:
MetadataMap m_initial_data;
CountedPtr<PatchModel> m_patch;
double m_new_module_x;
double m_new_module_y;
Gtk::Entry* m_name_entry;
Gtk::Label* m_message_label;
Gtk::SpinButton* m_poly_spinbutton;

View File

@ -122,7 +122,7 @@ PatchWindow::~PatchWindow()
// Prevents deletion
//m_patch->claim_patch_view();
App::instance().remove_patch_window(this);
//App::instance().remove_patch_window(this);
delete m_breadcrumb_box;
}
@ -188,10 +188,19 @@ PatchWindow::set_patch(CountedPtr<PatchModel> patch, CountedPtr<PatchView> view)
else
m_menu_destroy_patch->set_sensitive(true);
m_patch->destroyed_sig.connect(sigc::mem_fun(this, &PatchWindow::patch_destroyed));
m_enable_signal = true;
}
void
PatchWindow::patch_destroyed()
{
App::instance().window_factory()->remove_patch_window(this);
}
void
PatchWindow::event_show_engine()
{
@ -303,7 +312,6 @@ PatchWindow::on_show()
void
PatchWindow::on_hide()
{
claim_breadcrumbs();
m_position_stored = true;
get_position(m_x, m_y);
Gtk::Window::on_hide();
@ -383,11 +391,5 @@ PatchWindow::event_fullscreen_toggled()
}
}
void
PatchWindow::claim_breadcrumbs()
{
m_breadcrumb_box->reparent(m_breadcrumb_bin);
}
} // namespace Ingenuity

View File

@ -72,8 +72,6 @@ public:
Gtk::MenuItem* menu_view_control_window() { return m_menu_view_control_window; }
void claim_breadcrumbs();
protected:
void on_show();
void on_hide();
@ -91,6 +89,8 @@ private:
void event_show_controls();
void event_show_engine();
void patch_destroyed();
CountedPtr<PatchModel> m_patch;
CountedPtr<PatchView> m_view;

View File

@ -60,13 +60,15 @@ public:
void present_load_subpatch(CountedPtr<PatchModel> patch, MetadataMap data = MetadataMap());
void present_rename(CountedPtr<ObjectModel> object);
void present_properties(CountedPtr<NodeModel> node);
bool remove_patch_window(PatchWindow* win, GdkEventAny* ignored = NULL);
private:
typedef std::map<Path, PatchWindow*> PatchWindowMap;
typedef std::map<Path, NodeControlWindow*> ControlWindowMap;
PatchWindow* new_patch_window(CountedPtr<PatchModel> patch, CountedPtr<PatchView> view);
bool remove_patch_window(PatchWindow* win, GdkEventAny* ignored);
NodeControlWindow* new_control_window(CountedPtr<NodeModel> node);
bool remove_control_window(NodeControlWindow* win, GdkEventAny* ignored);