WinFBE on GitHub (January 1, 2017)

Started by Paul Squires, January 01, 2017, 01:13:35 PM

Previous topic - Next topic

Paul Squires

Release of WinFBE Version 1.2.0 created.

- Added: Autocomplete feature for IF/WHILE/FOR/SELECT/FUNCTION/SUB/PROPERTY/TYPE/UNION
- Added: Autocomplete displays data type list after "AS" is typed.
- Added: Codetip popups for builtin FreeBASIC keywords and user defined subs/functions.
- Added: Missing FB keywords: CULNG, CULNGINT, BOOLEAN
- Added: New sample projects: RichOleDemo, Treeview, ToolbarRebar
- Changed: Updated the Spanish language file.
- Changed: Compiler Output window will close on successul compile if no warnings/errors and listview was previously active.
- Changed: Font quality now uses the SC_EFF_QUALITY_DEFAULT flag.
- Fixed: Newly created documents when saved now show in Recent Files list (if no project is active).
- Fixed: Situation where closed project resource file used in subsequent opened *.bas file.
- Fixed: FOS_FILEMUSTEXIST flag was missing in AfxIFileOpenDialogMultiple.

Paul Squires
PlanetSquires Software

Paul Squires

Added code to GitHub

- Added: German localization file (deutsch.lang) compliments of Tom Dehn. Thanks!
Paul Squires
PlanetSquires Software

Paul Squires

Added code to GitHub:

- Added: Drag/Drop document tabs for the open code editor windows (top tabcontrol). Inspired by Pierre Bellisle.

Doesn't handle situation where the tab control needs to be scrolled.
Paul Squires
PlanetSquires Software

José Roca

#3
If I load a template, it is loaded as Untitled.bas, without a number. If I load a second template, without saving the first Untitled.bas file, the second template isn't loaded, but the Explorer window displays two Untitled.bas files.

José Roca

A second RichOle project. This time loading the .rtf file from a resource file. Passing a pointer to an structure in the dwCookie parameter of the callback function, I have managed to avoid the use of globals.


' ========================================================================================
' RICHEDITCUSTOMDATA structure
' ========================================================================================
TYPE AFX_RICHEDIT_CUSTOMDATA
   pData  AS BYTE PTR
   nLen   AS LONG
   curPos AS LONG
END TYPE
' ========================================================================================

' ========================================================================================
' The EditStreamCallback function is an application defined callback function used with
' the EM_STREAMIN and EM_STREAMOUT messages. It is used to transfer a stream of data into
' or out of a rich edit control.
' ========================================================================================
PRIVATE FUNCTION RichEdit_LoadRtfFromResourceCallback ( _
   BYVAL pCustData AS AFX_RICHEDIT_CUSTOMDATA PTR _   ' // Value of the dwCookie member of the EDITSTREAM structure.
, BYVAL lpBuff AS BYTE PTR _                         ' // Pointer to a buffer to write to.
, BYVAL cb AS LONG _                                 ' // Number of bytes to write.
, BYVAL pcb AS LONG PTR _                            ' // Number of bytes actually written.
) AS DWORD                                           ' // 0 for success, or an error code

   DIM nBytes AS LONG
   IF pCustData->nLen - pCustData->curPos > cb THEN nBytes = cb ELSE nBytes = pCustData->nLen - pCustData->curPos
   IF nBytes THEN
      CopyMemory(lpBuff, pCustData->pData + pCustData->curPos, nBytes)
      pCustData->curPos = pCustData->curPos + nBytes
      FUNCTION = 0
   ELSE
      FUNCTION = 1
   END IF
   *pcb = nBytes

END FUNCTION
' ========================================================================================

' ========================================================================================
' Loads a RTF resource file into a Rich Edit control.
' The EM_STREAMIN message replaces the contents of a rich edit control with a stream of
' data provided by an application definedâ€"EditStreamCallback callback function.
' ========================================================================================
PRIVATE FUNCTION RichEdit_LoadRtfFromResourceW ( _
   BYVAL hRichEdit AS HWND _                ' // Handle of the Rich Edit control
, BYVAL hInstance AS HINSTANCE _           ' // Instance handle
, BYREF wszResourceName AS WSTRING _       ' // Name of the resource to load
) AS BOOLEAN                               ' // TRUE or FALSE

   DIM hResInfo AS HRSRC                        ' // Resource handle
   DIM pResData AS LPVOID                       ' // Pointer to the resource data
   DIM eds AS EDITSTREAM                        ' // EDITSTREAM structure
   DIM rtfCustData AS AFX_RICHEDIT_CUSTOMDATA   ' // AFX_RICHEDIT_CUSTOMDATA structure

   ' // Checks the validity of the parameters
   IF hRichEdit = NULL OR hInstance = NULL THEN EXIT FUNCTION
   IF LEN(wszResourceName) = 0 THEN EXIT FUNCTION

   ' // Loads the resource
   hResInfo = FindResourceW(hInstance, wszResourceName, RT_RCDATA)
   IF hResInfo = NULL THEN EXIT FUNCTION

   ' // Loads and locks the resource
   pResData = LockResource(LoadResource(hInstance, hResInfo))
   IF pResData = NULL THEN EXIT FUNCTION
   DIM cbSize AS LONG = SizeofResource(hInstance, hResInfo)
   DIM buffer AS STRING = SPACE(cbSize)
   CopyMemory(STRPTR(buffer), pResData, cbSize)

   ' // Sends the message
   rtfCustData.pData = STRPTR(buffer)
   rtfCustData.nLen = cbSize
   rtfCustData.curPos = 0
   eds.dwCookie = cast(DWORD_PTR, @rtfCustData)
   eds.dwError = 0
   eds.pfnCallback = cast(EDITSTREAMCALLBACK, @RichEdit_LoadRtfFromResourceCallback)
   IF SendMessageW(hRichEdit, EM_STREAMIN, SF_RTF, cast(LPARAM, @eds)) > 0 AND eds.dwError = 0 THEN
      FUNCTION = TRUE
   END IF

END FUNCTION
' ========================================================================================





Paul Squires

Quote from: Jose Roca on January 17, 2017, 08:11:52 PM
If I load a template, it is loaded as Untitled.bas, without a number. If I load a second template, without saving the first Untitled.bas file, the second template isn't loaded, but the Explorer window displays two Untitled.bas files.

Thanks Jose, I will look at this problem in the morning and get an update to the code posted as soon as possible.
Paul Squires
PlanetSquires Software

Paul Squires

Quote from: TechSupport on January 17, 2017, 10:23:51 PM
Quote from: Jose Roca on January 17, 2017, 08:11:52 PM
If I load a template, it is loaded as Untitled.bas, without a number. If I load a second template, without saving the first Untitled.bas file, the second template isn't loaded, but the Explorer window displays two Untitled.bas files.

Thanks Jose, I will look at this problem in the morning and get an update to the code posted as soon as possible.


You can now download the new EXE's with the fix. Disregard the new "Search" menu option for "Find In Files...". I only just started working on that and it is obviously not functional yet.
Paul Squires
PlanetSquires Software

José Roca

Thanks for fixing it.

The new "search" option has a problem with the position of the controls. The groupbox draws partially over the third combobox (at least at 192 DPI).

Paul Squires

Quote from: TechSupport on January 17, 2017, 10:42:02 PM
Disregard the new "Search" menu option for "Find In Files...". I only just started working on that and it is obviously not functional yet.

LOL, I literally only started working on that dialog hours before. It is not even close to being finished or functional. Not all of the controls are there or even positioned correctly  :)
Paul Squires
PlanetSquires Software

Paul Squires

Just to be safe, I re-uploaded the EXE's with the Find In Files menu option temporarily commented out so people don't get the impression that it is functional. It may not be fully functional until this weekend.
Paul Squires
PlanetSquires Software

Paul Squires

Lots of progress made with the Find In Files but still work to do. Hope to have it included in the EXE and uploaded soon.

Paul Squires
PlanetSquires Software

Paul Squires

Find In Files functionality uploaded to GitHub repository

Version 1.2.2 (Not released yet)
- Added: Find in Files
- Added: Localization translations for Russian and Ukrainian compliments of ur_naz.
- Fixed: Regression from v1.2.1 whereby cursor would not change to arrow during application start.
- Fixed: Loading Template did not increment the Untitled 1,2,3 .bas filename numbering.
Paul Squires
PlanetSquires Software

Paul Squires

Next up is to build upon the parser to get much more things like TYPE elements and determine what variables are DIM'ed to each TYPE in order to present a popup selection list of TYPE elements as the user is typing.

I am going to switch to using an In-Memory SQLITE database to handle all of the details of the parsed data. That will make things so much easier and also maintain the necessary speed.
Paul Squires
PlanetSquires Software

Paul Squires

hmmmm.... SQLite, I'd have to do a 32 bit and 64 bit DLL's.... I might think about this a bit more.
Paul Squires
PlanetSquires Software

Paul Squires

Built my own system using super fast hash based in-memory structures to handle the codetips, function declares, etc. Works very well so far with very little overhead.

I have moved the code parsing into a separate file (modParser.inc) to make it easier to build upon. I have updated GiThub with the latest code and EXE's.

This update shows how WinFBE now reads any #INCLUDE files found within your code. This allows you to have codetip popups for libraries like code from Jose's collections without having to actually add those source files to your project. Currently I have disabled the parsing of Windows include files for the sake of speed for now. I am building a disk file containing already parsed versions of the windows includes and will simply load them from disk rather than potentially parsing countless windows files on program startup.

WinFBE now also scans for #DEFINE UNICODE and will soon load the correct windows include codetips depending on whether your code or project wants ANSI or UNICODE versions of the function declares.

Not too far away is also parsing of TYPE structures so we can have popup selection lists to allow easier inserting of TYPE elements into your code.

Version 1.2.2 (Not released yet)
- Added: Find in Files functionality added.
- Added: #Include files are now parsed for Sub/Function declaration Codetips.
- Added: Localization translations for Russian and Ukrainian compliments of ur_naz.
- Changed: Refined autocomplete insertions for SUB/FUNCTION/PROPERTY/TYPE/UNION.
- Fixed: Regression from v1.2.1 whereby cursor would not change to arrow during application start.
- Fixed: Loading Template did not increment the Untitled 1,2,3 .bas filename numbering.
- Fixed: Autocomplete insertions (eg. IF/THEN, FOR/NEXT) now honours the keyword casing as defined by the user.
Paul Squires
PlanetSquires Software