rllib  1
rlsvganimator.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                       rlsvganimator.h  -  description
00003                              -------------------
00004     begin                : Tue Apr 10 2006
00005     copyright            : (C) 2006 by Rainer Lehrig
00006     email                : lehrig@t-online.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as        *
00013  *   published by the Free Software Foundation                             *
00014  *                                                                         *
00015  ***************************************************************************/
00016 #ifndef _RL_SVG_ANIMATOR_
00017 #define _RL_SVG_ANIMATOR_
00018 #include "rldefine.h"
00019 #include "rlinifile.h"
00020 #include "rlspreadsheet.h"
00021 #include "rlstring.h"
00022 
00027 class rlSvgPosition
00028 {
00029   public:
00030     rlSvgPosition();
00031     rlSvgPosition(float sx_init, float a_init, float x0_init, float y0_init, float cx_init, float cy_init);
00032     virtual ~rlSvgPosition();
00033     float sx, alpha, x0, y0, cx, cy;
00034     struct rlPositionInit {float sx, alpha, x0, y0, w, h;} init;
00035     void setInit(float x0_init, float y0_init, float w_init, float h_init);
00036     void move(float x, float y);
00037     void moveRelative(float dx, float dy);
00038     void scale(float s);
00039     void scaleRelative(float ds);
00040     void rotate(float alpha, float cx, float cy);
00041 };
00042 
00048 class rlSvgAnimator
00049 {
00050   public:
00051     rlSvgAnimator();
00052     virtual ~rlSvgAnimator();
00053 
00055     int setSocket(int *socket);
00057     int setId(int Id);
00061     int read(const char *infile, rlIniFile *inifile=NULL);
00064 
00065     int writeSocket();
00068     int svgPrintf(const char *objectname, const char *tag, const char *format, ...);
00070     int svgRecursivePrintf(const char *objectname, const char *tag, const char *format, ...);
00072     int svgSearchAndReplace(const char *objectname, const char *tag, const char *before, const char *after);
00074     int svgRecursiveSearchAndReplace(const char *objectname, const char *tag, const char *before, const char *after);
00076     int svgTextPrintf(const char *objectname, const char *format, ...);
00078     int show(const char *objectname, int state); // state := 0|1
00080     int setMatrix(const char *objectname, float sx, float alpha, float x0, float y0, float cx, float cy);
00082 
00083     int setMatrix(const char *objectname, rlSvgPosition &pos);
00086     int setMainObject(const char *main_object);
00087     const char *mainObject();
00089     int setXY0(float x0, float y0);
00090     float x0();
00091     float y0();
00093     int setMouseXY0(float x0, float y0);
00094     float mouseX0();
00095     float mouseY0();
00097     int setMouseXY1(float x1, float y1);
00098     float mouseX1();
00099     float mouseY1();
00101     int setScale(float scale);
00102     float scale();
00104     int zoomCenter(float newScale);
00106     int zoomRect();
00108     int setMainObjectMatrix();
00110     int setWindowSize(int width, int height);
00111     float windowWidth();
00112     float windowHeight();
00114     int moveMainObject(float x, float y);
00115 
00116     int isModified;
00117 
00118   private:
00119     int tcpsend(const char *buf, int len);
00120     int fillIniFile(rlIniFile *inifile, const char *line);
00121     int fileFillIniFile(const char *infile, rlIniFile *inifile);
00122     int inifileState, inifileCount;
00123     rlSpreadsheetCell  inifileID;
00124     rlSpreadsheetTable inifileTable;
00125     int  *s;
00126     int  id;
00127     // zoomer variables follow
00128     float svgX0, svgY0, svgWindowWidth, svgWindowHeight, svgScale, svgMouseX0, svgMouseY0, svgMouseX1, svgMouseY1;
00129     rlString main_object_name;
00130 };
00131 #endif