Mercurial > ~dholland > hg > ag > index.cgi
comparison anagram/vaclgui/dvplug.cpp @ 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 * dvplug.cpp | |
7 */ | |
8 | |
9 #include "action.h" | |
10 #include "dvplug.hpp" | |
11 #include "dc.h" | |
12 #include "p.h" | |
13 #include "stacks.h" | |
14 #include "wm1.h" | |
15 | |
16 //#define INCLUDE_LOGGING | |
17 #include "log.h" | |
18 | |
19 | |
20 AgDataViewPlug::~AgDataViewPlug() { | |
21 LOGSECTION("AgDataViewPlug::~AgDataViewPlug"); | |
22 LOGV((int) this) LCV(displayControl->usage_count); | |
23 } | |
24 | |
25 IColor AgDataViewPlug::color[10] = { | |
26 IColor::blue, IColor::white, // table body | |
27 IColor:: darkRed, IColor::white, // cursor bar | |
28 IColor::paleGray, IColor::black, // head title | |
29 IColor::white, IColor::darkBlue, // column head titles | |
30 IColor::paleGray, IColor::black // foot title | |
31 }; | |
32 | |
33 void AgDataViewPlug::disconnect() { | |
34 displayControl.discardData(); | |
35 } | |
36 | |
37 void AgDataViewPlug::setFocus() { | |
38 dataView->setFocus(); | |
39 } | |
40 | |
41 int AgDataViewPlug::getCursorLine() { | |
42 //LOGSECTION("AgDataViewPlug::getCursorLine"); | |
43 return dataView->getCursorLine(); | |
44 } | |
45 | |
46 unsigned AgDataViewPlug::nColumns() { | |
47 int *tabs = displayControl->tab_stops; | |
48 if (tabs == 0) { | |
49 return 1; | |
50 } | |
51 unsigned i = 1; | |
52 while (*tabs++) { | |
53 i++; | |
54 } | |
55 return i; | |
56 } | |
57 | |
58 void AgDataViewPlug::show() { | |
59 pop_up_window(displayControl); | |
60 } | |
61 | |
62 AgString AgDataViewPlug::getLine(unsigned k) { | |
63 extern char *string_base; | |
64 | |
65 LOGSECTION("AgDataViewPlug::getLine"); | |
66 LOGV((int) (dc *) displayControl); | |
67 displayControl->getLine(k); | |
68 LOGV(string_base); | |
69 return buildAgString(); | |
70 } | |
71 | |
72 AgString AgDataViewPlug::findHelpTopic() { | |
73 displayControl->des->c_loc_doc.y = getCursorLine(); | |
74 return displayControl->findHelpTopic(); | |
75 } | |
76 | |
77 int AgDataViewPlug::syntaxDependent() { | |
78 return displayControl->syntax_dependent; | |
79 } | |
80 | |
81 unsigned AgDataViewPlug::nLines() { return displayControl->des->d_size.y; } | |
82 int AgDataViewPlug::nextChildId() { return ::nextChildId(); } | |
83 | |
84 AgString AgDataViewPlug::fileName() { return simple_file_name; } | |
85 AgString AgDataViewPlug::headTitle() { | |
86 return displayControl->head_title; | |
87 } | |
88 AgString AgDataViewPlug::columnHeadTitle() { | |
89 return displayControl->columnHeadTitle; | |
90 } | |
91 AgString AgDataViewPlug::footTitle() { | |
92 return displayControl->foot_title; | |
93 } | |
94 | |
95 AgArray<AgMenuItem> AgDataViewPlug::auxMenu() { | |
96 LOGSECTION("AgDataViewPlug::auxMenu"); | |
97 LOGV((int) dataView); | |
98 LOGV((int) dataView->frameWindow); | |
99 dc::MenuOption **auxMenu = displayControl->getAuxWinMenu(); | |
100 LOGV((int) auxMenu); | |
101 int n = 0; | |
102 int i; | |
103 if (auxMenu) { | |
104 while (auxMenu[n]) { | |
105 n++; | |
106 } | |
107 } | |
108 LOGV(n); | |
109 LOGV((int) dataView->frameWindow); | |
110 LOGV((int) (dc *) displayControl); | |
111 AgArray<AgMenuItem> menu(n); | |
112 for (i = 0; i < n; i++) { | |
113 LOGV(i) LCV(auxMenu[i]->option_name); | |
114 LOGV((int) dataView->frameWindow); | |
115 menu[i] = AgMenuItem(auxMenu[i]->option_name, | |
116 AgClassAction<dc>(*displayControl, | |
117 auxMenu[i]->action), | |
118 (dc *) displayControl); | |
119 LOGV((int) menu[i].displayControl); | |
120 LOGV((int) dataView->frameWindow); | |
121 } | |
122 return menu; | |
123 } | |
124 | |
125 void AgDataViewPlug::synchCursor(unsigned ln) { | |
126 LOGSECTION("AgDataViewPlug::synchCursor"); | |
127 LOGV((int) (dc *) displayControl); | |
128 displayControl->synchCursor(ln); | |
129 } |