Fresh IDE . Check-in [071b59fa8c]
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 TButton rendering bug and some little misbehavior on keyboard events.
Timelines: family | ancestors | descendants | both | NoCanvasGUI
Files: files | file ages | folders
SHA1:071b59fa8c42d8389012d05e496508c8ca53578c
User & Date: johnfound 2017-09-09 19:42:15
Context
2017-10-26
16:39
In general, a lot of work on the new GUI concept. Not finished. check-in: 4e013cc286 user: johnfound tags: NoCanvasGUI
2017-09-09
19:42
Fixed the TButton rendering bug and some little misbehavior on keyboard events. check-in: 071b59fa8c user: johnfound tags: NoCanvasGUI
2017-08-27
18:45
Minor fix in TButton and adapting TProgress to the new API. check-in: c5df17b099 user: johnfound tags: NoCanvasGUI
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to freshlib/gui/TButton.asm.

80
81
82
83
84
85
86

87
88
89
90
91
92
93
...
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
...
443
444
445
446
447
448
449

450
451
452
453
454
455
456
...
516
517
518
519
520
521
522







523
524
525
526
527
528
529
...
534
535
536
537
538
539
540







541
542

543
544
545
546
547
548
549
...
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
  method .SetCaption, .value

  method .EventFocusIn
  method .EventFocusOut

  method .EventMouseEnter
  method .EventMouseLeave


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

  method .EventKeyPress, .utf8, .scancode, .kbdState
  method .EventKeyRelease, .scancode, .kbdState

................................................................................
        xor     ebx, ebx        ; 0 == bsNeutral

.loop_y:

; draw the border and the background

        lea     eax, [.client]
        stdcall DrawBoxDefault, [.canvas], eax, [GUI.clBtnBk+4*ebx], [GUI.btnBorder+4*ebx], [GUI.boxBorderWidth]

; draw the icon

        mov     edi, [.icon]
        test    edi, edi
        jz      .draw_text

................................................................................
        add     [.client.y], eax

        inc     ebx
        cmp     ebx, bsDisabled
        jbe     .loop_y

.finish:

        popad
        return
endp




................................................................................
begin
        exec    [.self], TButton:SimpleSetParam, 0, TButton._state, bsNeutral
        inherited
        return
endp










method TButton.EventButtonPress
begin
        exec    [.self], TButton:SimpleSetParam, 0, TButton._state, bsPressed
        return
endp

................................................................................
        pushad

        mov     esi, [.self]

        cmp     [esi+TButton._state], bsPressed
        jne     .finish








        exec    [.self], TButton:SimpleSetParam, 0, TButton._state, bsHovered


        cmp     [esi+TButton._ModalResult], mrNone
        je      @f

        get     eax, esi, TButton:Parent

        istype  eax, TForm
        jne     @f
................................................................................
        push    ecx

        cmp     [.utf8], ' '
        jne     .finish

        mov     ecx, [.self]
        exec    ecx, TButton:SimpleSetParam, 0, TButton._state, bsPressed
        exec    ecx, TWindow:EventButtonRelease, mbLeft, [.kbdState], 0, 0

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








>







 







|







 







>







 







>
>
>
>
>
>
>







 







>
>
>
>
>
>
>


>







 







|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
...
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
...
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
...
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
...
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
...
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
  method .SetCaption, .value

  method .EventFocusIn
  method .EventFocusOut

  method .EventMouseEnter
  method .EventMouseLeave
  method .EventMouseMove, .x, .y, .kbdState

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

  method .EventKeyPress, .utf8, .scancode, .kbdState
  method .EventKeyRelease, .scancode, .kbdState

................................................................................
        xor     ebx, ebx        ; 0 == bsNeutral

.loop_y:

; draw the border and the background

        lea     eax, [.client]
        stdcall [DrawBox], [.canvas], eax, [GUI.clBtnBk+4*ebx], [GUI.btnBorder+4*ebx], [GUI.boxBorderWidth]

; draw the icon

        mov     edi, [.icon]
        test    edi, edi
        jz      .draw_text

................................................................................
        add     [.client.y], eax

        inc     ebx
        cmp     ebx, bsDisabled
        jbe     .loop_y

.finish:
        inc     [esi+TButton._canvas_valid]
        popad
        return
endp




................................................................................
begin
        exec    [.self], TButton:SimpleSetParam, 0, TButton._state, bsNeutral
        inherited
        return
endp


method TButton.EventMouseMove
begin
        exec    [.self], TButton:SimpleSetParam, 0, TButton._state, bsHovered
        inherited [.x], [.y], [.kbdState]
        return
endp


method TButton.EventButtonPress
begin
        exec    [.self], TButton:SimpleSetParam, 0, TButton._state, bsPressed
        return
endp

................................................................................
        pushad

        mov     esi, [.self]

        cmp     [esi+TButton._state], bsPressed
        jne     .finish

        cmp     [.x], -1         ; when called from the keyboard event as a mouse emulation the .x and .y parameters are both -1.
        jne     .hover

        cmp     [.y], -1
        je      .state_ok

.hover:
        exec    [.self], TButton:SimpleSetParam, 0, TButton._state, bsHovered

.state_ok:
        cmp     [esi+TButton._ModalResult], mrNone
        je      @f

        get     eax, esi, TButton:Parent

        istype  eax, TForm
        jne     @f
................................................................................
        push    ecx

        cmp     [.utf8], ' '
        jne     .finish

        mov     ecx, [.self]
        exec    ecx, TButton:SimpleSetParam, 0, TButton._state, bsPressed
        exec    ecx, TWindow:EventButtonRelease, mbLeft, [.kbdState], -1, -1

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

Changes to freshlib/gui/themes.asm.

728
729
730
731
732
733
734

735
736
737

738
739
740
741
742
743
744
745

  var DrawSplitter = DrawSplitterDefault
endg



proc DrawBoxDefault, .pImage, .pBounds, .bkground, .border, .brd_width

begin
        pushad


        mov     esi, [.pBounds]

        mov     edx, [.border]
        and     edx, $ff
        jz      .borderok

        mov     eax, [GUI.clBorderLight]
        mov     ecx, [GUI.clBorderDark]







>



>
|







728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747

  var DrawSplitter = DrawSplitterDefault
endg



proc DrawBoxDefault, .pImage, .pBounds, .bkground, .border, .brd_width
.bounds TBounds
begin
        pushad

        lea     esi, [.bounds]
        stdcall RectCopy, esi, [.pBounds]

        mov     edx, [.border]
        and     edx, $ff
        jz      .borderok

        mov     eax, [GUI.clBorderLight]
        mov     ecx, [GUI.clBorderDark]

Changes to freshlib/test_code0/TestNewGUI.asm.

20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
  options.DebugMode.NoTimers = 1
  options.DebugMode.XSync = 0
  options.DebugMode.XErrors =0

options.ShowSizes = 1
options.SkipZeroSizes = 0

ThemeGUI equ flat_gui


include "%lib%/freshlib.asm"


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







|
>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  options.DebugMode.NoTimers = 1
  options.DebugMode.XSync = 0
  options.DebugMode.XErrors =0

options.ShowSizes = 1
options.SkipZeroSizes = 0

;ThemeGUI equ flat_gui
ThemeGUI equ win_gui

include "%lib%/freshlib.asm"


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