Added my "Copyright (c) 2007" notices, for files I edited in 2007.
[synfig.git] / synfig-studio / trunk / src / gtkmm / dockbook.cpp
index 10ac98e..62047f7 100644 (file)
@@ -2,19 +2,21 @@
 /*!    \file dockbook.cpp
 **     \brief Template File
 **
-**     $Id: dockbook.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
+**     $Id$
 **
 **     \legal
-**     Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007 Chris Moore
 **
-**     This software and associated documentation
-**     are CONFIDENTIAL and PROPRIETARY property of
-**     the above-mentioned copyright holder.
+**     This package 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 (at your option) any later version.
 **
-**     You may not copy, print, publish, or in any
-**     other way distribute this software without
-**     a prior written agreement with
-**     the copyright holder.
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
 **     \endlegal
 */
 /* ========================================================================= */
@@ -37,6 +39,8 @@
 #include <gtkmm/eventbox.h>
 #include <gtkmm/menu.h>
 
+#include "general.h"
+
 #endif
 
 /* === U S I N G =========================================================== */
@@ -78,9 +82,7 @@ void
 DockBook::clear()
 {
        while(get_n_pages())
-       {
                remove(static_cast<Dockable&>(*get_nth_page(get_n_pages()-1)));
-       }
 }
 
 void
@@ -95,7 +97,7 @@ DockBook::on_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, i
                context->drag_finish(true, false, time);
                return;
        }
-       
+
        context->drag_finish(false, false, time);
 }
 
@@ -103,7 +105,7 @@ void
 DockBook::add(Dockable& dockable, int position)
 {
        dockable.detach();
-       
+
        if(position==-1)
                append_page(dockable, " ");
        else
@@ -120,13 +122,13 @@ DockBook::add(Dockable& dockable, int position)
                        &dockable
                )
        );
-       
+
        dockable.parent_=this;
 
        dockable.show();
 
        //set_current_page(get_n_pages()-1);
-               
+
        signal_changed_();
 }
 
@@ -134,7 +136,7 @@ void
 DockBook::refresh_tab(Dockable* dockable)
 {
        Gtk::Widget* label(dockable->create_tab_label());
-       
+
        label->signal_button_press_event().connect(
                sigc::bind(
                        sigc::mem_fun(
@@ -160,7 +162,7 @@ DockBook::remove(Dockable& dockable)
        if(!deleting_)
        {
                signal_changed_();
-       
+
                if(get_n_pages()==0)
                        signal_empty()();
        }
@@ -176,16 +178,16 @@ synfig::String
 DockBook::get_local_contents()const
 {
        synfig::String ret;
-       
+
        for(int i(0);i!=const_cast<DockBook*>(this)->get_n_pages();i++)
        {
                Dockable& dockable(static_cast<Dockable&>(*const_cast<DockBook*>(this)->get_nth_page(i)));
-               
+
                if(i)
                        ret+=", ";
                ret+=dockable.get_local_name();
        }
-       
+
        return ret;
 }
 
@@ -193,16 +195,16 @@ synfig::String
 DockBook::get_contents()const
 {
        synfig::String ret;
-       
+
        for(int i(0);i!=const_cast<DockBook*>(this)->get_n_pages();i++)
        {
                Dockable& dockable(static_cast<Dockable&>(*const_cast<DockBook*>(this)->get_nth_page(i)));
-               
+
                if(i)
                        ret+=' ';
                ret+=dockable.get_name();
        }
-       
+
        return ret;
 }
 
@@ -212,7 +214,7 @@ DockBook::set_contents(const synfig::String& x)
        synfig::String str(x);
        while(!str.empty())
        {
-               unsigned int separator=str.find_first_of(' ');
+               synfig::String::size_type separator=str.find_first_of(' ');
                synfig::String dock;
                if(separator==synfig::String::npos)
                {
@@ -224,7 +226,7 @@ DockBook::set_contents(const synfig::String& x)
                        dock=String(str.begin(),str.begin()+separator);
                        str=String(str.begin()+separator+1,str.end());
                }
-               
+
                try
                {
                        add(App::dock_manager->find_dockable(dock));
@@ -237,9 +239,10 @@ DockBook::tab_button_pressed(GdkEventButton* event, Dockable* dockable)
 {
        if(event->button!=3)
                return false;
-       
+
        Gtk::Menu *tabmenu=manage(new class Gtk::Menu());
-       
+       tabmenu->signal_hide().connect(sigc::bind(sigc::ptr_fun(&delete_widget), tabmenu));
+
        tabmenu->items().push_back(
                Gtk::Menu_Helpers::StockMenuElem(Gtk::StockID("gtk-close"),
                        sigc::mem_fun(*dockable,&Dockable::detach)
@@ -247,6 +250,6 @@ DockBook::tab_button_pressed(GdkEventButton* event, Dockable* dockable)
        );
 
        tabmenu->popup(event->button,gtk_get_current_event_time());
-       
+
        return true;
 }