Subversion Repositories Kolibri OS

Rev

Rev 1815 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1815 yogev_ezra 1
;
2
;   PANEL SETUP
3
;
4
;   Compile with FASM for Menuet
5
;
6
 
7
use32
8
 
9
               org    0x0
10
 
11
               db     'MENUET01'              ; 8 byte id
12
               dd     0x01                    ; header version
13
               dd     START                   ; start of code
14
               dd     I_END                   ; size of image
15
               dd     0x8000                  ; memory for app
16
               dd     0x8000                  ; esp
17
               dd     0x0 , 0x0               ; I_Param , I_Icon
18
 
1829 clevermous 19
include '../../../macros.inc'
1815 yogev_ezra 20
 
21
START:                          ; start of execution
22
 
23
     call draw_window
24
 
25
still:
26
 
27
    mov  eax,10                 ; wait here for event
28
    int  0x40
29
 
30
    cmp  eax,1                  ; redraw request ?
31
    je   red
32
    cmp  eax,2                  ; key in buffer ?
33
    je   key
34
    cmp  eax,3                  ; button in buffer ?
35
    je   button
36
 
37
    jmp  still
38
 
39
  red:                          ; redraw
40
    call draw_window
41
    jmp  still
42
 
43
  key:                          ; key
44
    mov  eax,2                  ; just read it and ignore
45
    int  0x40
46
 
47
    shr  eax,8
48
    cmp  eax,'0'
49
    jb   still
50
    cmp  eax,'9'
51
    jg   still
52
 
53
    mov  edi,[ent]
54
    add  edi,text
55
    mov  esi,edi
56
    inc  esi
57
    mov  ecx,3
58
    cld
59
    rep  movsb
60
 
61
    mov  [edi],al
62
 
63
    call draw_window
64
    jmp  still
65
 
66
  button:                       ; button
67
    mov  eax,17                 ; get id
68
    int  0x40
69
 
70
    cmp  ah,1                   ; button id=1 ?
71
    jne  noclose
72
    mov  eax,-1                 ; close this program
73
    int  0x40
74
  noclose:
75
 
76
    cmp  ah,10
77
    jne  no_apply
78
 
79
    mov  esi,text+17
80
    mov  edi,I_END+10
81
    mov  ecx,12
82
   newfe:
83
    mov  ebx,[esi]
84
    mov  [edi],ebx
85
    mov  [edi+4],byte ';'
86
    add  edi,5
87
    add  esi,55
88
    loop newfe
89
    mov  [edi],byte 'x'
90
 
91
    mov  eax,70
92
    mov  ebx,dat_write
93
    int  0x40
94
 
95
 
96
    mov  esi,1
97
   newread:
98
    inc  esi
99
    mov  eax,9
100
    mov  ebx,I_END
101
    mov  ecx,esi
102
    int  0x40
103
    cmp  esi,eax
104
    jg   all_terminated
105
 
106
    mov  eax,[ebx+10]
107
    and  eax,not 0x20202000
108
    cmp  eax,'@PAN'
109
    jne  newread
110
    mov  eax,[ebx+14]
111
    and  eax,not 0x2020
112
    cmp  eax,'EL  '
113
    jne  newread
114
 
115
    mov  eax,18
116
    mov  ebx,2
117
    mov  ecx,esi
118
    int  0x40
119
 
120
    mov  eax,5
121
    mov  ebx,5
122
    int  0x40
123
 
124
    mov  esi,1
125
 
126
    jmp  newread
127
 
128
   all_terminated:
129
 
130
    mov  eax,5
131
    mov  ebx,25
132
    int  0x40
133
 
134
        mov     eax, 70
135
        mov     ebx, panel_start
136
        int     0x40
137
 
138
  no_apply:
139
 
140
    cmp  ah,11
141
    jb   no_entry
142
    shr  eax,8
143
    sub  eax,11
144
    imul eax,55
145
    add  eax,17
146
    mov  [ent],eax
147
    mov  [text+eax],dword '0000'
148
    call draw_window
149
    jmp  still
150
  no_entry:
151
 
152
 
153
    jmp  still
154
 
155
 
156
ent       dd  17
157
 
158
panel_start:
159
        dd      7
160
        dd      0
161
        dd      0
162
        dd      0
163
        dd      0
164
        db      '/RD/1/@PANEL',0
165
 
166
dat_write:
167
        dd      2
168
        dq      0
169
        dd      5*12+1
170
        dd      I_END+10
171
        db      'PANEL.DAT',0
172
 
173
;   *********************************************
174
;   *******  WINDOW DEFINITIONS AND DRAW ********
175
;   *********************************************
176
 
177
 
178
draw_window:
179
 
180
 
181
    mov  eax,12                    ; function 12:tell os about windowdraw
182
    mov  ebx,1                     ; 1, start of draw
183
    int  0x40
184
 
185
                                   ; DRAW WINDOW
186
    mov  eax,0                     ; function 0 : define and draw window
187
    mov  ebx,100*65536+385         ; [x start] *65536 + [x size]
188
    mov  ecx,100*65536+190         ; [y start] *65536 + [y size]
189
    mov  edx,0x03ffffff            ; color of work area RRGGBB,8->color gl
190
    mov  esi,0x805080d0            ; color of grab bar  RRGGBB,8->color gl
191
    mov  edi,0x005080d0            ; color of frames    RRGGBB
192
    int  0x40
193
 
194
                                   ; WINDOW LABEL
195
    mov  eax,4                     ; function 4 : write text to window
196
    mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
197
    mov  ecx,0x10ddeeff            ; color of text RRGGBB
198
    mov  edx,labelt                ; pointer to text beginning
199
    mov  esi,labellen-labelt       ; text length
200
    int  0x40
201
 
202
    mov  eax,8
203
    mov  ebx,25*65536+335 ;160
204
    mov  ecx,162*65536+12
205
    mov  edx,10
206
    mov  esi,0x80a0c0 ;0x6677cc
207
    int  0x40
208
 
209
    mov  eax,8
210
    mov  ebx,340*65536+20
211
    mov  ecx,34*65536+10
212
    mov  edx,11
213
  newb:
214
    int  0x40
215
    add  ecx,10*65536
216
    inc  edx
217
    cmp  edx,23
218
    jb   newb
219
 
220
    mov  ebx,25*65536+35           ; draw info text with function 4
221
    mov  ecx,0x224466
222
    mov  edx,text
223
    mov  esi,55
224
  newline:
225
    mov  eax,4
226
    int  0x40
227
    add  ebx,10
228
    add  edx,55
229
    cmp  [edx],byte 'x'
230
    jne  newline
231
 
232
    mov  eax,12                    ; function 12:tell os about windowdraw
233
    mov  ebx,2                     ; 2, end of draw
234
    int  0x40
235
 
236
    ret
237
 
238
 
239
; DATA AREA
240
 
241
 
242
text:
243
 
244
db  'width            0000  :  0 for full screen width     <'
245
db  'buttons          0000  :  0 no frames  , 1 frames     <'
246
db  'soften_up        0001  :  0 no         , 1 yes        <'
247
db  'soften_down      0001  :  0 no         , 1 yes        <'
248
db  'minimize_left    0001  :  0 no         , 1 yes        <'
249
db  'minimize_right   0001  :  0 no         , 1 yes        <'
250
db  'icons_position   0100  :  position in pixels          <'
251
db  'menu_enable      0001  :  0 no         , 1 yes        <'
252
db  'setup_enable     0001  :  0 no         , 1 yes        <'
253
db  'graph_text       0001  :  0 graphics   , 1 text       <'
254
db  'soften_middle    0001  :  0 no         , 1 yes        <'
255
db  'icons            0001  :  0 start      , 1 activate   <'
256
db  '                                                       '
257
db  '                         APPLY                         '
258
db  'x'
259
 
260
 
261
labelt:
262
     db   'PANEL SETUP'
263
labellen:
264
 
265
I_END: