Fresh IDE . Check-in [3aeaecfe1c]
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:Dirty hack removed. ;)
Timelines: family | ancestors | descendants | both | NoCanvasGUI
Files: files | file ages | folders
SHA1:3aeaecfe1c12a69db51025a89b96abaeb84152a9
User & Date: johnfound 2017-12-04 13:45:43
Context
2017-12-04
15:34
Semi-transparent caret. Implemented changing insert-mode and the selection type from the keyboard (Insert and Ctrl+Alt+Insert keys.) UpdateCaretPos now updates the caret size as well. Also, vertical caret should be implemented there. check-in: 5b08d05798 user: johnfound tags: NoCanvasGUI
13:45
Dirty hack removed. ;) check-in: 3aeaecfe1c user: johnfound tags: NoCanvasGUI
12:55
Small fix in buffergap.asm: The function TextCompact only moves the gap, without reallocating the memory.

The procedures ScrollImageH and ScrollImageV has been moved to "graphics/draw.asm";

In TAsmEdit class, the aeoXXXXX options constants has been revised and extended. TAsmEdit.SetCaretXY method has been implemented. In order to handle the selection properly, the caret coordinates must be set only by calling this method.

The selection rendering was implemented in a proper way. Block and char selections are supported for now. The algorithm used allows other kind of selections to be easily added (for example line selection). check-in: a106042c55 user: johnfound tags: NoCanvasGUI

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to freshlib/gui/TAsmEdit.asm.

352
353
354
355
356
357
358



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
....
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
....
2401
2402
2403
2404
2405
2406
2407

2408
2409
2410
2411
2412
2413
2414
2415

2416
2417
2418
2419
2420
2421
2422
....
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443

2444





2445
2446



2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457


.add_block:
        mov     [.rect1.left], eax
        mov     [.rect1.right], ebx
        mov     [.rect1.top], ecx
        mov     [.rect1.bottom], edi




.rect1_only:
        get     eax, esi, TAsmEdit:PosX
        get     ecx, esi, TAsmEdit:PosY

        sub     [.rect1.left], eax
        sub     [.rect1.top], ecx
        sub     [.rect1.right], eax
        sub     [.rect1.bottom], ecx

        lea     eax, [.rect1]
        lea     ecx, [.client]
        stdcall RectSort, eax
        stdcall RectIntersect2, eax, ecx
        jc      .finish

        stdcall RectListAdd, edx, eax

.finish:
        mov     [esp+4*regEDX], edx
................................................................................
        pushad

        mov     edi, [.self]

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

        mov     [edi+TAsmEdit._options], aeoLeftMargin or aeoLineNumbers; or aeoStripedBackground or aeoScrollYMore or aeoScrollXMore

        stdcall GetFontMetrics, [ASM.Font]

        mov     [edi+TAsmEdit._font_height], eax
        mov     [edi+TAsmEdit._font_asc], ebx
        mov     [edi+TAsmEdit._font_desc], edx

................................................................................
endp





method TAsmEdit.CaretUpDown

begin
        pushad

        mov     esi, [.self]
        xor     edx, edx                    ; minimal caret pos 0

        mov     ebx, [esi+TAsmEdit._caret_y]
        mov     ecx, [esi+TAsmEdit._scrolly.pos]

        add     ebx, [.count]
        cmovs   ebx, edx

        add     ecx, [.count]
        cmovs   ecx, edx

        mov     eax, [esi+TAsmEdit._lines]
................................................................................
        cmova   ecx, eax

        exec    esi, TAsmEdit:SetCaretXY, ebx, caretAxisY, [.select]

        cmp     [.scroll], edx
        je      .scroll_ok

        OutputValue "Scroll position Y: ", ecx, 10, -1
        OutputValue "Scroll limit Y: ", eax, 10, -1


; dirty hack!






        DebugMsg "Dirty hack!"




        mov     [esi+TAsmEdit._scrolly.pos], ecx
        mov     [esi+TAsmEdit._img_txt_valid], edx
        mov     [esi+TAsmEdit._img_margin_valid], edx
        exec    esi, TAsmEdit:RectChanged2, edx
        exec    esi, TAsmEdit:UpdateCaretPos
        jmp     .finish

.scroll_ok:
        exec    esi, TAsmEdit:ScrollToCaretY








>
>
>












<







 







|







 







>







|
>







 







|
<

>
|
>
>
>
>
>

<
>
>
>

<
<
<







352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373

374
375
376
377
378
379
380
....
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
....
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
....
2438
2439
2440
2441
2442
2443
2444
2445

2446
2447
2448
2449
2450
2451
2452
2453
2454

2455
2456
2457
2458



2459
2460
2461
2462
2463
2464
2465


.add_block:
        mov     [.rect1.left], eax
        mov     [.rect1.right], ebx
        mov     [.rect1.top], ecx
        mov     [.rect1.bottom], edi
        lea     eax, [.rect1]
        stdcall RectSort, eax
        inc     [.rect1.bottom]

.rect1_only:
        get     eax, esi, TAsmEdit:PosX
        get     ecx, esi, TAsmEdit:PosY

        sub     [.rect1.left], eax
        sub     [.rect1.top], ecx
        sub     [.rect1.right], eax
        sub     [.rect1.bottom], ecx

        lea     eax, [.rect1]
        lea     ecx, [.client]

        stdcall RectIntersect2, eax, ecx
        jc      .finish

        stdcall RectListAdd, edx, eax

.finish:
        mov     [esp+4*regEDX], edx
................................................................................
        pushad

        mov     edi, [.self]

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

        mov     [edi+TAsmEdit._options], aeoLeftMargin or aeoLineNumbers or aeoBlockSelection; or aeoStripedBackground or aeoScrollYMore or aeoScrollXMore

        stdcall GetFontMetrics, [ASM.Font]

        mov     [edi+TAsmEdit._font_height], eax
        mov     [edi+TAsmEdit._font_asc], ebx
        mov     [edi+TAsmEdit._font_desc], edx

................................................................................
endp





method TAsmEdit.CaretUpDown
.rect RECT
begin
        pushad

        mov     esi, [.self]
        xor     edx, edx                    ; minimal caret pos 0

        mov     ebx, [esi+TAsmEdit._caret_y]
        get     ecx, esi, TAsmEdit:PosY

        add     ebx, [.count]
        cmovs   ebx, edx

        add     ecx, [.count]
        cmovs   ecx, edx

        mov     eax, [esi+TAsmEdit._lines]
................................................................................
        cmova   ecx, eax

        exec    esi, TAsmEdit:SetCaretXY, ebx, caretAxisY, [.select]

        cmp     [.scroll], edx
        je      .scroll_ok

        mov     [esi+TAsmEdit._scrolly.pos], ecx


        xor     eax, eax
        mov     ecx, [esi+TAsmEdit._width_ch]
        mov     ebx, [esi+TAsmEdit._height_ch]
        mov     [.rect.left], eax
        mov     [.rect.top], eax
        mov     [.rect.right], ecx
        mov     [.rect.bottom], ebx


        lea     eax, [.rect]
        exec    esi, TAsmEdit:_RenderTxt, [esi+TAsmEdit._imgText], eax
        exec    esi, TAsmEdit:_RenderLM, [esi+TAsmEdit._imgMargin], 0, [esi+TAsmEdit._height_ch]




        exec    esi, TAsmEdit:RectChanged2, edx
        exec    esi, TAsmEdit:UpdateCaretPos
        jmp     .finish

.scroll_ok:
        exec    esi, TAsmEdit:ScrollToCaretY