X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fdockable.cpp;h=4745311afe69fc9bf14aed7c384e85fe93930b88;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=d3c4aa82fafe98783e07b21db0ec486a2ff8690e;hpb=02252941b29de64037116f4d37991a38d9ff0d94;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/dockable.cpp b/synfig-studio/trunk/src/gtkmm/dockable.cpp index d3c4aa8..4745311 100644 --- a/synfig-studio/trunk/src/gtkmm/dockable.cpp +++ b/synfig-studio/trunk/src/gtkmm/dockable.cpp @@ -2,19 +2,20 @@ /*! \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 */ /* ========================================================================= */ @@ -39,6 +40,8 @@ #include #include +#include "general.h" + #endif /* === U S I N G =========================================================== */ @@ -81,24 +84,24 @@ Dockable::Dockable(const synfig::String& name,const synfig::String& local_name,G { 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 synfig::String& name,const synfig::String& local_name,G 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 synfig::String& name,const synfig::String& local_name,G } 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 synfig::String& name,const synfig::String& local_name,G 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& context, i if ((selection_data.get_length() >= 0) && (selection_data.get_format() == 8)) { Dockable& dockable(**reinterpret_cast(const_cast(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& context, i context->drag_finish(true, false, time); return; } - + context->drag_finish(false, false, time); } void -Dockable::on_drag_end(const Glib::RefPtr&context) +Dockable::on_drag_end(const Glib::RefPtr&/*context*/) { if(!dnd_success_) { @@ -210,13 +213,13 @@ Dockable::on_drag_end(const Glib::RefPtr&context) } void -Dockable::on_drag_begin(const Glib::RefPtr&context) +Dockable::on_drag_begin(const Glib::RefPtr&/*context*/) { dnd_success_=false; } void -Dockable::on_drag_data_get(const Glib::RefPtr&, Gtk::SelectionData& selection_data, guint info, guint time) +Dockable::on_drag_data_get(const Glib::RefPtr&, Gtk::SelectionData& selection_data, guint /*info*/, guint /*time*/) { Dockable* tmp(this); dnd_success_=true; @@ -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_; @@ -325,12 +328,13 @@ Dockable::add_button(const Gtk::StockID& stock_id, const synfig::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; }