my log
[synfig.git] / synfig-studio / trunk / src / synfigapp / actions / canvasrenddescset.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file canvasrenddescset.cpp
3 **      \brief Template File
4 **
5 **      $Id: canvasrenddescset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === H E A D E R S ======================================================= */
23
24 #ifdef USING_PCH
25 #       include "pch.h"
26 #else
27 #ifdef HAVE_CONFIG_H
28 #       include <config.h>
29 #endif
30
31 #include "canvasrenddescset.h"
32 #include <synfigapp/canvasinterface.h>
33
34 #endif
35
36 using namespace std;
37 using namespace etl;
38 using namespace synfig;
39 using namespace synfigapp;
40 using namespace Action;
41
42 /* === M A C R O S ========================================================= */
43
44 ACTION_INIT(Action::CanvasRendDescSet);
45 ACTION_SET_NAME(Action::CanvasRendDescSet,"canvas_rend_desc_set");
46 ACTION_SET_LOCAL_NAME(Action::CanvasRendDescSet,"Set Canvas RendDesc");
47 ACTION_SET_TASK(Action::CanvasRendDescSet,"set");
48 ACTION_SET_CATEGORY(Action::CanvasRendDescSet,Action::CATEGORY_CANVAS);
49 ACTION_SET_PRIORITY(Action::CanvasRendDescSet,0);
50 ACTION_SET_VERSION(Action::CanvasRendDescSet,"0.0");
51 ACTION_SET_CVS_ID(Action::CanvasRendDescSet,"$Id: canvasrenddescset.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
52
53 /* === G L O B A L S ======================================================= */
54
55 /* === P R O C E D U R E S ================================================= */
56
57 /* === M E T H O D S ======================================================= */
58
59 Action::CanvasRendDescSet::CanvasRendDescSet()
60 {
61         set_dirty(true);
62 }
63
64 Action::ParamVocab
65 Action::CanvasRendDescSet::get_param_vocab()
66 {
67         ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
68         
69         ret.push_back(ParamDesc("rend_desc",Param::TYPE_RENDDESC)
70                 .set_local_name(_("RendDesc"))
71         );
72         
73         return ret;
74 }
75
76 bool
77 Action::CanvasRendDescSet::is_canidate(const ParamList &x)
78 {
79         return canidate_check(get_param_vocab(),x);
80 }
81
82 bool
83 Action::CanvasRendDescSet::set_param(const synfig::String& name, const Action::Param &param)
84 {
85         if(name=="rend_desc" && param.get_type()==Param::TYPE_RENDDESC)
86         {
87                 new_rend_desc=param.get_rend_desc();
88                 
89                 return true;
90         }
91
92         return Action::CanvasSpecific::set_param(name,param);
93 }
94
95 bool
96 Action::CanvasRendDescSet::is_ready()const
97 {
98         return Action::CanvasSpecific::is_ready();
99 }
100
101 void
102 Action::CanvasRendDescSet::perform()
103 {
104         old_rend_desc=get_canvas()->rend_desc();
105
106         get_canvas()->rend_desc()=new_rend_desc;
107         
108         if(get_canvas_interface())
109         {
110                 get_canvas_interface()->signal_rend_desc_changed()();
111         }
112         else synfig::warning("CanvasInterface not set on action");
113 }
114
115 void
116 Action::CanvasRendDescSet::undo()
117 {
118         get_canvas()->rend_desc()=old_rend_desc;
119         
120         if(get_canvas_interface())
121         {
122                 get_canvas_interface()->signal_rend_desc_changed()();
123         }
124         else synfig::warning("CanvasInterface not set on action");
125 }