enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.h
[ardour.git] / libs / gtkmm2ext / tearoff.cc
index bc8829d94f619b7862f8ade32b855e3f3bfae16a..bb30e5610f64d60181b20beb73442d6eb8b41370 100644 (file)
@@ -1,6 +1,6 @@
 /*
     Copyright (C) 2003 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
     the Free Software Foundation; either version 2 of the License, or
@@ -26,7 +26,7 @@
 #include "gtkmm2ext/tearoff.h"
 #include "gtkmm2ext/utils.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace Gtkmm2ext;
 using namespace Gtk;
@@ -43,7 +43,7 @@ TearOff::TearOff (Widget& c, bool allow_resize)
         , _visible (true)
         , _torn (false)
         , _can_be_torn_off (true)
-         
+
 {
         own_window_width = 0;
         own_window_height = 0;
@@ -54,8 +54,8 @@ TearOff::TearOff (Widget& c, bool allow_resize)
        tearoff_event_box.set_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK);
        tearoff_event_box.signal_button_release_event().connect (mem_fun (*this, &TearOff::tearoff_click));
 
-        tearoff_event_box.set_tooltip_text (_("Click to to tear this into its own window"));
-        
+       tearoff_event_box.set_tooltip_text (_("Click to tear this into its own window"));
+
        close_event_box.add (close_arrow);
        close_event_box.set_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK);
        close_event_box.signal_button_release_event().connect (mem_fun (*this, &TearOff::close_click));
@@ -65,15 +65,15 @@ TearOff::TearOff (Widget& c, bool allow_resize)
        VBox* box1;
        box1 = manage (new VBox);
        box1->pack_start (close_event_box, false, false, 2);
-       
+
        window_box.pack_end (*box1, false, false, 2);
 
        own_window.add_events (KEY_PRESS_MASK|KEY_RELEASE_MASK|BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK|POINTER_MOTION_MASK|POINTER_MOTION_HINT_MASK);
        own_window.set_resizable (allow_resize);
-       own_window.set_type_hint (WINDOW_TYPE_HINT_TOOLBAR);
+       own_window.set_type_hint (WINDOW_TYPE_HINT_UTILITY);
 
        own_window.add (window_box);
-       
+
        own_window.signal_button_press_event().connect (mem_fun (*this, &TearOff::window_button_press));
        own_window.signal_button_release_event().connect (mem_fun (*this, &TearOff::window_button_release));
        own_window.signal_motion_notify_event().connect (mem_fun (*this, &TearOff::window_motion));
@@ -86,10 +86,10 @@ TearOff::TearOff (Widget& c, bool allow_resize)
 
        VBox* box2;
        box2 = manage (new VBox);
-       box2->pack_start (tearoff_event_box, false, false, 2);
+       box2->pack_start (tearoff_event_box, false, false);
 
        pack_start (contents);
-       pack_start (*box2, false, false, 2);
+       pack_start (*box2, false, false);
 }
 
 TearOff::~TearOff ()
@@ -112,7 +112,7 @@ TearOff::set_can_be_torn_off (bool yn)
 }
 
 void
-TearOff::set_visible (bool yn)
+TearOff::set_visible (bool yn, bool force)
 {
        /* don't change visibility if torn off */
 
@@ -120,7 +120,7 @@ TearOff::set_visible (bool yn)
                return;
        }
 
-       if (_visible != yn) {
+       if (_visible != yn || force) {
                _visible = yn;
                if (yn) {
                        show_all();
@@ -145,7 +145,7 @@ TearOff::tear_it_off ()
        if (!_can_be_torn_off) {
                 return;
         }
-                
+
         if (torn_off()) {
                 return;
         }
@@ -164,14 +164,14 @@ TearOff::tear_it_off ()
         _torn = true;
 
         Detach ();
-}        
+}
 
 gint
 TearOff::close_click (GdkEventButton* /*ev*/)
 {
         put_it_back ();
        return true;
-}              
+}
 
 void
 TearOff::put_it_back ()
@@ -232,7 +232,7 @@ TearOff::window_motion (GdkEventMotion* ev)
        double x_delta;
        double y_delta;
        RefPtr<Gdk::Window> win (own_window.get_window());
-       
+
        own_window.get_pointer (mx, my);
 
        if (!dragging) {
@@ -250,10 +250,10 @@ TearOff::window_motion (GdkEventMotion* ev)
 
        win->get_root_origin (x, y);
        win->move ((gint) floor (x + x_delta), (gint) floor (y + y_delta));
-       
+
        drag_x = ev->x_root;
        drag_y = ev->y_root;
-       
+
        return true;
 }
 
@@ -280,13 +280,13 @@ TearOff::add_state (XMLNode& node) const
                 snprintf (buf, sizeof (buf), "%d", own_window_ypos);
                 node.add_property ("ypos", buf);
         }
-}        
+}
 
 void
 TearOff::set_state (const XMLNode& node)
 {
         Glib::RefPtr<Gdk::Window> win;
-        const XMLProperty* prop;
+        XMLProperty const * prop;
 
         if ((prop = node.property (X_("tornoff"))) == 0) {
                 return;
@@ -316,7 +316,7 @@ TearOff::set_state (const XMLNode& node)
                 own_window.move (own_window_xpos, own_window_ypos);
         }
         /* otherwise do it once the window is realized, see below */
-}        
+}
 
 void
 TearOff::own_window_realized ()
@@ -335,7 +335,7 @@ TearOff::own_window_configured (GdkEventConfigure*)
         Glib::RefPtr<const Gdk::Window> win;
 
         win = own_window.get_window ();
-        
+
         if (win) {
                 win->get_size (own_window_width, own_window_height);
                 win->get_position (own_window_xpos, own_window_ypos);