Mark, you sure are having coding marathons! While you're at it, why not hack FreeBasic into FreeGin
![Laughing :lol:](./images/smilies/icon_lol.gif)
...I wonder though, it might not be so difficult to patch in your stuff.
Code: Select all
//-- load file and show the window
gins_glade("test.glade")
gins_set("window1" , "100" , "100" , "<uposition>")
gins_main()
//-- test new objectstuff
//-- add new elements to a window made with glade
gtk_createobject("GtkButtonWithLabel" , "button96", "testbutton" , 0)
gtk("gtk_box_pack_start" , "vbox1" , ":button96" , "0","0","0",0)
gtk("gtk_widget_show" , ":button96" , 0 ,0,0,0,0)
gtk_createobject("GtkLabel" , "label77", "testlabel" , 0)
gtk("gtk_box_pack_start" , "vbox1" , ":label77" , "0","0","0",0)
gtk("gtk_widget_show" , ":label77" , 0 ,0,0,0,0)
//-- create a completely new window
gtk_createobject("GtkWindow" , "NewWindow", 0 , 0)
gtk("gtk_widget_show" , ":NewWindow" , 0 ,0,0,0,0)
gtk_createobject("GtkHBox" , "NewHBox", "0" , "0")
gtk("gtk_container_add" , ":NewWindow" , ":NewHBox" , "1","1","0",0 )
gtk("gtk_widget_show" , ":NewHBox" , 0 ,0,0,0,0)
gtk_createobject("GtkButtonWithLabel" , "button77", "wwwbutton" , 0)
gtk("gtk_box_pack_start" , ":NewHBox" , ":button77" , "1","1","0",0)
gtk("gtk_widget_show" , ":button77" , 0 ,0,0,0,0)
//gtk("gtk_window_resize" ,"window1" , "100" , "100", 0,0,0)
Not sure if this is what you mean but if the code is based on C++ then things like TOPLEVEL in this case will usually be #defines and handled by the C preprocessor. Maybe it would be easier to make a basic preprocessor that took an array (or .csv) of couplets for each define, then just do a search and replace before running.(MU) A problem I now encountered are "enums".
These are options like Gtk_window_new (TOPLEVEL | POPUP).
It seems I can not pass them as variables, what makes it complex to write a lot of "if / else" statements.
Code: Select all
Eg Preprocess pseudo-code
DefineArray = (TOPLEVEL, 1),
(POPUP, 2),
(etc, 4)
....
For Each DefineArrayIndex
SearchAndReplace ProgramText, DefineArrayIndex(0), DefineArrayIndex(1)
Next
Code: Select all
#!/bin/bash
#--------------------------------------------------------
#-- setup the path to the dialogs
GBdialogPATH=/usr/local/Gtkbasic-002
FILECHOOSER="$GBdialogPATH/dialog-multifilechooser/GBdialog-multifilechooser"
#---------------------------------------------------------------
# modes (1-4) open file , save file , open folder , create folder
# multiselect only for mode 1
# -- open multiple files -----------------------------------
title="Open Files"
folder="/usr/share/audio"
wildcards="*.au"
mode="1"
multiselect="1"
result=`"$FILECHOOSER" "$title" "$folder" "$wildcards" "$mode" "$multiselect" 2>/dev/null`
#-- display the choice: -----------------------------------
xmessage -center "you chose:
$result
bye bye...
"
Code: Select all
gtk("gtk_text_buffer_get_selection_bounds",":buf1" , "dummy" , "dummy" , 0, 0,0 )
Code: Select all
gtk("gtk_text_buffer_get_selection_bounds",":buf1" , "1" , "2" , 0, 0,0 )
Code: Select all
gtk("gtk_text_buffer_delete", ":buf1" , "1" , "2" , "1", 0,0)
Code: Select all
gtk("gtk_text_buffer_get_selection_bounds",":buf2" , "3" , "4" , 0, 0,0 )
gtk("gtk_text_buffer_delete", ":buf2" , "3" , "4" , "1", 0,0)
Code: Select all
if event = "GDK_BUTTON_RELEASE" or event = "GDK_BUTTON_PRESS" then
Code: Select all
if event = "GDK_BUTTON_PRESS" then
Code: Select all
if event = "GDK_BUTTON_RELEASE" then
Code: Select all
static int current_number = 0;
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
g_static_mutex_lock (&mutex);
GSList* thefilenames = gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER (obj));
g_static_mutex_unlock (&mutex);