Rev 7757 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7757 | Rev 7759 | ||
---|---|---|---|
Line 17... | Line 17... | ||
17 | #include "..\lib\obj\proc_lib.h" |
17 | #include "..\lib\obj\proc_lib.h" |
18 | 18 | ||
Line 19... | Line 19... | ||
19 | //useful patterns |
19 | //useful patterns |
20 | #include "..\lib\patterns\simple_open_dialog.h" |
20 | #include "..\lib\patterns\simple_open_dialog.h" |
- | 21 | #include "..\lib\patterns\toolbar_button.h" |
|
Line 21... | Line 22... | ||
21 | 22 | ||
22 | char homepage[] = FROM "html\\homepage.htm""\0"; |
23 | char homepage[] = FROM "html\\homepage.htm""\0"; |
Line 23... | Line 24... | ||
23 | char page_not_found[] = FROM "html\\page_not_found_en.htm""\0"; |
24 | char page_not_found[] = FROM "html\\page_not_found_en.htm""\0"; |
24 | 25 | ||
Line 25... | Line 26... | ||
25 | char version[]="C-- Code View"; |
26 | char version[]="C-- Code View"; |
Line -... | Line 27... | ||
- | 27 | char accept_language[]= "Accept-Language: en\n"; |
|
- | 28 | ||
26 | char accept_language[]= "Accept-Language: en\n"; |
29 | #define URL_SERVICE_HOME "CodeView:home" |
Line 27... | Line 30... | ||
27 | 30 | ||
28 | #define URL_SERVICE_HOME "CodeView:home" |
31 | |
Line 29... | Line -... | ||
29 | - | ||
30 | proc_info Form; |
- | |
31 | - | ||
32 | - | ||
33 | dword TOOLBAR_H = 40; |
32 | |
Line 34... | Line 33... | ||
34 | dword STATUSBAR_H = 0; |
33 | proc_info Form; |
Line 35... | Line 34... | ||
35 | 34 | ||
36 | 35 | ||
37 | dword col_bg = 0xE3E2E2; |
36 | dword TOOLBAR_H = 40; |
- | 37 | dword STATUSBAR_H = 0; |
|
38 | dword panel_color = 0xE3E2E2; |
38 | |
Line 39... | Line 39... | ||
39 | dword border_color = 0x8C8C8C; |
39 | |
40 | 40 | bool debug_mode = false; |
|
- | 41 | ||
41 | bool debug_mode = false; |
42 | bool open_in_a_new_window = false; |
Line 42... | Line 43... | ||
42 | 43 | ||
43 | bool open_in_a_new_window = false; |
44 | enum { |
Line 72... | Line 73... | ||
72 | } |
73 | } |
73 | 74 | ||
Line 74... | Line 75... | ||
74 | void main() |
75 | void main() |
75 | { |
76 | { |
76 | int i; |
77 | int i, id; |
77 | LoadLibraries(); |
78 | LoadLibraries(); |
78 | if (param) strcpy(#current_path, #param); else strcpy(#current_path, URL_SERVICE_HOME); |
79 | if (param) strcpy(#current_path, #param); else strcpy(#current_path, URL_SERVICE_HOME); |
79 | WB1.list.SetFont(8, 14, 10011000b); |
80 | WB1.list.SetFont(8, 14, 10011000b); |
80 | WB1.list.no_selection = true; |
81 | WB1.list.no_selection = true; |
81 | SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); |
82 | SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); |
Line 94... | Line 95... | ||
94 | } |
95 | } |
95 | break; |
96 | break; |
96 | 97 | ||
Line 97... | Line 98... | ||
97 | case evButton: |
98 | case evButton: |
- | 99 | id = GetButtonID(); |
|
98 | if (GetButtonID()==1) ExitProcess(); |
100 | if (1==id) ExitProcess(); |
- | 101 | if (OPEN_PAGE==id) EventOpenDialog(); |
|
99 | break; |
102 | break; |
Line 100... | Line 103... | ||
100 | 103 | ||
101 | case evKey: |
104 | case evKey: |
Line 131... | Line 134... | ||
131 | } |
134 | } |
132 | break; |
135 | break; |
133 | 136 | ||
Line 134... | Line 137... | ||
134 | case evReDraw: |
137 | case evReDraw: |
135 | DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),GetScreenHeight()-600/2-random(80),800,600,0x73,col_bg,0,0); |
138 | DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),GetScreenHeight()-600/2-random(80),800,600,0x73,system.color.work,0,0); |
136 | GetProcessInfo(#Form, SelfInfo); |
139 | GetProcessInfo(#Form, SelfInfo); |
- | 140 | system.color.get(); |
|
137 | if (Form.status_window>2) { DrawTitle(#header); break; } |
141 | if (Form.status_window>2) break; |
138 | if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; } |
142 | if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; } |
139 | if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; } |
143 | if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; } |
140 | SetElementSizes(); |
144 | SetElementSizes(); |
141 | draw_window(); |
145 | draw_window(); |
142 | break; |
146 | break; |
Line 145... | Line 149... | ||
145 | 149 | ||
Line 146... | Line 150... | ||
146 | void SetElementSizes() |
150 | void SetElementSizes() |
147 | { |
151 | { |
148 | address_box.top = TOOLBAR_H/2-10; |
152 | address_box.top = TOOLBAR_H/2-10; |
149 | basic_line_h = calc(WB1.list.font_h * 130) / 100; |
- | |
150 | address_box.left = address_box.top; |
153 | address_box.left = address_box.top+43; |
151 | address_box.width = Form.cwidth - address_box.left - address_box.left -14; |
154 | address_box.width = Form.cwidth - address_box.left - address_box.left -14; |
152 | WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x, |
155 | WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x, |
153 | Form.cheight - TOOLBAR_H - STATUSBAR_H, basic_line_h); |
156 | Form.cheight - TOOLBAR_H - STATUSBAR_H, BASIC_LINE_H); |
154 | WB1.list.wheel_size = 7 * basic_line_h; |
157 | WB1.list.wheel_size = 7 * BASIC_LINE_H; |
155 | WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w; |
158 | WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w; |
156 | WB1.list.visible = WB1.list.h; |
159 | WB1.list.visible = WB1.list.h; |
157 | if (WB1.list.w!=WB1.DrawBuf.bufw) { |
160 | if (WB1.list.w!=WB1.DrawBuf.bufw) { |
158 | WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 32700); |
161 | WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, 32700); |
159 | OpenPage(#current_path); |
162 | OpenPage(#current_path); |
160 | } |
163 | } |
161 | } |
164 | } |
Line 162... | Line 165... | ||
162 | 165 | ||
163 | void draw_window() |
166 | void draw_window() |
164 | { |
167 | { |
165 | DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, panel_color); |
168 | DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, system.color.work); |
166 | DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3); |
169 | DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3); |
167 | DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color); |
170 | DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, system.color.work_graph); |
168 | DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+4, 25,border_color); |
171 | DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+4, 25,system.color.work_graph); |
169 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg); |
172 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, system.color.work); |
170 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color); |
173 | DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, system.color.work_graph); |
171 | DrawEditBoxWebView(); |
174 | DrawEditBoxWebView(); |
172 | if (!header) { |
175 | if (!WB1.header) { |
173 | OpenPage(#current_path); |
176 | OpenPage(#current_path); |
174 | } else { |
177 | } else { |
175 | WB1.DrawPage(); |
178 | WB1.DrawPage(); |
176 | DrawEditBoxWebView(); |
179 | DrawEditBoxWebView(); |
177 | } |
180 | } |
- | 181 | DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col); |
|
178 | DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col); |
182 | DrawTopPanelButton(OPEN_PAGE, 10, address_box.top-3, 0); |
Line 179... | Line 183... | ||
179 | } |
183 | } |
180 | 184 | ||
Line 213... | Line 217... | ||
213 | } |
217 | } |
214 | 218 | ||
Line 215... | Line 219... | ||
215 | void LoadInternalPage(dword _bufpos, _bufsize) |
219 | void LoadInternalPage(dword _bufpos, _bufsize) |
216 | { |
220 | { |
217 | if (bufpointer) free(bufpointer); |
- | |
218 | - | ||
219 | if (!_bufpos) || (!_bufsize) { |
221 | if (!_bufpos) || (!_bufsize) { |
220 | LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
222 | LoadInternalPage(#page_not_found, sizeof(page_not_found)); |
221 | return; |
223 | return; |
222 | } |
224 | } |
223 | strcpy(#edit_path, #current_path); |
225 | strcpy(#edit_path, #current_path); |
224 | DrawEditBoxWebView(); |
226 | DrawEditBoxWebView(); |
Line 225... | Line -... | ||
225 | - | ||
226 | bufpointer = _bufpos; |
- | |
227 | bufsize = _bufsize; |
- | |
228 | bufpointer = malloc(bufsize); |
- | |
229 | strcpy(bufpointer, _bufpos); |
- | |
230 | 227 | ||
231 | WB1.list.first = 0; |
228 | WB1.list.first = 0; |
232 | WB1.ParseHtml(); |
229 | WB1.ParseHtml(_bufpos, _bufsize); |
233 | WB1.DrawPage(); |
230 | WB1.DrawPage(); |
Line 234... | Line 231... | ||
234 | } |
231 | } |
235 | 232 |