Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-studio / trunk / src / gtkmm / dockable.cpp
index b3fb489..4745311 100644 (file)
@@ -1,20 +1,21 @@
-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
 /*!    \file dockable.cpp
 **     \brief Template File
 **
-**     $Id: dockable.cpp,v 1.2 2005/01/12 07:24:45 darco Exp $
+**     $Id$
 **
 **     \legal
-**     Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
 **
-**     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
 */
 /* ========================================================================= */
 #include "dockmanager.h"
 #include "dockbook.h"
 #include "dockdialog.h"
-#include <sinfg/general.h>
+#include <synfig/general.h>
 #include <gtkmm/table.h>
 #include <gtk/gtk.h>
 
+#include "general.h"
+
 #endif
 
 /* === U S I N G =========================================================== */
 
 using namespace std;
 using namespace etl;
-using namespace sinfg;
+using namespace synfig;
 using namespace studio;
 
 /* === M A C R O S ========================================================= */
@@ -71,7 +74,7 @@ using namespace studio;
 
 /* === M E T H O D S ======================================================= */
 
-Dockable::Dockable(const sinfg::String& name,const sinfg::String& local_name,Gtk::StockID stock_id_):
+Dockable::Dockable(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_):
 //     Gtk::Window(Gtk::WINDOW_TOPLEVEL),
        name_(name),
        local_name_(local_name),
@@ -81,24 +84,24 @@ Dockable::Dockable(const sinfg::String& name,const sinfg::String& local_name,Gtk
 {
        parent_=0;
        scrolled_=0;
-       
+
        use_scrolled_=true;
-       
+
        //set_title(local_name);
        //set_type_hint(Gdk::WINDOW_TYPE_HINT_UTILITY);
-       
+
 
        title_label_.show();
 
        attach_dnd_to(title_label_);
-       
+
        //scrolled_.set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC);
-       //scrolled_.show();     
+       //scrolled_.show();
        //scrolled_.set_shadow_type(Gtk::SHADOW_NONE);
 
        toolbar_=0;
        //button_box_.show();
-       
+
        Gtk::Table* table(this);
 
        {
@@ -107,15 +110,15 @@ Dockable::Dockable(const sinfg::String& name,const sinfg::String& local_name,Gtk
                event_box->set_border_width(0);
                event_box->add(title_label_);
                //table->attach(*event_box, 0, 1, 0,1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
-               
+
                header_box_.pack_start(*event_box);
-               
+
                attach_dnd_to(*event_box);
                event_box->show();
        //      event_box->set_events(Gdk::ALL_EVENTS_MASK); //!< \todo change this to only allow what is necessary for DnD
 
-               
-               Gtk::Button* bttn_close(manage(new Gtk::Button("X")));
+
+               Gtk::Button* bttn_close(manage(new Gtk::Button(_("X"))));
                //table->attach(*bttn_close, 1, 2, 0,1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
                header_box_.pack_end(*bttn_close,false,false);
                bttn_close->show();
@@ -126,7 +129,7 @@ Dockable::Dockable(const sinfg::String& name,const sinfg::String& local_name,Gtk
        }
 
        prev_widget_=manage(new Gtk::Label(" "));
-       
+
        //table->attach(header_box_, 0, 1, 0,1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
        table->attach(*prev_widget_, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
        //table->attach(*toolbar_, 0, 1, 2,3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
@@ -137,7 +140,7 @@ Dockable::Dockable(const sinfg::String& name,const sinfg::String& local_name,Gtk
 
        set_size_request(175,120);
        //scrolled_.set_shadow_type(Gtk::SHADOW_NONE);
-       
+
 }
 
 Dockable::~Dockable()
@@ -177,7 +180,7 @@ Dockable::attach_dnd_to(Gtk::Widget& widget)
        widget.signal_drag_data_get().connect(sigc::mem_fun(*this,&Dockable::on_drag_data_get));
        widget.signal_drag_end().connect(sigc::mem_fun(*this,&Dockable::on_drag_end));
        widget.signal_drag_begin().connect(sigc::mem_fun(*this,&Dockable::on_drag_begin));
-       widget.signal_drag_data_received().connect(sigc::mem_fun(*this,&Dockable::on_drag_data_received));      
+       widget.signal_drag_data_received().connect(sigc::mem_fun(*this,&Dockable::on_drag_data_received));
 }
 
 void
@@ -186,7 +189,7 @@ Dockable::on_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, i
        if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8))
        {
                Dockable& dockable(**reinterpret_cast<Dockable**>(const_cast<guint8*>(selection_data.get_data())));
-               
+
                if(dockable.parent_ != parent_)
                        parent_->add(dockable,parent_->page_num(*this));
                else
@@ -195,12 +198,12 @@ Dockable::on_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& context, i
                context->drag_finish(true, false, time);
                return;
        }
-       
+
        context->drag_finish(false, false, time);
 }
 
 void
-Dockable::on_drag_end(const Glib::RefPtr<Gdk::DragContext>&context)
+Dockable::on_drag_end(const Glib::RefPtr<Gdk::DragContext>&/*context*/)
 {
        if(!dnd_success_)
        {
@@ -210,13 +213,13 @@ Dockable::on_drag_end(const Glib::RefPtr<Gdk::DragContext>&context)
 }
 
 void
-Dockable::on_drag_begin(const Glib::RefPtr<Gdk::DragContext>&context)
+Dockable::on_drag_begin(const Glib::RefPtr<Gdk::DragContext>&/*context*/)
 {
        dnd_success_=false;
 }
 
 void
-Dockable::on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, Gtk::SelectionData& selection_data, guint info, guint time)
+Dockable::on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, Gtk::SelectionData& selection_data, guint /*info*/, guint /*time*/)
 {
        Dockable* tmp(this);
        dnd_success_=true;
@@ -225,7 +228,7 @@ Dockable::on_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&, Gtk::Selection
 }
 
 void
-Dockable::set_local_name(const sinfg::String& local_name)
+Dockable::set_local_name(const synfig::String& local_name)
 {
        //set_title(local_name);
        title_label_.set_text(local_name);
@@ -277,19 +280,19 @@ Dockable::add(Gtk::Widget& x)
                delete scrolled_;
                scrolled_=0;
        }
-       
+
        if(use_scrolled_)
        {
                scrolled_=new Gtk::ScrolledWindow;
-               
+
                scrolled_->add(x);
 
                attach(*scrolled_, 0, 1, 1,2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-               
+
                x.show();
-       
+
                scrolled_->show();
-               
+
                scrolled_->set_shadow_type(Gtk::SHADOW_NONE);
                scrolled_->set_policy(Gtk::POLICY_AUTOMATIC,Gtk::POLICY_AUTOMATIC);
                prev_widget_=scrolled_;
@@ -311,13 +314,13 @@ Dockable::add(Gtk::Widget& x)
 }
 
 Gtk::ToolButton*
-Dockable::add_button(const Gtk::StockID& stock_id, const sinfg::String& tooltip)
+Dockable::add_button(const Gtk::StockID& stock_id, const synfig::String& tooltip)
 {
        if(!toolbar_)
                set_toolbar(*manage(new Gtk::Toolbar));
 
        //Gtk::IconSize iconsize(4);
-       //Gtk::IconSize iconsize(Gtk::IconSize::from_name("sinfg-small_icon"));
+       //Gtk::IconSize iconsize(Gtk::IconSize::from_name("synfig-small_icon"));
 
        Gtk::ToolButton* ret(manage(new Gtk::ToolButton(stock_id)));
        //Gtk::Image* icon(manage(new Gtk::Image(stock_id,iconsize)));
@@ -325,12 +328,13 @@ Dockable::add_button(const Gtk::StockID& stock_id, const sinfg::String& tooltip)
        //ret->set_relief(Gtk::RELIEF_HALF);
        //ret->set_relief(Gtk::RELIEF_NONE);
        ret->set_label(tooltip);
-       //toolbar_->get_tooltips_object()->set_tip(*ret,tooltip);
+       if (toolbar_->get_tooltips_object())
+               toolbar_->get_tooltips_object()->set_tip(*ret,tooltip);
 
        ret->show();
        //icon->show();
        toolbar_->set_tooltips(true);
-       
+
        toolbar_->append(*ret);
        //button_box_.pack_start(*ret,false,false);
        //get_action_area()->pack_start(*ret,false,false);
@@ -368,13 +372,13 @@ Gtk::Widget*
 Dockable::create_tab_label()
 {
        Gtk::EventBox* event_box(manage(new Gtk::EventBox()));
-       
+
        attach_dnd_to(*event_box);
-       
+
        {
                Gtk::StockID stock_id(get_stock_id());
                Gtk::StockItem item;
-               
+
                // Check to make sure the icon is valid
                if(Gtk::Stock::lookup(stock_id,item))
                {
@@ -386,7 +390,7 @@ Dockable::create_tab_label()
                else
                {
                        // Bad icon, try to make a label
-                       
+
                        Glib::ustring text(get_local_name());
 
                        Gtk::Label* label(manage(new Gtk::Label(text)));
@@ -394,6 +398,6 @@ Dockable::create_tab_label()
                        label->show();
                }
        }
-       
+
        return event_box;
 }