X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fdockbook.cpp;h=62047f7856498e84610ac4418cab1eb8c4cf0b55;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=5968187849c1e564d16cccad8817626589ce6b83;hpb=ce408de81ca266b1f334ee9bc6c8fb7ba1492ed4;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/dockbook.cpp b/synfig-studio/trunk/src/gtkmm/dockbook.cpp index 5968187..62047f7 100644 --- a/synfig-studio/trunk/src/gtkmm/dockbook.cpp +++ b/synfig-studio/trunk/src/gtkmm/dockbook.cpp @@ -2,10 +2,11 @@ /*! \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-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** Copyright (c) 2007 Chris Moore ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -38,6 +39,8 @@ #include #include +#include "general.h" + #endif /* === U S I N G =========================================================== */ @@ -79,9 +82,7 @@ void DockBook::clear() { while(get_n_pages()) - { remove(static_cast(*get_nth_page(get_n_pages()-1))); - } } void @@ -96,7 +97,7 @@ DockBook::on_drag_data_received(const Glib::RefPtr& context, i context->drag_finish(true, false, time); return; } - + context->drag_finish(false, false, time); } @@ -104,7 +105,7 @@ void DockBook::add(Dockable& dockable, int position) { dockable.detach(); - + if(position==-1) append_page(dockable, " "); else @@ -121,13 +122,13 @@ DockBook::add(Dockable& dockable, int position) &dockable ) ); - + dockable.parent_=this; dockable.show(); //set_current_page(get_n_pages()-1); - + signal_changed_(); } @@ -135,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( @@ -161,7 +162,7 @@ DockBook::remove(Dockable& dockable) if(!deleting_) { signal_changed_(); - + if(get_n_pages()==0) signal_empty()(); } @@ -177,16 +178,16 @@ synfig::String DockBook::get_local_contents()const { synfig::String ret; - + for(int i(0);i!=const_cast(this)->get_n_pages();i++) { Dockable& dockable(static_cast(*const_cast(this)->get_nth_page(i))); - + if(i) ret+=", "; ret+=dockable.get_local_name(); } - + return ret; } @@ -194,16 +195,16 @@ synfig::String DockBook::get_contents()const { synfig::String ret; - + for(int i(0);i!=const_cast(this)->get_n_pages();i++) { Dockable& dockable(static_cast(*const_cast(this)->get_nth_page(i))); - + if(i) ret+=' '; ret+=dockable.get_name(); } - + return ret; } @@ -213,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) { @@ -225,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)); @@ -238,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) @@ -248,6 +250,6 @@ DockBook::tab_button_pressed(GdkEventButton* event, Dockable* dockable) ); tabmenu->popup(event->button,gtk_get_current_event_time()); - + return true; }