Subversion Repositories Kolibri OS

Rev

Rev 3279 | Rev 4487 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3279 Rev 3357
1
;-----------------------------------------------------------------------------
1
;-----------------------------------------------------------------------------
2
; project name:      TINYPAD
2
; project name:      TINYPAD
3
; compiler:          flat assembler 1.67.21
3
; compiler:          flat assembler 1.67.21
4
; memory to compile: 3.0/9.0 MBytes (without/with size optimizations)
4
; memory to compile: 3.0/9.0 MBytes (without/with size optimizations)
5
; version:           SVN (4.0.5)
5
; version:           SVN (4.0.5)
6
; last update:       2008-07-18 (Jul 18, 2008)
6
; last update:       2008-07-18 (Jul 18, 2008)
7
; minimal kernel:    revision #823 (svn://kolibrios.org/kernel/trunk)
7
; minimal kernel:    revision #823 (svn://kolibrios.org/kernel/trunk)
8
;-----------------------------------------------------------------------------
8
;-----------------------------------------------------------------------------
9
; originally by:     Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi
9
; originally by:     Ville Michael Turjanmaa >> villemt@aton.co.jyu.fi
10
; maintained by:     Mike Semenyako          >> mike.dld@gmail.com
10
; maintained by:     Mike Semenyako          >> mike.dld@gmail.com
11
;                    Ivan Poddubny           >> ivan-yar@bk.ru
11
;                    Ivan Poddubny           >> ivan-yar@bk.ru
12
;-----------------------------------------------------------------------------
12
;-----------------------------------------------------------------------------
13
; TODO (4.1.0):
13
; TODO (4.1.0):
14
;   - add vertical selection, undo, goto position, overwrite mode, smart tabulation
14
;   - add vertical selection, undo, goto position, overwrite mode, smart tabulation
15
;   - improve window drawing with small dimensions
15
;   - improve window drawing with small dimensions
16
;   - save/load settings to/from ini file, not executable
16
;   - save/load settings to/from ini file, not executable
17
;   - path autocompletion for open/save dialogs
17
;   - path autocompletion for open/save dialogs
18
;   - other bug-fixes and speed/size optimizations
18
;   - other bug-fixes and speed/size optimizations
19
;-----------------------------------------------------------------------------
19
;-----------------------------------------------------------------------------
20
; See history.txt for complete changelog
20
; See history.txt for complete changelog
21
;-----------------------------------------------------------------------------
21
;-----------------------------------------------------------------------------
22
 
22
 
23
include 'lang.inc'
23
include 'lang.inc'
24
 
24
 
25
include '../../../config.inc'		;for nightbuild
25
include '../../../config.inc'		;for nightbuild
26
include '../../../macros.inc'		; useful stuff
26
include '../../../macros.inc'		; useful stuff
27
include '../../../struct.inc'
27
include '../../../struct.inc'
28
include '../../../proc32.inc'
28
include '../../../proc32.inc'
29
 
29
 
30
include 'external/libio.inc'
30
include 'external/libio.inc'
31
 
31
 
32
include 'tinypad.inc'
32
include 'tinypad.inc'
33
 
33
 
34
;purge mov,add,sub            ;  SPEED
34
;purge mov,add,sub            ;  SPEED
35
 
35
 
36
header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,ini_path
36
header '01',1,@CODE,TINYPAD_END,STATIC_MEM_END,MAIN_STACK,@PARAMS,ini_path
37
 
37
 
38
APP_VERSION equ 'SVN (4.0.6)'
38
APP_VERSION equ 'SVN (4.0.6)'
39
 
39
 
40
TRUE = 1
40
TRUE = 1
41
FALSE = 0
41
FALSE = 0
42
 
42
 
43
;include 'debug.inc'
43
;include 'debug.inc'
44
;define __DEBUG__ 1
44
;define __DEBUG__ 1
45
;define __DEBUG_LEVEL__ 1
45
;define __DEBUG_LEVEL__ 1
46
;include 'debug-fdo.inc'
46
;include 'debug-fdo.inc'
47
 
47
 
48
; compiled-in options
48
; compiled-in options
49
 
49
 
50
ASEPC = '-'  ; separator character (char)
50
ASEPC = '-'  ; separator character (char)
51
ATOPH = 19   ; menu bar height (pixels)
51
ATOPH = 19   ; menu bar height (pixels)
52
SCRLW = 16   ; scrollbar widht/height (pixels)
52
SCRLW = 16   ; scrollbar widht/height (pixels)
53
ATABW = 8    ; tab key indent width (chars)
53
ATABW = 8    ; tab key indent width (chars)
54
LINEH = 10   ; line height (pixels)
54
LINEH = 10   ; line height (pixels)
55
PATHL = 256  ; maximum path length (chars) !!! don't change !!!
55
PATHL = 256  ; maximum path length (chars) !!! don't change !!!
56
AMINS = 8    ; minimal scroll thumb size (pixels)
56
AMINS = 8    ; minimal scroll thumb size (pixels)
57
LCHGW = 3    ; changed/saved marker width (pixels)
57
LCHGW = 3    ; changed/saved marker width (pixels)
58
 
58
 
59
STATH = 16   ; status bar height (pixels)
59
STATH = 16   ; status bar height (pixels)
60
TBARH = 18   ; tab bar height (pixels)
60
TBARH = 18   ; tab bar height (pixels)
61
 
61
 
62
INI_SEC_PREFIX equ ''
62
INI_SEC_PREFIX equ ''
63
 
63
 
64
;-----------------------------------------------------------------------------
64
;-----------------------------------------------------------------------------
65
section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
65
section @CODE ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
66
;-----------------------------------------------------------------------------
66
;-----------------------------------------------------------------------------
67
 
-
 
68
	mcall	9,p_info2,-1
-
 
69
	mov	ecx,[ebx+30]	; PID
-
 
70
	mcall	18,21
-
 
71
	mov	[active_process],eax	; WINDOW SLOT
-
 
72
 
-
 
73
	cld
67
	cld
74
	mov	edi,@UDATA
68
	mov	edi,@UDATA
75
	mov	ecx,@PARAMS-@UDATA
69
	mov	ecx,@PARAMS-@UDATA
76
	mov	al,0
70
	mov	al,0
77
	rep	stosb
71
	rep	stosb
78
 
72
 
79
	mcall	68,11
73
	mcall	68,11
80
	or	eax,eax
74
	or	eax,eax
81
	jz	key.alt_x.close
75
	jz	key.alt_x.close
82
 
76
 
83
	stdcall dll.Load,@IMPORT
77
	stdcall dll.Load,@IMPORT
84
	or	eax,eax
78
	or	eax,eax
85
	jnz	key.alt_x.close
79
	jnz	key.alt_x.close
86
 
80
 
87
	mov	edi,ini_path
81
	mov	edi,ini_path
88
	xor	al,al
82
	xor	al,al
89
	mov	ecx,PATHL
83
	mov	ecx,PATHL
90
	repne	scasb
84
	repne	scasb
91
	mov	dword[edi-1],'.ini'
85
	mov	dword[edi-1],'.ini'
92
	mov	byte[edi+3],0
86
	mov	byte[edi+3],0
93
 
87
 
94
	stdcall load_settings
88
	stdcall load_settings
95
 
89
 
96
	stdcall mem.Alloc,65536
90
	stdcall mem.Alloc,65536
97
	mov	[temp_buf],eax
91
	mov	[temp_buf],eax
98
 
92
 
99
	inc	[do_not_draw]
93
	inc	[do_not_draw]
100
 
94
 
101
	mov	dword[app_start],7
95
	mov	dword[app_start],7
102
 
96
 
103
	mov	esi,s_example
97
	mov	esi,s_example
104
	mov	edi,tb_opensave.text
98
	mov	edi,tb_opensave.text
105
	mov	ecx,s_example.size
99
	mov	ecx,s_example.size
106
	mov	[tb_opensave.length],cl
100
	mov	[tb_opensave.length],cl
107
	rep	movsb
101
	rep	movsb
108
 
102
 
109
	mov	esi,s_still
103
	mov	esi,s_still
110
	mov	edi,s_search
104
	mov	edi,s_search
111
	mov	ecx,s_still.size
105
	mov	ecx,s_still.size
112
	mov	[s_search.size],ecx
106
	mov	[s_search.size],ecx
113
	rep	movsb
107
	rep	movsb
114
 
108
 
115
	cmp	byte[@PARAMS],0
109
	cmp	byte[@PARAMS],0
116
	jz	no_params
110
	jz	no_params
117
 
111
 
118
;// Willow's code to support DOCPAK [
112
;// Willow's code to support DOCPAK [
119
 
113
 
120
	cmp	byte[@PARAMS],'*'
114
	cmp	byte[@PARAMS],'*'
121
	jne	.noipc
115
	jne	.noipc
122
 
116
 
123
;// diamond [ (convert size from decimal representation to dword)
117
;// diamond [ (convert size from decimal representation to dword)
124
;--     mov     edx,dword[@PARAMS+1]
118
;--     mov     edx,dword[@PARAMS+1]
125
	mov	esi,@PARAMS+1
119
	mov	esi,@PARAMS+1
126
	xor	edx,edx
120
	xor	edx,edx
127
	xor	eax,eax
121
	xor	eax,eax
128
    @@: lodsb
122
    @@: lodsb
129
	test	al,al
123
	test	al,al
130
	jz	@f
124
	jz	@f
131
	lea	edx,[edx*4+edx]
125
	lea	edx,[edx*4+edx]
132
	lea	edx,[edx*2+eax-'0']
126
	lea	edx,[edx*2+eax-'0']
133
	jmp	@b
127
	jmp	@b
134
    @@:
128
    @@:
135
;// diamond ]
129
;// diamond ]
136
 
130
 
137
	add	edx,20
131
	add	edx,20
138
 
132
 
139
	stdcall mem.Alloc,edx
133
	stdcall mem.Alloc,edx
140
	mov	ebp,eax
134
	mov	ebp,eax
141
	push	eax
135
	push	eax
142
 
136
 
143
	mov	dword[ebp+0],0
137
	mov	dword[ebp+0],0
144
	mov	dword[ebp+4],8
138
	mov	dword[ebp+4],8
145
	mcall	60,1,ebp
139
	mcall	60,1,ebp
146
	mcall	40,1000000b
140
	mcall	40,1000000b
147
 
141
 
148
	mcall	23,200
142
	mcall	23,200
149
 
143
 
150
	cmp	eax,7
144
	cmp	eax,7
151
	jne	key.alt_x.close
145
	jne	key.alt_x.close
152
	mov	byte[ebp],1
146
	mov	byte[ebp],1
153
 
147
 
154
	mov	ecx,[ebp+12]
148
	mov	ecx,[ebp+12]
155
	lea	esi,[ebp+16]
149
	lea	esi,[ebp+16]
156
	call	create_tab
150
	call	create_tab
157
	call	load_from_memory
151
	call	load_from_memory
158
 
152
 
159
	pop	ebp
153
	pop	ebp
160
	stdcall mem.Free,ebp
154
	stdcall mem.Free,ebp
161
 
155
 
162
	jmp	@f
156
	jmp	@f
163
  .noipc:
157
  .noipc:
164
 
158
 
165
;// Willow's code to support DOCPAK ]
159
;// Willow's code to support DOCPAK ]
166
 
160
 
167
	mov	esi,@PARAMS
161
	mov	esi,@PARAMS
168
	mov	edi,tb_opensave.text
162
	mov	edi,tb_opensave.text
169
	mov	ecx,PATHL
163
	mov	ecx,PATHL
170
	rep	movsb
164
	rep	movsb
171
	mov	edi,tb_opensave.text
165
	mov	edi,tb_opensave.text
172
	mov	ecx,PATHL
166
	mov	ecx,PATHL
173
	xor	al,al
167
	xor	al,al
174
	repne	scasb
168
	repne	scasb
175
	jne	key.alt_x.close
169
	jne	key.alt_x.close
176
	lea	eax,[edi-tb_opensave.text-1]
170
	lea	eax,[edi-tb_opensave.text-1]
177
	mov	[tb_opensave.length],al
171
	mov	[tb_opensave.length],al
178
	call	load_file
172
	call	load_file
179
	jnc	@f
173
	jnc	@f
180
 
174
 
181
  no_params:
175
  no_params:
182
	call	create_tab
176
	call	create_tab
183
 
177
 
184
    @@:
178
    @@:
185
	mov	[s_status],0
179
	mov	[s_status],0
186
	dec	[do_not_draw]
180
	dec	[do_not_draw]
187
 
181
 
188
	mov	al,[tabs_pos]
182
	mov	al,[tabs_pos]
189
	mov	[tab_bar.Style],al
183
	mov	[tab_bar.Style],al
190
 
184
 
191
;---------------------------------------------------------------------
185
;---------------------------------------------------------------------
192
	mov	edi,filename_area
186
	mov	edi,filename_area
193
	mov	esi,s_example+5
187
	mov	esi,s_example+5
194
	call	copy_str_1
188
	call	copy_str_1
195
 
189
 
196
	mov	esi,tb_opensave.text
190
	mov	esi,tb_opensave.text
197
	mov	edi,fname_Info
191
	mov	edi,fname_Info
198
	call	copy_str_1
192
	call	copy_str_1
199
	xor	eax,eax
193
	xor	eax,eax
200
	mov	[edi],al
194
	mov	[edi],al
201
;---------------------------------------------------------------------
195
;---------------------------------------------------------------------
202
;OpenDialog	initialisation
196
;OpenDialog	initialisation
203
	push    dword OpenDialog_data
197
	push    dword OpenDialog_data
204
	call    [OpenDialog_Init]
198
	call    [OpenDialog_Init]
205
;---------------------------------------------------------------------
199
;---------------------------------------------------------------------
206
 
200
 
207
 
201
 
208
	mcall	66,1,1
202
	mcall	66,1,1
209
	mcall	40,00100111b
203
	mcall	40,00100111b
210
red:
204
red:
211
	call	drawwindow
205
	call	drawwindow
212
 
206
 
213
;-----------------------------------------------------------------------------
207
;-----------------------------------------------------------------------------
214
 
208
 
215
still:
209