Fresh IDE . Check-in [fb9af5561c]
Not logged in

This repository is a mirror!

The original is located on: https://fresh.flatassembler.net/fossil/repo/fresh
If you want to follow the project, please update your remote-url

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

Overview
Comment:Fixed the Linux port WaitForSystemEvents procedure that caused hands sometimes (there is a message in the queue, but the procedure does not return).

The mouse.asm library refactored to use interface/body syntax.

ZeroMouseMove procedure introduced. It generates mouse move events, without moving mouse actually.

Work on the TAsmEdit control. As a result changed a little the Win32 message processing (WM_PAINT processed with higher priority).

Work on the different GUI controls in order to make them work with the new interfaces.

Timelines: family | ancestors | descendants | both | NoCanvasGUI
Files: files | file ages | folders
SHA1:fb9af5561cac494b4cd0276b03451e61a8055e68
User & Date: johnfound 2019-04-16 10:40:45
Context
2019-04-19
12:58
Some work on the text caret and Linux expose events processing priority. check-in: 2d4d2404aa user: johnfound tags: NoCanvasGUI
2019-04-16
10:40
Fixed the Linux port WaitForSystemEvents procedure that caused hands sometimes (there is a message in the queue, but the procedure does not return).

The mouse.asm library refactored to use interface/body syntax.

ZeroMouseMove procedure introduced. It generates mouse move events, without moving mouse actually.

Work on the TAsmEdit control. As a result changed a little the Win32 message processing (WM_PAINT processed with higher priority).

Work on the different GUI controls in order to make them work with the new interfaces. check-in: fb9af5561c user: johnfound tags: NoCanvasGUI

2019-04-14
19:46
A little bit more simple code. check-in: 17dd2e2d8c user: johnfound tags: NoCanvasGUI
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to freshlib/graphics/KolibriOS/images.asm.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
;
;  Dependencies:
;
;  Notes:
;_________________________________________________________________________________________


struct TImage
  .width   dd ?  ; width in pixels.
  .height  dd ?  ; height in pixels.
  .pPixels dd ?  ; pointer to the pixel memory.
ends



body CreateImage
begin
        stc
        return
endp







<
<
<
<
<
<







9
10
11
12
13
14
15






16
17
18
19
20
21
22
;
;  Dependencies:
;
;  Notes:
;_________________________________________________________________________________________










body CreateImage
begin
        stc
        return
endp

Changes to freshlib/graphics/KolibriOS/text.asm.

882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951

.bpp_const db 0, 1, 8, 2, 4, 24, 8, 32

endp



; the colors must be pre-multiplied ARGB.

proc _BlendPixel, .dstColor, .srcColor
begin
        pushad

        movzx   ecx, byte [.srcColor+3]      ; As
        mov     ebx, $ff
        mov     esi, ebx

        sub     ebx, ecx                     ; 1 - As

        movzx   eax, byte [.dstColor+3]      ; Ad
        imul    ecx, esi
        mul     ebx
        add     eax, ecx
        adc     edx, 0
        div     esi

        mov     byte [esp+4*regEAX+3], al


        movzx   eax, byte [.dstColor]       ; Bd
        movzx   ecx, byte [.srcColor]       ; Bs

        imul    ecx, esi
        mul     ebx
        add     eax, ecx
        adc     edx, 0
        div     esi

        mov     byte [esp+4*regEAX], al



        movzx   eax, byte [.dstColor+1]       ; Gd
        movzx   ecx, byte [.srcColor+1]       ; Gs

        imul    ecx, esi
        mul     ebx
        add     eax, ecx
        adc     edx, 0
        div     esi

        mov     byte [esp+4*regEAX+1], al



        movzx   eax, byte [.dstColor+2]       ; Rd
        movzx   ecx, byte [.srcColor+2]       ; Rs

        imul    ecx, esi
        mul     ebx
        add     eax, ecx
        adc     edx, 0
        div     esi

        mov     byte [esp+4*regEAX+2], al


        popad
        return
endp







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
882
883
884
885
886
887
888
































































.bpp_const db 0, 1, 8, 2, 4, 24, 8, 32

endp


































































Changes to freshlib/gui/KolibriOS/mouse.asm.

9
10
11
12
13
14
15
16














17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
;
;  Dependencies:
;
;  Notes:
;_________________________________________________________________________________________


proc SetMouseCursor, .hCursor














begin
        return
endp



proc GetStockCursor, .index
begin
        return
endp


proc __MouseCapture, .hwnd
begin
        return
endp







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






|
<
<
<
<
<
<



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
;
;  Dependencies:
;
;  Notes:
;_________________________________________________________________________________________


body SetMouseCursor     ;, .hWindow, .hCursor
begin
        return
endp



body GetStockCursor     ;, .index
begin
        return
endp



body __MouseCapture     ;, .hwnd
begin
        return
endp



body ZeroMouseMove






begin
        return
endp

Changes to freshlib/gui/Linux/Main.asm.

81
82
83
84
85
86
87




88
89
90
91
92
93
94
...
108
109
110
111
112
113
114

115
116
117
118
119
120
121


body WaitForSystemEvent
.timeout lnx_timeval
.fd_set  rb 128
begin
        pushad





        lea     edi, [.fd_set]
        xor     eax, eax
        mov     ecx, 32
        rep stosd

        mov     [.timeout.tv_sec], eax
................................................................................
        xor     esi, esi
        lea     edi, [.timeout]
        int     80h

        test    eax, eax
        jz      .its_timeout


        clc
        popad
        return

.its_timeout:
        stc
        popad







>
>
>
>







 







>







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
...
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126


body WaitForSystemEvent
.timeout lnx_timeval
.fd_set  rb 128
begin
        pushad

        cinvoke XEventsQueued, [hApplicationDisplay], QueuedAfterFlush
        test    eax, eax
        jnz     .finish_ok

        lea     edi, [.fd_set]
        xor     eax, eax
        mov     ecx, 32
        rep stosd

        mov     [.timeout.tv_sec], eax
................................................................................
        xor     esi, esi
        lea     edi, [.timeout]
        int     80h

        test    eax, eax
        jz      .its_timeout

.finish_ok:
        clc
        popad
        return

.its_timeout:
        stc
        popad

Changes to freshlib/gui/Linux/mouse.asm.

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
...
101
102
103
104
105
106
107










DebugMsg "Mouse cursors destroyed."
        return
endp
end if


proc SetMouseCursor, .hWindow, .hCursor
begin
        push    eax ecx edx
        cinvoke XDefineCursor, [hApplicationDisplay], [.hWindow], [.hCursor]
        pop     edx ecx eax
        return
endp



proc GetStockCursor, .index
begin
        mov     eax, [.index]
        cmp     eax, mcCount
        jb      @f
        xor     eax, eax
@@:
        mov     eax, [StockCursors+4*eax]
        return
endp



proc __MouseCapture, .hwnd
begin
        push    eax ecx edx
        cmp     [.hwnd], 0
        je      .release

        cinvoke XGrabPointer, [hApplicationDisplay], [.hwnd], FALSE, PointerMotionMask or ButtonPressMask or ButtonReleaseMask, \
                              GrabModeAsync, GrabModeAsync, None, None, CurrentTime
................................................................................
        return

.release:
        cinvoke XUngrabPointer, [hApplicationDisplay], CurrentTime
        jmp     .finish
endp

















|









|












|







 







>
>
>
>
>
>
>
>
>
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
...
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116

DebugMsg "Mouse cursors destroyed."
        return
endp
end if


body SetMouseCursor     ;, .hWindow, .hCursor
begin
        push    eax ecx edx
        cinvoke XDefineCursor, [hApplicationDisplay], [.hWindow], [.hCursor]
        pop     edx ecx eax
        return
endp



body GetStockCursor     ;, .index
begin
        mov     eax, [.index]
        cmp     eax, mcCount
        jb      @f
        xor     eax, eax
@@:
        mov     eax, [StockCursors+4*eax]
        return
endp



body __MouseCapture ; .hwnd
begin
        push    eax ecx edx
        cmp     [.hwnd], 0
        je      .release

        cinvoke XGrabPointer, [hApplicationDisplay], [.hwnd], FALSE, PointerMotionMask or ButtonPressMask or ButtonReleaseMask, \
                              GrabModeAsync, GrabModeAsync, None, None, CurrentTime
................................................................................
        return

.release:
        cinvoke XUngrabPointer, [hApplicationDisplay], CurrentTime
        jmp     .finish
endp



body ZeroMouseMove
begin
        pushad
        cinvoke XWarpPointer, [hApplicationDisplay], None, None, 0, 0, 0, 0, 0, 0
        popad
        return
endp

Changes to freshlib/gui/SplitGrid.asm.

368
369
370
371
372
373
374

375
376
377
378
379
380
381
        test    edx, stNone
        jnz     .exit

        test    edx, stJustGap
        jnz     .next

        stdcall [DrawSplitter], edi, eax, edx, ebx


.next:
        call    _DoDrawSplitters  ; first
        call    _DoDrawSplitters  ; second

.exit:
        return







>







368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
        test    edx, stNone
        jnz     .exit

        test    edx, stJustGap
        jnz     .next

        stdcall [DrawSplitter], edi, eax, edx, ebx


.next:
        call    _DoDrawSplitters  ; first
        call    _DoDrawSplitters  ; second

.exit:
        return

Changes to freshlib/gui/TAsmEdit.asm.

246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261

262
263
264
265
266
267
268
269
270
271
272


273
274
275
276
277
278
279
280
281
282



283
284
285
286
287
288
289
290
291
292

293





294
295
296
297
298
299
300
....
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
....
2629
2630
2631
2632
2633
2634
2635

2636
2637
2638
2639
2640
2641
2642
....
2663
2664
2665
2666
2667
2668
2669


2670
2671
2672
2673
2674
2675
2676
....
2678
2679
2680
2681
2682
2683
2684

2685
2686
2687
2688
2689
2690
2691
....
2710
2711
2712
2713
2714
2715
2716


2717
2718
2719
2720
2721
2722
2723

  method .EventScroll, .direction, .command, .value
  method .EventKeyPress, .utf8, .scancode, .kbdState
  method .EventButtonPress, .button, .kbdState, .x, .y
  method .EventButtonRelease, .button, .kbdState, .x, .y
  method .EventMouseMove, .x, .y, .kbdState

  method

endobj


method TAsmEdit.EventMouseMove   ;, .x, .y, .kbdState
begin
        pushad
        mov     esi, [.self]

        cmp     [esi+TAsmEdit._drag_button], mbLeft
        jne     .finish

        xor     ecx, ecx

        exec    esi, TAsmEdit:SelChangeBegin

        mov     eax, [.x]
        sub     eax, [esi+TAsmEdit._left_margin]
        cdq
        idiv    [esi+TAsmEdit._font_width]



        get     ebx, esi, TAsmEdit:PosX
        add     eax, ebx
        cmovs   eax, ecx
        mov     [esi+TAsmEdit._caretPos.x], eax
        mov     [esi+TAsmEdit._selEnd.x], eax

        mov     eax, [.y]
        cdq
        idiv    [esi+TAsmEdit._font_height]



        get     ebx, esi, TAsmEdit:PosY
        add     eax, ebx
        cmovs   eax, ecx
        mov     [esi+TAsmEdit._caretPos.y], eax
        mov     [esi+TAsmEdit._selEnd.y], eax

        exec    esi, TAsmEdit:ScrollToCaretX
        exec    esi, TAsmEdit:ScrollToCaretY

        exec    esi, TAsmEdit:UpdateCaretPos

        exec    esi, TAsmEdit:SelChangeEnd






.finish:
        popad
        return
endp


................................................................................
begin
        inherited [.parent]

        pushad

        mov     edi, [.self]

        mov     [edi+TAsmEdit._cursor], mcText
        mov     [edi+TAsmEdit.__want_focus], TRUE

        mov     [edi+TAsmEdit._options], aeoDefault

        stdcall GetFontMetrics, [ASM.Font]

        mov     [edi+TAsmEdit._font_height], eax
................................................................................

method TAsmEdit.ScrollToCaretX
begin
        pushad

        mov     esi, [.self]
        xor     ecx, ecx


        mov     eax, [esi+TAsmEdit._width]
        sub     eax, [esi+TAsmEdit._left_margin]
        xor     edx, edx
        div     [esi+TAsmEdit._font_width]

        dec     eax
................................................................................
        sub     eax, edi
        add     edx, eax
        cmovs   edx, ecx

        set     esi, TAsmEdit:PosX, edx
        exec    esi, TAsmEdit:RectChanged2, ecx



.finish:
        exec    esi, TAsmEdit:UpdateCaretPos
        popad
        return
endp


................................................................................

method TAsmEdit.ScrollToCaretY
begin
        pushad

        mov     esi, [.self]
        xor     ecx, ecx


        mov     eax, [esi+TAsmEdit._height]
        xor     edx, edx
        div     [esi+TAsmEdit._font_height]

        dec     eax
        mov     ebx, eax  ; max line
................................................................................
.do_scroll:
        sub     eax, edi
        add     edx, eax
        cmovs   edx, ecx

        set     esi, TAsmEdit:PosY, edx
        exec    esi, TAsmEdit:RectChanged2, ecx



.finish:
        exec    esi, TAsmEdit:UpdateCaretPos
        popad
        return
endp








<
<







>











>
>










>
>
>






|
|

|
>
|
>
>
>
>
>







 







|







 







>







 







>
>







 







>







 







>
>







246
247
248
249
250
251
252


253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
....
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
....
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
....
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
....
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
....
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739

  method .EventScroll, .direction, .command, .value
  method .EventKeyPress, .utf8, .scancode, .kbdState
  method .EventButtonPress, .button, .kbdState, .x, .y
  method .EventButtonRelease, .button, .kbdState, .x, .y
  method .EventMouseMove, .x, .y, .kbdState



endobj


method TAsmEdit.EventMouseMove   ;, .x, .y, .kbdState
begin
        pushad
        mov     esi, [.self]

        cmp     [esi+TAsmEdit._drag_button], mbLeft
        jne     .finish

        xor     ecx, ecx

        exec    esi, TAsmEdit:SelChangeBegin

        mov     eax, [.x]
        sub     eax, [esi+TAsmEdit._left_margin]
        cdq
        idiv    [esi+TAsmEdit._font_width]
        shl     edx, 1
        sbb     eax, 0

        get     ebx, esi, TAsmEdit:PosX
        add     eax, ebx
        cmovs   eax, ecx
        mov     [esi+TAsmEdit._caretPos.x], eax
        mov     [esi+TAsmEdit._selEnd.x], eax

        mov     eax, [.y]
        cdq
        idiv    [esi+TAsmEdit._font_height]
        shl     edx, 1
        sbb     eax, 0

        get     ebx, esi, TAsmEdit:PosY
        add     eax, ebx
        cmovs   eax, ecx
        mov     [esi+TAsmEdit._caretPos.y], eax
        mov     [esi+TAsmEdit._selEnd.y], eax

        exec    esi, TAsmEdit:UpdateCaretPos
        exec    esi, TAsmEdit:SelChangeEnd

        exec    esi, TAsmEdit:ScrollToCaretX
        mov     ecx, eax
        exec    esi, TAsmEdit:ScrollToCaretY
        or      ecx, eax
        jz      .finish

; repeat the scroll if the mouse is outside the  window!
        stdcall ZeroMouseMove

.finish:
        popad
        return
endp


................................................................................
begin
        inherited [.parent]

        pushad

        mov     edi, [.self]

        mov     [edi+TAsmEdit._cursor], mcArrow;mcText
        mov     [edi+TAsmEdit.__want_focus], TRUE

        mov     [edi+TAsmEdit._options], aeoDefault

        stdcall GetFontMetrics, [ASM.Font]

        mov     [edi+TAsmEdit._font_height], eax
................................................................................

method TAsmEdit.ScrollToCaretX
begin
        pushad

        mov     esi, [.self]
        xor     ecx, ecx
        mov     [esp+4*regEAX], ecx

        mov     eax, [esi+TAsmEdit._width]
        sub     eax, [esi+TAsmEdit._left_margin]
        xor     edx, edx
        div     [esi+TAsmEdit._font_width]

        dec     eax
................................................................................
        sub     eax, edi
        add     edx, eax
        cmovs   edx, ecx

        set     esi, TAsmEdit:PosX, edx
        exec    esi, TAsmEdit:RectChanged2, ecx

        inc     dword [esp+4*regEAX]

.finish:
        exec    esi, TAsmEdit:UpdateCaretPos
        popad
        return
endp


................................................................................

method TAsmEdit.ScrollToCaretY
begin
        pushad

        mov     esi, [.self]
        xor     ecx, ecx
        mov     [esp+4*regEAX], ecx

        mov     eax, [esi+TAsmEdit._height]
        xor     edx, edx
        div     [esi+TAsmEdit._font_height]

        dec     eax
        mov     ebx, eax  ; max line
................................................................................
.do_scroll:
        sub     eax, edi
        add     edx, eax
        cmovs   edx, ecx

        set     esi, TAsmEdit:PosY, edx
        exec    esi, TAsmEdit:RectChanged2, ecx

        inc     dword [esp+4*regEAX]

.finish:
        exec    esi, TAsmEdit:UpdateCaretPos
        popad
        return
endp

Changes to freshlib/gui/TButton.asm.

254
255
256
257
258
259
260

261
262
263
264
265
266
267
endp



method TButton.UpdateAction
begin
        exec    [.self], TButton:_RenderView

        return
endp




method TButton._RenderView







>







254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
endp



method TButton.UpdateAction
begin
        exec    [.self], TButton:_RenderView
        exec    [.self], TWindow:RectChanged2, 0
        return
endp




method TButton._RenderView

Changes to freshlib/gui/TCheckbox.asm.

45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
..
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
...
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
...
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
...
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
...
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
  method .GetChecked
  method .SetChecked, .value

  ; system events methods

  method .Create, .Parent

  method .Paint
  method .UpdateAction, .action



  method .EventMouseEnter
  method .EventMouseLeave

  method .EventButtonPress, .button, .kbdState, .x, .y
  method .EventButtonRelease, .button, .kbdState, .x, .y

................................................................................
        return
endp





method TCheckbox.Paint

 .bounds TBounds
 .canvas dd ?

 .caption dd ?
 .enabled dd ?
 .checked dd ?
................................................................................
        popad
        return
endp


method TCheckbox.UpdateAction
begin

        return
endp



method TCheckbox.EventMouseEnter
begin
        mov     eax, [.self]
        mov     [eax+TCheckbox._state], cbsHovered
;        exec    eax, TCheckbox:Refresh

        inherited
        return
endp




method TCheckbox.EventMouseLeave
begin
        mov     eax, [.self]

        mov     [eax+TCheckbox._state], cbsNeutral
;        exec    eax, TCheckbox:Refresh

        inherited
        return
endp



................................................................................
        get     eax, [.self], TCheckbox:OnClick
        test    eax, eax
        jz      .finish

        stdcall eax, [.self], [.button]

.finish:
;        exec    [.self], TCheckbox:Refresh
        pop     eax
        return
endp



method TCheckbox.EventButtonRelease
begin
        pushad

        mov     esi, [.self]
        mov     [esi+TCheckbox._state], cbsHovered
;        exec    esi, TCheckbox:Refresh

        popad
        return
endp



................................................................................
        mov     ecx, [.self]
        cmp     [ecx+TCheckbox._state], cbsPressed
        je      .finish

        exec    ecx, TWindow:EventButtonPress, mbLeft, [.kbdState], 0, 0

        mov     [ecx+TCheckbox._state], cbsPressed
;        exec    ecx, TWindow:Refresh

.finish:
        inherited [.utf8], [.scancode], [.kbdState]
        pop     ecx
        return
endp




method TCheckbox.EventKeyRelease
begin
        push    ecx

        mov     ecx, [.self]
        mov     [ecx+TCheckbox._state], cbsNeutral

;        exec    ecx, TWindow:Refresh
        pop     ecx

        return
endp



method TCheckbox.GetChecked
begin
................................................................................
        cmp     [ecx+TCheckbox.__action], 0
        je      .action_ok

        set     [ecx+TCheckbox.__action], TAction:Checked, eax

.action_ok:
        mov     [ecx+TCheckbox._checked], eax
;        exec    ecx, TWindow:Refresh

.finish:
        popad
        return
endp




endmodule







|

<
<







 







|







 







|









|













|







 







|












|







 







|













<


<
|

<







 







|










45
46
47
48
49
50
51
52
53


54
55
56
57
58
59
60
..
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
...
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
...
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
...
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324

325
326

327
328

329
330
331
332
333
334
335
...
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
  method .GetChecked
  method .SetChecked, .value

  ; system events methods

  method .Create, .Parent

  method .__RenderView
  method .UpdateAction, .action



  method .EventMouseEnter
  method .EventMouseLeave

  method .EventButtonPress, .button, .kbdState, .x, .y
  method .EventButtonRelease, .button, .kbdState, .x, .y

................................................................................
        return
endp





method TCheckbox.__RenderView

 .bounds TBounds
 .canvas dd ?

 .caption dd ?
 .enabled dd ?
 .checked dd ?
................................................................................
        popad
        return
endp


method TCheckbox.UpdateAction
begin
        exec    [.self], TWindow:RectChanged2, 0
        return
endp



method TCheckbox.EventMouseEnter
begin
        mov     eax, [.self]
        mov     [eax+TCheckbox._state], cbsHovered
        exec    eax, TCheckbox:RectChanged2, 0

        inherited
        return
endp




method TCheckbox.EventMouseLeave
begin
        mov     eax, [.self]

        mov     [eax+TCheckbox._state], cbsNeutral
        exec    eax, TCheckbox:RectChanged2, 0

        inherited
        return
endp



................................................................................
        get     eax, [.self], TCheckbox:OnClick
        test    eax, eax
        jz      .finish

        stdcall eax, [.self], [.button]

.finish:
        exec    [.self], TCheckbox:RectChanged2, 0
        pop     eax
        return
endp



method TCheckbox.EventButtonRelease
begin
        pushad

        mov     esi, [.self]
        mov     [esi+TCheckbox._state], cbsHovered
        exec    esi, TCheckbox:RectChanged2, 0

        popad
        return
endp



................................................................................
        mov     ecx, [.self]
        cmp     [ecx+TCheckbox._state], cbsPressed
        je      .finish

        exec    ecx, TWindow:EventButtonPress, mbLeft, [.kbdState], 0, 0

        mov     [ecx+TCheckbox._state], cbsPressed
        exec    ecx, TCheckbox:RectChanged2, 0

.finish:
        inherited [.utf8], [.scancode], [.kbdState]
        pop     ecx
        return
endp




method TCheckbox.EventKeyRelease
begin
        push    ecx

        mov     ecx, [.self]
        mov     [ecx+TCheckbox._state], cbsNeutral

        exec    ecx, TCheckbox:RectChanged2, 0
        pop     ecx

        return
endp



method TCheckbox.GetChecked
begin
................................................................................
        cmp     [ecx+TCheckbox.__action], 0
        je      .action_ok

        set     [ecx+TCheckbox.__action], TAction:Checked, eax

.action_ok:
        mov     [ecx+TCheckbox._checked], eax
        exec    ecx, TCheckbox:RectChanged2, 0

.finish:
        popad
        return
endp




endmodule

Changes to freshlib/gui/TMenu.asm.

40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
...
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
...
664
665
666
667
668
669
670

671
672
673
674
675
676
677
...
737
738
739
740
741
742
743




744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762

  method .SetSelected, .value
  method .SetItems, .menu_template
  method .SetVisible, .value

  method .AddItem, .Type, .Item

  method .Paint

  method .Create, .Parent
  method .Destroy

  method .Show, .parent, .x, .y

  method .EventButtonPress, .button, .kbdState, .x, .y
................................................................................
        mov     [__ActiveMenu], ecx
        jmp     .finish

endp



method TMenu.Paint

.bounds TBounds

.y    dd ?
.ytxt dd ?
.xTxt dd ?
.clTxt dd ?
................................................................................
        mov     [esi+TMenu._selected], 0

        mov     [esi+TMenu.__caller], edi
        mov     [__ActiveMenu], esi

        set     esi, TMenu:Visible, TRUE


;        exec    esi, TMenu:Refresh

        popad
        return
endp


................................................................................

        add     ebx, [edi+TMenuItem.height]
        add     edi, sizeof.TMenuItem
        jmp     .loop

.height_ok:





        cmp     [edi+TMenuItem.type], mitSubmenu
        jne     .hide_old

        get     eax, [edi+TMenuItem.item], TMenu:Enabled
        test    eax, eax
        jz      .finish

        mov     eax, [esi+TMenu._width]
        sub     eax, [GUI.menuIconMargin]

        exec    [edi+TMenuItem.item], TMenu:Show, esi, eax, ebx

        jmp     .finish

.hide_old:
        cmp     [__ActiveMenu], esi
        je      .finish

        set     [__ActiveMenu], TWindow:Visible, FALSE







|







 







|







 







>







 







>
>
>
>











<







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
...
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
...
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
...
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759

760
761
762
763
764
765
766

  method .SetSelected, .value
  method .SetItems, .menu_template
  method .SetVisible, .value

  method .AddItem, .Type, .Item

  method .__RenderView

  method .Create, .Parent
  method .Destroy

  method .Show, .parent, .x, .y

  method .EventButtonPress, .button, .kbdState, .x, .y
................................................................................
        mov     [__ActiveMenu], ecx
        jmp     .finish

endp



method TMenu.__RenderView

.bounds TBounds

.y    dd ?
.ytxt dd ?
.xTxt dd ?
.clTxt dd ?
................................................................................
        mov     [esi+TMenu._selected], 0

        mov     [esi+TMenu.__caller], edi
        mov     [__ActiveMenu], esi

        set     esi, TMenu:Visible, TRUE

        stdcall _RefreshWindowRect, [esi+TWindow.handle], 0, 0, [esi+TWindow._width], [esi+TWindow._height]
;        exec    esi, TMenu:Refresh

        popad
        return
endp


................................................................................

        add     ebx, [edi+TMenuItem.height]
        add     edi, sizeof.TMenuItem
        jmp     .loop

.height_ok:

        mov     eax, ebx
        add     eax, [edi+TMenuItem.height]
        exec    esi, TMenu:RectChanged2, 0;, ebx, [esi+TWindow._width], eax

        cmp     [edi+TMenuItem.type], mitSubmenu
        jne     .hide_old

        get     eax, [edi+TMenuItem.item], TMenu:Enabled
        test    eax, eax
        jz      .finish

        mov     eax, [esi+TMenu._width]
        sub     eax, [GUI.menuIconMargin]

        exec    [edi+TMenuItem.item], TMenu:Show, esi, eax, ebx

        jmp     .finish

.hide_old:
        cmp     [__ActiveMenu], esi
        je      .finish

        set     [__ActiveMenu], TWindow:Visible, FALSE

Changes to freshlib/gui/TScrollable.asm.

140
141
142
143
144
145
146


147
148
149
150
151
152
153

        mov     edx, TScrollable._scrX
        mov     ecx, TScrollable._scrY
        cmp     [.param], TScrollable.PosX
        cmovne  edx, ecx

        mov     [esi+edx+TScroller.pos], eax



        popad
        return
endp

;_________________________________________________________________________________________








>
>







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

        mov     edx, TScrollable._scrX
        mov     ecx, TScrollable._scrY
        cmp     [.param], TScrollable.PosX
        cmovne  edx, ecx

        mov     [esi+edx+TScroller.pos], eax

        exec    esi, TWindow:RectChanged2, 0

        popad
        return
endp

;_________________________________________________________________________________________

Changes to freshlib/gui/TTreeView.asm.

609
610
611
612
613
614
615


616
617
618
619
620
621
622
...
873
874
875
876
877
878
879

880
881
882
883
884
885
886
...
910
911
912
913
914
915
916



917
918
919
920
921
922
923
924

.pgdn:
        get     edx, esi, TTreeView:PageY
        dec     edx


.move_down:


        mov     edi, [esi+TTreeView._index]
        mov     ebx, [esi+TTreeView._focused]

        add     ebx, edx

        cmp     ebx, [edi+TArray.count]
        jb      .posok
................................................................................

        and     [edi+TTreeViewItem.state], ebx
        add     edi, sizeof.TTreeViewItem
        jmp     .loop


.finish:

        popad
        return
endp




................................................................................
        mov     eax, [esi+TTreeView._on_focused_change]
        test    eax, eax
        jz      .finish

        stdcall eax, esi, ebx           ; interface TTreeView.OnFocusItem, .pTreeView, .pItem

.finish:



        popad
        return
endp




endmodule







>
>







 







>







 







>
>
>








609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
...
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
...
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930

.pgdn:
        get     edx, esi, TTreeView:PageY
        dec     edx


.move_down:
        OutputValue "Move down distance:", edx, 10, -1

        mov     edi, [esi+TTreeView._index]
        mov     ebx, [esi+TTreeView._focused]

        add     ebx, edx

        cmp     ebx, [edi+TArray.count]
        jb      .posok
................................................................................

        and     [edi+TTreeViewItem.state], ebx
        add     edi, sizeof.TTreeViewItem
        jmp     .loop


.finish:
        and     [esi+TTreeView._canvas_valid], 0
        popad
        return
endp




................................................................................
        mov     eax, [esi+TTreeView._on_focused_change]
        test    eax, eax
        jz      .finish

        stdcall eax, esi, ebx           ; interface TTreeView.OnFocusItem, .pTreeView, .pItem

.finish:
        mov     [esi+TTreeView._canvas_valid], 0
        exec    esi, TWindow:RectChanged2, 0

        popad
        return
endp




endmodule

Changes to freshlib/gui/Win32/Main.asm.

20
21
22
23
24
25
26


27

28


29
30
31
32
33
34
35
36
37
38
39
40
41
42
..
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
..
74
75
76
77
78
79
80



81
82
83
84
85
86
87
.msg MSG
.msg2 MSG
begin
        push    ecx edx esi edi

.msgloop:
        lea     esi, [.msg]


        xor     eax, eax




        invoke  PeekMessageW, esi, eax, eax, eax, PM_REMOVE
        test    eax, eax
        jz      .exitok

        cmp     [.msg.message], WM_QUIT
        je      .terminate

        cmp     [.msg.message], WM_TIMER
        jne     .timer_ok

        xor     eax, eax
        stdcall __TimerProc, eax, eax, eax, eax
        jmp     .msgloop

................................................................................
        jne     .move_ok

.loop:
        invoke  PeekMessageW, esi, [.msg.hwnd], WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE
        test    eax, eax
        jnz     .loop
        jmp     .processit


.move_ok:
        cmp     [.msg.message], WM_KEYDOWN
        jne     .processit

; cleaning the message queue from the keyboard autorepeat messages.

................................................................................
        jne     .processit

        invoke  PeekMessageW, edi, [.msg.hwnd], WM_KEYDOWN, WM_KEYDOWN, PM_REMOVE
        jmp     .loop2


.processit:



        stdcall __ProcessOneSystemEvent, [.msg.hwnd], [.msg.message], [.msg.wParam], [.msg.lParam]
        jnc     .msgloop

        invoke  DefWindowProcW, [.msg.hwnd], [.msg.message], [.msg.wParam], [.msg.lParam]

;        invoke  TranslateMessage, esi
;        invoke  DispatchMessageW, esi







>
>
|
>

>
>




<
<
<







 







<







 







>
>
>







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
..
47
48
49
50
51
52
53

54
55
56
57
58
59
60
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
.msg MSG
.msg2 MSG
begin
        push    ecx edx esi edi

.msgloop:
        lea     esi, [.msg]

        invoke  PeekMessageW, esi, [.msg.hwnd], WM_PAINT, WM_PAINT, PM_REMOVE
        test    eax, eax
        jnz     .processit

; eax is always 0 here because of the previous call...
;        xor     eax, eax
        invoke  PeekMessageW, esi, eax, eax, eax, PM_REMOVE
        test    eax, eax
        jz      .exitok




        cmp     [.msg.message], WM_TIMER
        jne     .timer_ok

        xor     eax, eax
        stdcall __TimerProc, eax, eax, eax, eax
        jmp     .msgloop

................................................................................
        jne     .move_ok

.loop:
        invoke  PeekMessageW, esi, [.msg.hwnd], WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE
        test    eax, eax
        jnz     .loop
        jmp     .processit


.move_ok:
        cmp     [.msg.message], WM_KEYDOWN
        jne     .processit

; cleaning the message queue from the keyboard autorepeat messages.

................................................................................
        jne     .processit

        invoke  PeekMessageW, edi, [.msg.hwnd], WM_KEYDOWN, WM_KEYDOWN, PM_REMOVE
        jmp     .loop2


.processit:
        cmp     [.msg.message], WM_QUIT
        je      .terminate

        stdcall __ProcessOneSystemEvent, [.msg.hwnd], [.msg.message], [.msg.wParam], [.msg.lParam]
        jnc     .msgloop

        invoke  DefWindowProcW, [.msg.hwnd], [.msg.message], [.msg.wParam], [.msg.lParam]

;        invoke  TranslateMessage, esi
;        invoke  DispatchMessageW, esi

Changes to freshlib/gui/Win32/mouse.asm.

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
..
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
..
57
58
59
60
61
62
63















;
;  Notes:
;_________________________________________________________________________________________

; ToDo: Arbitrary mouse cursors, B&W for the begining.


proc SetMouseCursor, .hWindow, .hCursor
begin
        push    ecx edx
        invoke  SetCursor, [.hCursor]
        pop     edx ecx
        return
endp



proc GetStockCursor, .index
begin
        push    ecx edx
        mov     eax, [.index]
        cmp     eax, mcCount
        jb      @f
        xor     eax, eax
@@:
................................................................................

if used _cursors
  _cursors dw IDC_ARROW, IDC_IBEAM, IDC_CROSS, IDC_SIZEWE, IDC_SIZENS, IDC_SIZENWSE, IDC_SIZENESW, IDC_WAIT, IDC_HAND, IDC_HAND, IDC_ARROW
end if



proc __MouseCapture, .hwnd
begin
        push    eax ecx edx
        cmp     [.hwnd], 0
        je      .release

        invoke  SetCapture, [.hwnd]

................................................................................
        pop     edx ecx eax
        return

.release:
        invoke  ReleaseCapture
        jmp     .finish
endp






















|









|







 







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
..
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
..
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
;
;  Notes:
;_________________________________________________________________________________________

; ToDo: Arbitrary mouse cursors, B&W for the begining.


body SetMouseCursor     ;, .hWindow, .hCursor
begin
        push    ecx edx
        invoke  SetCursor, [.hCursor]
        pop     edx ecx
        return
endp



body GetStockCursor     ;, .index
begin
        push    ecx edx
        mov     eax, [.index]
        cmp     eax, mcCount
        jb      @f
        xor     eax, eax
@@:
................................................................................

if used _cursors
  _cursors dw IDC_ARROW, IDC_IBEAM, IDC_CROSS, IDC_SIZEWE, IDC_SIZENS, IDC_SIZENWSE, IDC_SIZENESW, IDC_WAIT, IDC_HAND, IDC_HAND, IDC_ARROW
end if



body __MouseCapture     ;, .hwnd
begin
        push    eax ecx edx
        cmp     [.hwnd], 0
        je      .release

        invoke  SetCapture, [.hwnd]

................................................................................
        pop     edx ecx eax
        return

.release:
        invoke  ReleaseCapture
        jmp     .finish
endp


body ZeroMouseMove
.point POINT
begin
        pushad

        lea     eax, [.point]
        invoke  GetCursorPos, eax
        invoke  SetCursorPos, [.point.x], [.point.y]

        popad
        return
endp

Changes to freshlib/gui/Win32/windows.asm.

220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
...
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256

;; WAY 1 - direct paint on the window surface, without sending any messages.
;
;        invoke  GetDC, [.hwnd]
;        mov     ebx, eax
;
;        stdcall _GetWindowStruct, [.hwnd]
;        get     eax, eax, TWindow:ImgScreen
;
;        stdcall DrawImageRect, ebx, eax, [.x], [.y], [.x], [.y], [.width], [.height]
;
;        invoke  ReleaseDC, [.hwnd], ebx

; Needed for WAY2 and WAY3

................................................................................
        mov     [.rect.bottom], ecx

        lea     eax, [.rect]
        xor     ecx, ecx

;; WAY2 - generates messages before returning.
;
;        invoke  RedrawWindow, [.hwnd], eax, ecx, RDW_UPDATENOW or RDW_INVALIDATE or RDW_NOERASE

; WAY3 - returns immediately and posts messages to the queue.
; In the real Windows, on intensive changes it delays the update and that can be unwanted.
;
        invoke  InvalidateRect, [.hwnd], eax, ecx

        pop     ebx edx ecx eax







|







 







|







220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
...
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256

;; WAY 1 - direct paint on the window surface, without sending any messages.
;
;        invoke  GetDC, [.hwnd]
;        mov     ebx, eax
;
;        stdcall _GetWindowStruct, [.hwnd]
;        get     eax, eax, TWindow:Screen
;
;        stdcall DrawImageRect, ebx, eax, [.x], [.y], [.x], [.y], [.width], [.height]
;
;        invoke  ReleaseDC, [.hwnd], ebx

; Needed for WAY2 and WAY3

................................................................................
        mov     [.rect.bottom], ecx

        lea     eax, [.rect]
        xor     ecx, ecx

;; WAY2 - generates messages before returning.
;
;        invoke  RedrawWindow, [.hwnd], eax, ecx, RDW_INVALIDATE or RDW_NOERASE or RDW_UPDATENOW

; WAY3 - returns immediately and posts messages to the queue.
; In the real Windows, on intensive changes it delays the update and that can be unwanted.
;
        invoke  InvalidateRect, [.hwnd], eax, ecx

        pop     ebx edx ecx eax

Changes to freshlib/gui/all.asm.

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
include 'TImageLabel.asm'
include 'TMenu.asm'
include 'TProgressbar.asm'
include 'TScrollWindow.asm'
include 'TScrollable.asm'
include 'TTreeView.asm'
;include 'TGrid.asm'

include 'TAsmEdit.asm'


include 'dialogs.asm'
include 'SplitGrid.asm'


; OS independent main procedures.
include 'Main.asm'







<
<
<







46
47
48
49
50
51
52



53
54
55
56
57
58
59
include 'TImageLabel.asm'
include 'TMenu.asm'
include 'TProgressbar.asm'
include 'TScrollWindow.asm'
include 'TScrollable.asm'
include 'TTreeView.asm'
;include 'TGrid.asm'




include 'dialogs.asm'
include 'SplitGrid.asm'


; OS independent main procedures.
include 'Main.asm'

Changes to freshlib/gui/dialogs.asm.

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
   getfile _DlgIconError,       '%lib%/gui/images/error.png'
   getfile _DlgIconInformation, '%lib%/gui/images/information.png'
   getfile _DlgIconQuestion,    '%lib%/gui/images/question.png'
   getfile _DlgIconWarning,     '%lib%/gui/images/warning.png'

   if used _CommonDialogTemplate
    _CommonDialogTemplate:
        ObjTemplate  tfParent or tfEnd, TForm, frmCommonDialog,  x = 200, y = 100, width = 480, height = 100, border = borderModal
           ObjTemplate tfChild, TImageLabel, .imgIcon, x = 4, y = 4, width = 70, height = 70, Visible = TRUE, ImageAlign = iaCenter or iaMiddle
           ObjTemplate tfChild, TLabel,  .LblText,   x = 74, y = 4, width = 10, height = 10, TextAlign = dtfAlignLeft or dtfAlignMiddle or dtfWordWrap or dtfCRLF, Visible = TRUE

           ObjTemplate tfChild, TButton, .btnOK,     x = 0, y = 0, width = 64, height = 24, TextAlign = dtfAlignCenter  or dtfAlignMiddle, Caption = 'OK',     ModalResult = mrOK
           ObjTemplate tfChild, TButton, .btnCancel, x = 0, y = 0, width = 64, height = 24, TextAlign = dtfAlignCenter  or dtfAlignMiddle, Caption = 'Cancel', ModalResult = mrCancel
           ObjTemplate tfChild, TButton, .btnAbort,  x = 0, y = 0, width = 64, height = 24, TextAlign = dtfAlignCenter  or dtfAlignMiddle, Caption = 'Abort',  ModalResult = mrAbort
           ObjTemplate tfChild, TButton, .btnRetry,  x = 0, y = 0, width = 64, height = 24, TextAlign = dtfAlignCenter  or dtfAlignMiddle, Caption = 'Retry',  ModalResult = mrRetry







|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
   getfile _DlgIconError,       '%lib%/gui/images/error.png'
   getfile _DlgIconInformation, '%lib%/gui/images/information.png'
   getfile _DlgIconQuestion,    '%lib%/gui/images/question.png'
   getfile _DlgIconWarning,     '%lib%/gui/images/warning.png'

   if used _CommonDialogTemplate
    _CommonDialogTemplate:
        ObjTemplate  tfParent or tfEnd, TForm, frmCommonDialog,  width = 480, height = 100, border = borderModal
           ObjTemplate tfChild, TImageLabel, .imgIcon, x = 4, y = 4, width = 70, height = 70, Visible = TRUE, ImageAlign = iaCenter or iaMiddle
           ObjTemplate tfChild, TLabel,  .LblText,   x = 74, y = 4, width = 10, height = 10, TextAlign = dtfAlignLeft or dtfAlignMiddle or dtfWordWrap or dtfCRLF, Visible = TRUE

           ObjTemplate tfChild, TButton, .btnOK,     x = 0, y = 0, width = 64, height = 24, TextAlign = dtfAlignCenter  or dtfAlignMiddle, Caption = 'OK',     ModalResult = mrOK
           ObjTemplate tfChild, TButton, .btnCancel, x = 0, y = 0, width = 64, height = 24, TextAlign = dtfAlignCenter  or dtfAlignMiddle, Caption = 'Cancel', ModalResult = mrCancel
           ObjTemplate tfChild, TButton, .btnAbort,  x = 0, y = 0, width = 64, height = 24, TextAlign = dtfAlignCenter  or dtfAlignMiddle, Caption = 'Abort',  ModalResult = mrAbort
           ObjTemplate tfChild, TButton, .btnRetry,  x = 0, y = 0, width = 64, height = 24, TextAlign = dtfAlignCenter  or dtfAlignMiddle, Caption = 'Retry',  ModalResult = mrRetry

Changes to freshlib/gui/mouse.asm.

24
25
26
27
28
29
30



















31
32
33
34
35
36
37
mcHand      = 8
mcDragHand  = 9
mcPencil    = 10


mcCount = 11






















proc SetMouseCapture, .window
begin
        pushad

        xor     edi, edi







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







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
mcHand      = 8
mcDragHand  = 9
mcPencil    = 10


mcCount = 11


; Captures the mouse to the given window.

interface __MouseCapture, .hwnd

; Sets a mouse cursor for the given window.

interface SetMouseCursor, .hWindow, .hCursor

; Returns a stock cursor defined by mcXXXXX constants.

interface GetStockCursor, .index


; This procedure does not actually moves the mouse pointer, but generates all events the same way it was moved.
; Useful for making automatic repeat of different things controlled by the mouse move. For example dragging
; objects with window area auto-scrolling when the pointer lieves the window area.

interface ZeroMouseMove


proc SetMouseCapture, .window
begin
        pushad

        xor     edi, edi

Changes to freshlib/imports/Linux/libX11.inc.

464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
        XUnmapWindow                            ,<NONE>,                                                'XUnmapWindow',                                 \
        XUnregisterIMInstantiateCallback        ,<NONE>,                                                'XUnregisterIMInstantiateCallback',             \
        XUnsetICFocus                           ,<NONE>,                                                'XUnsetICFocus',                                \
        XVaCreateNestedList                     ,<NONE>,                                                'XVaCreateNestedList',                          \
        XVendorRelease                          ,<NONE>,                                                'XVendorRelease',                               \
        XVisualIDFromVisual                     ,<NONE>,                                                'XVisualIDFromVisual',                          \
        XWMGeometry                             ,<NONE>,                                                'XWMGeometry',                                  \
        XWarpPointer                            ,<NONE>,                                                'XWarpPointer',                                 \
        XWhitePixel                             ,<NONE>,                                                'XWhitePixel',                                  \
        XWhitePixelOfScreen                     ,<NONE>,                                                'XWhitePixelOfScreen',                          \
        XWidthMMOfScreen                        ,<NONE>,                                                'XWidthMMOfScreen',                             \
        XWidthOfScreen                          ,<NONE>,                                                'XWidthOfScreen',                               \
        XWindowEvent                            ,<.display, .hwin, .event_mask, .pEvent>,               'XWindowEvent',                                 \
        XWithdrawWindow                         ,<NONE>,                                                'XWithdrawWindow',                              \
        XWriteBitmapFile                        ,<NONE>,                                                'XWriteBitmapFile',                             \







|







464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
        XUnmapWindow                            ,<NONE>,                                                'XUnmapWindow',                                 \
        XUnregisterIMInstantiateCallback        ,<NONE>,                                                'XUnregisterIMInstantiateCallback',             \
        XUnsetICFocus                           ,<NONE>,                                                'XUnsetICFocus',                                \
        XVaCreateNestedList                     ,<NONE>,                                                'XVaCreateNestedList',                          \
        XVendorRelease                          ,<NONE>,                                                'XVendorRelease',                               \
        XVisualIDFromVisual                     ,<NONE>,                                                'XVisualIDFromVisual',                          \
        XWMGeometry                             ,<NONE>,                                                'XWMGeometry',                                  \
        XWarpPointer                            ,<.display, .srcWnd, .dstWnd, .srcX, .srcY, .srcW, .srcH, .dstX, .dstY>,  'XWarpPointer',               \
        XWhitePixel                             ,<NONE>,                                                'XWhitePixel',                                  \
        XWhitePixelOfScreen                     ,<NONE>,                                                'XWhitePixelOfScreen',                          \
        XWidthMMOfScreen                        ,<NONE>,                                                'XWidthMMOfScreen',                             \
        XWidthOfScreen                          ,<NONE>,                                                'XWidthOfScreen',                               \
        XWindowEvent                            ,<.display, .hwin, .event_mask, .pEvent>,               'XWindowEvent',                                 \
        XWithdrawWindow                         ,<NONE>,                                                'XWithdrawWindow',                              \
        XWriteBitmapFile                        ,<NONE>,                                                'XWriteBitmapFile',                             \

Changes to freshlib/test_code0/TestAsmEdit.asm.

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
options.SkipZeroSizes = 1

ThemeGUI equ flat_gui
;ThemeGUI equ win_gui

include "%lib%/freshlib.asm"

;include "%lib%/FreshEdit/FreshEdit.asm"

iglobal

  TemplateMainForm:
        ObjTemplate  tfParent or tfEnd, TForm, frmMain,         \
                     x = 100,                                   \
                     y = 50,                                    \







|







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
options.SkipZeroSizes = 1

ThemeGUI equ flat_gui
;ThemeGUI equ win_gui

include "%lib%/freshlib.asm"

include '%lib%/gui/TAsmEdit.asm'

iglobal

  TemplateMainForm:
        ObjTemplate  tfParent or tfEnd, TForm, frmMain,         \
                     x = 100,                                   \
                     y = 50,                                    \

Changes to freshlib/test_code0/TestAsmEdit.fpr.

cannot compute difference between binary files

Changes to freshlib/test_code0/TestMenu.asm.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
;  Notes:
;_________________________________________________________________________________________

include "%lib%/freshlib.inc"

@BinaryType GUI, compact

options.DebugMode = 1
  options.DebugMode.NoTimers = 1
  options.DebugMode.XSync = 0
  options.DebugMode.XErrors =0

options.ShowSizes = 1
options.SkipZeroSizes = 1

ThemeGUI equ win_gui

include "%lib%/freshlib.asm"


iglobal
TemplateMainForm:
        ObjTemplate  tfParent or tfEnd, TForm, frmMain, \







|
|






|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
;  Notes:
;_________________________________________________________________________________________

include "%lib%/freshlib.inc"

@BinaryType GUI, compact

options.DebugMode = 0
  options.DebugMode.NoTimers = 0
  options.DebugMode.XSync = 0
  options.DebugMode.XErrors =0

options.ShowSizes = 1
options.SkipZeroSizes = 1

ThemeGUI equ flat_gui

include "%lib%/freshlib.asm"


iglobal
TemplateMainForm:
        ObjTemplate  tfParent or tfEnd, TForm, frmMain, \

Changes to freshlib/test_code0/TestNewGUI.fpr.

cannot compute difference between binary files

Changes to freshlib/test_code0/TestPNG.asm.

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
        jb      .loop

        mov     ecx, xStart
        add     edx, yStep
        jmp     .loop

.finish_demo:
;
;        get     ebx, [frmMain], TWindow:Canvas
;        mov     esi, [.img]
;
;;        stdcall BlendImage, ebx, 0, 0, esi, 0, 0, [esi+TImage.width], [esi+TImage.height]
;
;;        mov     eax, [frmMain]
;;        get     ecx, [frmMain], TWindow:width
;;        get     edx, [frmMain], TWindow:height
;
;        xor     ecx, ecx
;
;.loop2:
;;        stdcall BlendImageTile, ebx, ecx, ecx, [ebx+TImage.width], [ebx+TImage.height], esi, 0, 0, [esi+TImage.width], [esi+TImage.height]
;;        stdcall BlendImageTile, ebx, 100, 100, 400, 300, esi, ecx, ecx, [esi+TImage.width], [esi+TImage.height]
;        exec    [frmMain], TWindow:RectChangedXY, 100, 100, 400, 300, 0

;        stdcall ProcessSystemEvents

;        add     ecx, 1
;        cmp     ecx, 1000
;        jbe     .loop2

        DebugMsg "Draw on window"
.end:
        popad
        return
endp








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







179
180
181
182
183
184
185
186
187
188
189
190
191
192
193














194
195
196
197
198
199
200
        jb      .loop

        mov     ecx, xStart
        add     edx, yStep
        jmp     .loop

.finish_demo:

        get     ebx, [frmMain], TWindow:Screen
        mov     esi, [.img]

        stdcall BlendImage, ebx, 0, 0, esi, 0, 0, [esi+TImage.width], [esi+TImage.height]

        mov     eax, [frmMain]
        stdcall _RefreshWindowRect, [eax+TWindow.handle], 0, 0, [eax+TWindow.width], [eax+TWindow.height]















        DebugMsg "Draw on window"
.end:
        popad
        return
endp

Changes to freshlib/test_code0/TestSplitGrid.asm.

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
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
...
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
...
196
197
198
199
200
201
202

203
204
205
206
207
208
209
...
257
258
259
260
261
262
263


264
265
266
267
268
269
270
271
options.ShowSizes = 1
options.SkipZeroSizes = 1

ThemeGUI equ flat_gui

include "%lib%/freshlib.asm"


iglobal

TemplateMainForm:
        ObjTemplate  tfParent or tfEnd, TForm, frmMain, \
                     x = 100,        \
                     y = 50,         \
                     width = 640,    \
                     height = 480,   \
                     OnCreate = FormOnCreate,    \
                     OnClose = MainFormOnClose,  \
                     OnDestroy = FormOnDestroy,  \
                     SplitGrid = SplitTest,      \

                     Caption = 'Split grids test form'

          ObjTemplate tfChild, TLabel, lblEmpty,                        \
                     SplitCell = SplitTest.cellEmpty,                   \
                     Caption = utf8_long,                                \
                     TextAlign = dtfAlignJustify or dtfAlignTop or dtfCRLF or dtfWordWrap,         \
                     Visible = TRUE

;          ObjTemplate tfChild, TEdit, editDir,                 \
;                     Text = "/home",          \
;                     x = 10, y=10, width=370, height=24,       \
;                     MarginLeft= 2,                            \
;                     MarginRight= 2,                           \
;                     OnCreate = EditOnCreate,                  \
;                     SplitCell = SplitTest.cellEdit,           \
;                     Visible = TRUE

          ObjTemplate tfChild, TButton, btnArrowRight,          \
                     x = 384,        \
                     y = 10,         \
                     width = 24,     \
                     height = 24,    \
                     Icon = [iconArrowRight],      \
                     IconPosition = iposCenter,         \
                     SplitCell = SplitTest.cellButton,           \
                     Visible = TRUE, \
                     OnClick = ReadFolderClick

          ObjTemplate  tfChild or tfEnd, TTreeView, tvFolders,               \
                     x = 10, y = 40, width = 200, height = 200,              \
                     SplitCell = SplitTest.cellTree,                         \
\;                     OnFocusItem = TreeFocusItem,                            \
                     Visible = TRUE


include "UTF8_examples.asm"



SplitStart SplitTest

................................................................................
end if


endg


uglobal
  iconArrowRight dd ?

  iconFolder dd ?
  iconFile   dd ?
endg


;rb 423

................................................................................

; Sample event handlers. They work with other objects on the form.

proc FormOnCreate as TObject.OnCreate
begin
        DebugMsg "Form OnCreate event handler."

        stdcall CreateImagePNG, imgArrowRight, imgArrowRight.size
        mov     [iconArrowRight], eax

        stdcall CreateImagePNG, imgFolder, imgFolder.size
        mov     [iconFolder], eax

        stdcall CreateImagePNG, imgFile, imgFile.size
        mov     [iconFile], eax

        return
................................................................................





proc TreeFocusItem as TTreeView.OnFocusItem
begin

        mov     ebx, [.pItem]

        stdcall FileWriteString, [STDOUT], [ebx+TTreeViewItem.UserData]
        stdcall FileWriteString, [STDOUT], <txt 13, 10>

;        stdcall StrExtractExt, [ebx+TTreeViewItem.UserData]
;        jc      .finish
................................................................................

        stdcall StrDel, ebx

        OutputValue "Files tree items:", [edx+TArray.count], 10, 8

        exec    [tvFolders], TTreeView:__RebuildWidths
        exec    [tvFolders], TTreeView:__RebuildIndex


        exec    [tvFolders], TWindow:Refresh

        set     [frmMain], TWindow:Cursor, edi

        pop     eax
        popf
        jc      .error








<












>








|
|
|
|
|
|
|
|






|


|





|

<







 







<
<







 







<
<
<







 







>







 







>
>
|







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
...
108
109
110
111
112
113
114


115
116
117
118
119
120
121
...
143
144
145
146
147
148
149



150
151
152
153
154
155
156
...
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
...
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
options.ShowSizes = 1
options.SkipZeroSizes = 1

ThemeGUI equ flat_gui

include "%lib%/freshlib.asm"


iglobal

TemplateMainForm:
        ObjTemplate  tfParent or tfEnd, TForm, frmMain, \
                     x = 100,        \
                     y = 50,         \
                     width = 640,    \
                     height = 480,   \
                     OnCreate = FormOnCreate,    \
                     OnClose = MainFormOnClose,  \
                     OnDestroy = FormOnDestroy,  \
                     SplitGrid = SplitTest,      \
                     Visible = FALSE,            \
                     Caption = 'Split grids test form'

          ObjTemplate tfChild, TLabel, lblEmpty,                        \
                     SplitCell = SplitTest.cellEmpty,                   \
                     Caption = utf8_long,                                \
                     TextAlign = dtfAlignJustify or dtfAlignTop or dtfCRLF or dtfWordWrap,         \
                     Visible = TRUE

          ObjTemplate tfChild, TEdit, editDir,                 \
                     Text = "/home",          \
                     x = 10, y=10, width=370, height=24,       \
                     MarginLeft= 2,                            \
                     MarginRight= 2,                           \
                     OnCreate = EditOnCreate,                  \
                     SplitCell = SplitTest.cellEdit,           \
                     Visible = TRUE

          ObjTemplate tfChild, TButton, btnArrowRight,          \
                     x = 384,        \
                     y = 10,         \
                     width = 24,     \
                     height = 24,    \
                     Icon = imgArrowRight,      \
                     IconPosition = iposCenter,         \
                     SplitCell = SplitTest.cellButton,           \
                     Visible = TRUE,                             \
                     OnClick = ReadFolderClick

          ObjTemplate  tfChild or tfEnd, TTreeView, tvFolders,               \
                     x = 10, y = 40, width = 200, height = 200,              \
                     SplitCell = SplitTest.cellTree,                         \
                     OnFocusItem = TreeFocusItem,                            \
                     Visible = TRUE


include "UTF8_examples.asm"



SplitStart SplitTest

................................................................................
end if


endg


uglobal


  iconFolder dd ?
  iconFile   dd ?
endg


;rb 423

................................................................................

; Sample event handlers. They work with other objects on the form.

proc FormOnCreate as TObject.OnCreate
begin
        DebugMsg "Form OnCreate event handler."




        stdcall CreateImagePNG, imgFolder, imgFolder.size
        mov     [iconFolder], eax

        stdcall CreateImagePNG, imgFile, imgFile.size
        mov     [iconFile], eax

        return
................................................................................





proc TreeFocusItem as TTreeView.OnFocusItem
begin
        jmp     .finish
        mov     ebx, [.pItem]

        stdcall FileWriteString, [STDOUT], [ebx+TTreeViewItem.UserData]
        stdcall FileWriteString, [STDOUT], <txt 13, 10>

;        stdcall StrExtractExt, [ebx+TTreeViewItem.UserData]
;        jc      .finish
................................................................................

        stdcall StrDel, ebx

        OutputValue "Files tree items:", [edx+TArray.count], 10, 8

        exec    [tvFolders], TTreeView:__RebuildWidths
        exec    [tvFolders], TTreeView:__RebuildIndex
        exec    [tvFolders], TTreeView:UpdateScrollBar

        exec    [tvFolders], TWindow:RectChanged2, 0

        set     [frmMain], TWindow:Cursor, edi

        pop     eax
        popf
        jc      .error

Changes to freshlib/test_code0/TestTVmain.asm.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
..
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
..
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
...
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
;  Notes:
;_________________________________________________________________________________________

include "%lib%/freshlib.inc"

@BinaryType GUI, compact

options.DebugMode = 1
  options.DebugMode.NoTimers = 1
  options.DebugMode.XSync = 0
  options.DebugMode.XErrors =0

options.ShowSizes = 1
options.SkipZeroSizes = 1

................................................................................
                     MarginLeft= 2,                             \
                     MarginRight= 2,                            \
                     OnCreate = EditOnCreate,                   \
                     SplitCell = SplitTest.cellEdit,            \
                     Visible = TRUE

          ObjTemplate  tfChild, TButton, btnArrowRight,         \
                     Icon = [iconArrowRight],                   \
                     IconPosition = iposCenter,                 \
                     SplitCell = SplitTest.cellButton,          \
                     OnClick = ReadFolderClick,                 \
                     Visible = TRUE

          ObjTemplate  tfChild or tfEnd, TTreeView, tvFolders,  \
                     SplitCell = SplitTest.cellTree,            \
................................................................................
end if


endg


uglobal
  iconArrowRight dd ?

  iconFolder dd ?
  iconFile   dd ?
endg


;rb 423

................................................................................

; Sample event handlers. They work with other objects on the form.

proc FormOnCreate as TObject.OnCreate
begin
        DebugMsg "Form OnCreate event handler."

        stdcall CreateImagePNG, imgArrowRight, imgArrowRight.size
        mov     [iconArrowRight], eax

        stdcall CreateImagePNG, imgFolder, imgFolder.size
        mov     [iconFolder], eax

        stdcall CreateImagePNG, imgFile, imgFile.size
        mov     [iconFile], eax








|







 







|







 







<
<







 







|
|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
..
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
..
93
94
95
96
97
98
99


100
101
102
103
104
105
106
...
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
;  Notes:
;_________________________________________________________________________________________

include "%lib%/freshlib.inc"

@BinaryType GUI, compact

options.DebugMode = 0
  options.DebugMode.NoTimers = 1
  options.DebugMode.XSync = 0
  options.DebugMode.XErrors =0

options.ShowSizes = 1
options.SkipZeroSizes = 1

................................................................................
                     MarginLeft= 2,                             \
                     MarginRight= 2,                            \
                     OnCreate = EditOnCreate,                   \
                     SplitCell = SplitTest.cellEdit,            \
                     Visible = TRUE

          ObjTemplate  tfChild, TButton, btnArrowRight,         \
                     Icon = imgArrowRight,                     \
                     IconPosition = iposCenter,                 \
                     SplitCell = SplitTest.cellButton,          \
                     OnClick = ReadFolderClick,                 \
                     Visible = TRUE

          ObjTemplate  tfChild or tfEnd, TTreeView, tvFolders,  \
                     SplitCell = SplitTest.cellTree,            \
................................................................................
end if


endg


uglobal


  iconFolder dd ?
  iconFile   dd ?
endg


;rb 423

................................................................................

; Sample event handlers. They work with other objects on the form.

proc FormOnCreate as TObject.OnCreate
begin
        DebugMsg "Form OnCreate event handler."

;        stdcall CreateImagePNG, imgArrowRight, imgArrowRight.size
;        mov     [iconArrowRight], eax

        stdcall CreateImagePNG, imgFolder, imgFolder.size
        mov     [iconFolder], eax

        stdcall CreateImagePNG, imgFile, imgFile.size
        mov     [iconFile], eax