• Welcome to PlanetSquires Forums.
 

WinFBE v2.2.1

Started by Paul Squires, December 28, 2021, 12:16:12 PM

Previous topic - Next topic

Johan Klassen

Hi Paul :-)
I like the new look, any estimate on the release?

Paul Squires

Quote from: Johan Klassen on January 13, 2022, 09:13:29 PM
Hi Paul :-)
I like the new look, any estimate on the release?
Not sure at this time. I am creating a lot of new code every day but I have a fair amount of to-do items left in my notebook. When it is in a stable condition then I will probably upload test version so you guys can see how the editor reacts to your particular computer setups.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Johan Klassen


Joerg B.

Hey Paul
When we start programming and the code works, we are satisfied.
Then, as our programming knowledge and skills improve over time, we sometimes wonder how we could create such "modest" code and are no longer quite so satisfied.

I think all good programmers feel that way.
..... I am not such a good programmer..... sometimes I think. :-)

I'm looking forward to the beta or release version.
You are taking WinFBE to a new level with this.

Like I said before... it looks very good.
Greeting from Germany

Joerg

Paul Squires

Thanks Joerg, you are correct. Lots of old code that I look at now and know that I can write it much better now. :-)
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Here is what I've learned and implemented over the past couple of days.

- How to create semi-transparent popup windows allowing me to create a custom scrollbar that hovers above the child window much like it does in VSCode. You don't use WM_PAINT for this, you have to use UpdateLayeredWindow whenever you want to update the UI. I also learned that you need to hook into the message pump and redirect mouse messages because semi-transparent popup windows (WS_EX_LAYERED) do not get messages sent to their procedure handlers.

- I am now using the very latest Scintilla editing component. The lexers are no longer part of the Scintilla component itself. You need to compile whatever lexer(s) you need into a separate DLL (Lexilla.dll) and then retrieve the lexer pointer and feed it into the Scintilla control. I learned (after many GPF's) that you need to retrieve a new pointer for EVERY Scintilla window you create. You can not simply get the lexer pointer from Lexilla.dll and share it amongst all your windows. When a Scintilla window is destroyed it also destroys the pointer so therefore you can not share a global pointer. Using Visual Studio 2019 Community Edition, I was able to create 32 bit and 64 bit DLL's for both Scintilla and Lexilla and they work perfectly with the new code base. Now I can simply concentrate on modifying the existing lexer to make it perfect for FreeBasic.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Just finished coding "Load Session" and "Save Session" for people who do not like, or do not need, to work with full blown Projects. A Session basically saves the current open editor windows and your editing position within those windows. It also saves the selected Build Configuration. There is also an Environment Option to automatically load your last used session when WinFBE starts up. Session states are simple configuration files saved to disk in unicode format (*.session).

Next up... Auto save and backup of files.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

#22
Auto Save (and crash recovery) of files (thanks to Wallyg for this inspiration)

I analyzed how it works in Glade and also JEdit. They both deal with Auto Save very similarly.

This turned out to be a really cool feature and works perfectly for Project and non-project based files alike. The "Auto Save" option is now available on the File menu (similar to VSCode) so it is very easy to turn and off. This will all be in the next WinFBE update.

When auto save is enabled, every 10 seconds a check is performed to determine if the editor text has been modified further since the last AutoSave was done. If yes, then WinFBE automatically saves the current source code to a filename wrapped in # characters. For example, if the source filename is C:\FB\EXAMPLE.BAS then the auto saved file is called C:\FB\#EXAMPLE.BAS#. Later in a subsequent editing session, when WinFBE tries to load the original file it checks to see if the ### wrapped file exists and if it does, it checks the date on both files. If the auto saved #filename# is newer then WinFBE asks the user if they want to use the new auto saved version.

This feature is fantastic for situations where your computer has a power outage or WinFBE crashes prior to saving your unsaved edits.

This feature is also different than "backup". As Wallyg described in his FreeBasic forum post, he mentioned that Glade attaches a trailing tilde ~ to its auto save file. In actuality, Glade uses the ~ when backing up a file (so does JEdit). Both Glade and JEdit use the ### approach when handling auto save. Automatic backup of files is a different topic and editors approach this differently with some backing up a file when it is first loaded only, and others whenever the file is saved. Of course, some editors allow for multiple backups EXAMPLE.BAS~1, EXAMPLE.BAS~2, EXAMPLE.BAS~3, etc. I am on the fence as to whether I want to implement Backup into WinFBE. I feel that auto save is sufficient and leave the backup and archiving of source code files to the user so that they can handle it however they wish.


Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Joerg B.

Hey Paul
Thanks to Wally for the inspiration.... :-)
The autosave function is a good thing to reduce losses in case of a power failure. But actually it does not replace a real backup.
I had a big data loss two years ago and lost the complete source code of some programs. It was nothing important, but I miss all those code snippets to this day.

My inconsistency annoyed me the most in retrospect.

Since everything worked for a long time, I slowly lost sight of the need for a backup.
An optional backup feature in WinFBE is very useful and I would definitely use it.

Ultimately, of course, the responsibility for a backup always lies with the user.
Greeting from Germany

Joerg

SeaVipe

Hi Paul,

For "project" backup, I call a batch file from the User menu. This creates a unique folder on my 2 backup drives the names of which contain the date and time of the backup something like this:

C:\Users\Clive\OneDrive\BackUp\TaskMaster\SRC\TeriBasebak.19-Jan-2022-09-03-45-61 Where the last 2 digits are decimal seconds.

The batch file doesn't check the archive bit, just copies all relevant files (modified or not) to the new folder.
For reference, I pipe the output to a pair of text files in the root backup folder. Here is a single entry from the first text file:
==========================================
Backup Begin 19-Jan-2022 at  9:03:45.64             
Compiler - FB 64Bit.                    
TaskMaster.wfbe                         
------------------------------------------
Copied C:\SRC\TeriBase\modules\*.* to "C:\Users\Clive\OneDrive\BackUp\TaskMaster\SRC\TeriBasebak.19-Jan-2022-09-03-45-61\"    
Copied C:\SRC\TeriBase\modules\*.* to  I:\Backup\SRC\TaskMaster\TeriBasebak.19-Jan-2022-09-03-45-61\                      
Copied C:\SRC\TaskMaster\*.* to "C:\Users\Clive\OneDrive\BackUp\TaskMaster\SRC\TaskMasterbak.19-Jan-2022-09-03-45-61\"    
Copied C:\SRC\TaskMaster\*.* to  I:\Backup\SRC\TaskMaster\TaskMasterbak.19-Jan-2022-09-03-45-61\                      
------------------------------------------
TaskMaster (subset of TeriBase TaskMaster) SRC backed up as of 19-Jan-2022-09-03-45-61    
------------------------------------------

The second text file is simply a list of all the backed-up files.
I created the batch file decades ago and haven't found a need to modify it since, though tweaks for drive designations and so forth have happened from time to time. This works for me, but a proper backup feature built into WinFBE would be much better, less cumbersome than my batch file approach and no doubt have better control over the files being backed up/restored. I back up my projects at the beginning (and sometimes the end) of each session.
1 drive is a cloud drive and the other is a large(ish) hot-swappable SATA drive.
:0)
Clive Richey

Paul Squires

That's awesome Clive! My backup routine is not quite as elaborate as yours but it does involve an automated process of copying my source codes to a USB attached hard drive which is very convenient when I code from different computers and laptops.

I need to think long and hard about a good backup approach. I am thinking that I may postpone any backup implementations until after I get the next update out. I still have a lot of work left to do on this update and I fear that if I start going down the backup rabbit hole that I will "waste" a week or more that I could be using to polish up the core parts of the editor.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

SeaVipe

#26
Here is the batch file with comments and unused gotos where > and >> redirect output:


@ECHO off
REM goto getcopied
ECHO Batch file history:
ECHO 2020-03-06 - Add: Created from original
ECHO ============================================================================
REM /E copies directories, /Y suppresses overwrite prompt.
REM Convert the current time (with colons and a decimal)
REM to a string with hyphenated numbers (12-34-56-99):
set coln=%time%
set coln=%coln::=-%
set coln=%coln:.=-%
set coln=%coln: =0%
REM Copy to new dir with date-time designation:
ECHO.
ECHO Standby. . .
ECHO.
ECHO ========================================== >> I:\BackUp\SRC\TaskMaster\backup.log
ECHO Backup Begin %DATE% at %TIME% >> I:\BackUp\SRC\TaskMaster\backup.log
ECHO Compiler - FB 64Bit.  >> I:\BackUp\SRC\TaskMaster\backup.log
ECHO TaskMaster.wfbe        >> I:\BackUp\SRC\TaskMaster\backup.log
ECHO ------------------------------------------ >> I:\BackUp\SRC\TaskMaster\backup.log
ECHO.
REM
ECHO Copying TaskMaster Shared Modules
ECHO New backup > I:\BackUp\SRC\TaskMaster\BakFiles.log
xcopy /E /Y C:\SRC\TeriBase\modules\*.*    "C:\Users\Clive\OneDrive\BackUp\TaskMaster\SRC\TeriBasebak.%date%-%coln%\" >>  I:\BackUp\SRC\TaskMaster\BakFiles.log
xcopy /E /Y C:\SRC\TeriBase\modules\*.*     I:\Backup\SRC\TaskMaster\TeriBasebak.%date%-%coln%\  >> I:\BackUp\SRC\TaskMaster\BakFiles.log
ECHO Copied C:\SRC\TeriBase\modules\*.* to "C:\Users\Clive\OneDrive\BackUp\TaskMaster\SRC\TeriBasebak.%date%-%coln%\" >> I:\BackUp\SRC\TaskMaster\backup.log
ECHO Copied C:\SRC\TeriBase\modules\*.* to  I:\Backup\SRC\TaskMaster\TeriBasebak.%date%-%coln%\ >> I:\BackUp\SRC\TaskMaster\backup.log
ECHO.
xcopy /E /Y C:\SRC\TaskMaster\*.*    "C:\Users\Clive\OneDrive\BackUp\TaskMaster\SRC\TaskMasterbak.%date%-%coln%\" >  I:\BackUp\SRC\TaskMaster\BakFiles.log
xcopy /E /Y C:\SRC\TaskMaster\*.*     I:\Backup\SRC\TaskMaster\TaskMasterbak.%date%-%coln%\  >> I:\BackUp\SRC\TaskMaster\BakFiles.log
ECHO Copied C:\SRC\TaskMaster\*.* to "C:\Users\Clive\OneDrive\BackUp\TaskMaster\SRC\TaskMasterbak.%date%-%coln%\" >> I:\BackUp\SRC\TaskMaster\backup.log
ECHO Copied C:\SRC\TaskMaster\*.* to  I:\Backup\SRC\TaskMaster\TaskMasterbak.%date%-%coln%\ >> I:\BackUp\SRC\TaskMaster\backup.log
ECHO Done. C:\SRC\TeriBase\modiles\*.*
ECHO Done. C:\SRC\TaskMaster\*.*
REM
ECHO ------------------------------------------ >> I:\BackUp\SRC\TaskMaster\backup.log
ECHO Done with back up.
ECHO TaskMaster (subset of TeriBase TaskMaster) SRC backed up as of %date%-%coln% >> I:\BackUp\SRC\TaskMaster\backup.log
ECHO ------------------------------------------ >> I:\BackUp\SRC\TaskMaster\backup.log
ECHO.
REM goto end
:getcopied
REM ECHO Copy TaskMaster.exe to C:\ and OneDrive
REM Copy /Y C:\SRC\TeriBase\release64\TaskMaster.exe "C:\TeriBase\" >> I:\BackUp\SRC\TaskMaster\BakFiles.log
REM Copy /Y C:\SRC\TeriBase\release64\TaskMaster.exe "C:\Users\Cive\OneDrive\TeriBase\" >> I:\BackUp\SRC\TaskMaster\BakFiles.log
REM ECHO Copy TaskMaster.exe to "C:\TeriBase\" >> I:\BackUp\SRC\TaskMaster\backup.log
REM @ECHO OFF
ECHO.
:end
REM PAUSE
TIMEOUT 5

It's a bit cumbersome...
Clive Richey

Bumblebee

#27
In case of a power failure, my laptop battery has got my back. Right??

I do backups in case of hard drive failure.

SeaVipe

Hi @BumbleBee, if your laptop battery is in good condition then a power bump or full-on power failure should ensure that any unsaved work is not lost. I believe that Paul's reference to "Auto Save" in the next WinFBE will help those of us not working on laptops (or have a UPS) as a power failure should only result in a lose of data newer than the most recent Auto Save or manual save (it didn't take too many power failures for me to get into the habit of hitting CTRL/S on a regular basis).
QuoteWhen auto save is enabled, every 10 seconds a check is performed to determine if the editor text has been modified further since the last AutoSave was done. If yes, then WinFBE automatically saves the current source code to a filename wrapped in # characters. For example, if the source filename is C:\FB\EXAMPLE.BAS then the auto saved file is called C:\FB\#EXAMPLE.BAS#. Later in a subsequent editing session, when WinFBE tries to load the original file it checks to see if the ### wrapped file exists and if it does, it checks the date on both files. If the auto saved #filename# is newer then WinFBE asks the user if they want to use the new auto saved version.
This feature is fantastic for situations where your computer has a power outage or WinFBE crashes prior to saving your unsaved edits.
Auto Save could save your work to a backup hard drive, though we'll have to wait and see what options will be available for Auto Save.
If your external backup hard drive is powered from your laptop's USB, it may also survive a power failure.
My external drives have separate power supplies and shut down when the power fails so I no longer use them. Instead, I backup to a different (hot-swappable) internal hard drive as well as a Cloud Drive. Auto Save to the Cloud might be a safe way to ensure work is not lost...
Clive Richey

Paul Squires

#29
Here is today's accomplishment. A keyboard bindings map editor. You can now easily assign/re-assign your own user bindings to the various actions in the editor. Creating your own user defined keybinding simply overrides/replaces the default action. This is something that I've wanted to include in WinFBE for a very long time so it is satisfying to finally have it done. Granted, the dialog is not themed... none of the popup dialogs in WinFBE are themed (yet).

I have also finally finished the top tab control. That was an interesting programming exercise writing all of that from scratch. The result is awesome and looks so much better than the default Windows tab control.

Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer