Cross platform GUI project (debugger for FreeBASIC)

User contributed sources that have become inactive, deprecated, or generally unusable. But ... we don't really want to throw them away either.
Post Reply
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by TJF »

SARG wrote:High time to go to sleep...
Thanks for taking the time to answer!
SARG wrote:... in this format, less work for me.... I'll prepare it in a format more usable.
Save the trouble, it's not necessary (for me).
SARG wrote:I was asking if it's possible to put only one frame surrounding all the buttons. Just a detail.
Yes, it is. Some GtkThemes do have such a (visible) frame, others don't. When we put a frame widget around the toolbar, this may interfere with some GtkThemes.

Add just necessary widgets, says the philosopher.
SARG wrote:I could by default create/open a file with a name based on the exe name : test.exe --> test_dbg_log.txt changeable by the user.
What about a second icon in the entry (left side) that creates the default name on demand?
SARG wrote:You teach me a new word (mock-up)
Here're the missing characters: 'kkkkkkkkkkkkkkkkkkkkkkkkkkkkkk'
SARG wrote:Bookmarks allow to easily jump to any lines (like in a book).
My question was : do you think it's an usefull feature ?
I realy seldom use bookmarks. It's hard for me to find meaningful names and to remember them. Instead I'm much faster learning numbers. I'd prefer to name people by phone number.

Sure, that's neither typic not helpful here.
SARG wrote:This part "was" the memory dump but as it's moved in a tab you could remove it.
Done!

Today I made mostly code behind the surface and the shortcut dialog (show and edit)

Image
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by SARG »

Hi,
SARG wrote:I extract the code and add comment. I hope you'll find all you need. If not I'm still there. See point just below.
TJF wrote:Thank you. I tried to prepare the callbacks naming based on this list, but failed. Again, it takes me too much time to understand the context.
SARG wrote:Sure it was not nice to give you this information in this format, less work for me.... I'll prepare it in a format more usable.
I have sorted the list by buttons (left to right) and by menus. And for each menu sorted in the order top to bottom. But I'm almost sure that is not very usable....Anyway I'll can use it later.

Questions :
- Can you use the strikethrough "bug" image (fbdebugger .ico) for the exe ?
- How are handled the keypresses (out of menu) ? i.e. Some actions like "step" can be done also by pressing a key.
- Some windows/dialogs could be modal (settings) and other ones non-modal (memory parameters). Possible ?
- I didn't give you all the simple dialog boxes (messages or questions yes/no). Could they be created on fly without be defined before ? Even if they contains several lines of text.

Code: Select all

===============================
' Buttons (left to right)
===============================
Case IDBUTSTEP 'STEP
	stopcode=0
	bcktrk_close
	SetFocus(windmain) 'just to lose focus
	thread_rsm()
Case IDCONTHR 'run to cursor
   SetFocus(windmain)
   brk_set(9)
Case IDBUTSTEPP 'STEP+ over
	procin=procsk
	runtype=RTRUN
	but_enable()
	bcktrk_close
	SetFocus(windmain)
	thread_rsm()
Case IDBUTSTEPT 'STEP at top of proc 09/03/2013
	If rline(thread(threadcur).sv).ad<>proc(procsv).fn Then 'if current line is end of proc simple step   26/02/2013
	     proctop=TRUE
	     runtype=RTRUN
	     but_enable()
	EndIf
	bcktrk_close
	SetFocus(windmain)
	thread_rsm()
Case IDBUTSTEPB 'STEP at bottom of proc 27/02/2013
	If rline(thread(threadcur).sv).ad<>proc(procsv).fn Then 'if current line is end of proc simple step   26/02/2013
	  procbot=procsv
	  runtype=RTRUN
	  but_enable()
	EndIf
	bcktrk_close
	SetFocus(windmain)
	thread_rsm()
Case IDBUTSTEPM 'STEP- out
   If proc_find(thread(threadcur).id,KLAST)<>proc_find(thread(threadcur).id,KFIRST) Then 'impossible to go out first proc of thread
       procad=procsv
       runtype=RTRUN
       but_enable()
   End If
   bcktrk_close
   SetFocus(windmain)
   thread_rsm()
Case IDBUTAUTO,IDTHRDAUT 'simple and multi thread auto
   threadaut=0
    If LoWord(wparam)=IDTHRDAUT Then
            For i As Integer =0 To threadnb
                If thread(i).exc Then threadaut+=1
            Next
            If threadaut<2 Then fb_message("Automatic execution","Not enough selected thread so normal auto")
        EndIf
   runtype=RTAUTO
   but_enable()
   bcktrk_close
   SetFocus(windmain)
   thread_rsm()
Case IDBUTRUN 'run debuggee
   runtype=RTRUN
   but_enable()
   bcktrk_close
   SetFocus(windmain)
   fasttimer=Timer
   thread_rsm()
Case IDBUTSTOP 'halt running
   If runtype=RTFREE Or runtype=RTFRUN Then
       runtype=RTFRUN 'to treat free as fast
       For i As Integer = 1 To linenb 'restore old instructions
               WriteProcessMemory(dbghand,Cast(LPVOID,rline(i).ad),@breakcpu,1,0)
           Next
   Else
       runtype=RTSTEP:procad=0:procin=0:proctop=FALSE:procbot=0
   EndIf
   Stopcode=CSHALTBU
   SetFocus(dbgrichedit)
Case IDBUTMINI 'mini windows
   If dsptyp>99 Then 'set full screen
       dsptyp-=100
      DeleteObject(Cast(HGDIOBJ,hbrsh))
      fb_ModStyle (windmain,WS_MAXIMIZEBOX Or WS_MINIMIZEBOX Or WS_SIZEBOX Or WS_CAPTION Or WS_SYSMENU, 0,FALSE)
      SetWindowPos(windmain,HWND_NOTOPMOST,recsav.left,recsav.top,recsav.right-recsav.left,recsav.bottom-recsav.top,SWP_NOACTIVATE)' OR SWP_NOSIZE OR SWP_NOMOVE
   Else 'set mini screen
       dsptyp+=100
       GetWindowRect(windmain,@recsav)
      fb_ModStyle (windmain,0,WS_MAXIMIZEBOX Or WS_MINIMIZEBOX Or WS_SIZEBOX Or WS_CAPTION Or WS_SYSMENU, FALSE)
      hbrsh=createsolidbrush(&h0000FF) 'red background
      SetClassLong(windmain,GCL_HBRBACKGROUND,Cast(Long,hbrsh))
      SetWindowPos(windmain,HWND_TOPMOST,50,50,456,45,SWP_NOACTIVATE ) ' OR SWP_NOSIZE OR SWP_NOMOVE
   End If
   SetFocus(windmain)
Case IDFASTRUN 'fast run
    bcktrk_close
    but_enable()
    SetFocus(windmain)
    fastrun()
Case IDEXEMOD 'modify execution from cursor
    exe_mod()
Case IDBUTFREE 'release debuggee
    If fb_message("FREE","Release debugged prgm",MB_YESNO Or MB_ICONQUESTION)=IDYES Then
        For i As Integer = 1 To linenb 'restore old instructions
            WriteProcessMemory(dbghand,Cast(LPVOID,rline(i).ad),@rLine(i).sv,1,0)
        Next
        runtype=RTFREE
        but_enable()
        thread_rsm()
    End If
Case IDBUTKILL  'kill process
   kill_process("Terminate immediatly no saved data, other option Release")
Case IDBUTRRUNE  'restart exe
    Dim As Double dtempo=FileDateTime(exename)'21/07/2013
    If exedate<>0 AndAlso exedate=dtempo Then
        flagrestart=sourcenb
    EndIf
    If wtchcpt Then flagwtch=1 
   treat_file(exename)
Case IDLSTEXE 'last 10 EXE(s)   
   GetCursorPos(@pnt)
   Dim exelist As HMENU
   exelist = CreatepopupMenu()
   For i As Byte =0 To 9
    If savexe(i)<>"" Then AppendMenu(exelist, MF_STRING,1200+i,savexe(i)):If i=0 Then AppendMenu(exelist, MF_SEPARATOR, 0, "")
   Next
   TrackPopupMenuEx(exelist, TPM_LEFTALIGN Or TPM_RIGHTBUTTON, pnt.x, pnt.y, hWnd,ByVal NULL)
   destroymenu(exelist)
   PostMessage(windmain, WM_NULL, 0, 0)
Case 1200 To 1209  'popup menu showing all the 10 last debugged exes 
    exename=savexe(LoWord(wparam)-1200)
    treat_file(exename)
Case IDBUTATTCH  'attach running process
    If prun AndAlso kill_process("Trying to attach but debuggee still running")=FALSE Then
            'nothing to do but better algo
    Else
        GetCursorPos(@pnt)
        fb_MDialog(@attach_box,"Attachment to a running process",windmain,pnt.x-300,pnt.y,100,150)
    End If
Case IDBUTFILE 'selct file button
    treat_file("£$_NO$FILE_$£") 'hope that nobody uses a such name ;-)
    SetFocus(windmain)
Case IDNOTES 'open or close notes
    If dsptyp<>0 And dsptyp<>3 Then dsp_hide(dsptyp)'cancel full source or mem or var
    dsp_hide(3)  
Case IDBUTTOOL 'tools button 
   GetCursorPos(@pnt)
   If Dir(ExePath+"\dbg_log_file.txt")="" Then 'the file can be deleted by user outside
            EnableMenuItem(menutools,IDSHWLOG,MF_GRAYED)
            EnableMenuItem(menutools,IDDELLOG,MF_GRAYED)
   Else
    EnableMenuItem(menutools,IDSHWLOG,MF_ENABLED)
            EnableMenuItem(menutools,IDDELLOG,MF_ENABLED)
   End If
   TrackPopupMenuEx(menutools, TPM_LEFTALIGN Or TPM_RIGHTBUTTON, pnt.x, pnt.y, hWnd,ByVal NULL)
   PostMessage(windmain, WM_NULL, 0, 0)
   SetFocus(windmain)
Case ENLRSRC 'enlarge source
    dsp_hide(1)
Case ENLRVAR 'enlarge treeviews
    dsp_hide(2)
Case ENLRMEM 'enlarge dump
    dsp_hide(4)
===============================
' Tools Menu
===============================
Case IDCMDLPRM   'open settings
    fb_MDialog(@settings_box,"Settings",windmain,50,25,337,196)
Case IDABOUT 'about
   fb_message("FB DEBUGGER",fbdebuggerversion+Chr(13)+__DATE__+Chr(13)+"(C) L.GRAS"+Chr(13)+"sarg @ aliceadsl . fr")
Case IDCMPINF 'show compilation information
   compinfo_sh
Case IDDBGHELP 'open the help file
    help_manage '05/06/2013
Case IDTUTO 'not really used
    'If tutobx=0 Then fb_Dialog(@tuto_box,"Tutorial",windmain,20,280,325,60) '04/01/2013
    fb_message("Tutorial","Sorry, work in progress !!!")
Case IDFILEIDE 'launch ide
    ide_launch()
Case IDQCKEDT 'quick edit (use the source code as editor)
    If prun AndAlso kill_process("If YES debuggee is killed then Quick edit is started")=FALSE Then
            'nothing to do but better algo
    Else
    If dbgsrc="" OrElse Dir(dbgsrc)="" Then
        fb_message("Quick internal Editor","No file !!!")
    Else
        sendmessage(dbgrichedit,EM_SETREADONLY,FALSE,0)
        dsp_hide(1)
        fb_Dialog(@save_box,"Quick edit",windmain,283,25,150,25)
        setfocus(dbgrichedit)
        sendmessage(dbgrichedit,EM_HIDESELECTION,1,0)
        sendmessage(dbgrichedit,EM_SETSEL,1,1)
    End If
    EndIf
Case IDCMPNRUN  'recompil bas then run
    If source(dbgmain)="" Then
        treat_file("£$_NO$FILE_$£")
    Else
        treat_file(source(dbgmain))
    EndIf    
    
Case IDCLIPBRD 'copy notes to clipboard
    sendmessage(dbgedit1,EM_SETSEL,0,-1)
    sendmessage(dbgedit1,WM_COPY,0,0)
    sendmessage(dbgedit1,EM_SETSEL,-1,0)
    
Case IDSHWLOG'show log
        log_show
Case IDHIDLOG 'hide log
        log_hide    
Case IDDELLOG 'delete log file if exists
            Dim savflog As Integer=flaglog       'save see below
            flaglog=flaglog And 1                'change the value but keeps screen output
            dbg_prt(" $$$$___CLOSE ALL___$$$$ ") 'close the file if needed
            Kill (ExePath+"\dbg_log_file.txt")   'delete it
            flaglog=savflog 'restore the value to keep the use of file log

Case IDSHENUM'list enums
    If helpbx=0 Then helptyp=6:fb_Dialog(@help_box,"LIST ENUMS",windmain,2,2,260,250)
Case IDINFOS 'proceess list
   If helpbx=0 Then helptyp=2:fb_Dialog(@help_box,"PROCESS LIST",windmain,2,2,400,250)
Case IDLSTDLL 'DLL list (so on linux)
   If helpbx=0 Then helptyp=7:fb_Dialog(@help_box,"DLLS LIST",windmain,2,2,400,250)
Case IDLSTSHC 'shorcut list
   If helpbx=0 Then helptyp=8:fb_Dialog(@help_box,"SHORTCUT KEYS LIST",windmain,2,2,400,250)    
Case IDWINMSG'translate win message (windows only)
    winmsg()
Case IDSHWBDH'show value in dec/hexa/bin
    dechexbin()
Case IDFRTIMER 'show the value of fast timer
    fb_message("Fast run timer","Elapsed Time : "+Str(fasttimer))
Case IDJITDBG 'set info in case of exception to launch fbdebugger (windows only) 
    fb_MDialog(@jit_box,"Set/reset JIT debugger",windmain,283,25,325,60)
    
===============================
' code Menu
===============================    
'The first 13 entries are like the most left buttons    

Case IDSETBRK 'set breakpoint
   brk_set(1)
Case IDSETBRT 'set tempo brkp
   brk_set(2)
Case IDBRKENB 'enable/disable brkp
   brk_set(3) '01/03/2013
Case IDMNGBRK
   fb_MDialog(@brk_manage,"Manage breakpoints",windmain,500,8,330,170) '27/02/2013
Case IDSHWVAR 'show var retrieved from code windows
    var_tip(PROCVAR)
Case IDSETWVAR'set var as watched retrieved from code windows
    var_tip(WATCHED)
Case IDFNDTXT 'find text from code windows
        If hfindbx=0 Then 'findtext not active ?
            stext=wtext() 'selected text or ascii text near cursor
            fb_Dialog(@find_box,"Findtext (Circular)",windmain,283,25,100,25)
        End If
Case IDTGLBMK 'toogle on/off bookmark 
   bmk_tgl()
Case IDNXTBMK 'go to next bookmark
    bmk_goto(TRUE) 'bookmark move forward
Case IDPRVBMK  'go to previous bookmark
   bmk_goto(FALSE)'move backward
Case IDGOTO 'goto line
        line_goto
Case IDLINEADR 'line address (in memory)
    line_adr
Case IDLINEASM 'dissassembly line in source
    If helpbx=0 Then helptyp=9:fb_Dialog(@help_box,"Dissassembly line",windmain,2,2,400,250)
Case IDPROCASM 'dissassembly proc from line in source
    If helpbx=0 Then helptyp=10:fb_Dialog(@help_box,"Dissassembly proc",windmain,2,2,400,250)        
Case IDACCLINE 'show not executable lines by changing their color 
    'dsp_access(shwtab)
    dsp_noaccess
Case IDFCSSRC 'open focus dialog
    If focusbx=0 Then
        fb_Dialog(@focus_box,"Focus on some lines from source",windmain,2,2,400,260)
    EndIf  
Case IDADDNOT 'add notes
   notes_add()
===============================
' proc/var Menu 
===============================  
Case IDSETWTCH 'set watched first free slot
    If var_find2(tviewvar)<>-1 Then watch_set()
Case IDSETWTTR 'set watched + trace
    watch_addtr
Case IDVARBRK  'break on var value
  brkv_set(1)
Case IDSELIDX 'select index in prc/var tab
    If hindexbx=0 Then fb_Dialog(@index_box,"Index selection",windmain,283,25,350,250)
Case IDVARDMP  'var dump
  var_dump(tviewvar)
Case IDPTDUMP 'dump pointed data
    var_dump(tviewvar,1)
Case IDVAREDT  'edit var value
  If var_find2(tviewvar)<>-1 Then fb_MDialog(@edit_box,"Edit var value (Be carefull)",windmain,283,25,350,50)
Case IDSHWEXP  'show and expand variables
	shwexp_new(tviewvar)
Case IDSHSTRG  'show z/w/string
  string_sh(tviewvar)
Case IDSHCHAR '03/11/2014
    char_sh(tviewvar)
Case IDCHGZSTR 'change byte <-> zstring type
  zstringbyte_exchange()
Case IDLOCPRC 'locate proc   also in proc menu and proc/var menu
    proc_loc()
Case IDCALLINE 'locate calling line
   proc_loccall(1)
Case IDPBCKTRK'backtracking from proc/var 22/08/2013
    proc_loccall(2)
Case IDPCHNING'chaining from proc/var 31/08/2013
    proc_loccall(3)
Case IDVCLPSE 'collapse proc/var
     proc_expcol(TVE_COLLAPSE)
Case IDVEXPND 'expand
   proc_expcol(TVE_EXPAND)
Case IDLSTVARA 'list all var in log
   procvar_list()
Case IDLSTVARS'list selected var in log
    procvar_list(1)
Case  IDCLBVARA 'clipboard all '28/11/2014
    procvar_list(2)
Case  IDCLBVARS 'clipboard selected var
    procvar_list(3)
====================================
' watched menu
====================================
Case IDWCHVAR'show in proc:var window from watched
    watch_sel(watch_find())
Case IDWCHEDT'edit from watched
    If var_find2(tviewwch)<>-1 Then 'not local non-existent
        fb_MDialog(@edit_box,"Edit var value (Be carefull)",windmain,283,25,350,50)
    End If
Case IDWCHDMP'dump for watched
    var_dump(tviewwch)
Case IDWCHSHW'shw/exp from watched
    shwexp_new(tviewwch)
Case IDWCHSTG'shw string from watched
    string_sh(tviewwch)
Case IDWCHTTGL 'toggle trace
    watch_trace(watch_find()) 
Case IDWCHTTGA 'cancel all traces
    watch_trace()
Case IDSTWTCH1,IDSTWTCH2,IDSTWTCH3,IDSTWTCH4 'exchange watch 0 to 3
   watch_exch(LoWord(wparam)-IDSTWTCH1) 
Case IDWCHDEL'delete watch on cursor from watched
    watch_del(watch_find())
Case IDWCHDALL'delete all watches
    If fb_message("Delete watched vars","Delete all",MB_YESNO Or MB_ICONQUESTION)=IDYES Then
        watch_del()
    EndIf
==========================
' proc menu
==========================
Case IDLOCPRC 'locate proc   also in proc menu and proc/var menu
    proc_loc()
Case IDASMPRC '22/08/2013
    If helpbx=0 Then helptyp=11:fb_Dialog(@help_box,"Dissassembly proc",windmain,2,2,400,250)
Case IDSORTPRC'toggle type of sort and update display
    procsort=1-procsort:proc_sh 
Case IDRSTPRC 'reset all proc
    proc_flw(1)
Case IDSETPRC 'set all proc
    proc_flw(2)
==========================================
' thread menu
==========================================
Case IDTHRDCHG 'change next executed thread
    thread_change
Case IDEXCLINE 'show line
    thread_execline(1)
Case IDCREATHR 'show line creating thread
    thread_execline(2)
Case IDLOCPRC 'locate proc   also in proc menu and proc/var menu
    proc_loc()
Case IDSHWPROC 'locate proc in proc/var treeview
    thread_procloc(1)
Case IDSHPRSRC 'locate proc in source
    thread_procloc(2)
Case IDTBCKTRK 'backtracking (from thread) 22/08/2013
    thread_procloc(3)
Case IDTCHNING 'chaining (from thread) 31/08/2013
    thread_procloc(4)  
Case IDPRCRADR 'information about running proc
    thread_procloc(5)'20/08/2013
Case IDTHRDKLL 'kill a thread
    thread_kill    
Case IDTHRDEXP 'expand threads
    thread_expcol(TVE_EXPAND) '14/12/2012
Case IDTHRDCOL  'collapse threads
    thread_expcol(TVE_COLLAPSE)
Case IDTHRDLST 'list threads
    If helpbx=0 Then helptyp=1:fb_Dialog(@help_box,"THREADS LIST",windmain,2,2,260,250)
==================================
' buttons to select the direction of the search  
Case IDFNDTXUP 'find text backward
    fb_find(0,sfind)
Case IDFNDTXDW'find text forward
    fb_find(1,sfind)
==================================
' left click on watched var textbox / right click delete the corresponding item
Case IDWATCH1,IDWATCH2,IDWATCH3,IDWATCH4 'check adr then select watched variable inside proc/var
        watch_sel(LoWord(wparam)-IDWATCH1)
==================================
' left click on the break on var button
Case IDBRKVAR 'update break on var
    If brkv.adr<>0 Then brkv_set(2)
=========================
'left click on an item in the bookmark area
Case IDBMKCMB 
       If HiWord(wparam)=CBN_SELCHANGE Then 'move to bmk
          x=sendmessage(bmkh,CB_GETCURSEL,0,0)
        x=sendmessage(bmkh,CB_GETITEMDATA,x,0)
        If bmk(x).ntab<>shwtab Then exrichedit(bmk(x).ntab) 'change tab
        sel_line(bmk(x).nline-1)'select line
       EndIf
=========================
'left click on "current line" button
Case IDCURLIG
           exrichedit(curtab)
           sel_line(curlig-1)
=========================
'when a note is created change the notes icon button 
Case IDNOTEWIN 
    If HiWord(wparam)=EN_CHANGE Then
        If SendMessage(dbgedit1,EM_GETMODIFY,0,0) Then
            SendMessage(butnotes,BM_SETIMAGE,IMAGE_BITMAP,Cast(LPARAM,bmb(21)))
        EndIf
    EndIf
    'SetFocus(windmain)

Edit : I just see your post after posting mine (3 minutes)...
Just a comment about bookmarks on howto use it :
- Put the cursor where you want to create a bookmark
- Select the option --> the program retrieves the beginning of the line (30 chars) and create one more line in a combobox
- Then in the combo you see all the bookmarks and you can select one to jump to the desired line
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by TJF »

Hi,
SARG wrote:Questions :
- Can you use the strikethrough "bug" image (fbdebugger .ico) for the exe ?
I tried, but GTK+ ignores it. It's too small.

I prepared the GUI source to load the icons in a GtkIconFactory. Just exchange the file src/img/logo.png by a bigger icon.

Create new icons in 32x32 pixel size and store them in PNG format. Then edit the file src/fbdbg.ui and replace all .bmp by .png. That should be all to use the new icons (old .bmp files can get removed then).
SARG wrote:- How are handled the keypresses (out of menu) ? i.e. Some actions like "step" can be done also by pressing a key.
All shortcuts are in a GtkAccelgroup, one group for each window. When you press one of the shortcut keys in the group, the related action gets triggered, regardless if the action proxies a toolbar button or menu item.
SARG wrote:- Some windows/dialogs could be modal (settings) and other ones non-modal (memory parameters). Possible ?
Sure, modal or non modal. I made the settings and the shortcut dialog modal. Some time ago, I tried to open more than 100 windows. It doesn't make sense, but it's possible.
SARG wrote:- I didn't give you all the simple dialog boxes (messages or questions yes/no). Could they be created on fly without be defined before ? Even if they contains several lines of text.
Yes, you can add any widget by source code in several ways:
  • Classic code by calling functions line by line
  • Using GtkBuilder or GtkBuildable interface to create from string literals (or variables)
  • Using GtkBuilder to load from file

I'd like to use the latest to build the windows shown in expand.jpg.

It doesn't make sense to include small message windows in the main GUI file. It's hard to search for a specific widget if the file contains too much windows. I prefer to create small message dialogs from source.


Here's a screenshot of the settings dialog in German translation:

Image

And here's an example on how the documentation may look like, if we use Doxygen and fb-doc. I implemented the current documentation pages in the Manual section. Click on the image to browse the html tree. It doesn't contain all signal handlers yet. Find documented source in files like src/tobac/act_Settings.bas or src/tobac/act_Shortcuts.bas (and the files at the bottom of the tobac folder).

Image

Any news regarding the GIT repo?
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by SARG »

Hi,

Thanks for all your answers.

The documentation is very impressive, this will take me a bit of time to understand how information is organized.

Reading the doc I found a shift in the variables of fbdbg.bas :
const VAR PROJ_VERS = "3.0"
The project description.
My modest contribution of the day : a new icon sized 32 x 32 :
Image

About the log
The log is used to display/keep either data automatically written by the debugger or selected by the user.

---> screen , a gtk window (instead of the console window) with 2 buttons to clear / hide.
+ an entry in tools menu to show the window. If hidden, the window appears soon there is information to display.
---> file, a gtk window to display the current FIXED file with 2 buttons to delete the file / hide the window.
+ an entry in tools menu to show the window if hidden.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by AGS »

@TJF
There is a problem with the code (I think). Looking at your code it contains gtk_builder/glade related code. Two lines of code that caught my attention are in fbdbg_tobac.bas

Code: Select all

gtk_builder_new()
gtk_builder_add_from_file(GUI_MAIN.XML, "fbdbg.ui", @meld) THEN
fbdbg.ui was nowhere to be found (it could be there and I simply overlooked it) but I am assuming it contains XML as produced by glade.

Glade and in particular a version of glade that supports gtk 3.x is unavailable on the windows platform. Meaning that SARG cannot maintain the gui himself. Unless, of course, he is willing to make a move to Linux as his main development platform and I don't think he is willing to do so.

We discussed using glade or some other tool in the fbdebugger thread. 'Low level GTK' was what was asked for. And right away you suggested using GtkAction (which is not low level gtk). After reading up on using GtkAction and related Gtk classes the choice for GtkAction made sense to me.

So what I was expecting to see was code not unlike what I found in example code on how to use the GtkUIManager. Lots of callback - code, some code to create the gui and of course a main program that glues it all together. But what I am finding here is a gui created using a combination of glade and gtkbuilder.

I am getting a bit confused here.

Is SARG no longer interested in being able to maintain the gui himself?
Is the gui you are presenting here just a mock - up and is the final code not going to be glade based but gtkuimanager based (='semi - low - level' gtk).
Or are you planning to stick with the combination of glade and gtkbuilder? (in which case you'd have to persuade SARG to make a switch to Linux as his main development platform?).

And I simply have to write something about the doxygen generated documentation at http://users.freebasic-portal.de/tjf/Pr ... /doc/html/
It looks great.
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by SARG »

Hi,
AGS wrote:@TJF
There is a problem with the code (I think). Looking at your code it contains gtk_builder/glade related code. Two lines of code that caught my attention are in fbdbg_tobac.bas

Code: Select all

gtk_builder_new()
gtk_builder_add_from_file(GUI_MAIN.XML, "fbdbg.ui", @meld) THEN
fbdbg.ui was nowhere to be found (it could be there and I simply overlooked it) but I am assuming it contains XML as produced by glade.

Glade and in particular a version of glade that supports gtk 3.x is unavailable on the windows platform. Meaning that SARG cannot maintain the gui himself. Unless, of course, he is willing to make a move to Linux as his main development platform and I don't think he is willing to do so.

We discussed using glade or some other tool in the fbdebugger thread. 'Low level GTK' was what was asked for. And right away you suggested using GtkAction (which is not low level gtk). After reading up on using GtkAction and related Gtk classes the choice for GtkAction made sense to me.

So what I was expecting to see was code not unlike what I found in example code on how to use the GtkUIManager. Lots of callback - code, some code to create the gui and of course a main program that glues it all together. But what I am finding here is a gui created using a combination of glade and gtkbuilder.

I am getting a bit confused here.

Is SARG no longer interested in being able to maintain the gui himself?
Is the gui you are presenting here just a mock - up and is the final code not going to be glade based but gtkuimanager based (='semi - low - level' gtk).
Or are you planning to stick with the combination of glade and gtkbuilder? (in which case you'd have to persuade SARG to make a switch to Linux as his main development platform?).
@AGS Thank you for pointing me this problem. You are my guardian angel.
Newbie with the gtk stuff, I had not yet realized the implications. That was the reason I wanted to see how all the parts work together.
Sure I'm not willing to move to linux. I have prepared a linux box for testing but I'm far to be fluent with this OS.
Sure I prefer to be able to make small changes in the GUI.

@TFJ Come back to the good side of the Force ;-) I hope there will be not too many changes in the existing code.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by TJF »

SARG wrote:@TFJ Come back to the good side of the Force ;-)
Who's TFJ ?-)

I am still at the good side of the Force. There're a lot of miss-understandings here, ATM.
AGS wrote:Glade and in particular a version of glade that supports gtk 3.x is unavailable on the windows platform.
I don't know where you get that information from, but it's simply wrong. Glade3 executables are available from here: Glade-3.14.2.

Both of you can have full access to all source code files also on non-LINUX systems. (Somebody has to do the testing on that OSs, and I'm really happy that it's not me.)
AGS wrote:fbdbg.ui was nowhere to be found (it could be there and I simply overlooked it) but I am assuming it contains XML as produced by glade.
Yes, it contains XML. And the file isn't implemented in this documentation, because Doxygen isn't designed to parse XML source. (I don't know what happens when I include it. It's worth a try.)
AGS wrote:Meaning that SARG cannot maintain the gui himself. Unless, of course, he is willing to make a move to Linux as his main development platform and I don't think he is willing to do so.
First, switching to LINUX isn't the worst option.

Glade3 generates XML output. That is a human readable text file. You don't need Glade3 to manipulate that file (and therefor the GUI). I often use Geany to optimize (or correct) the Glade3 code, or to operate on a bunch of widgets at a time, ie. to replace some texts using regex.

It's easy to adapt texts in labels or tooltips that way, or to implement a further widget by duplicating an existend.
AGS wrote:We discussed using glade or some other tool in the fbdebugger thread. 'Low level GTK' was what was asked for. And right away you suggested using GtkAction (which is not low level gtk). After reading up on using GtkAction and related Gtk classes the choice for GtkAction made sense to me.

So what I was expecting to see was code not unlike what I found in example code on how to use the GtkUIManager. Lots of callback - code, some code to create the gui and of course a main program that glues it all together. But what I am finding here is a gui created using a combination of glade and gtkbuilder.

I am getting a bit confused here.
Yes, this is a confusing part of GTK+. And in addition, I do not really understand what you mean by 'Low level GTK' here.

There are three ways to create a GtkWidget:
  • Classic coding line by line (Is this what you mean by low-level?)
  • Parsing a STRING by a GtkUIManager (variables only)
  • Parsing a STRING by a GtkBuilder (variables or file)
Each GUI toolkit supports classic coding. In contrast GTK+ offers two more possibilities to generate GUI elements from XML code. The code gets parsed at run-time, so the XML code is like a source code for a JIT compiler.

The first XML parser is the GtkUIManager. It is designed to generate menus and toolbars on the fly in the source code. It describes the widgets in a simple way. The syntax is easy to read and to edit, but not very powerful.

In contrast the GtkBuilder syntax is more complex, but also more powerful. While GtkUIManager can create toolbar and menu widgets only, GtkBuilder can generate any class that implements the GtkBuildable interface. Ie. it can also generate a GtkLabel, or a GtkFrame, or a GtkListStore, which isn't a complex GtkWidget but a simple GObject.

So GtkUIManager implements a subset of the GtkBuilder features in a less complex syntax. You can embed a GtkUIManager in a GtkBuilder object, but not the oposite.

All GtkBuilder features are also available as function calls (classic coding), but not the oposite. GtkBuilder is made for initially creating the widgets, but not to handle user actions.

BTW: The classic code is related to a certain programming language. In contrast, the XML file can be used by any code, writen in FB, C, Vala, JavaScript, ... It's not only cross-platform, it also allows polyglot coding. That's not an important feature here but a nice-to-have, anyway.

I can neither see a good, nor any reason to fallback to the GUI stone-age, to classic coding. But feel free to do the job of GtkBuilder and translate the Glade XML code to function calls, if you like. (The current file has about 4000 LOC, so you can be done in a week, or two.)
AGS wrote:Is SARG no longer interested in being able to maintain the gui himself?
I'm very interested in getting you and SARG being able to maintain the GUI without my help. I'm planing to switch from my productive role to a more consultant role soon, after getting the basics done.
AGS wrote:Is the gui you are presenting here just a mock - up and is the final code not going to be glade based but gtkuimanager based (='semi - low - level' gtk).
See above. GtkUIManager is designed to create toolbars and menus, but not to create a complex GUI.

The code isn't a simple mock-up anymore. I started coding for widgets data handling.
AGS wrote:Or are you planning to stick with the combination of glade and gtkbuilder? (in which case you'd have to persuade SARG to make a switch to Linux as his main development platform?).
IMHO this could be the final version (before doing text fixes and the packaging).

Regarding development platform: there's an other tool that wasn't discussed here, yet. The most time I spend on using Geany IDE. The second most time I use DevHelp, which is a simple HTML browser. It reads tag files from a bunch of directories (local on my HD) containing HTML trees (called books), and is able to jump on a certain documentation position (book->page->line) regarding the passed keyword.

Regardless if I work in Glade3 or Geany, when I press a key or the help button, DevHelp shows the related documentation (or a list of matches when the keyword is ambiguous). This works for any keyword, ie. in installed libraries like GTK, GDK, GIO, GLib, ..., or for the keywords in FB. All this books are linked to each other. This saves time, a lot of time.

I couldn't find a similar tool for non-LINUX systems yet. IHMO this DevHelp tool is the most important reason why you should consider to switch to LINUX. (But, please, only for development and NOT for testing.)
SARG wrote:About the log
The log is used to display/keep either data automatically written by the debugger or selected by the user.

---> screen , a gtk window (instead of the console window) with 2 buttons to clear / hide.
+ an entry in tools menu to show the window. If hidden, the window appears soon there is information to display.
---> file, a gtk window to display the current FIXED file with 2 buttons to delete the file / hide the window.
+ an entry in tools menu to show the window if hidden.
I guess 'FIXED file' = fixed file name.

OK, I can replace the entry by a simple checkbox. Or I copy your initial design (four radio buttons).

Anyway, I'd like to understand why you want to restrict the users freedom to choose a custom file name and why you want to show two windows with the same context -- screen and file. Isn't this confusing? And a waste of memory? I'd prefer a clearer concept: use an editor to watch the (any) file; the debugger offers an additional screen log window.
AGS wrote:And I simply have to write something about the doxygen generated documentation at ...
It looks great.
Thank you!

The credits don't belong to me. I just used the standard layout from Doxygen tool, which is responsible for that design (which can get customized as well).
SARG wrote:The documentation is very impressive, this will take me a bit of time to understand how information is organized
I'd like to think that both of you are willing to give Doxygen a try.

It should be easy to transform the current documentation pages to markup language, in order to fully integrate them in to the html tree.
SARG wrote:Reading the doc I found a shift in the variables of fbdbg.bas :
This was a test to find out if you check all pages. You stand the proof ;-)

So first Doxygen lessons here:

Documentational comments for Doxygen start with the magic character "*" right after the single quote (for both, single or multi line comments). By default they belong to the following source code construct. The magic character "<" makes them belong to the previous.

Here's the corrected snippet for src/fbdbg.bas

Code: Select all

CONST PROJ_NAME = "fbdbg"                   '*< The project name
CONST PROJ_DESC = "FreeBASIC Debugger"      '*< The project description
CONST PROJ_VERS = "3.0"                     '*< The version number
CONST PROJ_YEAR = "2015"                    '*< The year of the release
CONST PROJ_AUTH = "SARG, AGS, TJF"          '*< The authors
CONST PROJ_MAIL = "Th0ma5.Fr3ih3rr@gmx.net" '*< An email address to get in contact
CONST PROJ_WEBS = "github.com/fbdbg"        '*< The website where to find further informations
CONST PROJ_LICE = "GPLv3"                   '*< The licence of the project
As you can see, the resulting documentation gets generated from documentational comments, as well as from FB source. When you change a variable name, the documentation gets auto up-dated in the next Doxygen run (single source, saves a lot of work - only names in parameter lists have to get copied).
SARG wrote:My modest contribution of the day : a new icon sized 32 x 32 :
Thanks, implemented! I made the edge area transparent. (Later, you can replace my file if you don't like it.)


Any news regarding the GIT repo?
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by AGS »

@TJF
I was clearly wrong about availability of glade on windows. My mistake.

With 'low level' I mean classic.

With the availability of glade on windows a question remains: does SARG want to use glade and the other tool(s) you used to maintain a gtk based program? Or does he want to stick with (semi-) classic code?

Your suggestion to use GtkActions instead of a classic solution to handling menu/toolbar/shortcut related callbacks was a step away from classic coding. The more I read about the use of GtkAction and GtkUIManager the more I think a little bit of non - classic coding isn't all that bad.

The non - classic parts of gtk are, however, somewhat hard to understand. You might gain something when using non - classic gtk but isn't a straightforward classic gui easier to understand?

This is how you create a toolbar using the classic solution (code posted so SARG can see some classic GTK code).

Code: Select all

dim toolbar as GtkWidget ptr = gtk_toolbar_new()
dim new_button as GtkToolItem ptr = gtk_tool_button_new_from_stock(GTK_STOCK_NEW)
dim open_button  as GtkToolItem ptr = gtk_tool_button_new_from_stock(GTK_STOCK_OPEN)
dim save_button as GtkToolItem ptr = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE)
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), new_button, -1)
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), open_button, -1)
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), save_button, -1)
All that is left to do is to connect the callbacks (set tooltips etc...).
The above looks much more like what fbdebugger code looks like right now. And I think SARG was writing classic fltk code before we got him to switch to gtk.

Maybe the above is what SARG wants. Perhaps a little non - classic gtk could not hurt.
Maybe some code like you can find here
https://wiki.gnome.org/GnomeLove/UIManagerTutorial

(it's a good example on how to use GtkUIManager).

I looked at a large editor project (bluefish) that does not use glade. But it does use GtkUiManager and two .ui files (one for menus, one for toolbar(s)). Lots of code related to GtkUiManager can be found in the bluefish project http://sourceforge.net/p/bluefish/code/ ... er.c#l1137

Anyway... GtkUiManager: yes. And the rest should be classic code. But that's just my opinion. Perhaps SARG likes glade so much he is willing to move away from classic coding.

As an aside: it would be silly to not use the code created by TJF. Even if SARG does not want to maintain fbdebugger using glade and related tools the code produced by TJF can still be used.
It would take some time to turn the TJF code (and the associated glade file) into 'classic' gui code (with the possible exception of the use of GtkUIManager) but I am more than willing to do that.

And what's up with the use of git, TJF? If you are done coding you can put the code on the German fb site so SARG (and I) can download the finished code from there. There is no need to use git to put some files online, is there?

Again, sorry about my mistake regarding the availability of glade on windows.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by TJF »

AGS wrote:Again, sorry about my mistake regarding the availability of glade on windows.
Thanks for quick response! Apology accepted.
AGS wrote:Your suggestion to use GtkActions instead of a classic solution to handling ...
There's still a miss-understanding here. As I wrote above
TJF wrote:All GtkBuilder features are also available as function calls (classic coding), ...
Really ALL GtkBuilder features are also availble as classic function calls, even GtkAction. Have a look at GtkAction and related pages. There isn't anything hidden in the XML file. In combination with a GUI designer it's just a more convenient and a faster (and a polyglot) way to generate a GUI.
AGS wrote:... does SARG want to use glade and the other tool(s) you used to maintain a gtk based program? Or does he want to stick with (semi-) classic code?
Yes, that is a central question. I tought it was answered before I startet. My way of code organization offers a lot of possiblities, like
  • you can develop much faster (I'm working since eight days on this project and the current state isn't that bad)
  • the GUI code doesn't pollute the functional code, it gets more easy to read
  • you can separate functional and GUI code, and exchange either part with low effort adapting the other (you could also make the functional part a command line program or library, and place the calling commands in the GUI callbacks)
to name just a few. So if we're still about that question, I'll stop immediately and wait for your decisions.

What I don't understand is why do you care about things SARG may or may not want? He doesn't know my code organization, so how should he decide if he likes it? Isn't it more important to see and test the code in a well known development environment, first?
AGS wrote:And what's up with the use of git, TJF? If you are done coding you can put the code on the German fb site so SARG (and I) can download the finished code from there. There is no need to use git to put some files online, is there?
There's no need from the sink point of view.

This is the way I worked in the past. Starting with the second upload, interested users mix up the code versions and get problems compiling the code. Just check the Fltk thread of D.J.Peters to see what I mean. I'll spend a lot of time finding the problems (not everyone creates such good problem reports as you) and fixing them. It's lost time for me, and it shouldn't happen in this project.

A GIT repository (like the one used for FreeBASIC source) can make sure that all source files match each other. For me, it is more easy to upload the source. And the circle of interested people will have easy downloads and working source trees.

A further point is that we soon will start to work in parallel, each one of us on an other part of the project. Afterwards, we have to merge that parts together. This is what a version control system is designed for. GIT is the most advanced system.

So from my point of view it's a must-have, and I won't upload before we have a GIT repo, sorry.
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by SARG »

Hi TJF and AGS,

@TJF
First sorry for the misspelling. And I know you are always on the right side ;-)
TJF wrote:This was a test to find out if you check all pages. You stand the proof ;-)
Funny I thought the same thing.
TJF wrote:
SARG wrote: About the log
The log is used to display/keep either data automatically written by the debugger or selected by the user.

---> screen , a gtk window (instead of the console window) with 2 buttons to clear / hide.
+ an entry in tools menu to show the window. If hidden, the window appears soon there is information to display.
---> file, a gtk window to display the current FIXED file with 2 buttons to delete the file / hide the window.
+ an entry in tools menu to show the window if hidden.
I guess 'FIXED file' = fixed file name.

OK, I can replace the entry by a simple checkbox. Or I copy your initial design (four radio buttons).

Anyway, I'd like to understand why you want to restrict the users freedom to choose a custom file name and why you want to show two windows with the same context -- screen and file. Isn't this confusing? And a waste of memory? I'd prefer a clearer concept: use an editor to watch the (any) file; the debugger offers an additional screen log window.
Sorry again, to be not clear. Your idea to let the user choose a name is good.
"Fixed" file means loading the file in its current state to allow the user to look at it. But the next update will only be done in the file (and eventually in the other window, screen log) but not in file window. The purpose for example is to compare easily the current session and an older one.

For the rest I'll answer tomorrow (1 am so today now).
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by TJF »

Hi all!
SARG wrote:Sorry again, to be not clear. Your idea to let the user choose a name is good.
"Fixed" file means loading the file in its current state to allow the user to look at it. But the next update will only be done in the file (and eventually in the other window, screen log) but not in file window. The purpose for example is to compare easily the current session and an older one.
OK, I think it's clear now.


Today I made some tests under non-LINUX.

The GTK+ part works well. Here's a screenshot compiled and running under wine (, which has poor grafics support). Unfortunately I couldn't get GtkSourceView working yet (needed for syntax highlighting).

Image

I'd like to find out if my problems are related to wine or if they are more general. Therefore I'd like you to do some testing. I'll post simple source code later to be tested on other boxes.
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by SARG »

Hi,

For not losing time, what I propose :

- TJF regroups all the files (in their respective folders) in a zip file and uploads it in freebasic-portal.de.
Just one time. After no problem to use Git. However I'll need some information on how to use it ;-)

- AGS and I will look at them to be able to give our opinion about the way to continue.

- In case it seems, at least for me, very hard to maintain I prefer to stay at low level GTK or semi-low level GTK. AGS is willing to help so we'll try.
If you don't want to go in this way I hope that you'll let us use all the good job you have done during these few days.
And your help will always be welcome.

- In the other case we'll continue in the current way.


Two things I don't like :
TJF wrote:I can neither see a good, nor any reason to fall back to the GUI stone-age.
If you give me a drill than I can't use, I'll use again my piece of stone.
TJF wrote:What I don't understand is why do you care about things SARG may or may not want? He doesn't know my code organization, so how should he decide if he likes it? Isn't it more important to see and test the code in a well known development environment, first?
I think that AGS well understands my way of thinking.
I'm just a hobbyist (although I'm working in an IT dept) my way to code is not "modern" but I understand almost everything I do. This must still stay like that.
I also know that's less faster but I'm no hurry : 7 or 8 years, not full time, for FBdebugger learning Freebasic, WIN APIs, Stabs and dwarf data, system calls...
Maybe later I'll change my mind but for now there are enough things to explore : Linux, 64bit system, low level GTK ;-).

Anyway, It's great to share this project with other people. That should continue.
TJF wrote:I'd like to find out if my problems are related to wine or if they are more general. Therefore I'd like you to do some testing. I'll post simple source code later to be tested on other boxes.
Ok I'll test it.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by TJF »

Hi SARG!

You find polite and clear words in a critical situation, even at two o'clock in the morning. And you don't forget the positive aspects. I like that.

Let me explain my situation a bit: I stranded in my prime project. Working three month to produce 100 new LOC was frustrating, I needed a constructive break. Then I really enjoyed it to generate in this intermediate project more than 6000 LOC in less than a week.

This project is also a good way to explain my bad habits,
D.J.Peters wrote:TJF keep scope of your bad attitude.
not by words, but by facts. Our project can benefit from the outcome.
If you give me a drill than I can't use, I'll use again my piece of stone.
This drill (and your other citation) was under an AGS quote, it wasn't directed to you.

In the past, AGS and me had teamwork in several projects. Two of them reached a final state (h_2_bi and fb-doc, command line tools, no GUI). I like to work with him. We complement each other in a generative way. I sent new code and he tested, reported and subjoined new ideas. It worked well between the two of us.

In the past I annoyed him, now he made a mistake -- that happens. I don't think that's a KO criterium for the objective project. Nevertheless I think everybody should speak for himself here.

The above mentioned, well known and proven cooperation cannot work here, since we have three team members and the downloads should be public. We need a version control system here. When I introduced that idea, your response was
SARG wrote:Sure, +1
so I'd like to think that we agree.

Sure, I can package my source tree and upload. Please keep in mind: I don't have a single project to maintain, I've more than 40. Each one is packaged in a different way. When I want to upload a new release, I spend hours to create a package with similar context. Nevertheless, there is a bug in nearly every upload. I do not want to start a further project with manual packaging, where I have to upload a mega byte of data to fix a single character.

We need a version control system in this project, so what I propose:
  • somebody starts a GIT repo (AGS mustn't needs do it, but the big boss says
    SARG wrote:No lazy man in the team. :-)
  • you, AGS and all others can download
  • you can test the code, ask questions, and decide if the code works for you
[@Sebastian] Kann das Dilemma mit Hilfe aus Braunsen gelöst werden? [/@Sebastian]
In case it seems, at least for me, very hard to maintain I prefer to stay at low level GTK or semi-low level GTK. AGS is willing to help so we'll try.
The "modern" way isn't really modern. I started working with GUI designers in the middle 80's. That time we used a single bit to set a boolean state. Today, Glade XML needs a line with up to 90 characters (bytes). But in the 80's it took an expert and a week or more to find a faulty bit. Today everybody can find it in an hour or less, using a simple text editor.

AGS and you can, you should, you'll have to do classic coding in your part of the source, to set a new text in the status bar, to fill or clear a list or tree store, to open a window, to update the GUI on users requests. This wouldn't change.

What I try to do is separating as much as possible of the booring stuff. Things like make a window, set the border width, pack this or that widget at any position ... are not related to the functional code. They polute the functional source code. That's why they should move to an other part of the source.
St_W wrote:It's nice to see that fbDebugger is going to get some new UI. The reason why I think that's important is that UI and other code should be separated.
This code gets not hidden, it's the oposite. The code can still be edited with a text editor and it has to be compiled. But in addition you can (but you needn't) use a further method, a grafical designer to maintain the code. Each method has its advantages and its downsides.

I also prefer to know what's going on in the code I produce. But I need not understand what hardware accelleration is used when cairo draws my button, or which plural forms have to get considered when translating the GUI in to Polish language. I focus on my level and acept some layers of abstraction for the others.

I understand that's much to explore. A lot will clear up, once you test the code. You liked the output that you've seen so far, so why not give the input a try?

Yesterday, I prepared and tested my local GIT repo for uploading. Once I get the URL of the public repo, it's just one command to connect the public repo (URL)
  • git remote add <URL>
and one further command to upload (for first and all further uploads)
  • git push
At your site it needs
  • git clone git://<URL>
to initially download the package and
  • git pull
to update to the current state. Further commands we have to figure out by trial and error. I'm no git expert, I also want to learn it in this project. Git has a grafical user interface (git gui) that helps to keep track of the things going on.


Here's the test code I mentioned in my previous post. It compiles and runs in the current state, creating a GtkTextView in a window.

Code: Select all

#LIBPATH "your/path/to/GTK/lib"

#INCLUDE ONCE "Gir/GtkSource-3.0.bi"
#INCLUDE ONCE "Gir/_GObjectMacros-2.0.bi"

gtk_init(@__FB_ARGC__, @__FB_ARGV__)

VAR win = gtk_window_new(GTK_WINDOW_TOPLEVEL)
gtk_widget_set_size_request(win, 200, 137)
g_signal_connect(G_OBJECT(win), "destroy", _
                     G_CALLBACK(@gtk_main_quit), NULL)

VAR myview = gtk_text_view_new()
'~ VAR myview = gtk_source_view_new()

gtk_container_add(GTK_CONTAINER(win), myview)

VAR buff = gtk_text_view_get_buffer(GTK_TEXT_VIEW(myview))
gtk_text_buffer_set_text(buff, "Hallo all!", -1)

gtk_widget_show_all(win)
gtk_main()
When I comment the line gtk_text_view_new and instead uncomment the gtk_source_view_new line, the code still compiles. And it runs on LINUX. But not on other systems: no window, no error message, no output at all. It starts and just returns to the command line (producing an empty line).

Please test and report. I hope your debugger can help.

BR
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by TJF »

I just tried an other version of GtkSourceView and get an exeption message now:
Wine wrote:Unhandled exception: unimplemented function libgobject-2.0-0.dll.g_type_add_instance_private called
I couldn't find that function 'g_type_add_instance_private' in the docu.

Doing further testing ...
SARG
Posts: 1755
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Cross platform GUI project (debugger for FreeBASIC)

Post by SARG »

hi TJF,

Not a lot of time today :-(
So I just tried to compile your code.I had to download some data for gir (thank you google) from the FB's forum.
For now I'm stuck with an error gtksourceview-3.0 not found.
The only binary I have found : mingw32-gtksourceview3-3.4.1-1.fc17.noarch.rpm
I can't open it. Pls upload a zip file version.

Sunday, more time, I could reply to your previous post.
Post Reply