NOOP, remove trailing tabs/whitespace.
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / gtk_ui.h
index bba3fb6fdf6b62f03b465e6830636b1dd2163ec1..868f71fd8db8ecb7ccfe3934508867302c414a7e 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 1999 Paul Barton-Davis 
+    Copyright (C) 1999 Paul Barton-Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 #include <setjmp.h>
 #include <pthread.h>
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <glibmm/thread.h>
 
 #include <gtkmm/widget.h>
 #include <gtkmm/textbuffer.h>
 #include <gtkmm/main.h>
 #include <gdkmm/color.h>
-#include <pbd/abstract_ui.h>
-#include <pbd/ringbufferNPT.h>
-#include <pbd/pool.h>
-#include <pbd/error.h>
-#include <pbd/receiver.h>
+
+#ifndef ABSTRACT_UI_EXPORTS
+#define ABSTRACT_UI_EXPORTS
+#endif
+#include "pbd/abstract_ui.h"
+#include "pbd/ringbufferNPT.h"
+#include "pbd/pool.h"
+#include "pbd/error.h"
+#include "pbd/receiver.h"
+
+#include "gtkmm2ext/visibility.h"
 
 class Touchable;
 
@@ -59,14 +68,14 @@ extern BaseUI::RequestType SetTip;
 extern BaseUI::RequestType AddIdle;
 extern BaseUI::RequestType AddTimeout;
 
-struct UIRequest : public BaseUI::BaseRequestObject {
-     
+struct LIBGTKMM2EXT_API UIRequest : public BaseUI::BaseRequestObject {
+
      /* this once used anonymous unions to merge elements
        that are never part of the same request. that makes
        the creation of a legal copy constructor difficult
        because of the semantics of the slot member.
      */
-     
+
     Touchable *display;
     const char *msg;
     Gtk::StateType new_state;
@@ -79,17 +88,30 @@ struct UIRequest : public BaseUI::BaseRequestObject {
     UIRequest () {
             type = NullMessage;
     }
-    
-    ~UIRequest () { 
+
+    ~UIRequest () {
            if (type == ErrorMessage && msg) {
                    /* msg was strdup()'ed */
-                   free ((char *)msg);
+                   free (const_cast<char *>(msg));
            }
     }
 };
 
-class UI : public Receiver, public AbstractUI<UIRequest>
+class LIBGTKMM2EXT_API UI : public AbstractUI<UIRequest>
 {
+  private:
+       class MyReceiver : public Receiver {
+         public:
+               MyReceiver (UI& ui) : _ui (ui) {}
+               void receive (Transmitter::Channel chn, const char *msg) {
+                       _ui.receive (chn, msg);
+               }
+         private:
+               UI& _ui;
+       };
+
+       MyReceiver _receiver;
+
   public:
        UI (std::string name, int *argc, char **argv[]);
        virtual ~UI ();
@@ -104,8 +126,6 @@ class UI : public Receiver, public AbstractUI<UIRequest>
 
        bool caller_is_ui_thread ();
 
-       static Glib::Thread* thread_id() { return gui_thread; }
-
        /* Gtk-UI specific interfaces */
 
        bool running ();
@@ -118,6 +138,7 @@ class UI : public Receiver, public AbstractUI<UIRequest>
        void flush_pending ();
        void toggle_errors ();
        void show_errors ();
+       void dump_errors (std::ostream&);
        void touch_display (Touchable *);
        void set_tip (Gtk::Widget &w, const gchar *tip);
        void set_tip (Gtk::Widget &w, const std::string &tip);
@@ -141,15 +162,12 @@ class UI : public Receiver, public AbstractUI<UIRequest>
           stopping just after we return from it (at the top level)
        */
 
-       sigc::signal<void> starting;
-       sigc::signal<void> stopping;
+        virtual int starting() = 0;
 
        sigc::signal<void> theme_changed;
 
        static bool just_hide_it (GdkEventAny *, Gtk::Window *);
 
-       static Glib::Thread* the_gui_thread() { return gui_thread; }
-
   protected:
        virtual void handle_fatal (const char *);
        virtual void display_message (const char *prefix, gint prefix_len,
@@ -158,7 +176,7 @@ class UI : public Receiver, public AbstractUI<UIRequest>
 
   private:
        static UI *theGtkUI;
-       static Glib::Thread* gui_thread;
+
        bool _active;
        Gtk::Main *theMain;
 #ifndef GTK_NEW_TOOLTIP_API
@@ -178,11 +196,15 @@ class UI : public Receiver, public AbstractUI<UIRequest>
        void process_error_message (Transmitter::Channel, const char *);
        void do_quit ();
 
+       Glib::Threads::Mutex   error_lock;
+       std::list<std::string> error_stack;
+
        void color_selection_done (bool status);
        bool color_selection_deleted (GdkEventAny *);
        bool color_picked;
 
        void do_request (UIRequest*);
+
 };
 
 } /* namespace */