Fresh IDE . Check-in [6639367637]
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:A lot of changes as a result of activated work on Fresh v3.x

TToolbar control implemented. In very primitive state, but works somehow.

New StrNormalizePath2 function, together with the OS dependent path functions IsPathRelative and GetPrefix. They are aimed to provide OS independent way for path processing.

Fixed serious bugs in the GUI part, related to windows nested in more than 2 levels. It turned that the library was never tested with such windows before...

A lot of new functionality and correct behavior in the GUI part. Now the TAction accelerator keys are assigned through the StrToAccelerator function directly from the templates.

Timelines: family | ancestors | descendants | both | NoCanvasGUI
Files: files | file ages | folders
SHA1:6639367637f7e8da837867d073875ef7ae937cb5
User & Date: johnfound 2019-05-07 21:38:24
Context
2019-05-09
12:49
Added userID field for the menu items. TMenu:InsertItem implemented. Better and readable menu template syntax. TButton:Menu for easy attach of menu to button. check-in: edb12bf679 user: johnfound tags: NoCanvasGUI
2019-05-07
21:38
A lot of changes as a result of activated work on Fresh v3.x

TToolbar control implemented. In very primitive state, but works somehow.

New StrNormalizePath2 function, together with the OS dependent path functions IsPathRelative and GetPrefix. They are aimed to provide OS independent way for path processing.

Fixed serious bugs in the GUI part, related to windows nested in more than 2 levels. It turned that the library was never tested with such windows before...

A lot of new functionality and correct behavior in the GUI part. Now the TAction accelerator keys are assigned through the StrToAccelerator function directly from the templates. check-in: 6639367637 user: johnfound tags: NoCanvasGUI

2019-05-03
21:00
Work on TAsmEdit, related to the text editing.

Work on TMenu - implemented menu template similar to the old CoolMenu and procedure MenuFromTemplate that creates the whole menu tree from the template.

The functions "read" and "write" removed from the pthreads import library, because in conflict with FASM interface procedures. I am not sure why these functions are there, but they are not used after all. check-in: f313647175 user: johnfound tags: NoCanvasGUI

Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to freshlib/data/strlib.asm.

  3603   3603   ;        stosd
  3604   3604   ;        mov     [edx+string.len], esi
  3605   3605   ;        popf
  3606   3606           popad
  3607   3607           return
  3608   3608   
  3609   3609   endp
         3610  +
         3611  +
         3612  +
         3613  +
         3614  +; Normalizes some path to the minimal possible path.
         3615  +; Removes ".." and "." from the path in all cases. In the incorrect cases the result path
         3616  +;         is of course not equivalent to the beginning.
         3617  +;
         3618  +; Arguments:
         3619  +;   .hPath - handle or pointer of string with the path. The processing is in-place and
         3620  +;            the result string is always shorter or equal to the input string.
         3621  +;            If the string is in memory, it MUST be in the format of FreshLib string
         3622  +;            (i.e. on the offset -4 to be placed the length of the string and the
         3623  +;             string to be terminated at least with dword of 0) The length of the string
         3624  +;             is not used, but is updated with the result string length.
         3625  +;
         3626  +;   .separators - the first two bytes of this argument specifies two possible directory
         3627  +;            separators. For example "/\" will accept both slashes as a valid separators.
         3628  +;            all separators in the result string will be converted to the first of them.
         3629  +;            These two characters should be equal if only one separator is to be used.
         3630  +; Returns:
         3631  +;    Nothing. Preserves all registers.
         3632  +;
         3633  +; Note: StrNormalizePath2 is more "paranoid" about the invalid paths than StrNormalizePath
         3634  +;       it removes ".." and "." even if the result path is not equivalent.
         3635  +
         3636  +proc StrNormalizePath2, .hPath, .separators
         3637  +.back dd ?
         3638  +begin
         3639  +        pushad
         3640  +
         3641  +        mov     ebx, esp
         3642  +
         3643  +        stdcall StrPtr, [.hPath]
         3644  +        mov     esi, eax
         3645  +        mov     edi, eax
         3646  +        mov     edx, eax
         3647  +        xor     eax, eax
         3648  +        mov     [.back], eax
         3649  +
         3650  +        mov     cl, byte [.separators]
         3651  +        mov     ch, cl
         3652  +        mov     byte [.back], cl
         3653  +        mov     byte [.back+2], cl
         3654  +        mov     al, cl
         3655  +        rol     ecx, 16
         3656  +        mov     cx, '..'
         3657  +        mov     byte [.back+1], cl
         3658  +        rol     ecx, 8
         3659  +
         3660  +.loop:
         3661  +        shl     eax, 8
         3662  +        lodsb
         3663  +        stosb
         3664  +
         3665  +        test    al, al
         3666  +        jz      .end_of_string
         3667  +
         3668  +        cmp     al, byte [.separators]
         3669  +        je      .separator1
         3670  +        cmp     al, byte [.separators+1]
         3671  +        jne     .loop
         3672  +
         3673  +.separator2:
         3674  +        mov     al, byte [.separators]
         3675  +        mov     [edi-1], al
         3676  +
         3677  +.separator1:
         3678  +        cmp     eax, ecx        ;ecx == '/../'
         3679  +        je      .dir_back
         3680  +
         3681  +        and     eax, $ffffff
         3682  +        cmp     eax, [.back]    ; [.back] == '/./'
         3683  +        je      .dir_remove
         3684  +
         3685  +        push    edi
         3686  +        jmp     .loop
         3687  +
         3688  +.dir_remove:
         3689  +        sub     edi, 2
         3690  +        cmp     edi, edx
         3691  +        cmovb   edi, edx
         3692  +        jmp     .loop
         3693  +
         3694  +.dir_back:
         3695  +        cmp     esp, ebx
         3696  +        cmove   edi, edx
         3697  +        je      .loop
         3698  +
         3699  +        add     esp, 4
         3700  +        cmp     esp, ebx
         3701  +        cmove   edi, edx
         3702  +        je      .loop
         3703  +
         3704  +        mov     edi, [esp]
         3705  +        jmp     .loop
         3706  +
         3707  +.end_of_string:
         3708  +
         3709  +        and     dword [edi], 0
         3710  +        sub     edi, edx
         3711  +        mov     [edx+string.len], edi
         3712  +        mov     esp, ebx
         3713  +
         3714  +        popad
         3715  +        return
         3716  +endp
         3717  +
         3718  +
         3719  +
  3610   3720   
  3611   3721   
  3612   3722   
  3613   3723   ;******************************************************
  3614   3724   ; Computes MD5 hash of the string .hString and returns
  3615   3725   ; new string handle in eax containing the hash of the
  3616   3726   ; string.

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

   367    367           stdcall ServeMenuMouseMove, [ebx+XMotionEvent.window], [ebx+XMotionEvent.x], [ebx+XMotionEvent.y], [ebx+XMotionEvent.state]
   368    368           jc      .finish
   369    369   
   370    370           mov     edi, [__MouseTarget]
   371    371           test    edi, edi
   372    372           jz      .search_target_move
   373    373   
          374  +        ; returns coordinates in ecx, edx
   374    375           stdcall __GetRelativeXY, edi, [ebx+XMotionEvent.x], [ebx+XMotionEvent.y]
   375    376           jmp     .target_move
   376    377   
   377    378   .search_target_move:
          379  +        ; returns coordinates in ecx, edx
   378    380           exec    esi, TWindow:ChildByXY, [ebx+XMotionEvent.x], [ebx+XMotionEvent.y], TRUE
   379    381           mov     edi, eax
   380    382   
   381    383   .target_move:
   382    384           cmp     edi, [__LastPointedWindow]
   383    385           je      .move_event
   384    386   

Changes to freshlib/gui/SplitGrid.asm.

   333    333   
   334    334   
   335    335   
   336    336   
   337    337   
   338    338   
   339    339   
   340         -proc DrawSplitters, .pImage, .ptrSplitters, .x, .y, .width, .height
          340  +proc DrawSplitters, .pImage, .ptrSplitters, .xDst, .yDst, .width, .height, .ofsx, .ofsy
          341  +.rect RECT
   341    342   begin
   342    343           pushad
   343    344   
   344         -        mov     eax, [.x]
   345         -        mov     edx, [.y]
          345  +        mov     eax, [.xDst]
          346  +        mov     edx, [.yDst]
   346    347           add     [.width], eax
   347    348           add     [.height], edx
   348    349   
   349         -        lea     ebx, [.x]
          350  +        lea     ebx, [.xDst]
   350    351   
   351    352           mov     esi, [.ptrSplitters]
   352         -        mov     edi, [.pImage]
   353         -        call    _DoDrawSplitters
          353  +        lea     edi, [.rect]
          354  +        call    .DoDrawSplitters
   354    355           popad
   355    356           return
   356         -endp
   357    357   
          358  +; esi - pointer to TSplitRect
          359  +.DoDrawSplitters:
   358    360   
   359         -;esi - pointer to TSplitRect
   360         -; edi - TImage
   361         -
   362         -proc _DoDrawSplitters
   363         -begin
   364    361           lea     eax, [esi+TSplitRect.spRect]
          362  +        stdcall RectCopy, edi, eax
          363  +
          364  +        mov     eax, [.ofsx]
          365  +        mov     edx, [.ofsy]
          366  +        add     [edi+RECT.left], eax
          367  +        add     [edi+RECT.top], edx
          368  +        add     [edi+RECT.right], eax
          369  +        add     [edi+RECT.bottom], edx
          370  +
   365    371           mov     edx, [esi+TSplitRect.type]
   366    372           add     esi, sizeof.TSplitRect
   367    373   
   368    374           test    edx, stNone
   369    375           jnz     .exit
   370    376   
   371    377           test    edx, stJustGap
   372    378           jnz     .next
   373    379   
   374         -        stdcall [DrawSplitter], edi, eax, edx, ebx
   375         -
          380  +        stdcall [DrawSplitter], [.pImage], edi, edx, ebx
   376    381   
   377    382   .next:
   378         -        call    _DoDrawSplitters  ; first
   379         -        call    _DoDrawSplitters  ; second
          383  +        call    .DoDrawSplitters  ; first
          384  +        call    .DoDrawSplitters  ; second
   380    385   
   381    386   .exit:
   382         -        return
          387  +        retn
   383    388   endp
          389  +
   384    390   
   385    391   
   386    392   ; Returns:
   387    393   ;   CF=1; the splitter has been found. EAX=pointer to TSplitRect structure.
   388    394   ;   CF=0; the splitter has not been found. EAX not changed.
   389    395   
   390    396   proc FindSplitter, .ptrSplitters, .ptrPoint

Changes to freshlib/gui/TAction.asm.

    50     50     ._icon_cache       dd ?
    51     51   
    52     52     param .Caption,   ._caption,    .SetCaption
    53     53     param .HintText,  ._hint_text,  .SetHintText
    54     54     param .IconIndex, ._icon_index, .SetIconIndex
    55     55     param .Enabled,   ._enabled,    .SetEnabled
    56     56     param .Checked,   ._checked,    .SetChecked
    57         -  param .AccelStr,  .GetAccelStr, NONE
           57  +  param .Accelerator, .GetAccelStr, .SetAccelStr
    58     58     param .Icon, .GetIcon, NONE
    59     59   
    60     60     param .OnExecute, ._on_execute, ._on_execute
    61     61     param .OnIdle,    ._on_idle,    ._on_idle
    62     62   
    63     63     method .GetIcon
    64     64     method .GetAccelStr
           65  +  method .SetAccelStr, .value
    65     66   
    66     67     method .SetParent, .value
    67     68   
    68     69     method .SetCaption, .value
    69     70     method .SetHintText, .value
    70     71     method .SetIconIndex, .value
    71     72     method .SetEnabled, .value
................................................................................
   271    272   begin
   272    273           mov     eax, [.self]
   273    274           lea     eax, [eax+TAction._accel]
   274    275           stdcall AcceleratorToStr, eax
   275    276           return
   276    277   endp
   277    278   
          279  +
          280  +method TAction.SetAccelStr; , .value
          281  +begin
          282  +        push    eax edx
          283  +        stdcall StrToAccelerator, [.value]
          284  +        exec    [.self], TAction:SetAccelerator, eax, edx
          285  +        pop     edx eax
          286  +        return
          287  +endp
          288  +
   278    289   
   279    290   
   280    291   method TAction.__clear_cache
   281    292   begin
   282    293           push    eax edx
   283    294   
   284    295           mov     edx, [.self]

Changes to freshlib/gui/TAsmEdit.asm.

   175    175   ; common methods
   176    176   
   177    177     method .Create, .parent
   178    178     method .Destroy
   179    179   
   180    180     method .__UpdateImages
   181    181     method .Resize, .newWidth, .newHeight
          182  +  method .Move, .newX, .newY
   182    183   
   183    184     method .UpdateScrollBar
   184    185   
   185    186     method .UpdateCaretPos
   186    187   
   187    188   
   188    189   ; rendering methods
................................................................................
  2402   2403   ;        exec    [.self], TAsmEdit:RectChanged2, 0
  2403   2404   
  2404   2405           popad
  2405   2406           return
  2406   2407   endp
  2407   2408   
  2408   2409   
         2410  +
         2411  +method TAsmEdit.Move
         2412  +begin
         2413  +        mov     eax, [Caret.pWindow]
         2414  +        push    eax
         2415  +        cmp     eax, [.self]
         2416  +        jne     @f
         2417  +        stdcall CaretAttach, 0
         2418  +@@:
         2419  +        inherited [.newX], [.newY]
         2420  +
         2421  +        pop     eax
         2422  +        cmp     eax, [.self]
         2423  +        jne     @f
         2424  +        stdcall CaretAttach, eax
         2425  +        exec    [.self], TAsmEdit:UpdateCaretPos
         2426  +@@:
         2427  +        return
         2428  +endp
         2429  +
  2409   2430   
  2410   2431   ; parameters get/set methods
  2411   2432   
  2412   2433   method TAsmEdit.SetOptions
  2413   2434   begin
  2414   2435           pushad
  2415   2436   

Changes to freshlib/gui/TCanvasWindow.asm.

    58     58   
    59     59   
    60     60   method TCanvasWindow.__UpdateImages
    61     61   begin
    62     62           pushad
    63     63           mov     esi, [.self]
    64     64   
    65         -        DebugMsg "TCanvasWindow update canvas."
           65  +;        DebugMsg "TCanvasWindow update canvas."
    66     66   
    67     67           mov     ebx, [esi+TCanvasWindow._visible]
    68     68           mov     edi, [esi+TCanvasWindow._canvas]
    69     69   
    70     70           mov     ecx, [esi+TCanvasWindow._width]
    71     71           mov     edx, [esi+TCanvasWindow._height]
    72     72   
................................................................................
    81     81           cmp     ecx, [edi+TImage.width]
    82     82           ja      .destroy
    83     83   
    84     84           cmp     edx, [edi+TImage.height]
    85     85           jbe     .setwrap
    86     86   
    87     87   .destroy:
    88         -        DebugMsg "Destroy old canvas."
           88  +;        DebugMsg "Destroy old canvas."
    89     89   
    90     90           stdcall DestroyImage, edi                         ; canvas
    91     91   
    92     92           xor     eax, eax
    93     93           mov     [esi+TCanvasWindow._canvas], eax
    94     94   
    95     95           test    ebx, ebx
    96     96           jz      .exit
    97     97   
    98     98   
    99     99   .create_new:
   100    100   
   101         -        DebugMsg "Create new canvas."
          101  +;        DebugMsg "Create new canvas."
   102    102   
   103    103   ; new size - get it with x1.5 reserve in order to allow easy resizing.
   104    104   ;        lea     ecx, [ecx*3]
   105    105   ;        lea     edx, [edx*3]
   106    106   ;        shr     ecx, 1
   107    107   ;        shr     edx, 1
   108    108   
................................................................................
   112    112           lea     ebx, [edx+256]
   113    113   
   114    114           stdcall CreateImage, eax, ebx
   115    115           mov     [esi+TCanvasWindow._canvas], eax
   116    116           mov     edi, eax
   117    117   
   118    118   
   119         -        OutputValue "Canvas created: ", eax, 16, 8
          119  +;        OutputValue "Canvas created: ", eax, 16, 8
   120    120   
   121    121   .setwrap:
   122    122           mov     [edi+TImage.wrapW], ecx
   123    123           mov     [edi+TImage.wrapH], edx
   124    124   
   125    125   .exit:
   126    126           and     [esi+TCanvasWindow._canvas_valid], 0

Changes to freshlib/gui/TForm.asm.

    51     51     method .EventMouseMove, .x, .y, .kbdState
    52     52     method .EventButtonPress, .button, .kbdState, .x, .y
    53     53     method .EventButtonRelease, .button, .kbdState, .x, .y
    54     54   
    55     55     method .Resize, .newWidth, .newHeight
    56     56   
    57     57     method .CloseRequest, .reason
    58         -;  method .SelfPaint, .pDstImage, .xDst, .yDst, .xSrc, .ySrc, .width, .height    ; Paints itself on the caller provided TImage.
    59         -
    60         -  method .Create, .parent
           58  +  method .SelfPaint, .pDstImage, .xDst, .yDst, .xSrc, .ySrc, .width, .height    ; Paints itself on the caller provided TImage.
    61     59   
    62     60   endobj
    63     61   
    64     62   
    65     63   
    66     64   ;----------------------------------------------------------------------
    67     65   ; Interface for TForm.OnClose user handler.
................................................................................
    74     72   ;   CF = 0 - Destroy the object.
    75     73   ;
    76     74   ; If the OnClose event handler is not set, the form will be destroyed.
    77     75   ;----------------------------------------------------------------------
    78     76   interface TForm.OnClose, .self, .reason
    79     77   
    80     78   
    81         -method TForm.Create
           79  +
           80  +method TForm.SelfPaint
    82     81   begin
    83         -        inherited [.parent]
    84         -        set     [.self], TForm:OnSelfPaint, FormOnSelfPaint
    85         -        return
    86         -endp
    87         -
    88         -
    89         -
    90         -
    91         -proc FormOnSelfPaint as TWindow.OnSelfPaint
    92         -begin
    93         -        push    eax
    94     82   
    95     83           stdcall DrawSolidRect,  [.pDstImage], [.xDst], [.yDst], [.width], [.height], [GUI.clDialogBk]
    96     84   
    97         -        mov     eax, [.self]
    98         -        mov     eax, [eax+TForm._p_split_grid]
           85  +        inherited [.pDstImage], [.xDst], [.yDst], [.xSrc], [.ySrc], [.width], [.height]
           86  +
           87  +        pushad
           88  +        mov     esi, [.self]
           89  +        mov     eax, [esi+TForm._p_split_grid]
    99     90           test    eax, eax
   100     91           jz      .finish
           92  +
           93  +        mov     ecx, [.xDst]
           94  +        mov     edx, [.yDst]
           95  +        sub     ecx, [.xSrc]
           96  +        sub     edx, [.ySrc]
   101     97   
   102     98           lea     eax, [eax+TArray.array]
   103         -        stdcall DrawSplitters, [.pDstImage], eax, [.xDst], [.yDst], [.width], [.height]
           99  +        stdcall DrawSplitters, [.pDstImage], eax, [.xDst], [.yDst], [.width], [.height], ecx, edx
   104    100   
   105    101   .finish:
   106         -        pop     eax
          102  +        popad
   107    103           return
   108    104   endp
   109    105   
   110    106   
   111    107   
   112    108   
   113    109   method TForm.Resize        ;, .newWidth, .newHeight
................................................................................
   357    353   
   358    354   .invalidate_splitters:
   359    355   
   360    356           test    [esi+TSplitRect.type], stNone
   361    357           lea     eax, [esi+TSplitRect.spRect]
   362    358           lea     esi, [esi+sizeof.TSplitRect]
   363    359           jnz     .end_spl
          360  +
          361  +        OutputValue "Invalidate splitter Y = ", [eax+RECT.top], 10, -1
   364    362   
   365    363           exec    [.self], TForm:RectChanged2, eax
   366    364           call    .invalidate_splitters
   367    365           call    .invalidate_splitters
   368    366   
   369    367   .end_spl:
   370    368           retn

Changes to freshlib/gui/TMenu.asm.

    67     67   
    68     68   object TMenu, TCanvasWindow
    69     69     ._p_items   dd ?
    70     70     ._selected  dd ?
    71     71     .__caller   dd ?
    72     72   
    73     73     .__icon_size dd ?
           74  +
           75  +  ._ActiveSubmenu dd ?
    74     76   
    75     77     param .Selected, ._selected, .SetSelected
    76     78     param .Items, ._p_items, .SetItems
    77     79   
    78     80     method .SetSelected, .value
    79     81     method .SetItems, .menu_template
    80     82     method .SetVisible, .value
................................................................................
   183    185   
   184    186           stdcall GetTextBounds, "Empty menu", 10, [GUI.DefaultFont]
   185    187           add     eax, 20
   186    188           jmp     .set_width
   187    189   
   188    190   
   189    191   .compute_width:
          192  +; first scan for the icon height
   190    193   
          194  +        lea     edx, [edi+TArray.array-sizeof.TMenuItem]
          195  +        mov     [esi+TMenu.__icon_size], 0
          196  +
          197  +.loop_icon:
          198  +        add     edx, sizeof.TMenuItem
          199  +        dec     ecx
          200  +        js      .height_ok
          201  +
          202  +        cmp     [edx+TMenuItem.type], mitAction
          203  +        jne     .loop_icon
          204  +
          205  +        get     eax, [edx+TMenuItem.item], TAction:Icon
          206  +        test    eax, eax
          207  +        jz      .loop_icon
          208  +
          209  +        mov     eax, [eax+TImage.height]
          210  +        cmp     eax, [esi+TMenu.__icon_size]
          211  +        cmovb   eax, [esi+TMenu.__icon_size]
          212  +        mov     [esi+TMenu.__icon_size], eax
          213  +        jmp     .loop_icon
          214  +
          215  +.height_ok:
          216  +        mov     ecx, [edi+TArray.count]
   191    217           lea     edi, [edi+TArray.array-sizeof.TMenuItem]        ; edi points to the current TMenuItem
   192    218   
   193    219           xor     eax, eax
   194    220           mov     [.maxW], eax                    ; the width of the menu window
   195    221           mov     [.sumH], eax                    ; the total height of the menu window
   196         -        mov     [esi+TMenu.__icon_size], 0
   197    222   
   198    223   .loop:
   199    224           add     edi, sizeof.TMenuItem
   200    225           dec     ecx
   201    226           js      .end_width
   202    227   
   203    228           cmp     [edi+TMenuItem.type], mitSeparator
................................................................................
   225    250           push    eax
   226    251   
   227    252           stdcall StrCat, eax, txt "  >"
   228    253           jmp     .str_width
   229    254   
   230    255   
   231    256   .action:
   232         -        get     eax, [edi+TMenuItem.item], TAction:Icon
   233         -        test    eax, eax
   234         -        jz      .icon_ok
   235         -
   236         -        mov     eax, [eax+TImage.height]
   237         -
   238         -        cmp     eax, [esi+TMenu.__icon_size]
   239         -        jbe     .icon_ok
   240         -        mov     [esi+TMenu.__icon_size], eax
   241         -
   242         -.icon_ok:
   243         -
   244         -        get     eax, [edi+TMenuItem.item], TAction:AccelStr
          257  +        get     eax, [edi+TMenuItem.item], TAction:Accelerator
   245    258           push    eax
   246    259   
   247    260           get     edx, [edi+TMenuItem.item], TAction:Caption
   248    261           stdcall StrCat, eax, edx
   249    262   
   250    263   
   251    264   .str_width:
................................................................................
   478    491   
   479    492   .action:
   480    493           mov     [.subicon], 0
   481    494   
   482    495           get     eax, [edi+TMenuItem.item], TAction:Caption
   483    496           mov     [.text], eax
   484    497   
   485         -        get     eax, [edi+TMenuItem.item], TAction:AccelStr
          498  +        get     eax, [edi+TMenuItem.item], TAction:Accelerator
   486    499           mov     [.accel], eax
   487    500   
   488    501           get     eax, [edi+TMenuItem.item], TAction:Enabled
   489    502           mov     [.enabled], eax
   490    503   
   491    504           get     eax, [edi+TMenuItem.item], TAction:Icon
   492    505           mov     [.icon], eax
................................................................................
   521    534           jne     .selected_ok
   522    535   
   523    536           cmp     [.enabled], 0
   524    537           je      .selected_ok
   525    538   
   526    539           mov     eax, [.bounds.x]
   527    540           mov     edx, [.bounds.width]
   528         -        add     edx, eax
          541  +
          542  +        add     eax, [GUI.boxBorderWidth]
          543  +        sub     edx, [GUI.boxBorderWidth]
          544  +        sub     edx, [GUI.boxBorderWidth]
          545  +
          546  +        stdcall DrawSolidRect, [.canvas], eax, [.y], edx, [edi+TMenuItem.height], [GUI.clMenuSelection]
   529    547   
   530    548           mov     ebx, [.icon]
   531    549           test    ebx, ebx
   532         -        jz      .paint_sel
          550  +        jz      .selected_ok
   533    551   
   534         -        add     eax, [ebx+TImage.width]
   535         -        add     eax, [GUI.menuIconMargin]
   536         -        add     eax, [GUI.menuIconMargin]
   537         -        add     eax, [GUI.menuIconMargin]
   538         -        add     eax, [GUI.boxBorderWidth]
          552  +        mov     edx, [ebx+TImage.width]
          553  +        add     edx, [GUI.menuIconMargin]
   539    554   
   540    555           mov     ebx, [GUI.iconMenuChecked]
   541    556           add     eax, [ebx+TImage.width]
   542    557   
   543         -.paint_sel:
   544         -        sub     edx, eax
   545         -        stdcall DrawSolidRect, [.canvas], eax, [.y], edx, [edi+TMenuItem.height], [GUI.clMenuSelection]
          558  +        mov     ebx, [GUI.menuIconMargin]
          559  +        add     eax, ebx
          560  +        shr     ebx, 1
          561  +        add     eax, ebx
          562  +
          563  +        stdcall DrawSolidRect, [.canvas], eax, [.y], edx, [edi+TMenuItem.height], [GUI.clMenuSelIcon]
   546    564   
   547    565   .selected_ok:
   548    566   
   549    567   ; draw the icon
   550    568   
   551    569           cmp     [.icon], 0
   552    570           je      .icon_ok
................................................................................
   701    719   method TMenu.Show
   702    720   begin
   703    721           pushad
   704    722   
   705    723           mov     esi, [.self]
   706    724           mov     edi, [.parent]
   707    725   
   708         -        istype edi, TMenu
   709         -        je     .capture_ok
   710         -
   711         -        stdcall SetMouseCapture, edi
   712         -
   713         -.capture_ok:
   714         -
   715    726           exec    edi, TWindow:ClientToScreenXY, [.x], [.y]
   716    727   
   717    728           mov     [esi+TMenu._x], ecx
   718    729           mov     [esi+TMenu._y], edx
   719    730   
   720    731           mov     [esi+TMenu.__caller], edi
          732  +        istype  edi, TMenu
          733  +        jne     .submenu_ok
          734  +
          735  +        mov     eax, esi
          736  +        xchg    eax, [edi+TMenu._ActiveSubmenu]
          737  +        test    eax, eax
          738  +        jz      .submenu_ok
          739  +
          740  +        set     eax, TMenu:Visible, FALSE
          741  +        stdcall SetMouseCapture, edi
          742  +
          743  +.submenu_ok:
   721    744           mov     [__ActiveMenu], esi
   722    745   
   723    746           set     esi, TMenu:Visible, TRUE
   724    747           set     esi, TMenu:Selected, 0
   725    748           popad
   726    749           return
   727    750   endp
................................................................................
   754    777   
   755    778   .finish:
   756    779           pop     edx ecx
   757    780           return
   758    781   endp
   759    782   
   760    783   
          784  +; Converts the string representation of an accelerator key to
          785  +; TFastKey structure.
          786  +;
          787  +; Returns:
          788  +;   eax - keyboard flags (TFastKey.flags)
          789  +;   edx - keyboard key (TFastKey.key)
          790  +;
          791  +; ToDo: more modifiers need to be processed
          792  +
          793  +proc StrToAccelerator, .hString
          794  +.res TFastKey
          795  +begin
          796  +        pushad
          797  +
          798  +        stdcall StrSplitList, [.hString], "+", FALSE
          799  +        mov     edx, eax
          800  +        xor     ecx, ecx
          801  +        mov     [.res.flags], ecx
          802  +        mov     [.res.key], ecx
          803  +
          804  +.loop:
          805  +        cmp     ecx, [edx+TArray.count]
          806  +        jae     .finish
          807  +
          808  +        mov     ebx, Ctrl
          809  +        stdcall StrCompNoCase, [edx+TArray.array + 4*ecx], txt "Ctrl"
          810  +        jc      .setflag
          811  +        stdcall StrCompNoCase, [edx+TArray.array + 4*ecx], txt "Control"
          812  +        jc      .setflag
          813  +        stdcall StrCompNoCase, [edx+TArray.array + 4*ecx], txt "Ctl"
          814  +        jc      .setflag
          815  +
          816  +        mov     ebx, Alt
          817  +        stdcall StrCompNoCase, [edx+TArray.array + 4*ecx], txt "Alt"
          818  +        jc      .setflag
          819  +
          820  +        mov     ebx, Shift
          821  +        stdcall StrCompNoCase, [edx+TArray.array + 4*ecx], txt "Shift"
          822  +        jc      .setflag
          823  +
          824  +        stdcall StrLenUtf8, [edx+TArray.array + 4*ecx], -1
          825  +        cmp     eax, 1
          826  +        je      .setkey
          827  +
          828  +; search the key in the key-names.
          829  +        mov     esi, __FunctionalKeyNames
          830  +
          831  +.key_loop:
          832  +        cmp     word [esi], 0
          833  +        je      .next           ; ignore not found
          834  +
          835  +        movzx   eax, word [esi+2]
          836  +        add     eax, esi
          837  +        stdcall StrCompNoCase, [edx+TArray.array + 4*ecx], eax
          838  +        jc      .found
          839  +
          840  +        add     esi, 4
          841  +        jmp     .key_loop
          842  +
          843  +.found:
          844  +        movzx   eax, word [esi]
          845  +        mov     [.res.key], eax
          846  +        or      [.res.flags], fkScancode
          847  +        jmp     .next
          848  +
          849  +.setkey:
          850  +        stdcall StrPtr, [edx+TArray.array + 4*ecx]
          851  +        push    edx
          852  +        stdcall DecodeUtf8, [eax]
          853  +        pop     edx
          854  +        mov     [.res.key], eax
          855  +        and     [.res.flags], not fkScancode
          856  +        jmp     .next
          857  +
          858  +.setflag:
          859  +        or      [.res.flags], ebx
          860  +
          861  +.next:
          862  +        inc     ecx
          863  +        jmp     .loop
          864  +
          865  +.finish:
          866  +        stdcall ListFree, edx, StrDel
          867  +
          868  +        mov     eax, [.res.flags]
          869  +        mov     edx, [.res.key]
          870  +        mov     [esp+4*regEAX], eax
          871  +        mov     [esp+4*regEDX], edx
          872  +        popad
          873  +        return
          874  +endp
          875  +
          876  +
          877  +
   761    878   
   762    879   method TMenu.SetSelected
   763    880   begin
   764    881           pushad
   765    882   
   766    883           mov     esi, [.self]
   767    884           mov     ecx, [.value]
................................................................................
   772    889           test    edi, edi
   773    890           jz      .finish
   774    891   
   775    892           cmp     ecx, [edi+TArray.count]
   776    893           jae     .finish
   777    894   
   778    895           mov     [esi+TMenu._selected], ecx
   779         -;        exec    esi, TWindow:Refresh
   780    896   
   781    897   ; compute Y coordinate
   782    898   
   783    899           lea     edi, [edi+TArray.array]
   784    900           xor     ebx, ebx
   785    901   
   786    902   .loop:
................................................................................
   793    909   
   794    910   .height_ok:
   795    911   
   796    912           mov     eax, ebx
   797    913           add     eax, [edi+TMenuItem.height]
   798    914           exec    esi, TMenu:RectChanged2, 0;, ebx, [esi+TWindow._width], eax
   799    915   
   800         -; hide old menu if active:
   801         -
   802         -        cmp     [__ActiveMenu], esi
   803         -        je      .hide_ok
   804         -
   805         -        set     [__ActiveMenu], TWindow:Visible, FALSE
   806         -        mov     [__ActiveMenu], esi
   807         -
   808         -.hide_ok:
   809    916           cmp     [edi+TMenuItem.type], mitSubmenu
   810         -        jne     .finish               ;hide_old
          917  +        jne     .hide_old
   811    918   
   812    919           get     eax, [edi+TMenuItem.item], TMenu:Enabled
   813    920           test    eax, eax
   814         -        jz      .finish
          921  +        jz      .hide_old
   815    922   
   816    923           mov     eax, [esi+TMenu._width]
   817    924           sub     eax, [GUI.menuIconMargin]
   818    925   
   819         -        exec    [edi+TMenuItem.item], TMenu:Show, esi, eax, ebx
   820         -;        jmp     .finish
   821         -;
   822         -;.hide_old:
   823         -;        cmp     [__ActiveMenu], esi
   824         -;        je      .finish
   825         -;
   826         -;        set     [__ActiveMenu], TWindow:Visible, FALSE
   827         -;        mov     [__ActiveMenu], esi
          926  +        exec    [edi+TMenuItem.item], TMenu:Show, esi, eax, ebx ; will hide the previous open submenu!
          927  +        jmp     .finish
          928  +
          929  +; hide old menu if active:
          930  +.hide_old:
          931  +        cmp     [esi+TMenu._ActiveSubmenu], 0
          932  +        je      .finish
          933  +
          934  +        set     [esi+TMenu._ActiveSubmenu], TWindow:Visible, FALSE
          935  +        and     [esi+TMenu._ActiveSubmenu], 0
   828    936   
   829    937   .finish:
   830    938           popad
   831    939           return
   832    940   endp
   833    941   
   834    942   

Changes to freshlib/gui/TScrollable.asm.

   108    108           mov     [esi+TScrollable._BackGroundV], eax
   109    109   
   110    110           test    ebx, ebx
   111    111           jz      .finish
   112    112   
   113    113   .create_new:
   114    114   
   115         -        DebugMsg "TScrollable create background TImages!"
          115  +;        DebugMsg "TScrollable create background TImages!"
   116    116   
   117    117           mov     ecx, [GUI.scrollWidth]
   118    118   
   119    119           stdcall CreateImage, [ebx+TImage.width], ecx
   120    120           mov     [esi+TScrollable._BackGroundH], eax
   121    121   
   122    122           stdcall CreateImage, ecx, [ebx+TImage.height]
................................................................................
   344    344   ; draw the slider Y
   345    345   
   346    346           lea     eax, [esi+TScrollable._scrY]
   347    347           stdcall _SliderPixels2, eax, [.rectY.height]
   348    348   
   349    349           mov     edi, [esi+TScrollable._scrY.state]
   350    350   
   351         -        OutputValue "Length Y:", [.rectY.height], 10, -1
   352         -        OutputValue "Pos Y:", eax, 10, -1
   353         -        OutputValue "Page Y:", edx, 10, -1
          351  +;        OutputValue "Length Y:", [.rectY.height], 10, -1
          352  +;        OutputValue "Pos Y:", eax, 10, -1
          353  +;        OutputValue "Page Y:", edx, 10, -1
   354    354   
   355    355           mov     ecx, [.rectY.height]
   356    356           sub     ecx, edx
   357    357           cmp     eax, ecx
   358    358           cmovg   eax, ecx
   359    359   
   360    360           mov     ecx, [esi+TScrollable._scrY.pos]

Added freshlib/gui/TToolbar.asm.

            1  +; _______________________________________________________________________________________
            2  +;|                                                                                       |
            3  +;| ..::FreshLib::..  Free, open source. Licensed under "BSD 2-clause" license."          |
            4  +;|_______________________________________________________________________________________|
            5  +;
            6  +;  Description: TToolbar object class
            7  +;
            8  +;  Target OS: Any
            9  +;
           10  +;  Dependencies:
           11  +;
           12  +;  Notes: Represents GUI button.
           13  +;_________________________________________________________________________________________
           14  +module "TToolbar library"
           15  +
           16  +tbbSeparator = 0
           17  +
           18  +tbsNeutral  = bsNeutral
           19  +tbsHovered  = bsHovered
           20  +tbsPressed  = bsPressed
           21  +tbsDisabled = bsDisabled
           22  +
           23  +
           24  +struct TToolButton
           25  +  .action dd ?          ; can be pointer to TAction object, or TMenu or tbbSeparator (0)
           26  +  .state  dd ?
           27  +  .width  dd ?
           28  +ends
           29  +
           30  +
           31  +object TToolbar, TWindow
           32  +
           33  +; private fields
           34  +
           35  +  ._canvas       dd ?
           36  +  ._canvas_valid dd ?
           37  +
           38  +  ._btn_height   dd ?
           39  +
           40  +  ._buttons     dd ?            ; TArray of TToolButton structures.
           41  +
           42  +; methods
           43  +
           44  +  method .Create, .Parent
           45  +  method .ForceRefresh
           46  +
           47  +  method .HitTest, .x, .y
           48  +  method .ClearState
           49  +
           50  +  method .AddButton, .action
           51  +
           52  +  method ._RenderView
           53  +
           54  +  method .SelfPaint, .pDstImage, .xDst, .yDst, .xSrc, .ySrc, .width, .height
           55  +
           56  +  method .Autosize
           57  +
           58  +  ; system events methods
           59  +
           60  +  method .EventMouseEnter
           61  +  method .EventMouseLeave
           62  +  method .EventMouseMove, .x, .y, .kbdState
           63  +
           64  +  method .EventButtonPress, .button, .kbdState, .x, .y
           65  +  method .EventButtonRelease, .button, .kbdState, .x, .y
           66  +
           67  +endobj
           68  +
           69  +
           70  +interface TToolbar.OnClick, .self, .button
           71  +
           72  +
           73  +; new
           74  +
           75  +method TToolbar.Create
           76  +begin
           77  +        inherited [.Parent]
           78  +        push    esi
           79  +
           80  +        mov     esi, [.self]
           81  +        mov     [esi+TToolbar._cursor], mcHand
           82  +        mov     [esi+TToolbar.__want_focus], FALSE
           83  +
           84  +        stdcall CreateArray, sizeof.TToolButton
           85  +        mov     [esi+TToolbar._buttons], eax
           86  +        mov     [esi+TToolbar._btn_height], 24
           87  +
           88  +        pop     esi
           89  +        return
           90  +endp
           91  +
           92  +
           93  +
           94  +method TToolbar.ForceRefresh
           95  +begin
           96  +        mov     eax, [.self]
           97  +        and     [eax+TToolbar._canvas_valid], 0
           98  +        inherited
           99  +        return
          100  +endp
          101  +
          102  +
          103  +method TToolbar.SelfPaint
          104  +begin
          105  +        pushad
          106  +        mov     esi, [.self]
          107  +
          108  +        cmp     [esi+TToolbar._canvas_valid], 0
          109  +        jne     @f
          110  +        exec    esi, TToolbar:_RenderView
          111  +@@:
          112  +        mov     ebx, [esi+TToolbar._canvas]
          113  +        test    ebx, ebx
          114  +        jz      .finish
          115  +
          116  +        stdcall BlendImage, [.pDstImage], [.xDst], [.yDst], ebx, [.xSrc], [.ySrc], [.width], [.height]
          117  +
          118  +.finish:
          119  +        popad
          120  +        inherited [.pDstImage], [.xDst], [.yDst], [.xSrc], [.ySrc], [.width], [.height]
          121  +        return
          122  +endp
          123  +
          124  +
          125  +method TToolbar.HitTest
          126  +begin
          127  +        pushad
          128  +
          129  +        mov     esi, [.self]
          130  +        mov     edi, [esi+TToolbar._buttons]
          131  +        mov     ecx, [edi+TArray.count]
          132  +        lea     edi, [edi+TArray.array]
          133  +
          134  +.loop:
          135  +        dec     ecx
          136  +        js      .not_found
          137  +
          138  +        mov     eax, [edi+TToolButton.width]
          139  +        cmp     [.x], eax
          140  +        jl      .found
          141  +
          142  +        sub     [.x], eax
          143  +        add     edi, sizeof.TToolButton
          144  +        jmp     .loop
          145  +
          146  +.found:
          147  +        cmp     [edi+TToolButton.action], 0
          148  +        je      .not_found
          149  +
          150  +        mov     [esp+4*regEAX], edi
          151  +        clc
          152  +        popad
          153  +        return
          154  +
          155  +.not_found:
          156  +        stc
          157  +        popad
          158  +        return
          159  +endp
          160  +
          161  +
          162  +method TToolbar.AddButton
          163  +begin
          164  +        pushad
          165  +
          166  +        mov     esi, [.self]
          167  +        mov     edx, [esi+TToolbar._buttons]
          168  +        mov     ecx, [.action]
          169  +
          170  +        stdcall AddArrayItems, edx, 1
          171  +        mov     [esi+TToolbar._buttons], edx
          172  +
          173  +        test    ecx, ecx
          174  +        cmovz   edx, [GUI.tbSeparatorWidth]
          175  +        cmovnz  edx, [esi+TToolbar._btn_height]
          176  +
          177  +        mov     [eax+TToolButton.action], ecx
          178  +        mov     [eax+TToolButton.state], tbsNeutral
          179  +        mov     [eax+TToolButton.width], edx
          180  +
          181  +        exec    esi, TToolbar:ForceRefresh
          182  +        popad
          183  +        return
          184  +endp
          185  +
          186  +
          187  +
          188  +method TToolbar.ClearState
          189  +begin
          190  +        pushad
          191  +        mov     esi, [.self]
          192  +        mov     edi, [esi+TToolbar._buttons]
          193  +        mov     ecx, [edi+TArray.count]
          194  +        lea     edi, [edi+TArray.array]
          195  +
          196  +.loop:
          197  +        dec     ecx
          198  +        js      .finish
          199  +
          200  +        mov     [edi+TToolButton.state], tbsNeutral
          201  +        add     edi, sizeof.TToolButton
          202  +        jmp     .loop
          203  +
          204  +.finish:
          205  +        popad
          206  +        return
          207  +endp
          208  +
          209  +
          210  +
          211  +method TToolbar._RenderView
          212  +begin
          213  +        pushad
          214  +
          215  +        mov     esi, [.self]
          216  +        mov     edi, [esi+TToolbar._buttons]
          217  +        mov     ecx, [edi+TArray.count]
          218  +        jecxz   .finish
          219  +
          220  +        mov     ebx, [esi+TToolbar._canvas]
          221  +        test    ebx, ebx
          222  +        jnz     .canvas_ok
          223  +
          224  +        mov     eax, ecx
          225  +        imul    eax, [esi+TToolbar._btn_height]
          226  +        stdcall CreateImage, eax, [esi+TToolbar._btn_height]
          227  +        mov     [esi+TToolbar._canvas], eax
          228  +        mov     ebx, eax
          229  +
          230  +.canvas_ok:
          231  +
          232  +        lea     edi, [edi + TArray.array]
          233  +        xor     edx, edx
          234  +
          235  +.loop:
          236  +        dec     ecx
          237  +        js      .finish
          238  +
          239  +        stdcall DrawToolbarBtn, ebx, edi, edx, 0, [esi+TToolbar._btn_height]
          240  +
          241  +        add     edx, [edi+TToolButton.width]
          242  +        add     edi, sizeof.TToolButton
          243  +        jmp     .loop
          244  +
          245  +
          246  +.finish:
          247  +        popad
          248  +        return
          249  +endp
          250  +
          251  +
          252  +
          253  +
          254  +proc DrawToolbarBtn, .canvas, .pButton, .x, .y, .height
          255  +.bounds TBounds
          256  +begin
          257  +        pushad
          258  +        mov     edi, [.pButton]
          259  +
          260  +        mov     eax, [.x]
          261  +        mov     ecx, [.y]
          262  +        mov     [.bounds.x], eax
          263  +        mov     [.bounds.y], ecx
          264  +
          265  +        mov     eax, [edi+TToolButton.width]
          266  +        mov     ecx, [.height]
          267  +        mov     [.bounds.width], eax
          268  +        mov     [.bounds.height], ecx
          269  +
          270  +        mov     ebx, [edi+TToolButton.state]
          271  +
          272  +        lea     eax, [.bounds]
          273  +        stdcall DrawBoxDefault, [.canvas], eax, [GUI.clToolBtnBk+4*ebx], [GUI.tbBorder+4*ebx], [GUI.tbBorderWidth]
          274  +
          275  +        cmp     [edi+TToolButton.action], 0
          276  +        je      .draw_separator
          277  +
          278  +        istype  [edi+TToolButton.action], TAction
          279  +        jne     .finish
          280  +
          281  +        add     [.bounds.x], 4
          282  +        add     [.bounds.y], 4
          283  +
          284  +        mov     eax, [GUI.tbPressedOfsX]
          285  +        mov     edx, [GUI.tbPressedOfsY]
          286  +
          287  +        cmp     [edi+TToolButton.state], tbsHovered
          288  +        jne     @f
          289  +        neg     eax
          290  +        neg     edx
          291  +@@:
          292  +        cmp     [edi+TToolButton.state], tbsPressed
          293  +        je      @f
          294  +        cmp     [edi+TToolButton.state], tbsHovered
          295  +        je      @f
          296  +        xor     eax, eax
          297  +        xor     edx, edx
          298  +@@:
          299  +        add     [.bounds.x], eax
          300  +        add     [.bounds.y], edx
          301  +
          302  +        get     ecx, [edi+TToolButton.action], TAction:Icon
          303  +        test    ecx, ecx
          304  +        jz      .finish
          305  +
          306  +        stdcall BlendImage, [.canvas], [.bounds.x], [.bounds.y], ecx, 0, 0, [ecx+TImage.width], [ecx+TImage.height]
          307  +
          308  +.finish:
          309  +        popad
          310  +        return
          311  +
          312  +.draw_separator:
          313  +
          314  +        mov     ecx, [edi+TToolButton.width]
          315  +        sub     ecx, 2
          316  +        sub     [.bounds.height], ecx
          317  +        shr     ecx, 1
          318  +        add     [.bounds.x], ecx
          319  +        add     [.bounds.y], ecx
          320  +        mov     [.bounds.width], 2
          321  +
          322  +        lea     eax, [.bounds]
          323  +        stdcall DrawBoxDefault, [.canvas], eax, 0, [GUI.tbSeparatorType], 1
          324  +;        stdcall DrawSolidRect, [.canvas], ecx, [.bounds.y], 2, [.bounds.height], [GUI.clToolSeparator]
          325  +;        stdcall DrawSolidRect, [.canvas], [.bounds.x], 0, [edi+TToolButton.width], 2, clAlizarin
          326  +
          327  +        jmp     .finish
          328  +
          329  +
          330  +endp
          331  +
          332  +
          333  +
          334  +method TToolbar.Autosize
          335  +begin
          336  +        inherited
          337  +        mov     edx, [.self]
          338  +        mov     edx, [edx+TToolbar._btn_height]
          339  +        return
          340  +endp
          341  +
          342  +
          343  +
          344  +method TToolbar.EventMouseEnter
          345  +begin
          346  +;        exec    [.self], TToolbar:SimpleSetParam, 0, TToolbar._state, bsHovered
          347  +        inherited
          348  +        return
          349  +endp
          350  +
          351  +
          352  +method TToolbar.EventMouseLeave
          353  +begin
          354  +        exec    [.self], TToolbar:ClearState
          355  +        exec    [.self], TToolbar:ForceRefresh
          356  +        inherited
          357  +        return
          358  +endp
          359  +
          360  +
          361  +method TToolbar.EventMouseMove
          362  +begin
          363  +        test    [.kbdState], maskBtnLeft
          364  +        jnz     .exit
          365  +
          366  +        exec    [.self], TToolbar:ClearState
          367  +        exec    [.self], TToolbar:HitTest, [.x], [.y]
          368  +        jc      .finish
          369  +
          370  +        mov     [eax+TToolButton.state], bsHovered
          371  +
          372  +.finish:
          373  +        exec    [.self], TToolbar:ForceRefresh
          374  +
          375  +.exit:
          376  +        inherited [.x], [.y], [.kbdState]
          377  +        return
          378  +endp
          379  +
          380  +
          381  +method TToolbar.EventButtonPress
          382  +begin
          383  +        exec    [.self], TToolbar:ClearState
          384  +        exec    [.self], TToolbar:HitTest, [.x], [.y]
          385  +        jc      .finish
          386  +
          387  +        mov     [eax+TToolButton.state], bsPressed
          388  +        stdcall SetMouseCapture, [.self]
          389  +
          390  +.finish:
          391  +        exec    [.self], TToolbar:ForceRefresh
          392  +        return
          393  +endp
          394  +
          395  +
          396  +
          397  +method TToolbar.EventButtonRelease
          398  +begin
          399  +        pushad
          400  +        stdcall SetMouseCapture, 0
          401  +
          402  +        mov     esi, [.self]
          403  +        mov     edi, [esi+TToolbar._buttons]
          404  +        mov     ecx, [edi+TArray.count]
          405  +        lea     edi, [edi+TArray.array]
          406  +
          407  +.loop:
          408  +        dec     ecx
          409  +        js      .finish
          410  +
          411  +        cmp     [edi+TToolButton.state], tbsPressed
          412  +        je      .end_scan
          413  +
          414  +        add     edi, sizeof.TToolButton
          415  +        jmp     .loop
          416  +
          417  +.end_scan:
          418  +        exec    esi, TToolbar:HitTest, [.x], [.y]
          419  +        jc      .finish
          420  +
          421  +        cmp     eax, edi
          422  +        jne     .finish
          423  +
          424  +        mov     [edi+TToolButton.state], bsHovered
          425  +        exec    esi, TToolbar:ForceRefresh
          426  +
          427  +        istype  [edi+TToolButton.action], TAction
          428  +        jne     .finish
          429  +
          430  +        exec    [edi+TToolButton.action], TAction:Execute, esi
          431  +
          432  +.finish:
          433  +        popad
          434  +        return
          435  +endp
          436  +
          437  +
          438  +
          439  +endmodule

Changes to freshlib/gui/TTreeView.asm.

   259    259           mov     esi, [.pTreeView]
   260    260           mov     ebx, [.pItem]
   261    261   
   262    262           mov     eax, [ebx+TTreeViewItem.xwidth]
   263    263           cmp     eax, [esi+TTreeView._max_width]
   264    264           jle     @f
   265    265           mov     [esi+TTreeView._max_width], eax
   266         -        OutputValue "Max width:", eax, 10, -1
          266  +;        OutputValue "Max width:", eax, 10, -1
   267    267   @@:
   268    268   
   269    269           mov     esi, [esi+TTreeView._items]
   270    270           lea     esi, [esi+TArray.array]
   271    271   
   272    272           mov     edi, [.user]
   273    273           sub     ebx, esi
................................................................................
   319    319   
   320    320   method TTreeView.__RenderView
   321    321   .bounds TBounds
   322    322   .end_item dd ?
   323    323   begin
   324    324           pushad
   325    325   
   326         -if defined options.DebugMode & options.DebugMode
   327         -        stdcall  GetFineTimestamp
   328         -        push     eax
   329         -end if
          326  +;if defined options.DebugMode & options.DebugMode
          327  +;        stdcall  GetFineTimestamp
          328  +;        push     eax
          329  +;end if
   330    330   
   331    331           mov     esi, [.self]
   332    332           get     ebx, esi, TTreeView:Canvas
   333    333           test    ebx, ebx
   334    334           jz      .finish
   335    335   
   336    336           xor     eax, eax
................................................................................
   391    391           or      ecx, bxNoFill
   392    392           stdcall [DrawBox], [esi+TTreeView._canvas], eax, [GUI.clTreeViewBack], ecx, [GUI.boxBorderWidth]
   393    393   
   394    394   
   395    395   .finish:
   396    396           inherited
   397    397   
   398         -if defined options.DebugMode & options.DebugMode
   399         -
   400         -        stdcall GetFineTimestamp
   401         -        sub     eax, [esp]
   402         -        OutputValue "TreeView.Paint time: ", eax, 10, -1
   403         -        add     esp, 4
   404         -end if
          398  +;if defined options.DebugMode & options.DebugMode
          399  +;
          400  +;        stdcall GetFineTimestamp
          401  +;        sub     eax, [esp]
          402  +;        OutputValue "TreeView.Paint time: ", eax, 10, -1
          403  +;        add     esp, 4
          404  +;end if
   405    405   
   406    406           popad
   407    407           return
   408    408   endp
   409    409   
   410    410   
   411    411   proc TTreeView.__PaintOneItem, .pTreeView, .pItem, .pNextItem, .hsize, .vsize, .y, .focused
................................................................................
   609    609   
   610    610   .pgdn:
   611    611           get     edx, esi, TTreeView:PageY
   612    612           dec     edx
   613    613   
   614    614   
   615    615   .move_down:
   616         -        OutputValue "Move down distance:", edx, 10, -1
          616  +;        OutputValue "Move down distance:", edx, 10, -1
   617    617   
   618    618           mov     edi, [esi+TTreeView._index]
   619    619           mov     ebx, [esi+TTreeView._focused]
   620    620   
   621    621           add     ebx, edx
   622    622   
   623    623           cmp     ebx, [edi+TArray.count]

Changes to freshlib/gui/TWindow.asm.

   346    346   ; renders the children windows on the provided TImage/rectangle.
   347    347   ; The implementations for the controls can use any method of paint, but must to call
   348    348   ; "inherited" at the end;
   349    349   
   350    350   method TWindow.SelfPaint  ; .pDstImage, .xDst, .yDst, .xSrc, .ySrc, .width, .height
   351    351   .src  RECT
   352    352   .dest RECT
          353  +.ofsx dd ?
          354  +.ofsy dd ?
   353    355   begin
   354    356           pushad
   355    357   
   356    358           mov     esi, [.self]
   357    359           stdcall LockImg, [.pDstImage]
   358    360   
   359    361           mov     eax, [esi+TWindow._OnSelfPaint]
................................................................................
   364    366           stdcall eax, esi, [.pDstImage], [.xDst], [.yDst], [.xSrc], [.ySrc], [.width], [.height]
   365    367           pop     esi
   366    368   
   367    369   .user_event_processed:
   368    370   
   369    371   ; The source rectangle:
   370    372   
   371         -        mov     ecx, [.xSrc]
   372         -        mov     edx, [.ySrc]
          373  +        mov     ecx, [.xDst]
          374  +        mov     edx, [.yDst]
          375  +        sub     ecx, [.xSrc]
          376  +        sub     edx, [.ySrc]
          377  +        mov     [.ofsx], ecx    ; .ofsx and .ofsy actually are the X and Y position of the top-left corner
          378  +        mov     [.ofsy], edx    ; of the window on the destination image.
          379  +
          380  +        mov     ecx, [.xDst]
          381  +        mov     edx, [.yDst]
   373    382           mov     [.src.left], ecx
   374    383           mov     [.src.top], edx
   375    384           add     ecx, [.width]
   376    385           add     edx, [.height]
   377    386           mov     [.src.right], ecx
   378    387           mov     [.src.bottom], edx
   379    388           lea     edi, [.src]
................................................................................
   397    406           istype  esi, TWindow
   398    407           jne     .children_loop
   399    408   
   400    409           get     eax, esi, TWindow:Visible
   401    410           test    eax, eax
   402    411           jz      .children_loop
   403    412   
   404         -        push    [esi+TWindow._x] [esi+TWindow._y] [esi+TWindow._width] [esi+TWindow._height]
   405         -        pop     [.dest.bottom] [.dest.right] [.dest.top] [.dest.left]
   406         -
   407         -        mov     eax, [.dest.left]
   408         -        add     [.dest.right], eax
   409         -
   410         -        mov     eax, [.dest.top]
   411         -        add     [.dest.bottom], eax
          413  +        mov     eax, [esi+TWindow._x]
          414  +        mov     edx, [esi+TWindow._y]
          415  +        add     eax, [.ofsx]
          416  +        add     edx, [.ofsy]
          417  +        mov     [.dest.left], eax
          418  +        mov     [.dest.top], edx
          419  +        add     eax, [esi+TWindow._width]
          420  +        add     edx, [esi+TWindow._height]
          421  +        mov     [.dest.right], eax
          422  +        mov     [.dest.bottom], edx
   412    423   
   413    424           lea     eax, [.dest]
   414    425           stdcall RectIntersect, eax, eax, edi
   415    426           jc      .children_loop                  ; the rectangles does not intersect, so the child should not to be painted.
   416    427   
   417    428           mov     eax, [.dest.left]
   418    429           mov     edx, [.dest.top]
   419    430           sub     [.dest.right], eax      ; source rectangle width
   420    431           sub     [.dest.bottom], edx     ; source rectangle height
   421    432   
   422    433           sub     eax, [esi+TWindow._x]
   423    434           sub     edx, [esi+TWindow._y]
          435  +        sub     eax, [.ofsx]
          436  +        sub     edx, [.ofsy]
   424    437   
   425         -; notice, that the children are self painted only with spBlend operation!
   426    438           exec    esi, TWindow:SelfPaint, [.pDstImage], [.dest.left], [.dest.top], eax, edx, [.dest.right], [.dest.bottom]
   427         -
   428    439           jmp     .children_loop
   429    440   
   430    441   .end_loop:
   431    442           stdcall UnlockImg, [.pDstImage]
   432    443           popad
   433    444           return
   434    445   endp
................................................................................
   776    787   ;_________________________________________________________________________________________
   777    788   
   778    789   ;---------------------------------------------------------------------------------
   779    790   ; Arguments:
   780    791   ;   .self
   781    792   ;   .x
   782    793   ;   .y
          794  +;   .onlyenabled
   783    795   ;
   784    796   ; Returns:
   785    797   ;   eax - pointer to TWindow
   786    798   ;   ecx - X coordinates, translated to the client coordinates of the child.
   787    799   ;   edx - Y coordinates, translated to the client coordinates of the child.
   788    800   ;
   789    801   ; If children window was not found, the method returns:
................................................................................
   880    892   ;
   881    893   ; Includes the passed rectangle in the invalid rectangles list. Later this rectangle will need
   882    894   ; to be repainted, but only when the screen image is required.
   883    895   ;
   884    896   
   885    897   method TWindow.RectChanged2      ;, .pRect
   886    898   
          899  +.prect  RECT
   887    900   .rect   RECT
   888    901   .client RECT
   889    902   
   890    903   begin
   891    904           pushad
   892    905   
   893    906           mov     esi, [.self]
   894    907   
          908  +        mov     ecx, [.pRect]
          909  +        jecxz   .prect_ok
          910  +
          911  +        lea     eax, [.prect]
          912  +        stdcall RectCopy, eax, [.pRect]
          913  +        mov     [.pRect], eax
          914  +
          915  +.prect_ok:
   895    916           get     ecx, esi, TWindow:width
   896    917           get     edx, esi, TWindow:height
   897    918           xor     eax, eax
   898    919   
   899    920           mov     [.client.left], eax
   900    921           mov     [.client.top], eax
   901    922           mov     [.client.right], ecx
................................................................................
  1298   1319           jz      .finish
  1299   1320   
  1300   1321           exec    edx, TWindow:RectChangedXY2, [esi+TWindow._x], [esi+TWindow._y], [esi+TWindow._width], [esi+TWindow._height]        ; previous position.
  1301   1322   
  1302   1323           mov     [esi+TWindow._x], ebx
  1303   1324           mov     [esi+TWindow._y], ecx
  1304   1325   
         1326  +        istype esi, TForm
         1327  +        jne    @f
         1328  +
         1329  +        OutputValue "Form moved X:", ebx, 10, -1
         1330  +        OutputValue "Form moved Y:", ecx, 10, -1
         1331  +@@:
  1305   1332           exec    edx, TWindow:RectChangedXY2, [esi+TWindow._x], [esi+TWindow._y], [esi+TWindow._width], [esi+TWindow._height]       ; new position.
  1306   1333   
  1307   1334   .finish:
  1308   1335           popad
  1309   1336           return
  1310   1337   endp
  1311   1338   

Changes to freshlib/gui/all.asm.

    45     45   include 'TLabel.asm'
    46     46   include 'TImageLabel.asm'
    47     47   include 'TMenu.asm'
    48     48   include 'TProgressbar.asm'
    49     49   include 'TScrollWindow.asm'
    50     50   include 'TScrollable.asm'
    51     51   include 'TTreeView.asm'
           52  +include 'TToolbar.asm'
    52     53   ;include 'TGrid.asm'
    53     54   
    54     55   include 'dialogs.asm'
    55     56   include 'SplitGrid.asm'
    56     57   
    57     58   
    58     59   ; OS independent main procedures.

Changes to freshlib/gui/themes/flat_gui.asm.

    15     15   ;_________________________________________________________________________________________
    16     16   module "GUI theme data and code library"
    17     17   
    18     18   ; Named theme colors
    19     19   
    20     20   ; cyan
    21     21   clTurquoise = $ff1abc9c
           22  +clTurquoiseL = $ff31e2bf
           23  +clTurquoiseD = $ff138670
           24  +
    22     25   clGreenSea  = $ff16A085
    23     26   
    24     27   ; green
    25     28   clEmerald   = $ff2ecc71
    26     29   clNephritis = $ff27ae60
    27     30   
    28     31   ; blue
................................................................................
    62     65   clPumpkin = $ffd35400
    63     66   
    64     67   ; Red
    65     68   
    66     69   clAlizarin =    $ffe74c3c
    67     70   clPomegranate = $ffc0392b
    68     71   
           72  +clBelizeClouds = $ffc9dce7 ; a blend between clBelizeHole and clClouds
           73  +
    69     74   iglobal
    70     75   
    71     76           NamedArray      GUI,                                           \
    72     77   \
    73     78   \ ; Text caret color
    74     79                   clTextCaret,       HEX, clAlizarin,                     \       ;(clAlizarin and $00ffffff) or $e0000000,                    \
    75     80                   caretTimes,        NUM, <250, 250>,                    \
    76     81   \ ; Widgets border colors and width
    77     82                   clBorderNeutral,   HEX, clTurquoise,                   \
    78         -                clBorderLight,     HEX, clTurquoise,                   \
    79         -                clBorderDark,      HEX, clTurquoise,                   \
           83  +                clBorderLight,     HEX, clTurquoiseL,                      \
           84  +                clBorderDark,      HEX, clTurquoiseD,                  \
    80     85                   clBorderNeutralGray, HEX, $ff606060,                   \
    81         -                clBorderLightGray, HEX, $ff606060,                     \
    82         -                clBorderDarkGray,  HEX, $ff606060,                     \
           86  +                clBorderLightGray, HEX, $ff808080,                     \
           87  +                clBorderDarkGray,  HEX, $ff404040,                     \
    83     88                   clBorderFocused,   HEX, clAlizarin,                    \
    84     89   \
    85     90                   boxBorderWidth,  NUM, 2,                               \
    86     91   \
    87     92   \ ; TButton colors and styles. The multivalue fields are for Neutral, Hovered and Pressed states.
    88     93   \
    89     94                  clBtnBk,         HEX, <clTurquoise, $ff48c9b0, clGreenSea, $807b7b7b>,   \
................................................................................
    90     95                  clBtnTxt,        HEX, <clWhite, clWhite, clSilver, $80ffffff>,           \
    91     96                  btnBorder,       NUM, <bxNone, bxNone, bxNone, bxNone or bxDisabled>,    \
    92     97                  btnPressedOfsX,  NUM, 0,                                      \
    93     98                  btnPressedOfsY,  NUM, 0,                                      \
    94     99                  btnMarginX,      NUM, 8,                                      \
    95    100                  btnMarginY,      NUM, 8,                                      \
    96    101   \
          102  +\ ; Toolbar buttons colors and styles
          103  +               clToolBtnBk,     HEX, <clClouds, clBelizeClouds, clBelizeClouds, clClouds>,   \
          104  +               clToolBtnTxt,    HEX, <$ff000000, $ff000000, $ff000000, $80000000>,           \
          105  +               tbBorder,        NUM, <bxNone, bxNone, bxNone, bxNone or bxDisabled>,         \
          106  +               tbBorderWidth,   NUM, 1,                                      \
          107  +               tbPressedOfsX,   NUM, 0,                                      \
          108  +               tbPressedOfsY,   NUM, 2,                                      \
          109  +               tbSeparatorType,  HEX, bxFlat or bxDisabled,                  \
          110  +               tbSeparatorWidth, NUM, 10,                                     \
          111  +\
    97    112   \ ; TEdit colors and styles.
    98    113   \
    99    114                  clEditBk,          HEX, clClouds,                             \
   100    115                  clEditBkFocused,   HEX, clClouds,                             \
   101    116                  clEditTxt,         HEX, $ff000000,                            \
   102    117                  clEditSel,         HEX, clBelizeHole and $00ffffff or $60000000,                         \
   103    118                  clEditSelTxt,      HEX, $ffffffff,                            \
................................................................................
   145    160   \
   146    161   \ ; TMenu colors and styles
   147    162   \
   148    163                 clMenuBack,         HEX, clClouds,                                             \
   149    164                 clMenuText,         HEX, $ff000000,                                            \
   150    165                 clMenuTextGray,     HEX, $90000000,                                            \
   151    166                 clMenuSelection,    HEX, clBelizeHole,                                         \
          167  +              clMenuSelIcon,      HEX, clBelizeClouds,                                       \
   152    168                 borderMenu,         NUM, bxFlat,                                               \
   153    169                 menuIconMargin,     NUM, 4,                                                    \
   154    170                 menuSeparatorHeight,NUM, 12,                                                   \
   155    171                 menuMinTextDist,    NUM, 32,                                                   \
   156    172                 menuSubIcon,        PNG, "%lib%/gui/images/menu/submenu.png",                  \
   157    173                 menuSubIconSel,     PNG, "%lib%/gui/images/menu/submenusel.png",               \
   158    174                 menuSubIconGray,    PNG, "%lib%/gui/images/menu/submenugray.png",              \

Changes to freshlib/gui/themes/win_gui.asm.

    42     42                  clBtnTxt,        HEX, <$ff000000, $ff000000, $ff000000, $ff606060>,           \
    43     43                  btnBorder,       NUM, <bxRaised, bxRaised, bxSunken, bxRaised or bxDisabled>,               \
    44     44                  btnPressedOfsX,  NUM, 1,                                      \
    45     45                  btnPressedOfsY,  NUM, 1,                                      \
    46     46                  btnMarginX,      NUM, 8,                                      \
    47     47                  btnMarginY,      NUM, 8,                                      \
    48     48   \
           49  +\ ; Toolbar buttons colors and styles
           50  +               clToolBtnBk,     HEX, <$ffd4d0c8, $ffe0e0e0, $ffa0a0a0, $80d4d0c8>,              \
           51  +               clToolBtnTxt,    HEX, <$ff000000, $ff000000, $ff000000, $ff606060>,              \
           52  +               tbBorder,        NUM, <bxNone, bxRaised, bxSunken, bxNone or bxDisabled>,        \
           53  +               tbBorderWidth,   NUM, 1,                                      \
           54  +               tbPressedOfsX,   NUM, 1,                                      \
           55  +               tbPressedOfsY,   NUM, 1,                                      \
           56  +               tbSeparatorType,  HEX, bxSunken,                              \
           57  +               tbSeparatorWidth, NUM, 10,                                    \
           58  +\
    49     59   \ ; TEdit colors and styles.
    50     60   \
    51     61                  clEditBk,          HEX, $ffffffff,                            \
    52     62                  clEditBkFocused,   HEX, $ffffffff,                            \
    53     63                  clEditTxt,         HEX, $ff000000,                            \
    54     64                  clEditSel,         HEX, $600a246c,                            \
    55     65                  clEditSelTxt,      HEX, $ffffffff,                            \
................................................................................
    97    107   \
    98    108   \ ; TMenu colors and styles
    99    109   \
   100    110                 clMenuBack,         HEX, $ffd4d0c8,                                            \
   101    111                 clMenuText,         HEX, $ff000000,                                            \
   102    112                 clMenuTextGray,     HEX, $80000000,                                            \
   103    113                 clMenuSelection,    HEX, $ff000080,                                            \
          114  +              clMenuSelIcon,      HEX, $ffadaabb,                                            \
   104    115                 borderMenu,         NUM, bxRaised,                                             \
   105    116                 menuIconMargin,     NUM, 4,                                                    \
   106    117                 menuSeparatorHeight,NUM, 10,                                                   \
   107    118                 menuMinTextDist,    NUM, 32,                                                   \
   108    119                 menuSubIcon,        PNG, "%lib%/gui/images/menu/submenu.png",                  \
   109    120                 menuSubIconSel,     PNG, "%lib%/gui/images/menu/submenusel.png",               \
   110    121                 menuSubIconGray,    PNG, "%lib%/gui/images/menu/submenugray.png",              \

Changes to freshlib/system/Linux/files.asm.

    12     12   ;
    13     13   ;  Notes:
    14     14   ;_________________________________________________________________________________________
    15     15   
    16     16   uses libc
    17     17   
    18     18   DIR_SLASH equ '/'
           19  +DIR_SEP_PAIR equ '/\' ; for use with StrNormalizePath and StrNormalizePath2
    19     20   
    20     21   fsFromBegin     = 0
    21     22   fsFromEnd       = 2
    22     23   fsFromCurrent   = 1
    23     24   
    24     25   
    25     26   faReadOnly   = O_RDONLY
................................................................................
   651    652           int     $80
   652    653   
   653    654           mov     [esp+4*regEAX], eax
   654    655           bt      eax, 31         ; if negative - error
   655    656           popad
   656    657           return
   657    658   endp
          659  +
          660  +
          661  +
          662  +
          663  +
          664  +body IsRelativePath     ;, .hPath
          665  +begin
          666  +        push    eax
          667  +        stdcall StrLen, [.hPath]
          668  +        test    eax, eax
          669  +        jz      .relative
          670  +
          671  +        stdcall StrPtr, [.hPath]
          672  +        cmp     byte [eax], DIR_SLASH
          673  +        clc
          674  +        je      .finish
          675  +
          676  +.relative:
          677  +        stc     ; relative!
          678  +
          679  +.finish:
          680  +        pop     eax
          681  +        return
          682  +endp
          683  +
          684  +
          685  +
          686  +body GetCurrentPrefix
          687  +begin
          688  +        stdcall StrNew
          689  +        return
          690  +endp

Changes to freshlib/system/Win32/files.asm.

    11     11   ;
    12     12   ;  Notes:
    13     13   ;_________________________________________________________________________________________
    14     14   
    15     15   uses kernel32
    16     16   
    17     17   DIR_SLASH equ '\'
           18  +DIR_SEP_PAIR equ '\/'   ; for use with StrNormalizePath and StrNormalizePath2
    18     19   
    19     20   fsFromBegin     = FILE_BEGIN
    20     21   fsFromEnd       = FILE_END
    21     22   fsFromCurrent   = FILE_CURRENT
    22     23   
    23     24   faReadOnly   = GENERIC_READ
    24     25   faWriteOnly  = GENERIC_WRITE
................................................................................
   573    574   
   574    575   .notexists:
   575    576           stc
   576    577           popad
   577    578           return
   578    579   endp
   579    580   
          581  +
          582  +
          583  +
          584  +
          585  +body IsRelativePath     ;, .hPath
          586  +begin
          587  +        push    eax
          588  +        stdcall StrLen, [.hPath]
          589  +        cmp     eax, 3
          590  +        jb      .relative
          591  +
          592  +        stdcall StrPtr, [.hPath]
          593  +        cmp     byte [eax], DIR_SLASH
          594  +        jne      .drive
          595  +        cmp      byte [eax+1], DIR_SLASH
          596  +        jmp      .absolute
          597  +
          598  +.drive:
          599  +        cmp     byte [eax], 'A'
          600  +        jb      .relative
          601  +        cmp     byte [eax], 'Z'
          602  +        jbe     .maybe_drive
          603  +
          604  +        cmp     byte [eax], 'a'
          605  +        jb      .relative
          606  +        cmp     byte [eax], 'Z'
          607  +        ja      .relative
          608  +
          609  +.maybe_drive:
          610  +        cmp     byte [eax+1], ':'
          611  +        jne     .relative
          612  +
          613  +        cmp     byte [eax+2], DIR_SLASH
          614  +        jne     .relative
          615  +
          616  +.absolute:
          617  +        clc
          618  +        pop     eax
          619  +        return
          620  +
          621  +.relative:
          622  +        cmp     byte [eax], DIR_SLASH
          623  +        stc
          624  +        pop     eax
          625  +        return
          626  +endp
          627  +
          628  +
          629  +
          630  +
          631  +body GetCurrentPrefix
          632  +begin
          633  +        stdcall GetCurrentDir
          634  +        push    eax
          635  +
          636  +        stdcall StrPtr, eax
          637  +        and     dword [eax+2], 0
          638  +        mov     [eax+string.len], 2
          639  +
          640  +        pop     eax
          641  +        return
          642  +endp

Changes to freshlib/system/files.asm.

    26     26   __std_handle_out:
    27     27     var STDOUT = 1
    28     28   __std_handle_err:
    29     29     var STDERR = 2
    30     30   endg
    31     31   
    32     32   
           33  +;----------------------------------------------------
           34  +; Returns:
           35  +;   CF = 1 if the path is relative.
           36  +;
           37  +;   CF = 0 if the path is absolute.
           38  +;          In this case ZF=0 indicates that the
           39  +;          path is relative towards the current root
           40  +;          prefix (drive letter in Windows)
           41  +;          ZF=1 indicates that the path is fully absolute.
           42  +;
           43  +;   CF = 1 - the path is fully relative.
           44  +;   CF = 0, ZF = 1 - the path is fully absolute.
           45  +;   CF = 0, ZF = 0 - the path is absolute, but needs
           46  +;                    the current root prefix ahead.
           47  +;
           48  +; This procedure is OS dependent, because the
           49  +; paths are different in the different OSes.
           50  +;----------------------------------------------------
           51  +interface IsRelativePath, .hPath
           52  +
           53  +; Returns the current root prefix if any. Can be empty string.
           54  +interface GetCurrentPrefix
    33     55   
    34     56   interface FileOpenAccess, .filename, .access
    35     57   
    36     58   interface FileClose, .handle
    37     59   
    38     60   ; returns 32bit file size in eax
    39     61   interface FileSize, .handle

Changes to freshlib/test_code/TestStrLib.asm.

    46     46   
    47     47   
    48     48   endg
    49     49   
    50     50   TestPosHeap text  'saasoidhjaasdfsijoa;aijdfasi;ojaryiaejnkjfvnarfui;adnv'
    51     51   TestPosNeedle text 'b'
    52     52   
           53  +
           54  +proc TestNP, .pString
           55  +begin
           56  +        stdcall StrDupMem, [.pString]
           57  +        mov     ebx, eax
           58  +
           59  +        stdcall FileWriteString, [STDOUT], txt 'From: '
           60  +        stdcall FileWriteString, [STDOUT], ebx
           61  +        stdcall FileWriteString, [STDOUT], <txt 13, 10>
           62  +
           63  +;        stdcall StrNormalizePath2, ebx, "/\"
           64  +
           65  +        stdcall FileWriteString, [STDOUT], txt '  To: '
           66  +        stdcall FileWriteString, [STDOUT], ebx
           67  +        stdcall FileWriteString, [STDOUT], <txt 13, 10, 13, 10>
           68  +
           69  +        stdcall StrDel ; from the stack.
           70  +        return
           71  +endp
           72  +
    53     73   
    54     74   start:
    55     75           InitializeAll
           76  +
           77  +
           78  +; Test StrNormalizePath
           79  +
           80  +        stdcall TestNP, "../../work./asm.work/test.asm"
           81  +        stdcall TestNP, "/usr/./lib/./../../work./asm.work/test.asm"
           82  +        stdcall TestNP, "/usr/./././lib/test.asm"
           83  +        stdcall TestNP, "/usr/../lib/test.asm"
           84  +        stdcall TestNP, "./usr/../lib/test.asm"
           85  +        stdcall TestNP, "usr/../lib/test.asm"
           86  +        stdcall TestNP, "usr/././lib/../test.asm"
           87  +        stdcall TestNP, "././lib/../test.asm"
           88  +        stdcall TestNP, "./././lib/test.asm"
           89  +        stdcall TestNP, "/usr/lib/../../../../work./asm.work/test.asm"
           90  +        stdcall TestNP, "/usr/lib\../..\../..\work./asm.work\test.asm"
           91  +
           92  +
           93  +        stdcall FileReadLine, [STDIN]
           94  +        jmp     .finish
           95  +
           96  +
    56     97   
    57     98   ; Test StrPos procedure
    58     99   
    59    100   
    60    101           stdcall StrDupMem, TestPosHeap
    61    102           mov     esi, eax
    62    103   
................................................................................
   374    415           repne scasb
   375    416           lea     eax, [edi-1]
   376    417           sub     eax, [.ptrString]
   377    418   
   378    419           pop     ecx edi
   379    420           return
   380    421   endp
          422  +
          423  +
          424  +
          425  +
          426  +
          427  +
          428  +
          429  +

Changes to freshlib/test_code/TestStrLib.fpr.

cannot compute difference between binary files

Changes to freshlib/test_code0/TestMenu.asm.

    12     12   ;  Notes:
    13     13   ;_________________________________________________________________________________________
    14     14   
    15     15   include "%lib%/freshlib.inc"
    16     16   
    17     17   @BinaryType GUI, compact
    18     18   
    19         -options.DebugMode = 0
           19  +options.DebugMode = 1
    20     20     options.DebugMode.NoTimers = 0
    21     21     options.DebugMode.XSync = 0
    22     22     options.DebugMode.XErrors =0
    23     23   
    24     24   options.ShowSizes = 1
    25     25   options.SkipZeroSizes = 1
    26     26   
................................................................................
    31     31   
    32     32   iglobal
    33     33   TemplateMainForm:
    34     34           ObjTemplate  tfParent or tfEnd, TForm, frmMain, \
    35     35                        x = 200,          \
    36     36                        y = 200,          \
    37     37                        width = 320,    \
    38         -                     height = 240,   \
           38  +                     height = 260,   \
    39     39                        OnCreate = FormOnCreate,    \
    40     40                        OnClose = MainFormOnClose,  \
    41     41                        OnDestroy = FormOnDestroy,  \
    42     42                        Caption = 'Popup menu test'
    43     43   
    44     44             ObjTemplate tfChild, TEdit, editTest,                 \
    45     45                        x = 10, y = 200, width = 300, height = 24, \
    46     46                        Text = "This is test TEdit control",       \
    47     47                        Visible = TRUE
    48     48   
    49         -          ObjTemplate tfParent, TActionList, ActionList1,    \
           49  +          ObjTemplate tfParent or tfChild, TActionList, ActionList1,    \
    50     50                        ImgIcons = imgMenuList
    51     51   
    52     52                ObjTemplate tfChild, TAction, actCheck,                \
    53     53                            Caption = "Check it", HintText = "Action that can be checked and unchecked.",         \
    54     54                            OnExecute = ActionOnCheck,                                                                \
    55     55                            IconIndex = 9
    56     56   
................................................................................
   158    158                        Visible = TRUE
   159    159   
   160    160             ObjTemplate tfChild, TCheckbox, cbEnableDisable2,     \
   161    161                        x = 146, y = 130, width = 100, height = 24,         \
   162    162                        Action = [actCheck],                                \
   163    163                        Visible = TRUE
   164    164   
   165         -          ObjTemplate tfChild or tfEnd, TCheckbox, cbEnableDisable,     \
          165  +          ObjTemplate tfChild, TCheckbox, cbEnableDisable,     \
   166    166                        x = 146, y = 104, width = 100, height = 24,         \
   167    167                        Action = [actCheck],                                \
   168    168                        Visible = TRUE
          169  +
          170  +          ObjTemplate tfChild or tfEnd, TToolbar, tbTest,        \
          171  +                     x = 0, y = 236, width = 320, height = 24,  \
          172  +                     Visible = TRUE
   169    173   
   170    174   
   171    175   TemplateMainMenu:
   172    176         ObjTemplate  tfEnd, TMenu, mainMenu,              \
   173    177           Visible = FALSE
   174    178   
   175    179   TemplateSubMenu:
................................................................................
   248    252   
   249    253           exec    [subMenu], TMenu:AddItem, mitAction, [actClean]
   250    254           exec    [subMenu], TMenu:AddItem, mitSeparator, 0
   251    255           exec    [subMenu], TMenu:AddItem, mitString, "/home/johnfound/Fresh/source/Fresh.fpr"
   252    256           exec    [subMenu], TMenu:AddItem, mitString, "/home/johnfound/Fresh/source/Fresh.asm"
   253    257           exec    [subMenu], TMenu:AddItem, mitString, "/home/johnfound/Fresh/freshlib/freshlib.inc"
   254    258   
          259  +
          260  +        exec    [tbTest], TToolbar:AddButton, [actNew]
          261  +        exec    [tbTest], TToolbar:AddButton, [actOpen]
          262  +        exec    [tbTest], TToolbar:AddButton, [actSave]
          263  +        exec    [tbTest], TToolbar:AddButton, [actSaveAll]
          264  +        exec    [tbTest], TToolbar:AddButton, 0
          265  +        exec    [tbTest], TToolbar:AddButton, [actClose]
          266  +        exec    [tbTest], TToolbar:AddButton, [actCloseAll]
          267  +
   255    268           stdcall Run
   256    269   
   257    270           FinalizeAll
   258    271           stdcall TerminateAll, 0
   259    272   
   260    273   
   261    274   

Changes to freshlib/test_code0/TestMenu.fpr.

cannot compute difference between binary files

Changes to freshlib/test_code0/theme_flat.cfg.

            1  +clTextCaret = $FFE74C3C
            2  +caretTimes = 250, 250
     1      3   clBorderNeutral = $FF1ABC9C
     2         -clBorderLight = $FF1ABC9C
     3         -clBorderDark = $FF1ABC9C
            4  +clBorderLight = $FF31E2BF
            5  +clBorderDark = $FF138670
     4      6   clBorderNeutralGray = $FF606060
     5         -clBorderLightGray = $FF606060
     6         -clBorderDarkGray = $FF606060
            7  +clBorderLightGray = $FF808080
            8  +clBorderDarkGray = $FF404040
     7      9   clBorderFocused = $FFE74C3C
     8     10   boxBorderWidth = 2
     9     11   clBtnBk = $FF1ABC9C, $FF48C9B0, $FF16A085, $807B7B7B
    10     12   clBtnTxt = $FFFFFFFF, $FFFFFFFF, $FFBDC3C7, $80FFFFFF
    11         -btnBorder = 0, 0, 0, 0
           13  +btnBorder = 0, 0, 0, 1073741824
    12     14   btnPressedOfsX = 0
    13     15   btnPressedOfsY = 0
    14     16   btnMarginX = 8
    15     17   btnMarginY = 8
           18  +clToolBtnBk = $FFECF0F1, $FFC9DCE7, $FFC9DCE7, $FFECF0F1
           19  +clToolBtnTxt = $FF000000, $FF000000, $FF000000, $80000000
           20  +tbBorder = 0, 0, 0, 1073741824
           21  +tbBorderWidth = 1
           22  +tbPressedOfsX = 0
           23  +tbPressedOfsY = 2
           24  +tbSeparatorType = $40000003
           25  +tbSeparatorWidth = 10
    16     26   clEditBk = $FFECF0F1
    17     27   clEditBkFocused = $FFECF0F1
    18     28   clEditTxt = $FF000000
    19     29   clEditSel = $602980B9
    20     30   clEditSelTxt = $FFFFFFFF
    21     31   editBorder = 3
    22     32   editBorderFocused = 3
................................................................................
    28     38   progressBorder = 3
    29     39   clScrollBk = $3FBDC3C7, $A0BDC3C7
    30     40   clScrollSlider = $7F7F8C8D, $FF1ABC9C
    31     41   clScrollSliderOvf = $3FF39C12, $FFF39C12
    32     42   borderScroll = 0
    33     43   scrollWidth = 12
    34     44   minSliderHeight = 24
    35         -clLabelBk = $0
           45  +clLabelBk = $FFECF0F1
    36     46   clLabelTxt = $FF000000
    37     47   clTreeViewBack = $FFECF0F1
    38     48   clTreeViewText = $FF000000
    39     49   clTreeSelected = $FF2980B9
    40     50   clTreeSelectedTxt = $FFFFFFFF
    41     51   clTreeFocused = $FFD35400
    42     52   clTreeFocusedTxt = $FFFFFFFF
    43     53   tvBorder = 3
    44     54   tvIcons = 297:iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAMAAACecocUAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAEJQTFRFAAAAgICAkra2n5+fmaOjkqiolqamlaWllqWllKWnlaWllaSmlqWllaWllqWllaWmlaWmlaWmlaWmlaWmlaWmlaWml3PoaAAAABV0Uk5TAAIHCBkjLkFmbm9zd4Ciu8vM4uj9nlc1ogAAADhJREFUCJlj4OJhZoABXlEhDkY4W1RUkB3BFhXlZ0OwRUX4WOBsUVFhViziCPUC7Jjmc3IzwawFAEAMBLa48vXWAAAAAElFTkSuQmCC, 333:iVBORw0KGgoAAAANSUhEUgAAAAsAAAALCAYAAACprHcmAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADKSURBVBiVhY+7TgJhFIS/+d3QmWDhE/gQhlfgAbb46U00aENMoKCgs5ZIRey49FpbmFhZm9iQ0FFaC2yGQjFcVna6Oec7l1FvMLgATijWV2LrGHFXREo0wmkp6QomBex0WS4/hDRN5xbtQ6Rx66Za/RaAbfWGozegkoO+X8V4Lsnh5x/ZuJm3NUhNSQYI62K9VnsVet5hny5jfPkb3Oxk8i2wXFuL1taVTXMd46fR42+qfj3Gj39hgKNs0QZmibNOXoY93Y/HZ3n1FeLFO3+97VjQAAAAAElFTkSuQmCC
    45     55   clMenuBack = $FFECF0F1
    46     56   clMenuText = $FF000000
    47     57   clMenuTextGray = $90000000
    48     58   clMenuSelection = $FF2980B9
           59  +clMenuSelIcon = $FFC9DCE7
    49     60   borderMenu = 3
    50     61   menuIconMargin = 4
    51     62   menuSeparatorHeight = 12
    52     63   menuMinTextDist = 32
    53     64   menuSubIcon = 206:iVBORw0KGgoAAAANSUhEUgAAAAYAAAALCAYAAABcUvyWAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABLSURBVBiVjc+xDYBADATBeSQCIgqgYzJaoARSInqgH5MQvQ6JzezVyT7YMAgUdoxJFA5MSRQuzEkUbiztHXrOz8SvG/Gr2GNF65cP8X4dCPkfyx8AAAAASUVORK5CYII-
    54     65   menuSubIconSel = 207:iVBORw0KGgoAAAANSUhEUgAAAAYAAAALCAYAAABcUvyWAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABMSURBVBiVjc+xDYAwEEPRCxIFFQOwcTpWyAi0VOzAPi8FXTgk3H5Z3w7smGKMJw1zBuDAkgG4sGYAbmwFXuKI87Pxy5GuSn9UlNHeAYWml41HdWNxAAAAAElFTkSuQmCC
    55     66   menuSubIconGray = 280:iVBORw0KGgoAAAANSUhEUgAAAAYAAAALCAYAAABcUvyWAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAACVSURBVBiVY5i6dOnEhoYGJgY0wMTAwJgnpqq6YObMmaxoEgwM/xkYY//w8K7tW7WKE0UCCnzZf//ZMXPVKn4GBgYGxqlLl/1HM/4q0x8WdwxLGRgYtP+x/JmPTeIq0x+WRHSJQyysLNaZ8WFPkSU2/2Rl8UgPC/sIdxUjw//FLF8+BxeFhX2HK5u2ZFnX////GdEtAgDKqy21io/rDwAAAABJRU5ErkJggg--

Changes to freshlib/test_code0/theme_win.cfg.

            1  +clTextCaret = $FFFF0000
            2  +caretTimes = 250, 250
     1      3   clBorderNeutral = $FFA0A0A0
     2      4   clBorderLight = $FFFFFFFF
     3      5   clBorderDark = $FF404040
     4      6   clBorderNeutralGray = $FF909090
     5      7   clBorderLightGray = $FFE0E0E0
     6      8   clBorderDarkGray = $FF808080
     7      9   clBorderFocused = $FFFF8000
     8     10   boxBorderWidth = 1
     9     11   clBtnBk = $FFD4D0C8, $FFE0E0E0, $FFA0A0A0, $80D4D0C8
    10     12   clBtnTxt = $FF000000, $FF000000, $FF000000, $FF606060
    11         -btnBorder = 1, 1, 2
           13  +btnBorder = 1, 1, 2, 1073741825
    12     14   btnPressedOfsX = 1
    13     15   btnPressedOfsY = 1
    14     16   btnMarginX = 8
    15     17   btnMarginY = 8
           18  +clToolBtnBk = $FFD4D0C8, $FFE0E0E0, $FFA0A0A0, $80D4D0C8
           19  +clToolBtnTxt = $FF000000, $FF000000, $FF000000, $FF606060
           20  +tbBorder = 0, 1, 2, 1073741824
           21  +tbBorderWidth = 1
           22  +tbPressedOfsX = 1
           23  +tbPressedOfsY = 1
           24  +tbSeparatorType = $2
           25  +tbSeparatorWidth = 10
    16     26   clEditBk = $FFFFFFFF
    17     27   clEditBkFocused = $FFFFFFFF
    18     28   clEditTxt = $FF000000
    19     29   clEditSel = $600A246C
    20     30   clEditSelTxt = $FFFFFFFF
    21     31   editBorder = 2
    22     32   editBorderFocused = 2
................................................................................
    42     52   clTreeFocusedTxt = $FFFFFF00
    43     53   tvBorder = 2
    44     54   tvIcons = 117:iVBORw0KGgoAAAANSUhEUgAAAAsAAAALAQMAAACTYuVlAAAABlBMVEUAAAAAAAClZ7nPAAAAAXRSTlMAQObYZgAAAB1JREFUCNdjYGBgqD/A4ODA4AJG8TAGUAQozsAAAGXeBi6dny4xAAAAAElFTkSuQmCC, 114:iVBORw0KGgoAAAANSUhEUgAAAAsAAAALAQMAAACTYuVlAAAABlBMVEUAAAAAAAClZ7nPAAAAAXRSTlMAQObYZgAAABpJREFUCNdjYGBgqD/A4OAARfEOCDZQnIEBAGTOBh7FK7i2AAAAAElFTkSuQmCC
    45     55   clMenuBack = $FFD4D0C8
    46     56   clMenuText = $FF000000
    47     57   clMenuTextGray = $80000000
    48     58   clMenuSelection = $FF000080
           59  +clMenuSelIcon = $FFADAABB
    49     60   borderMenu = 1
    50     61   menuIconMargin = 4
    51     62   menuSeparatorHeight = 10
    52     63   menuMinTextDist = 32
    53     64   menuSubIcon = 206:iVBORw0KGgoAAAANSUhEUgAAAAYAAAALCAYAAABcUvyWAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABLSURBVBiVjc+xDYBADATBeSQCIgqgYzJaoARSInqgH5MQvQ6JzezVyT7YMAgUdoxJFA5MSRQuzEkUbiztHXrOz8SvG/Gr2GNF65cP8X4dCPkfyx8AAAAASUVORK5CYII-
    54     65   menuSubIconSel = 207:iVBORw0KGgoAAAANSUhEUgAAAAYAAAALCAYAAABcUvyWAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABMSURBVBiVjc+xDYAwEEPRCxIFFQOwcTpWyAi0VOzAPi8FXTgk3H5Z3w7smGKMJw1zBuDAkgG4sGYAbmwFXuKI87Pxy5GuSn9UlNHeAYWml41HdWNxAAAAAElFTkSuQmCC
    55     66   menuSubIconGray = 280:iVBORw0KGgoAAAANSUhEUgAAAAYAAAALCAYAAABcUvyWAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAACVSURBVBiVY5i6dOnEhoYGJgY0wMTAwJgnpqq6YObMmaxoEgwM/xkYY//w8K7tW7WKE0UCCnzZf//ZMXPVKn4GBgYGxqlLl/1HM/4q0x8WdwxLGRgYtP+x/JmPTeIq0x+WRHSJQyysLNaZ8WFPkSU2/2Rl8UgPC/sIdxUjw//FLF8+BxeFhX2HK5u2ZFnX////GdEtAgDKqy21io/rDwAAAABJRU5ErkJggg--