Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
31 halyavin 1
;
51 mikedld 2
;    UNIFORM WINDOW COLOURS & SKIN
31 halyavin 3
;
4
;    Compile with FASM for Menuet
5
;
6
;    < russian edition by Ivan Poddubny >
51 mikedld 7
;    < skin selection by Mike Semenyako >
31 halyavin 8
;
1611 mario79 9
; last update:  10/09/2010
10
; written by:   Marat Zakiyanov aka Mario79, aka Mario
11
; changes:      select path with OpenDialog
31 halyavin 12
;******************************************************************************
13
   use32
14
   org     0
15
   db      'MENUET01'  ; identifier
16
   dd      1           ; header version
17
   dd      START       ; start address
18
   dd      I_END       ; file size
1611 mario79 19
   dd      i_end ;28000h      ; memory
20
   dd      stacktop    ; stack pointer
21
   dd      skin_info       ; parameters
22
   dd      cur_dir_path ; path to file
23
 
24
include 'lang.inc'
25
include '../../../macros.inc'
26
include 'kglobals.inc'
27
include 'unpacker.inc'
28
include '../../../develop/libraries/box_lib/load_lib.mac'
29
	@use_library
31 halyavin 30
;******************************************************************************
31
 
32
 
51 mikedld 33
struct SKIN_HEADER
485 heavyiron 34
  ident   dd ?
35
  version dd ?
36
  params  dd ?
37
  buttons dd ?
38
  bitmaps dd ?
51 mikedld 39
ends
31 halyavin 40
 
51 mikedld 41
struct SKIN_PARAMS
485 heavyiron 42
  skin_height    dd ?
43
  margin.right   dw ?
44
  margin.left    dw ?
45
  margin.bottom  dw ?
46
  margin.top     dw ?
47
  colors.inner   dd ?
48
  colors.outer   dd ?
49
  colors.frame   dd ?
50
  colors_1.inner dd ?
51
  colors_1.outer dd ?
52
  colors_1.frame dd ?
53
  dtp.size       dd ?
54
  dtp.data       db 40 dup (?)
51 mikedld 55
ends
56
 
57
struct SKIN_BUTTONS
485 heavyiron 58
  type     dd ?
59
  pos:
60
    left   dw ?
61
    top    dw ?
62
  size:
63
    width  dw ?
64
    height dw ?
51 mikedld 65
ends
66
 
67
struct SKIN_BITMAPS
485 heavyiron 68
  kind  dw ?
69
  type  dw ?
70
  _data  dd ?
51 mikedld 71
ends
72
 
73
 
31 halyavin 74
START:                          ; start of execution
1611 mario79 75
;---------------------------------------------------------------------
76
	mcall	68,11
77
 
78
	test	eax,eax
79
	jz	close
80
 
81
load_libraries l_libs_start,end_l_libs
82
 
83
;if return code =-1 then exit, else nornary work
84
;        cmp     eax,-1
85
	inc	eax
86
	test	eax,eax
87
	jz	close
88
 
89
;---------------------------------------------------------------------
90
	mov	edi,filename_area
91
	mov	esi,start_temp_file_name
92
	xor	eax,eax
93
	cld
94
@@:
95
	lodsb
96
	stosb
97
	test	eax,eax
98
	jnz	@b
99
 
100
 
101
	mov	edi,fname
102
	mov	esi,default_dtp
103
	xor	eax,eax
104
	cld
105
@@:
106
	lodsb
107
	stosb
108
	test	eax,eax
109
	jnz	@b
110
 
111
;---------------------------------------------------------------------
112
;        mov     esi, param
113
;        cmp     byte [esi], 0
114
;		je	@f
115
;        jnz     has_param
116
;    mov  esi,default_skn
117
;    mov  edi,fname
118
;    mov  ecx,default_skn.size
119
;    rep  movsb
120
;    jmp  skin_path_ready
121
;has_param:
122
;        mov     ecx, 256/4
123
;        mov     edi, fname
124
;        rep     movsd
125
;		skin_path_ready
126
;---------------------------------------------------------------------
127
	mov	edi,skin_info
128
	cmp     byte [edi], 0
129
	jne	skin_path_ready
130
	mov	esi,default_skin
131
	xor	eax,eax
132
	cld
133
@@:
134
	lodsb
135
	stosb
136
	test	eax,eax
137
	jnz	@b
138
skin_path_ready:
139
;---------------------------------------------------------------------
140
;OpenDialog	initialisation
141
	push    dword OpenDialog_data
142
	call    [OpenDialog_Init]
143
 
144
	push    dword OpenDialog_data2
145
	call    [OpenDialog_Init]
146
 
147
; prepare for PathShow
148
	push	dword PathShow_data_1
149
	call	[PathShow_prepare]
150
 
151
	push	dword PathShow_data_2
152
	call	[PathShow_prepare]
153
;---------------------------------------------------------------------
31 halyavin 154
    mov  eax,48                 ; get current colors
155
    mov  ebx,3
156
    mov  ecx,color_table
157
    mov  edx,4*10
485 heavyiron 158
    mcall
31 halyavin 159
 
1611 mario79 160
    call load_skin_file.2
528 diamond 161
 
179 mikedld 162
;    mov  esi, default_dtp
163
;    mov  edi, fname
164
;    mov  ecx, default_dtp.size
165
;    rep  movsb
31 halyavin 166
 
167
red:
168
    call draw_window            ; at first, draw the window
169
 
170
still:
171
 
172
    mov  eax,23                 ; wait here for event
173
    mov  ebx,5
485 heavyiron 174
    mcall
31 halyavin 175
 
176
    dec  eax                    ; redraw request ?
177
    jz   red
178
    dec  eax                    ; key in buffer ?
179
    jz   key
180
    dec  eax                    ; button in buffer ?
181
    jz   button
182
 
183
    call draw_cursor
184
 
185
    jmp  still
186
 
187
 
188
  key:                          ; key
205 heavyiron 189
    mov  al,2                   ; just read it and ignore
485 heavyiron 190
    mcall
31 halyavin 191
    jmp  still
192
 
193
  button:                       ; button
205 heavyiron 194
    mov  al,17                  ; get id
485 heavyiron 195
    mcall
31 halyavin 196
 
1611 mario79 197
;    cmp  ah,11                  ; read string
198
;    jne  no_string
199
;    call read_string
200
;    jmp  still
201
;  no_string:
51 mikedld 202
 
203
    cmp  ah,12                  ; load file
204
    jne  no_load
205
    call load_file
206
    call draw_window
207
    jmp  still
208
  no_load:
209
 
210
    cmp  ah,13                  ; save file
211
    jne  no_save
212
    call save_file
213
    jmp  still
214
  no_save:
215
 
31 halyavin 216
    cmp  ah,14                  ; set 3d buttons
217
    jne  no_3d
218
    mov  eax,48
219
    mov  ebx,1
220
    mov  ecx,1
485 heavyiron 221
    mcall
484 diamond 222
    jmp  doapply
31 halyavin 223
   no_3d:
224
 
225
    cmp  ah,15                  ; set flat buttons
226
    jne  no_flat
227
    mcall 48, 1, 0
484 diamond 228
doapply:
31 halyavin 229
    mcall 48, 0, 0
230
    jmp  still
231
  no_flat:
232
 
51 mikedld 233
    cmp  ah,16                  ; apply
31 halyavin 234
    jne  no_apply
51 mikedld 235
  apply_direct:
31 halyavin 236
    mov  eax,48
237
    mov  ebx,2
238