Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

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