IUP_FB_EDITOR (simple development environment)

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

Re: IUP_FB_EDITOR (simple development environment)

Post by VANYA »

Update:
bug fixed.
dwzgocl0
Posts: 4
Joined: Apr 05, 2022 10:21

Re: IUP_FB_EDITOR (simple development environment)

Post by dwzgocl0 »

Good editor. But I found one bug. Editor doesn't detect the source file encoding but force system default (Windows-1252) so the text is broken. User has to use ReOpen the file encoded to select the correct encoding for the text to display properly.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: IUP_FB_EDITOR (simple development environment)

Post by VANYA »

dwzgocl0 wrote: Apr 07, 2022 9:58 Good editor. But I found one bug. Editor doesn't detect the source file encoding but force system default (Windows-1252) so the text is broken. User has to use ReOpen the file encoded to select the correct encoding for the text to display properly.
This is not a bug!
The editor automatically detects only unicode encodings (UTF-16LE , UTF-16BE , UTF-32LE , UTF-32BE , UTF8 with BOM). For encodings, you can set the desired default encoding, in which the editor will open all files if they are compatible with the encoding you set. If the encoding you set is incompatible with the file being opened, the editor will try to open in a different encoding after you confirm in a popup dialog. If the default encoding is set to "Default System" then the editor will normally use the default encoding on your system.
Roland Chastain
Posts: 992
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: IUP_FB_EDITOR (simple development environment)

Post by Roland Chastain »

Hello Vanya.

Great project! Congratulations.

The GTK3 Linux version works fine here (and looks beautiful).

The GTK2 version crashes:

Code: Select all

[roland@localhost iup_fb_editor64_gtk2_linux]$ ./fbnp
./fbnp: /lib64/libtinfo.so.5: no version information available (required by ./fbnp)
./fbnp: Symbol `ospeed' has different size in shared object, consider re-linking

(fbnp:6988): Gtk-ERROR **: 10:47:02.339: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
Trappe pour point d'arrêt et de trace (core dumped)
I cannot compile the source:

Code: Select all

[roland@localhost source]$ fbc fbnp.bas
fbnp.c:1023:8: attention: types conflictuels pour la fonction interne « strspn », « long unsigned int(const char *, const char *) » attendu [-Wbuiltin-declaration-mismatch]
 1023 | uint64 strspn( uint8*, uint8* );
      |        ^~~~~~
fbnp.c:1:1: note: « strspn » est déclaré dans l'en-tête « <string.h> »
  +++ |+#include <string.h>
    1 | typedef   signed char       int8;
/usr/bin/../bin/ld : avertissement : /usr/bin/../lib/freebasic/linux-x86_64/fbextra.x contient des sections de sortie; avez-vous oublié -T?
/usr/bin/../bin/ld : ne peut trouver -lpangox-1.0
I tried to edit my iup.bi as explained in this discussion, but it doesn't seem to solve the problem.

Regards.

Roland

P.-S. I can solve the compilation error like this:

Code: Select all

[roland@localhost source]$ sudo ln -s /usr/lib64/libpango-1.0.so.0 ./libpangox-1.0.so
But after that I get the same GTK error:

Code: Select all

[roland@localhost source]$ ./fbnp

(fbnp:7870): Gtk-ERROR **: 10:57:54.980: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
Trappe pour point d'arrêt et de trace (core dumped)
But I can compile and execute without errors the IUP examples shipped with FB!
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: IUP_FB_EDITOR (simple development environment)

Post by VANYA »

Hi Roland!
The GTK2 and GTK3 versions of the IUP cause problems if mixed.

Tip from the IUP authors: https://sourceforge.net/projects/iup/fi ... Libraries/


Linux26g4_64: Ubuntu 10.04 (x64) / Kernel 2.6 / gcc 4.4 (GTK 2.20)
Linux32: Ubuntu 12.04 (x86) / Kernel 3.2 / gcc 4.6 (GTK 2.24)
Linux32_64: Ubuntu 12.04 (x64) / Kernel 3.2 / gcc 4.6 (GTK 2.24)
Linux35_64: Ubuntu 12.10 (x64) / Kernel 3.5 / gcc 4.7 (GTK 2.24)
Linux313_64: Ubuntu 14.04 (x64) / Kernel 3.13 / gcc 4.8 (GTK 3.10)
Linux319_64: Ubuntu 15.04 (x64) / Kernel 3.19 / gcc 4.9 (GTK 3.14)
Linux44_64: Ubuntu 16.04 (x64) / Kernel 4.4 / gcc 5.3 (GTK 3.18)
Linux415_64: Ubuntu 18.04 (x64) / Kernel 4.15 / gcc 7.3 (GTK 3.22)

RED - GTK2
BLUE - GTK3


For GTK2:
1) Use standard FB headers for IUP (for compilation)
2) Use IUP libraries for GTK2 (to run)
libgtk2.0-dev must be installed on the system

For GTK3:
1) Use edited headers (like here: http://freebasic.ucoz.com/forum/22-402- ... 1583128277 ) IUP for GTK3 (for compilation)
2) Use IUP libraries for GTK3 (to run)

You can compile and run both versions (GTK2 and GTK3) on your system, but the IUP libraries for GTK2 and GTK3 must be in different folders and specified when starting the editor. For example like this:
#!/bin/bash
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./iupgtk3so/
./fbnp
In this case, the IUP libraries for GTK3 are in the folder iupgtk3so:
.
..
./fbnp
/iupgtk3so
Roland Chastain
Posts: 992
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: IUP_FB_EDITOR (simple development environment)

Post by Roland Chastain »

Thank you Vanya.

I hadn't seen that there was a copy of IUP headers in IUP FB Editor source. :oops:

I appended this line in declarations.bi and now I can compile and run the editor.

Code: Select all

#define __USE_GTK3__
#include Once "IUP/iup.bi"
I have only one IUP binary installed. It depends on GTK3.

By the way, my IUP version is 3.30 (while the headers are for 3.15, I believe), but as far as I can see it doesn't seem to hurt.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: IUP_FB_EDITOR (simple development environment)

Post by VANYA »

update:
fix bugs
NorbyDroid
Posts: 70
Joined: May 21, 2016 22:55

Re: IUP_FB_EDITOR (simple development environment)

Post by NorbyDroid »

I downloaded and tried out this in Windows xp, and although it runs, it doesn’t compile nor does it run the program. I set path to fbc.exe

There is a message that says make do e, but nothing happens.

Windows xp 32 bit
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: IUP_FB_EDITOR (simple development environment)

Post by VANYA »

@NorbyDroid

Try installing the compiler in a folder whose path contains only Latin characters and does not contain spaces, for example:

C:\Compliler\fbc.exe

P.S. For Windows Xp it is better to use an old version of the IUP library (eg 3.22 or 3.23). That is files iup.dll , iup_scintilla.dll should be from package 3.22 or 3.23. Newer versions of the IUP are designed for newer systems and may cause problems. I have not fully tested the editor on Windows XP, so this system is not officially supported.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: IUP_FB_EDITOR (simple development environment)

Post by VANYA »

Update:

Added plugins from SARG (reload file , button F6)
Fixed minor bugs
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: IUP_FB_EDITOR (simple development environment)

Post by VANYA »

Update:

1) Added an update event when the code is collapsed (works correctly only with the vb lexer; the fb lexer still requires editing and recompiling IUP_SCINTILLA)
2) Fixed an error when loading a file (when it is on the disk, but access to it is closed for various reasons)
3) Added highlight theme by Quiet Snow (thank you!)
4) Under Linux, I updated the utilities for viewing help in the archives (I somehow forgot about them completely and there were ancient versions)
5) Added some checks after ALLOCATE | CALLOCATE | NEW
Roland Chastain
Posts: 992
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: IUP_FB_EDITOR (simple development environment)

Post by Roland Chastain »

Hello VANYA!

Thanks for the update.

I don't know why, I had to put

Code: Select all

#define __USE_GTK3__
directly in iup.bi, like this:

Code: Select all

#inclib "iup"
#define __USE_GTK3__
#ifdef __fb_win32__
Otherwise I couldn't compile the program.
Roland Chastain
Posts: 992
Joined: Nov 24, 2011 19:49
Location: France
Contact:

Re: IUP_FB_EDITOR (simple development environment)

Post by Roland Chastain »

Another thing. This afternoon I played with the Windows version. I wonder if the relative path for the compiler is really supported: I didn't manage to make it work. Maybe I made a mistake in the path. But I have not seen any error message.

If it was my program, I would add a log file, so one could easily see when something went wrong. My two cents. :wink:

I used this script (on Linux) to create a desktop launcher. I put it here in case you would wish to use it:

Code: Select all

## Create desktop launcher

## Script directory
D1="$(dirname "$(readlink -f "$0")")"

## Destination directories
D2="$HOME/Desktop"
D3="/usr/share/applications"

if [ -d $D2 ] ;
then
  FILE=$D2/fbnp.desktop
  echo "Creating desktop launcher $FILE"
  cat > $FILE << EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=IUP FB Editor
Comment=IUP Editor for FreeBASIC
Exec=$D1/fbnp %F
Icon=$D1/media/res.ico
Path=$D1
Terminal=false
StartupNotify=true
Categories=Development;IDE;
EOF
  echo "Make launcher executable"
  sudo chmod -R 777 $FILE
  if [ -d $D3 ] ;
  then
    FILE2=$D3/fbnp.desktop
    echo "Copy $FILE to $FILE2"
    sudo cp -f $FILE $FILE2
  else
    echo "Cannot find directory $D3"
  fi
  echo "Done"
else
  echo "Cannot find directory $D2"
fi
By the way, what means fbnp?
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: IUP_FB_EDITOR (simple development environment)

Post by VANYA »

Hi Roland!
Another thing. This afternoon I played with the Windows version. I wonder if the relative path for the compiler is really supported: I didn't manage to make it work. Maybe I made a mistake in the path. But I have not seen any error message.
Relative paths are only supported if $A is in the path.
A$ - this is the path to the fbnp.exe. That is, it is set like this:

$A\Compiler\fbc.exe

In all other cases, the path must be global.
By the way, what means fbnp?
f b n p
freebasic notepad

Initially, the editor was conceived to be as simple as Notepad with small additions (highlighting, compiling, and that's it). But then it developed to what it is now.
If it was my program, I would add a log file, so one could easily see when something went wrong. My two cents.
In the output window when compiling, the path to the compiler (which is passed) is displayed and it is immediately clear if it is incomplete.

P.S. thanks for the script, but I usually write labels with my hands
jepalza
Posts: 149
Joined: Feb 24, 2010 10:08
Location: Spain (Bilbao)

Re: IUP_FB_EDITOR (simple development environment)

Post by jepalza »

Hey Vanya!!

Maybe you want to put this code in your "sources": (sorry for comments in spanish)

Code: Select all


' jepalza , necesarios para la busqueda (no estan en este include del IUP)
#Define SCI_SETINDICATORCURRENT 2500
#Define SCI_GETINDICATORCURRENT 2501
#Define SCI_SETINDICATORVALUE 2502
#Define SCI_GETINDICATORVALUE 2503
#Define SCI_INDICATORFILLRANGE 2504
#Define SCI_INDICATORCLEARRANGE 2505

#define SCI_INDICSETSTYLE 2080
#define SCI_INDICSETFORE 2082
#define SCI_INDICSETUNDER 2510
#define SCI_INDICSETALPHA 2523

#define INDIC_PLAIN 0
#define INDIC_SQUIGGLE 1
#define INDIC_TT 2
#define INDIC_DIAGONAL 3
#define INDIC_STRIKE 4
#define INDIC_HIDDEN 5
#define INDIC_BOX 6
#define INDIC_ROUNDBOX 7
#Define INDIC_CONTAINER 8

'jepalza: marcado de palabras coincidentes
Sub marcado_de_palabras_iguales(mt as iHandle Ptr, actualLine As Integer )
   Dim As Integer CurrentIndicator=8 ' cualquiera entre 1 y 31
   
   ' caracteres en el fichero (total de bytes que ocupan)
   dim as Long iLenDoc = IupGetInt(mt, "COUNT")
   
   ' borra los anteriores marcadores nada mas entrar
   IupScintillaSendMessage( mt , SCI_SETINDICATORCURRENT , CurrentIndicator , 0) ' indicador 8
   IupScintillaSendMessage( mt , SCI_INDICATORCLEARRANGE , 0 , Cast(ZString ptr,iLenDoc) ) ' total de caracteres del fichero

   Dim As Long idTabs = Val(*IupGetAttribute(TGlobalVariables->tabs, "VALUEPOS"))
   
   ' coge el texto seleccionado 
   Dim As string sSelectionText = *IupGetAttribute(TGlobalVariables->tTabsOptions(idTabs).multitext, "SELECTEDTEXT")
   If sSelectionText="" Then Exit Sub ' en caso de no haber selccionado nada, sale
   Dim As Integer iLenFind=Len(sSelectionText) ' longitud del texto (se puede con scintilla, pero vale asi)

   ' coge el inicio y final del texto seleccionado
   Dim As Integer cpMin=CInt(IupScintillaSendMessage( mt , SCI_GETSELECTIONSTART , 0 , 0))
   Dim As Integer cpMax=CInt(IupScintillaSendMessage( mt , SCI_GETSELECTIONEND , 0 , 0))
   'Dim As Integer iLenFind=cpMax-cpMin ' longitud del texto
   
	Dim As integer selectedStyle = CInt(IupScintillaSendMessage( mt , SCI_GETSTYLEAT , cpMin , 0)) ' coge el estilo del texto seleccionado

   Dim As Integer style = -1
	Dim As Integer offset = 0

	'IupScintillaSendMessage( mt , SCI_SETSEARCHFLAGS , SCFIND_WHOLEWORD , 0)  '&h00100002 
	IupScintillaSendMessage( mt , SCI_SETTARGETSTART, offset,0)
	IupScintillaSendMessage( mt , SCI_SETTARGETEND, iLenDoc,0)
	Dim As integer indexOf = Cint(IupScintillaSendMessage( mt , SCI_SEARCHINTARGET , iLenFind , StrPtr(sSelectionText) )) 
		
	While (indexOf <> -1) 	
		style = CInt(IupScintillaSendMessage( mt , SCI_GETSTYLEAT, indexOf,0))
			If (selectedStyle = style) Then ' hay coincidencia
				IupScintillaSendMessage( mt , SCI_SETINDICATORCURRENT, CurrentIndicator,Cast(ZString ptr,0) ) ' INDICADOR 8 (PUEDE SER 1)
				IupScintillaSendMessage( mt , SCI_INDICSETALPHA, CurrentIndicator, Cast(ZString ptr,&H40) ) ' TRANSPARENCIA
				IupScintillaSendMessage( mt , SCI_INDICSETSTYLE, CurrentIndicator, Cast(ZString ptr,INDIC_CONTAINER) ) ' TIPO 8=CAJA
				IupScintillaSendMessage( mt , SCI_INDICSETFORE, CurrentIndicator, Cast(ZString ptr,&H00FFFF) ) ' AMARILLO
				IupScintillaSendMessage( mt , SCI_INDICATORFILLRANGE, IndexOf, Cast(ZString ptr,iLenFind) ) ' INICIO + LONG. DEL TEXTO
			End If
		offset = indexOf + iLenFind ' busca el siguiente
		IupScintillaSendMessage( mt , SCI_SETTARGETSTART, offset,0)
		IupScintillaSendMessage( mt , SCI_SETTARGETEND, iLenDoc,0)
		indexOf = Cint(IupScintillaSendMessage( mt , SCI_SEARCHINTARGET , iLenFind , StrPtr(sSelectionText) )) 
	Wend

End Sub
It is to mark the selected text (highlighting) that matches in the whole document. Or when double-clicking on a word or text. It lights up on all matches found.
It has some bugs, for example, it can also mark spaces, and it looks "ugly", but with a little help, maybe we can improve it together. :wink:
Post Reply