Rev 1417 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1219 | mario79 | 1 | ;***************************************************************************** |
2 | ; Macro for use Open Dialog - for Kolibri OS |
||
3 | ; Copyright (c) 2009, Marat Zakiyanov aka Mario79, aka Mario |
||
4 | ; All rights reserved. |
||
5 | ; |
||
6 | ; Redistribution and use in source and binary forms, with or without |
||
7 | ; modification, are permitted provided that the following conditions are met: |
||
8 | ; * Redistributions of source code must retain the above copyright |
||
9 | ; notice, this list of conditions and the following disclaimer. |
||
10 | ; * Redistributions in binary form must reproduce the above copyright |
||
11 | ; notice, this list of conditions and the following disclaimer in the |
||
12 | ; documentation and/or other materials provided with the distribution. |
||
13 | ; * Neither the name of the |
||
14 | ; names of its contributors may be used to endorse or promote products |
||
15 | ; derived from this software without specific prior written permission. |
||
16 | ; |
||
17 | ; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY |
||
18 | ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
19 | ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
20 | ; DISCLAIMED. IN NO EVENT SHALL |
||
21 | ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
22 | ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
23 | ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
24 | ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
25 | ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
26 | ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
27 | ;***************************************************************************** |
||
28 | ;***************************************************************************** |
||
29 | macro OpenDialog_exit |
||
30 | { |
||
31 | popa |
||
32 | ret |
||
33 | } |
||
34 | ;***************************************************************************** |
||
35 | macro use_OpenDialog |
||
36 | { |
||
37 | OpenDialog: |
||
38 | od_type equ dword [ebp] |
||
39 | od_procinfo equ dword [ebp+4] |
||
40 | od_com_area_name equ dword [ebp+8] |
||
41 | od_com_area equ dword [ebp+12] |
||
42 | od_opendir_pach equ dword [ebp+16] |
||
43 | od_dir_default_pach equ dword [ebp+20] |
||
44 | od_start_path equ dword [ebp+24] |
||
45 | od_draw_window equ dword [ebp+28] |
||
46 | od_status equ dword [ebp+32] |
||
47 | od_openfile_pach equ dword [ebp+36] |
||
48 | ;***************************************************************************** |
||
49 | .init: |
||
50 | pusha |
||
51 | mcall 9, od_procinfo, -1 |
||
52 | mov ebx,[ebx+30] |
||
53 | mov edi,od_com_area_name |
||
54 | add edi,7 |
||
55 | ; mov edi,communication_area_name+7 |
||
56 | std |
||
57 | mov ecx,4 |
||
58 | @@: |
||
59 | mov al,bl |
||
60 | and al,1111b |
||
61 | add al,0x30 |
||
62 | stosb |
||
63 | mov al,bl |
||
64 | shr al,4 |
||
65 | and al,1111b |
||
66 | add al,0x30 |
||
67 | stosb |
||
68 | shr ebx,8 |
||
69 | dec ecx |
||
70 | jnz @r |
||
71 | cld |
||
72 | |||
73 | mcall 68,22,od_com_area_name,8192,0x09 |
||
74 | mov od_com_area,eax |
||
75 | OpenDialog_exit |
||
76 | ;***************************************************************************** |
||
77 | ;***************************************************************************** |
||
78 | .start: |
||
79 | pusha |
||
80 | mov eax,od_com_area |
||
81 | test eax,eax |
||
82 | jz .1 |
||
83 | mov [eax],dword 2 ; folder for open |
||
84 | mov edi,eax |
||
85 | add edi,4 |
||
86 | |||
87 | mov esi,od_opendir_pach |
||
88 | xor eax,eax |
||
89 | mov al,[esi] |
||
90 | test eax,eax |
||
91 | jnz @f |
||
92 | mov esi,od_dir_default_pach ;communication_area_default_pach |
||
93 | @@: |
||
94 | call .copy |
||
95 | |||
96 | mov eax,od_com_area_name |
||
97 | mov [start_open_dialog.parameter],eax |
||
98 | |||
99 | mov eax,od_start_path |
||
100 | mov [start_open_dialog.name],eax |
||
101 | |||
102 | mcall 70, start_open_dialog |
||
103 | shr eax,31 |
||
104 | test eax,eax |
||
105 | jnz .1 |
||
106 | jmp .still |
||
107 | .red: |
||
108 | pusha |
||
109 | call od_draw_window |
||
110 | popa |
||
111 | .still: |
||
112 | mcall 23, 50 |
||
113 | cmp eax,1 |
||
114 | je .red |
||
115 | mov eax,od_com_area |
||
116 | mov ebx,[eax] |
||
117 | test ebx,ebx |
||
118 | jz .still |
||
119 | cmp ebx,3 |
||
120 | je .2 ;still |
||
121 | cmp ebx,1 |
||
122 | jne .still |
||
123 | |||
124 | mov esi,od_com_area |
||
125 | add esi,4 |
||
126 | mov edi,od_openfile_pach ;string |
||
127 | call .copy |
||
128 | mov od_status,1 |
||
129 | jmp .3 ;kopen_1 |
||
130 | .2: |
||
131 | mov od_status,0 |
||
132 | jmp .3 ; still |
||
133 | .1: |
||
134 | mov od_status,2 ; thread1 |
||
135 | .3: |
||
136 | OpenDialog_exit |
||
137 | ;---------------------------------------------- |
||
138 | .copy: |
||
139 | xor eax,eax |
||
140 | cld |
||
141 | @@: |
||
142 | lodsb |
||
143 | stosb |
||
144 | test eax,eax |
||
145 | jnz @b |
||
146 | ret |
||
147 | ;---------------------------------------------- |
||
148 | align 4 |
||
149 | start_open_dialog: |
||
150 | .subfunction dd 7 |
||
151 | .flags dd 0 |
||
152 | .parameter dd 0 ;od_com_area_name |
||
153 | .reserved1 dd 0 |
||
154 | .reserved2 dd 0 |
||
155 | db 0 |
||
156 | .name: dd 0 ;od_start_path |
||
157 | } |
||
158 | ;***************************************************************************** |
||
159 | macro init_OpenDialog od_ptr |
||
160 | { |
||
161 | mov ebp,od_ptr |
||
162 | call OpenDialog.init |
||
163 | } |
||
164 | ;***************************************************************************** |
||
165 | macro start_OpenDialog od_ptr |
||
166 | { |
||
167 | mov ebp,od_ptr |
||
168 | call OpenDialog.start |
||
169 | } |
||
170 | ;***************************************************************************** |