PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]

Author Topic: A little fun WinFBE project :-)  (Read 10131 times)

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9389
  • Windows 10
    • PlanetSquires Software
Re: A little fun WinFBE project :-)
« Reply #15 on: November 10, 2016, 08:04:44 AM »

I am putting this modern version of the editor on hold. I am working on feature completing the original classic version of the editor. I will be adding the UTF-8 capability today and will update the GitHub repository later tonight.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9389
  • Windows 10
    • PlanetSquires Software
Re: A little fun WinFBE project :-)
« Reply #16 on: November 10, 2016, 01:59:42 PM »

I added the UTF-8 support by following Jose's suggestions in this thread. Once I upload the source/exe change tonight to GitHub I will ask for help in testing that the Unicode characters function correctly in the editor.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9389
  • Windows 10
    • PlanetSquires Software
Re: A little fun WinFBE project :-)
« Reply #17 on: November 10, 2016, 09:38:37 PM »

New WinFBE with UTF-8 unicode support added to GitHub repository.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Josť Roca

  • Guru Member
  • *****
  • Posts: 3326
Re: A little fun WinFBE project :-)
« Reply #18 on: November 11, 2016, 12:41:31 AM »

It works as expected and it is all you can do using Scintilla, that has not UTF-16 support.

However, keep in mind that, since Windows does not understand UTF-8, it is only a workaround. What will be needed is UTF-16 support in Scintilla, but I don't think that this will happen.

People wanting to use unicode through UTF-8 will need to always use a function like AfxUcode to convert from UTF-8 to UTF-16.
« Last Edit: November 11, 2016, 01:26:16 AM by Jose Roca »
Logged

Josť Roca

  • Guru Member
  • *****
  • Posts: 3326
Re: A little fun WinFBE project :-)
« Reply #19 on: November 11, 2016, 04:42:06 AM »

The code templates are outdated.

I will revise them to use CWSTR instead of WSTRING.
« Last Edit: November 11, 2016, 04:50:58 AM by Jose Roca »
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9389
  • Windows 10
    • PlanetSquires Software
Re: A little fun WinFBE project :-)
« Reply #20 on: November 11, 2016, 04:58:05 AM »

Awesome, thanks Jose for testing the UTF-8 functionality. I am working on some user interface changes this morning and hope to have it posted today. I will start a separate thread detailing changes once that is done.

(feels good to be back programming again)
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Josť Roca

  • Guru Member
  • *****
  • Posts: 3326
Re: A little fun WinFBE project :-)
« Reply #21 on: November 11, 2016, 04:09:28 PM »

Using the 64-bit version I have noticed two problems, but I can't repeat them at will, ie. sometimes happens and sometimes don't.

The first one is that sometimes the editor is unable to load the text of a template. Must be because you have changed my original code posted at http://www.planetsquires.com/protect/forum/index.php?topic=3867.msg28442#msg28442

You're using REDIM PRESERVE and this causes problems. With REDIM PRESERVE apparently the memory changes and some of the pointers stored in the listbox are no longer valid. This is why I first get the number of files to dimension the array.

Code: [Select]
   ' // Search templates
   DIM hSearch as HANDLE, WFD AS WIN32_FIND_DATAW, FileNo AS LONG, nType AS LONG, nItem AS LONG
   DIM wszPath AS WSTRING * MAX_PATH, wszCurPath AS WSTRING * MAX_PATH, wszText AS WSTRING * 260
   DIM wszFullPath AS WSTRING * MAX_PATH * 2, idx AS LONG, nLin AS LONG
   wszPath = ExePath & "\Templates\"
   wszCurPath = wszPath & "*.fbtpl"

   ' // Count the number of files and dimension the array
   ' // REDIM PRESERVE causes problems
   DIM nCount AS LONG
   hSearch = FindFirstFileW(wszCurPath, @WFD)
   IF hSearch <> INVALID_HANDLE_VALUE THEN
      DO
         IF (WFD.dwFileAttributes AND FILE_ATTRIBUTE_DIRECTORY) <> FILE_ATTRIBUTE_DIRECTORY THEN
            nCount +=1
         END IF
      LOOP WHILE FindNextFileW(hSearch, @WFD)
      FindClose(hSearch)
   END IF
   ' // Dimension the array
   IF nCount = 0 THEN EXIT FUNCTION
   DIM rgwszPaths(nCount - 1) AS WSTRING * MAX_PATH
   idx = 0

   ' // Find the files
   hSearch = FindFirstFileW(wszCurPath, @WFD)
   IF hSearch <> INVALID_HANDLE_VALUE THEN
      DO
         IF (WFD.dwFileAttributes AND FILE_ATTRIBUTE_DIRECTORY) <> FILE_ATTRIBUTE_DIRECTORY THEN
            wszFullPath = wszPath & WFD.cFileName
            ' // Get the description
            FileNo = FREEFILE
            OPEN wszFullPath FOR INPUT AS #FileNo
            IF ERR = 0 THEN
               nLin = 0
               DO UNTIL EOF(FileNo)
                  LINE INPUT #FileNo, wszText
                  nLin += 1
                  IF nLin = 1 THEN nType = VAL(wszText)
                  IF nType < 1 OR nType > 2 THEN EXIT DO
                  IF nType = 1 AND nLin = 3 THEN EXIT DO
                  IF nType = 2 AND nLin = 4 THEN EXIT DO
               LOOP
               CLOSE FileNo
               ' // Display the description in the listbox
               nItem = SendMessageW(hListBox, LB_ADDSTRING, 0, cast(LPARAM, @wszText))
               ' // Store the full path in the array
               rgwszPaths(idx) = wszFullPath
               ' // Store a pointer to the element of the array in the listbox item
               SendMessageW hListBox, LB_SETITEMDATA, nItem, cast(LPARAM, VARPTR(rgwszPaths(idx)))
               idx += 1
               IF idx > UBOUND(rgwszPaths) THEN EXIT DO
            END IF
         END IF
      LOOP WHILE FindNextFileW(hSearch, @WFD)
      FindClose(hSearch)
   END IF


The second one are random crashes when changing colors and clicking the OK button. The selection is saved, but the editor sometimes crashes.
« Last Edit: November 11, 2016, 04:14:16 PM by Jose Roca »
Logged

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9389
  • Windows 10
    • PlanetSquires Software
Re: A little fun WinFBE project :-)
« Reply #22 on: November 11, 2016, 04:25:31 PM »

Thanks Jose, I will revert the code back. I will also check the color selection crash problem. I have been testing using the 32-bit version but I will switch to the 64 bit version tonight.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 9389
  • Windows 10
    • PlanetSquires Software
Re: A little fun WinFBE project :-)
« Reply #23 on: November 11, 2016, 04:39:45 PM »

I have been making lots of changes to the user interface today so I can't upload new code until that is stable.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer
Pages: 1 [2]