3 ** This module contains functions to support the data/register window display.
13 /*****************************************
14 ** STATIC LOCAL FUNCTIONS FORWARD DECLS **
15 ******************************************/
19 /*****************************************
20 ** PUBLIC FUNCTIONS **
21 ******************************************/
25 ** tuiFirstDataItemDisplayed()
26 ** Answer the index first element displayed.
27 ** If none are displayed, then return (-1).
31 tuiFirstDataItemDisplayed (void)
33 tuiFirstDataItemDisplayed ()
39 for (i
= 0; (i
< dataWin
->generic
.contentSize
&& elementNo
< 0); i
++)
41 TuiGenWinInfoPtr dataItemWin
;
43 dataItemWin
= &((TuiWinContent
)
44 dataWin
->generic
.content
)[i
]->whichElement
.dataWindow
;
45 if (dataItemWin
->handle
!= (WINDOW
*) NULL
&& dataItemWin
->isVisible
)
50 } /* tuiFirstDataItemDisplayed */
54 ** tuiFirstDataElementNoInLine()
55 ** Answer the index of the first element in lineNo. If lineNo is
56 ** past the data area (-1) is returned.
60 tuiFirstDataElementNoInLine (
63 tuiFirstDataElementNoInLine (lineNo
)
67 int firstElementNo
= (-1);
70 ** First see if there is a register on lineNo, and if so, set the
71 ** first element number
73 if ((firstElementNo
= tuiFirstRegElementNoInLine (lineNo
)) == -1)
75 ** Looking at the general data, the 1st element on lineNo
79 return firstElementNo
;
80 } /* tuiFirstDataElementNoInLine */
84 ** tuiDeleteDataContentWindows()
85 ** Function to delete all the item windows in the data window.
86 ** This is usually done when the data window is scrolled.
90 tuiDeleteDataContentWindows (void)
92 tuiDeleteDataContentWindows ()
96 TuiGenWinInfoPtr dataItemWinPtr
;
98 for (i
= 0; (i
< dataWin
->generic
.contentSize
); i
++)
100 dataItemWinPtr
= &((TuiWinContent
)
101 dataWin
->generic
.content
)[i
]->whichElement
.dataWindow
;
102 tuiDelwin (dataItemWinPtr
->handle
);
103 dataItemWinPtr
->handle
= (WINDOW
*) NULL
;
104 dataItemWinPtr
->isVisible
= FALSE
;
108 } /* tuiDeleteDataContentWindows */
113 tuiEraseDataContent (
116 tuiEraseDataContent (prompt
)
120 werase (dataWin
->generic
.handle
);
121 checkAndDisplayHighlightIfNeeded (dataWin
);
122 if (prompt
!= (char *) NULL
)
124 int halfWidth
= (dataWin
->generic
.width
- 2) / 2;
127 if (strlen (prompt
) >= halfWidth
)
130 xPos
= halfWidth
- strlen (prompt
);
131 mvwaddstr (dataWin
->generic
.handle
,
132 (dataWin
->generic
.height
/ 2),
136 wrefresh (dataWin
->generic
.handle
);
139 } /* tuiEraseDataContent */
143 ** tuiDisplayAllData().
144 ** This function displays the data that is in the data window's
145 ** content. It does not set the content.
149 tuiDisplayAllData (void)
154 if (dataWin
->generic
.contentSize
<= 0)
155 tuiEraseDataContent (NO_DATA_STRING
);
158 tuiEraseDataContent ((char *) NULL
);
159 tuiDeleteDataContentWindows ();
160 checkAndDisplayHighlightIfNeeded (dataWin
);
161 tuiDisplayRegistersFrom (0);
163 ** Then display the other data
165 if (dataWin
->detail
.dataDisplayInfo
.dataContent
!=
166 (TuiWinContent
) NULL
&&
167 dataWin
->detail
.dataDisplayInfo
.dataContentCount
> 0)
172 } /* tuiDisplayAllData */
176 ** tuiDisplayDataFromLine()
177 ** Function to display the data starting at line, lineNo, in the
182 tuiDisplayDataFromLine (
185 tuiDisplayDataFromLine (lineNo
)
189 int _lineNo
= lineNo
;
194 checkAndDisplayHighlightIfNeeded (dataWin
);
196 /* there is no general data, force regs to display (if there are any) */
197 if (dataWin
->detail
.dataDisplayInfo
.dataContentCount
<= 0)
198 tuiDisplayRegistersFromLine (_lineNo
, TRUE
);
201 int elementNo
, startLineNo
;
202 int regsLastLine
= tuiLastRegsLineNo ();
205 /* display regs if we can */
206 if (tuiDisplayRegistersFromLine (_lineNo
, FALSE
) < 0)
208 ** _lineNo is past the regs display, so calc where the
209 ** start data element is
211 if (regsLastLine
< _lineNo
)
212 { /* figure out how many lines each element is to obtain
213 the start elementNo */
218 ** calculate the starting element of the data display, given
219 ** regsLastLine and how many lines each element is, up to
223 /* Now display the data , starting at elementNo */
227 } /* tuiDisplayDataFromLine */
231 ** tuiDisplayDataFrom()
232 ** Display data starting at element elementNo
240 tuiDisplayDataFrom (elementNo
, reuseWindows
)
245 int firstLine
= (-1);
247 if (elementNo
< dataWin
->detail
.dataDisplayInfo
.regsContentCount
)
248 firstLine
= tuiLineFromRegElementNo (elementNo
);
250 { /* calculate the firstLine from the element number */
255 tuiEraseDataContent ((char *) NULL
);
257 tuiDeleteDataContentWindows ();
258 tuiDisplayDataFromLine (firstLine
);
262 } /* tuiDisplayDataFrom */
266 ** tuiRefreshDataWin()
267 ** Function to redisplay the contents of the data window.
271 tuiRefreshDataWin (void)
276 tuiEraseDataContent ((char *) NULL
);
277 if (dataWin
->generic
.contentSize
> 0)
279 int firstElement
= tuiFirstDataItemDisplayed ();
281 if (firstElement
>= 0) /* re-use existing windows */
282 tuiDisplayDataFrom (firstElement
, TRUE
);
286 } /* tuiRefreshDataWin */
290 ** tuiCheckDataValues().
291 ** Function to check the data values and hilite any that have changed
296 struct frame_info
*frame
)
298 tuiCheckDataValues (frame
)
299 struct frame_info
*frame
;
302 tuiCheckRegisterValues (frame
);
304 /* Now check any other data values that there are */
305 if (m_winPtrNotNull (dataWin
) && dataWin
->generic
.isVisible
)
309 for (i
= 0; dataWin
->detail
.dataDisplayInfo
.dataContentCount
; i
++)
312 TuiDataElementPtr dataElementPtr
;
313 TuiGenWinInfoPtr dataItemWinPtr
;
316 dataItemPtr
= &dataWin
->detail
.dataDisplayInfo
.
317 dataContent
[i
]->whichElement
.dataWindow
;
318 dataElementPtr
= &((TuiWinContent
)
319 dataItemWinPtr
->content
)[0]->whichElement
.data
;
321 has
changed (dataElementPtr
, frame
, &newValue
)
323 dataElementPtr
->value
= newValue
;
324 update the display with the
new value
, hiliting it
.
329 } /* tuiCheckDataValues */
333 ** tui_vCheckDataValues().
334 ** Function to check the data values and hilite any that have
335 ** changed with args in a va_list
339 tui_vCheckDataValues (
342 tui_vCheckDataValues (args
)
346 struct frame_info
*frame
= va_arg (args
, struct frame_info
*);
348 tuiCheckDataValues (frame
);
351 } /* tui_vCheckDataValues */
355 ** tuiVerticalDataScroll()
356 ** Scroll the data window vertically forward or backward.
360 tuiVerticalDataScroll (
361 TuiScrollDirection scrollDirection
,
364 tuiVerticalDataScroll (scrollDirection
, numToScroll
)
365 TuiScrollDirection scrollDirection
;
370 int firstLine
= (-1);
372 firstElementNo
= tuiFirstDataItemDisplayed ();
373 if (firstElementNo
< dataWin
->detail
.dataDisplayInfo
.regsContentCount
)
374 firstLine
= tuiLineFromRegElementNo (firstElementNo
);
376 { /* calculate the first line from the element number which is in
377 ** the general data content
383 int lastElementNo
, lastLine
;
385 if (scrollDirection
== FORWARD_SCROLL
)
386 firstLine
+= numToScroll
;
388 firstLine
-= numToScroll
;
389 tuiEraseDataContent ((char *) NULL
);
390 tuiDeleteDataContentWindows ();
391 tuiDisplayDataFromLine (firstLine
);
395 } /* tuiVerticalDataScroll */
398 /*****************************************
399 ** STATIC LOCAL FUNCTIONS **
400 ******************************************/