Rev 7984 | Rev 8955 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7984 | Rev 8954 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | // Notes v1.1 |
1 | // Notes v1.1 |
Line 2... | Line 2... | ||
2 | 2 | ||
- | 3 | #define MEMSIZE 1024*40 |
|
- | 4 | #define ENTRY_POINT #main |
|
3 | #define MEMSIZE 0xDAE80 |
5 | |
Line 4... | Line 6... | ||
4 | #include "..\lib\kolibri.h" |
6 | #include "..\lib\kolibri.h" |
5 | 7 | ||
6 | #include "..\lib\obj\box_lib.h" |
8 | #include "..\lib\obj\box_lib.h" |
Line 11... | Line 13... | ||
11 | // // |
13 | // // |
12 | // DATA // |
14 | // DATA // |
13 | // // |
15 | // // |
14 | //===================================================// |
16 | //===================================================// |
Line 15... | Line -... | ||
15 | - | ||
16 | #ifndef AUTOBUILD |
- | |
17 | #include "lang.h--" |
- | |
18 | #endif |
- | |
19 | 17 | ||
20 | #ifdef LANG_RUS |
18 | #ifdef LANG_RUS |
21 | ?define WINDOW_CAPTION " ¬¥âª¨" |
19 | ?define WINDOW_CAPTION " ¬¥âª¨" |
22 | ?define DELETE_TEXT "¤ «¨âì"; |
20 | ?define DELETE_TEXT "¤ «¨âì"; |
23 | #else |
21 | #else |
Line 37... | Line 35... | ||
37 | #define WIN_H RED_LINE_X*LINES_COUNT+HEADER_HEIGHT+4 |
35 | #define WIN_H RED_LINE_X*LINES_COUNT+HEADER_HEIGHT+4 |
Line 38... | Line 36... | ||
38 | 36 | ||
39 | #define DELETE_BTN 4; |
37 | #define DELETE_BTN 4; |
Line 40... | Line -... | ||
40 | #define DELETE_W sizeof(DELETE_TEXT)+2*6 |
- | |
41 | - | ||
42 | proc_info Form; |
38 | #define DELETE_W sizeof(DELETE_TEXT)+2*6 |
43 | 39 | ||
Line -... | Line 40... | ||
- | 40 | #include "engine.h" |
|
- | 41 | #include "ini.h" |
|
- | 42 | ||
44 | #include "engine.h" |
43 | proc_info Form; |
45 | #include "ini.h" |
44 | |
46 | 45 | edit_box notebox = {WIN_W-RED_LINE_X-6,RED_LINE_X+5,RED_LINE_X, |
|
Line 47... | Line 46... | ||
47 | edit_box notebox = {NULL,NULL,NULL,COL_BG_ACTIVE,0x94AECE,COL_BG_ACTIVE,0xffffff,0, |
46 | COL_BG_ACTIVE, 0x94AECE,COL_BG_ACTIVE,0xffffff,0, |
48 | MAX_LINE_CHARS-1,NULL,0,ed_always_focus+ed_focus}; |
47 | MAX_LINE_CHARS-1, NULL,0,ed_always_focus+ed_focus}; |
49 | dword lists[] = { 0xEAEAEA, 0xCDCDCD, 0xF0F0F0, 0xD8D8D8, 0 }; |
48 | dword lists[] = { 0xEAEAEA, 0xCDCDCD, 0xF0F0F0, 0xD8D8D8, 0 }; |
Line 50... | Line 49... | ||
50 | 49 | ||
51 | bool delete_active = false; |
50 | bool delete_active = false; |
52 | bool window_dragable = true; |
51 | bool window_dragable = true; |
53 | block delBtn; |
52 | block delBtn = { WIN_W-DELETE_W-1, NULL, DELETE_W, RED_LINE_X}; |
54 | 53 | ||
Line 55... | Line 54... | ||
55 | //===================================================// |
54 | //===================================================// |
56 | // // |
55 | // // |
57 | // CODE // |
56 | // CODE // |
58 | // // |
- | |
59 | //===================================================// |
57 | // // |
Line 60... | Line 58... | ||
60 | 58 | //===================================================// |
|
Line 61... | Line 59... | ||
61 | void main() |
59 | |
Line 62... | Line 60... | ||
62 | { |
60 | void main() |
63 | bool first_redraw=true; |
61 | { |
64 | dword cur_line_offset; |
- | |
65 | load_dll(boxlib, #box_lib_init,0); |
62 | bool first_redraw=true; |
66 | 63 | load_dll(boxlib, #box_lib_init,0); |
|
67 | if (GetCpuFrequency()/1000000>=1000) window_dragable=true; else window_dragable=false; |
64 | |
68 | 65 | if (GetCpuFrequency()/1000000>=1000) window_dragable=true; else window_dragable=false; |
|
Line 113... | Line 110... | ||
113 | break; |
110 | break; |
114 | } |
111 | } |
115 | break; |
112 | break; |
Line 116... | Line 113... | ||
116 | 113 | ||
117 | case evKey: |
114 | case evKey: |
118 | GetKeys(); |
115 | @GetKeys(); |
119 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) |
116 | if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) |
120 | { |
117 | { |
121 | if (key_scancode == SCAN_CODE_SPACE) |
118 | if (key_scancode == SCAN_CODE_SPACE) |
122 | { |
119 | { |
Line 182... | Line 179... | ||
182 | DrawRectangle(0,TITLE_H,WIN_W,WIN_H-HEADER_HEIGHT+EDGE_H,0xBBBBBB); |
179 | DrawRectangle(0,TITLE_H,WIN_W,WIN_H-HEADER_HEIGHT+EDGE_H,0xBBBBBB); |
183 | for (i=0; lists[i]!=0; i++) DrawBar(1,WIN_H-i-1, WIN_W-1, 1, lists[i]); |
180 | for (i=0; lists[i]!=0; i++) DrawBar(1,WIN_H-i-1, WIN_W-1, 1, lists[i]); |
184 | EventListRedraw(); |
181 | EventListRedraw(); |
185 | } |
182 | } |
Line 186... | Line -... | ||
186 | - | ||
187 | void DrawEditBoxN() |
- | |
188 | { |
- | |
189 | notebox.width = notes.w-notes.x-8; |
- | |
190 | notebox.left = notes.x+5; |
- | |
191 | notebox.offset = notebox.shift = notebox.shift_old = 0; |
- | |
192 | notebox.cl_curs_x = notebox.cl_curs_y = 0; |
- | |
193 | notebox.size = strlen(notebox.text); |
- | |
194 | notebox.flags = ed_always_focus+ed_focus; |
- | |
195 | if (notebox.pos > notebox.size) notebox.pos = notebox.size; |
- | |
196 | notebox.top = notes.cur_y*notes.item_h+4+notes.y; |
- | |
197 | edit_box_draw stdcall(#notebox); |
- | |
198 | } |
- | |
199 | 183 | ||
200 | //===================================================// |
184 | //===================================================// |
201 | // // |
185 | // // |
202 | // EVENTS // |
186 | // EVENTS // |
203 | // // |
187 | // // |
Line 207... | Line 191... | ||
207 | { |
191 | { |
208 | if (line_n<0) || (line_n>=notes.count) return; |
192 | if (line_n<0) || (line_n>=notes.count) return; |
209 | notes.cur_y = line_n; |
193 | notes.cur_y = line_n; |
210 | notebox.text = notes.DrawLine(notes.cur_y, notes.item_h); |
194 | notebox.text = notes.DrawLine(notes.cur_y, notes.item_h); |
211 | EventListRedraw(); |
195 | EventListRedraw(); |
- | 196 | ||
- | 197 | notebox.size = strlen(notebox.text); |
|
- | 198 | notebox.offset = notebox.shift = notebox.shift_old = 0; |
|
- | 199 | notebox.cl_curs_x = notebox.cl_curs_y = 0; |
|
- | 200 | if (notebox.pos > notebox.size) notebox.pos = notebox.size; |
|
- | 201 | notebox.top = notes.cur_y*notes.item_h+4+notes.y; |
|
212 | DrawEditBoxN(); |
202 | edit_box_draw stdcall(#notebox); |
213 | } |
203 | } |
Line 214... | Line 204... | ||
214 | 204 | ||
215 | void EventExitApp() |
205 | void EventExitApp() |
216 | { |
206 | { |
Line 220... | Line 210... | ||
220 | } |
210 | } |
Line 221... | Line 211... | ||
221 | 211 | ||
222 | void EventDrawDeleteButton() |
212 | void EventDrawDeleteButton() |
223 | { |
213 | { |
224 | notes.DrawLine(notes.cur_y, notes.item_h); |
214 | notes.DrawLine(notes.cur_y, notes.item_h); |
225 | delBtn.set_size(WIN_W-DELETE_W-1, notes.cur_y*notes.item_h+notes.y, DELETE_W, notes.item_h-1); |
215 | delBtn.y = notes.cur_y*notes.item_h+notes.y; |
226 | DefineButton(delBtn.x, delBtn.y, delBtn.w, delBtn.h, DELETE_BTN, 0xFF0000); |
216 | DefineButton(delBtn.x, delBtn.y, delBtn.w, delBtn.h, DELETE_BTN, 0xFF0000); |
227 | WriteText(delBtn.x+10, delBtn.h/2-3 + delBtn.y, 0x80, 0xFFFfff, DELETE_TEXT); |
217 | WriteText(delBtn.x+10, delBtn.h/2-3 + delBtn.y, 0x80, 0xFFFfff, DELETE_TEXT); |
228 | notebox.top=-20; |
218 | notebox.top=-20; |
229 | delete_active = true; |
219 | delete_active = true; |