Use the name of each action's class is its internal name. This makes it easier to...
[synfig.git] / synfig-studio / trunk / src / gtkmm / state_width.cpp
index bbe802d..1c7ef4f 100644 (file)
@@ -2,10 +2,11 @@
 /*!    \file state_width.cpp
 **     \brief Template File
 **
-**     $Id: state_width.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**     $Id$
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**  Copyright (c) 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
@@ -55,6 +56,8 @@
 
 #include <ETL/clock>
 
+#include "general.h"
+
 #endif
 
 /* === U S I N G =========================================================== */
@@ -103,8 +106,6 @@ class studio::StateWidth_Context : public sigc::trackable
        //Toolbox display
        Gtk::Table options_table;
 
-       //Gtk::Entry            entry_id; //what to name the layer
-
        Gtk::Adjustment adj_delta;
        Gtk::SpinButton spin_delta;
 
@@ -149,7 +150,7 @@ public:
        void save_settings();
        void reset();
 
-};     // END of class StateGradient_Context
+};     // END of class StateWidth_Context
 
 /* === M E T H O D S ======================================================= */
 
@@ -184,11 +185,11 @@ StateWidth_Context::load_settings()
        else
                set_radius(15);
 
-       //defaults to true
-       if(settings.get_value("width.relative",value) && value == "0")
-               set_relative(false);
-       else
+       //defaults to false
+       if(settings.get_value("width.relative",value) && value == "1")
                set_relative(true);
+       else
+               set_relative(false);
 }
 
 void
@@ -208,16 +209,16 @@ StateWidth_Context::reset()
 StateWidth_Context::StateWidth_Context(CanvasView* canvas_view):
        canvas_view_(canvas_view),
        is_working(*canvas_view),
-       prev_workarea_layer_clicking(get_work_area()->allow_layer_clicks),
-       prev_workarea_duck_clicking(get_work_area()->allow_duck_clicks),
+       prev_workarea_layer_clicking(get_work_area()->get_allow_layer_clicks()),
+       prev_workarea_duck_clicking(get_work_area()->get_allow_duck_clicks()),
        old_duckmask(get_work_area()->get_type_mask()),
 
        settings(synfigapp::Main::get_selected_input_device()->settings()),
 
-       adj_delta(6,0,1,0.001,0.01),
+       adj_delta(6,0,20,0.01,0.1),
        spin_delta(adj_delta,0.01,3),
 
-       adj_radius(0,0,1e50,1,10),
+       adj_radius(200,0,1e50,1,10),
        spin_radius(adj_radius,1,1),
 
        check_relative(_("Relative Growth"))
@@ -225,17 +226,16 @@ StateWidth_Context::StateWidth_Context(CanvasView* canvas_view):
        load_settings();
 
        // Set up the tool options dialog
-       //options_table.attach(*manage(new Gtk::Label(_("Width Tool"))), 0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       //options_table.attach(entry_id, 0, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(*manage(new Gtk::Label(_("Width Tool"))),  0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
 
        //expand stuff
-       options_table.attach(*manage(new Gtk::Label(_("Growth:"))), 0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(spin_delta, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(*manage(new Gtk::Label(_("Growth:"))),             0, 1, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(spin_delta,                                                                1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
 
-       options_table.attach(*manage(new Gtk::Label(_("Radius:"))), 0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
-       options_table.attach(spin_radius, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(*manage(new Gtk::Label(_("Radius:"))),             0, 1, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(spin_radius,                                                               1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
 
-       options_table.attach(check_relative, 0, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
+       options_table.attach(check_relative,                                                    0, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
 
        options_table.show_all();
 
@@ -243,7 +243,7 @@ StateWidth_Context::StateWidth_Context(CanvasView* canvas_view):
        App::dialog_tool_options->present();
 
        // Turn off layer clicking
-       get_work_area()->allow_layer_clicks=false;
+       get_work_area()->set_allow_layer_clicks(false);
 
        // clear out the ducks
        //get_work_area()->clear_ducks();
@@ -278,7 +278,7 @@ StateWidth_Context::StateWidth_Context(CanvasView* canvas_view):
        }
 
        //Disable duck clicking for the maximum coolness :)
-       get_work_area()->allow_duck_clicks = false;
+       get_work_area()->set_allow_duck_clicks(false);
        get_work_area()->set_type_mask((Duck::Type)((int)Duck::TYPE_WIDTH + (int)Duck::TYPE_RADIUS));
 
        // Turn the mouse pointer to crosshairs
@@ -288,8 +288,8 @@ StateWidth_Context::StateWidth_Context(CanvasView* canvas_view):
        //prev_table_status=get_canvas_view()->tables_are_visible();
        //if(prev_table_status)get_canvas_view()->hide_tables();
 
-       // Hide the time bar
-       //get_canvas_view()->hide_timebar();
+       // Disable the time bar
+       //get_canvas_view()->set_sensitive_timebar(false);
 
        // Connect a signal
        //get_work_area()->signal_user_click().connect(sigc::mem_fun(*this,&studio::StateWidth_Context::on_user_click));
@@ -307,7 +307,7 @@ StateWidth_Context::refresh_tool_options()
 }
 
 Smach::event_result
-StateWidth_Context::event_refresh_tool_options(const Smach::event& x)
+StateWidth_Context::event_refresh_tool_options(const Smach::event& /*x*/)
 {
        refresh_tool_options();
        return Smach::RESULT_ACCEPT;
@@ -327,10 +327,10 @@ StateWidth_Context::~StateWidth_Context()
        }
 
        // Restore Duck clicking
-       get_work_area()->allow_duck_clicks = prev_workarea_duck_clicking;
+       get_work_area()->set_allow_duck_clicks(prev_workarea_duck_clicking);
 
        // Restore layer clicking
-       get_work_area()->allow_layer_clicks = prev_workarea_layer_clicking;
+       get_work_area()->set_allow_layer_clicks(prev_workarea_layer_clicking);
 
        // Restore the mouse pointer
        get_work_area()->reset_cursor();
@@ -341,9 +341,8 @@ StateWidth_Context::~StateWidth_Context()
        // Tool options be rid of ye!!
        App::dialog_tool_options->clear();
 
-       // Show the time bar
-       if(get_canvas_view()->get_canvas()->rend_desc().get_time_start()!=get_canvas_view()->get_canvas()->rend_desc().get_time_end())
-               get_canvas_view()->show_timebar();
+       // Enable the time bar
+       //get_canvas_view()->set_sensitive_timebar(true);
 
        // Bring back the tables if they were out before
        //if(prev_table_status)get_canvas_view()->show_tables();
@@ -355,13 +354,13 @@ StateWidth_Context::~StateWidth_Context()
 }
 
 Smach::event_result
-StateWidth_Context::event_stop_handler(const Smach::event& x)
+StateWidth_Context::event_stop_handler(const Smach::event& /*x*/)
 {
        throw Smach::egress_exception();
 }
 
 Smach::event_result
-StateWidth_Context::event_refresh_handler(const Smach::event& x)
+StateWidth_Context::event_refresh_handler(const Smach::event& /*x*/)
 {
        refresh_ducks();
        return Smach::RESULT_ACCEPT;
@@ -462,7 +461,7 @@ StateWidth_Context::event_mouse_handler(const Smach::event& x)
 {
        const EventMouse& event(*reinterpret_cast<const EventMouse*>(&x));
 
-       //handle ze click
+       //handle the click
        if( (event.key == EVENT_WORKAREA_MOUSE_BUTTON_DOWN || event.key == EVENT_WORKAREA_MOUSE_BUTTON_DRAG)
                        && event.button == BUTTON_LEFT )
        {
@@ -566,7 +565,7 @@ StateWidth_Context::event_mouse_handler(const Smach::event& x)
 
                        if(     desc.get_value_type() == ValueBase::TYPE_REAL )
                        {
-                               Action::Handle action(Action::create("value_desc_set"));
+                               Action::Handle action(Action::create("ValueDescSet"));
                                assert(action);
 
                                action->set_param("canvas",get_canvas());