From 605531c2f1238cf5b0a710de38d05b9c8637f392 Mon Sep 17 00:00:00 2001 From: Nedko Arnaudov Date: Mon, 17 Aug 2009 04:35:25 +0300 Subject: [PATCH] Remove use of C++ stdstreams --- gui/main.cpp | 73 +++++++++++++++++++--------------------------------- 1 file changed, 26 insertions(+), 47 deletions(-) diff --git a/gui/main.cpp b/gui/main.cpp index 8c76205d..4a33454c 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -25,29 +25,17 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include -#include -#include - -#include -#include -#include -#include -#include - #include "common.h" -#include "Widget.hpp" +#include +#include #include -#include "../common/debug.h" +#include "Widget.hpp" -//class a2j_proxy; -//class lash_proxy; -//class project_list; -//class session; +#include "../common/debug.h" class Patchage { public: - Patchage(int argc, char** argv); + Patchage(); ~Patchage(); Gtk::Window* window() { return _main_win.get(); } @@ -150,8 +138,6 @@ protected: #include #include -#include -#include #include #include #include @@ -206,7 +192,7 @@ gtkmm_set_width_for_given_text (Gtk::Widget &w, const gchar *text, #define INIT_WIDGET(x) x(g_xml, ((const char*)#x) + 1) -Patchage::Patchage(int argc, char** argv) +Patchage::Patchage() : _max_dsp_load(0.0) , INIT_WIDGET(_about_win) , INIT_WIDGET(_buffer_size_combo) @@ -237,16 +223,6 @@ Patchage::Patchage(int argc, char** argv) { g_app = this; - while (argc > 0) { - if (!strcmp(*argv, "--help")) { - std::cout << "Usage: patchage [OPTIONS]\nOptions: --no-alsa" << std::endl; - exit(0); - } - - argv++; - argc--; - } - patchage_dbus_init(); graph_create(JACKDBUS_SERVICE, JACKDBUS_OBJECT, &g_jack_graph); @@ -511,7 +487,7 @@ Patchage::on_view_toolbar() bool Patchage::on_scroll(GdkEventScroll* ev) { - std::cout << "ON SCROLL" << std::endl; + lash_debug("ON SCROLL"); return false; } @@ -878,6 +854,9 @@ Patchage::is_canvas_empty() Glib::RefPtr g_xml; +#include +#include + static Glib::RefPtr glade_open() @@ -906,32 +885,32 @@ glade_open() int main(int argc, char** argv) { - if (!canvas_init()) { + if (!canvas_init()) + { lash_error("Canvas initialization failed."); return 1; } - try { - - Gtk::Main app(argc, argv); + try + { + Gtk::Main app(argc, argv); - g_xml = glade_open(); + g_xml = glade_open(); - Patchage patchage(argc, argv); - app.run(*patchage.window()); - - } catch (std::exception& e) { - std::cerr << "Caught exception, aborting. Error message was: " - << e.what() << std::endl; + Patchage patchage; + app.run(*patchage.window()); + } + catch (std::exception& e) + { + lash_error("Caught exception, aborting. Error message was: %s\n", e.what()); return 1; - } catch (Glib::Exception& e) { - std::cerr << "Caught exception, aborting. Error message was: " - << e.what() << std::endl; + } + catch (Glib::Exception& e) + { + lash_error("Caught exception, aborting. Error message was: %s\n", e.what().c_str()); return 1; } return 0; } - -