Author Topic: my editor project  (Read 6577 times)

zedd151

  • Member
  • *****
  • Posts: 1931
my editor project
« on: October 06, 2022, 04:21:34 AM »
Humble beginnings. Here is a very basic 32 bit editor. Not a BASIC editor,  :badgrin: .
Alas, yet another project that I have largely abandoned. Each incremented version of the editor may be found in the archive In this post
You may do whatever you wish with the code contained within that archive. Finish it, modify it, throw it in the scrap bin, whatever.  :biggrin:


I am writing yet another editor I call "Plain Old Editor" or 'Poe' for short. Nicknamed 'The Raven'.  :biggrin:
Details coming soon. It will differ from this editor in that it will NOT have user definable settings. All settings will be hard coded.  :tongue:
If changes are desired, make changes to the source for yourself and reassemble.  :badgrin:  Also there will be no plugin interface for this editor, but I will add some functions that I find useful in the source code of the editor. You may add your own to it as well.
Nothing 'fancy schmancy' in this editor. NO toolbar, NO program defined keyboard accellerators used, NO user editable menus (resource file must be recompiled to add menu items...), NO print capabilties, and NO niceties others find useful but I have no use for. There may be others that are purposely omitted as I do not need them.
I will not post the code until that editor is completed.  :mrgreen:
« Last Edit: December 10, 2022, 05:04:29 PM by zedd151 »
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1931
Re: my editor project
« Reply #1 on: October 06, 2022, 05:47:37 AM »
Added a dialog box for changing the editor background and text color. Will add code to save the new colors to an .ini file a bit later.


Code: [Select]
        ; This source code written by zedd151 @ masm32.com
        include \masm32\include\masm32rt.inc
   
        RegWindow       proto :dword, :dword
        WinMain         proto :dword, :dword, :dword
        WndProc         proto :dword, :dword, :dword, :dword
        CenterMain      proto :dword, :dword, :dword
        ColorProc       proto :dword, :dword, :dword, :dword
   
        wwidth          equ 1024
        wheight         equ 768
        cwidth          equ 782
        cheight         equ 604
        ws              equ WS_BORDER or WS_CAPTION or WS_MINIMIZEBOX or WS_SYSMENU
        menuid          equ 1000
        iconid          equ 500
       
    .data
        bak_colour      dd 00300018h
        txt_colour      dd 00FFC0E0h
        CustomColors    dd 16 dup(0)
    .data?
        hWnd            dd ?
        hInstance       dd ?
        hAlready        dd ?
        hEdit           dd ?
        btFlag          dd ?


    .const
        wclass          db "BasicEdClass", 0
        dname           db "Basic Editor", 0
        about           db "Basic Editor with limited functions. :P", 0
        smscr           db "Screen size must be at least 1024 x 768", 0
       
    .code
        include files\richedit.asm   
        include files\fileio.asm   
 ;         include files\search.asm   
    start:
        invoke FindWindow, addr wclass, 0
        cmp eax, 0
        je @F
        mov hAlready, eax
        invoke ShowWindow, hAlready, SW_RESTORE
        invoke SetForegroundWindow, hAlready
        mov eax, 0
        jmp twoinst
      @@:
        invoke GetSystemMetrics, SM_CXSCREEN
        cmp eax, wwidth
        jb smallscr
        invoke GetSystemMetrics, SM_CYSCREEN
        cmp eax, wheight
        jb smallscr
        invoke GetModuleHandle, 0
        mov hInstance, eax
        invoke RegWindow, hInstance, addr wclass
        invoke WinMain, hInstance, addr wclass, addr dname
        jmp overit
      smallscr:
        invoke MessageBox, 0, addr smscr, addr dname, 0
      twoinst:
      overit:
        invoke ExitProcess, eax
       
    WinMain proc hi:dword, cn:dword, dn:dword
    local msg:MSG, Wtx:dword, Wty:dword
        invoke CreateWindowEx, 0, cn, dn, ws, 0, 0, 0, 0, 0, 0, hi, 0
        mov hWnd, eax
        invoke LoadMenu, hi, menuid
        invoke SetMenu, hWnd, eax
        invoke ShowWindow, hWnd, SW_SHOWNORMAL
        invoke UpdateWindow, hWnd
      StartLoop:
        invoke GetMessage, addr msg, 0, 0, 0
        cmp eax, 0
        je ExitLoop
        invoke TranslateMessage, addr msg
        invoke DispatchMessage, addr msg
        jmp StartLoop
      ExitLoop:
        return msg.wParam
    WinMain endp
   
    WndProc proc hWin:dword, uMsg:dword, wParam:dword, lParam:dword
    local rct:RECT
      .if uMsg == WM_CREATE
        invoke CenterMain, hWin, wwidth, wheight
        fn LoadLibrary, "riched20.dll"
        invoke rich_edit, hWin, hInstance
        mov hEdit, eax
        invoke set_edit_colours
     .elseif uMsg == WM_COMMAND
        .if wParam == 1001
           mov szFileName[0], 0
           invoke GetFileName, hWin, ADDR szTitleO, ADDR szFilterO
   
           cmp szFileName[0], 0
           je @F
             invoke stream_file_in, hEdit, ADDR szFileName
             invoke SetWindowText, hWin, ADDR szFileName
           @@:
        .elseif wParam == 1012
          fn SendMessage, hWin, WM_CLOSE, 0, 0
        .elseif wParam == 2001
          invoke DialogBoxParamA, hInstance, 3000, hWin, addr ColorProc, 0
        .elseif wParam == 1900
          invoke MessageBox, hWin, addr about, addr dname, MB_OK
        .endif
      .elseif uMsg == WM_SIZE
        invoke GetClientRect, hWin, addr rct
        mov eax, rct.bottom
 ;         sub eax, sbh ; uncomment if using status bar.
        mov rct.bottom, eax
        invoke MoveWindow, hEdit, rct.left, rct.top, rct.right, rct.bottom, TRUE
      .elseif uMsg == WM_CLOSE
      .elseif uMsg == WM_DESTROY
        invoke PostQuitMessage, 0
        return 0
      .endif
        invoke DefWindowProc, hWin, uMsg, wParam, lParam
        ret
    WndProc endp
   
    ColorProc proc hWin:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
    LOCAL clr:CHOOSECOLOR
    .if uMsg==WM_INITDIALOG
    .elseif uMsg==WM_COMMAND
        mov eax, wParam
        shr eax, 16
    .if ax==BN_CLICKED
        mov eax, wParam
    .if ax==IDCANCEL
        invoke SendMessage, hWin, WM_CLOSE, 0, 0
    .elseif ax==3001
        invoke RtlZeroMemory, addr clr, sizeof clr
        mov clr.lStructSize, sizeof clr
        push hWin
        pop clr.hwndOwner
        push hInstance
        pop clr.hInstance
        push bak_colour
        pop clr.rgbResult
        mov clr.lpCustColors, offset CustomColors
        mov clr.Flags, CC_ANYCOLOR or CC_RGBINIT
        invoke ChooseColor, addr clr
    .if eax!=0
        push clr.rgbResult
        pop bak_colour
        invoke GetDlgItem, hWin, 3001
        invoke InvalidateRect, eax, 0, TRUE
    .endif
    .elseif ax==3002
        invoke RtlZeroMemory, addr clr, sizeof clr
        mov clr.lStructSize, sizeof clr
        push hWin
        pop clr.hwndOwner
        push hInstance
        pop clr.hInstance
        push txt_colour
        pop clr.rgbResult
        mov clr.lpCustColors, offset CustomColors
        mov clr.Flags, CC_ANYCOLOR or CC_RGBINIT
        invoke ChooseColor, addr clr
    .if eax!=0
        push clr.rgbResult
        pop txt_colour
        invoke GetDlgItem, hWin, 3002
        invoke InvalidateRect, eax, 0, TRUE
    .endif
    .elseif ax==IDOK
        invoke SendMessage, hEdit, EM_GETMODIFY, 0, 0
        push eax
        invoke set_edit_colours
        pop eax
        invoke SendMessage, hEdit, EM_SETMODIFY, eax, 0
        invoke EndDialog, hWin, 0
    .endif
    .endif
    .elseif uMsg==WM_CTLCOLORSTATIC
        invoke GetDlgItem, hWin, 3001
    .if eax==lParam
        invoke CreateSolidBrush, bak_colour
        ret
    .else
        invoke GetDlgItem, hWin, 3002
    .if eax==lParam
        invoke CreateSolidBrush, txt_colour
        ret
    .endif
    .endif
        mov eax, FALSE
        ret
    .elseif uMsg==WM_CLOSE
        invoke EndDialog, hWin, 0
    .else
        mov eax, FALSE
        ret
    .endif
        mov eax, TRUE
        ret
    ColorProc endp
   
    RegWindow proc hi:dword, cn:dword
    local wc:WNDCLASSEX, icn:dword
        mov wc.cbSize, sizeof WNDCLASSEX
        mov wc.style, CS_HREDRAW or CS_VREDRAW or CS_BYTEALIGNWINDOW
        mov wc.lpfnWndProc, offset WndProc
        mov wc.cbClsExtra, 0
        mov wc.cbWndExtra, 0
        mrm wc.hInstance, hi
        mov wc.hbrBackground, COLOR_BTNFACE+6
        mov wc.lpszMenuName, 0
        mrm wc.lpszClassName, cn
        invoke LoadIcon, hi, iconid
        mov wc.hIcon, eax
        mov icn, eax
        invoke LoadCursor, 0, IDC_ARROW
        mov wc.hCursor, eax
        mrm wc.hIconSm, icn
        invoke RegisterClassEx, addr wc
        ret
    RegWindow endp
   
    CenterMain proc hWin:dword, wd:dword, ht:dword
    local rct:RECT, h:dword, w:dword, x:dword, y:dword
      @@: ; dynamically adjusting width of the window for proper client rect size
        invoke MoveWindow, hWin, x, y, wd, ht, 0
        invoke GetClientRect, hWin, addr rct
        mov eax, rct.right
        sub eax, rct.left
      .if eax > 872 ; desired client rect width
        dec wd
        jmp @b
      .elseif eax < 872
        inc wd
        jmp @b
      .endif
      @@: ; dynamically adjusting height of the window for proper client rect size
        invoke MoveWindow, hWin, x, y, wd, ht, 0
        invoke GetClientRect, hWin, addr rct
        mov eax, rct.bottom
        sub eax, rct.top
      .if eax > 604 ; desired client rect height
        dec ht
        jmp @b
      .elseif eax < 604
        inc ht
        jmp @b
      .endif
        invoke GetSystemMetrics, SM_CYMENU
        add ht, eax
        invoke SystemParametersInfoA, SPI_GETWORKAREA, 0, addr rct, 0
        mov eax, rct.right
        sub eax, wd
        sar eax, 1
        mov x, eax
        mov eax, rct.bottom
        sub eax, ht
        sar eax, 1
        mov y, eax
        invoke MoveWindow, hWin, x, y, wd, ht, TRUE
        ret
    CenterMain endp


    end start



Attachment 'basic editor2.zip' removed but is included in the archive In this post
« Last Edit: November 17, 2022, 12:33:56 PM by zedd151 »
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1931
Re: my editor project
« Reply #2 on: October 06, 2022, 06:09:57 AM »
Currently exploring a few different ways for storing the editors persistent settings...  :biggrin:
Would probably be either a simple editable plaintext file (one value per line to be tokenized for extraction in program), or editable ini file. (Key=Value, etc.) Has to be easy for user to manually change outside of the editor, imo.
Regards, zedd.
:tongue:

jj2007

  • Member
  • *****
  • Posts: 13657
  • Assembly is fun ;-)
    • MasmBasic
Re: my editor project
« Reply #3 on: October 06, 2022, 07:03:14 AM »
Currently exploring a few different ways for storing the editors persistent settings...  :biggrin:

For inspiration - it uses a 200 byte structure ;-)

Code: [Select]
[simpled.asm]
Inf200=00440044062F2J002wB4105W000CO200036invoke000043pop000000064pushe0000005While000000B00000000000B00000000000B00000000000B00000000000B000000000078000440006004400060044000600tE000h00Gw000R00000000t00zc0Vn#
[basic.asm]
Inf200=00CU00CU052F2J002wB4105W000vo200035starte000046invoke000063pophe0000004pushe0000005While000000B00000000000B00000000000B00000000000B000000000078000CU000500CV000500DD000100DD000100Ei00020067000AtP0qc0Vn#

zedd151

  • Member
  • *****
  • Posts: 1931
Re: my editor project
« Reply #4 on: October 06, 2022, 07:41:21 AM »
Thanks jj, I'll look at that later..


See, you've inspired me to write another editor. SimplEd was rather lame. Even in a more finished form. But this project may take quite a bit of time to finish, if it ever does get finished. (I keep wanting to add more features)
Regards, zedd.
:tongue:

jj2007

  • Member
  • *****
  • Posts: 13657
  • Assembly is fun ;-)
    • MasmBasic
Re: my editor project
« Reply #5 on: October 06, 2022, 08:08:25 AM »
Thanks jj, I'll look at that later..

You'll see that there is a section where general editor settings are stored, and another section where "by source" settings are kept, in a 200 byte structure. Inter alia, the last seven or so strings searched, the window position, and the edit history. The latter means that in a huge source you can work on up to 8 distant procs, and by pressing Alt right arrow you go back to the last edit areas. This is one feature I use extremely often.

zedd151

  • Member
  • *****
  • Posts: 1931
Re: my editor project
« Reply #6 on: October 06, 2022, 08:13:27 AM »

I'm currently reading up on:
GetPrivateProfileIntA
GetPrivateProfileStringA
WritePrivateProfileStringA
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1931
Re: my editor project
« Reply #7 on: October 06, 2022, 08:40:53 AM »
GetPrivateProfileInt returns a decimal value. lmao, good thing I tried it first. At any rate I could use GetPrivateProfileString instead. Either way conversion to COLORREF format (hex) will be needed for the colors. I've used these functions years ago, glad I read up on them. I will be making a procedure that returns hex value instead (doing the conversion there). I may even make my own procedures for reading and writing to the ini file.  :cool:
edit=another idea  :icon_idea:
« Last Edit: October 06, 2022, 09:47:33 AM by zedd151 »
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1931
Re: my editor project
« Reply #8 on: October 06, 2022, 09:56:25 AM »


Get settings values
Code: [Select]
fn GetPrivateProfileString, "Settings", "BackColor", 0, addr strx, 15, ".\editor.ini"
invoke htodw, addr strx
mov bak_colour, eax
fn GetPrivateProfileString, "Settings", "TextColor", 0, addr strx, 15, ".\editor.ini"
invoke htodw, addr strx
mov txt_colour, eax


ini file
Code: [Select]
[Settings]
BackColor=00300018
TextColor=00FFC0E0
Simple enough.  :biggrin:


Will add to the ini file of course for: editor font, margins, number of spaces to replace hard tabs, etc... maybe add (10?) recent files too.
Need also to save the settings to the ini file before exiting...  :bgrin:  Once I finish the .ini related code, I'll post the sources of waht I have up to that point in the development. Next after that: Finish the file handling code. After that, the Search and Replace code.
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1931
Re: my editor project
« Reply #9 on: October 06, 2022, 02:04:41 PM »
I have made the custom function to retrieve hex value from ini file.  :cool:
The background and text colors are no longer hard coded.
Code: [Select]
GetPrivateProfileHex proc lpSection:dword, lpKey:dword, lpString:dword, lpIni2:dword
    invoke GetPrivateProfileString, lpSection, lpKey, 0, lpString, 15, lpIni2
    invoke htodw, lpString
    ret
GetPrivateProfileHex endp

Will create the matching function to write hex value to the ini file shortly. Will finish all of the ini file related code before proceeding with the other functions/features.


Attachment 'basic editor3.zip' removed but is included in the archive In this post
« Last Edit: November 17, 2022, 12:34:44 PM by zedd151 »
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1931
Re: my editor project
« Reply #10 on: October 06, 2022, 02:26:58 PM »
Code: [Select]
    SetPrivateProfileHex proc lpSection:dword, lpKey:dword, hexval:dword, lpIni2:dword
    local hextext[12]:byte
        invoke dw2hex, hexval, addr hextext
        invoke WritePrivateProfileString, lpSection, lpKey, addr hextext, lpIni2
        ret
    SetPrivateProfileHex endp
That went pretty quick. The background and text colors are now saved to the ini file upon changing them.
Now for the rest of the custom settings. This will take a little longer as some are not yet coded into the richedit control.


Attachment 'basic editor4.zip' removed but is included in the archive In this post
« Last Edit: November 17, 2022, 12:35:35 PM by zedd151 »
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1931
Re: my editor project
« Reply #11 on: October 06, 2022, 05:24:12 PM »

Tidied up the main souce code file a bit.
Code: [Select]
        ; This source code written by zedd151 @ masm32.com
        include \masm32\include\masm32rt.inc


        RegWindow               proto :dword, :dword
        WinMain                 proto :dword, :dword, :dword
        WndProc                 proto :dword, :dword, :dword, :dword
        CenterMain              proto :dword, :dword, :dword


        wwidth                  equ 1024
        wheight                 equ 768
        cwidth                  equ 960
        cheight                 equ 720
        ws                      equ WS_BORDER or WS_CAPTION or WS_MINIMIZEBOX or WS_MAXIMIZEBOX or WS_SYSMENU
        menuid                  equ 1000
        iconid                  equ 500
       
    .data?
        bak_colour              dd ?
        txt_colour              dd ?
        CustomColors            dd 16 dup(?)
        strx                    db 64 dup (?)
        edfont                  db 64 dup (?)
        edfntsiz                dd ?
        hWnd                    dd ?
        hInstance               dd ?
        hAlready                dd ?
        hEdit                   dd ?
        btFlag                  dd ?


    .const
        wclass                  db "BasicEdClass", 0
        dname                   db "My Editor", 0
        about                   db "My Editor v. ?", 0
        smscr                   db "Screen size must be at least 1024 x 768", 0
        section1                db "Settings", 0
        key1                    db "BackColor", 0
        key2                    db "TextColor", 0
        key3                    db "Font", 0
        key4                    db "FontSize", 0
        inifile                 db ".\editor.ini", 0
       
    .code
   
 ;         include files\search.asm             ; not yet implemented
        include files\fileio.asm   
        include files\settings.asm   
        include files\richedit.asm
       
    start:
        invoke SetSettings                      ; load setting from ini file
       
        ; code to detect if program is already open
        invoke FindWindow, addr wclass, 0
        cmp eax, 0
        je @F                                   ; jump if not open
        mov hAlready, eax
        invoke ShowWindow, hAlready, SW_RESTORE ; elseif open bring window to top
        invoke SetForegroundWindow, hAlready
        mov eax, 0
        jmp twoinst
      @@:
     
        ; code to detect screen size
        invoke GetSystemMetrics, SM_CXSCREEN    ; 1024 x 768 minimum required
        cmp eax, wwidth
        jb smallscr                             ; if not met display message
        invoke GetSystemMetrics, SM_CYSCREEN    ; then exit
        cmp eax, wheight
        jb smallscr


        invoke GetModuleHandle, 0
        mov hInstance, eax
        invoke RegWindow, hInstance, addr wclass
        invoke WinMain, hInstance, addr wclass, addr dname
        jmp overit
      smallscr:
        invoke MessageBox, 0, addr smscr, addr dname, 0
      twoinst:
      overit:
        invoke ExitProcess, eax
       
    WinMain proc hi:dword, cn:dword, dn:dword
    local msg:MSG, Wtx:dword, Wty:dword
        invoke CreateWindowEx, 0, cn, dn, ws, 0, 0, 0, 0, 0, 0, hi, 0
        mov hWnd, eax
        invoke LoadMenu, hi, menuid
        invoke SetMenu, hWnd, eax
        invoke ShowWindow, hWnd, SW_SHOWNORMAL
        invoke UpdateWindow, hWnd
      StartLoop:
        invoke GetMessage, addr msg, 0, 0, 0
        cmp eax, 0
        je ExitLoop
        invoke TranslateMessage, addr msg
        invoke DispatchMessage, addr msg
        jmp StartLoop
      ExitLoop:
        return msg.wParam
    WinMain endp
   
    WndProc proc hWin:dword, uMsg:dword, wParam:dword, lParam:dword
    local rct:RECT
      .if uMsg == WM_CREATE
        invoke CenterMain, hWin, wwidth, wheight
        fn LoadLibrary, "riched20.dll"
        invoke rich_edit, hWin, hInstance
        mov hEdit, eax
        invoke set_edit_colours
     .elseif uMsg == WM_COMMAND
        .if wParam == 1001
           mov szFileName[0], 0
           invoke GetFileName, hWin, ADDR szTitleO, ADDR szFilterO
   
           cmp szFileName[0], 0
           je @F
             invoke stream_file_in, hEdit, ADDR szFileName
             invoke SetWindowText, hWin, ADDR szFileName
           @@:
        .elseif wParam == 1012
          fn SendMessage, hWin, WM_CLOSE, 0, 0
        .elseif wParam == 2001
          invoke DialogBoxParamA, hInstance, 3000, hWin, addr ColorProc, 0
        .elseif wParam == 1900
          invoke MessageBox, hWin, addr about, addr dname, MB_OK
        .endif
      .elseif uMsg == WM_SIZE
        invoke GetClientRect, hWin, addr rct
        mov eax, rct.bottom
 ;         sub eax, sbh ; uncomment if using status bar.
        mov rct.bottom, eax
        invoke MoveWindow, hEdit, rct.left, rct.top, rct.right, rct.bottom, TRUE
      .elseif uMsg == WM_CLOSE
      .elseif uMsg == WM_DESTROY
        invoke PostQuitMessage, 0
        return 0
      .endif
        invoke DefWindowProc, hWin, uMsg, wParam, lParam
        ret
    WndProc endp
   
    RegWindow proc hi:dword, cn:dword
    local wc:WNDCLASSEX, icn:dword
        mov wc.cbSize, sizeof WNDCLASSEX
        mov wc.style, CS_HREDRAW or CS_VREDRAW or CS_BYTEALIGNWINDOW
        mov wc.lpfnWndProc, offset WndProc
        mov wc.cbClsExtra, 0
        mov wc.cbWndExtra, 0
        mrm wc.hInstance, hi
        mov wc.hbrBackground, COLOR_BTNFACE+6
        mov wc.lpszMenuName, 0
        mrm wc.lpszClassName, cn
        invoke LoadIcon, hi, iconid
        mov wc.hIcon, eax
        mov icn, eax
        invoke LoadCursor, 0, IDC_ARROW
        mov wc.hCursor, eax
        mrm wc.hIconSm, icn
        invoke RegisterClassEx, addr wc
        ret
    RegWindow endp
   
    CenterMain proc hWin:dword, wd:dword, ht:dword
    local rct:RECT, h:dword, w:dword, x:dword, y:dword
      @@: ; dynamically adjusting width of the window for proper client rect size
        invoke MoveWindow, hWin, x, y, wd, ht, 0
        invoke GetClientRect, hWin, addr rct
        mov eax, rct.right
        sub eax, rct.left
      .if eax > 872 ; desired client rect width
        dec wd
        jmp @b
      .elseif eax < 872
        inc wd
        jmp @b
      .endif
      @@: ; dynamically adjusting height of the window for proper client rect size
        invoke MoveWindow, hWin, x, y, wd, ht, 0
        invoke GetClientRect, hWin, addr rct
        mov eax, rct.bottom
        sub eax, rct.top
      .if eax > 604 ; desired client rect height
        dec ht
        jmp @b
      .elseif eax < 604
        inc ht
        jmp @b
      .endif
        invoke GetSystemMetrics, SM_CYMENU
        add ht, eax
        invoke SystemParametersInfoA, SPI_GETWORKAREA, 0, addr rct, 0
        mov eax, rct.right
        sub eax, wd
        sar eax, 1
        mov x, eax
        mov eax, rct.bottom
        sub eax, ht
        sar eax, 1
        mov y, eax
        invoke MoveWindow, hWin, x, y, wd, ht, TRUE
        ret
    CenterMain endp


    end start
Using a 'modular' approach to not clutter the main source. Makes code easier for me to find.
Regards, zedd.
:tongue:

jj2007

  • Member
  • *****
  • Posts: 13657
  • Assembly is fun ;-)
    • MasmBasic
Re: my editor project
« Reply #12 on: October 06, 2022, 05:32:27 PM »
Using a 'modular' approach to not clutter the main source. Makes code easier to find.

So, if you want to have a look at the rich_edit proc, you hit Ctrl F and type rich_edit <Return>, what does your current IDE show?

basic_editor.asm:
Code: [Select]
      .if uMsg == WM_CREATE
        fn loadafile, "editor.ini"
        mov lpIni, eax
        mov inisize, ecx
        invoke CenterMain, hWin, wwidth, wheight
        fn LoadLibrary, "riched20.dll"
        invoke rich_edit, hWin, hInstance
        mov hEdit, eax
        invoke set_edit_colours

NoCforMe

  • Member
  • *****
  • Posts: 1043
Re: my editor project
« Reply #13 on: October 06, 2022, 05:38:24 PM »
Who says he's even using an IDE? I don't.

jj2007

  • Member
  • *****
  • Posts: 13657
  • Assembly is fun ;-)
    • MasmBasic
Re: my editor project
« Reply #14 on: October 06, 2022, 05:42:25 PM »
Me neither. And the number of IDEs which spontaneously go around searching for files that might contain the word rich_edit is severely limited. So "easier to find" translates to "will be found only once, as invoke rich_edit, hWin, hInstance".

Whenever I see tiny projects with code split over a dozen tiny little inc and asm files, I spontaneously decide to ignore them :cool: