-/* === 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>
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
/* === 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),
{
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);
{
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")));
//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);
}
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);
set_size_request(175,120);
//scrolled_.set_shadow_type(Gtk::SHADOW_NONE);
-
+
}
Dockable::~Dockable()
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
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
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_)
{
}
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;
}
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);
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_;
}
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)));
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);
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))
{
else
{
// Bad icon, try to make a label
-
+
Glib::ustring text(get_local_name());
Gtk::Label* label(manage(new Gtk::Label(text)));
label->show();
}
}
-
+
return event_box;
}