Recent

Author Topic: Modified LazResExplorer example program  (Read 2965 times)

dsiders

  • Hero Member
  • *****
  • Posts: 1077
Modified LazResExplorer example program
« on: July 13, 2021, 05:47:22 am »
I hope this is the correct sub-forum.

I modified the files in examples/lazresexplorer. I added image viewing for generic resource types (like PNG, JPG, etc.), icons, and cursors. It populates the binary tab for recognized image types, so you can view the image or the binary content.

For anyone interested, I am attaching a .zip archive with the modified files. I've been using it on Windows with no issues. I'm not a graphics guru, so suggestions to improve the code are welcomed.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: Modified LazResExplorer example program
« Reply #1 on: July 13, 2021, 08:26:36 am »
You should provide a patch against trunk and publish it in bugtracker so once it is accepted everyone benefits. If you have trouble extracting diff info from git/svn then you might use a tool like https://winmerge.org which can extract diff info and create a patch based on a simple directory comparison.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

dsiders

  • Hero Member
  • *****
  • Posts: 1077
Re: Modified LazResExplorer example program
« Reply #2 on: July 13, 2021, 08:38:03 am »
You should provide a patch against trunk and publish it in bugtracker so once it is accepted everyone benefits.

That is my plan. I was hoping for some feedback before I did that. I did the "simplest thing that works", but possibly not the "right thing". :)

Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4467
  • I like bugs.
Re: Modified LazResExplorer example program
« Reply #3 on: July 13, 2021, 09:05:59 am »
That is my plan. I was hoping for some feedback before I did that. I did the "simplest thing that works", but possibly not the "right thing". :)
Hold on with a patch. We need a resource explorer in the tools directory of Lazarus sources. Now there is only a half-baked glazres with support for the old resource format. I had a plan to combine its functionality and more with the exact same example project that you found.
A new improved version should go to the GitLab repo under tools directory.

Your version works well also under Linux.
For some reason the "Save resource ..." feature is always disabled. The fileSave: TAction is not disabled anywhere. Strange.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

dsiders

  • Hero Member
  • *****
  • Posts: 1077
Re: Modified LazResExplorer example program
« Reply #4 on: July 13, 2021, 03:55:14 pm »
That is my plan. I was hoping for some feedback before I did that. I did the "simplest thing that works", but possibly not the "right thing". :)
Hold on with a patch. We need a resource explorer in the tools directory of Lazarus sources. Now there is only a half-baked glazres with support for the old resource format. I had a plan to combine its functionality and more with the exact same example project that you found.
A new improved version should go to the GitLab repo under tools directory.

I'm in no rush.

Your version works well also under Linux.

That's good to know. The platform defs for the readers was already in place. So I didn't break it.

For some reason the "Save resource ..." feature is always disabled. The fileSave: TAction is not disabled anywhere. Strange.

The FileSave action has DisableIfNoHandler set. And there is no OnExecute handler on the action or the action list.

It appears that there were intentions to make it a general purpose resource editor. But never realized. I just added image viewing for the unsupported image resource types. There are other resource types that are not explicitly supported, and use display as binary as the fallback.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

 

TinyPortal © 2005-2018