1 /* Copyright (C) 2000 Damir Zucic */
2 
3 /*=============================================================================
4 
5 				draw titles.c
6 
7 Purpose:
8 	Draw titles.
9 
10 Input:
11 	(1) Pointer to RuntimeS structure.
12 	(2) Pointer to GUIS structure.
13 
14 Output:
15 	(1) Titles drawn to the hidden pixmap.
16 	(2) Return value.
17 
18 Return value:
19 	The number of titles drawn.
20 
21 =============================================================================*/
22 
23 #include <stdio.h>
24 
25 #include <string.h>
26 
27 #include <X11/Xlib.h>
28 #include <X11/Xutil.h>
29 #include <X11/Xos.h>
30 #include <X11/Xatom.h>
31 
32 #include "defines.h"
33 #include "typedefs.h"
34 
35 /*======draw titles:=========================================================*/
36 
DrawTitles_(RuntimeS * runtimeSP,GUIS * guiSP)37 int DrawTitles_ (RuntimeS *runtimeSP, GUIS *guiSP)
38 {
39 int		titles_drawnN = 0;
40 int		titleI;
41 char		*curr_titleP;
42 int		curr_title_length;
43 int		screen_x, screen_y;
44 
45 /* Prepare the text color: */
46 XSetForeground (guiSP->displaySP, guiSP->theGCA[0],
47 		guiSP->main_winS.fg_colorID);
48 
49 /* Scan the set of titles: */
50 for (titleI = 0; titleI < MAXTITLES; titleI++)
51 	{
52 	/** Do not draw hidden titles: **/
53 	if (runtimeSP->title_hiddenF[titleI] != 0) continue;
54 
55 	/** Pointer to the current title: **/
56 	curr_titleP = runtimeSP->titlesP + titleI * TITLESTRINGSIZE;
57 
58 	/** Do not draw empty titles: **/
59 	curr_title_length = strlen (curr_titleP);
60 	if (curr_title_length == 0) continue;
61 
62 	/** String position: **/
63 	screen_x = runtimeSP->title_screen_x[titleI];
64 	screen_y = runtimeSP->title_screen_y[titleI];
65 
66 	/** Draw the string: **/
67 	XDrawString (guiSP->displaySP,
68 		     guiSP->main_winS.ID,
69 		     guiSP->theGCA[0],
70 		     screen_x, screen_y,
71 		     curr_titleP, curr_title_length);
72 	}
73 
74 /* Return the number of titles that were drawn: */
75 return titles_drawnN;
76 }
77 
78 /*===========================================================================*/
79 
80 
81