Rev 5676 | Rev 5702 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5676 | Rev 5694 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | int x, y, w, h, min_h, line_h, text_y; |
12 | int x, y, w, h, min_h, line_h, text_y; |
13 | int column_max; |
13 | int column_max; |
14 | int count, visible, first, current; //visible = row_max |
14 | int count, visible, first, current; //visible = row_max |
15 | int active; |
15 | int active; |
16 | void ClearList(); |
16 | void ClearList(); |
17 | int ProcessKey(dword key); |
- | |
18 | int MouseOver(int xx, yy); |
17 | int MouseOver(int xx, yy); |
19 | int ProcessMouse(int xx, yy); |
18 | int ProcessMouse(int xx, yy); |
- | 19 | int ProcessKey(dword key); |
|
20 | int KeyDown(); |
20 | int KeyDown(); |
21 | int KeyUp(); |
21 | int KeyUp(); |
22 | int KeyHome(); |
22 | int KeyHome(); |
23 | int KeyEnd(); |
23 | int KeyEnd(); |
- | 24 | int KeyPgDown(); |
|
- | 25 | int KeyPgUp(); |
|
- | 26 | void CheckDoesValuesOkey(); |
|
24 | void SetSizes(int xx, yy, ww, hh, min_hh, line_hh); |
27 | void SetSizes(int xx, yy, ww, hh, min_hh, line_hh); |
25 | int MouseScroll(dword scroll_state); |
28 | int MouseScroll(dword scroll_state); |
26 | int MouseScrollNoSelection(dword scroll_state); |
29 | int MouseScrollNoSelection(dword scroll_state); |
27 | void debug_values(); |
30 | void debug_values(); |
28 | }; |
31 | }; |
Line 29... | Line 32... | ||
29 | 32 | ||
30 | 33 | ||
31 | void llist::debug_values() |
- | |
32 | { |
34 | void llist::debug_values() |
33 | debug("current: "); |
35 | { |
34 | debugi(current); |
- | |
35 | debug("first: "); |
36 | char yi[128]; |
36 | debugi(first); |
- | |
37 | debug("visible: "); |
- | |
38 | debugi(visible); |
37 | sprintf(#yi, "%s %d %s %d %s %d %s %d", "current:", current, "first:", first, |
39 | debug("count: "); |
38 | "visible:", visible, "count:", count); |
Line 40... | Line 39... | ||
40 | debugi(count); |
39 | debugln(#yi); |
Line 54... | Line 53... | ||
54 | y = yy; |
53 | y = yy; |
55 | w = ww; |
54 | w = ww; |
56 | h = hh; |
55 | h = hh; |
57 | min_h = min_hh; |
56 | min_h = min_hh; |
58 | line_h = line_hh; |
57 | line_h = line_hh; |
59 | text_y = line_hh / 2 - 4; |
58 | text_y = line_h / 2 - 4; |
60 | visible = h / line_h; |
59 | visible = h / line_h; |
61 | column_max = w / 6; |
60 | column_max = w / 6; |
62 | //if (visible > count) visible=count; |
61 | //if (visible > count) visible=count; |
63 | } |
62 | } |
Line 126... | Line 125... | ||
126 | { |
125 | { |
127 | case ASCII_KEY_DOWN: return KeyDown(); |
126 | case ASCII_KEY_DOWN: return KeyDown(); |
128 | case ASCII_KEY_UP: return KeyUp(); |
127 | case ASCII_KEY_UP: return KeyUp(); |
129 | case ASCII_KEY_HOME: return KeyHome(); |
128 | case ASCII_KEY_HOME: return KeyHome(); |
130 | case ASCII_KEY_END: return KeyEnd(); |
129 | case ASCII_KEY_END: return KeyEnd(); |
- | 130 | case ASCII_KEY_PGUP: return KeyPgUp(); |
|
- | 131 | case ASCII_KEY_PGDN: return KeyPgDown(); |
|
131 | } |
132 | } |
132 | return 0; |
133 | return 0; |
133 | } |
134 | } |
Line 134... | Line 135... | ||
134 | 135 | ||
Line 143... | Line 144... | ||
143 | { |
144 | { |
144 | if (visible+first>=count) return 0; |
145 | if (visible + first >= count) return 0; |
145 | first++; |
146 | first++; |
146 | current++; |
147 | current++; |
147 | } |
148 | } |
- | 149 | if (current < first) || (current > first + visible) |
|
- | 150 | { |
|
- | 151 | first = current; |
|
- | 152 | CheckDoesValuesOkey(); |
|
- | 153 | } |
|
148 | return 1; |
154 | return 1; |
149 | } |
155 | } |
Line 150... | Line 156... | ||
150 | 156 | ||
151 | int llist::KeyUp() |
157 | int llist::KeyUp() |
Line 158... | Line 164... | ||
158 | { |
164 | { |
159 | if (first==0) return 0; |
165 | if (first == 0) return 0; |
160 | first--; |
166 | first--; |
161 | current--; |
167 | current--; |
162 | } |
168 | } |
- | 169 | if (current < first) || (current > first + visible) |
|
- | 170 | { |
|
- | 171 | first = current; |
|
- | 172 | CheckDoesValuesOkey(); |
|
- | 173 | } |
|
163 | return 1; |
174 | return 1; |
164 | } |
175 | } |
Line 165... | Line 176... | ||
165 | 176 | ||
166 | int llist::KeyHome() |
177 | int llist::KeyHome() |
167 | { |
178 | { |
168 | if (current==0) && (first==0) return 0; |
179 | if (current==0) && (first==0) return 0; |
169 | current=0; |
- | |
170 | first=0; |
180 | current = first = 0; |
171 | return 1; |
181 | return 1; |
Line 172... | Line 182... | ||
172 | } |
182 | } |
173 | 183 | ||
Line 177... | Line 187... | ||
177 | current=count-1; |
187 | current = count-1; |
178 | first=count-visible; |
188 | first = count - visible; |
179 | return 1; |
189 | return 1; |
180 | } |
190 | } |
Line -... | Line 191... | ||
- | 191 | ||
- | 192 | int llist::KeyPgUp() |
|
- | 193 | { |
|
- | 194 | if (count <= visible) return KeyHome(); |
|
- | 195 | if (first == 0) return 0; |
|
- | 196 | first -= visible; |
|
- | 197 | CheckDoesValuesOkey(); |
|
- | 198 | return 1; |
|
- | 199 | } |
|
- | 200 | ||
- | 201 | int llist::KeyPgDown() |
|
- | 202 | { |
|
- | 203 | if (count <= visible) return KeyEnd(); |
|
- | 204 | if (first == count - visible) return 0; |
|
- | 205 | first += visible; |
|
- | 206 | CheckDoesValuesOkey(); |
|
- | 207 | return 1; |
|
- | 208 | } |
|
- | 209 | ||
- | 210 | void llist::CheckDoesValuesOkey() |
|
- | 211 | { |
|
- | 212 | if (first < 0) first = 0; |
|
- | 213 | if (visible + first > count) first = count - visible; |
|
- | 214 | if (current >= count) current = count - 1; |
|
- | 215 | if (current < 0) current = 0; |
|
- | 216 | } |
|
181 | 217 | ||
182 | #endif |
218 | #endif>>=>=>>> |