1 /* Copyright (C) 2000 Damir Zucic */ 2 3 /*============================================================================= 4 5 init_buttons.c 6 7 Purpose: 8 Initialize dummy buttons in control window, i.e. define edge 9 coordinates for all windows. 10 11 Input: 12 (1) Pointer to ButtonS structure. 13 14 Output: 15 (1) ButtonS array of structures initialized. 16 (2) Return value. 17 18 Return value: 19 (1) Positive always (trivial). 20 21 Notes: 22 (1) Indices are assigned as follows: 23 0 = KP_0 24 1 = KP_1 25 2 = KP_2 26 3 = KP_3 27 4 = KP_4 28 5 = KP_5 29 6 = KP_6 30 7 = KP_7 31 8 = KP_8 32 9 = KP_9 33 10 = KP_Decimal 34 11 = KP_Enter 35 12 = KP_Add 36 13 = KP_Subtract 37 14 = KP_Multiply 38 15 = KP_Divide 39 16 = F1 40 17 = F2 41 18 = F3 42 19 = F4 43 44 ========includes:============================================================*/ 45 46 #include <stdio.h> 47 48 #include <X11/Xlib.h> 49 #include <X11/Xutil.h> 50 #include <X11/Xos.h> 51 #include <X11/Xatom.h> 52 53 #include "defines.h" 54 #include "typedefs.h" 55 56 /*======initialize dummy buttons:============================================*/ 57 InitializeButtons_(ButtonS * buttonSP)58int InitializeButtons_ (ButtonS *buttonSP) 59 { 60 ButtonS *curr_buttonSP; 61 62 /* [0] KP_Zero: */ 63 curr_buttonSP = buttonSP; 64 curr_buttonSP->left_edge = 3; 65 curr_buttonSP->top_edge = 162; 66 curr_buttonSP->right_edge = 65; 67 curr_buttonSP->bottom_edge = 192; 68 69 /* [1] KP_1: */ 70 curr_buttonSP = buttonSP + 1; 71 curr_buttonSP->left_edge = 3; 72 curr_buttonSP->top_edge = 130; 73 curr_buttonSP->right_edge = 33; 74 curr_buttonSP->bottom_edge = 160; 75 76 /* [2] KP_2: */ 77 curr_buttonSP = buttonSP + 2; 78 curr_buttonSP->left_edge = 35; 79 curr_buttonSP->top_edge = 130; 80 curr_buttonSP->right_edge = 65; 81 curr_buttonSP->bottom_edge = 160; 82 83 /* [3] KP_3: */ 84 curr_buttonSP = buttonSP + 3; 85 curr_buttonSP->left_edge = 67; 86 curr_buttonSP->top_edge = 130; 87 curr_buttonSP->right_edge = 97; 88 curr_buttonSP->bottom_edge = 160; 89 90 /* [4] KP_4: */ 91 curr_buttonSP = buttonSP + 4; 92 curr_buttonSP->left_edge = 3; 93 curr_buttonSP->top_edge = 98; 94 curr_buttonSP->right_edge = 33; 95 curr_buttonSP->bottom_edge = 128; 96 97 /* [5] KP_5: */ 98 curr_buttonSP = buttonSP + 5; 99 curr_buttonSP->left_edge = 35; 100 curr_buttonSP->top_edge = 98; 101 curr_buttonSP->right_edge = 65; 102 curr_buttonSP->bottom_edge = 128; 103 104 /* [6] KP_6: */ 105 curr_buttonSP = buttonSP + 6; 106 curr_buttonSP->left_edge = 67; 107 curr_buttonSP->top_edge = 98; 108 curr_buttonSP->right_edge = 97; 109 curr_buttonSP->bottom_edge = 128; 110 111 /* [7] KP_7: */ 112 curr_buttonSP = buttonSP + 7; 113 curr_buttonSP->left_edge = 3; 114 curr_buttonSP->top_edge = 66; 115 curr_buttonSP->right_edge = 33; 116 curr_buttonSP->bottom_edge = 96; 117 118 /* [8] KP_8: */ 119 curr_buttonSP = buttonSP + 8; 120 curr_buttonSP->left_edge = 35; 121 curr_buttonSP->top_edge = 66; 122 curr_buttonSP->right_edge = 65; 123 curr_buttonSP->bottom_edge = 96; 124 125 /* [9] KP_9: */ 126 curr_buttonSP = buttonSP + 9; 127 curr_buttonSP->left_edge = 67; 128 curr_buttonSP->top_edge = 66; 129 curr_buttonSP->right_edge = 97; 130 curr_buttonSP->bottom_edge = 96; 131 132 /* [10] KP_Decimal: */ 133 curr_buttonSP = buttonSP + 10; 134 curr_buttonSP->left_edge = 67; 135 curr_buttonSP->top_edge = 162; 136 curr_buttonSP->right_edge = 97; 137 curr_buttonSP->bottom_edge = 192; 138 139 /* [11] KP_Enter: */ 140 curr_buttonSP = buttonSP + 11; 141 curr_buttonSP->left_edge = 99; 142 curr_buttonSP->top_edge = 130; 143 curr_buttonSP->right_edge = 129; 144 curr_buttonSP->bottom_edge = 192; 145 146 /* [12] KP_Add: */ 147 curr_buttonSP = buttonSP + 12; 148 curr_buttonSP->left_edge = 99; 149 curr_buttonSP->top_edge = 66; 150 curr_buttonSP->right_edge = 129; 151 curr_buttonSP->bottom_edge = 128; 152 153 /* [13] KP_Subtract: */ 154 curr_buttonSP = buttonSP + 13; 155 curr_buttonSP->left_edge = 99; 156 curr_buttonSP->top_edge = 34; 157 curr_buttonSP->right_edge = 129; 158 curr_buttonSP->bottom_edge = 64; 159 160 /* [14] KP_Multiply: */ 161 curr_buttonSP = buttonSP + 14; 162 curr_buttonSP->left_edge = 67; 163 curr_buttonSP->top_edge = 34; 164 curr_buttonSP->right_edge = 97; 165 curr_buttonSP->bottom_edge = 64; 166 167 /* [15] KP_Divide: */ 168 curr_buttonSP = buttonSP + 15; 169 curr_buttonSP->left_edge = 35; 170 curr_buttonSP->top_edge = 34; 171 curr_buttonSP->right_edge = 65; 172 curr_buttonSP->bottom_edge = 64; 173 174 /* [16] F1: */ 175 curr_buttonSP = buttonSP + 16; 176 curr_buttonSP->left_edge = 3; 177 curr_buttonSP->top_edge = 288; 178 curr_buttonSP->right_edge = 33; 179 curr_buttonSP->bottom_edge = 326; 180 181 /* [17] F2: */ 182 curr_buttonSP = buttonSP + 17; 183 curr_buttonSP->left_edge = 35; 184 curr_buttonSP->top_edge = 288; 185 curr_buttonSP->right_edge = 65; 186 curr_buttonSP->bottom_edge = 326; 187 188 /* [18] F3: */ 189 curr_buttonSP = buttonSP + 18; 190 curr_buttonSP->left_edge = 67; 191 curr_buttonSP->top_edge = 288; 192 curr_buttonSP->right_edge = 97; 193 curr_buttonSP->bottom_edge = 326; 194 195 /* [19] F4: */ 196 curr_buttonSP = buttonSP + 19; 197 curr_buttonSP->left_edge = 99; 198 curr_buttonSP->top_edge = 288; 199 curr_buttonSP->right_edge = 129; 200 curr_buttonSP->bottom_edge = 326; 201 202 /* Return positive value (trivial): */ 203 return 1; 204 } 205 206 /*===========================================================================*/ 207 208 209