WikiPad

Check-in [9cbee56b0a]
Login

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

Overview
Comment:Implemented AsmEdit as an edit control. Some highlighing added. Work in progress.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:9cbee56b0a541c938b0e9ce9d6f8560c138b0975
User & Date: JohnFound 2011-04-08 08:41:10
Context
2011-04-08
08:48
Some missing files added. check-in: d9bc02361d user: JohnFound tags: trunk
08:41
Implemented AsmEdit as an edit control. Some highlighing added. Work in progress. check-in: 9cbee56b0a user: JohnFound tags: trunk
2011-03-16
14:58
It is almost useful. It misses search and replace, syntax highlight and other things, but allows inserting text really fast. check-in: 970026b1fd 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
12


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





27
28
29
30
31
32
33
...
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
;<ff
Window Form1, 3, 0, 'TForm', 'Wiki editor:', $16CF0000, $10000, 0, 433, 299, 550, 409, Form1WinProc;
Window NONE, 0, 5, 'EDIT', '', $56311104, $200, 100, 120, 0, 422, 382, EditWinProc;
Window NONE, 2, 1, 'LISTBOX', 'Listbox', $508105C3, $200, 200, 0, 0, 120, 382, 0;
;ff>
idEdit = 100
idShortcuts = 200

cEditorFontFace text 'FreshBold'


uglobal


  hMainForm dd ?
  hMainMenu dd ?
  hMainToolbar dd ?

  hEditorFont dd ?

  hShortcuts dd ?
................................................................................
  hEditor dd ?

  hAccelerators dd ?
endg

iglobal
  property propIgnoreNext, 'IGNORENEXT'





endg


winproc Form1WinProc
begin

ondefault
................................................................................
onmessage WM_CLOSE
        stdcall OnExit, 0, 0
        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




winproc EditWinProc
begin



ondefault
        stc
        return

onmessage WM_GETDLGCODE

        mov     eax, DLGC_WANTARROWS or DLGC_WANTTAB or DLGC_WANTALLKEYS
        clc
        return

onmessage WM_CHAR

        invoke  GetProp, [.hwnd], [propIgnoreNext]
        test    eax, eax
        jz      .ondefault

        invoke  SetProp, [.hwnd], [propIgnoreNext], 0

        cmp     [.wparam], $20
        jae     .ondefault

        xor     eax, eax
        clc
        return

onmessage WM_KEYDOWN

        mov     eax, [.wparam]

        mov     ecx, [.lparam]

        cmp     eax, $20
        jb      .ondefault

        xor     ebx, ebx



        invoke  GetKeyState, VK_CONTROL
        test    ax, ax
        jns     @f
        or      ebx, HOTKEYF_CONTROL
@@:
        invoke  GetKeyState, VK_SHIFT
        test    ax, ax
        jns     @f
        or      ebx, HOTKEYF_SHIFT
@@:
        invoke  GetKeyState, VK_MENU
        test    ax, ax
        jns     @f
        or      ebx, HOTKEYF_ALT
@@:
        shl     ebx, 8
        mov     bl, byte [.wparam]

        stdcall SearchHotKey, ebx
        jc      .ondefault

        mov     esi, eax        ; pointer to TShortcutItem
        stdcall InsertShortcut, eax


        xor     eax,eax
        clc
        return

onmessage AM_INITWINDOW
        invoke  SetProp, [.hwnd], [propOwnFont], 1

        invoke  CreateFont, -13, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, RUSSIAN_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, FIXED_PITCH or FF_DONTCARE, cEditorFontFace
        mov     [hEditorFont], eax
        invoke  SendMessage, [.hwnd], WM_SETFONT, [hEditorFont], 1
        clc
        return



onmessage WM_SETFOCUS
        invoke  SetProp, [.hwnd], [propIgnoreNext], 0
        jmp     .ondefault

onmessage WM_DESTROY
        invoke  DeleteObject, [hEditorFont]
        clc

        return

endwp






|
|
|








>
>







 







>
>
>
>
>







 







>
>
>
>
>
>






>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>



>
>
>









<
<

>
>
|
<
<

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
>
|
<
|
<

<
>
>

<
<
|
<
<
<
<
|
<
<
<
<
|
<

<
|
<
<
|

<
<
<
>
|
<
<
<
<
<
<
<
|
<
<
<
>
>

<
<
<
<
<
<
<
>

<
|
<
<
<
<
<
1
2
3
4
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
35
36
37
38
39
40
...
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





;<ff
Window Form1, 3, 0, 'TForm', 'Wiki editor:', $16CF0000, $10000, 0, 296, 91, 550, 409, Form1WinProc;
Window NONE, 0, 1, 'LISTBOX', 'Listbox', $508105C3, $200, 200, 0, 0, 120, 382, 0;
Window NONE, 2, 5, 'ASMEDIT', '', $50300124, $200, 100, 120, 0, 422, 382, 0;
;ff>
idEdit = 100
idShortcuts = 200

cEditorFontFace text 'FreshBold'


uglobal
  hAppPath dd ?

  hMainForm dd ?
  hMainMenu dd ?
  hMainToolbar dd ?

  hEditorFont dd ?

  hShortcuts dd ?
................................................................................
  hEditor dd ?

  hAccelerators dd ?
endg

iglobal
  property propIgnoreNext, 'IGNORENEXT'

  EditorTheme AETHEME $000000, $ffffff, $ffffff, $800000,               \
                      $e8e8e8, $000000, 16,      1,                      \
                      $000000, $ffff00,                                 \
                      procSyntax,  $c0c0c0, $c0c0c0                     ; syntax proc and colors.
endg


winproc Form1WinProc
begin

ondefault
................................................................................
onmessage WM_CLOSE
        stdcall OnExit, 0, 0
        clc
        return


onmessage FM_AFTERCREATE
locals
  .filename rb 512
  .fullname rb 512
  .ptrname  dd ?
endl

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

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


        lea     esi, [.filename]
        invoke  GetModuleFileName, 0, esi, 512
        lea     edi, [.fullname]
        lea     ecx, [.ptrname]
        invoke  GetFullPathName, esi, 512, edi, ecx
        mov     eax, [.ptrname]
        mov     byte [eax], 0
        stdcall StrDup, edi
        mov     [hAppPath], eax

        stdcall StrDup, [hAppPath]
        push    eax
        stdcall StrCat, eax, cDefaultShortcuts
        stdcall LoadShortcuts, eax
        stdcall StrDel ; from the stack

cDefaultShortcuts text 'wikipad.cfg'

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

        invoke  SendMessage, [hEditor], WM_SETFONT, [hEditorFont], TRUE
        invoke  SendMessage, [hEditor], AEM_SETTHEME, 0, EditorTheme

        clc
        return

endwp







proc procSyntax, .ptrLine, .ptrColors
begin
        pushad


























        mov     esi, [.ptrLine]
        mov     edi, [.ptrColors]
        mov     ecx, $100

        xor     ebx, ebx



.loop:
        lodsb



        cmp     al, '<'




        jne     @f




        mov     bl, 1

@@:

        mov     [edi], bl


        inc     edi




        cmp     al, '>'
        jne     @f







        mov     bl, 0



@@:
        loop    .loop








        popad
        return

endp





Changes to ShortcutEngine.asm.

3
4
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
...
309
310
311
312
313
314
315
316
317
318
319
320
321
322

323
324
325
326
327
328
329
330
  .hOpenTag    dd ?
  .hCloseTag   dd ?
  .HotKey      dd ?
ends


proc InsertShortcut, .ptrShortcut
  .beg dd ?
  .end dd ?
  .ins dd ?
begin
        push    esi
        mov     esi, [.ptrShortcut]

        lea     eax, [.beg]
        lea     ecx, [.end]
        invoke  SendMessage, [hEditor], EM_GETSEL, eax, ecx

        mov     eax, [.beg]
        cmp     eax, [.end]


        invoke  SendMessage, [hEditor], EM_SETSEL, [.end], [.end]

        stdcall StrLen, [esi+TShortcutItem.hCloseTag]
        mov     [.ins], eax
        stdcall StrLen, [esi+TShortcutItem.hOpenTag]
        add     [.ins], eax
................................................................................


uglobal
  file_buffer rb 1024
endg


proc LoadShortcuts, .ptrFileName
.count dd ?
begin
        xor     ebx, ebx

        stdcall DestroyShortcuts


        stdcall FileOpen, [.ptrFileName]
        jc      .error_load
        mov     ebx, eax

        stdcall FileRead, ebx, file_buffer, 4   ; how many records
        cmp     dword [file_buffer], 'wpSC'
        jne     .error_load








|
<
<




|
<
|

<
<
>







 







|






>
|







3
4
5
6
7
8
9
10


11
12
13
14
15

16
17


18
19
20
21
22
23
24
25
...
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
  .hOpenTag    dd ?
  .hCloseTag   dd ?
  .HotKey      dd ?
ends


proc InsertShortcut, .ptrShortcut
  .pos AEPOS


begin
        push    esi
        mov     esi, [.ptrShortcut]

        lea     eax, [.pos]

        invoke  SendMessage, [hEditor], AEM_GETPOS, eax, 0





        invoke  SendMessage, [hEditor], EM_SETSEL, [.end], [.end]

        stdcall StrLen, [esi+TShortcutItem.hCloseTag]
        mov     [.ins], eax
        stdcall StrLen, [esi+TShortcutItem.hOpenTag]
        add     [.ins], eax
................................................................................


uglobal
  file_buffer rb 1024
endg


proc LoadShortcuts, .hFileName
.count dd ?
begin
        xor     ebx, ebx

        stdcall DestroyShortcuts

        stdcall StrPtr, [.hFileName]
        stdcall FileOpen, eax
        jc      .error_load
        mov     ebx, eax

        stdcall FileRead, ebx, file_buffer, 4   ; how many records
        cmp     dword [file_buffer], 'wpSC'
        jne     .error_load

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
33
34
35
36

37
38
39
40
41
42
43
..
60
61
62
63
64
65
66


67
68
69
70
71
72
73

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/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 'giflib.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'

include 'dlgShortcuts.frm'
include 'MainForm.frm'
include 'ShortcutEngine.asm'


uglobal
  hInstance       dd 0  ; Instance handle for common use.
  hHeap           dd 0

  hIml            dd 0
  hImlGray        dd 0
................................................................................
        invoke  InitCommonControls      ;Ex, ComCtrlsFlags

        InitializeAll

        stdcall CreateForm, Form1, 0
        mov     [hMainForm], ebx



;----------------------------------------------
; Main message loop
;----------------------------------------------
Run:
        call    ProcessMessages
        jc      .terminate








>







 







>











>







 







>
>







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
35
36
37
38
39
40
41
42
43
44
45
46
..
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

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/splitter.inc'
include '%finc%/libs/asmedit/asmedit.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 'giflib.asm'
include '%finc%/libs/splitter.asm'
include '%finc%/libs/asmedit/asmedit.asm'

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

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

include 'dlgShortcuts.frm'
include 'MainForm.frm'
include 'ShortcutEngine.asm'
include 'arguments.asm'

uglobal
  hInstance       dd 0  ; Instance handle for common use.
  hHeap           dd 0

  hIml            dd 0
  hImlGray        dd 0
................................................................................
        invoke  InitCommonControls      ;Ex, ComCtrlsFlags

        InitializeAll

        stdcall CreateForm, Form1, 0
        mov     [hMainForm], ebx


        stdcall ParseCommandLine
;----------------------------------------------
; Main message loop
;----------------------------------------------
Run:
        call    ProcessMessages
        jc      .terminate

Changes to WikiPad.exe.

cannot compute difference between binary files

Changes to WikiPad.fpr.

cannot compute difference between binary files