wxFBE, editor for both Windows and Linux

User projects written in or related to FreeBASIC.
VANYA
Posts: 1324
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: wxFBE, editor for both Windows and Linux

Postby VANYA » Aug 29, 2012 14:31

MOD wrote:Try this code in a path with russian symbols:

Code: Select all

Print ExePath
Print WStr(ExePath)
Sleep


The first line will probably fail, but if the second line also fails to give you russians signs, then that's the problem.


Russian characters in the console displays only the OEM866 and Unicode. Therefore, the command displays the Print scribble (this is normal!)

However, if you use a normal messagebox the path in both cases returned correctly:

Code: Select all

#Include "windows.bi"

MessageBox(0, ExePath,"",0)
MessageBox(0, WStr(ExePath),"",0)


Image

Maybe all the same for Windows (for encoding to Unicode) to use MultiByteToWideChar and WideCharToMultiByte ???:

Code: Select all

#Include once "windows.bi"

Function ASCIITOUTF(ByVal text As String) As WString Ptr export
  Var blen = (Len(text)*2)+2
  Dim As WString Ptr wbuf
  wbuf  = Allocate( blen )
  MultiByteToWideChar(CP_ACP, 0,text , -1, wbuf, blen)
  Return  wbuf
End Function

Function UTFTOASCII(ByVal text As WString Ptr) As String Export
  Var    blen = WideCharToMultiByte (CP_ACP  , 0,text , -1, 0, 0,0,0)
  Dim As ZString ptr wbuf
  Dim As String returnS
  wbuf= allocate( blen )
  WideCharToMultiByte (CP_ACP  , 0,text , -1, Cast( LPSTR ,wbuf), blen,0,0)
  returnS=*wbuf
  DeAllocate(wbuf)
  Return returnS
End Function
MOD
Posts: 555
Joined: Jun 11, 2009 20:15

Re: wxFBE, editor for both Windows and Linux

Postby MOD » Aug 29, 2012 14:45

So your codepage doesn't fit your language.

For this project every 'Include "windows.bi"' and similar is tabu.
VANYA
Posts: 1324
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: wxFBE, editor for both Windows and Linux

Postby VANYA » Aug 29, 2012 15:05

MOD wrote:So your codepage doesn't fit your language.

For this project every 'Include "windows.bi"' and similar is tabu.


That is me and the other Russian speakers there is no hope to use your normal editor?

Or have I misunderstood your last post?
MOD
Posts: 555
Joined: Jun 11, 2009 20:15

Re: wxFBE, editor for both Windows and Linux

Postby MOD » Aug 29, 2012 16:07

It's not just you and russian speakers but also japanese etc.
I will see, what can be done here but it's not easy because I can't test it here. For now I can just suggest to use only file names and paths without non-ASCII symbols.
Coolman
Posts: 211
Joined: Nov 05, 2010 15:09

Re: wxFBE, editor for both Windows and Linux

Postby Coolman » Aug 29, 2012 17:15

Excellent project. good luck.
Jonge
Posts: 129
Joined: Jul 17, 2012 17:51
Location: Norway
Contact:

Re: wxFBE, editor for both Windows and Linux

Postby Jonge » Sep 14, 2012 16:19

Great project. Looks good, clean and simple. I'll start using it when you add project support =) I hope this can turn into the "Official" FreeBasic IDE sometime.

Small bug:
- "If Then" should auto complete to "End If" not "EndIf" (Imo)
- in a line with "End If" only "End" will be colored as a keyword

Edit:
Suggestion:
- Maybe the "close current" file icon could be located on the open file tabs? Like on tabs in FireFox.
dafhi
Posts: 1276
Joined: Jun 04, 2005 9:51

Re: wxFBE, editor for both Windows and Linux

Postby dafhi » Sep 14, 2012 20:40

if I open a file and hit ctrl-z the window contents are erased
dafhi
Posts: 1276
Joined: Jun 04, 2005 9:51

Re: wxFBE, editor for both Windows and Linux

Postby dafhi » Sep 14, 2012 20:45

A color scheme I whipped up

Code: Select all

  <commentColour>0,128,0</commentColour>
  <numberColour>128,128,128</numberColour>
  <keyword1Colour>128,0,128</keyword1Colour>
  <keyword2Colour>64,0,64</keyword2Colour>
  <keyword3Colour>255,0,0</keyword3Colour>
  <keyword4Colour>0,128,255</keyword4Colour>
  <stringColour>255,0,0</stringColour>
  <preprocessorColour>64,128,128</preprocessorColour>
  <operatorColour>255,0,0</operatorColour>
  <backgroundColour>209,209,163</backgroundColour>
MOD
Posts: 555
Joined: Jun 11, 2009 20:15

Re: wxFBE, editor for both Windows and Linux

Postby MOD » Sep 14, 2012 21:06

- "If Then" should auto complete to "End If" not "EndIf" (Imo)

Open the wxFBE.xml and set <closeIf>0</closeIf> to 1 (secret setting for what you want it to be).

- in a line with "End If" only "End" will be colored as a keyword

A keyword is just highlighted, when another character like as space or a new line follows (as in FBIDE). This seems to be normal for wxScintilla.

- Maybe the "close current" file icon could be located on the open file tabs? Like on tabs in FireFox.

I looked for this one but sadly wx-c doesn't support this.

if I open a file and hit ctrl-z the window contents are erased

Will be fixed in next update.

A color scheme I whipped up

Nice. I guess, that some day it will be possible to load themes directly.


I hope this can turn into the "Official" FreeBasic IDE sometime.

I don't think FB needs an official IDE. For now I like to use FBEdit, others like to use FBIDE. On linux it's somewhat harder. I just want to make a nice little editor for windows and linux user, so they can switch easily between their systems and use FB on both in the same way.

Thanks for the feedback! :)
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Re: wxFBE, editor for both Windows and Linux

Postby Merick » Sep 16, 2012 23:35

For the open file hotkey - "ctrl-o", can you make it like in fbedit so that if the cursor is over an #include statement it automatically opens the file named in the statement?
MOD
Posts: 555
Joined: Jun 11, 2009 20:15

Re: wxFBE, editor for both Windows and Linux

Postby MOD » Sep 17, 2012 18:36

This was already on my todo list. :)
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Re: wxFBE, editor for both Windows and Linux

Postby AGS » Sep 20, 2012 22:51

I noticed that regular expression search/replace does not work (yet). It's a good thing to have, regex find/replace (I use it all the time).

I checked the wxwidgets site and apparently there is support for regular expressions in the wxregex class (both search/match and replacing). But it's not part of wx-c (no wrapper). And I could not find the regular expression part of the styled text control either. Interesting... nil desperandum. pcre to the rescue (supports both utf8 and utf16)! Integrating pcre with wx-c is doable (assuming styled text control is used otherwise things get harder).

I am wondering how you are going about creating some sort of sidebar where all the program symbols can be displayed (and what you have planned in terms of code completion).

I've noticed that editors depending upon ctags for the creation of symbolic info are easily fooled by preprocessor stuff. I'm not sure if it can be done but it would be very nice if the fb parser could extract symbolic info from the code for you (ctags does a lousy job on parsing/scanning freebasic code).

If the fbc front end could be used to get info on symbols used it would solve that kind of problem (getting symbolic information from source code) not only for you but for others as well. Now you've got to come up with something yourself (which will not be easy) while there is a perfectly good parser that should be able to get symbolic info for you (the fbc front end creates a symbol table so the info is there).

Looking forward to whatever you are going to add to the current version. And could you post the source code of wxFBE? I want to see what the code looks like, mess around with it myself a bit. Perhaps try to add regular expression stuff
(it looks like an interesting challenge to try and get pcre to play nice with wxwidgets).

edit: changed the text on regular expressions after finding out that there is no regex support in wx-c.
MOD
Posts: 555
Joined: Jun 11, 2009 20:15

Re: wxFBE, editor for both Windows and Linux

Postby MOD » Sep 21, 2012 19:10

My fault! The checkboxes exist already and the options are working but in code I did a 'If 0 Then' instead of the actual code. I fixed it and uploaded a new package (download at FreeBASIC-Portal, see first post). wxRegEx is not part of wx-c but the search engine can use some RegExp (that's why there's a checkbox for it and no need for pcre). Here a link for what works with it: RegExp in wxFBE.

No progress on the file browser so far, I have to wait for nemored to clarify some things.
At the moment it is not possible to use FreeBASICs parser for this, maybe somewhen in future (AFAIR dkl want to have a parser-as-a-lib too, but I wouldn't wait for it, as many other things at the compiler have to be done first).
I want a simple parser to get declared symbols with Dim and Declare and some special things like 'For i As Integer' and #Defines/#Macros. But it will be a really simple parser so it will also be easily fooled by macros.

wxFBE is, as Visual WX-C Designer, LGPL. You can download the current code base at the project page at FreeBASIC-Portal (see first post, to download click button "Exportieren" at the end of the page). The code is a mess, mostly messed up with adding tabbing, but have fun with it. ;)

You can also send me patches, if you come up with some nice new feature. :)
VANYA
Posts: 1324
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: wxFBE, editor for both Windows and Linux

Postby VANYA » Sep 22, 2012 5:28

Hi MOD!

I looked at the source code wxFBE. To the editor correctly (for the Russian, Japanese and other users) loads the images, icons in the toolbar, you can use the following code (for windows):

Code: Select all

#If Defined(__FB_WIN32__)
#Include "windows.bi"
#EndIf
Function fbstring_to_wxStringUTF16( ByVal fbstr As String ) As wxString Ptr
   Dim As wxString Ptr ret
   #If Defined(__FB_WIN32__)
      If fbstr<>"" Then
         Dim As Integer bLen = (Len(fbstr)*2)+2
         Dim As WString Ptr wbuf
         wbuf  = Allocate( blen )
         MultiByteToWideChar(CP_ACP, 0,fbstr , -1, wbuf, blen)
         ret = wxString_ctorUTF16( wbuf )
         DeAllocate wbuf
      EndIf
   #ElseIf Defined(__FB_LINUX__)
   ret = wxString_ctorUTF8( fbstr )
   #EndIf
   Return ret
End Function


But I could not do certain BAS file downloads to the editor, the function-wrapper wxString_CharAtUTF16 (in the wxString_to_fbstring) returns the invalid characters.
MOD
Posts: 555
Joined: Jun 11, 2009 20:15

Re: wxFBE, editor for both Windows and Linux

Postby MOD » Sep 22, 2012 14:14

Would you test it on a russian linux version?

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest