X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fwidget_value.cpp;h=c6a8b973f4f1453d28cd46bf49a2b087ac124f38;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=ddf28fae56752409d3ed4c0e2335e7eccdd662e7;hpb=3a3c4bca3a17137bec5d7960560934b91ef4146e;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/widget_value.cpp b/synfig-studio/trunk/src/gtkmm/widget_value.cpp index ddf28fa..c6a8b97 100644 --- a/synfig-studio/trunk/src/gtkmm/widget_value.cpp +++ b/synfig-studio/trunk/src/gtkmm/widget_value.cpp @@ -1,20 +1,21 @@ -/* === S I N F G =========================================================== */ +/* === S Y N F I G ========================================================= */ /*! \file widget_value.cpp ** \brief Template File ** -** $Id: widget_value.cpp,v 1.1.1.1 2005/01/07 03:34:37 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 */ /* ========================================================================= */ @@ -48,9 +49,11 @@ #include "app.h" #include "widget_distance.h" +#include "general.h" + #endif -using namespace sinfg; +using namespace synfig; using namespace etl; using namespace std; using namespace studio; @@ -68,12 +71,12 @@ using namespace studio; Widget_ValueBase::Widget_ValueBase(): Glib::ObjectBase (typeid(Widget_ValueBase)), Gtk::HBox(), - real_adjustment(0,-2000000000,2000000000,0.05,0.05,0.05), - integer_adjustment(0,-2000000000,2000000000,1,1,1), - angle_adjustment(0,-2000000000,2000000000,1,1,1) + real_adjustment(0,-2000000000,2000000000,0.05,0.05,0), + integer_adjustment(0,-2000000000,2000000000,1,1,0), + angle_adjustment(0,-2000000000,2000000000,1,1,0) { set_no_show_all(); - + label=manage(new class Gtk::Label("Unknown Datatype")); pack_start(*label); label->show(); @@ -96,7 +99,7 @@ Widget_ValueBase::Widget_ValueBase(): angle_widget=manage(new class Gtk::SpinButton(angle_adjustment,15,2)); pack_start(*angle_widget); - bool_widget=manage(new class Gtk::CheckButton()); + bool_widget=manage(new class Gtk::CheckButton()); pack_start(*bool_widget); //color_widget=manage(new class Gtk::ColorSelection()); @@ -104,7 +107,7 @@ Widget_ValueBase::Widget_ValueBase(): string_widget=manage(new class Gtk::Entry()); pack_start(*string_widget); - + canvas_widget=manage(new class Widget_CanvasChooser()); pack_start(*canvas_widget); @@ -117,7 +120,7 @@ Widget_ValueBase::Widget_ValueBase(): distance_widget=manage(new class Widget_Distance()); pack_start(*distance_widget); - + vector_widget->signal_activate().connect(sigc::mem_fun(*this,&Widget_ValueBase::activate)); color_widget->signal_activate().connect(sigc::mem_fun(*this,&Widget_ValueBase::activate)); enum_widget->signal_activate().connect(sigc::mem_fun(*this,&Widget_ValueBase::activate)); @@ -129,7 +132,7 @@ Widget_ValueBase::Widget_ValueBase(): filename_widget->signal_activate().connect(sigc::mem_fun(*this,&Widget_ValueBase::activate)); time_widget->signal_activate().connect(sigc::mem_fun(*this,&Widget_ValueBase::activate)); distance_widget->signal_activate().connect(sigc::mem_fun(*this,&Widget_ValueBase::activate)); - + /*signal_focus_in_event().connect( sigc::bind_return( sigc::hide( @@ -146,7 +149,6 @@ Widget_ValueBase::~Widget_ValueBase() void Widget_ValueBase::activate() { - //DEBUGPOINT(); signal_activate()(); } @@ -161,7 +163,7 @@ Widget_ValueBase::inside_cellrenderer() distance_widget->set_has_frame(false); //static_cast(distance_widget)->gobj()->is_cell_renderer = true; // XXX - + integer_widget->set_has_frame(false); //static_cast(integer_widget)->gobj()->is_cell_renderer = true; // XXX vector_widget->set_has_frame(false); @@ -193,7 +195,7 @@ Widget_ValueBase::set_sensitive(bool x) } void -Widget_ValueBase::set_value(const sinfg::ValueBase &data) +Widget_ValueBase::set_value(const synfig::ValueBase &data) { label->hide(); vector_widget->hide(); @@ -208,7 +210,7 @@ Widget_ValueBase::set_value(const sinfg::ValueBase &data) filename_widget->hide(); time_widget->hide(); distance_widget->hide(); - + value=data; try{ switch(value.get_type()) @@ -257,7 +259,7 @@ Widget_ValueBase::set_value(const sinfg::ValueBase &data) case ValueBase::TYPE_CANVAS: assert(canvas); canvas_widget->set_parent_canvas(canvas); - canvas_widget->set_value(value.get(etl::loose_handle())); + canvas_widget->set_value(value.get(etl::loose_handle())); canvas_widget->show(); break; case ValueBase::TYPE_BOOL: @@ -278,11 +280,11 @@ Widget_ValueBase::set_value(const sinfg::ValueBase &data) break; case ValueBase::TYPE_COLOR: { - color_widget->set_value(value.get(sinfg::Color())); + color_widget->set_value(value.get(synfig::Color())); color_widget->show(); /* Gdk::Color gdkcolor; - sinfg::Color color=value.get(sinfg::Color()); + synfig::Color color=value.get(synfig::Color()); gdkcolor.set_rgb_p(color.get_r(),color.get_g(),color.get_b()); color_widget->set_current_color(gdkcolor); color_widget->set_has_opacity_control(true); @@ -295,10 +297,10 @@ Widget_ValueBase::set_value(const sinfg::ValueBase &data) label->show(); break; } - }catch(...) { sinfg::error(__FILE__":%d: Caught something that was thrown",__LINE__); } + }catch(...) { synfig::error(__FILE__":%d: Caught something that was thrown",__LINE__); } } -const sinfg::ValueBase & +const synfig::ValueBase & Widget_ValueBase::get_value() { switch(value.get_type()) @@ -330,7 +332,7 @@ Widget_ValueBase::get_value() { value=enum_widget->get_value(); } - + break; case ValueBase::TYPE_BOOL: value=bool_widget->get_active(); @@ -350,13 +352,13 @@ Widget_ValueBase::get_value() value=color_widget->get_value(); /* Gdk::Color gdkcolor; - sinfg::Color color; + synfig::Color color; gdkcolor=color_widget->get_current_color(); color.set_r(gdkcolor.get_red_p()); color.set_g(gdkcolor.get_green_p()); color.set_b(gdkcolor.get_blue_p()); color.set_a(color_widget->get_current_alpha()/65535.0); - + value=color; */ } @@ -367,7 +369,7 @@ Widget_ValueBase::get_value() return value; } - + void Widget_ValueBase::on_grab_focus() @@ -401,7 +403,7 @@ Widget_ValueBase::on_grab_focus() { enum_widget->grab_focus(); } - + break; case ValueBase::TYPE_BOOL: bool_widget->grab_focus(); @@ -440,7 +442,7 @@ Widget_ValueBase::signal_activate() return distance_widget->signal_activate(); else return real_widget->signal_activate(); - + break; case ValueBase::TYPE_TIME: return time_widget->signal_activate(); @@ -456,7 +458,7 @@ Widget_ValueBase::signal_activate() return integer_widget->signal_activate(); else return enum_widget->signal_activate(); - + break; case ValueBase::TYPE_BOOL: return string_widget->signal_activate();