PlanetSquires Forums

Support Forums => PlanetSquires Software => Topic started by: Paul Squires on July 09, 2016, 02:12:02 AM

Title: WinFBE on GitHub (July 9, 2016)
Post by: Paul Squires on July 09, 2016, 02:12:02 AM
New code in GitHub repository July 9, 2016.

Many changes in the editor. Too many to remember and list here.

- Fixed "Find Next" (F3)
- Added "General Options" in "Environment Options"
- Added "Close Function List on selection" option
- Added "Close Project Manager on selection" option
- Eliminated several areas that contributed to visual flickering in the editor
- Function List now shows sub/function names in sorted order







Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: José Roca on July 09, 2016, 02:38:07 AM
Suggestion: It is customary to allow navigation between tabs with Ctrl+W.
Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: Paul Squires on July 09, 2016, 02:54:49 AM
Quote from: Jose Roca on July 09, 2016, 02:38:07 AM
Suggestion: It is customary to allow navigation between tabs with Ctrl+W.

Sounds good. I will put that in there.
Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: Paul Squires on July 09, 2016, 02:56:06 AM
Fixed column editing mode by activating SCI_SETADDITIONALSELECTIONTYPING for each document. Now when you select a column and start to type, the characters will apply to all rows in the column.
Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: Paul Squires on July 09, 2016, 03:11:54 AM
Quote from: TechSupport on July 09, 2016, 02:54:49 AM
Quote from: Jose Roca on July 09, 2016, 02:38:07 AM
Suggestion: It is customary to allow navigation between tabs with Ctrl+W.

Sounds good. I will put that in there.

I am looking at https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts and under "Tab management" for Windows it lists:

Ctrl+W:  Close current tab

Ctrl+Tab:  Go to next tab

Ctrl+Shift+Tab:  Go to previous tab

Do those key combinations look okay?
Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: José Roca on July 09, 2016, 04:15:00 AM
Yes.

BTW the editor sometimes GPFs after changing an option and clicking the OK button. This time it has happened changing the charset. But it is not consistent, sometimes GPFs and sometimes not.
Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: José Roca on July 09, 2016, 04:19:08 AM
Another suggestion. In CSED I added an image list to the tab control with a red "x" icon. If you click on it, the tab is closed. More handy than the right click menu when you only want to close individual tabs. You may need two sizes for the icons, 16 and 32 pixels, because 16 pixels is too small with higher DPI settings.

Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: José Roca on July 09, 2016, 04:31:50 AM
This is progressing very well. A good editor and a very lightweight class to deal with BSTRs that works with the FB itntrinsic operators and can also be used with the Windows API functions. With the addition of a string builder class to add speed, we don't need to ask for a native implementation anymore, although it will be very welcome if it comes.

I will add to the wrappers some functions that return strings and that I have been avoiding until now.

Also I have plans for new separate include files for date and time functions, CD ROM, Shell, File System, operating system, etc., and the Ole Container.

Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: José Roca on July 09, 2016, 04:35:32 AM
Forgot it: I also need a class for variants.
Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: Paul Squires on July 09, 2016, 11:04:38 AM
Quote from: Jose Roca on July 09, 2016, 04:15:00 AM
BTW the editor sometimes GPFs after changing an option and clicking the OK button. This time it has happened changing the charset. But it is not consistent, sometimes GPFs and sometimes not.

Thanks Jose, is it the 64 bit version of the EXE that you are experiencing this problem with, or both?
Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: Paul Squires on July 09, 2016, 11:05:49 AM
Quote from: TechSupport on July 09, 2016, 03:11:54 AM
Ctrl+W:  Close current tab

Ctrl+Tab:  Go to next tab

Ctrl+Shift+Tab:  Go to previous tab

This has now been implemented. New code in repository.
Also, added saving and restoring of bookmarks for each document in a project.
Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: Paul Squires on July 09, 2016, 11:07:15 AM
Quote from: Jose Roca on July 09, 2016, 04:31:50 AM
This is progressing very well. A good editor and a very lightweight class to deal with BSTRs that works with the FB itntrinsic operators and can also be used with the Windows API functions. With the addition of a string builder class to add speed, we don't need to ask for a native implementation anymore, although it will be very welcome if it comes.

As soon as I hear that the class is now okay to be used in production code, I will start converting WSTRING code in the editor to use CBSTR.
Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: Paul Squires on July 09, 2016, 12:20:48 PM
New code added:

- Close icons in the top tabcontrol tabs. Uses the same red close "X" icon from Jose's CSED editor.
Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: Paul Squires on July 09, 2016, 04:45:10 PM
New code added:

- Project Options dialog. Added another textbox for Other Compiler Options 64 bit. Now you can have different compiler option switches for both 32 and 64 bit compilers. Very useful if using the "-x" switch that allows you to save resulting compiled file under a specific name.
Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: José Roca on July 09, 2016, 04:56:49 PM
Quote
As soon as I hear that the class is now okay to be used in production code, I will start converting WSTRING code in the editor to use CBSTR.

The class has become very simple. Instead of trying to do the allocations/deallocations in the code of the class, which can cause memory leaks for not freeing temporary strings, it delegates the task to the compiler. The class simply stores the resulting string provided by the compiler in a BSTR and returns a pointer to the string data when the compiler asks for it. Therefore, the temporary strings are allocated and freed by the compiler.

The only code that has an infinitesimal possibility to fail is:


OPERATOR CBStr.Let (BYREF bstrHandle AS AFX_BSTR)
   IF bstrHandle = NULL THEN EXIT OPERATOR
   ' Free the current OLE string
   IF m_bstr THEN SysFreeString(m_bstr)
   ' Detect if the passed handle is an OLE string.
   ' If it is an OLE string it must have a descriptor; otherwise, don't.
   ' Get the length in bytes looking at the descriptor and divide by 2 to get the number of
   ' unicode characters, that is the value returned by the FreeBASIC LEN operator.
   DIM res AS DWORD = PEEK(DWORD, CAST(ANY PTR, bstrHandle) - 4) \ 2
   ' If the retrieved length is the same that the returned by LEN, then it must be an OLE string
   IF res = .LEN(*bstrHandle) THEN
      ' Attach the passed handle to the class
      m_bstr = bstrHandle
   ELSE
      ' Allocate an OLE string with the contents of the string pointed by bstrHandle
      m_bstr = SysAllocString(*bstrHandle)
   END IF
END OPERATOR


As the compiler does not support BSTRs natively, it has no way to know if the pointer is a BSTR or a WSTRING. Therefore, we can't have an overloaded function for BSTR and another for WSTRINGs. Even if I have used BYREF bstrHandle AS AFX_BSTR, the passed pointer can be a BSTR or a WSTRING.

To ascertain it, I peek the value of the prefix dword, that in the case of a BSTR contains the length in bytes of the string data, and compare it with the length of the string data. In the case of a WSTRING these four bytes before the string data will likely contain garbage and what are the odds that this value will coincide exactly with the length of the string?


Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: Paul Squires on July 09, 2016, 07:07:28 PM
That's a pretty good hack. I imagine that the probability of it failing is so small as to not to be concerned about.
I will start to use CBSTR for parts of the editor code to see if there are any troubles.
Title: Re: WinFBE on GitHub (July 9, 2016)
Post by: Paul Squires on July 09, 2016, 07:08:28 PM
New source code uploaded:

- Added F1 context sensitive help for FB keyword lookups.