[gimp-perl] Add dialog scrollbars if necessary.



commit e85acfe7085e7d0f6eac3b89581584a635782ce8
Author: Ed J <edj src gnome org>
Date:   Wed Apr 30 23:54:34 2014 +0100

    Add dialog scrollbars if necessary.

 Gimp/Fu.pm |    4 ++--
 TODO       |    9 ++++-----
 UI/UI.pm   |   38 ++++++++++++++++++--------------------
 3 files changed, 24 insertions(+), 27 deletions(-)
---
diff --git a/Gimp/Fu.pm b/Gimp/Fu.pm
index f62126a..1e8fecf 100644
--- a/Gimp/Fu.pm
+++ b/Gimp/Fu.pm
@@ -227,7 +227,7 @@ Gimp::on_net {
         unless defined $args[$i] or $interact>0;
    }
    if ($interact > 0) {
-      (my $res,@args)=interact($function,$blurb,$help,$params,@args);
+      (my $res,@args)=interact($function,$blurb,$help,$params,$menupath,@args);
       return unless $res;
    } else {
       for my $i (0..$#args) { $args[$i] = string2pf($args[$i], $params->[$i]); }
@@ -399,7 +399,7 @@ sub register($$$$$$$$$;@) {
                my @hide = splice @$params, 0, scalar @pre;
 
                my $res;
-               ($res,@_)=interact($function,$blurb,$help,$params,@$fudata);
+               ($res,@_)=interact($function,$blurb,$help,$params,$menupath,@$fudata);
                return (undef) x @$results unless $res;
 
                unshift @$params, @hide;
diff --git a/TODO b/TODO
index f246127..3fec124 100644
--- a/TODO
+++ b/TODO
@@ -1,12 +1,13 @@
-Items as of 2014-04-23 (by Ed J)
+Items as of 2014-04-29 (by Ed J)
 * possible killer app: https://mail.gnome.org/archives/gimp-developer-list/2014-April/msg00017.html
 * <Load> and <Save> need any registration as such done in Gimp::Fu - see pod and e/dataurl
-* Gimp::Fu must doc command-line usage
+* Gimp::Fu must doc command-line usage; no -o needs give warning
+* Gimp::UI PF_IMAGE needs "open" button
 * e/fade-alpha should generate buttons, not hardcode
 * ensure Server startup, security note in docs
 * image in Gimp.pm POD http://perlmaven.com/how-to-add-images-to-cpan -
   input image -> output image of a plugin
-* examples POD
+* examples POD finish, get rid README
 * Gimp/Lib.xs is huge, and not very XS-y - lots of it is manually
   pushing GIMP data structures onto perl stack and vice versa. Figure
   way to pass GIMP data back and forth directly via typemap system. May
@@ -24,7 +25,5 @@ Items as of 2014-04-23 (by Ed J)
   http://users.telenet.be/blendix/verse/#gimp_plugin
   https://github.com/verse/verse/wiki/Tutorial-Simple-C-Verse-Client
   http://graphicdesign.stackexchange.com/questions/25077/how-can-i-collaborate-using-gimp2
-
-Legacy notes from Seth Burgess:
 * Win32 port
 * Figure out i18n some day.
diff --git a/UI/UI.pm b/UI/UI.pm
index aa53683..2d3f040 100644
--- a/UI/UI.pm
+++ b/UI/UI.pm
@@ -4,6 +4,7 @@ use Gimp ('__');
 use Gimp::Fu;
 use Gtk2;
 use IO::All;
+use List::Util qw(min);
 use strict;
 
 our (@ISA, $VERSION);
@@ -95,8 +96,6 @@ package Gimp::UI::PreviewSelect;
 #                  ->get_pixbuf
 #TODO: Add preview (or portion of preview) directly to button
 
-use Gimp '__';
-
 use Gtk2::SimpleList;
 
 our @ISA = 'Glib::Object';
@@ -202,8 +201,6 @@ sub preview_dialog {
 
 package Gimp::UI::PatternSelect;
 
-use Gimp '__';
-
 our @ISA = 'Glib::Object';
 
 Glib::Type->register (
@@ -212,7 +209,7 @@ Glib::Type->register (
    properties => [],
 );
 
-sub get_title { __"Pattern Selection Dialog" }
+sub get_title { Gimp::__"Pattern Selection Dialog" }
 sub get_list { Gimp::Patterns->get_list("") }
 
 sub new_pixbuf {
@@ -242,8 +239,6 @@ sub new_pixbuf {
 
 package Gimp::UI::BrushSelect;
 
-use Gimp '__';
-
 our @ISA = 'Glib::Object';
 
 Glib::Type->register (
@@ -252,7 +247,7 @@ Glib::Type->register (
    properties => [],
 );
 
-sub get_title { __"Brush Selection Dialog" }
+sub get_title { Gimp::__"Brush Selection Dialog" }
 sub get_list { Gimp::Brushes->get_list("") }
 
 sub new_pixbuf {
@@ -282,8 +277,6 @@ sub new_pixbuf {
 
 package Gimp::UI::GradientSelect;
 
-use Gimp '__';
-
 our @ISA = 'Glib::Object';
 
 Glib::Type->register (
@@ -292,7 +285,7 @@ Glib::Type->register (
    properties => [],
 );
 
-sub get_title { __"Gradient Selection Dialog" }
+sub get_title { Gimp::__"Gradient Selection Dialog" }
 sub get_list { Gimp::Gradients->get_list("") }
 
 sub new_pixbuf {
@@ -337,6 +330,9 @@ sub help_window(\$$$) {
       $$helpwin = new Gtk2::Dialog;
       $$helpwin->set_title(sprintf __"Help for %s", $title);
       $$helpwin->action_area->set_border_width (2);
+      my $tophelp = new Gtk2::Label $help;
+      $tophelp->set_alignment(0.5,0.5);
+      $$helpwin->vbox->pack_start($tophelp,0,1,3);
       my $sw = new Gtk2::ScrolledWindow undef,undef;
       $sw->set_policy (-automatic, -automatic);
       $sw->set_size_request(500,600);
@@ -403,23 +399,17 @@ sub interact($$$$@) {
      my $title = $menupath;
      $title =~ s#.*/##; $title =~ s#[_\.]##g;
      set_title $w "Perl-Fu: $title";
-     $w->set_border_width(3); # sets border on inside because its a window
+     $w->set_border_width(3); # sets border on inside because it's a window
      $w->action_area->set_spacing(2);
      $w->action_area->set_homogeneous(0);
-
-     my $aboutbox = new Gtk2::HBox 0,0;
+     signal_connect $w destroy => sub { main_quit Gtk2 };
 
      my $topblurb = new Gtk2::Label $blurb;
      $topblurb->set_alignment(0.5,0.5);
-     #realize $w;
-     signal_connect $w destroy => sub { main_quit Gtk2 };
-     $aboutbox->pack_start($topblurb,1,1,3);
-
-     $w->vbox->pack_start($aboutbox,1,1,0);
+     $w->vbox->pack_start($topblurb,0,1,3);
 
      $g = new Gtk2::Table scalar @params,2,0;
      $g->set(border_width => 4);
-     $w->vbox->pack_start($g,1,1,0);
 
      for(@params) {
         my ($label,$a);
@@ -752,6 +742,10 @@ if (0) {
         };
         $res++;
      }
+     my $sw = new Gtk2::ScrolledWindow undef,undef;
+     $sw->set_policy (-automatic, -automatic);
+     $sw->add_with_viewport($g);
+     $w->vbox->add($sw);
 
      my $hbbox = new Gtk2::HButtonBox;
      $hbbox->set_spacing (4);
@@ -785,6 +779,10 @@ if (0) {
      $res=0;
 
      show_all $w;
+     $sw->set_size_request(
+        min(0.75*$sw->get_screen->get_width, $g->size_request->width + 30),
+        min(0.6*$sw->get_screen->get_height, $g->size_request->height + 5)
+     );
      main Gtk2;
      die $EXCEPTION if $EXCEPTION;
 


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