[gtk-list] Re: Resource parser

Adrian Likins wrote:
> On 02-May-97 Richard D. Jackson wrote:
> >
> >Seems we have simular ideas. Not only do I want application resources I
> >would like configuable button bars as well. Here are some of my ideas on
> >how to do it...
> >
> >Preregister internal application functions that can be called by a
> >button bar/menu or what ever. with something like this:
> >
>         Yup, sounds like the right approach. Fro the gimp these could
> simply be PDB calls.
> >gtk_func_register( function_pointer, "resource name", "description")
> >
> >The resource name is the string that will be used in the resource file
> >and the function_pointer is what would be called for that resource. The
> >description would be used by GUI configuration utilities so the user
> >knows what a given funciton does.
> >
> >The only minor draw back is functions would need to be registerd before
> >the resource file was parsed.
> >
>         Probabaly. Compile time too probabaly. For a wm button bar i would
> imagine there wouldnt be too many new functions to add. Seeing as fvwm
> already as functions for just about everything. You would just need to
> hook into them somehow. But, I dont know what all you want to be able to
> do with it.
>         For a GIMP button bar, this is simplified because of the PDB. So
> as long as you can perfrom pdb functions you can do basically everything.
> Original for my idea I had though about trying to rip open scriptf-fu and
> use the scheme intreprter so i could have buttons execute complex scheme
> scripts. But it would be much easier just to call pdb to call scripf-fu
> with the approriate commands.

I haven't dug into gimp's sources yet but that may be one way of doing
it. After I get global resources done I will take a look at it. 

> >The button/menu bar side would be the easy part. During the bar creation
> >phase you attach  these functions to the buttons for the varios events.
> >
> >Now once that is done how much harder would it be to define the actual
> >interface in the resource file? See where I'm heading?
>         I think so. Basically, you want a bar that can be completely user
> configureable at run time. Including the ui. So that if you have one setup
> with ten buttons , and another with 60 then it's no problem.

Not only buttons but pages on the note book as well. 

> > Esentialy I want
> >to unbind the UI as much as possible from the code. That way if I want
> >to change something or try something out all I would have to do is
> >modify the resource file and rerun the program no recompile needed.
>         Yup. Souunds cool. Unfortunately I havent the slightest clue of
> how to go about  making the ui change at run-time. Actually, now that I
> think about it, it shouldnt be that hard as stuff in the gimp ui changes
> in run time (click this button, that button disappears, etc). How to do
> that based on a resource file I am not to clear on. Unfortunately, last
> ime I checked all the .gimprc configurable stuff in gimp that should
> effect the ui didnt work (ie, rulers, the transparency "check" size, etc).
> hmmm.

Actualy implementing this should not be too hard. All you realy need is
a function that can read and parse the resource definitoin and call the
right gtk function to create the widget or interface. Along with
registerd functions you could also attach the functions for the varios
events. True it will take some time but still it should not be that
hard. Hell if MS$ and IBM and do it why can't I do it? Shoot I've even
seen this done for Motif widgets but as with all things Motif dies this
cost you another 2mb or so which is outragous.

Richard Jackson

To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]