More debugscript things, sanity fading fast
[ipdf/code.git] / src / debugscript.h
1 #ifndef _DEBUGSCRIPT_H
2 #define _DEBUGSCRIPT_H
3
4 #include "real.h"
5 #include "view.h"
6 #include "screen.h"
7 #include <iostream>
8 #include <fstream>
9
10 namespace IPDF
11 {
12
13 class DebugScript
14 {
15 public:
16         DebugScript() : inp(), currentAction(), m_actions(), m_labels(), m_index(0) {}
17         virtual ~DebugScript() {}
18         void Load(const char *filename)
19         {
20                 inp.open(filename);
21         }
22         bool Execute(View *view, Screen *scr);
23 private:
24         enum ActionType
25         {
26                 AT_WaitFrame,
27                 AT_Translate,
28                 AT_Zoom,
29                 AT_TranslatePx,
30                 AT_ZoomPx,
31                 AT_SetCPURendering,
32                 AT_SetGPURendering,
33                 AT_EnableLazyRendering,
34                 AT_DisableLazyRendering,
35                 AT_LoadSVG,
36                 AT_Label,
37                 AT_Goto,
38                 AT_Debug,
39                 AT_Quit
40         };
41
42         struct Action
43         {
44                 ActionType type;
45                 Real x, y;
46                 int ix, iy;
47                 Real z;
48                 int iz;
49                 int loops;
50                 std::string textargs;
51                 Action() : type(AT_WaitFrame), x(0), y(0), ix(0), iy(0), z(0), loops(0), textargs("") {}
52         };
53
54         std::ifstream inp;
55
56         Action currentAction;
57         std::vector<Action> m_actions;
58         std::map<std::string, int> m_labels;
59         unsigned m_index;
60         void ParseAction();
61 };
62
63 }
64
65 #endif

UCC git Repository :: git.ucc.asn.au