WikiPad

Check-in [73056687ed]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:The editor for the shortcut keys works. Same for save and load config files. Now, remains only to make shortcuts to work.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:73056687ed54a702c54dcc161df5435b06e12a4e
User & Date: JohnFound 2011-03-15 19:50:49
Context
2011-03-15
22:31
First fully functional version. One can edit read files with it. :) check-in: 60fdc677a1 user: JohnFound tags: trunk
19:50
The editor for the shortcut keys works. Same for save and load config files. Now, remains only to make shortcuts to work. check-in: 73056687ed user: JohnFound tags: trunk
15:08
Almost working program. The shortcuts was separated in listbox aligned left, for easy access. check-in: f1cb0a952a user: lhmnai0 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to MainForm.frm.

1
2
3
4
5
6
7
8
9
10
11
..
13
14
15
16
17
18
19

20
21
22
23
24
25
26
..
60
61
62
63
64
65
66







67
68
69
70
71
72
73

74


75
76
77
78
79
80


81
82
83
84
85
86
87
...
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
;<ff
Window Form1, 3, 0, 'TForm', 'Wiki editor:', $16CF0000, $0, 0, 370, 301, 550, 409, Form1WinProc;
Window NONE, 0, 5, 'EDIT', '', $56201104, $200, 100, 120, 0, 422, 382, EditWinProc;
Window NONE, 2, 1, 'LISTBOX', 'Listbox', $50800541, $200, 200, 0, 0, 120, 382, 0;
;ff>
idEdit = 100
idShortcuts = 200

cEditorFontFace text 'FreshBold'


................................................................................
  hMainForm dd ?
  hMainMenu dd ?
  hMainToolbar dd ?

  hEditorFont dd ?

  hShortcuts dd ?

endg


winproc Form1WinProc
begin

ondefault
................................................................................
        stdcall SetAlign, eax, waTop

;        stdcall SetAutoSize, [hMainToolbar], TRUE
        invoke  SetProp, [hApplication], [propMainForm], [.hwnd]

        clc
        return








onmessage WM_CLOSE
        invoke  GetWindow, [.hwnd], GW_OWNER
        invoke  SendMessage, eax, [.wmsg], [.wparam], [.lparam]
        clc
        return


onmessage FM_AFTERCREATE



        invoke  GetDlgItem, [.hwnd], idShortcuts
        mov     [hShortcuts], eax

        stdcall LoadShortcuts, cDefaultShortcuts
cDefaultShortcuts text 'wikipad.cfg'



        clc
        return

endwp


................................................................................
        clc
        return

endwp






;proc RefreshShortcutList
;.list dd ?
;begin
;        invoke  GetDlgItem, [hMainForm], 200            ; ID of the listbox with the shortcuts.
;        mov     [.list], eax
;
;        invoke  SendMessage, [.list], LB_RESETCONTENT, 0, 0
;
;        mov     esi, [ptrShortcuts]
;        test    esi, esi
;        jz      .exit
;
;        mov     ebx, [esi+TArray.count]
;        lea     esi, [esi+TArray.array]
;
;.listloop:
;        stdcall StrPtr, [esi+TShortcutItem.hCaption]
;        invoke  SendMessage, [.list], LB_ADDSTRING, 0, eax
;        invoke  SendMessage, [.list], LB_SETITEMDATA, eax, esi
;
;        add     esi, sizeof.TShortcutItem
;        dec     ebx
;        jnz     .listloop
;
;
;.exit:
;        return
;endp




|

|







 







>







 







>
>
>
>
>
>
>







>

>
>

|
|



>
>







 









<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
1
2
3
4
5
6
7
8
9
10
11
..
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
...
121
122
123
124
125
126
127
128
129
































;<ff
Window Form1, 3, 0, 'TForm', 'Wiki editor:', $16CF0000, $0, 0, 247, 95, 550, 409, Form1WinProc;
Window NONE, 0, 5, 'EDIT', '', $56201104, $200, 100, 120, 0, 422, 382, EditWinProc;
Window NONE, 2, 1, 'LISTBOX', 'Listbox', $508005C3, $200, 200, 0, 0, 120, 382, 0;
;ff>
idEdit = 100
idShortcuts = 200

cEditorFontFace text 'FreshBold'


................................................................................
  hMainForm dd ?
  hMainMenu dd ?
  hMainToolbar dd ?

  hEditorFont dd ?

  hShortcuts dd ?
  hEditor dd ?
endg


winproc Form1WinProc
begin

ondefault
................................................................................
        stdcall SetAlign, eax, waTop

;        stdcall SetAutoSize, [hMainToolbar], TRUE
        invoke  SetProp, [hApplication], [propMainForm], [.hwnd]

        clc
        return

onmessage WM_SETFOCUS

        invoke  SetFocus, [hEditor]
        clc
        return


onmessage WM_CLOSE
        invoke  GetWindow, [.hwnd], GW_OWNER
        invoke  SendMessage, eax, [.wmsg], [.wparam], [.lparam]
        clc
        return


onmessage FM_AFTERCREATE
        invoke  GetDlgItem, [.hwnd], idShortcuts
        mov     [hShortcuts], eax

        invoke  GetDlgItem, [.hwnd], idEdit
        mov     [hEditor], eax

        stdcall LoadShortcuts, cDefaultShortcuts
cDefaultShortcuts text 'wikipad.cfg'

        stdcall CreateSplitter, [hShortcuts], TRUE, $80000000 or IDC_SIZEWE, $80000000 or IDC_SIZENS

        clc
        return

endwp


................................................................................
        clc
        return

endwp





































Changes to ShortcutEngine.asm.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
25
26
27
28
29
30
31

32
33
34
35
36



37











































38
39
40
41

42
43
44



45
46
47
48
49
50
51


52
53
54
55
56
57
58
59
60
61
62
63
64




65
66
67
68
69
70
71
..
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102

103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
...
148
149
150
151
152
153
154

155
156
157
158
159
160
161
...
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
...
183
184
185
186
187
188
189

190
191
192
193
194
195
196

197
198
199
200
201
202
203
...
207
208
209
210
211
212
213


214
215
216
217
218
219
220
221
222
223
224
225
...
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
...
291
292
293
294
295
296
297





298



























struct TShortcutItem
  .hCaption    dd ?
  .hOpenTag    dd ?
  .hCloseTag   dd ?
  .HotKey      dd ?
  .openCnt     dd ?
ends



proc DestroyShortcuts
begin
        invoke  SendMessage, [hShortcuts], LB_GETCOUNT, 0, 0
        mov     ebx, eax

.loop:  dec     ebx
        js      .finish

        invoke  SendMessage, [hShortcuts], LB_GETITEMDATA, ebx, 0
        mov     esi, eax

        stdcall StrDel, [esi+TShortcutItem.hCaption]
        stdcall StrDel, [esi+TShortcutItem.hOpenTag]
................................................................................

        stdcall FreeMem, esi

        invoke  SendMessage, [hShortcuts], LB_DELETESTRING, ebx, 0
        jmp     .loop

.finish:

        return
endp


















































proc OnEditShortcut, .wparam, .lparam
.index dd ?
begin
        xor     esi, esi


        stdcall CreateForm, frmEditShortcuts, [hMainForm]




        invoke  SendMessage, [hShortcuts], LB_GETCURSEL, 0, 0
        mov     [.index], eax
        cmp     eax, LB_ERR
        je      .edit

        invoke  SendMessage, ebx, LB_GETITEMDATA, eax, 0
        mov     esi, eax



        stdcall StrPtr, [esi+TShortcutItem.hCaption]
        invoke  SendDlgItemMessage, ebx, idCaptionEdit, WM_SETTEXT, 0, eax

        stdcall StrPtr, [esi+TShortcutItem.hOpenTag]
        invoke  SendDlgItemMessage, ebx, idOpenTagEdit, WM_SETTEXT, 0, eax

        stdcall StrPtr, [esi+TShortcutItem.hCloseTag]
        invoke  SendDlgItemMessage, ebx, idCloseTagEdit, WM_SETTEXT, 0, eax

        invoke  SendDlgItemMessage, ebx, HKM_SETHOTKEY, [esi+TShortcutItem.HotKey], 0

.edit:




        stdcall ShowModal, ebx, MSF_CENTER
        cmp     eax, MR_OK
        jne     .exit

        cmp     [.index], LB_ERR
        je      .itemok

................................................................................
        stdcall GetControlText, eax, [esi+TShortcutItem.hOpenTag]
        mov     [esi+TShortcutItem.hOpenTag], eax

        invoke  GetDlgItem, ebx, idCloseTagEdit
        stdcall GetControlText, eax, [esi+TShortcutItem.hCloseTag]
        mov     [esi+TShortcutItem.hCloseTag], eax

        invoke  SendMessage, ebx, idKeyEdit, HKM_GETHOTKEY, 0, 0
        mov     [esi+TShortcutItem.HotKey], eax

        stdcall StrPtr, [esi+TShortcutItem.hCaption]
        invoke  SendMessage, [hShortcuts], LB_ADDSTRING, 0, eax
        invoke  SendMessage, [hShortcuts], LB_SETITEMDATA, eax, esi

.exit:
        invoke  DestroyWindow, ebx

        return
endp




proc OnNewShortcut, .wparam, .lparam
begin
        invoke  SendMessage, [hShortcuts], LB_SELITEMRANGE, 0, -1
        stdcall OnEditShortcut, [.wparam], [.lparam]
        return
endp




uglobal
................................................................................
        mov     edi, eax        ; pointer to the TShortcutItem

; read 3 strings.
        xor     ecx, ecx

.strings_loop:
        stdcall FileRead, ebx, file_buffer, 4   ; length of the string.capacity

        cmp     eax, 1000
        ja      .error_load

        stdcall FileRead, ebx, file_buffer, eax
        jc      .error_load

        mov     [file_buffer+eax], 0
................................................................................
        jne     .strings_loop

; then read shortcut keys

        lea     eax, [edi+TShortcutItem.HotKey]
        stdcall FileRead, ebx, eax, 4   ; dword for flags and dword for the key.

        stdcall StrPtr, [edi+TShortcutItem.hCaption]
        invoke  SendMessage, [hShortcuts], LB_ADDSTRING, 0, eax
        invoke  SendMessage, [hShortcuts], LB_SETITEMDATA, eax, edi

        dec     [.count]
        jmp     .main_loop

.error_load:
        stdcall DestroyShortcuts
................................................................................

.end_file:
        test    ebx, ebx
        jz      .file_closed
        stdcall FileClose, ebx

.file_closed:

        return
endp



proc SaveShortcuts, .ptrFileName
.count dd ?

begin
        xor     ebx, ebx
        stdcall FileCreate, [.ptrFileName]
        jc      .error_save
        mov     ebx, eax

        mov     dword [file_buffer], 'wpSC'
................................................................................
        invoke  SendMessage, [hShortcuts], LB_GETCOUNT, 0, 0

        mov     [.count], eax
        mov     dword [file_buffer], eax
        stdcall FileWrite, ebx, file_buffer, 4
        jc      .error_save



.main_loop:
        cmp     [.count], 0
        jle     .end_file

        invoke  SendMessage, [hShortcuts], LB_GETITEMDATA, [.count], 0
        mov     esi, eax

; write 3 strings.
        xor     ecx, ecx

.strings_loop:
        stdcall StrPtr, [esi+TShortcutItem.hCaption + 4*ecx]
................................................................................
        jne     .strings_loop

; then write shortcut keys

        lea     eax, [esi+TShortcutItem.HotKey]
        stdcall FileWrite, ebx, eax, 4   ; dword for flags and dword for the key.

        dec     [.count]
        jmp     .main_loop

.error_save:

.end_file:
        test    ebx, ebx
        jz      .file_closed
................................................................................
        stdcall StrDel ; from the stack
.finish:
        return
endp









































<








|
|







 







>





>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|


>



>
>
>
|




|

>
>










|


>
>
>
>







 







|


|
<




>








<
|







 







>







 







|
<







 







>







>







 







>
>

|
|

|







 







|







 







>
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
..
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
...
143
144
145
146
147
148
149
150
151
152
153

154
155
156
157
158
159
160
161
162
163
164
165
166

167
168
169
170
171
172
173
174
...
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
...
223
224
225
226
227
228
229
230

231
232
233
234
235
236
237
...
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
...
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
...
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
...
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
struct TShortcutItem
  .hCaption    dd ?
  .hOpenTag    dd ?
  .hCloseTag   dd ?
  .HotKey      dd ?

ends



proc DestroyShortcuts
begin
        invoke  SendMessage, [hShortcuts], LB_GETCOUNT, 0, 0
        mov     ebx, eax
.loop:
        dec     ebx
        js      .finish

        invoke  SendMessage, [hShortcuts], LB_GETITEMDATA, ebx, 0
        mov     esi, eax

        stdcall StrDel, [esi+TShortcutItem.hCaption]
        stdcall StrDel, [esi+TShortcutItem.hOpenTag]
................................................................................

        stdcall FreeMem, esi

        invoke  SendMessage, [hShortcuts], LB_DELETESTRING, ebx, 0
        jmp     .loop

.finish:
        invoke  SendMessage, [hShortcuts], LB_RESETCONTENT, 0, 0
        return
endp



proc SetTabstop
.size SIZE
begin

        invoke  SendMessage, [hShortcuts], LB_GETCOUNT, 0, 0
        mov     ebx, eax

        xor     esi, esi
        invoke  GetDC, [hShortcuts]
        mov     edi, eax

.loop:  dec     ebx
        js      .finish

        invoke  SendMessage, [hShortcuts], LB_GETITEMDATA, ebx, 0
        test    eax, eax
        jz      .loop

        stdcall StrPtr, [eax+TShortcutItem.hCaption]
        lea     ecx, [.size]
        invoke  GetTextExtentPoint32, edi, eax, [eax+string.len], ecx

        cmp     esi, [.size.cx]
        ja      .loop
        mov     esi, [.size.cx]
        jmp     .loop

.finish:
        invoke  ReleaseDC, [hShortcuts], edi

        add     esi, 10

        invoke  GetDialogBaseUnits
        mov     ecx, eax
        and     ecx, $ffff
        lea     eax, [4*esi]
        cdq
        div     ecx

        mov     [.size.cx], eax
        lea     eax, [.size.cx]
        invoke  SendMessage, [hShortcuts], LB_SETTABSTOPS, 1, eax
        return
endp



proc OnEditShortcut, .wparam, .lparam
  .index dd ?
begin
        xor     esi, esi
        mov     [.index], -1

        stdcall CreateForm, frmEditShortcuts, [hMainForm]

        cmp     [.lparam], -1
        je      .edit

        invoke  SendMessage, [hShortcuts], LB_GETCARETINDEX, 0, 0
        mov     [.index], eax
        cmp     eax, LB_ERR
        je      .edit

        invoke  SendMessage, [hShortcuts], LB_GETITEMDATA, eax, 0
        mov     esi, eax
        test    esi, esi
        jz      .edit

        stdcall StrPtr, [esi+TShortcutItem.hCaption]
        invoke  SendDlgItemMessage, ebx, idCaptionEdit, WM_SETTEXT, 0, eax

        stdcall StrPtr, [esi+TShortcutItem.hOpenTag]
        invoke  SendDlgItemMessage, ebx, idOpenTagEdit, WM_SETTEXT, 0, eax

        stdcall StrPtr, [esi+TShortcutItem.hCloseTag]
        invoke  SendDlgItemMessage, ebx, idCloseTagEdit, WM_SETTEXT, 0, eax

        invoke  SendDlgItemMessage, ebx, idKeyEdit, HKM_SETHOTKEY, [esi+TShortcutItem.HotKey], 0

.edit:
        stdcall NumToStr, [.index], ntsHex or ntsUnsigned
        stdcall SetControlText, ebx, eax
        stdcall StrDel, eax

        stdcall ShowModal, ebx, MSF_CENTER
        cmp     eax, MR_OK
        jne     .exit

        cmp     [.index], LB_ERR
        je      .itemok

................................................................................
        stdcall GetControlText, eax, [esi+TShortcutItem.hOpenTag]
        mov     [esi+TShortcutItem.hOpenTag], eax

        invoke  GetDlgItem, ebx, idCloseTagEdit
        stdcall GetControlText, eax, [esi+TShortcutItem.hCloseTag]
        mov     [esi+TShortcutItem.hCloseTag], eax

        invoke  SendDlgItemMessage, ebx, idKeyEdit, HKM_GETHOTKEY, 0, 0
        mov     [esi+TShortcutItem.HotKey], eax

        stdcall AddShortcut, esi

        invoke  SendMessage, [hShortcuts], LB_SETITEMDATA, eax, esi

.exit:
        invoke  DestroyWindow, ebx
        stdcall SetTabstop
        return
endp




proc OnNewShortcut, .wparam, .lparam
begin

        stdcall OnEditShortcut, [.wparam], -1
        return
endp




uglobal
................................................................................
        mov     edi, eax        ; pointer to the TShortcutItem

; read 3 strings.
        xor     ecx, ecx

.strings_loop:
        stdcall FileRead, ebx, file_buffer, 4   ; length of the string.capacity
        mov     eax, dword [file_buffer]
        cmp     eax, 1000
        ja      .error_load

        stdcall FileRead, ebx, file_buffer, eax
        jc      .error_load

        mov     [file_buffer+eax], 0
................................................................................
        jne     .strings_loop

; then read shortcut keys

        lea     eax, [edi+TShortcutItem.HotKey]
        stdcall FileRead, ebx, eax, 4   ; dword for flags and dword for the key.

        stdcall AddShortcut, edi

        invoke  SendMessage, [hShortcuts], LB_SETITEMDATA, eax, edi

        dec     [.count]
        jmp     .main_loop

.error_load:
        stdcall DestroyShortcuts
................................................................................

.end_file:
        test    ebx, ebx
        jz      .file_closed
        stdcall FileClose, ebx

.file_closed:
        stdcall SetTabstop
        return
endp



proc SaveShortcuts, .ptrFileName
.count dd ?
.index dd ?
begin
        xor     ebx, ebx
        stdcall FileCreate, [.ptrFileName]
        jc      .error_save
        mov     ebx, eax

        mov     dword [file_buffer], 'wpSC'
................................................................................
        invoke  SendMessage, [hShortcuts], LB_GETCOUNT, 0, 0

        mov     [.count], eax
        mov     dword [file_buffer], eax
        stdcall FileWrite, ebx, file_buffer, 4
        jc      .error_save

        mov     [.index], 0

.main_loop:
        dec     [.count]
        js      .end_file

        invoke  SendMessage, [hShortcuts], LB_GETITEMDATA, [.index], 0
        mov     esi, eax

; write 3 strings.
        xor     ecx, ecx

.strings_loop:
        stdcall StrPtr, [esi+TShortcutItem.hCaption + 4*ecx]
................................................................................
        jne     .strings_loop

; then write shortcut keys

        lea     eax, [esi+TShortcutItem.HotKey]
        stdcall FileWrite, ebx, eax, 4   ; dword for flags and dword for the key.

        inc     [.index]
        jmp     .main_loop

.error_save:

.end_file:
        test    ebx, ebx
        jz      .file_closed
................................................................................
        stdcall StrDel ; from the stack
.finish:
        return
endp



proc AddShortcut, .ptrShortcut
.accel ACCEL
.str rb 256
begin
        push    esi ebx

        mov     esi, [.ptrShortcut]
        stdcall StrDup, [esi+TShortcutItem.hCaption]
        mov     ebx, eax
        stdcall StrCharCat, ebx, $09

        mov     eax, [esi+TShortcutItem.HotKey]
        movzx   ecx, al ; virt key
        shr     eax, 8  ; modifier
        shl     eax, 2

        mov     [.accel.fVirt], ax
        mov     [.accel.key], cx

        lea     eax, [.accel]
        lea     ecx, [.str]
        stdcall AccelToStr, eax, ecx

        lea     eax, [.str]
        stdcall StrCat, ebx, eax

        stdcall StrPtr, ebx
        invoke  SendMessage, [hShortcuts], LB_ADDSTRING, 0, eax
        stdcall StrDel, ebx

        pop     ebx esi
        return
endp

Changes to WikiPad.asm.

5
6
7
8
9
10
11

12
13
14
15
16
17
18
..
19
20
21
22
23
24
25

26
27
28
29
30
31
32

include '%finc%/libs/gui.inc'
include '%finc%/libs/parents.inc'
include '%finc%/libs/msgutils.inc'
include '%finc%/libs/templates.inc'
include '%finc%/libs/tform.inc'
include '%finc%/libs/application.inc'



section '.code' code readable executable

include '%finc%/libs/gui.asm'
include '%finc%/libs/parents.asm'
include '%finc%/libs/msgutils.asm'
................................................................................
include '%finc%/libs/templates.asm'
include '%finc%/libs/tform.asm'
include '%lib%/system/memory.asm'
include '%lib%/system/files.asm'

include '%lib%/GUI/Win32/giflib.asm'
include '%finc%/libs/application.asm'


include '%lib%/data/arrays.asm'
include '%lib%/data/strlib.asm'
include 'StrLibOS.asm'

include 'opendialog.asm'
include 'actions.asm'







>







 







>







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
..
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

include '%finc%/libs/gui.inc'
include '%finc%/libs/parents.inc'
include '%finc%/libs/msgutils.inc'
include '%finc%/libs/templates.inc'
include '%finc%/libs/tform.inc'
include '%finc%/libs/application.inc'
include '%finc%/libs/splitter.inc'


section '.code' code readable executable

include '%finc%/libs/gui.asm'
include '%finc%/libs/parents.asm'
include '%finc%/libs/msgutils.asm'
................................................................................
include '%finc%/libs/templates.asm'
include '%finc%/libs/tform.asm'
include '%lib%/system/memory.asm'
include '%lib%/system/files.asm'

include '%lib%/GUI/Win32/giflib.asm'
include '%finc%/libs/application.asm'
include '%finc%/libs/splitter.asm'

include '%lib%/data/arrays.asm'
include '%lib%/data/strlib.asm'
include 'StrLibOS.asm'

include 'opendialog.asm'
include 'actions.asm'

Changes to WikiPad.exe.

cannot compute difference between binary files

Changes to dlgShortcuts.frm.

1
2
3
4
5
6
7
8
9
..
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
..
67
68
69
70
71
72
73
74



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
;<ff
Window frmEditShortcuts, 3, 0, 'TForm', 'Edit shortcut', $16480000, $10000, 0, 553, 340, 320, 299, CustomWinProc;
Window NONE, 0, 0, 'EDIT', '', $50010080, $200, 104, 8, 176, 297, 21, 0;
Window NONE, 0, 0, 'EDIT', '', $50010080, $200, 101, 8, 32, 297, 21, 0;
Window NONE, 0, 0, 'STATIC', 'Shortcut key:', $50000000, $0, 0, 8, 160, 64, 16, 0;
Window NONE, 0, 0, 'STATIC', 'Open tag:', $50000000, $0, 0, 8, 64, 64, 16, 0;
Window NONE, 0, 0, 'EDIT', '', $50010080, $200, 102, 8, 80, 297, 21, 0;
Window NONE, 0, 0, 'STATIC', 'Caption:', $50000000, $0, 0, 8, 16, 64, 16, 0;
Window NONE, 0, 0, 'STATIC', 'Close tag:', $50000000, $0, 0, 8, 112, 64, 16, 0;
................................................................................
;   .hwnd - handle of the window
;   .wmsg - code of the message
;   .wparam \ Parameters of the message
;   .lparam /
;-----------------------------------------------------------------------
winproc CustomWinProc
begin
;-----------------------------------------------------------------------
; Write here the code that have to be executed before
; message dispathing.
;-----------------------------------------------------------------------


ondefault
;-----------------------------------------------------------------------
; Write here the code that have to be executed if message
; was not processed by this procedure.
;-----------------------------------------------------------------------
        stc
        return


onmessage FM_AFTERCREATE
locals
  .rect RECT
................................................................................
        invoke  ScreenToClient, [.hwnd], eax

        mov     ecx, [.rect.right]
        mov     eax, [.rect.bottom]
        sub     ecx, [.rect.left]
        sub     eax, [.rect.top]

        invoke  CreateWindowEx, 0, cHotkeyEditClassName, 0, WS_CHILD or WS_CLIPSIBLINGS or WS_VISIBLE, [.rect.left], [.rect.top], ecx, eax, [.hwnd], idKeyEdit, [hInstance], 0




        clc
        return


endwp








;
;
;
;        cmp     [.lparam], 0
;        jne     .nameok
;
;        stdcall StrNew
;        mov     [.lparam], eax
;
;        lea     eax, [.lparam]
;        stdcall OpenFilesDialog, cOpenFileTitle, FALSE, ShortcutFilter, _returnNameCallback, 0, eax
;        test    eax, eax
;        jz      .finish
;
;        stdcall DestroyShortcuts
;
;.nameok:
;        stdcall StrPtr, [.lparam]
;        stdcall LoadBinaryFile, eax
;        jc      .error_load
;
;        mov     [.file], eax
;        mov     [.size], ecx
;
;        stdcall CreateArray, sizeof.TShortcutItem
;        mov     [ptrShortcuts], eax
;
;        mov     esi, [.file]
;        mov     ebx, [.size]
;
;.scanloop:
;        stdcall AddArrayItem , [ptrShortcuts]
;        mov     [ptrShortcuts], edx
;        mov     edi, eax
;
;        xor     ecx, ecx
;
;.strloop:
;        call    .scantoseparator
;;        jc      .error_format
;
;        stdcall StrDup, eax     ; caption
;        mov     [edi+TShortcutItem.hCaption+4*ecx], eax
;
;        inc     ecx
;        cmp     ecx, 3
;        jne     .strloop
;
;; shortcut
;        call    .scantoseparator
;;        jc      .error_format
;
;
;
;
;
;
;.error_load:
;.end_of_file:
;
;.endfile:
;        stdcall FreeMem, [.file]
;
;.finish:
;        stdcall StrDel, [.lparam]
;        return
;
;.scantoseparator:
;        retn
;
;.skiptoeol:
;        retn
;
;endp
;
;

;
;
;proc _returnNameCallback, .name, .hRetString
;begin
;        stdcall StrCopy, [.hRetString], [.name]
;        mov     eax, 1   ; the file is assigned...
;        return
;endp
;
;
;
;
;
;proc AppendShortCutMenu, .hMenu, .ptrShortcutsArray, .fromSeparator
;.mii  MENUITEMINFO
;begin
;        push    esi edi ebx
;
;        mov     [.mii.cbSize], sizeof.MENUITEMINFO
;        mov     [.mii.fMask], MIIM_TYPE or MIIM_ID
;
;        xor     edi, edi
;
;        invoke  GetMenuItemCount, [.hMenu]
;        mov     ebx, eax
;        test    ebx, ebx
;        jz      .endscan
;
;.scanloop:
;        lea     ecx, [.mii]
;        invoke  GetMenuItemInfo, [.hMenu], edi, TRUE, ecx
;        cmp     [.mii.fType], MF_SEPARATOR
;        jne     .next
;        dec     [.fromSeparator]
;        jz      .delloop
;.next:
;        inc     edi
;        cmp     edi, ebx
;        jae     .endscan
;        jmp     .scanloop
;
;; found needed separator, delete to the next separator.
;.delloop:
;        invoke  DeleteMenu, [.hMenu], edi, MF_BYPOSITION
;        dec     ebx
;        cmp     edi, ebx
;        jae     .endscan
;
;        lea     ecx, [.mii]
;        invoke  GetMenuItemInfo, [.hMenu], edi, TRUE, ecx
;        cmp     [.mii.fType], MF_SEPARATOR
;        jne     .delloop
;
;.endscan:
;        mov     [.mii.fType], MFT_STRING
;
;        mov     esi, [.ptrList]
;        xor     ebx, ebx
;        mov     eax, [esi+4]
;        add     [.ItemID], eax
;        stc                     ; One for the separator.
;        adc     [.ItemID], edi
;.loop:
;        cmp     ebx, [esi+4]
;        jae     .endinsert
;
;        stdcall StrPtr, [esi+4*ebx+8]
;        mov     [.mii.dwTypeData], eax
;
;        dec     [.ItemID]
;        push    [.ItemID]
;        pop     [.mii.wID]
;
;        lea     eax, [.mii]
;        invoke  InsertMenuItem, [.hMenu], edi, TRUE, eax
;        inc     ebx
;        jmp     .loop
;
;.endinsert:
;; Put separator at the begin.
;        mov     [.mii.fMask], MIIM_TYPE
;        mov     [.mii.fType], MFT_SEPARATOR
;        mov     [.mii.wID], NULL
;        lea     eax, [.mii]
;        invoke  InsertMenuItem, [.hMenu], edi, TRUE, eax
;
;.finish:
;        pop     ebx edi esi
;        return
;endp
;
;
;

|







 







<
<
<
<

<

<
<
<
<







 







|
>
>
>




<


<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
1
2
3
4
5
6
7
8
9
..
30
31
32
33
34
35
36




37

38




39
40
41
42
43
44
45
..
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

73
74

















































































































































































;<ff
Window frmEditShortcuts, 3, 0, 'TForm', 'Edit shortcut', $16480000, $10000, 0, 362, 147, 320, 299, CustomWinProc;
Window NONE, 0, 0, 'EDIT', '', $50010080, $200, 104, 8, 176, 297, 21, 0;
Window NONE, 0, 0, 'EDIT', '', $50010080, $200, 101, 8, 32, 297, 21, 0;
Window NONE, 0, 0, 'STATIC', 'Shortcut key:', $50000000, $0, 0, 8, 160, 64, 16, 0;
Window NONE, 0, 0, 'STATIC', 'Open tag:', $50000000, $0, 0, 8, 64, 64, 16, 0;
Window NONE, 0, 0, 'EDIT', '', $50010080, $200, 102, 8, 80, 297, 21, 0;
Window NONE, 0, 0, 'STATIC', 'Caption:', $50000000, $0, 0, 8, 16, 64, 16, 0;
Window NONE, 0, 0, 'STATIC', 'Close tag:', $50000000, $0, 0, 8, 112, 64, 16, 0;
................................................................................
;   .hwnd - handle of the window
;   .wmsg - code of the message
;   .wparam \ Parameters of the message
;   .lparam /
;-----------------------------------------------------------------------
winproc CustomWinProc
begin






ondefault




        stc
        return


onmessage FM_AFTERCREATE
locals
  .rect RECT
................................................................................
        invoke  ScreenToClient, [.hwnd], eax

        mov     ecx, [.rect.right]
        mov     eax, [.rect.bottom]
        sub     ecx, [.rect.left]
        sub     eax, [.rect.top]

        invoke  CreateWindowEx, 0, cHotkeyEditClassName, 0, WS_CHILD or WS_TABSTOP or WS_CLIPSIBLINGS or WS_VISIBLE, [.rect.left], [.rect.top], ecx, eax, [.hwnd], idKeyEdit, [hInstance], 0
        mov     ebx, eax
        invoke  GetDlgItem, [.hwnd], idCloseTagEdit
        invoke  SetWindowPos, ebx, eax, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE

        clc
        return


endwp


















































































































































































Changes to wikipad.cfg.

cannot compute difference between binary files