graph_viewport.h

00001 
00002 /***************************************************************************
00003  *  graph_viewport.h - FSM Graph Viewport for Skill GUI
00004  *
00005  *  Created: Mon Dec 15 15:38:02 2008
00006  *  Copyright  2008  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __TOOLS_SKILLGUI_GRAPH_VIEWPORT_H_
00024 #define __TOOLS_SKILLGUI_GRAPH_VIEWPORT_H_
00025 
00026 #include <papyrus.h>
00027 #include <papyrus-gtkmm/viewport.h>
00028 
00029 #include <gvc.h>
00030 #include <gvcjob.h>
00031 
00032 #include <string>
00033 
00034 class SkillGuiGraphViewport : public Papyrus::Gtk::Viewport
00035 {
00036  public:
00037   SkillGuiGraphViewport();
00038   ~SkillGuiGraphViewport();
00039 
00040   void set_gvjob(GVJ_t *job);
00041   void set_graph_fsm(std::string fsm_name);
00042   void set_graph(std::string graph);
00043 
00044   bool get_update_graph();
00045   void set_update_graph(bool update);
00046 
00047   void save();
00048   void render();
00049 
00050   void zoom_in();
00051   void zoom_out();
00052   void zoom_fit();
00053   void zoom_reset();
00054 
00055   Papyrus::AffineController::pointer get_affine();
00056 
00057   void add_drawable(Papyrus::Drawable::pointer d);
00058   virtual void clear();
00059   void set_bb(double bbw, double bbh);
00060   void set_pad(double pad_x, double pad_y);
00061   void set_translation(double tx, double ty);
00062   void set_scale(double scale);
00063   bool scale_override();
00064 
00065  protected:
00066   void on_expose(GdkEventExpose *event);
00067 
00068  private:
00069   GVC_t *__gvc;
00070   GVJ_t *__gvjob;
00071 
00072   std::string __graph_fsm;
00073   std::string __graph;
00074 
00075   double __bbw;
00076   double __bbh;
00077   double __pad_x;
00078   double __pad_y;
00079   double __translation_x;
00080   double __translation_y;
00081   double __scale;
00082   bool   __update_graph;
00083 
00084   bool __scale_override;
00085 
00086   Gtk::FileChooserDialog *__fcd;
00087   Papyrus::AffineController::pointer __affine;
00088   Papyrus::Translator::pointer __translator;
00089 };
00090 
00091 
00092 #endif