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

Re: GtkImageView



On 22/12/2007, muppet <scott asofyet org> wrote:
> More proactive:  #include gtkanimview.h in gtkimageviewperl.h, and
> make sure you use gtkimageviewperl.h everywhere instead of duplicating
> the #include lines for all the various headers.  The attached patch
> does this.  One reason to do this is that anybody wanting to create an
> XS extension that builds atop yours (as yours builds atop gtk2perl.h)
> will expect everything it needs to come through one header,
> gtkimageviewperl.h.  More immediately, this ensures that every file
> inside your project sees the same set of preprocessor definitions at
> build time.  (Repeat after me: the C preprocessor is Evil.)

Ah. Another inch up the learning curve.

> Oh, and check your license comment blocks; you've attributed your
> binding work to the gtk2-perl team as of four years ago, and have a
> CVS $Header:$ tag showing me as the most recent author, in June
> 2003.  ;-)

Well, based on results rather than time spent, apart from the date,
that is probably accurate. I'll fix it anyway.

> A bigger issue:  namespacing.  The classes you define are
> Gtk2::ImageView, Gtk2::ImageToolSelector, etc.  That is, they are
> right in the Gtk2:: namespace, waiting for potential name clashes if
> and when gtk+ adds something called GtkImageView.  Now, of course, the
> same problem exists with the upstream library, but instead of taking
> up a bunch of slots in the Gtk2:: namespace, how about doing something
> like this, instead?
>
>      GtkImageView -> Gtk2::ImageView
>      GtkImageTransp -> Gtk2::ImageView::Transp
>      GtkImageToolPainter -> Gtk2::ImageView::Tool::Painter

OK. How about:

GtkImageView -> Gtk2::ImageView
GtkAnimView -> Gtk2::ImageView::Anim
GtkImageNav -> Gtk2::ImageView::Nav
GtkImageScrollWin -> Gtk2::ImageView::ScrollWin
GtkIImageTool -> Gtk2::ImageView::Tool
GtkImageToolDragger -> Gtk2::ImageView::Tool::Dragger
GtkImageToolSelector -> Gtk2::ImageView::Tool::Selector
GtkImageTransp -> Gtk2::ImageView::Transp

> fix-includes.patch: make everything include gtkimageviewperl.h instead
> of various files.

Thanks.

> requirements.patch: in Makefile.PL, look for gtkimageview 1.5.0, since
> these bindings won't compile against older.  You can play with
> ExtUtils::PkgConfig and look at other modules for hints on how to make
> your bindings compile against multiple versions of the upstream library.

Thanks.

> transp-map.patch: GtkImageTransp was listed incorrectly in the maps
> file as mapping to the package name Gtk2::ImageView.  Fix that.

And I left out Gtk2::ImageToolPainter completely. Fixed that.

> interactive.pl:  a quick transliteration of gtkimageview/tests/

Good grief. You can't have been bored - you've got kids, so I can only
assume you couldn't sleep! Thanks.

> interactive.c.  Note that the way this program uses the GtkImageTransp
> values in the UI manager actions doesn't really play nicely with perl
> syntax for enums, so there's a terrible, evil, horrible hack in its
> place.  If you golf this down to more perlish code, using closures and
> such, you can sidestep the problem.

I take it you are talking about the lines like:

sub GTK_IMAGE_TRANSP_COLOR { 0 }

I'll see what I can do.

Regards

Jeff


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