diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/GraphCanvas.cpp | 12 | ||||
-rw-r--r-- | src/gui/GraphView.cpp | 9 |
2 files changed, 13 insertions, 8 deletions
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 18fd1a39..b6a8e5a2 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -324,8 +324,8 @@ GraphCanvas::remove_plugin(const URI& uri) void GraphCanvas::add_block(const SPtr<const BlockModel>& bm) { - SPtr<const GraphModel> pm = dynamic_ptr_cast<const GraphModel>(bm); - NodeModule* module; + SPtr<const GraphModel> pm = dynamic_ptr_cast<const GraphModel>(bm); + NodeModule* module = nullptr; if (pm) { module = SubgraphModule::create(*this, pm, _human_names); } else { @@ -485,8 +485,8 @@ GraphCanvas::auto_menu_position(int& x, int& y, bool& push_in) *_app.window_factory()->graph_window(_graph), 64, 64, _menu_x, _menu_y); - int origin_x; - int origin_y; + int origin_x = 0; + int origin_y = 0; widget().get_window()->get_origin(origin_x, origin_y); _menu_x += origin_x; _menu_y += origin_y; @@ -865,8 +865,8 @@ GraphCanvas::load_plugin(const WPtr<PluginModel>& weak_plugin) void GraphCanvas::get_new_module_location(double& x, double& y) { - int scroll_x; - int scroll_y; + int scroll_x = 0; + int scroll_y = 0; get_scroll_offsets(scroll_x, scroll_y); x = scroll_x + 20; y = scroll_y + 20; diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp index a4bc1400..4f76f798 100644 --- a/src/gui/GraphView.cpp +++ b/src/gui/GraphView.cpp @@ -100,9 +100,14 @@ GraphView::set_graph(const SPtr<const GraphModel>& graph) SPtr<GraphView> GraphView::create(App& app, const SPtr<const GraphModel>& graph) { - GraphView* result = nullptr; - Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("warehouse_win"); + GraphView* result = nullptr; + Glib::RefPtr<Gtk::Builder> xml = WidgetFactory::create("warehouse_win"); + xml->get_widget_derived("graph_view_box", result); + if (!result) { + return nullptr; + } + result->init(app); result->set_graph(graph); return SPtr<GraphView>(result); |