|
Post by bigbass on Jul 6, 2014 17:19:19 GMT 1
I wanted to test some ideas by updating HUG to use gtk3 as the default lib added typedef structs and getting the gdk_keyval_name so that we have better info for key grabs There are several widgets I want to add that use gtk3 so this is just the start to see if it works In hope that something can get added into the official one day HUG still has a lot more we can do with it ! ------------------------------------------------------------ updated this post with the latest working version HUG3DEMOS-2.1.tar.gz (401.25 KB) Have a functional HUG3 for gtk3 gdk3 and goo2 the gdk3 code compiles for the canvas but will have to tune things for HUG syntax of course I will have to walk through all of the great demos Alex and vovchik did for goocanvas and fix up things as I go (to get stuff to compile and run with the new libs) but the demos I tested are working with just changing to the new libs and compiling against HUG3 Attachment Deletedyou will have to have goo2 installed to compile those apps libgoocanvas-2.0-dev but I included some binaries for testing since HUG is fast now we don't need a special hug lib so using HUG3.bac is more transparent and easy for anyone to edit P.S I see this as a community project where Peter made and is author of HUG Alex added goocanvas . vovchik made many example demos I added the gtk3 gdk3 demos and modified HUG for the new libs so like I said we all added stuff here and its a community thing maybe Peter will pick it up clean up things and make it official someday maybe not ? but anyway its out there for just testing purposes and proof of concept that HUG can be updated for gtk3 tested these demos so there is something to get started with action-types.bac aster.bac asteroid.bac button1.bac canvas.bac checkbox.bac combobox.bac dynamic-combobox.bac dynamic-listbox.bac edit2.bac edit.bac entry.bac goo2.bac goocanvas.bac gootest3.bac Gtk3canvascairo.bac hello.bac hslider.bac image.bac input.bac label.bac listbox.bac markup.bac messagedialog.bac notebook.bac progressbar.bac radio.bac resize-window.bac spinbox.bac spinner.bac spinner_INCLUDE.bac vslider.bac * gdk3.bac this is an include file Joe
|
|
|
Post by alexfish on Jul 6, 2014 20:24:13 GMT 1
Hi Joe
test code works fine ,
can remember one problem with gtk3 combo box , the API method of append has slightly changed
test the combo first and see what happens
then if problem can try these at the import gtk section add
IMPORT "gtk_combo_box_text_append_text(long,char*)" TYPE void IMPORT "gtk_combo_box_text_remove_all(long)" FROM hug_Gtk$ TYPE void
the change COMBO to
FUNCTION COMBO (STRING hug_text$, int hug_xsize, int hug_ysize)
LOCAL combo
combo = gtk_combo_box_text_new() gtk_combo_box_text_append_text(combo,hug_text$) gtk_combo_box_set_active(combo, 0)
IF HUG_WIDGET_SHOW THEN gtk_widget_show(combo)
hug_widget_xsize(STR$(combo)) = hug_xsize hug_widget_ysize(STR$(combo)) = hug_ysize hug_widget_signal(STR$(combo)) = 5 hug_widget_s_widget(STR$(combo)) = combo
hug_widget_type$(STR$(combo)) = "combo" hug_widget_font(STR$(combo)) = gtk_bin_get_child(combo) hug_widget_focus(STR$(combo)) = gtk_bin_get_child(combo) WIDGET = combo
RETURN combo
END FUNCTION
in SUB TEXT(NUMBER hug_widget, STRING hug_text$) at CASE "combo" change to
CASE "combo" IF LEN(hug_text$) EQ 0 THEN IF hug_widget_comborows(STR$(hug_widget)) >= 0 THEN gtk_combo_box_text_remove_all(hug_widget) DECR hug_widget_comborows(STR$(hug_widget)) END IF ELSE gtk_combo_box_text_append_text(hug_widget, hug_text$) INCR hug_widget_comborows(STR$(hug_widget)) END IF
for GOO CANVAS gtk3 uses goocanvas2 , the lib search for libgoo is
FUNCTION hug_Get_Goocanvas$ : REM INCLUDE
LOCAL hug_lib$ LOCAL hug_sequence = -1
CATCH GOTO Redo_Import
LABEL Redo_Import INCR hug_sequence PRINT "lib goo 1 ",hug_lib$ IF hug_sequence = HUG_MAX_LIB_SEQ THEN GOTO Print_Error hug_lib$ = "libgoocanvas-2.0.so." & STR$(hug_sequence) IMPORT "goo_canvas_new" FROM hug_lib$ TYPE long PRINT "lib goo 2 ",hug_lib$ RETURN hug_lib$ LABEL Print_Error RETURN "notfound"
END FUNCTION
with canvas get a problem with get position so hatched them out for now
IN 'SUB hug_mouse_event (NUMBER hug_widget, NUMBER hug_data, long hug_user) : REM INCLUDE'
REM always get position 'gdk = gdk_window_at_pointer(ADDRESS(x), ADDRESS(y)) 'gdk_window_get_pointer(gdk, ADDRESS(hug_gui_properties.mousex), ADDRESS(hug_gui_properties.mousey), 0)
HTH Alex
|
|
|
Post by bigbass on Jul 7, 2014 15:52:45 GMT 1
Hey Alex Thanks for the snippets and the copy and paste with details The combo works but I believe there is a warning bug that several other people had but haven't seen a solution I tried the newer function from 3.0 and the same IMPORT "gtk_combo_box_text_insert(long,int,char*,char*)" FROM hug_Gtk$ TYPE void gtk_combo_box_text_insert(hug_widget,-1,NULL,hug_text$)
not sure I got the syntax right (correct code shouldn't have warnings unless a bug) but they both work but with the warning tested the combo widget to be working using some demo code for HUG wiki.basic-converter.org/index.php?title=Combobox.bacgoo2 isnt installed yet but thanks for the snippet I also added it a much welcomed improvement We all have a few tricks that can get rolled back into a testing HUG3 for the sole purpose that something can get into "hug.bac" but at the same time we can all add some ideas to the mix I think it would also be a good exercise after all the changes to go back and do all the widget demos again for gtk3 and update any functions a little at a time and maybe some new demos too P.S thanks again for all the work on elm bac all of these improvements give all of us more options and the more options the better Joe
|
|
|
Post by bigbass on Jul 10, 2014 17:16:08 GMT 1
Porting hug to gtk3 is a worthy project but a big one that will take some help from several people to do it correctly its doable but not simple we wouldn't want HUG to become stale or old in time so an update will prevent that But taking a step this is where we are at so far (added the fixes Alex posted too) Attachment Deletedbecause gtk3 itself has many changes developer.gnome.org/gtk3/stable/ch24s02.htmlabout 16 more functions will get renamed for cairo a new (gdk.bac)which seems easy enough to do but some other function go about things a different way and getting everything to line up correctly with HUG syntax is another big step But taking a first step and seeing what works with minor changes I got these to compile and work correctly action-types.bac button1.bac checkbox.bac combobox.bac edit2.bac edit.bac entry.bac hello.bac hslider.bac input.bac label.bac listbox.bac markup.bac messagedialog.bac radio.bac resize-window.bac spinbox.bac vslider.bac ================= Don't work yet ================= canvas dynamic-combobox.bac dynamic-listbox.bac icon-kde4.bac progressbar.bac
|
|
|
Post by vovchik on Jul 10, 2014 17:40:23 GMT 1
Dear Joe,
Thanks for your work on this. Indeed, we don't want HUG to go stale and some of those GDK functions are very useful, along all that cairo has to offer. I think it is a big project, but will contribute bits where I can...
With kind regards, vovchik
|
|
|
Post by bigbass on Jul 12, 2014 8:49:53 GMT 1
sourceforge.net/p/baconproto/wiki/gdk3.bac/one example of the sixteen renamed functions when using gtk3 the gdk_region gets renamed cairo '--- fixes for gtk3 functions are replaced by cairo '---IMPORT "gdk_region_copy(long)" FROM "libgdk-x11-2.0.so" TYPE long IMPORT "cairo_region_copy(long)" FROM "libgdk-x11-2.0.so" TYPE long
none of those are in HUG anyway but if you have code that calls any of those functions use the gdk3.bac
|
|
|
Post by vovchik on Jul 12, 2014 10:40:46 GMT 1
Dear Joe, Thanks a million for that impressive piece of work. Will now have to learn how to port a number of my things that use gdk.... With kind regards, vovchik
|
|
|
Post by bigbass on Jul 16, 2014 16:11:56 GMT 1
Hey guys This can be done a little at a time while we are busy with other things I think there is still a need for a gtk3 HUG *vovchik Porting already working HUG demo code is a lot easier than writing new demo code just focusing on the new functions for gtk3 use maybe we still need to test some simple stand alone widgets first to get the syntax ported where we need a lot of help is with cairo and the canvas most of the gtk gdk widgets are working now all the hard work was already done by Peter we just want to keep HUG moving and growing but it will take some time and a lot of testing but the ball is moving you and Alex did a lot of work with the canvas that could patch up and improve HUG in that area so any simple demos would be great for testing I only added 16 IMPORTS to the gdk.bac and renamed it gdk3.bac to sort out the differences here are the changed functions I commented out the old ones so porting the code would be easier Note : I haven't added the IMPORTS for the GdkDrawable to GdkWindow but will append them
|
|
|
Post by vovchik on Jul 16, 2014 21:21:49 GMT 1
Dear Joe,
Thanks. We'll have to see what we can do here. I like the fact that libgdk-x11-2.0.so pulls in cairo all by itself.
With kind regards, vovchik
|
|
|
Post by alexfish on Jul 18, 2014 11:27:10 GMT 1
Hi Joe have tested goo_canvas with the lib here using the first instance of when Peter introduced goo_canvas in hug HEREthis is my code , same as Peter's Demo except the bacon_eyes.png . its works out of the box.. INCLUDE "hug3.bac", INIT, WINDOW, CANVAS, DISPLAY, ATTACH, HUGOPTIONS, CIRCLE, PIXEL, LINE, SQUARE, OUT, PICTURE
INIT
HUGOPTIONS("NOSCALING") HUGOPTIONS("CANVAS GOO")
win = WINDOW("Goo Canvas", 500, 400)
canvas = CANVAS(500, 400)
ATTACH(win, canvas, 0, 0)
CIRCLE("#FF0000", 50, 50, 100, 100, 0)
LINE("#0000FF", 300, 10, 100, 350)
SQUARE("#FFFF00", 10, 300, 50, 50, TRUE)
OUT("<b>Hello</b> GOO Canvas", "#FF00FF", "#0000FF", 0, 0)
PICTURE("bacon_eyes.png", 320, 100, 128, 128)
FOR x = 0 TO 50 PIXEL("#FF00FF", 100+x, 40) NEXT
DISPLAY
As Regards an input on the IMPORT gdk bits in respect of cairo , Goo-Canvas will be the better option unless the user can code Cairo at low level then got no chance , goo canvas resolves all of that and more, I tested GTK3 quite a while back and most if not all the examples on the thread should work. the BacPacBoy also (Packman) demo did work).. I can not test that on my system since still got a deep rooted problem with SVG .. perhaps Vovchik or U'r self can test it Looking forward to more HUG(GTK3) BR Alex Attachments:
|
|
|
Post by alexfish on Jul 18, 2014 12:11:22 GMT 1
Hi Joe
tried testing this Code RE Notebook. looks like the NOTEBOOK works
INCLUDE "hug3.bac" HUGOPTIONS("NOSCALING")
REM HUGOPTIONS("CANVAS GL")
win = WINDOW("Goo Canvas", 500, 400)
note=NOTEBOOK("Tab 1 EDIT",500,400) ATTACH(win,note,0,0)
ed_1=EDIT(500,400) ATTACH(note,ed_1,0,0)
TEXT(note,"Tab 2 CANVAS") canvas=CANVAS(500,400)
ATTACH(note,canvas,0,0)
DISPLAY
Default Canvas error messages
GL CANVAS :: the app crashes
Looks like a bit of work to for the two canvases.
Think Best option for GL would be to Test Peters GL canvas Demo with PROTO first , then see What Happens.
The GTK drawing area , Know not much about it , here would be looking at the DOCS.
Update: managed to catch GL crash
(NoteBook:5537): GLib-GObject-WARNING **: cannot register existing type `GdkDisplay'
(NoteBook:5537): GLib-CRITICAL **: g_once_init_leave: assertion `result != 0' failed
(NoteBook:5537): Gdk-CRITICAL **: IA__gdk_x11_display_get_xdisplay: assertion `GDK_IS_DISPLAY (display)' failed Segmentation fault
suppose narrows the field down to the GdkDisplay , think I mentioned that one in a previous post looks like not fixed in the latest lib.
also need this bit fixed for the MOUSE,
BR Alex
|
|
|
Post by alexfish on Jul 18, 2014 13:57:31 GMT 1
Hi All , and Peter
done some testing on this GTK3/GDK2 ::
hug_gdkwin = gdk_get_default_root_window()
Not sure but think this could be a bug in GTK3/GDK2 , IE: not a BaCon Hug bug
IF by Reason :: GTK2/GDK2 this call works ,in BaCon Hug
Now need some feed back on this one..
use the Note book demo for testing
looks like a Possible fix by calling from GTK Not GDK , found the command by NM on the gtk lib
REM IMPORT "gdk_get_default_root_window" FROM hug_Gdk$ TYPE long IMPORT "gdk_get_default_root_window" FROM hug_Gtk$ TYPE long
Now getting pixbuff Null on call to
pix = gdk_pixmap_new(hug_gdkwin, gdk_screen_get_width(gdk_screen_get_default()), gdk_screen_height(gdk_screen_get_default()), -1)
IN the Canvas .. IE pix=0 , it should have a number. :: Still no progress , giving up for now.
Will await for confirmation of Compile , Pass or Fail , on other Systems , This is Mint 16, 32bit BR Alex
|
|
|
Post by alexfish on Jul 18, 2014 15:43:25 GMT 1
Hi Joe
thought would test IMAGE since Standard Canvas = Image with nothing set ,
image = gtk_image_new()
and IMAGE :
image = gtk_image_new_from_file(hug_file$)
now this one works:
INCLUDE "hug3.bac" HUGOPTIONS("NOSCALING")
win = WINDOW("Goo Canvas", 500, 400)
img=IMAGE("bacon_eyes.png",160,160) ATTACH(win,img,0,0)
DISPLAY
BR Alex
|
|
|
Post by bigbass on Jul 18, 2014 16:18:40 GMT 1
Hey Alex Excellent progress thanks! I added your demos to the community HUG3 testing project image.bac goocanvas.bac notebook.bac I fixed dynamic-combobox.bac dynamic-listbox.bac spinner.bac spinner_INCLUDE.bac take a look at Peter's spinner.bac spinner_INCLUDE.bac they use REGISTER and METHOD a long forgotten way of adding widgets (and that's the official way) I updated them to gtk3 Hope to have some time on the weekend for GdkDisplay and fix the mouse stuff Joe HUG3DEMOS-1.0.tar.gz (207.3 KB)
|
|
|
Post by bigbass on Jul 20, 2014 0:17:22 GMT 1
|
|