Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Apr 10, 2013 20:54:06 GMT 1
Should I assume that this is only a Puppy Linux solution and Ubuntu 64 Gtk3 users are SOL?
|
|
|
Post by alexfish on Apr 10, 2013 21:50:14 GMT 1
Hi John only thing I can remember about Ubuntu 12 + 64 bit when in Beta , it did not work well with software development , Ist off did install gtk devs , Bacon would compile from bash but the resultant compiled progs failed to work as expected , some worked some did not so ended up Looking GTK site for all the bits required , at one point had suspected Glib , cut a long story short , banged in everything that had been done on present system so I can not help In that department since only used beta testing , Bits where missing but was still ify. after installing required. Unless someone with a bit more know-how of 12 + devs comes to aid then possibly , get on a working system , and run the progs with valgrind , it should show what is been used , it does come up with such things as xml parsers and zlibs etc etc. BR
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Apr 10, 2013 21:56:53 GMT 1
Your Makefile generated the following error for me. jrs@laptop:~/BaCon/B30$ make Makefile:9: *** missing separator (did you mean TAB instead of 8 spaces?). Stop. jrs@laptop:~/BaCon/B30$ I was able to compile the example using gcc direct. gcc switch-c.c -o switch-c `pkg-config gtk+-3.0 --cflags --libs` I think we went over this already that if I compile the example from the Gtk site using gcc direct, it works fine. All my IUP (Gtk3 driver) works fine as well. Like you say, I'll just wait around until someone with the most popular distribution out there and running the LTS version cares about this thread.
|
|
|
Post by alexfish on Apr 10, 2013 22:23:23 GMT 1
Hi John
have U tried compile with all of bacon types.
IE bacon.bash | bacon | bacongui
+ can try option as for only your system , will have to look at the compiler options in Bacon help
BR
Alex
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Apr 11, 2013 0:02:11 GMT 1
jrs@laptop:~/BaCon/B30$ ./bacon --help Segmentation fault (core dumped) jrs@laptop:~/BaCon/B30$ I think I'll revisit this when I have more time to invest.
|
|
|
Post by bigbass on Apr 11, 2013 6:45:24 GMT 1
here is a compiled binary on the way ... cant attach
|
|
|
Post by bigbass on Apr 11, 2013 6:57:46 GMT 1
Hey jrs toggle-spinner-gtk3-protohere is a compiled binary its not a tar.gz I just renamed it to upload remove the tar.gz NOTE: 32bit added this info after reading your post if it works then its a compile time problem not a run time problem it would help to know if it runs *you may have to reset permissions to run it as executable I use official slackware 14 the longest running linux OS Joe Attachments:
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Apr 11, 2013 7:18:39 GMT 1
jrs@laptop:~/BaCon/B30$ ./togglespinnergtk3proto ./togglespinnergtk3proto: error while loading shared libraries: libgtk-3.so.0: cannot open shared object file: No such file or directory jrs@laptop:~/BaCon/B30$ find /usr/lib -name libgtk-3.so* /usr/lib/x86_64-linux-gnu/libgtk-3.so /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 /usr/lib/x86_64-linux-gnu/libgtk-3.so.0.400.2 jrs@laptop:~/BaCon/B30$
Is this a 32 or 64 bit binary?
jrs@laptop:~/BaCon/B30$ ./bacon -help
USAGE: bacon [options] program[.bac]
OPTIONS:
-c <compiler> Compiler to use (default: cc) -l <ldflags> Pass libraries to linker -o <options> Pass compiler options -i <include> Add include file to C code -d <tmpdir> Temporary directory (default: .) -x Extract gettext strings -f Create Shared Object -n Do not compile, only convert -j Invoke C Preprocessor -p Preserve temporary files -b Execute from shebang -w Save options to BaCon configfile -v Show version -h Show help
jrs@laptop:~/BaCon/B30$
@peter - Most *nix console mode utilities use the --help format. It shouldn't cause a segment fault. Bad first impression.
|
|
|
Post by bigbass on Apr 11, 2013 14:18:23 GMT 1
Hey jrs the binary I attached is 32bit
bash-4.2# file /usr/share/BaCon/toggle-spinner-gtk3-proto
/usr/share/BaCon/toggle-spinner-gtk3-proto: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), not stripped bash-4.2#
of course it would be better if someone else running 64 bit Ubuntu or other OS compiled the binary....till then that's all I can do on this 32 bit system
Joe
|
|
|
Post by alexfish on Apr 11, 2013 14:35:26 GMT 1
HiJohn
Can U check the linkers your files are showing in this directory
/usr/lib/x86_64-linux-gnu/ Find the original libgtk-3*
can use "ln" try making symbolic link in the "/usr/lib/" like so
/usr/lib/libgtk-3.so
See what happens
BR
Alex
Have added this Editor code , here so Joe Can Carry on with Proto Code Here is a simple editor , helper ,
it does not save or load ,
It should work if have fully configured bacongui
You will have to do some home work
here I have taken the gtk.bac from the main download site and have removed portions of each line this is easy to do in the likes of gedit , it took me about 5min.
the lines should look similar to the below , but note the likes of "gtk_button_new() TYPE long" look at the results carefully then compare with what I show below .
gtk_button_get_use_stock(long) TYPE int gtk_button_get_use_underline(long) TYPE int gtk_button_leave(long) TYPE void gtk_button_new() TYPE long gtk_button_new_from_stock(char*) TYPE long gtk_button_new_with_label(char*) TYPE long gtk_button_new_with_mnemonic(char*) TYPE long
The code: ' Ideas ' setting Proto Edit helper ' Can be improve on , see some of Joes Examples. ' alexfish Bacon ConVertor Forums
INCLUDE hug.bac HUGOPTIONS("NOSCALING") HUGOPTIONS("TABLE 40 41") ' Here You will have to change the path and name of file to suit , get it wrong it will crash ' since no checking is done for FILEEXIST PROTO_FILE$="/bacon/gtk.proto" CALL Find_GtkSource_Library
SUB Find_GtkSource_Library
LOCAL lib$ LOCAL seq, retry
CATCH GOTO handle_error
lib$ = "libgtksourceview-2.0.so" seq = -1 LABEL import_retry INCR seq retry = FALSE IMPORT "gtk_source_buffer_new_with_language(long)" FROM lib$ TYPE long IF retry THEN GOTO import_retry
GOTO contin
LABEL handle_error ERROR = 0 IF seq IS 0 THEN lib$ = "libgtksourceview-2.0.so.0" ELSE lib$ = CONCAT$(LEFT$(lib$, INSTRREV(lib$, ".")), STR$(seq)) IF seq < 50 THEN retry = TRUE ELSE PRINT "GtkSourceView library not found!" END END IF RESUME
LABEL contin
CATCH GOTO lookup_error
IMPORT "gtk_source_buffer_can_undo(long)" FROM lib$ TYPE int IMPORT "gtk_source_buffer_set_highlight_matching_brackets(long,int)" FROM lib$ TYPE void IMPORT "gtk_source_buffer_undo(long)" FROM lib$ TYPE void IMPORT "gtk_source_language_manager_get_default" FROM lib$ TYPE long IMPORT "gtk_source_language_manager_get_language(long,char*)" FROM lib$ TYPE long IMPORT "gtk_source_view_new_with_buffer(long)" FROM lib$ TYPE long IMPORT "gtk_source_view_set_auto_indent(long,int)" FROM lib$ TYPE void IMPORT "gtk_source_view_set_show_line_numbers(long,int)" FROM lib$ TYPE void IMPORT "gtk_source_view_set_tab_width(long,int)" FROM lib$ TYPE void IMPORT "gtk_source_buffer_set_language(long,long)" FROM lib$ TYPE void GOTO Exit_Sub
LABEL lookup_error PRINT ERR$(ERROR) END
LABEL Exit_Sub CATCH RESET
END SUB
FUNCTION SEDIT (int hug_xsize, int hug_ysize) lm = gtk_source_language_manager_get_default() lang = gtk_source_language_manager_get_language(lm,"bacon") LOCAL buffer, view, scrolled buffer = gtk_source_buffer_new_with_language(lang) 'buffer = gtk_text_buffer_new(0) view = gtk_source_view_new_with_buffer(buffer) 'view = gtk_text_view_new_with_buffer(buffer) scrolled = gtk_scrolled_window_new(0, 0) gtk_scrolled_window_set_policy(scrolled, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC) gtk_scrolled_window_set_shadow_type(scrolled, GTK_SHADOW_ETCHED_IN) gtk_container_add(scrolled, view) gtk_text_view_set_editable(view, 1) gtk_text_view_set_wrap_mode(view, 3) IF HUG_WIDGET_SHOW THEN gtk_widget_show_all(scrolled)
hug_widget_xsize(STR$(scrolled)) = hug_xsize hug_widget_ysize(STR$(scrolled)) = hug_ysize hug_widget_signal(STR$(scrolled)) = 5 hug_widget_s_widget(STR$(scrolled)) = buffer
hug_widget_type$(STR$(scrolled)) = "edit" hug_widget_font(STR$(scrolled)) = buffer hug_widget_focus(STR$(scrolled)) = view
RETURN scrolled
END FUNCTION
SUB Entry_1_Activate
search$=GRAB$(Entry_1)
search$=CHOP$(search$) IF LEN(search$) > 0 THEN ck_gtk = INSTR(search$,"gtk_") IF ck_gtk > 0 THEN search$=MID$(search$,ck_gtk) TEXT(List_1,"") OPEN PROTO_FILE$ FOR READING AS myfile WHILE NOT(ENDFILE(myfile)) DO READLN txt$ FROM myfile txt$=CHOP$(txt$) IF INSTR(txt$,search$) THEN TEXT(List_1,txt$) END IF WEND CLOSE FILE myfile END IF END IF END SUB
SUB Button_1_Clicked text$=CHOP$(GRAB$(Entry_1)) IF LEN(text$) > 0 THEN TEXT(Edit_1,text$) END IF
END SUB
SUB List_1_Clicked text$=CHOP$(GRAB$(List_1)) IF LEN(text$) > 0 THEN SPLIT text$ BY " " TO codes$ SIZE bits TEXT(Entry_1,codes$[0]) END IF END SUB
Window_1=WINDOW("Proto-Edit",300,300)
Edit_1=SEDIT(25,38) ATTACH(Window_1, Edit_1,15,0)
List_1=LIST(15 , 38) ATTACH(Window_1 , List_1, 0 , 0) CALLBACK( List_1 , List_1_Clicked )
Entry_1=ENTRY("gtk_button_",38 , 1) ATTACH(Window_1 , Entry_1, 0 , 39) CALLBACK (Entry_1,Entry_1_Activate)
Button_1=BUTTON("ADD",2, 4) ATTACH(Window_1 , Button_1, 38 , 38) CALLBACK( Button_1 , Button_1_Clicked ) DISPLAY
The List is to the left The source code editor is to the right The Entry is bottom left The add button , Obvious
enter search word in Entry , press return , results show in the List , the more gtk text in the entry refines the results Clicking on the List feeds back to the Entry , Clicking on the ADD button Adds to Source code Editor, , where the CURSOR is. where the likes of (char*) show then will have to replace with correct code
it is meant to be an aid and not a full blown compiler , U have bacon for this , but there are code snippets done by Joe , which can do this
Joe may be able to Improve this one ?
Have Fun
Alex
|
|
|
Post by bigbass on Apr 11, 2013 15:52:41 GMT 1
Sticking to just the basics a mini how to So you can see how to convert official examples to Simplified embedded gtk ones in BaCon using the new PROTO option using this official example code as the reference developer.gnome.org/gnome-devel-demos/3.5/checkbutton.c.html.enSome special notes : replace with this will make life easy for getting started replace with callbacks are modified for BaCon I had to modify this to this for BaCon nuke all the pointers because they are ugly to convert well, really we have better variables in basic so lets use them instead PRAGMA LDFLAGS `pkg-config --cflags --libs gtk+-3.0`
PROTO gtk_init PROTO gtk_window_new PROTO gtk_main PROTO gtk_main_quit PROTO gtk_window_set_title PROTO gtk_container_add PROTO gtk_toggle_button_set_active PROTO gtk_widget_show_all PROTO gtk_window_set_default_size PROTO gtk_window_set_title PROTO gtk_application_new PROTO gtk_application_window_new PROTO gtk_check_button_new_with_label PROTO g_signal_connect_data
PROTO gtk_toggle_button_get_active
'--- signal handler for "toggled" signal of the CheckButton
'==================== SUB toggled_cb '==================== TBUT = gtk_toggle_button_get_active (checkbutton) IF TBUT = 1 THEN gtk_window_set_title (window, "CheckButton Example") ELSE gtk_window_set_title (window, "Callback working") END IF PRINT TBUT END SUB
gtk_init(0, 0) window = gtk_window_new () gtk_window_set_title (window, "CheckButton Example") gtk_window_set_default_size (window, 300, 100) checkbutton = gtk_check_button_new_with_label ("Show Title") gtk_toggle_button_set_active (checkbutton, TRUE) g_signal_connect_data(checkbutton, "notify::active",toggled_cb, 0, 0, 0) gtk_container_add (window, checkbutton) gtk_widget_show_all (window)
gtk_main
|
|
|
Post by bigbass on Apr 12, 2013 6:03:18 GMT 1
another official example developer.gnome.org/gnome-devel-demos/3.5/textview.c.html.enconverted to embedded gtk -PROTO format text-gtk3-proto.bac PRAGMA LDFLAGS `pkg-config --cflags --libs gtk+-3.0`
PROTO gtk_init PROTO gtk_window_new PROTO gtk_main PROTO gtk_main_quit PROTO g_signal_connect_data PROTO gtk_container_add PROTO gtk_container_set_border_width PROTO gtk_scrolled_window_set_policy PROTO gtk_text_view_set_wrap_mode PROTO gtk_widget_show_all PROTO gtk_window_set_default_size PROTO gtk_window_set_title PROTO gtk_application_new PROTO gtk_application_window_new PROTO gtk_scrolled_window_new PROTO gtk_text_buffer_new PROTO gtk_text_view_new_with_buffer
GTK_WRAP_WORD = 2 GTK_POLICY_AUTOMATIC = 1
'===================== SUB exit_prog '===================== gtk_main_quit END SUB
gtk_init(0, 0)
'--- Create a window with a title, and a default size window = gtk_window_new () gtk_window_set_title (window, "TextView Example") gtk_window_set_default_size (window, 220, 200) g_signal_connect_data(window, "delete-event", exit_prog, 0, 0, 0)
'--- The text buffer represents the text being edited buffer = gtk_text_buffer_new (NULL)
'--- Text view is a widget in which can display the text buffer. '--- The line wrapping is set to break lines in between words.
text_view = gtk_text_view_new_with_buffer (buffer) gtk_text_view_set_wrap_mode (text_view, GTK_WRAP_WORD)
'--- Create the scrolled window. Usually NULL is passed for both parameters so '--- that it creates the horizontal/vertical adjustments automatically. Setting '--- the scrollbar policy to automatic allows the scrollbars to only show up '--- when needed.
scrolled_window = gtk_scrolled_window_new (NULL, NULL) gtk_scrolled_window_set_policy (scrolled_window, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC) '--- The function directly below is used to add children to the scrolled window '--- with scrolling capabilities (e.g text_view), otherwise, '--- gtk_scrolled_window_add_with_viewport() would have been used
gtk_container_add (scrolled_window, text_view) gtk_container_set_border_width (scrolled_window, 5)
gtk_container_add (window, scrolled_window) gtk_widget_show_all (window) gtk_main
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Apr 12, 2013 9:47:15 GMT 1
Doesn't the HUG EDIT() function make this same Gtk call? (an much simpler to call)
I'm just saying ...
|
|
|
Post by bigbass on Apr 12, 2013 17:14:38 GMT 1
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Apr 12, 2013 18:31:58 GMT 1
I would be more enthusiastic about this embedded Gtk3 project if I could get it to work on the most popular distribution of Linux out there. I think IUP is much easier to work with using BaCon then anything I have seen posted to date. With a few minor tweaks I can port ScriptBasic IUP based code to BaCon and translate it to C. IUP isn't some taboo library on this forum and I plan to promote it's use so other BaCon users looking for a easy to use GUI with their easy to use Basic can actually create something useful in their lifetime. This is an example of working with the IupTabs control. Can one of the BaCon/Gtk gurus here translate this to Gtk notebook example? (a HUG example as well would be great) Let the users decide which method is best for them. ' IupTabs Example in BaCon
PRAGMA OPTIONS -I/usr/include/iup PRAGMA LDFLAGS iup PRAGMA INCLUDE iup.h
PROTO IupOpen IupSetAttribute IupShowXY IupMainLoop IupClose
DECLARE *dlg, *vbox1, *vbox2, *tabs1, *tabs2, *box TYPE Ihandle IupOpen(NULL, NULL) vbox1 = IupVbox(IupLabel("Inside Tab A"), IupButton("Button A", ""), NULL) vbox2 = IupVbox(IupLabel("Inside Tab B"), IupButton("Button B", ""), NULL) IupSetAttribute(vbox1, "TABTITLE", "Tab A") IupSetAttribute(vbox2, "TABTITLE", "Tab B") tabs1 = IupTabs(vbox1, vbox2, NULL) vbox1 = IupVbox(IupLabel("Inside Tab C"), IupButton("Button C", ""), NULL) vbox2 = IupVbox(IupLabel("Inside Tab D"), IupButton("Button D", ""), NULL) IupSetAttribute(vbox1, "TABTITLE", "Tab C") IupSetAttribute(vbox2, "TABTITLE", "Tab D") tabs2 = IupTabs(vbox1, vbox2, NULL) IupSetAttribute(tabs2, "TABTYPE", "LEFT") box = IupHbox(tabs1, tabs2, NULL) IupSetAttribute(box, "MARGIN", "10x10") IupSetAttribute(box, "GAP", "10") dlg = IupDialog(box) IupSetAttribute(dlg, "TITLE", "IupTabs") IupSetAttribute(dlg, "SIZE", "200x80") IupShowXY(dlg, IUP_CENTER, IUP_CENTER) IupMainLoop() IupClose()
|
|