Fawkes API  Fawkes Development Version
graph_viewport.h
1 
2 /***************************************************************************
3  * graph_viewport.h - FSM Graph Viewport for Skill GUI
4  *
5  * Created: Mon Dec 15 15:38:02 2008
6  * Copyright 2008 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef _TOOLS_SKILLGUI_GRAPH_VIEWPORT_H_
24 #define _TOOLS_SKILLGUI_GRAPH_VIEWPORT_H_
25 
26 #include <papyrus-gtkmm/viewport.h>
27 
28 #include <gvc.h>
29 #include <gvcjob.h>
30 #include <papyrus.h>
31 #include <string>
32 
33 class SkillGuiGraphViewport : public Papyrus::Gtk::Viewport
34 {
35 public:
38 
39  void set_gvjob(GVJ_t *job);
40  void set_graph_fsm(const std::string &fsm_name);
41  void set_graph(const std::string &graph);
42 
43  bool get_update_graph();
44  void set_update_graph(bool update);
45 
46  void save();
47  void render();
48 
49  void zoom_in();
50  void zoom_out();
51  void zoom_fit();
52  void zoom_reset();
53 
54  Papyrus::AffineController::pointer get_affine();
55 
56  void add_drawable(Papyrus::Drawable::pointer d);
57  virtual void clear();
58  void set_bb(double bbw, double bbh);
59  void set_pad(double pad_x, double pad_y);
60  void set_translation(double tx, double ty);
61  void set_scale(double scale);
62  bool scale_override();
63 
64 protected:
65  void on_expose(GdkEventExpose *event);
66 
67 private:
68  GVC_t *gvc_;
69  GVJ_t *gvjob_;
70 
71  std::string graph_fsm_;
72  std::string graph_;
73 
74  double bbw_;
75  double bbh_;
76  double pad_x_;
77  double pad_y_;
78  double translation_x_;
79  double translation_y_;
80  double scale_;
81  bool update_graph_;
82 
83  bool scale_override_;
84 
85  Gtk::FileChooserDialog * fcd_;
86  Papyrus::AffineController::pointer affine_;
87  Papyrus::Translator::pointer translator_;
88 };
89 
90 #endif
Skill FSM Graph Viewport.
void set_graph(const std::string &graph)
Set graph.
~SkillGuiGraphViewport()
Destructor.
void set_gvjob(GVJ_t *job)
Set current Graphviz job.
bool scale_override()
Check if scale override is enabled.
void render()
Render current graph.
void set_update_graph(bool update)
Set if the graph should be updated on new data.
void zoom_fit()
Zoom to fit.
Papyrus::AffineController::pointer get_affine()
Get scaler.
void save()
Render current graph.
void set_graph_fsm(const std::string &fsm_name)
Set graph's FSM name.
void set_pad(double pad_x, double pad_y)
Set padding.
virtual void clear()
Clear all drawables.
void set_bb(double bbw, double bbh)
Set bounding box.
SkillGuiGraphViewport()
Constructor.
void zoom_out()
Zoom out.
void on_expose(GdkEventExpose *event)
Called on explose.
bool get_update_graph()
Check if graph is being updated.
void zoom_reset()
Zoom reset.
void add_drawable(Papyrus::Drawable::pointer d)
Add a drawable.
void set_scale(double scale)
Set scale.
void set_translation(double tx, double ty)
Set translation.