• Welcome to PlanetSquires Forums.
 

WinFBE new code on GitHub

Started by Paul Squires, June 26, 2016, 09:23:59 PM

Previous topic - Next topic

Paul Squires

I am finding using Git with their Windows client is so incredibly easy. I have committed new files to the repository.

https://github.com/PaulSquires/WinFBE

You will find a green button on that page called "Clone or download". Click that button and you will see an option to download the source in a zip file.

The latest code adds support for Localization. I have included the default "english.lang". To create a localization file for a particular language you simply need to copy the "english.lang" file to a new file, say, "french.lang" or "german.lang" and then go through the file changing the english text to the new language. Finally, in "Environment Options" select the new localization file and restart the editor.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

I anticipate that I may have to increase the size of buttons and labels in order to handle the maximum size of some languages. I find that French is more verbose than English so controls will have to be a bit bigger.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

All Latin languages are more verbose than English.

And German, with its very long compound nouns...

Mark Twain said the following about the length of German words:

“Some German words are so long that they have a perspective.”

José Roca

I have done a Spanish translation. Will have to check how it looks visually and to choose and adequate place for the keyboard shortcuts (&).

Paul Squires

Wow, thanks Jose, that will be the first translation and should serve as a good test of this new localization stuff.

Cool  :)
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

This is the translated file. It will need to be tweaked to make sure there are not two & symbols with the same letter in the menu.

Paul Squires

Thanks Jose, now I can use your translated file to help make the controls a little larger. I think that I may have to fix the keyword casing combobox as well because I was testing for the selected English word rather than the combo index.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

#7
Next time you upload the code, remove AfxBstr, AfxStr, CImageCtx amd CUIlayout include files. These are simple tests. CImageCtx has not yeen be tested and CUILayout does not work as I like and was replaced by CLayout.

Some templates will also be changed to use the wrappers of AfxCtl.inc.

José Roca

In the colors and fonts options there is an important feature missing, the charset. Setting the charset allows the user to write in its own language.

The supported charsets are:


' ========================================================================================
' Set the charsets
' ========================================================================================
FUNCTION FBSED_CharsetID (BYVAL strCharsetName AS STRING) AS LONG

   SELECT CASE strCharsetName
      CASE "Default"       : FUNCTION = %SC_CHARSET_DEFAULT
      CASE "Ansi"          : FUNCTION = %SC_CHARSET_ANSI
      CASE "Arabic"        : FUNCTION = %SC_CHARSET_ARABIC
      CASE "Baltic"        : FUNCTION = %SC_CHARSET_BALTIC
      CASE "Chinese Big 5" : FUNCTION = %SC_CHARSET_CHINESEBIG5
      CASE "East Europe"   : FUNCTION = %SC_CHARSET_EASTEUROPE
      CASE "GB 2312"       : FUNCTION = %SC_CHARSET_GB2312
      CASE "Greek"         : FUNCTION = %SC_CHARSET_GREEK
      CASE "Hangul"        : FUNCTION = %SC_CHARSET_HANGUL
      CASE "Hebrew"        : FUNCTION = %SC_CHARSET_HEBREW
      CASE "Johab"         : FUNCTION = %SC_CHARSET_JOHAB
      CASE "Mac"           : FUNCTION = %SC_CHARSET_MAC
      CASE "OEM"           : FUNCTION = %SC_CHARSET_OEM
      CASE "Russian"       : FUNCTION = %SC_CHARSET_RUSSIAN
      CASE "Shiftjis"      : FUNCTION = %SC_CHARSET_SHIFTJIS
      CASE "Symbol"        : FUNCTION = %SC_CHARSET_SYMBOL
      CASE "Thai"          : FUNCTION = %SC_CHARSET_THAI
      CASE "Turkish"       : FUNCTION = %SC_CHARSET_TURKISH
      CASE "Vietnamese"    : FUNCTION = %SC_CHARSET_VIETNAMESE
   END SELECT

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


and you set it sending the SCI_STYLESETCHARACTERSET message and STYLE_DEFAULT.

Paul Squires

Thanks Jose, I have deleted those files. I have also updated new code to increase the size of dialogs and controls to help accommodate longer phrases in languages other than English. It is still not perfect but I don't want to make the controls overly large.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Paul Squires

Ah, yes, I will add the charset stuff tonight, thanks!
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

The latest version GPF's when I compile an run it.

Also, you don't need to call AfxSetProcessDPIAware if you're using a manifest that already has <dpiAware>true</dpiAware>. I use it in the examples for testing purposes because many of them don't use a manifest.

José Roca

In frmMain_Show you're using now your own message pump, but I', not seeing

ShowWindow pWindow->hWindow, nCmdShow
UpdateWindow pWindow->hWindow

before entering the message loop.

Paul Squires

Quote from: Jose Roca on June 27, 2016, 07:24:17 PM
In frmMain_Show you're using now your own message pump, but I', not seeing

ShowWindow pWindow->hWindow, nCmdShow
UpdateWindow pWindow->hWindow

before entering the message loop.


I didn't use ShowWindow because I was setting the visibility using the call to:
    SetWindowPlacement(pWindow->hWindow, @WinPla)

I will remove the AfxSetProcessDPIAware  call.

I am just about to upload new code that has the font character set code.

I know where that gpf is. You will need to delete your ini file when you use the new code. There was also a potential gpf on program end due to me using "Delete" on the document array elements.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

José Roca

In clsConfig.LoadFromFile you are passing default.lang as the name of the language file, but default.lang does not exist.

Then you are calling LoadLocalizationFile( Exepath & "\" & this.LocalizationFile ) and returning FUNCTION = 0, when it should be:

FUNCTION = LoadLocalizationFile( Exepath & "\" & this.LocalizationFile )

and in WinMain you should check the success or failure of loading the localization file.

' Load configuration file
IF gConfig.LoadFromFile() = FALSE THEN RETURN FALSE

It is GPFing because loading the localization file is failing and then the program is trying to access a non dimensioned array.