]> dxcluster.net Git - spider.git/commitdiff
add panes
authorminima <minima>
Thu, 20 Jul 2006 11:30:02 +0000 (11:30 +0000)
committerminima <minima>
Thu, 20 Jul 2006 11:30:02 +0000 (11:30 +0000)
gtkconsole/gtkconsole
gtkconsole/gtkconsolerc [new file with mode: 0644]

index 95a810aeee1db092b383e2f05dffa7d4f8c3f1b2..cfa771b0b39f7a8d6e17e78051d1dda812e7a270 100755 (executable)
@@ -7,6 +7,10 @@
 # $Id$
 #
 
+use strict;
+
+our $root;
+
 # search local then perl directories
 BEGIN {
        # root of directory tree for this system
@@ -18,13 +22,13 @@ BEGIN {
        unshift @INC, "$root/local";
 }
 
-use strict;
-
 use Glib;
 use Gtk2 qw(-init);
 use Gtk2::Helper;
 use Gtk2::SimpleList;
 
+use Text::Wrap;
+
 use vars qw(@modules $font);                    
 
 @modules = ();                                 # is the list of modules that need init calling
@@ -34,6 +38,13 @@ use DXVars;
 use DXUtil;
 use IO::Socket::INET;
 
+# 
+# read in gtkconsole file
+
+Gtk2::Rc->set_default_files("$root/gtkconsole/gtkconsolerc", "$ENV{HOME}/.gtkconsolerc", ".gtkconsolerc");
+print join(', ', Gtk2::Rc->get_default_files), "\n";
+Gtk2::Rc->reparse_all;
 #
 # main initialisation
 #
@@ -97,16 +108,15 @@ my $menu = $itemf->get_widget('<main>');
 $vbox->pack_start($menu, 0, 1, 0);
 
 
-# another hbox is packed as the bottom of the vbox
-my $bhbox = Gtk2::HBox->new(0, 1);
-$vbox->pack_end($bhbox, 1, 1, 0);
+# a paned hbox is packed as the bottom of the vbox
+my $bhpane = Gtk2::HPaned->new;
+$vbox->pack_end($bhpane, 1, 1, 0);
 
-# now pack two vboxes into the hbox
-my $lhvbox = Gtk2::VBox->new(0, 1);
-my $rhvbox = Gtk2::VBox->new(0, 1);
-$bhbox->pack_start($lhvbox, 1, 1, 5);
-$bhbox->pack_start(Gtk2::VSeparator->new, 0, 1, 0);
-$bhbox->pack_end($rhvbox, 1, 1, 5);
+# now create the lh and rh panes
+my $lhvpane = Gtk2::VPaned->new;
+my $rhvpane = Gtk2::VPaned->new;
+$bhpane->pack1($lhvpane, 1, 0);
+$bhpane->pack2($rhvpane, 1, 0);
 
 # first add a column type for the QRG
 my $font = 'monospace 9';
@@ -134,6 +144,39 @@ Gtk2::SimpleList->add_column_type( 'tt',
                      }
                 );
 
+Gtk2::SimpleList->add_column_type( 'ttlong',
+                     type     => 'Glib::Scalar',
+                     renderer => 'Gtk2::CellRendererText',
+                     attr     => sub {
+                          my ($treecol, $cell, $model, $iter, $col_num) = @_;
+                          my $info = $model->get ($iter, $col_num);
+                                                 $Text::Wrap::columns = 80;
+                          $cell->set(text => join("\n",wrap("","",$info)), font => $font);
+                     }
+                );
+
+Gtk2::SimpleList->add_column_type( 'ttlesslong',
+                     type     => 'Glib::Scalar',
+                     renderer => 'Gtk2::CellRendererText',
+                     attr     => sub {
+                          my ($treecol, $cell, $model, $iter, $col_num) = @_;
+                          my $info = $model->get ($iter, $col_num);
+                                                 $Text::Wrap::columns = 65;
+                          $cell->set(text => join("\n",wrap("","",$info)), font => $font);
+                     }
+                );
+
+Gtk2::SimpleList->add_column_type( 'ttshort',
+                     type     => 'Glib::Scalar',
+                     renderer => 'Gtk2::CellRendererText',
+                     attr     => sub {
+                          my ($treecol, $cell, $model, $iter, $col_num) = @_;
+                          my $info = $model->get ($iter, $col_num);
+                                                 $Text::Wrap::columns = 30;
+                          $cell->set(text => join("\n",wrap("","",$info)), font => $font);
+                     }
+                );
+
 
 #
 # LEFT HAND SIDE
@@ -145,7 +188,7 @@ my $dxlist = Gtk2::SimpleList->new(
                                                                   'QRG' => 'qrg',
                                                                   'DX Call' => 'tt',
                                                                   'Grid' => 'tt',
-                                                                  'Remarks' => 'tt',
+                                                                  'Remarks' => 'ttshort',
                                                                   'By' => 'tt',
                                                                   'Grid' => 'tt',
                                                                   'TxTime' => 'tt',
@@ -157,25 +200,24 @@ $dxscroll->set_policy ('never', 'automatic');
 #$dxscroll->set_size_request (700, 400);
 $dxscroll->add($dxlist);
 $dxscroll->set_border_width(5);
-$lhvbox->pack_start($dxscroll, 1, 1, 0);
+
+$lhvpane->pack1($dxscroll, 1, 0);
 
 # The command list
+my $lhvbox = Gtk2::VBox->new(0, 1);
 my $cmdlist = Gtk2::SimpleList->new(
                                                                        RxTime => 'tt',
-                                                                       Information => 'tt',
+                                                                       Information => 'ttlong',
                                                                   );
 my $cmdscroll = Gtk2::ScrolledWindow->new (undef, undef);
 $cmdscroll->set_shadow_type ('etched-out');
-$cmdscroll->set_policy ('never', 'automatic');
+$cmdscroll->set_policy ('automatic', 'automatic');
 #$cmdscroll->set_size_request (700, 400);
 $cmdscroll->add($cmdlist);
 $cmdscroll->set_border_width(5);
 $lhvbox->pack_start($cmdscroll, 1, 1, 0);
 
 
-# nice little separator
-$lhvbox->pack_start(Gtk2::HSeparator->new, 0, 1, 0 );
-
 # callsign and current date and time
 my $hbox = new Gtk2::HBox;
 my $calllabel = new Gtk2::Label($call);
@@ -192,6 +234,7 @@ $bot->set_editable(1);
 $bot->signal_connect('activate', \&bothandler);
 $bot->can_default(1);
 $lhvbox->pack_end($bot, 0, 1, 0);
+$lhvpane->pack2($lhvbox, 1, 0);
 $bot->grab_default;
 
 #
@@ -203,7 +246,7 @@ my $annlist = Gtk2::SimpleList->new(
                                                                        RxTime => 'tt',
                                                                        From => 'tt',
                                                                        To => 'tt',
-                                                                       Announcement => 'tt',
+                                                                       Announcement => 'ttlesslong',
                                                                   );
 $annlist->set_rules_hint(1);
 my $annscroll = Gtk2::ScrolledWindow->new (undef, undef);
@@ -212,16 +255,18 @@ $annscroll->set_policy ('automatic', 'automatic');
 #$annscroll->set_size_request (700, 400);
 $annscroll->add($annlist);
 $annscroll->set_border_width(5);
-$rhvbox->pack_start($annscroll, 1, 1, 0);
+$rhvpane->pack1($annscroll, 1, 0);
 
 # The wwv list
+my $rhvbox = Gtk2::VBox->new(0, 1);
+
 my $wwvlist = Gtk2::SimpleList->new(
                                                                        RxTime => 'tt',
                                                                        From => 'tt',
                                                                        SFI => 'int',
                                                                        A => 'int',
                                                                        K => 'int',
-                                                                       Remarks => 'tt',
+                                                                       Remarks => 'ttshort',
                                                                        Hour => 'tt'
                                                                   );
 $wwvlist->set_rules_hint(1);
@@ -231,7 +276,7 @@ $wwvscroll->set_policy ('never', 'automatic');
 #$wwvscroll->set_size_request (700, 200);
 $wwvscroll->add($wwvlist);
 $wwvscroll->set_border_width(5);
-$rhvbox->pack_start($wwvscroll, 0, 1, 0);
+$rhvbox->pack_start($wwvscroll, 1, 1, 0);
 
 # The wcy list
 my $wcylist = Gtk2::SimpleList->new(
@@ -251,10 +296,13 @@ $wcylist->set_rules_hint(1);
 my $wcyscroll = Gtk2::ScrolledWindow->new (undef, undef);
 $wcyscroll->set_shadow_type ('etched-out');
 $wcyscroll->set_policy ('never', 'automatic');
-#$wcyscroll->set_size_request (700, 200);
 $wcyscroll->add($wcylist);
 $wcyscroll->set_border_width(5);
-$rhvbox->pack_start($wcyscroll, 0, 1, 0);
+$rhvbox->pack_start($wcyscroll, 1, 1, 0);
+$rhvbox->set_size_request (-1, $scr_height / 4);
+
+
+$rhvpane->pack2($rhvbox, 1, 0);
 
 my $sock_helper = Gtk2::Helper->add_watch($sock->fileno, 'in', \&tophandler, $sock);
  
diff --git a/gtkconsole/gtkconsolerc b/gtkconsole/gtkconsolerc
new file mode 100644 (file)
index 0000000..1d4c9bc
--- /dev/null
@@ -0,0 +1,5 @@
+#
+# Standard RC file for gtkconsole
+#
+# $Id$
+#