1 /* === S Y N F I G ========================================================= */
2 /*! \file state_null.cpp
3 ** \brief Null State File
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 ** Copyright (c) 2007, 2008 Chris Moore
11 ** This package is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU General Public License as
13 ** published by the Free Software Foundation; either version 2 of
14 ** the License, or (at your option) any later version.
16 ** This package is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ** General Public License for more details.
22 /* ========================================================================= */
24 /* === H E A D E R S ======================================================= */
33 #include "state_null.h"
35 #include "event_mouse.h"
36 #include "event_layerclick.h"
38 #include "dialog_tooloptions.h"
39 #include <gtkmm/dialog.h>
40 #include "widget_waypointmodel.h"
41 #include <synfig/valuenode_animated.h>
42 #include <synfig/valuenode_composite.h>
43 #include <synfig/valuenode_const.h>
44 #include "canvasview.h"
49 /* === U S I N G =========================================================== */
53 using namespace synfig;
54 using namespace studio;
56 /* === M A C R O S ========================================================= */
58 /* === G L O B A L S ======================================================= */
60 StateNull studio::state_null;
62 /* === C L A S S E S & S T R U C T S ======================================= */
64 class studio::StateNull_Context : public sigc::trackable
66 CanvasView *canvas_view;
68 CanvasView* get_canvas_view() { return canvas_view; }
69 Canvas::Handle get_canvas() { return canvas_view->get_canvas(); }
70 WorkArea* get_work_area() { return canvas_view->get_work_area(); }
71 etl::handle<synfigapp::CanvasInterface> get_canvas_interface() { return canvas_view->canvas_interface(); }
73 Gtk::Table options_table;
76 StateNull_Context(CanvasView *canvas_view);
79 Smach::event_result event_refresh_tool_options(const Smach::event& x);
81 void refresh_tool_options();
82 }; // END of class StateNull_Context
84 /* === P R O C E D U R E S ================================================= */
86 /* === M E T H O D S ======================================================= */
88 StateNull::StateNull():
89 Smach::state<StateNull_Context>("null")
91 insert(event_def(EVENT_REFRESH_TOOL_OPTIONS,&StateNull_Context::event_refresh_tool_options));
94 StateNull::~StateNull()
98 StateNull_Context::StateNull_Context(CanvasView *canvas_view):
99 canvas_view(canvas_view)
101 // Synfig Studio's default state is initialized in the canvas view constructor
102 // As a result, it cannot reference canvas view or workarea when created
103 // Other states need to reference the workarea,
104 // so a null state was created to be the default
106 options_table.attach(*manage(new Gtk::Label(_("Welcome to Synfig Studio"))), 0, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, 0, 0);
107 options_table.show_all();
108 refresh_tool_options();
111 StateNull_Context::~StateNull_Context()
116 StateNull_Context::refresh_tool_options()
118 App::dialog_tool_options->clear();
119 App::dialog_tool_options->set_widget(options_table);
120 App::dialog_tool_options->set_local_name(_("Welcome to Synfig Studio"));
121 App::dialog_tool_options->set_name("null");
125 StateNull_Context::event_refresh_tool_options(const Smach::event& /*x*/)
127 refresh_tool_options();
128 return Smach::RESULT_ACCEPT;