New tab

Fileviewer reinstated

I've pushed changes to reinstate the Fileviewer in templot3.

I've made substantial changes, although the code is still very messy.

The changes I have made are:
  • use the ShellTreeView and ShellListView components. ShellTreeView replaces the drive and directory boxes.
  • added a preview (using htmlviewer).
  • only show the preview for the selected file
  • removed rename/delete/find functions.
I'm reluctant to do much more in here, as I believe the whole Fileviewer should probably be removed and replaced with a more standard File menu with options Open/Save/Save as/Import/Export. Rename and Delete are functions that I think are best left to the underlying OS.

The Open Dialog can be customized to provide a visual preview.

Spending time on this though has just reinforced for me how important it is to work through the code improving the design, before trying to implement new features.

Cheers,
Alistair.
 
_______________
message ref: 677

Martin Wynne

Admin
Location
West of the Severn UK
Info
Please do not send requests for help direct to me via email.

Post your questions on the forum where everyone can see them and add helpful replies.
Hi Alistair,

Good to see some actual new code being posted.

I downloaded the zip from your repository, and tried it in Lazarus. It compiled straight off. :)

A few points.

You didn't update the version number from 2.92.a That's a big no-no for me -- the link to your repository is public and Googleable in your other topic. So anyone can download and compile it -- I did so. Which means we now have two different versions of T3 in the wild, both with the same version number. My original still on Sourceforge, and your fork from it.

That makes any user support totally impossible. Fortunately I doubt there is anyone using either version in anger, but in principle there could be.

I think your fork needs a separate versioning system, or maybe a different name. Perhaps your fork should be called Templot4 ?

It's your fork, but for me showing only one file at a time in the file viewer has destroyed the intended functionality of the viewer. It was not intended as a replacement for the Windows file-open dialog. The idea is to be able to scan quickly through your files and find the one you are looking for. You can't do that if you have to laboriously click through 100 files one at a time.

removed and replaced with a more standard File menu with options Open/Save

I'm afraid this is where we are going to part company. No software with my name on it is ever going to use the Windows Document Model with Open/Save functionality. It is totally useless for non text-based design applications. Overwriting your data with an accidental Save is just ludicrous. When I first started using Windows I couldn't believe it. In Templot2 you don't open a file, you load data from it. After which, where it came from is irrelevant. Data from other files can be added to it. Later it can all be saved to a new file. See: https://85a.uk/templot/companion/gs_baffled.php#files

Nothing on Earth will persuade me to have my Templot write data back to the file it came from. It always goes in a new file. Deleting, sorting and overwriting files should be the responsibility of the user.

But that's just me, your fork is for you to decide. :)

I noticed you code functions as:

fv_add_file();

which is puzzling to me. I don't understand the purpose of the empty parenthesis? I know this format is used in untyped languages to indicate a function. But in Pascal

fv_add_file;

is previously declared as a function or procedure, so there is no need to indicate the type every time you use it. When I see the the empty parenthesis in other software I wonder momentarily if I'm seeing a typo and something is missing.

Thanks again for your work on this. I'm a bit tied up with Templot2 at present to do much on T3.

cheers,

Martin.
 
_______________
message ref: 685
Hi Martin,

You didn't update the version number from 2.92.a
Oops. I hadn't been thinking about version numbers. I absolutely agree about versioning, so I'll do something about this asap. At this stage anything built from the main branch is a "development version", and therefore not deserving of a version number - but it does need to be identified as such.

showing only one file at a time in the file viewer has destroyed the intended functionality of the viewer
Believe me, I hummed and hahhed a lot about this, and I can't say I'm happy with what I've got. What I think I might do is add some buttons to select the different modes for the List View (Report/List/Small Icon/Large Icon), and a button to show/hide the preview.

Even if I don't keep the File Viewer in the longer term, the work to support the different modes will be useful for customizing a File Open dialog.

No software with my name on it is ever going to use the Windows Document Model with Open/Save functionality
This is the way the world works (whether it is Windows, Linux, Mac or whatever else). One of the tenets of software/UI design is to make things familiar/discoverable to users. Pretty much all other software works this way, and if your software is different that makes it harder for people to learn how to use.

Now, I do understand your concerns about versioning, and I agree that it is not something the Document model handles well (or at all!). I've seen a couple of approaches to this, but while they still present as a "Document", they generally have a database backend rather than a file (Autodesk Fusion 360 is a good example). For the moment I still think the Document model is the better long term plan, but I'm definitely open to alternatives.

I noticed you code functions as:

fv_add_file();

which is puzzling to me. I don't understand the purpose of the empty parenthesis?

I know the parenthesis are optional in Pascal (if there are no parameters), but I'm still sorting out coding style (it's been a few years since I last used Delphi, and I mostly work in C++ these days).

Just a matter of coding style that will probably flip-flop a bit until I settle down on something :)

Cheers,
Alistair.
 
_______________
message ref: 686
Hi,

I've pushed another set of changes to address the versioning.

For the moment it will now report as being version "0.00.dev".

I have also introduced a separate file_version. The idea of this is that it is a simple incrementing number that is independent of the program version. It gets incremented whenever a change that affects the file format occurs. It may be incremented several times between designated releases, or it may not change at all. I have set this to a large initial value, so that it won't conflict with Templot program version numbers.

I have also added a GetVersionString() function, so that the logic for formatting version strings is now isolated in one place.

Regards,
Alistair.
 
_______________
message ref: 698
New tab
Top