Author Topic: my editor project  (Read 7944 times)

zedd151

  • Member
  • *****
  • Posts: 1937
Re: my editor project
« Reply #180 on: October 18, 2022, 12:02:40 PM »
here is the procedure that I am currently using for incrementing quantity and appending the string for that value to create an incremented "Name?" key and "Path?" key.
Code: [Select]
    Plug2Ini proc lpIni:dword, lpSection:dword, lpKey:dword, lpName:dword, lpPath:dword
    local strInt[8]:byte, intx:dword, Name_[32]:byte, Path_[32]:byte
        fn GetPrivateProfileInt, lpSection, lpKey, 0, lpIni ; get current quantity value
        inc eax                                             ; increment
        mov intx, eax
        invoke dwtoa, intx, addr strInt                     ; make string (quantity+1)
        invoke WritePrivateProfileString, lpSection, lpKey, addr strInt, lpIni ; write incremented quantity back to ini
        fn lstrcpy, addr Name_, "Name"
        invoke lstrcat, addr Name_, addr strInt             ; append count to "Name", creating a new key
        invoke WritePrivateProfileString, lpSection, addr Name_, lpName, lpIni
        fn lstrcpy, addr Path_, "Path"
        invoke lstrcat, addr Path_, addr strInt             ; append count to "Path", creating a new key
        invoke WritePrivateProfileString, lpSection, addr Path_, lpPath, lpIni
        ret
    Plug2Ini endp
Producing the following result: (snippet from ini file)
Code: [Select]
[Plugins]
Quantity=3
Name1=plug 1
Path1=\plugins\plug1.dll
Name2=plug 2
Path2=\plugins\plug2.dll
Name3=plug 3
Path3=\plugins\plug3.dll
In practice though, would probably be better to use the full path. Which I will do... in a moment

Now on to the procedure to read the ini file, and add the plugins to the editors menu.  :biggrin:
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1937
Re: my editor project
« Reply #181 on: October 18, 2022, 12:48:16 PM »
Real world testing of the "Add Plugin" function.
Code: [Select]
        .if wParam == 12103
          invoke GetPlugName, hDlg, addr lpTitleP, addr lpDllFilt
          invoke SetDlgItemText, hDlg, 12102, addr szPlugName
        .elseif wParam == 12104
          invoke GetDlgItemText, hDlg, 12101, addr MenuName, 64
          invoke Plug2Ini, addr inifile, addr strPlug, addr strQuty, addr MenuName, addr szPlugName
          invoke SendMessage, hDlg, WM_CLOSE, 0, 0
        .elseif wParam == 12105
result:
Code: [Select]
[Plugins]
Quantity=5
Name1=ASM Comment
Path1=C:\Users\Administrator\Desktop\basic editor19\plugins\ASMComment.dll
Name2=Plugin Builder
Path2=C:\Users\Administrator\Desktop\basic editor19\plugins\PluginBuilder.dll
Name3=Replace by List
Path3=C:\Users\Administrator\Desktop\basic editor19\plugins\repbylist.dll
Name4=UnCap
Path4=C:\Users\Administrator\Desktop\basic editor19\plugins\uncap.dll
Name5=Remove Comments
Path5=C:\Users\Administrator\Desktop\basic editor19\plugins\uncomment.dll

It Verks.  :tongue:  This time now on to creating the procedure to read the ini file, and add the plugins to the editors menu. Finally.
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1937
Re: my editor project
« Reply #182 on: October 20, 2022, 02:34:08 AM »
Finally had a chance to work on the "ini2menu" function for the plugin menu. The function first retrieves the plugin count "Quantity". It then loops through the found plugin names and adds them to the "Plugins" menu, at that time an ID number is also generated for the menu entry. Further testing needed before I post the code.  :biggrin:
Regards, zedd.
:tongue:

TimoVJL

  • Member
  • *****
  • Posts: 1296
Re: my editor project
« Reply #183 on: October 20, 2022, 05:13:26 AM »
Quantity is useful, when removing things from numbered list, allowing holes in it and having max count.

EDIT:
With GetPrivateProfileSection is possible to have same name/labels like this:
Code: [Select]
[Tools]
Name=test1
Tool=calc.exe
Name=test2
Tool=notepad.exe
Name=test3
Tool=cmd.exe
Quote
GetPrivateProfileSection function

Applies to: desktop apps only

Retrieves all the keys and values for the specified section of an initialization file.
Note  This function is provided only for compatibility with 16-bit applications written for Windows. Applications should store initialization information in the registry.

Syntax

DWORD WINAPI GetPrivateProfileSection(  _In_   LPCTSTR lpAppName,   _Out_  LPTSTR lpReturnedString,   _In_   DWORD nSize,   _In_   LPCTSTR lpFileName
);
« Last Edit: October 20, 2022, 06:40:37 PM by TimoVJL »
May the source be with you

zedd151

  • Member
  • *****
  • Posts: 1937
Re: my editor project
« Reply #184 on: October 20, 2022, 07:39:59 AM »

Hey Timo, quite right. I have thought of that. Beside the function to add a plugin I plan on a similar one to remove plugins as well. The plugins wil be automatically renumbered in that scenario. I will look into it in any case. As far as maximum plugins, as I no longer use a list of names or list of plugin dll's, probably the maximum would be limited by whatever ID numbers are used after the plugin ID series. Ex. If plugins have ID's from 12001 as it is currently, the ID of the about box would cause a collision at 13001. Making absolute maximum number of plugins 1000 in that scenario. So in order to avoid such collisions probably take other WM_COMMAND ID's into consideration.   I've got some more work to do...  :biggrin:
Added afterwards:  I must change the ID's for the AddPlugin push buttons and other controls.    :undecided:
Quote from: zedd
Code: [Select]
        .if wParam == 12103
          invoke GetPlugName, hDlg, addr lpTitleP, addr lpDllFilt
          invoke SetDlgItemText, hDlg, 12102, addr szPlugName
        .elseif wParam == 12104
          invoke GetDlgItemText, hDlg, 12101, addr MenuName, 64
          invoke Plug2Ini, addr inifile, addr strPlug, addr strQuty, addr MenuName, addr szPlugName
          invoke SendMessage, hDlg, WM_CLOSE, 0, 0
        .elseif wParam == 12105
I hadn't thought about those until after writing the above. maximum plugins with this code = 100
Whoops. It's all okay since I hadn't yet published the full source code  :tongue:
The project may be moving slowly, but still... progress is being made. Even if is just finding mistakes.  :biggrin:

I myself cannot see using more than several dozen plugins, but who knows what others may do?
« Last Edit: October 20, 2022, 08:56:07 AM by zedd151 »
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1937
Re: "my editor" project
« Reply #185 on: October 23, 2022, 02:50:26 AM »
The editor is now officially named "my editor". Yes all of the attachments were named "basic editorxx" but that was only a placeholder until I decided on a final name. I plan on posting the final version of my editor sometime later today. It will not have a "remove plugin" function as I had previously mentioned but rather instructions for removing it from the ini file which should be a no-brainer to do manually. There is a function to add plugins though. Also I will forego adding any other functions that I may have mentioned in this thread. (For now at least). I will finish up the current code, adding checking if the plugin is valid (checking for either one of the two arguments for valid qe plugins) first though, as well as checking if the .dll is still where it is specified to be in the ini file, else do nothing after a message box.  :smiley:
Any other additions will come much later. I do plan on having plugins designed specifically for 'my editor', which take the rich edit controls handle as it's sole argument. Those plugins will not be compatible with qeditor.
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1937
my editor project - complete series
« Reply #186 on: November 10, 2022, 04:32:42 PM »
This project is on hold for the foreseeable future. Attached is a zip file containing each (numbered) version of the editor, showing progress in a step by step manner from a bare bones editor to an almost completed version. They are all included in the attached zip file for anyone interested but they don't want to wade through all of the 'noise' posts to find them.

The attached is a culmination of the progress of this editor up until this point (basic editor - basic editor18)
« Last Edit: November 17, 2022, 01:00:38 PM by zedd151 »
Regards, zedd.
:tongue:

greenozon

  • Member
  • **
  • Posts: 51
Re: my editor project
« Reply #187 on: November 10, 2022, 07:22:45 PM »
Nice work!
small bugreport: if .ini is not present nearby then .exe hangs in memory consuming 100% CPU but not showing main window
despite it writes back some default ini file to disk...
the only way is to kill the process and start again

PS Looks like the real reason of not showing main window is
[Plugins]
Quantity=0

zedd151

  • Member
  • *****
  • Posts: 1937
Re: my editor project
« Reply #188 on: November 11, 2022, 02:04:46 AM »

Nice work!
small bugreport: if .ini is not present nearby then .exe hangs in memory consuming 100% CPU but not showing main window
despite it writes back some default ini file to disk...
the only way is to kill the process and start again

PS Looks like the real reason of not showing main window is
[Plugins]
Quantity=0

In any case I don't have time right now to chase bugs here. Too much going on in real life. Also, this project is still WIP, as mentioned in my post above. So bugs can be expected for some versions until an official release is made.r
I will look into this issue when time permits.
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1937
Re: my editor project
« Reply #189 on: November 11, 2022, 02:06:25 AM »
greenozon, which version of the editor (from which folder)?
Also what OS are you running? Will be helpful for debug purposes. The code for processing the ini file and the plugins has changed through different test versions. Without knowing which version of the editor I cannot reproduce the errors described and don't have time to cycle through all of them myself to find this specific error.
Regards, zedd.
:tongue:

greenozon

  • Member
  • **
  • Posts: 51
Re: my editor project
« Reply #190 on: November 11, 2022, 06:13:30 AM »
I took "basic editor19" from your package
my OS is W7x64 sp1
questions: does it suppose to run wihtout any .ini nearby?
does it suppose to run without plugins dir?

jj2007

  • Member
  • *****
  • Posts: 13872
  • Assembly is fun ;-)
    • MasmBasic
Re: my editor project
« Reply #191 on: November 11, 2022, 07:04:53 AM »
I took "basic editor19" from your package
my OS is W7x64 sp1

Works fine here on Win7-64. There are an ini file and a plugin directory in the archive. The plugin folder is not needed, but the ini file is essential. The one that gets created if the editor doesn't find any doesn't work.
« Last Edit: November 11, 2022, 08:25:09 AM by jj2007 »

zedd151

  • Member
  • *****
  • Posts: 1937
Re: my editor project
« Reply #192 on: November 11, 2022, 07:42:10 AM »
I took "basic editor19" from your package
my OS is W7x64 sp1
questions: does it suppose to run wihtout any .ini nearby?
does it suppose to run without plugins dir?
It is supposed to create a default ini file in the program directory if no ini file found. Only needs plugin directory if plugins are used. I will look into this the first chance I get.
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1937
Re: my editor project
« Reply #193 on: November 11, 2022, 07:44:29 AM »
Quote from: jj2007
The one that does created (ini file) if the editor doesn't find any doesn't work.
I will look into this as time permits...

The version I have been using has a few tweaks in it. I will compare that version later tonight, with version 19 from the archive to see whether any changes in my (unpublished) version fixes the errors that you and greenozon have found. Thank both of you for your responses. If not tonight, then soon. I'm raising a little puppy that takes up a lot of my time lately...
Regards, zedd.
:tongue:

zedd151

  • Member
  • *****
  • Posts: 1937
Re: my editor project
« Reply #194 on: November 11, 2022, 08:47:41 AM »
Whoops! 'basic editor 19' is an untested version and should not have been included in the archive. Removed it from the archive and updated the attachment above. Version 19 was the last version that I was working on and still on my desktop. I forget exactly what I was doing with it, but yes it does not work if no ini file is present. It creates the default ini file but hangs, exactly as described.

Version 18 works though (the last public version), with or without an ini file being present in the program directory or not.

Attachment removed but is included in the archive In this post


For now, the project remains on hold.
« Last Edit: November 17, 2022, 12:57:35 PM by zedd151 »
Regards, zedd.
:tongue: