comparison anagram/vaclgui/ftview.hpp @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:13d2b8934445
1 /*
2 * AnaGram, A System for Syntax Directed Programming
3 * Copyright 1997-2002 Parsifal Software. All Rights Reserved.
4 * See the file COPYING for license and usage terms.
5 *
6 * ftview.hpp
7 */
8
9 #ifndef FTVIEW_HPP
10 #define FTVIEW_HPP
11
12 #include <ikeyevt.hpp>
13 #include <ikeyhdr.hpp>
14 #include <imcelcv.hpp>
15 #include <imousevt.hpp>
16 #include <imoushdr.hpp>
17 //#include <imphdr.hpp>
18 #include <ipainevt.hpp>
19 #include <ipainhdr.hpp>
20 //#include <isizehdr.hpp>
21 #include <isplitcv.hpp>
22 #include <istattxt.hpp>
23 #include <itbar.hpp>
24
25 class AgDataViewPlug; // from dvplug.hpp
26 struct tsd; // from tsd.h
27 #include "agstring.h"
28 #include "brt.h"
29 #include "conflicttrc.h"
30 #include "dview.hpp"
31 #include "frame.hpp"
32 #include "ftpardc.h"
33 #include "toolbar.hpp"
34 #include "trfview.hpp"
35 #include "vaclgui-res.h"
36
37
38 class FileTraceWindow; // below
39
40 class FileTraceView
41 : public ICanvas
42 , public AgFocusHandler
43 , public IMouseHandler
44 , public IPaintHandler
45 {
46 public:
47 FileTraceView(FileTraceWindow*,text_file, AgString);
48 ~FileTraceView();
49
50 FileTraceView &refreshRules(int);
51
52 FileTraceWindow *frame;
53
54 ISplitCanvas mainSplitter;
55 ISplitCanvas tracePanels;
56 IMultiCellCanvas leftPanel;
57 AgDataView stackView;
58 AgDataViewPlug *stackConnector;
59 IMultiCellCanvas rightPanel;
60 IStaticText fileTitle;
61 TraceFileView fileView;
62 ISplitCanvas bottomPanel;
63 AgDataView reductionChoiceView;
64 DcRef<FtParserReductionDc> reductionMenu;
65 AgDataView ruleView;
66 AgDataViewPlug *ruleConnector;
67 AgString fileName;
68 text_file textFile;
69 tsd *itemStack;
70 DcRef<rule_stack_dc> ruleControl;
71 DcRef<FtParserDc> parserDc;
72
73 FileTraceView &completeReduction();
74 //FileTraceView &setFocus();
75 int focusControl;
76 int activePanel;
77
78 void mySetFocus() { setFocus(); }
79
80 protected:
81 Boolean gotFocus(IEvent &);
82 Boolean lostFocus(IEvent &);
83
84 Boolean mouseClicked(IMouseClickEvent &event);
85 Boolean paintWindow(IPaintEvent &event);
86
87 AgNotificationAction<FileTraceView> dataColorChange;
88 void onColorChange() {fileTitle.refresh();}
89 AgNotificationAction<FileTraceView> fontChange;
90 void onFontChange() {fileTitle.setFont(FontSpec::columnHead).refresh();}
91 HelpDemon fileViewHelp;
92 };
93
94 class FileTraceWindow
95 : public AgFrame
96 , public AgFocusHandler
97 /*, public IKeyboardHandler - compiler complains because AgFrame has one */
98 , public IMouseHandler
99 {
100 public:
101 FileTraceWindow(AgString,int);
102 ~FileTraceWindow();
103 void stackSelect();
104 void ruleSelect();
105 void tokenSelect();
106 void fileEnter();
107 virtual AgString copyTitle();
108 virtual FileTraceWindow &copyTo(IClipboard &c);
109
110 // otherwise the compiler complains this is hidden
111 virtual int showHelp(IEvent &e) { return AgFrame::showHelp(e); }
112
113 void synchRules(unsigned sn, unsigned token);
114
115 Boolean windowResize(IResizeEvent &event);
116 Boolean gotFocus(IEvent&);
117
118 Boolean characterKeyPress(IKeyboardEvent &);
119 Boolean virtualKeyPress(IKeyboardEvent &);
120 Boolean mouseClicked(IMouseClickEvent &event);
121
122 void doStep();
123 void parseFile();
124 void resetParser();
125 void reload();
126 void showHelp();
127
128 FileTraceWindow &setLocationField(cint loc);
129 FileTraceWindow &setStatusField(const char *msg);
130
131 FileTraceWindow &showReductionSelection();
132 void reductionChoiceEnter();
133 void onActivate();
134 FileTraceWindow &setFocus();
135
136 public:
137 ToolBar toolBar;
138 IStaticText locationField;
139 HelpDemon locationFieldHelp;
140 IStaticText statusField;
141 HelpDemon statusFieldHelp;
142 FileTraceView canvas;
143 AgString fileName;
144 ToolBar buttonGroup;
145 ToolButton stepButton;
146 ToolButton parseButton;
147 ToolButton resetButton;
148 ToolButton reloadButton;
149 ToolButton helpButton;
150
151 virtual Boolean findNext(AgString s);
152 virtual Boolean findPrev(AgString s);
153
154 void onDesynch();
155 void onResynch();
156
157 class TabControl {
158 public:
159 int enabled;
160 char *helpTopic;
161 AgAction action;
162 IWindow *window;
163
164 TabControl() {}
165 TabControl(IWindow *window_,
166 char *helpTopic_,
167 AgAction action_ = AgAction())
168 : enabled(1)
169 , helpTopic(helpTopic_)
170 , action(action_)
171 , window(window_)
172 {}
173 TabControl(const TabControl &x)
174 : enabled(x.enabled)
175 , helpTopic(x.helpTopic)
176 , action(x.action)
177 , window(x.window)
178 {}
179 };
180
181 enum {
182 stackTab,
183 fileTab,
184 choiceTab,
185 ruleTab,
186 stepTab,
187 parseTab,
188 resetTab,
189 reloadTab,
190 helpTab,
191 nTabs
192 };
193 TabControl tabControl[nTabs];
194 };
195
196
197 #endif /* FTVIEW_HPP */