some gtk2 code

Archives Forums/Linux Discussion/some gtk2 code

skidracer(Posted 2006) [#1]
An example of using GTK2 from BlitzMax without any C/C++ glue.

It's not exactly stunning as gadgetpositions are wrong and the event loop is looking a bit broken.

Has anyone else been doing any GTK development?

Oh, and you may need a sudo apt-get install libgtk2.0-dev to build.




Ole JR(Posted 2006) [#2]
Someone has:
http://developer.berlios.de/projects/blitzmaxgtk/

no clue if it work, it's a result of google.
But it would be nice to have the MaxIde use scintilla i think..


Kernle 32DLL_2(Posted 2006) [#3]
yes, it works !!


Ole JR(Posted 2006) [#4]
And for some reason OpenSuse 10.1 (maybe others to) has the gtk2 libs & stuff in /opt/gnome/lib.

So to make the above code work:
Import "-L/usr/lib"
Import "-L/opt/gnome/lib" 'Add This line...
Import "-lgtk-x11-2.0"
Import "-lgdk-x11-2.0"
Import "-lglib-2.0"



Brucey(Posted 2006) [#5]
Greetings all :-)

Rather than simply wrapping the gtk libs (like that berlios project seems to be doing), I've been working on a *proper* GTKMaxGUI module over the last week and a half, where you use the standard MaxGUI API, and thus you should simply be able to recompile an app using it.

So far I only have windows, menus, labels, buttons, comboboxes, textfields, htmlview (using gtkhtml), font requester, color requester, and other stuff working.
TextArea is about 75% done. Still have to add tag support to it, but other than that, the selection / text setting/retrieving works.
More or less sussed the event stuff... and positioning is working pretty well.
Gadgets can change their fonts... which is nice.
Menus were a bugger, but I think I solved the hard stuff.
Haven't started on list / treeview yet
Panels are challenging me at the moment...

All in all, it's going fairly good, me thinks...

Max-code only.... no C to see ;-)


Kernle 32DLL_2(Posted 2006) [#6]
hey, thats sounds very gooood! When we could test it?


Brucey(Posted 2006) [#7]
Once it's fairly stable and the main features are in.

We've already got one biggish app running in it without too much trouble.

Filerequester up and running too now...


Brucey(Posted 2006) [#8]
This is what makes Max such a wonderful tool....
...once you have a module that takes away all the nastiness of having to work out how these huge c-based APIs work, you can create a listbox with a single line of code, and throw in a new row with another...

I've implemented gtkhtml as the browser view. It currently works off libgtkhtml-3.8. It's not the best one, but it was *fairly* easy to implement, and for simple pages it works okay. I was considering an gtk-embedded version of firefox (I've read some stuff about creating firefox as a .so) but I'm sticking with what works for now.
Most people should have libgtkhtml-3.x installed (and if not, it's just a package download).


:o)


Brucey(Posted 2006) [#9]
Interestingly, GTK2+ doesn't yet support Tooltips on individual list items...

I hope no-one minds too much.

It's apparently on their list of things to do - one day.


Kernle 32DLL_2(Posted 2006) [#10]
no problems, tooltips are not so important like building different kind of gadgets.Could you post a list of features which are solved?


skidracer(Posted 2006) [#11]
LGPL should force people to release stuff before they start talking it up I reckon, I suppose I did post the question, tch.

Sounds all good Brucey


Chris C(Posted 2006) [#12]
LGPL should force people to release stuff before they start talking it up I reckon

Why is LGPL some kind of magic bullet?
Has it ever been upheld in a court of law?

And besides anything else theres nothing stopping somone modifying gtk bragging about it and then not distrubuting it!

And besides all that a module that doesnt actually modify the gtk2 source code, mearly uses it, I'm not entirely sure has any licence restrictions
5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.



skidracer(Posted 2006) [#13]
Umm, it was a joke Chris.


Brucey(Posted 2006) [#14]
LGPL should force people to release stuff before they start talking it up I reckon

Very true... ;-)

Anyway... here's a screenshot of the IDE using the gtk mod...



Good thing about using something like the IDE to test it is that it touches on a lot of the module... makes tracking down things I've missed, a tad easier.
ClientWidth/Height has been a royal pain in the .....

Things to do still :
Canvas :-p
Radio button
Key accel stuff

Most of the rest works up to a point... but there's still a lot of the "little" stuff to sort out - (eg. raise event on open/close tree node, move text area to selection.. etc)

And once people get to start testing it, we'll see all the other stuff I've missed ;-)


Brucey(Posted 2006) [#15]
Oh yeah, and that weird splitter thing in the IDE doesn't work properly - but then it doesn't work right in fltk either :-)


Brucey(Posted 2006) [#16]
and apparently
the list box has been changed so a single click gived a GADGET_SELECT


which is a shame, cuz I've been using the docs to help build the mod, and it don't mention that fact... :-(

I suppose it's a good idea, in order to make the list and treeview work in a similar fashion... alas, it'll break GUI apps that use list boxes...

I hope this is a fixed feature now then?? In which case I'll implement the GTK listbox in the same way.

:-p


Brucey(Posted 2006) [#17]
In an effort to make it look like I've done something useful (for a change), I'm posting the current WIP GTK2 module for people to have a play with.
It's by no means complete, but it gives an idea of what it will be like to have pretty GTK apps from Max.

You can Download the alpha release via this link.

You will need the following packages installed to be able to create apps with GTK:

libgtk-2.0-dev
libgnomecanvas-2.0-dev
libgtkhtml-3.8-dev

(Selecting these in your favourite package manager should also get you the *many* other required packages that these ones use)
Remember, the dev packages are only required for building stuff. You use the standard libs for running the apps.

Things still missing :
Accelerator key handling
Canvas
Radio Button

and I'm sure there's a whole load of Free() gadgets I've missed along the way.

Only constructive comments please, or code snippets for testing. "It doesn't work" type comments are pointless and boring.

<WARNING>
Oh yeah... if you are not comfortable with the fact that the app (and IDE) might crash in a big, crunchy-sounding way, I wouldn't try this YET. (no skid, that doesn't include you ;-)
</WARNING>


skidracer(Posted 2006) [#18]
Awesome work Brucey. Lots of things working really well. Couldn't get htmlview happening, dies with the following sort of thing:

*** glibc detected *** free(): invalid pointer: 0x08323880 ***




Brucey(Posted 2006) [#19]
Thanks skid ;-)

...strange that ... I even have the IDE running in gtk (using either 3.6 or 3.8 gtkhtml lib)...
But as stated.. my gadget freeing requires a good bit of going thru and making sure it frees the right stuff...

There's a tests folder with the mod. Perhaps you can try the basic "createhtmlview.bmx" with some different urls ?

Over the weekend I've got key-acceleration stuff running, sorted treeview expand / collapse, and have working popup menus.
Oh, and clicking in a textarea generates a gadgetselect event now too (so that you can track the cursor properly)

You may notice that menus sometimes appear with icons... I've got it mapping menu text to gtk stock ids, so that the menus can look more "natural" if you use the correct names. eg. a menu called "Save" will automagically have a save icon and the standard short-cut key etc.
At the moment the mappings are ALWAYS used if it finds one, but perhaps I should consider adding a flag that you can set (or not) if you wish to have this functionality enabled.

As for the key-stuff... I've gone through the gtk / max key mapping but not tested it thoroughly - only in as much as running it in the IDE and having it pop up stuff when I press F3 etc...

Still to do :
Radio button
Canvas
Panel pixmap

will post the newer code later...


Chris C(Posted 2006) [#20]
keep going Brucey! great work, nearly there!


Brucey(Posted 2006) [#21]
You can get the current (0.91) gtk module here.
It has the new features as mentioned in my previous post, as well as radio buttons (I've only tested this on a window - not in a panel as yet).
Also added EVENT_GADGETOPEN and CLOSE to the treeview, and got SelectedTreeViewNode() and ModifyTreeViewNode() working.

I guess next stop will be the Canvas...

If anyone has *any* thoughts on the best GL widget implementation to go with, now would be a good time to mention them....
I'm going to attempt to get gtkglext working....


Enjoy :o)


Mark Tiffany(Posted 2006) [#22]
Good work Brucey!

You mentioned compiling the IDE using this - whenever you feel your code is in a position to do so I'd like to post a gtk version of the linux CE IDE on the SF.net site. We'd no doubt need to make sure it's identified as being experimental, but I'm thinking it may prove useful to highlight any issues.


Brucey(Posted 2006) [#23]
Good idea Mark.
I haven't tried the CE IDE yet with it - been focusing on getting the core stuff running my tests and the official IDE.

I've found the gtk textarea to be well capable of running underneath the IDE's syntax highlighter. And it should be even better with the new lexer.

:o)


Mark Tiffany(Posted 2006) [#24]
Cool, just send me a copy by email when you're ready and I'll pop it up on SF.net.


skidracer(Posted 2006) [#25]
I'm on holiday this week, but might grab my linux machine from the office if I get bored as I'd like to help with the canvas implementation.

Hopefully you won't need ANY opengl on your end as AttachGraphics takes an xwindow handle and flags, this is the relevant code from fltkgadget, hopefully you can create a panel with it's own xwindow and be away.

' canvas
	
	Field	driver$
	Field	canvas:TGraphics
	Field	canvasflags
	
	Method AttachGraphics:TGraphics( flags )
			canvasflags=flags
	End Method
	
	Method CanvasGraphics:TGraphics()
		If Not canvas
			canvas=brl.graphics.AttachGraphics( flCanvasWindow(flhandle),canvasflags )
		EndIf
		Return canvas
	End Method


fltk needed some nasty cludging to get a colormap/visual combo which I think had to be shared by all contexts, but i think you will be fine ignoring that.

	XVisualInfo *visual;
	Colormap colormap;	

public:

	Fl_Canvas(int x,int y,int w,int h,const char *title):Fl_Window(x,y,w,h,title) {
		enabled=1;mode=0;visual=0;
	}

	void setenabled(int yesno) {
		enabled=yesno;
	}

	void setmode(int gfxmode) {
		mode=gfxmode;
	}

	void show() {	
		if (window() && window()->shown()==0) return;	//parent is hidden so must defer
		if (shown()) {Fl_Window::show(); return;}  // you must do this!
//		static XVisualInfo *visual;
//		static Colormap colormap;	
		if (!visual)
		{
//			visual=glXChooseVisual(fl_display,fl_screen,glspec2);
			visual=_chooseXVisual(mode);
			colormap=XCreateColormap(fl_display,RootWindow(fl_display,fl_screen),visual->visual,AllocNone);
		}
		Fl_X::make_xid(this,visual,colormap);	
	}


ps I found hidegadget more troublesome to implement than freegadget


Brucey(Posted 2006) [#26]
Cool... thanks Skid !! :-)

Turns out it only took 1 line to implement it, rather than using a 3rd-party lib (which is where I'd been heading).

As you say, I only had to find the xwindow attached to the gadget - which was simply a bit of reading and some trial and error.

I now have the CreateCanvas test running (that "clock" thing), but currently without mouse / key events - just need to add the signals for those, hopefully...

Of course, someone will need to give it a good thrashing to see what else on the Canvas needs tweaking!

Max rocks ;-)


Brucey(Posted 2006) [#27]
Implementation question :

In gtkcommon.bmx, I have the following imports :
BRL.Graphics
BRL.GLGraphics
BRL.Max2D
BRL.GLMax2D

since these are only useful for Canvas gadgets, would it be better to have the user specify them in their app, rather?


Mark Tiffany(Posted 2006) [#28]
It feels like it might make sense for the whole canvas implementation to be an extension of maxgui itself. Then if you want to write something with just standard windows components, you just:
Import BRL.Maxgui

If you want something with graphics, you would:
Import BRL.Maxgui2d

which itself imports BRL.maxgui etc.


Brucey(Posted 2006) [#29]
Hallo :-)

I've decided to leave out those imports from the module... cuz it seems to include the GL stuff - which you don't need if you aren't using a canvas...
The developer will have to find the correct imports ;-)


Anyhoo... here's the latest gtk module with Canvas.
There are a couple of tests to play with - glcube and CreateCanvas.
Of course some "real" apps should be run against it to see what else needs fixed.

One note, the canvas key-down event seems to repeat...

Oh yeah... and it doesn't require any 3rd party GL widget thingy ;-)

Have fun :o)


Brucey(Posted 2006) [#30]
Last update for the day.

This is release 0.93.

This makes the IDE much more usable, and includes the following :
Fixed textarea clipboard actions.
Fixed textarea setText.
Fixed RequestFile save button text.
Fixed font size issues.
Fixed Tab sizing.

Specifically, the IDE doesn't crash when choosing a font now ;-)

If you find any things that don't work, please list them here, so I can go through them.

Skid, if you'd like something to do, perhaps you have an idea about the repeating key-down events on the canvas?

Cheers and enjoy! :o)


Brucey(Posted 2006) [#31]
Yet another...

This is release 0.94.

stuff done...
* TGTKButtonCheckBox now extends TGTKToggleButton like it was meant to. SetSelected now works for it
* Textarea background color now setable. Textarea SetStyle now creates tags on the fly - rather than caching them - dunno if this will be a memory issue.


:o)


Brucey(Posted 2006) [#32]
Friday already...

This latest 0.95 release includes support for key-filters....

...which enables things like tab-key block-indenting and auto-indent in the IDE.

One big issue left with the IDE under GTK is undo which is currently rather broken. I have yet to dig into how the undo stuff works, so I'm not sure what I've missed in the GTK code that causes it to do weird stuff.

It's the only thing stopping *me* using the IDE in GTK full-time now - since undo can be rather useful, and one gets into the habit of pressing ctl-z without noticing usually.

See other post on debugging to see what needs changed in appstub.linux.c to stop the debugged app going mad...

:o)


Brucey(Posted 2006) [#33]
Last excitement before the weekend...

This 0.96 release fixes the problem of Undo not working correctly in the IDE.

It's getting there :-)


skidracer(Posted 2006) [#34]
Managed to have another quick look today.

I did get the IDE to open (my bad) but still not having much luck with the htmlview.

A few things I spotted in processURL, gtk_html_write is being called with a string not a cstring???

Also in same method I moved the gtk_html_end call to below the stream <> null block as it causes some pretty nasty hangs if it's not called.

Mark added a new EVENT_KEYREPEAT event the other day, so will look into generating that in the xevent handler which can hopefully be hooked up to gtk panels and canvas without too much fuss.


Brucey(Posted 2006) [#35]
Thanks skid.

TBH, I've only looked at the htmlview enough to get it running in the IDE - for which it works well on the two systems I've tried it. That said, if it tries to access a page that doesn't exist (or it can't find), it'll appear to hang for a while before returning a blank page.
When testing an IDE, you need to make sure, I think, that it either has it's own doc folder, or you run the exe from the BlitzMax folder - in order that it can find the docs.

Here's a new update (0.97) that includes the following new bits :
* Tabber now supports tooltips. Tabber will show scroller if too many tabs.
* TextField (pressing return) can now activate Default Gadget.
* Added SetPointer().
* Fixed excessive window SIZE events.
* Fixed List missing 'extra' data.
* Fixed some Gadget freeing issues.

I am now using the gtk IDE to develop with, as it is quite stable on my system.

The "splitter" in the IDE needs an overhaul by the looks as I'm having the same issues in GTK as I had in fltk with it.
The problem is that it's not using the "live" GadgetX/Y to refer to it's current position, and things kind of go crazy as you move it. (perhaps this is a *bug* ;-)

Some things that still need looking at with GTK :
* panel pixmaps (no idea where to start with that really)
* stepper - gtk comes with one, but it includes a text field box already. So I dunno.
* tabber and combo can apparently show images as well as text - according to the docs. Will need to add that.

There's other stuff too, I'm sure.

Needs people to test it and see how they get on with it.

:o)


Mark Tiffany(Posted 2006) [#36]
The "splitter" in the IDE needs an overhaul by the looks as I'm having the same issues in GTK as I had in fltk with it.
The problem is that it's not using the "live" GadgetX/Y to refer to it's current position, and things kind of go crazy as you move it. (perhaps this is a *bug* ;-)

I'm not surprised. TBH, I've left that code well alone, as I'd rather get a much beefier GUI layout mechanism in place. My Linux PC is stuck in a cupboard at the moment, will try to have a play with this in the next week or so.


Brucey(Posted 2006) [#37]
I'd rather get a much beefier GUI layout mechanism in place

bit OT, but I was thinking perhaps something along the lines of what eclipse has, where you can divide the editor into various areas as you like - all resizable etc.
That way people could please themselves.


I had a go at running maxide2 under gtk last night. Apart from some fltk-specific code in there (which I commented out for now), it seemed to work okay, except for resizing the window - the panels stayed where they were - not sure if this is my bug.
All the menu-text changes (for languages) I see, which helped me with a menu-SetText bug I didn't know I had.
Will stick with the BRL gtk IDE until I can suss out the issues.


Mark Tiffany(Posted 2006) [#38]
bit OT, but I was thinking perhaps something along the lines of what eclipse has, where you can divide the editor into various areas as you like - all resizable etc.
That way people could please themselves.

Precisely. I've yet to start coding it up, but I have been thinking about it quite a bit over the past couple of weeks (while not being on holiday or watching footy or playing Naked War). The idea being to have the IDE contain whatever "GUI regions" you want, with them all resizable, etc. Then you choose to show whatever "GUI element" you want in those regions, e.g. code, help viewer, help nac, code nav, output, debug, etc. Some regions / elements will allow multiple elements inside then with a related "GUI navigator" attached : e.g. the region containing the code "element" will link to a navigator (tabber).

If you're interested, look at the type structure mindmap in the maxide2\docs folder. Any thoughts welcome!


Brucey(Posted 2006) [#39]
Time for another update...

This latest 0.98 release fixes a few problems :
* Fixed Panel position bug.
* Fixed menu SetText issue.
* Changed window sizing/positioning *again*. Still not entirely happy with it.

The window stuff has been hard work, and probably not entirely sorted out yet.
But, it is stable enough to run the IDE under it : Download from here
(oh, and don't forget, if you intend debugging from this, you will need to add signal(SIGPIPE, SIG_DFLT); to appstub.linux.c - see other thread for details)

I now use it exclusively in linux - rather than the fltk one.

Still lots to do....

Comments, ideas, etc, appreciated.

:o)


LarsG(Posted 2006) [#40]
Great work Brucey..
I, personally, haven't tried it yet, but it looks like you've put *alot* of work into it.
Maybe BRL would like to incorporate it when it's more or less feature complete.. :)
Options are always good.. :)


Brucey(Posted 2006) [#41]
Thanks Lars :-)

Here's an update of the gtk IDE which loads source files exponentially faster.
Alas, for this to happen, it requires an IDE hack and a gtk-only feature of the TextArea.
For the 1 or 1.5 people that are interested in the technicals.... ;-)
... The gtk TextBuffer does colouring using what are called Tags. You simply create a tag of attributes you'd like to apply to some text then set some area of the text with it. It even has a TagTable that lets you cache different types of tag so you can reuse them.
All great and good... but there are some problems when plugging this into max... When you add a new tag it becomes the tag with the highest priority. Therefore if you were to apply colour to a word, and then apply a different color using a tag created before it, it would still show the other color. Ack... what to do? Fortunately, you can remove tags before applying them to the given text. Alas, you need to do a "remove all tags" on the area to clear it first, which is slowwwww.
So imagine doing the following for each syntax highlighted word :
remove old tags
apply new tag
...loading anything more than a few hundred lines of code is mind-numbingly slow.
My hack...
The IDE knows which section of text it wants to re-apply the colouring to (be it the complete file on loading, or the current line etc), and it first sets that whole area to the default style before iterating through and highlighting it. This is good... I add some code which flicks a "fastUpdate" flag to OFF when it "clears" the highlighting (enabling the remove tags functionality), and the set it ON for the highlighting (which doesn't perform and remove tags, since it doesn't have to!).
And it's *very* fast.
Even better was running the CE lexer test on it.
On my libxml mod (3000+) without the hack, I almost fell asleep waiting for it to show the code. With the hack, it was quick between 1-2 seconds. I doubled up the code to nearly 7000 lines and it took the same amount of time!

Anyhoo... this is the problem trying to kludge a specific UI to work in a standard cross-platform implementation....

Oh, and I also added a SetPointer to the source loader so you see a "wait" pointer while it loads, so you can see it's doing something... (should have been there anyway IMHO)

Have fun :o)


Brucey(Posted 2006) [#42]
Things are continuing to improve on the gtk front.

The changes for the 0.99 release include :
* Improved textarea SetStyle speed - added setFastUpdate() method."
* HTMLView fixes. NONAVIGATE now *correctly* raises event on link-click
* Added Window maximize/minimize state awareness, and Window restore
* Added WINDOW_TOOL functionality
* Added window setIcon() method
* Enabled EVENT_WINDOWACTIVATE. Added x,y,w,h to window size / move events. Enabled ActivateWindow()
* Added SetGadgetToolTip() function
* Fixed Tabber visual issues. Added Tabber icon support

I'm also including the gtk IDE built on top of the latest gtk module (0.99).

The Stepper and Panel pixmaps are the only outstanding missing features.
Since gtk has no max-type stepper, but instead a spinner which already includes a text field, it looks like I might have to come up with something from scratch. Ho hum.
The panel pixmap... well, I haven't even looked at it to be honest. It will require scaling / tiling and stuff to implement, and perhaps a tad out of the scope of my experience :-p

Of course, if anyone wants to start testing this, and perhaps report back on any issues they have, it would be most appreciated.
It's certainly stable enough to use, and in fact, on my work PC the gtkIDE opens .bmx files much faster (running in vmware player) than the native win32 version.

I am *very* happy now that I have a useable IDE on linux - which was the whole reason for me to embark on the project.

gtkhtml has issues with style sheets and id's in table tags (rather than using a named anchor). I have a version of docmods (with only a few minor changes) that generates html suitable for viewing in the IDE. If anyone is interested.

Programming in linux, can be enjoyable.... :o)


skidracer(Posted 2006) [#43]
Excellent! Will check it out in the morning.

I'll have a go at implementing panels using canvases, I'm guessing it will be relatively straight forward.


Brucey(Posted 2006) [#44]
I've built *everything* on top of gnome_canvases.

I had originally used the "fixed" container, but it lacked usefullness, so instead turned to using the gnomecanvas as my base container widget.
It actually works really well - once you get the hang of its quirks.

Apart from the "fixed" positioning of widgets, gnomecanvas also gives me access to changing its color (which is working for panels) and in theory, displaying images on it. ( http://developer.gnome.org/doc/API/2.0/libgnomecanvas/GnomeCanvasPixbuf.html )

btw, gtk is very cool when it comes to adding functionality. For example, I needed to support icons in tabber tabs. Normally, you would only show a label in a tab, but with a few extra tweaks you can work some magic...
tabber tab container, holding ->
    event box container (for tooltip support), holding ->
        hbox container, holding ->
            image widget (either hidden, or shown with pixbuf)
            label widget


:o)


AlexO(Posted 2006) [#45]
Thanks alot for your hard work Brucey :). I can finally start using Linux now :D. I'll be using this ide and I'll report bugs/issues that I find as I develop my next game.


SebHoll(Posted 2006) [#46]
Brilliant module Brucey (v.0.99). The GTK GUI for Linux seems a lot nicer and easier to use than the FLTK one. Also, cross-compatability works a lot better on it as my project that runs fine on Windows will refuse to work on Linux using FLTK, but near perfect with GTK.

In addition, the GTK Linux IDE is soooo much better than the FLTK one (namely, the web browser) and is actually usable. While I've been trying some test code, I thought I'd share a few improvements that would perfect this module:

> The GTK module can't handle CHILD windows, i.e. ones grouped to a parent window (they minimize with parent windows, they can't leave parent's area etc.). You can see this in the IDE you compiled when showing requestors, e.g. Find (Ctrl+F). Minimize the main window and the Find window still remains.
> The GTK file (or it might have been directory) requestor appears slowly on my Ubuntu 6.06. It loads fine but navigating between directories takes about 10 seconds. Evident in the IDE.
> Panel Pixmaps aren't yet supported but would be a welcome addition. I wish I knew how to program Linux API so I could help code it myself.

Other than that, fantastic!!! To me it seems to be working better than the official one and has fewer bugs!

Keep the good work up, thanks,


Seb


AlexO(Posted 2006) [#47]

> The GTK file (or it might have been directory) requestor appears slowly on my Ubuntu 6.06. It loads fine but navigating between directories takes about 10 seconds. Evident in the IDE.



I've stumbled upon this too but with different symptoms. When I navigate between directories to open a .bmx file it simply stalls until I click on another window and click back to regain focus. I have to click a folder, click web browser (for example) then click back to the open dialogue for it to show the next level.

I'm running on Ubuntu dapper 6.06 if that helps with anything.


Brucey(Posted 2006) [#48]
Hi guys,

I believe this is an issue with the window manager / version of GTK.
On both my systems (ubuntu 5.10 and FC4) I haven't had this problem, but I know someone with 6.06 that did, and he tried a different window manager, which solved it.

I had a look on some forums, and people had reported speed issues on file requesters using apps like gimp and firefox, but there doesn't seem to be anything very specific as to why it affects some apps and not others.
It's also possible that the directory requester is looking for mounted / shared / network drives every time....

Perhaps someone might want to install a different wm and see if that helps?
http://www.icewm.org/
hmmm... there's a *lot* to choose from, actually : http://xwinman.org/

Can maybe anyone who *isn't* having speed issues with the dir-requester post their linux version?


SebHoll(Posted 2006) [#49]
I've stumbled upon this too but with different symptoms. When I navigate between directories to open a .bmx file it simply stalls until I click on another window and click back to regain focus. I have to click a folder, click web browser (for example) then click back to the open dialogue for it to show the next level.

Just tried GTK again, and tried the switching window thing, and the requestor kicks back into life after it has been done. So it looks like me and Alex have the same problem. For reference, I'm running Ubunutu 6.06 (dapper) as well which can't be a coincidence.


Brucey(Posted 2006) [#50]
Greetings :-)

Okay... I'm about done with this coding lark for now. Nearly everything (except for Panel Pixmaps) appears to work now, so I'm happy enough to give this a version *1* release.
Here's the 1.00 release changes/additions :

* Added label, textarea, progressbar tooltip support.
* Added progressbar GetValue().
* Changed combobox to extend TGTKList. Added combobox icon support.
* Fixed combobox missing 'extra' data.
* Fixed treeview Free() crash.
* Tweaked menu SetSelected to work in a more 'Max' way...
* Keymapping improvements.
* Implemented ACTIVATE_REDRAW, SelectTreeViewNode().
* Default F10 accel remapped to alt-F10 if app requires F10 hot key.
* Modified window/panel layout code based on source from Simon Armstrong.
* Added TEXTFORMAT_UNDERLINE and TEXTFORMAT_STRIKETHROUGH.
* Added lost-focus handling - only enabled for textfield and textarea for now.
* Added SetText, GetText methods.
* Implemented UTF8/unicode string handling.
* Added working stepper. It works, but it ain't nice...

It includes the *latest* additions to MaxGUI, so you should probably syncmods or it won't work (lostfocus and new TextFormats).
Also, it now support UTF8 properly, so .max files with "funny" characters won't break when loading into the IDE, and of course all the gadgets should happily display most character sets.

Oh, and here's the gtk IDE built on the latest module.

As usual, any problems / comments, feel free to let me know and I'll see what to do about sorting things out.

Enjoy

:o)


SebHoll(Posted 2006) [#51]
Hi Brucey,

Thanks once again for the brilliant module! Now as far as problems go, just thought I should mention (in case you didn't already know):

1) The slider on the IDE still doesn't work well. I've had a look myself and I can't work out what's wrong as it's just simple calls to SetGadgetShape() unless there's some bug in GTK's SetGadgetShape() that aren't apparent unless in this situation.
2) The IDE sometimes crashes (program immediately terminates) when double-clicking on a module reference in the Help tree view pane.

But apart from that, this IDE is a lot better than the official FLTK one so I recommend it to any BlitzMax Linux users out there.

As far as suggestions go, the only feature I could really do with (but is missing) is the SetPanelPixmap() feature. I've had a look at the code for Panels and it seems you are creating them as GnomeCanvas'es. This gave me an idea, how about when SetPanelPixmap() is called, GTKMaxGUI draws the pixmaps onto the canvas as if it were a canvas (which it is), using Max2D drawing commands. I've tried to replicate the image panel flag stretching styles in the code below if that's any help:



Thanks


Seb


Brucey(Posted 2006) [#52]
Greetings :o)

you can now get the latest updates to the gtk module via syncmods :
syncmods -u your_user_name -p your_password bah.gtkmaxgui


1.01 is now available with the following changes :
* Enabled child/parent window relationships with WINDOW_CHILD.
* Fixed listbox left-click to raise SELECT event. Added listbox double-click ACTION event.
* Added list/tree right-click MENU events.
* Fixed tabber redrawing frenzy - hopefully.
* More panel layout tweaking.

...
For child windows, you should, as well as indicating the parent window (as the group parameter of CreateWindow), use the WINDOW_CHILD flag.
With windows created in this way, when the parent is minimized, the child window is also minimized.
As for the child windows in the IDE, they do not populate the "group" param of CreateWindow and so will not work in the expected way - this would be a bug in the IDE ;-)

The tabber redrawing issue turned out to be related to the way in which the canvas redraws in 512 pixel sections, whereby a tabber greater that this would have multiple redraws issued (1 + width/512), of which I hopefully now ignore the correct number. (worked in my limited testing anyways).


Seb, not sure what issue you have with 1) exactly. With which slider (and on which window/panel) do you have problems?

Also, the problem with the IDE crashing when you double-click on the Help tree view. Do you mean in particular the docs reference entry in the list, or a .bmx file?
I have had neither be a problem here, but it may be something to do with the htmlview (if it's the former).
Ideally, you want to be using a slightly tweaked version of docmods anyways, as gtkhtml can't properly see anchors in tables when they are specified as "id=...". In my docmods, I simply added a <a name="..."></a> snippet in the relevant place, so that it worked better.

I know there is a wee issue concerning the way the IDE hides textareas and stopping in debug - in that when the IDE attempts to highlight a line for you on a textarea and then switches to that view, the cursor appears at the start of the line but the line is not highlighted. This appears to be because of something else going on with either hidden textareas not retaining their "selection" state, or perhaps the IDE subsequently setting the cursor position (and thus invalidating the selection).
Of course, the main problem here is that gtk doesn't immediately update visuals, and sticks them on some kind of queue, which means that you may "ask" it to show something, but it will only do so when it is ready to..

Seb, your idea for the panel pixmaps is good, but a gnomecanvas and a Max canvas are not the same. However, I'll probably have a look at perhaps doing something similar (or suchlike) next, as I'm running out of things to do. (excluding of course the ongoing work on libxml, libxslt, fontconfig and cairo)...
I didn't even know there *was* a ResizePixmap() function - just goes to show how much attention I pay...

Well, as usual, see how you get on with the latest version...

:o)


skidracer(Posted 2006) [#53]
I've been knee deep in other stuff and have been meaning to try it myself but I really do think you should try implementing panels using a plain canvas gadget (max gtk canvas implementation you already have) adding a few panel specific properties and drawing the different modes with max2d commands, ie

field panelimage
field panelmode
field panelred,panelgreen,panelblue

method setpixmap ()
  panelimage=loadimage(pixmap)
end method

method redraw()
  setgraphics 
  setviewport
  setclscolor panelred,panelgreen,panelblue 
  cls
  if panelimage
    select canvasmode
      case PANELPIXMAP_TILE
        setscale
        drawimage drawimage drawimage
      case PANELPIXMAP_CENTER
        setscale
        drawimage 
      case PANELPIXMAP_FIT
        setscale
        drawimage 
      case PANELPIXMAP_STRETCH
        setscale
        drawimage
    endselect
  endif
  flip
end method

etc. etc.



SebHoll(Posted 2006) [#54]
Thanks for another update, Brucey. Having a few problems though... Firstly, thanks for the WINDOW_CHILD thing - it's just what I needed.

I've just downloaded the latest MaxIDE source I could find (v1.20d) from the code archives and tried to compile it using the latest version of GTK, and the slightly older v1.00 one. For both, I get the error message:
*** glibc detected *** free(): invalid pointer: 0x084bf1f8 ***
...just as the window is starting to be initialised, and the program terminates. I tried compiling it in FLTK and it is fine.

I put a DebugStop to find out where it seems to be crashing, and the program terminates at about line 4820 (may be different on your source), on the command navbar.SelectView 0 but when stepping through onto this line, I don't get the above error message, it just termiates.

Max'd GUI, when compiled, runs fine so it doesn't look as though it is a problem with GTK. If nobody has any ideas, please could you compile the source for us so we can use your new GTK v1.1 IDE.


Thanks

Seb


SebHoll(Posted 2006) [#55]
On a different note, I think that I've found a bug...

Run this sample program and try to resize the child window. After a few resizes, you should notice the child window jump down, and an EVENT_WINDOWMOVE event triggered. It's sporadic but a real problem...



Because it is random, I can't seem to find what it causing it. Do you have any ideas?


Seb


P.S. If you can't see it, let me know and I'll try to find a better example.


SebHoll(Posted 2006) [#56]
Found an even bigger bug that isn't random, (that is probably related):



Seems like a problem either with ClientWidth()/ClientHeight(), GadgetX()/GadgetY(), or SetGadgetShape().

Edit: The same also happens when the window isn't WINDOW_CLIENTCOORDS, and you use GadgetWidth()/GadgetHeight() instead.


Brucey(Posted 2006) [#57]
Well, I had a go getting panel pixmaps to work using the max2d way, and it did draw things as expected. However, I couldn't get any gadgets *on* the canvas to appear any more - where if for example I had a button on a panel, if I moused-over it a grey outline would appear where the button was, and it would even accept button-presses.

So, in the end, I've opted for using gdk pixbufs, which support scaling, and can be added to a gnome canvas as a canvas item (much like all the other widgets do), and it seems to work okay.

I've uploaded a new (1.02) version with the following changes:

* Added panel pixmaps : currently only FIT, STRETCH and CENTER are working.
* Fixed some issues with SetGadgetShape on a window. Now attempts to ignore SetShape-driven events.


Seb, it seems I'm not doing much in the way of supporting WINDOW_CLIENTCOORDS at the moment, which is why it doesn't handle some things correctly when that is enabled for a window.
However, I've tweaked some of the size/move event handlers which fix some of the issues you've been having (see the "sebtest_x" tests in the tests folder)... But not all.
Will see next what I need to do to better handle clientcoords...

I'll have a look into that IDE bug too...


:o)


Brucey(Posted 2006) [#58]
Here's a link to the 120d IDE compiled with the gtk module. Also included is the modified source.

Seb, I had no issues running this.
Only changes I've made :
* changed Framework to bah.gtkmaxgui. commented out fltk import.
* added fastupdate support for editor - search for "fastupdate" in the source to see what I did - one section, a couple of extra lines. It just makes it load/parse the code *much* faster.

Let me know how you get on...

:o)


SebHoll(Posted 2006) [#59]
Thanks for adding Pixmap support... Max'd GUI looks a lot better now. I've downloaded and tried the 120d IDE you posted and when it is double-clicked it opens and closes immediately. I tried running it from the terminal to find out which error message it throws up and it is (surprise, surprise):

*** glibc detected *** free(): invalid pointer: 0x084bf1f8 ***
I'm running Ubuntu 6.06 Dapper (CD version), on a Pentium 3 laptop, with 256MB RAM, 850Mhz CPU.

Edit: I found out that I can compile and successfully run the original MaxIDE v120 source that comes with Max with the latest release, but I can't with the v120d source code.

Is there a debugging program I can run on Ubunutu that checks packages and stuff when running a program, and that gives me a bit more information than the *** glibc detected ***? I've tried a Google search but it just brings up program specifix fixes etc.


SebHoll(Posted 2006) [#60]
Another bug report for you Brucey, although it's not really a bug, more of an inconsistency...

Basically, in Win32, Cocoa, and FLTK, changing a gadget's properties programatically (e.g. using SetGadgetText(), SetButtonState() ) doesn't trigger a GAGDET_ACTION event. However in GTK, it does.

Framework BaH.GTKMaxGUI
'Framework BRL.FLTKMaxGUI
Import BRL.Timer

Global wndMain:TGadget = CreateWindow("Hello",100,100,400,300,Null,15)
	Global gadTextBox:TGadget = CreateTextField(10,10,370,20,wndMain)
	Global gadCheckBox:TGadget = CreateButton("Test Checkbox",10,30,370,20,wndMain,BUTTON_CHECKBOX)
	
	CreateTimer(1)
	
Global varSwitch:Int = 0

Repeat

	Select WaitEvent()
		
		Case EVENT_WINDOWCLOSE;End
		
		Case EVENT_TIMERTICK
		
			If varSwitch = 0 Then
		
			SetButtonState(gadCheckBox,1)
			SetGadgetText(gadTextBox,"Test Text")
			varSwitch = 1
			
			Else
			
			SetButtonState(gadCheckBox,0)
			SetGadgetText(gadTextBox,"")
			varSwitch = 0
			
			EndIf
		
	EndSelect
	
	DebugLog CurrentEvent.toString$()
	
Forever


Have a look at the debug log as the gadgets are changed with a) FLTK and then b) GTK.

Cheers Brucey

Seb


SebHoll(Posted 2006) [#61]
Another one, however it maybe that it hasn't been added yet, instead of a bug:

When a gadget has "&" in its text (in Win32, Cocoa and FLTK), the next letter after it is underlined, the ampersand removed and the gadget becomes sensitive to Alt + Next Letter.

Here some code for testing...

'Framework BaH.GTKMaxGUI
Framework BRL.FLTKMaxGUI
Import BRL.Timer

Global wndMain:TGadget = CreateWindow("Hello",100,100,400,300,Null,15)
	Global gadCheckBox:TGadget = CreateButton("&Test Button",10,30,370,30,wndMain)
	
Repeat

	Select WaitEvent()
		
		Case EVENT_WINDOWCLOSE;End
		
	EndSelect
	
	DebugLog CurrentEvent.toString$()
	
Forever


P.S. Brucey, I hope you don't mind me posting so often. As Skid will tell you, I do post a lot of bug reports for MaxGUI...


Brucey(Posted 2006) [#62]
Hi Seb, thanks for the reports...

You might like to try running the crashing IDE in strace...
strace ./gtkMaxIDE

It will create a "stack" trace and may help pin down where it blows up. Unfortunately, Max doesn't create any useful symbols so if it crashes inside Max code (rather than in say, a gtk lib) it'll be a bit harder to track it down.
I've also used gdb (gnu debugger) on max code to track down some problems in the past, but it's not the easiest program to get to grips with.
If strace produces anything remotely coherent, you might want to post it in a codebox here...


The GADGET_ACTION event must be being raised by the SetButtonState... so I will wrap that so that it doesn't.

The ampersand thing... I only coded it for Menus - silly me - not thinking about buttons etc... I presume it is *only* buttons that need this?
Will sort that out too :-)

P.S... feedback is very much appreciated, and definitely required if improvements are to be made.
As Skid will tell you, I do post a lot of bug reports for MaxGUI...

Yeah, you tend to find a lot of bugs when writing a GUI editor, like I have with GED ;-)


SebHoll(Posted 2006) [#63]
Running the IDE in strace (thank's for letting me know) gives:



I noticed the ***glibc*** message at the end but I can't make anything else out of it. I've tried to use gbd, by type "file ./gtkmaxide" and then "run" but all I get is a load of "no debugging symbols found" before the program halts and doesn't print anymore??? (possibly where it has crashed, but I'm not sure).

The ampersand thing... I only coded it for Menus - silly me - not thinking about buttons etc... I presume it is *only* buttons that need this?
Will sort that out too :-)

In Windows, the ampersand thing appers on all button types - e.g. checkboxes, option button and standard push buttons. I don't think there are any more. Also, are gadget hotkeys (e.g. Ctrl+O) added to buttons or just menus at the moment?

The GADGET_ACTION event must be being raised by the SetButtonState... so I will wrap that so that it doesn't.

It seems also that SetGadgetShape() on Windows, generates an EVENT_WINDOWMOVE / EVENT_WINDOWSIZE event that should be surpressed as well for compatibility with the other modules.

I don't know much about Linux API programming but I may be able to help you with certain BMax areas of GTKMaxGUI so if you need any help, I'll try my best. You've done so much already, it's the least I can do.

Yeah, you tend to find a lot of bugs when writing a GUI editor, like I have with GED ;-)

What's GED? Are you writing a gui-editor too? Looks like we are in competition, :-P. Have a look at mine (Max'd GUI) in my signature, and if you're interested in any part, let me know.

Finally,

P.S... feedback is very much appreciated, and definitely required if improvements are to be made.

Come on Blitz Community - show your support!!!


Thnx

Seb


Brucey(Posted 2006) [#64]
So strace isn't very helpful then ;-)

How's about, when running gdb, when the program crashes and the gdb prompt comes back, you try "backtrace" or "bt". I should give you something like a java stack-trace, which shows exactly where the program fell over - with function names etc (if it was in c-code at the time).
I'm betting I am freeing up something somewhere that has already freed itself - can't think of any other reasons for the message. And strangely it only happening on your linux and neither of mine...

I've got the textfield actions suppressed now. Just need to sort out "button" ones, which isn't going to be too tough. (well, I'd have it ready already, but I was playing with writing a mod for realtimebattle yesterday (yay... only took a day and a half!), which I've finished and only need to finish documenting. It's a lot of fun - building robots to battle in an imaginery arena. Not that I'm any good at it myself ;-)

As for the API, yeah, gtk is quite fully featured as far as things you can call goes - see gtkcommon.bmx for a list of gtk functions I'm using ;-)
Am looking forward to general take up of gtk 2.10 which introduces a printing API - which should make implementing that GadgetPrint thing easier.
And I also need to look at drag and drop support... ho hum...

Hotkeys? Dunno... I had a look at maxgui.bmx and it looked like it handled all that itself, so we'll have to see when someone tries to use it :-)


Brucey(Posted 2006) [#65]
Greetings,

the module has been updated to 1.03 with the following improvements :

* Fixed textfield SetText raising event.

* Added mnemonic functionality for buttons.

* Tweaked window client width/height to work on certain window types. Also takes into account status/menu heights on initial client height testing.

* Fixed crash on app end after freeing canvas.

* Fixed label SetText visuals.


As usual, you can get it via syncmods :
syncmods -u your_name -p your_password bah.gtkmaxgui


:o)


SebHoll(Posted 2006) [#66]
Thanks again Brucey for the update - I've just been on a power-boat course for the weekend so I've only just got a chance to visit BlitzBasic.com.

The updates to GTKMaxGUI are brilliant - they have made Max'd GUI from completely unusable to relatively stable.

I've made a small donation to you so get a beer from me for all your hard work. (Sent to @removed@ .)

A bug I noticed to do with "mnemonic functionality" for menus, which is that it breaks when the menu becomes checked...



Also, you know the PANEL_GROUP flag for CreatePanel, according to the docs:

PANEL_GROUP: Panel is drawn with a titled etched border.

In GTK, it seems that panels don't have a title above them, just the box.




Thanks


Seb


Brucey(Posted 2006) [#67]
Thanks very much Seb, it's greatly appreciated! :-)
I might just put it towards getting my powerbook fixed...

Glad things are working well for you, generally.

A bug I noticed to do with "mnemonic functionality" for menus, which is that it breaks when the menu becomes checked...

Which is funny, coz I thought I'd coded for that. I'm even sure I have a variable for just that case...

[quote]In GTK, it seems that panels don't have a title above them, just the box../quote]
Well... it *was* working... ahhh... my test uses SetText on the panel, not on the create... ;-)

Will try and sort these out tonight..

oh... and am thinking of re-writing the underlying layout engine to do away with gnomecanvas - as it has some quirks I could do without - also, it should end up much faster too.. but I work on that as a separate fork cuz it's a big job.

Many thanks :o)


SebHoll(Posted 2006) [#68]
Thanks very much Seb, it's greatly appreciated! :-)

No problem!

Will try and sort these out tonight..

Thanks!

oh... and am thinking of re-writing the underlying layout engine to do away with gnomecanvas - as it has some quirks I could do without - also, it should end up much faster too.. but I work on that as a separate fork cuz it's a big job.

That's great - Max'd GUI would *definitely* benefit from a speed increase in the Linux distribution.


Seb


Brucey(Posted 2006) [#69]
I'm very pleased to announce version 1.04 of the gtkmaxgui module. This version uses a completely re-engineered gadget layout mechanism, doing away with the iffy gnomecanvas. The change results in a much improved experience, with noticeable speedups in many areas - especially panels.

A summary of changes :

* *Engine Rewrite* - Now uses GtkLayout instead of gnomecanvas. Fixes a LOT of rendering anomolies. Should also be faster.
* Changed tabber redrawing back.
* Fixed check-menu issues with mnemonics and checking a menu initially with UncheckMenu.
* Fixed group panel not setting text on create.


As usual, you can pick it up via syncmods...
syncmods -u your_name -p your_pass bah.gtkmaxgui


Hopefully, I haven't added any new issues whilst ripping out the old stuff, but it's always a possibility...
Let me know how you get on with it - good or bad.


Enjoy :o)


SebHoll(Posted 2006) [#70]
Version 1.04 seems greatly improved as far as speed goes and the fixes all seem to work. Thanks!!!

Another bug report unfortunately... Radio buttons seem broken. Have a look at this slightly modified version of your createbutton.bmx test in your mod folder:



In the example, pressing a radio button makes the other radio button states irratic. I believe the correct radio button behaviour is that when a radio button is pressed, all other radio buttons within the same parent are unchecked and a single EVENT_GADGETACTION from the depressed radio button is fired. Also, they shouldn't toggle - pressing the same radio button repeatedly should result in the button remaining constantly checked. Hope this helps....

Also, I mentioned earlier about hotkey support for buttons etc (not just menus) and it still doesn't seem to work...



Something worth mentioning regarding this, is in Win32 and FLTK MaxGUI, assigning a modifier of, say Control, would mean you would be able to activate the button/menu using either the left or right Control key on the keyboard... on GTK, it only enables the left Control key on menus.

Only a few more things to go (e.g. tiling pixmaps in panels and drag n' dropping files onto windows) and this module will be complete... Well done Brucey!!!

A feature request: Would it be possible to implement something like in Windows where you can centralise, and right align text in the status bar by inserting the ~t (tab) symbol. It is used in the IDE where on Windows, the Line: # Char: # appears on the right and the function descriptions appear on the left. Run the following test in Windows to see what I mean:



I know it's part of the Windows API - which does it automatically, but would it be possible for the GTK module to parse the string for tabs and align the text itself, (on-the-fly), or not?

Thanks once again


Seb

P.S. Just out of curiosity, how do you upload custom made modules to syncmods?


Brucey(Posted 2006) [#71]
In the example, pressing a radio button makes the other radio button states irratic.

Perhaps I should test with more than two radio buttons... any more than that and it appears to have a mind of its own.

The splitting of the statusbar using tabs is maybe a no-go, I'm afraid, as a gtkstatusbar has no concept of left/middle/right where the text is concerned. Would require a fair amount of work to implement something similar, I imagine.

Will have a look into SetGadgetHotKey().
And you realize that standard hotkeys for buttons etc would be Alt on linux? ;-)

The left or right-ness of control keys might be out of my um... control, but I'll see if I can find anything anyways..

:o)


Brucey(Posted 2006) [#72]
ahhh....
The important thing to remember is that gtk_radio_button_get_group() must be called for each new button added to the group, with the previous button passed in as an argument.

As usual, it helps to read the API docs *properly* !!

Let that be a lesson to you all ! ;-)


Brucey(Posted 2006) [#73]
While I'm at it, other than buttons (push, radio and check), should SetGadgetHotKey() work for any other gadgets?


SebHoll(Posted 2006) [#74]
Nope - I don't think so... Buttons + Menus (already done) only...


Brucey(Posted 2006) [#75]
Greetings,

The latest version, 1.05 introduces the following changes :

* Fixed radiobutton problem with groups of more than two buttons.
* SetHotKey now working for buttons.
* Window statusbar text now supports three positions based on tabs.

sebtest_6.bmx shows off the statusbar enhancement.
This now matches both win32 and MacOS for text-formatting in the statusbar. (shame about fltk ;-)

You can get this update via syncmods :
syncmods -u your_name -p your_pass bah.gtkmaxgui



Still to do, in the big, black void of completeness...
* tiled panel pixmaps
* drag and drop support

Enjoy :o)


SebHoll(Posted 2006) [#76]
Another brilliant update...

* Window statusbar text now supports three positions based on tabs.

Thanks very much...

Found some more minor improvements...

> When a checkbox or radio button is fired, the state of the button should be passed with the event in EventData(). This isn't needed as such (as you can use ButtonSelected() individually) but the official MaxGUI modules use this method...

I had a play around and came up with this for the TGTKButton type (in gtkgadget.bmx):

Function onButtonClicked(widget:Byte Ptr, obj:Object)

	If Not TGTKButton(obj).ignoreButtonClicked Then
		PostGUIEvent(EVENT_GADGETACTION, TGadget(obj), ButtonState(TGadget(obj)))
	EndIf

	TGTKButton(obj).ignoreButtonClicked = False

EndFunction
> Radio buttons (along with checkboxes) should respond to the ButtonState() command as they do in the official mods, to find out which button is selected after the event was fired (and the state should also be passed with EventData upon EVENT_GADGETACTION being fired).

> This is being really picky, but I thought I would mention it anyway (:-P). You know the status bar, how it has a resize handle, well it seems to have a black border around the handle... Is it supposed to be there, or is it my dodgy Linux setup?

I'll keep on the look-out for any more minor adjustments that should be made,

Thanks


Seb


Brucey(Posted 2006) [#77]
Thanks very much...

Pleasure ;-)
But really, you should thank GTK for being so flexible. The way you can build your own widgets from the basic ones makes it great for hacking together things like that new statusbar.

You know the status bar, how it has a resize handle, well it seems to have a black border around the handle

I dunno why that is. It doesn't appear like that one either of my distros. What if you change your theme, how does it look then?
The only thing different with the handle is that the statusbar to which the handle belongs is only slightly wider than the handle itself - being placed in an hbox at the end of several labels.

...but I see now... I changed my theme, and on some themes it wraps the whole statusbar widget in a box...
There are two ways around this, I suppose...
1) is to try and use statusbar widgets throughout - instead of labels
2) is maybe to replace the handle with an image? (something theme neutral)...

I guess the former would look the best, but the latter would be harder to implement - there are two statusbar tests in the tests folder which shows what I tried before I came to the current implementation.
Might have a play with an image tonight... ;-)


SebHoll(Posted 2006) [#78]
I dunno why that is. It doesn't appear like that one either of my distros. What if you change your theme, how does it look then?
The only thing different with the handle is that the statusbar to which the handle belongs is only slightly wider than the handle itself - being placed in an hbox at the end of several labels.

Yep, changing themes makes it disappear. It's not really that big of an issue then, however if the changes I mentioned above (button events with missing EvenntData) could be added that would be great.

Edit: Another thing... Would you be able to update the GTK module to take account for Skid's latest OpenUrl$() Linux fix.

Thanks


Seb


Brucey(Posted 2006) [#79]
Yep, changing themes makes it disappear.

I've decided, for now, just to exclude the handle. Then it's theme safe. Unless it's very important to have a handle on a resizeable window...
If it is, then I'll rewrite that bit to use individual statusbars for the three sections. However, that would mean that the right-hand text wouldn't be right-aligned (I haven't been able to right-align text appearing in a statusbar), and would float somewhere "towards" the right side...
Personally, I'm happy with the way it appears using the labels..

Would you be able to update the GTK module to take account for Skid's latest OpenUrl$() Linux fix.

No problem :-)

button events with missing EvenntData

Was looking at that last night. Fixed some other issues with events being raised / setting states while I was there...

btw.. there's also some other things in the mod that might be of interest :
* Function SetAppIcon(pix:TPixmap) - sets icon for all app windows
* Function SetGadgetToolTip(gadget:TGadget, tip:String) - sets tooltip for most gadgets (that I could get it working with!)
* GTKWindow . Method setIcon(pix:TPixmap) - sets icon for specific window.

Would be nice if some of these made it into mainstream...


SebHoll(Posted 2006) [#80]
* Function SetAppIcon(pix:TPixmap) - sets icon for all app windows
* Function SetGadgetToolTip(gadget:TGadget, tip:String) - sets tooltip for most gadgets (that I could get it working with!)
* GTKWindow . Method setIcon(pix:TPixmap) - sets icon for specific window.

CoOoL! Thanks for letting me know... A question I wanted to ask (although slightly off-topic) is whether or not you can set an executable icon (the one that shows in the file explorer) in Linux (as you can in Windows / Mac OS X).


Thanks


Seb


Brucey(Posted 2006) [#81]
Greetings,

Version 1.06 introduces the following changes :

* Removed statusbar handle - theme issues.
* Improved button state handling.
* OpenURL now calls native-driver openurl.
* Added panel pixmap TILE support.
* Panel pixmaps can now be cleared.
* Removed libgnomecanvas dependency.
* Stepper now uses pixbuf to draw onto buttons.
* Added menu (EVENT_GADGETMENU) support to buttons and textfield.

As usual, you can get it via syncmods... (see above for details)

:o)


MVB(Posted 2006) [#82]
Hi.
Very good work so far. Just a few little problems:
1. Your 120d IDE doesn't work for me. It just opens an empty window and then crashes.
2. The normal IDE works with your module, but if I open a file with such "funny characters" the highlighting isn't correct.
3. The filechooser is really slow.

A cool thing would be to have MozEmbed for HTML-rendering.

Thanks


SebHoll(Posted 2006) [#83]
Thanks Brucey, great updates. Unfortunately, another bug, due to the layout of panels being different with GTK:

Framework BRL.Win32MaxGUI
'Framework BaH.GTKMaxGUI
'Framework BRL.FLTKMaxGUI

Global wndMain:TGadget = CreateWindow("Test Window",100,100,400,400,Null,1|WINDOW_CLIENTCOORDS)

	Global gadPanel:TGadget = CreatePanel(10,20,100,300,wndMain,PANEL_GROUP,"Test Panel")
	Global gadSlider:TGadget = CreateSlider(120,20,100,300,wndMain,SLIDER_VERTICAL)
	
	SetPanelColor(gadPanel,200,255,200)
	
Repeat

	Select WaitEvent()
	
		Case EVENT_WINDOWCLOSE;End
		
	EndSelect
	
Forever
Have a look at the panel, it is drawn too tall (>300 pixels) using GTK however it is 300 pixels high on Windows and FLTK.

Thanks

Seb


Brucey(Posted 2006) [#84]
@mvb
1. I managed to make it do the same, once, then tried to put some debug into it, and it's worked ever since :-(
So for now, I cannot reproduce it.

2. Can you provide me with an example of a file with the "funny" characters, as I thought it was handling UTF-8 properly now.

3. That's a known issue with Ubuntu 6.06 - at least, everyone using its default window manager have had issues like that. Changing the Window Manager fixes the problem.

A cool thing would be to have MozEmbed for HTML-rendering.

Yeah, now that things have settled down, I intended having a look at implementing that.
It would mean we'd have a "proper" html-view on linux for Max, finally.


@seb
My oops... I noticed that too, but forgot to change it for the last release.
If you want to try a quick hack...
Line 2987 or thereabouts looks like:
gtk_widget_set_size_request(handle, w, Max(h,0))
Just change it to :
gtk_widget_set_size_request(frame, w, Max(h,0))
...


MVB(Posted 2006) [#85]
2. Can you provide me with an example of a file with the "funny" characters, as I thought it was handling UTF-8 properly now.

Global blub:Int		'üüüüüüü
Global bla:Float		'äääääää


Thanks


SebHoll(Posted 2006) [#86]
Hi Brucey,

Another welcome release... Much obliged...

@seb
My oops... I noticed that too, but forgot to change it for the last release.
If you want to try a quick hack...
Line 2987 or thereabouts looks like:
gtk_widget_set_size_request(handle, w, Max(h,0))
Just change it to :
gtk_widget_set_size_request(frame, w, Max(h,0))

Lovely-jubly... Seems to work well (thnx) You probably hate me posting, but I've found another few bugs for the next release... ;-)



I've put a few comments in the source code for you to help you generate them.

Great work as always, keep it up,


Seb


SebHoll(Posted 2006) [#87]
Hi Brucey,

I've just sync'd BaH.GTKMaxGUI to my other Linux computer, and I get the following error whenever I try to compile:



I've had a look and my firefox path is: /usr/lib/firefox . I've tried setting LD_LIBRARY_PATH in /etc/environment however it doesn't seem to make any difference.

Any ideas?


Seb


Brucey(Posted 2006) [#88]
I tell you what is interesting... libxpcom_core.so is required by my FC5 install, but on my ubuntu, firefox doesn't have that file. (so it seems different versions of firefox have different sets of shared objects)... joy, joy and happy joy.
1.07 was probably a release too early. And a bit buggy anyway, when it comes to the htmlview. Sorry about that.
Watch this space..


Brucey(Posted 2006) [#89]
Yet another update... 1.08

* Split out HTML views into separate modules - see bah.gtkwebgtkhtml and bah.gtkwebmozilla.
* Fixed double-ampersand text displaying.
* Improved WINDOW_CLIENTCOORDS handling.
* Improved gadget positioning - no negative coords!.
* EVENT_MOUSEMOVE on panel/canvas now contain button-pressed value.
* Improved gadgeted freeing.

Also there are TWO new optional modules available. These allow you to choose which HTMLView you want to package (if any!) with your application. Currently it supports GTKHtml and Mozilla widgets...

* bah.gtkwebgtkhtml
* bah.gtkwebmozilla

To use one in your app you would have something like the following:
Framework BaH.GTKMaxGUI
Import BaH.GTKWebMozilla

If you don't need an HTMLView, don't import one, and it'll build your app without that library dependency.

Caveats ;-)
GTKHTML
------
Requires libgtkhtml-3.8

Mozilla
-------
Requires the path to the mozilla libs defined (either via LD_LIBRARY_PATH or by configuring it using ldconfig path/to/the/libs)
An environment variable can be set - MOZ_DIST_BIN - which the app will use to tell mozilla where it is installed. This sets a global string variable - MOZ_DIST_BIN.
The default value is /usr/lib/mozilla-firefox
You can override the value either by setting the environment variable, or by setting the blitz variable at runtime.
Also (isn't there always?)... some firefox dists appear to have different required files to import. In gtkwebmozilla.bmx there is a commented out line - Import "-lxpcom_core" - which you may have to uncomment for your distro. (of course, this could be a problem when attempting to run the app on a different box, but for now I don't know what to do about it).
Other than that, Mozilla provides a much enhanced web-standards supported browsing experience, which you may wish to persevere with...

hmmm. I should probably add more imports for the "lookup" paths for compiling. Currently there is only :
Import "-L/usr/lib/mozilla-firefox"
might want to add :
Import "-L/usr/lib/firefox"

:o)


SebHoll(Posted 2006) [#90]
Hi Brucey,

Thanks for the update, however it seems SetPanelColor() appears to have been broken in the meantime...



It might be my new linux set-up but I remember it used to work before syncmods. Also you know this...

Improved gadget positioning - no negative coords!.

Well, what do you actually mean... Do you mean gadgets can't be drawn at negative co-ordinates. If so, how would I be able to tweak GTKMaxGUI to disable this for Max'd GUI so that I can draw gadgets at -ve co-ordinates.

Also Brucey, I was wondering if I could pick your brains. Is there a way in GTK for me to make gadgets "see-through". I don't literally mean setting the transparency, but can you make a gadget not "suck-up" mouse-clicks so that the parent containers will receive them instead. (Let me give an example...)

I.e. if a button is drawn on a panel, would I be able to still display the button, but when the mouse moves over the button, the parent panel underneath still fires EVENT_MOUSEMOVE events while over the button. In Windows, I can acheive this by disabling the gadget (and as a kind of side effect, Windows seems to automatically pass events to the parent gadget)...

Finally, I can't get a HTML gadget to show with either module (GTKHTML or Mozilla). Mozilla still reports the above error message and GTKHTML compiles, but just displays a blank window...

I tried the example from the MaxGUI docs and I get the same effect (which I've pasted here for quick reference)...



Thank - you so much...


Seb


Brucey(Posted 2006) [#91]
Greetings,

New update, 1.09 :

* i18n enhancement - GTKTextArea.areaText and gadgets GetText now return ISO8859 strings.

Web modules are also updated...

This fixes a problem with Blitz strings not supporting UTF8 strings properly ;-)
Gadgets now return Strings in ISO8859 format instead of UTF8, which caused highlighting issues in the IDE.
What this means for non-latin locales, I've no idea really. I suppose I'll need to store the "original" string locale (if I can find out what it was) and use that when reverted back to a Max String... ho hum.


@Seb
it seems SetPanelColor() appears to have been broken

This works on mine ok. The panel appears as a lime green. Do you get *no* colour change or the wrong colour?

Do you mean gadgets can't be drawn at negative co-ordinates

Aye... On occasions a gadget would reposition itself to a negative coord (so I thought it better to disallow that to happen). It's an issue related I think to WINDOW_CLIENTCOORDS, which I'm still struggling with. Try sebtest_7 to see what I mean. - mouse over the panel and watch in amazement as the window resizes itself... *sigh*
Window sizing is a bit niggly...

In Windows, I can acheive this by disabling the gadget

But that probably doesn't work on Mac either tho? (sure it didn't when I tried it). What I did for GED was to overlay "invisible" panels on top of each gadget, which would catch clicks and drags. Of course, I haven't added support for making anything transparent on GTK yet - actually, it doesn't support it, but there *is* a concept of an actual "invisible" widget, which might be useful. I should have a read up about it...

I can't get a HTML gadget to show with either module (GTKHTML or Mozilla)

Okay... let's start with GTKHTML... It does actually work. However, it only displays itself when it is *finished* loading everything on the page. And at the moment, your example URL blitzmax.com is a bad choice as one of the news items has links to images which aren't available. It will show up eventually...
...and mozilla... try uncommenting line 29 :
'Import "-lxpcom_core"
...rebuild and re-run. Being built on Gecko, this shows the page *as* it loads, and also has a "wait" cursor over the gadget til it's done. Mozilla is a *much* better gadget for overall html useability.
I'm providing both so there's some choice. As I've said already, getting mozilla working takes a bit of effort to get things setup right.


btw... the Community Edition IDE appears to work *really* well with the latest version. (although without the new lexer it renders the text slightly slower...)


MVB(Posted 2006) [#92]

Hi
I don't really know what that means and what I have to do? My firefox-path is /usr/lib/firefox.
If I use gtkhtml I get this Error: "*** glibc detected *** free(): invalid next size (fast): 0x084fcb08 ***"

Thank you.


SebHoll(Posted 2006) [#93]
Thanks Brucey, I guess I was just impatient with http://www.blitzbasic.com but now I have got both Mozilla and GTK to work with http://www.google.com. Just for reference, for Ubuntu Dapper I had to (hope this helps MVB):

> In the terminal, run "ldconfig /usr/lib/firefox"
> Comment out Import "-L/usr/lib/mozilla-firefox" in gtkwebmozilla.bmx.
> Uncomment Import "-lxpcom_core" in gtkwebmozilla.bmx.
> Save and build modules from the IDE.

I'm looking into the SetPanelColor() etc. issues I've got on this computer - will check them on my laptop also. Basically, after calling the command, the color of the panel remains it's default one as if it hasn't been set... :S

Another problem which I have on this computer is using ActiveGadget(). Try running the following example and see what you get:


I get a Signal Handler 11 on the ActiveGadget() line and the program is forced to terminate.

Anyone else get this problem?


Seb


SebHoll(Posted 2006) [#94]
Done some more debugging, stepping through the code - it Signal Handler 11's on line 396 of gtkgui.bmx:

			Local _gflags:Int = Int Ptr(widget + _OFFSET_GTK_FLAGS)[0]


The debugger reports that widget = 0, w = $08130eb0, and w.handle = 08194840. Hope this helps,


Seb


MVB(Posted 2006) [#95]
Hi.
> In the terminal, run "ldconfig /usr/lib/firefox"
> Comment out Import "-L/usr/lib/mozilla-firefox" in gtkwebmozilla.bmx.
> Uncomment Import "-lxpcom_core" in gtkwebmozilla.bmx.
> Save and build modules from the IDE.

Ok. Thank you! That works for me.
Now I'm able to compile the normal MaxIDE with Mozilla and GtkHTML, but everytime I try to compile and run the CE-IDE it shows me these error-messages:
With mozilla:
/usr/bin/ld: warning: libstdc++.so.6, needed by /usr/lib/libgtkembedmoz.so, may conflict with libstdc++.so.5
*** glibc detected *** double free or corruption (!prev): 0x089bb268 ***

With gtkHTML:
*** glibc detected *** free(): invalid pointer: 0x08434c28 ***


Keep up the good work!


Brucey(Posted 2006) [#96]
another problem.. ...is using ActiveGadget()

Two issues with this one.
1) There is a bug in the actual ActiveGadget function, as you found.
2) ActiveGadget *can* return null, as it is entirely possible for there not to be an active gadget on any window... therefore ActiveGadget().xpos could crash.


As for the problems with glibc and free() I am having trouble hunting down the exact causes...


Brucey(Posted 2006) [#97]
hokay... I think I have a method of getting the IDE to run with gdb attached, which might be useful in trying to trace where things are going wrong (although Max doesn't produce any meaningful symbol code... so mileage isn't likely to be much)

The following enters the realms of shell scripting... if you aren't sure, stay away ;-)

Create yourself an executable script with something along the lines of the following in it :
./gtkMaxIDE &
gdb ./gtkMaxIDE $!

..change the name of "gtkMaxIDE" to the name of the app you want to attach gdb to.
This launches the application in the background, then immediately launches gdb and attaches it to the PID of the app.

You should then see a large list of "reading symbols" statements, as gdb processes all the libraries.
Once it has finished, you should be left with the following prompt:
(gdb)

do "continue" to carry on with the app startup...
(gdb) continue


If your application crashes, you should then be able to enter "bt" or "backtrace" and it will reveal where things went wrong.


One downside to the way in which Max is set up is that by default, SIGV signals (seg-faults / crashes) are trapped by Max and passed on safely, in which case gdb will tell you that your app in fact exited happily.

If you *really* want to do some serious debugging, you will need to comment out the following line of appstud.linux.c in the appstub module:
signal( SIGSEGV,sighandler );



:o)


Brucey(Posted 2006) [#98]
GTKMaxGUI 1.10 is now available via syncmods (on mod server 122)

* Fixes ActiveGadget crash if no active widget on a window.
* Added Enter/Leave events for labels.
* Fixed text color setting for labels and buttons.
* Added GTK_USE_STOCK_ITEMS global int. Enabled by default. Set it to False to disable on-the-fly conversion of gadgets showing stock-items (image/text/shortcut)
* Fixed statusbar disappearing with no text.

see sebtest_8.bmx in tests for ActiveGadget fix.
see labelovertest.bmx for example of label stuff.

GTKWebMozilla also updated to 1.02 :
* Added Free() method.

GTK mod tested against latest (1.22) IDE using :
these imports:
Import BaH.GTKMaxGUI
Import BaH.GTKWebMozilla

and the setCode speed tweak :
' highlight code
		s=style[NORMAL]
		?linux
		TGTKTextArea(textarea).setFastUpdate(False)
		?
		If p1>p s.format(textarea,p,p1-p)
		?linux
		TGTKTextArea(textarea).setFastUpdate(True)
		?

... search for "highlight code"


:o)


MVB(Posted 2006) [#99]
It seems there is a problem with listboxes.
"Unhandled Exception:Index out of range"



MVB(Posted 2006) [#100]
Hi again.
Now I also tryed to use an other windowmanager (Openbox), but the open-file-dialog is still as slow as it was with metacity. :?


Brucey(Posted 2006) [#101]
Hi MVB,

A new update is available via syncmods (1.11) which includes the following change :
* Fixed listbox generating selection event on initialisation.

However, I would say your code example is flawed, since if you control-click a currently selected row, it deselects it, raising a selection event with -1 (i.e. no selection) in the eventdata, which will break your code.

Of course one argument is :
Should the listbox generate an event when you DEselect a row to have none selected, or should it do nothing.
I say it should. Why? Because if you want to enable/disable a button, for instance, depending on the current selection, by NOT having an event generated on deselection you would never know to disable the button...

rather change your code :
If EventSource()=Listbox Then
    If EventData() >= 0 Then
        SetGadgetText Textfield, GadgetItemText(Listbox, EventData())
    Else
        SetGadgetText TextField, ""
    End If
EndIf

I would even disable the textfield when nothing is selected...

btw, if win32 / macos versions of MaxGUI don't raise an event on deselection, then I say that is a bug on those platforms.
Personally, you *want* as many events raised as possible.

:-)


SebHoll(Posted 2006) [#102]
Hi Brucey,

Sorry I haven't visited this post in the last week as I've recently formatted my HDD and haven't as yet installed Linux on my desktop computer... In order to try and debug the IDE, I followed the steps you provided (including removing the line from appstub.linux.c) and below is GDB output:



This is v1.22 of the IDE, running GTK v1.11 and importing the Mozilla Firefox HTML extension.

Does this mean anything to you?


Seb


Brucey(Posted 2006) [#103]
Hi Seb,

According to your backtrace it appears that something is attempting to free a png twice? (i.e. a "double free" on "png_destroy_read_struct")... which is kind of worrying in that it's not anything I'm doing directly.
The only thing that comes to mind are pixmaps, and at that, the IDE appears to only use them for the toolbar...

If only "debug max" included debug symbols :-(


skidracer(Posted 2006) [#104]
Just had a small play with the latest code. If I remove the pngloader from gtkmaxgui loading png files in a gtkwebgtk htmlview doesn't cause a glibc memfree'd twice error which makes me think there is a problem with our version of pnglib. Also had to disable garbage collection until I changed the following to processURL:
	Global banks:TList=New TList

	Function processURL(handle:Byte Ptr, url:Byte Ptr, html_stream:Byte Ptr, data:Object)

		Local u:String = parse_href(checkURL(String.FromCString(url)), String.FromCString(gtk_html_get_base(handle)))
		Local path$=urlLessAnchor(checkURL(u, True))
		If FileType(path)=FILETYPE_FILE	
			Local b:TBank=LoadBank(path)
			banks.addlast b
			gtk_html_write(handle, html_stream, LockBank(b), BankSize(b))
		Else
			DebugStop
		End If
   	    gtk_html_end(handle, html_stream, GTK_HTML_STREAM_OK)
	End Function

So there looks to be some issues here also with the memory being used to feed the browser.


also sorry for being stupid but how do I get round this link error with ubuntu when trying to use the firefox htmlview -
/home/simon/blitzmax/mod/bah.mod/gtkmaxgui.mod/tests/createhtmlview:

error while loading shared libraries: libgtkembedmoz.so: cannot open shared object file: No such file or directory



Brucey(Posted 2006) [#105]
Thanks for the help, Mr A. :-)

The GTKHtml view gadget was very much a kludge to begin with I'm afraid, what with it having to be hand-held with regards to URLs and streams - unlike mozilla which does everything for you :-)
I'll have another play with processURL, based on what you've uncovered.
Of course, I'd like to recommend Mozilla anyway, if it weren't for the big mess of getting it setup in the various distros...

Anyhoo, your linking problem...
Check out gtkwebmozilla.bmx. There are two imports pointing to *hopefully* the most likely locations of the shared objects you need...

Import "-L/usr/lib/mozilla-firefox"
Import "-L/usr/lib/firefox"

At least, that's the ones I know about. If it ain't there, perhaps I need to add some more options ;-)

Further down the code is MOZ_DIST_BIN. It tells the library where it is installed, and is set when you first try to open a widget. It has a default, but may not be yours. So you can either set this at runtime, or via an environment variable.
Last but not least (see what I mean about setting it up???), you need to make sure (for runtime) that the above mentioned path is either in LD_LIBRARY_PATH or has been set via the "ldconfig" program, otherwise the exe won't be able find the shared objects....

Other than that, getting mozilla working is fairly easy ;-)


SebHoll(Posted 2006) [#106]
Hi Everyone,

Just had a small play with the latest code. If I remove the pngloader from gtkmaxgui loading png files in a gtkwebgtk htmlview doesn't cause a glibc memfree'd twice error which makes me think there is a problem with our version of pnglib. Also had to disable garbage collection until I changed the following to processURL:


What is the status of the PNG glibc memfree'd problem? Was there ever a fixed release?

Thanks


Seb


Brucey(Posted 2006) [#107]
As I am unable to reproduce these problems, it's been hard to try and find solutions for them.

However, I posted updates to both the libpng and zlib modules HERE which may, or may not, help.
Both of these modules use the LATEST libpng and zlib sources, so with that you also get bug fixes, security updates etc. I can't see any reason why you wouldn't want to use them anyway.

But I don't know if it fixes these issues...

While I'm at it, I've uploaded new updates for both GTKMaxGUI and GTKWebGTKHTML modules which you can get via syncmods.

gtkmaxgui :
* Added mouse Down/Menu events for label.
* Added Enter/Leave events for buttons.
* Removed requester leaks. Code clean-up.
* Added SetButtonPixmap function.
* Panel now raises GADGETPAINT event when repaint required.
* Gadget ACTIVATE_REDRAW now raises GADGETPAINT event.

Mostly these add "new features" which may one day even make it into the other BRL gui modules. I think they are very useful - the extra Events - and let you create a much more full-featured application.

and for gtkwebgtkhtml:
* ProcessURL changes to use banks. [Simon Armstrong]


Please let me know how you get on with the latest stuff... :-)


Winni(Posted 2006) [#108]
Only wanted to say that I'm impressed and find that project -REALLY- cool! :-)


SebHoll(Posted 2006) [#109]
Hi Brucey,

I've just downloaded Ubuntu 6.10 CD and after burning it to a disk, I noticed that it has on it the GTK toolkit for Windows. Is it possible to use this module with the Windows version of GTK and if so what do I need to do?

Thanks,


Seb


Brucey(Posted 2006) [#110]
Hallo.

I don't think there are any particular reasons it wouldn't work assuming the GTK/GDK/GLib (and whatever others I've used) APIs are the same.
Alas, I don't have Windows at home so my win32 dev time is rather limited to squeezing it in between coding at work...

On a bright note, I've yet again updated GTKMaxGUI, fixing some bugs and adding more missing functionality (seems MaxGUI is quite the big beast when it comes to everything that it does. I keep finding stuff I missed). You can find details HERE.


Sub_Zero(Posted 2007) [#111]
GREAT WORK Brucey!!!

However synchronizing with modserver124 doesn't seem to work


Brucey(Posted 2007) [#112]
Have updated to 124 now...

Enjoy :-)


Sub_Zero(Posted 2007) [#113]
You're da man =)


SebHoll(Posted 2007) [#114]
Hi Brucey,

In case you've missed it, could you please see this bug report for GTK MaxGUI I posted in MaxGUI bug reports as it affected the FLTK mod as well, which Skid made a simple fix for.

Many thanks for the update,


Seb


Brucey(Posted 2007) [#115]
Has been noted Seb, thanks :-)

Been messing around with Cocoa (warning - don't take it nasally!) over the last week, which has been kinda fun. Probably 'bout time I got back into Linux... ;-)


Sub_Zero(Posted 2007) [#116]
A tip for saving time when messing around/testing stuff in different operating systems: use vmware workstation.

This way I can test stuff in any windows os without even leaving linux, or test stuff in linux or any other OS without even leaving windows. It's a must.


SebHoll(Posted 2007) [#117]
Thanks for the Treenode fix Brucey... Just a thought but does the GTK toolkit support Alpha gadgets or not? I've had an idea for a work-around to get Max'd GUI working better on Linux and it involves using transparent panels.


Brucey(Posted 2007) [#118]
It doesn't Seb, unfortunately. At least, not yet... I believe it's some way down the line for things like that - since they intend to use the power of gfx cards to drive stuff like that.

My GED UI editor used transparent panels to do all its cleverness, but I'm considering trying something else for that when I get back to it - which I hope to in the near future.


SebHoll(Posted 2007) [#119]
Thanks Brucey for letting me know. As a result, I've completely rewritten the mouse handling code in Max'd GUI to try a new method. I've come across a little bug that I was wondering if you could crack for me...

Basically what is happening is that if you create a panel with a gadget on it, and then you hide the gadget upon entering the panel, the panel then generates MouseEnter followed by MouseLeave events alternatively until you take your mouse away from the gadget again. I know it's probably got something to do with having no border between the edge of the gadget and the panel, but this one thing alone, locks up my event queue with millions of these Mouse Enter/Leave events and the program grinds to a halt. :-(

If it means I'll have to put a massive border around the gadgets it'll look really rubbish, so is there anything I can do to suppress these erratic events.



Also I remember you adding PopupMenu functionality recently to GTKMaxGUI, however is it Linux convention for them to only remain visible while the right mouse button is held down and hide as soon as it's released (in MaxIDE) ?

Many thanks,


Seb


SebHoll(Posted 2007) [#120]
Another thing, how come windows will only have the Tool Window look when they are resizable. I have a tool window with a toolbar inside it to imitate a floating toolbar and it looks great, however in order to get the WINDOW_TOOL flag to work, I also had to apply the WINDOW_RESIZABLE flag, and it means that people can resize the window to show empty space.


SebHoll(Posted 2007) [#121]
Just for those who didn't realise and check back here for info regarding GTKMaxGUI, Brucey released version 1.15 of GTKMaxGUI a few days ago...

BaH.GTKMaxGUI (1.15)

* UTF-8 fix for RequestFile filters and RequestDir path.
* Added text attribute with GetText and SetText methods to TreeNode.



Thanks :-)


Brucey(Posted 2007) [#122]
Another wee update...

BaH.GTKMaxGUI (1.16)
* Added visible field to TGTKGadget to control generation of events.

which fixes the issue of mouse enter/leave events being raised by "going-invisible" gadgets - see sebtest10 in the tests folder.

:o)


SebHoll(Posted 2007) [#123]
Many thanks Brucey - restarting into Ubuntu now to test!

Update: Works perfectly - thanks Brucey!


Picklesworth(Posted 2007) [#124]
Hi folks!
Firstly, thanks for this module, Brucey. It looks amazing!

However, I unfortunately do not own a copy of the MaxGUI module, and it appears that gtkmaxgui needs it :(
I guess that's sold another copy of MaxGUI, but for now is there a binary of the IDE (even better: The community edition IDE) using gtkmaxgui?

Edit:
Oops! Looks like there's already a gtk build for the CE MaxIDE.
...Err, don't mind me!


Picklesworth(Posted 2007) [#125]
After playing with the GTK Max IDE (community edition) for a while, I have a few thoughts!

Again, great job. It is so much better than the old one, and smaller too!

Three things:

1. In the CE IDE, is anyone else getting a glitch where merely rolling the mouse pointer over a font button (in IDE options) will open up the font selector?

2. Also with the IDE: The sidebar is being very difficult to resize. It seems to jump between either fully closed, half open, or completely open for me. Very difficult to get it anywhere in between.

3. Do you know Gnome's fancy little features that let people detach toolbars and change menu accelerators? Are those features available in gtkmaxgui? (Judging by MaxIDE, no. It would be very cool to have, however! And I guess they could already be there since it doesn't look like the IDE had any extra changes other than being built with gtk. Err... are they?).

This is with Ubuntu, Feisty Fawn (development version).


SebHoll(Posted 2007) [#126]
Hi There...

Firstly, great job. It is so much better than the old one, and smaller too!

I second that - hooray to Brucey!

2. Also with the IDE: The sidebar is being very difficult to resize. It seems to jump between either fully closed, half open, or completely open for me. Very difficult to get it anywhere in between.


This problem has been there since day 1, and I originally thought it was probably just poorly designed splitter code. However, it seems that the GTK MaxGUI panel events generate occasional freak mis-positions with regards to EventX() and EventY() data on active panel events. It seems to happen when you call SetGadgetShape on a panel when the mouse is still moving around on it - which I believe to be how the splitter works...

I'll see if I can get some reproducable bug code to help Brucey diagnose the problem when I get a chance but at the moment I am really busy.


Brucey(Posted 2007) [#127]
Hi folks :-)

Thanks for the feedback.

Starting with The Poster Formally Known As Mr...

1) I noticed the very same thing this weekend, having not recompiled my IDE for months. It turns out that it is both a problem with my module and the way in which the dialog windows for the IDE have been coded (poorly, in my opinion).
In a fairly recent update to the module, I added mouse events to buttons - which I think are a great addition to MaxGUI, and give much more choice when making GUI apps - but, in certain dialogs, the Event testing code simply assumes that if an event is raised on a button it must be a click...
Personally, I think it's bad design to assume something like that, even though at the moment (on Win32 & Mac), buttons only raise an Action event...
see...
		Select EventSource()
			Case window
				If EventID()=EVENT_WINDOWCLOSE
					Hide
				EndIf				
			Case ok
				find=TextFieldText(findterm)
				Hide
				PollSystem
				host.activepanel.Invoke TOOLFINDNEXT,find
			Case cancel
				Hide

It can be fixed by adding eventID checks to the relevant points...

Of course, I could simply disable all the nice event generation that is in the GTK module... but I'd rather not. Maybe I should push the CE IDE to be fixed - the change would be compatible with all the platforms.. so...
I guess, perhaps, I'll have to see about writing some more "Tweaks" that add the same functionality to Mac and Windows.... Ho hum.


2) Yeah, I'm sorry about this one. I just haven't got around to fixing it yet.
It's all to do with the way in which GTK generates it's events. Unlike on Mac and windows (and Qt funnily enough, but more on that elsewhere ;-), GTK adds events to it's own event queue, before eventually arriving at Max's. This causes some delay, and hence the issues with dragging that splitter about.
I suppose I should take another look at it.

3) I see Qt/KDE has that nice concept of detaching toolbars too. Alas, I didn't look into supporting features like that because it wasn't a general "MaxGUI" feature - Yeah, I know all the extra events I generate aren't either, but they only required 1 line of code to implement ;-)
I guess it might be worth a look, just to see what would need to be done. The bigger issue would be handling the user dragging things back into the window and having Max try to sort out all the gadgets... but you never knows.


Seb, I did have an example of dragging panels around a GTK window that worked perfectly, but it all depended how you handled the event coordinates.
Basically, it's been hard work getting the GTK module to appear to work like the Mac/Win32 versions with regards event generation - read, kludgy ;-)

I'd say I'm about 90% happy with what we have.


skidracer(Posted 2007) [#128]
topic continued here...