GTM

 view release on metacpan or  search on metacpan

bin/gtm  view on Meta::CPAN

#! /usr/bin/perl

use common::sense;
use Gtk2 -init;
use GTM qw(save_prefs);

###################################################################################
# do things only needed for single-binary version (par)
BEGIN {
   if (%PAR::LibCache) {
      @INC = grep ref, @INC; # weed out all paths except pars loader refs

      my $root = $ENV{PAR_TEMP};

      while (my ($filename, $zip) = each %PAR::LibCache) {

bin/gtm  view on Meta::CPAN

      if %PAR::LibCache && $^O eq "MSWin32";
}

unshift @INC, $ENV{PAR_TEMP};
###################################################################################


my $w = new GTM;
$w->show_all;
main Gtk2;
save_prefs;

lib/GTM.pm  view on Meta::CPAN

=head1 FILES

   ~/.gtmrc

preferences (you can source it).

=cut

BEGIN {
    use base 'Exporter';
    our @EXPORT_OK = qw(set_busy output %override save_prefs);
    our @EXPORT    = ();
}

use GTM::Run ();

our %override;

our ($gtm_version, $gtm_utf8);
our @gtm_variables = (qw/gtm_dist gtmroutines gtmgbldir gtm_log gtm_chset gtm_icu_version/);

lib/GTM.pm  view on Meta::CPAN

    my $tv    = $sa->{tv};
    my $lines = join "", @d;
    my $buf   = $tv->get_buffer;
    $buf->insert ($buf->get_end_iter, $lines);
    $tv->scroll_to_mark ($sa->{end}, 0, 1, 0, 1);

}

my $rcfile = my_home File::HomeDir . "/.gtmrc";

sub save_prefs () {
    open my $fh, ">", $rcfile
      or do { warn "can't create '$rcfile': $!"; return; };

    while (my ($k, $v) = each %win_size) {
        print $fh "# win=$k w=$v->[0] h=$v->[1]\n";
    }

    while (my ($k, $v) = each %override) {
        $v =~ s/"/\\"/g;
        print $fh "$k=\"$v\"\nexport $k\n\n";
    }
}

sub load_prefs () {
    open my $fh, "<", $rcfile
      or do { warn "can't open '$rcfile': $!"; return; };
    while (my $line = <$fh>) {
        if ($line =~ /^#\s+win=(\w+)\s+w=(\d+)\s+h=(\d+)$/) {
            my ($window, $win_width, $win_height) = ($1, $2, $3);
            $win_size{$window} = [ $win_width, $win_height ];
        }
        if ($line =~ /^(gtm\w+)=\"(.*)\"$/) {
            my ($k, $v) = ($1, $2);
            $v =~ s/\\"/"/g;

lib/GTM.pm  view on Meta::CPAN

    $dialog->show_all;
    if ($dialog->run == 42) {
        for (my $i = 0 ; $i < $cnt ; $i++) {
            my $k = $vars[$i];
            my $v = $entries[$i]->get_text;
            delete $override{$k};
            $override{$k} = $v if length $v;
        }

        get_gtm_version ();
        save_prefs;
    }
    $dialog->destroy;
}

my $menu_tree = [
    _File => {
        item_type => '<Branch>',
        children  => [
            "_Routine Restore" => {
                                   callback    => sub { gtm_routine_restore; },

lib/GTM.pm  view on Meta::CPAN

                      callback    => sub { main_quit Gtk2; },
                      accelerator => '<Alt>X',
                     },
                    ],
             },

    _Variables => {
                   item_type => '<Branch>',
                   children  => [
                       '_Edit all variables' => {callback => sub { edit_environment (@gtm_variables) },},
                       '_Clear all overrides' => {callback => sub { %override = (); save_prefs(); },},
                       Separator => {item_type => '<Separator>',},
                               ],
                  },

    _Database => {
        item_type => '<Branch>',
        children  => [
            '_Integrity check' => {
                                   callback => sub { gtm_integ (); }
                                  },

lib/GTM.pm  view on Meta::CPAN

    $main_window = new Gtk2::Window ('toplevel');
    $main_window->signal_connect (destroy => sub { main_quit Gtk2; });
    win_size ($main_window, "main_window", 960, 600);
    my $v = new Gtk2::VBox;
    $v->pack_start ($menu->{widget}, 0, 0, 0);
    $v->pack_start ($button,         0, 0, 0);

    $v->add                       ($main_scroll);
    $main_window->add             ($v);
    $main_window->add_accel_group ($menu->{accel_group});
    load_prefs;
    set_busy (0);
    get_gtm_version();
    $main_window;
}

my $was_busy = 1;
my $timer;
my $counter = 0;
my ($red, $green, $off);
$button = new Gtk2::Button;



( run in 2.020 seconds using v1.01-cache-2.11-cpan-0bb4e1dffa6 )