Rev 5674 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5614 | punk_joker | 1 | #ifndef AUTOBUILD |
2 | #include "lang.h--" |
||
3 | #endif |
||
4 | |||
5612 | punk_joker | 5 | #define MEMSIZE 0x100000 |
6 | #include "..\lib\kolibri.h" |
||
7 | #include "..\lib\strings.h" |
||
8 | #include "..\lib\mem.h" |
||
9 | #include "..\lib\file_system.h" |
||
10 | #include "..\lib\dll.h" |
||
11 | #include "..\lib\gui.h" |
||
5615 | leency | 12 | #include "..\lib\list_box.h" |
13 | |||
5612 | punk_joker | 14 | #include "..\lib\obj\box_lib.h" |
15 | #include "..\lib\obj\proc_lib.h" |
||
16 | #include "..\lib\obj\libio_lib.h" |
||
17 | |||
18 | #ifdef LANG_RUS |
||
19 | ?define T_FILE "Файл" |
||
20 | ?define T_TYPE "Тип" |
||
21 | ?define T_SIZE "Размер" |
||
22 | ?define MENU1 "Файл" |
||
23 | ?define MENU1_SUBMENU1 "Открыть" |
||
24 | ?define MENU1_SUBMENU2 "Закрыть" |
||
25 | ?define MENU1_SUBMENU3 "Свойства" |
||
26 | ?define MENU1_SUBMENU4 "Выход" |
||
27 | #else |
||
28 | ?define T_FILE "File" |
||
29 | ?define T_TYPE "Type" |
||
30 | ?define T_SIZE "Size" |
||
31 | ?define MENU1 "File" |
||
32 | ?define MENU1_SUBMENU1 "Open" |
||
33 | ?define MENU1_SUBMENU2 "Close" |
||
34 | ?define MENU1_SUBMENU3 "Properties" |
||
35 | ?define MENU1_SUBMENU4 "Exit" |
||
36 | #endif |
||
37 | |||
38 | #ifdef LANG_RUS |
||
39 | struct menu_text_struct |
||
40 | { |
||
41 | char menu[5]; |
||
42 | char sub_menu1[8]; |
||
43 | char sub_menu2[8]; |
||
44 | //char sub_menu3[9]; |
||
45 | char sub_menu4[6]; |
||
46 | byte end; |
||
47 | }; |
||
48 | #else |
||
49 | struct menu_text_struct |
||
50 | { |
||
51 | char menu[5]; |
||
52 | char sub_menu1[5]; |
||
53 | char sub_menu2[6]; |
||
54 | //char sub_menu3[11]; |
||
55 | char sub_menu4[5]; |
||
56 | byte end; |
||
57 | }; |
||
58 | #endif |
||
59 | |||
60 | #define TOPPANELH 19 |
||
61 | #define BOTPANELH 10 |
||
62 | #define WIN_W 600 |
||
63 | #define WIN_H 400 |
||
64 | |||
5705 | punk_joker | 65 | #define TITLE "Calypte v0.13" |
5615 | leency | 66 | char win_title[4096] = TITLE; |
5612 | punk_joker | 67 | proc_info Form; |
5674 | pavelyakov | 68 | |
5615 | leency | 69 | dword old_width,old_height; |
70 | llist tview; |
||
5612 | punk_joker | 71 | |
72 | byte active_properties = 0; |
||
73 | dword properties_window; |
||
74 | |||
75 | #include "include\gui.h" |
||
76 | #include "include\properties.h" |
||
5615 | leency | 77 | // #include "include\top_menu.h" |
78 | // #include "include\open_dial.h" |
||
5612 | punk_joker | 79 | |
80 | struct filter |
||
81 | { |
||
82 | dword size; |
||
83 | char ext1[4]; |
||
84 | //char ext2[4]; |
||
85 | //char ext3[4]; |
||
86 | //char ext4[4]; |
||
87 | byte end; |
||
88 | }; |
||
89 | |||
90 | filter filter2; |
||
91 | menu_text_struct menu_text_area1; |
||
92 | |||
5615 | leency | 93 | int read=0; |
5612 | punk_joker | 94 | |
95 | |||
96 | proc_info pr_inf; |
||
97 | char communication_area_name[] = "FFFFFFFF_open_dialog"; |
||
98 | byte plugin_path[4096]; |
||
99 | char default_dir[] = "/rd/1"; |
||
100 | char open_dialog_path[] = "/rd/1/File managers/opendial"; //opendial |
||
101 | byte openfile_path[2048]; |
||
102 | byte filename_area[4096]; |
||
103 | |||
104 | opendialog o_dialog = {0, #pr_inf, #communication_area_name, 0, #plugin_path, #default_dir, #open_dialog_path, #draw_window, 0, #openfile_path, #filename_area, #filter2, 420, 200, 320, 120}; |
||
105 | |||
106 | dword bufpointer; |
||
107 | dword bufsize; |
||
108 | dword draw_sruct; |
||
109 | |||
110 | menu_data menudata1 = {0, 40, 2, 15, 2, #menu_text_area1.menu, #menu_text_area1.sub_menu1, #menu_text_area1.end, 0, 0, 80, 2, 100, 18, 0xEEEEEE, 0xFF, 0xEEEEEE, 0, 0, 0, #Form, 0, 0, 0, 16, 0, 0, 0x00CC00, 0, 0xFFFFFF, 0, 8, 0, 0}; |
||
111 | |||
112 | void main() |
||
113 | { |
||
5705 | punk_joker | 114 | int id; |
115 | word key_ascii, key_scancode; |
||
116 | dword status_key; |
||
5612 | punk_joker | 117 | |
118 | strcpy(#filter2.ext1, "TXT"); |
||
119 | //strcpy(#filter2.ext2, "ASM"); |
||
120 | //strcpy(#filter2.ext3, "INC\0"); |
||
121 | //strcpy(#filter2.ext4, "\0"); |
||
122 | filter2.size = 8; |
||
123 | filter2.end = 0; |
||
124 | |||
125 | strcpy(#menu_text_area1.menu, MENU1); |
||
126 | strcpy(#menu_text_area1.sub_menu1, MENU1_SUBMENU1); |
||
127 | strcpy(#menu_text_area1.sub_menu2, MENU1_SUBMENU2); |
||
128 | //strcpy(#menu_text_area1.sub_menu3, MENU1_SUBMENU3); |
||
129 | strcpy(#menu_text_area1.sub_menu4, MENU1_SUBMENU4); |
||
130 | menu_text_area1.end = 0; |
||
131 | |||
5626 | leency | 132 | load_dll(boxlib, #box_lib_init,0); |
133 | load_dll(libio, #libio_init,1); |
||
134 | load_dll(Proc_lib, #OpenDialog_init,0); |
||
5612 | punk_joker | 135 | OpenDialog_init stdcall (#o_dialog); |
136 | SetEventMask(0x27); |
||
137 | loop() |
||
138 | { |
||
139 | switch(WaitEvent()) |
||
140 | { |
||
141 | case evMouse: |
||
5640 | pavelyakov | 142 | mouse.get(); |
143 | if (tview.MouseScrollNoSelection(mouse.vert)) DrawText(); |
||
5615 | leency | 144 | |
145 | menu_bar_mouse stdcall (#menudata1); |
||
146 | if (menudata1.click) |
||
5612 | punk_joker | 147 | { |
148 | switch(menudata1.cursor_out) |
||
149 | { |
||
150 | case 1: |
||
151 | OpenDialog_start stdcall (#o_dialog); |
||
152 | OpenFile(#openfile_path); |
||
153 | Prepare(); |
||
154 | draw_window(); |
||
155 | break; |
||
156 | case 2: |
||
157 | read = 0; |
||
5705 | punk_joker | 158 | tview.current = 0; |
5612 | punk_joker | 159 | strcpy(#win_title, TITLE); |
160 | FreeBuf(); |
||
161 | draw_window(); |
||
162 | break; |
||
163 | case 3: |
||
164 | if (!active_properties) |
||
165 | { |
||
166 | SwitchToAnotherThread(); |
||
167 | properties_window = CreateThread(#properties_dialog, #properties_stak+4092); |
||
168 | break; |
||
169 | } |
||
170 | else |
||
171 | { |
||
172 | ActivateWindow(GetProcessSlot(properties_window)); |
||
173 | } |
||
174 | break; |
||
175 | case 4: |
||
176 | ExitProcess(); |
||
177 | } |
||
178 | } |
||
179 | break; |
||
180 | |||
181 | case evButton: |
||
182 | id=GetButtonID(); |
||
5615 | leency | 183 | if (id==1) ExitProcess(); |
5612 | punk_joker | 184 | break; |
185 | |||
186 | case evKey: |
||
5615 | leency | 187 | if (Form.status_window>2) break; |
5705 | punk_joker | 188 | GetFullKey(); |
189 | key_ascii = AH; |
||
190 | $shr eax,16 |
||
191 | key_scancode = AL; |
||
192 | status_key = GetStatusKey(); |
||
193 | if (tview.ProcessKey(key_scancode)) DrawText(); |
||
194 | if (TestBit(status_key, 2)) |
||
5612 | punk_joker | 195 | { |
5705 | punk_joker | 196 | switch(key_scancode) |
197 | { |
||
198 | case 024: //Ctrl+O |
||
199 | OpenDialog_start stdcall (#o_dialog); |
||
200 | OpenFile(#openfile_path); |
||
201 | Prepare(); |
||
202 | draw_window(); |
||
203 | break; |
||
204 | } |
||
205 | break; |
||
206 | } |
||
207 | switch (key_scancode) |
||
208 | { |
||
209 | /*case SCAN_CODE_HOME: |
||
210 | case SCAN_CODE_END: |
||
211 | case SCAN_CODE_UP: |
||
212 | case SCAN_CODE_DOWN: |
||
213 | if (tview.ProcessKey(key_scancode)) DrawText(); |
||
214 | break;*/ |
||
215 | case SCAN_CODE_PGUP: |
||
5615 | leency | 216 | if (!tview.current) break; |
217 | if (tview.current |
||
218 | else tview.current = tview.current-tview.visible; |
||
5612 | punk_joker | 219 | DrawText(); |
220 | break; |
||
5705 | punk_joker | 221 | case SCAN_CODE_PGDN: |
5615 | leency | 222 | if (tview.current+tview.visible>tview.count) break; |
223 | tview.current = tview.current+tview.visible; |
||
5612 | punk_joker | 224 | DrawText(); |
225 | break; |
||
226 | } |
||
227 | break; |
||
228 | |||
229 | case evReDraw: |
||
230 | draw_window(); |
||
231 | break; |
||
232 | } |
||
233 | } |
||
234 | } |
||
235 | |||
236 | |||
237 | void draw_window() |
||
238 | { |
||
5674 | pavelyakov | 239 | system.color.get(); |
5612 | punk_joker | 240 | DefineAndDrawWindow(GetScreenWidth()-WIN_W/2,GetScreenHeight()-WIN_H/2,WIN_W,WIN_H,0x73,0xFFFFFF,#win_title); |
241 | GetProcessInfo(#Form, SelfInfo); |
||
5615 | leency | 242 | if (Form.status_window>2) return; |
243 | tview.SetSizes(0, TOPPANELH, Form.cwidth, Form.cheight-BOTPANELH-TOPPANELH, 200, 12); |
||
5674 | pavelyakov | 244 | DrawBar(0, 0, Form.cwidth, TOPPANELH, system.color.work); |
245 | DrawBar(0, Form.cheight-BOTPANELH, Form.cwidth, BOTPANELH, system.color.work); |
||
5612 | punk_joker | 246 | |