Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-studio / trunk / src / gtkmm / cellrenderer_value.cpp
index 459a595..456dee7 100644 (file)
@@ -6,6 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007, 2008 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
@@ -54,6 +55,8 @@
 #include "dialog_color.h"
 #include <gtkmm/textview.h>
 
+#include "general.h"
+
 #endif
 
 using namespace synfig;
@@ -124,7 +127,6 @@ public:
        }
        ~ValueBase_Entry()
        {
-               DEBUGPOINT();
        }
 
        void on_editing_done()
@@ -199,8 +201,11 @@ public:
        {
                if(valuewidget)
                        return valuewidget->get_value();
-               return synfig::ValueBase();
+
+               warning("%s:%d this code shouldn't be reached", __FILE__, __LINE__);
+               return *(new synfig::ValueBase());
        }
+
        const Glib::ustring &get_path()
        {
                return path;
@@ -276,12 +281,13 @@ CellRenderer_ValueBase::CellRenderer_ValueBase():
        property_attributes()=attr_list;
 
        property_foreground()=Glib::ustring("#7f7f7f");
-       property_inconsistant()=false;
+       property_inconsistent()=false;
 }
 
 CellRenderer_ValueBase::~CellRenderer_ValueBase()
 {
-//     synfig::info("CellRenderer_ValueBase::~CellRenderer_ValueBase(): deleted");
+       if (getenv("SYNFIG_DEBUG_DESTRUCTORS"))
+               synfig::info("CellRenderer_ValueBase::~CellRenderer_ValueBase(): Deleted");
 }
 
 void
@@ -366,7 +372,13 @@ CellRenderer_ValueBase::render_vfunc(
                        for(iter=enum_list.begin();iter!=enum_list.end();iter++)
                                if(iter->value==data.get(int()))
                                {
-                                       property_text()=(Glib::ustring)iter->local_name;
+                                       // don't show the key_board s_hortcut under_scores
+                                       String local_name = iter->local_name;
+                                       String::size_type pos = local_name.find_first_of('_');
+                                       if (pos != String::npos)
+                                               property_text() = local_name.substr(0,pos) + local_name.substr(pos+1);
+                                       else
+                                               property_text() = local_name;
                                        break;
                                }
                }
@@ -396,7 +408,7 @@ CellRenderer_ValueBase::render_vfunc(
                if(data.get(etl::handle<synfig::Canvas>()))
                {
                        if(data.get(etl::handle<synfig::Canvas>())->is_inline())
-                               property_text()="<Inline Canvas>";
+                               property_text()=_("<Inline Canvas>");
                        else
                                property_text()=(Glib::ustring)data.get(etl::handle<synfig::Canvas>())->get_id();
                }
@@ -490,13 +502,14 @@ CellRenderer_ValueBase::color_edited(synfig::Color color, Glib::ustring path)
 
 Gtk::CellEditable*
 CellRenderer_ValueBase::start_editing_vfunc(
-       GdkEvent* event,
+       GdkEvent* event __attribute__ ((unused)),
        Gtk::Widget& widget,
        const Glib::ustring& path,
-       const Gdk::Rectangle& background_area,
-       const Gdk::Rectangle& cell_area,
-       Gtk::CellRendererState flags)
+       const Gdk::Rectangle& background_area __attribute__ ((unused)),
+       const Gdk::Rectangle& cell_area __attribute__ ((unused)),
+       Gtk::CellRendererState flags __attribute__ ((unused)))
 {
+       edit_value_done_called = false;
        // If we aren't editable, then there is nothing to do
        if(!property_editable())
                return 0;
@@ -521,6 +534,7 @@ CellRenderer_ValueBase::start_editing_vfunc(
                                path
                        )
                );
+               App::dialog_gradient->grab_button_set_sensitive(true);
                App::dialog_gradient->present();
 
                return NULL;
@@ -543,13 +557,11 @@ CellRenderer_ValueBase::start_editing_vfunc(
                        synfig::String string;
                        string=data.get(string);
                        if(get_paragraph(string))
-                       {
                                signal_edited_(path,ValueBase(string));
-                       }
                        return NULL;
                }
-               if(get_param_desc().get_hint()!="filename")
-                       return CellRendererText::start_editing_vfunc(event,widget,path,background_area,cell_area,flags);
+               // if(get_param_desc().get_hint()!="filename")
+                       // return CellRendererText::start_editing_vfunc(event,widget,path,background_area,cell_area,flags);
        default:
                {
                        assert(get_canvas());
@@ -570,6 +582,14 @@ CellRenderer_ValueBase::start_editing_vfunc(
 void
 CellRenderer_ValueBase::on_value_editing_done()
 {
+       if (edit_value_done_called)
+       {
+               synfig::error("on_value_editing_done(): Called twice!");
+               return;
+       }
+
+       edit_value_done_called = true;
+
        if(value_entry)
        {
                ValueBase old_value(property_value_.get_value());