App-Chart

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

maybe/SymbolHistory.pm
maybe/SymbolHistory.t
maybe/t-symbol-history.pl
maybe/TimerObject.pm
maybe/TimerObject.t
maybe/TreeModelConcat.pm
maybe/TreeOfTreesModel.pm
maybe/unused.pm
misc/activate-signal.pl
misc/arena.pl
misc/binding-button-event.pl
misc/bindings-release.pl
misc/buildable-subclass.pl
misc/cellview.pl
misc/do.pl
misc/dump.pl
misc/fieldhash.pl
misc/gc.pl
misc/gcfree.pl
misc/glib-uri.pl
misc/gravity.pl
misc/gtk-button-stock.c

MANIFEST  view on Meta::CPAN

misc/insert-or-replace.pl
misc/magical-false.pl
misc/Makefile
misc/misc.pl
misc/server.pl
misc/t-adjscale.pl
misc/t-annotations.pl
misc/t-ath.pl
misc/t-barchart.pl
misc/t-bastardize.pl
misc/t-bindings.pl
misc/t-browser-open.pl
misc/t-buffering.pl
misc/t-button-sens.pl
misc/t-cas.pl
misc/t-cbt.pl
misc/t-cell-button.pl
misc/t-cellview-dnd.pl
misc/t-childpid.pl
misc/t-coloralloc.pl
misc/t-combobox.pl

SIGNATURE  view on Meta::CPAN

SHA256 2871f16fa6c6038f54a90ace61b55e37702d508c35f320df9e7c98ef454f5b50 maybe/SymbolHistory.t
SHA256 d15b2fe3de8be19230d7901e3e503434fe6126438adc5e14639f24a09c4db897 maybe/TimerObject.pm
SHA256 9dbf9d180b4f907d71dd16f0e56521c9c8706484fcce61b626809f28ea6de1ea maybe/TimerObject.t
SHA256 34edec944776dd215b0e17990ff57e6f56077adc7457823006617ae68b0b9a9b maybe/TreeModelConcat.pm
SHA256 10cea3e7c8db279784f032dc7846f77778086dfc8f207cfa5b04e73e432be534 maybe/TreeOfTreesModel.pm
SHA256 1faa6b05492954ff40836458f2245056e83f8feb4ae47f8c50eb3785bd59d2b5 maybe/t-symbol-history.pl
SHA256 b54f04ac96334380c4428c2800d02eb8117f1fabf68d0cfd3cff00ea9cdaa988 maybe/unused.pm
SHA256 977ba2105e3f662b1427fcd535e3fb4006c3df5f734c614d09f86962be4e7b2a misc/Makefile
SHA256 c714bb285999ce042f79a278029ab92933513db22d2e796929a660c40fbf91c1 misc/activate-signal.pl
SHA256 0b240725b5666516fa55c3a43ec895520da74abd37f1959d35a792650a8a2feb misc/arena.pl
SHA256 76113b0dbc310c7193726cc2db64885ce76668a97c187e225aa04a6ac2648b3a misc/binding-button-event.pl
SHA256 602cf4dd9999354db81db3c41c6c8551f098a3d1e73c2cffb1f7b0bd5de59691 misc/bindings-release.pl
SHA256 dd83566bd787eb8aa23b3ab9c3c49dcff586353c59df2c40bdee90981d818a41 misc/buildable-subclass.pl
SHA256 3423f24ec27339e53d1922b58ca443b56760f3c92fae270ddc1df302cf82719e misc/cellview.pl
SHA256 ee43b976b6bb13b2232012aa5629046e43d1eb830b1baeb5f5848af37e1706db misc/do.pl
SHA256 fa302f8e9bd34d2a1dcacd47463c8f9afa0f1922c2fbaa39285781089e9508e3 misc/dump.pl
SHA256 1698edc4d3b5f848183e0f50c941aecbe2bd7c59d3cc11d46e1bcab4050ee426 misc/fieldhash.pl
SHA256 b605a41174d475a485929c0fe4455e7e6dae92088d90faf151e0457e12f55b38 misc/gc.pl
SHA256 915ad50dfcac8805168c5df3f38ef6482cb47f485488b3d50fe6a8a6f9fb37b3 misc/gcfree.pl
SHA256 90b425fa046ed9b25ab7fa04d233fdcd960218e0b13c4c2c039eaf9f13996a5b misc/glib-uri.pl
SHA256 7232741c0beecb65264bfabd9ea4a57a8bf53ca87e0cfbf15fe907f1cc35a4d5 misc/gravity.pl
SHA256 d899c44a0c68c0fe9f8d506124236df9bb27a48692c98ba54344bcdace2246c8 misc/gtk-button-stock.c
SHA256 302b6729c6cd4891fe0725b6090bb3b87497cce77e41cc4b16dd520619291ec0 misc/gtk-proxies-foo.pl
SHA256 b8599eee0eff3c8365c2bdab47ea08cbce1a1197ad3f4af4843f63b9fa4b3a12 misc/insert-or-replace.pl
SHA256 14be3d0590010e61c960ff94706c9b5b8844189f608782057b23775c6fd0fd65 misc/magical-false.pl
SHA256 81b026e3d1608203779b174064ba798b9c003f568d67333ae2d80e2ad661e89c misc/misc.pl
SHA256 dc6cf7b05cd4e7f9c38dbb906a2635e79c1b515787fd318c5dea06dd072220fa misc/server.pl
SHA256 40e25f303091a354c66fcc98600ef23258e9e8bdceeff0e245a3bf09cebae5fe misc/t-adjscale.pl
SHA256 0c46e42261835f3a64a2bfc21dd13917ebcaefdc81d256e2b3e78a70cbf16e6c misc/t-annotations.pl
SHA256 8815d8fad1e1fa8c02586527a4e4bcd312c27c3fad980f9589ca6e372b0d4dab misc/t-ath.pl
SHA256 1617fc31952cf1aaec0056b2fb39ad80152f86969535609fe7529d2182de5e39 misc/t-barchart.pl
SHA256 2a52aad518bec310400a17b89f08ced1c1dc431e0b0924f53d1e4013fc2f0df5 misc/t-bastardize.pl
SHA256 ed98f02d4994fa9375512377e8d4d6530f055958cb4cd3a1ab5968f933be1a9c misc/t-bindings.pl
SHA256 055358a32800e1768f9761314e1586016231d02844a3cc38fd9d7c42eb5af3c6 misc/t-browser-open.pl
SHA256 e86c8baf5992ad27ba9d92662a08a5512ad44c14bf0db8f215da8ad7875c130e misc/t-buffering.pl
SHA256 61c743767b26904be3bf2fdb30fdb363217f7e2fd09104f333d038ed87326761 misc/t-button-sens.pl
SHA256 a70b938c727557d37c40b88a35cd5348c882e0fa526cfa803cdad68f3cf23672 misc/t-cas.pl
SHA256 fca829d42dae6756bd016f31cbfe343d03a573f79d64a36c9cb5e573fdbd6a10 misc/t-cbt.pl
SHA256 78cc9028a55d0f066a53bbe300545a0616546a586df0c037a8ff04d3029b9bda misc/t-cell-button.pl
SHA256 cffd77bb1a9c36dfff74c66f8d984217ebd6f6a14d4a231de8838bb844e6601e misc/t-cellview-dnd.pl
SHA256 927600ac200f7a063b623dda9beb12dda011123948d247e781666c33a1a28396 misc/t-childpid.pl
SHA256 7661c41ff52e10791aa3ab23f2e5d0a09bc540fd457b979c2e6840811f5adaf7 misc/t-coloralloc.pl
SHA256 6e97fb2552724a9688b88ded2f2293e44840114ad536a99b79b5ee046ce9ff19 misc/t-combobox.pl

doc/chart.texi  view on Meta::CPAN

@c @code{load-path} 



@section Watchlist and Quotes

@findex @code{chart-watchlist}
@kbd{M-x chart-watchlist} displays the Favourites list in a buffer.  Key
@key{a} adds a symbol.  @kbd{C-k} and @kbd{C-y} kill and yank symbols.
@key{g} refreshes the quotes.  @key{L} selects a different list (like the
Alerts list).  The usual @kbd{C-h m} mode help shows other key bindings.

Chart communicates changes to the lists between the Emacs display and a
running Chart GUI@.  So if you have both open then changes in one are
reflected in the other a moment later.

@findex @code{chart-quote}
@kbd{M-x chart-quote} displays a quote for a given symbol in the message area.
It prompts for the symbol with default a symbol at point.  @key{Tab}
completion is available (@pxref{Completion,,, emacs, The Emacs Editor}) using
the database symbols, favourites list, and previously requested symbols.

lib/App/Chart.pm  view on Meta::CPAN

use Locale::TextDomain ('App-Chart');
use Glib;

# uncomment this to run the ### lines
#use Smart::Comments;

our $VERSION = 275;

use Locale::Messages 1.16; # version 1.16 for turn_utf_8_on()
BEGIN {
  Locale::Messages::bind_textdomain_codeset ('App-Chart','UTF-8');
  Locale::Messages::bind_textdomain_filter ('App-Chart',
                                            \&Locale::Messages::turn_utf_8_on);
}
# sub chart_gettext_filter {
#   my ($str) = @_;
#   Locale::Messages::turn_utf_8_on ($str);
#   $str =~ s/^CONTEXT\(.*?\): *//;
#   return $str;
# }

# Return the user's ~/Chart directory, as an absolute path in filesystem

lib/App/Chart/Gtk2/AnnDrag.pm  view on Meta::CPAN

               toggle_horizontal => { param_types   => [],
                                      return_type   => undef,
                                      flags         => ['run-last','action'],
                                      class_closure => \&_do_toggle_horizontal,
                                    },
             };

# priority level "gtk" treating this as widget level default, for overriding
# by application or user RC
Gtk2::Rc->parse_string (<<'HERE');
binding "App__Chart__Gtk2__AnnDrag_keys" {
  bind "Escape"         { "abort" () }
  bind "a"              { "toggle-alert" () }
  bind "space"          { "swap-ends" () }
  bind "d"              { "delete-element" () }
  bind "h"              { "toggle-horizontal" () }
}
class "App__Chart__Gtk2__AnnDrag" binding:gtk "App__Chart__Gtk2__AnnDrag_keys"
HERE


my $active = 0;
my $graph;
my $cursor;
my $drawn = 0;
my $wevents;
my $snooper;

lib/App/Chart/Gtk2/AnnDrag.pm  view on Meta::CPAN


sub _do_key_snooper {
  my ($widget, $event) = @_;

  # ignore key releases
  $event->type eq 'key-press' or return Gtk2::EVENT_PROPAGATE;

  # needing an actual self Gtk2::Object
  #   require Gtk2::Ex::BindingBits;
  #   Gtk2::Ex::BindingBits::activate_event
  #   if (App::Chart::Gtk2::GUI::bindings_activate_event ('App__Chart__Gtk2__AnnDrag_keys',
  #                                                $event, $self)) {
  #     return Gtk2::EVENT_STOP; # since handled
  #   }

  my $keyval = $event->keyval;
  my $modifiers = $event->state;
  $modifiers = $modifiers & Gtk2::Accelerator->get_default_mod_mask;
  my $key = lc (Gtk2::Gdk->keyval_name ($keyval));
  if (DEBUG) { print "keypress $key\n"; }

lib/App/Chart/Gtk2/Ex/BindingBits.pm  view on Meta::CPAN

# binding set replaced by an rc parse_string in program,
#
# lookup through widget bindings won't take Pointer_Button1 etc



# Copyright 2009, 2010, 2011 Kevin Ryde

# This file is part of Chart.
#
# Chart is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3, or (at your option) any later

lib/App/Chart/Gtk2/Ex/BindingBits.pm  view on Meta::CPAN

use strict;
use warnings;
use Carp;
use Gtk2;
use Scalar::Util;

# uncomment this to run the ### lines
#use Smart::Comments;


# Think it's better to croak for an unknown bindingset name than to return 0
# for not activated, on the basis it picks up typos or bad names.
#
sub activate_button_event {
  my ($bindings, $event, $object) = @_;

  unless (Scalar::Util::blessed($bindings)
          && $bindings->isa('Gtk2::BindingSet')) {
    $bindings = Gtk2::BindingSet->find ($bindings)
      || croak 'No BindingSet called ',$bindings;
  }
  my $keyval = Gtk2::Gdk->keyval_from_name('Pointer_Button' . $event->button)
    || do {
      ### activate_button_event() unknown: 'Pointer_Button' . $event->button
      return 0;
    };

  my $modifiers = $event->get_state;
  if ($event->type eq 'button-release') { $modifiers |= 'release-mask'; }
  ###   type     : $event->type
  ###   modifiers: "$modifiers"

  my $found = $bindings->activate ($keyval, $modifiers, $object);
  ### activate_button() found: $found
  return $found;
}

1;
__END__

=for stopwords Ryde Chart

=head1 NAME

lib/App/Chart/Gtk2/Ex/BindingBits.pm  view on Meta::CPAN

App::Chart::Gtk2::Ex::BindingBits -- helpers for Gtk2::BindingSet etc

=head1 SYNOPSIS

 use App::Chart::Gtk2::Ex::BindingBits;

=head1 FUNCTIONS

=over 4

=item C<< $bool = App::Chart::Gtk2::Ex::BindingBits::activate_button_event ($bindings, $event, $object) >>

Activate bindings for a button press C<$event>.  The return is true if a
binding was found and activated or false if not.

C<$event> should be a C<Gtk2::Gdk::Event::Button>.  The button number is
turned into keyval C<Pointer_Button1> etc, modifiers get C<release-mask>
added if it's a C<button-release> event, then simply

    $bindings->activate ($keyval, $modifiers, $object)

C<$bindings> can be either a C<Gtk2::BindingSet> object or a string name of
a binding set for C<< Gtk2::BindingSet->find >>.  As of Gtk 2.18 there's
keyvals for buttons 1 through 5.  If C<< $event->button >> is somehow
another value then C<activate_button_event> returns 0 as there cannot be any
bindings for it.

See F<examples/binding-button-event.pl> in the sources for a sample program.

=back

=head1 OTHER NOTES

For reference, as of Gtk 2.18 the C<Gtk2::Object> method
C<< $object->bindings_activate >> is no good for C<Pointer_Button1> etc as
that C<bindings_activate> trys to go from keyval to hardware keycode then
back to keyvals, but there's normally no keycode for the pointer buttons, so
it doesn't lookup anything in the BindingSet.

=head1 SEE ALSO

L<Gtk2::BindingSet>, L<Gtk2::Ex::WidgetBits>, L<Gtk2::Gdk::Event::Button>

=head1 HOME PAGE

L<http://user42.tuxfamily.org/chart/index.html>

lib/App/Chart/Gtk2/Ex/BindingBits.pm  view on Meta::CPAN

more details.

You should have received a copy of the GNU General Public License along with
Chart.  If not, see L<http://www.gnu.org/licenses/>.

=cut

# junk, probably
#
# sub activate_event {
#   my ($bindings, $event, $object) = @_;
#   unless (Scalar::Util::blessed($bindings)
#           && $bindings->isa('Gtk2::BindingSet')) {
#     $bindings = Gtk2::BindingSet->find ($bindings)
#       || croak "No BindingSet called '$bindings'";
#   }
# 
#   my $keyval;
#   if ($event->can('keyval')) {
#     $keyval = $event->keyval;
#   } elsif ($event->can('button')) {
#     my $button = $event->button;
#     $keyval = Gtk2::Gdk->keyval_from_name("Pointer_Button$button")
#       || do { warn "BindingBits ignoring unrecognised button number $button";
#               return 0; };
#   } else {
#     croak "Unrecognised event type $event";
#   }
# 
#   my $found = $bindings->activate ($keyval, $event->get_state, $object);
#   ### activate_event_keyval() found: $found
#   return $found;
# }

lib/App/Chart/Gtk2/Graph.pm  view on Meta::CPAN

                 ('series-list',
                  'Series list',
                  'Arrayref of perl App::Chart::Series objects.',
                  Glib::G_PARAM_READWRITE),
                ];
App::Chart::Gtk2::GUI::chart_style_class (__PACKAGE__);

# priority level "gtk" treating this as widget level default, for overriding
# by application or user RC
Gtk2::Rc->parse_string (<<'HERE');
binding "App__Chart__Gtk2__Graph_keys" {
  bind "<Shift>Pointer_Button1" { "start_lasso" (1) }
  bind "Pointer_Button1" { "start_drag" (1) }
  bind "Pointer_Button2" { "start_annotation_drag" (2) }
}
class "App__Chart__Gtk2__Graph" binding:gtk "App__Chart__Gtk2__Graph_keys"
HERE


#------------------------------------------------------------------------------

sub INIT_INSTANCE {
  my ($self) = @_;
  $self->{'series_list'} = [];

  $self->set_double_buffered (0);

lib/App/Chart/Gtk2/HAxis.pm  view on Meta::CPAN

# the base $timebase is expected to be among these, then the medium marks
# are drawn in the one after that
my @marks_timebase_list = qw(App::Chart::Timebase::Days
                             App::Chart::Timebase::Weeks
                             App::Chart::Timebase::Months
                             App::Chart::Timebase::Quarters
                             App::Chart::Timebase::Years
                             App::Chart::Timebase::Decades);

Gtk2::Rc->parse_string (<<'HERE');
binding "App__Chart__Gtk2__HAxis_keys" {
  bind "Pointer_Button1" { "start_drag" (1) }
}
# priority level "gtk" treating this as widget level default, for overriding
# by application or user RC
class "App__Chart__Gtk2__HAxis" binding:gtk "App__Chart__Gtk2__HAxis_keys"
HERE

sub INIT_INSTANCE {
  my ($self) = @_;
  $self->add_events (['button-press-mask',
                      'button-motion-mask',
                      'button-release-mask']);
  $self->{'layout'} = $self->create_pango_layout ('');

  if (! @fullmonth) {

lib/App/Chart/Gtk2/RawDialog.pm  view on Meta::CPAN

  my $date_width = App::Chart::Gtk2::GUI::string_width ($treeview, '2099-99-99 ');
  my $date_width_editable = $date_width * 1.4; # diff font, and pulldown
  my $digit_width = Gtk2::Ex::Units::digit_width ($self);

  my $datasheet = Gtk2::Ex::Datasheet::DBI->new
    ({ dbh => $dbh,
       sql => { select   => 'ex_date, record_date, pay_date, amount, imputation, type, qualifier, note',
                from     => 'dividend',
                order_by => 'ex_date DESC',
                where    => 'symbol=?',
                bind_values => [ '' ],
              },
       treeview => $treeview,
       fields => [ { name          => 'ex_date',
                     header_markup => __('Ex'),
                     x_absolute    => $date_width_editable,
                     validation    => \&validate_date,
                     # renderer      => 'date',
                   },
                   { name          => 'record_date',
                     header_markup => __('Record'),

lib/App/Chart/Gtk2/RawDialog.pm  view on Meta::CPAN

  my $date_width = App::Chart::Gtk2::GUI::string_width ($treeview, '2099-99-99 ');
  my $date_width_editable = $date_width * 1.4; # diff font, and pulldown
  my $digit_width = Gtk2::Ex::Units::digit_width ($self);

  my $datasheet = Gtk2::Ex::Datasheet::DBI->new
    ({ dbh => $dbh,
       sql => { select   => 'date, new, old, note',
                from     => 'split',
                order_by => 'date DESC',
                where    => 'symbol=?',
                bind_values => [ '' ],
              },
       treeview => $treeview,
       fields => [ { name          => 'date',
                     header_markup => __('Date'),
                     x_absolute    => $date_width_editable,
                     validation    => \&validate_date,
                     # renderer      => 'date',
                   },
                   { name          => 'new',
                     header_markup => __('New'),

lib/App/Chart/Gtk2/RawDialog.pm  view on Meta::CPAN

  require App::Chart::DBI;
  my $dbh = App::Chart::DBI->instance;
  my $em = Gtk2::Ex::Units::em($self);

  my $datasheet = Gtk2::Ex::Datasheet::DBI->new
    ({ dbh => $dbh,
       sql => { select   => 'key, value',
                from     => 'extra',
                order_by => 'key ASC',
                where    => 'symbol=?',
                bind_values => [ '' ],
              },
       treeview => $treeview,
       fields => [
                  { name => 'key',
                    header_markup => __('Key'),
                    x_absolute    => 15 * $em,
                  },
                  { name => 'value',
                    header_markup => __('Value'),
                    x_absolute    => 15 * $em,

lib/App/Chart/Gtk2/RawDialog.pm  view on Meta::CPAN

  my $dbh = App::Chart::DBI->instance;
  my $em = Gtk2::Ex::Units::em($self);
  my $digit_width = Gtk2::Ex::Units::digit_width ($self);

  my $datasheet = Gtk2::Ex::Datasheet::DBI->new
    ({ dbh => $dbh,
       sql => { select   => 'mode, error, fetch_timestamp, url, etag, last_modified',
                from     => 'intraday_image',
                order_by => 'mode ASC',
                where    => 'symbol=?',
                bind_values => [ '' ],
              },
       treeview => $treeview,
       fields => [ { name          => 'mode',
                     header_markup => __('Mode'),
                     x_absolute    => 4 * $em,
                   },
                   { name          => 'error',
                     header_markup => __('Error'),
                     x_absolute    => 10 * $em,
                   },

lib/App/Chart/Gtk2/RawDialog.pm  view on Meta::CPAN

  my $date_width_editable = $date_width * 1.4; # diff font, and pulldown
  my $em = Gtk2::Ex::Units::em($treeview);
  my $digit_width = Gtk2::Ex::Units::digit_width ($self);

  my $datasheet = Gtk2::Ex::Datasheet::DBI->new
    ({ dbh => $dbh,
       sql => { select   => 'id,date1,price1,date2,price2,horizontal',
                from     => 'line',
                order_by => 'id ASC',
                where    => 'symbol=?',
                bind_values => [ '' ],
              },
       treeview => $treeview,
       fields => [
                  { name => 'id',
                    header_markup => __('Id'),
                    x_absolute    => 3 * $em,
                  },
                  { name          => 'date1',
                    header_markup => __('Date1'),
                    x_absolute    => $date_width_editable,

lib/App/Chart/Gtk2/RawDialog.pm  view on Meta::CPAN

  my $dbh = App::Chart::DBI->instance;
  my $em = Gtk2::Ex::Units::em($treeview);
  my $digit_width = Gtk2::Ex::Units::digit_width ($self);

  my $datasheet = Gtk2::Ex::Datasheet::DBI->new
    ({ dbh => $dbh,
       sql => { select   => 'id,price,above',
                from     => 'alert',
                order_by => 'id ASC',
                where    => 'symbol=?',
                bind_values => [ '' ],
              },
       treeview => $treeview,
       fields => [
                  { name => 'id',
                    header_markup => __('Id'),
                    x_absolute    => 3 * $em,
                  },
                  { name          => 'price1',
                    header_markup => __('Price1'),
                    x_absolute    => 15 * $digit_width,

lib/App/Chart/Gtk2/RawDialog.pm  view on Meta::CPAN

  my ($self, $pagewidget) = @_;
  ### _refresh_page(): $pagewidget->{'dirty'}
  ### for: $self->{'symbol'}

  if ($pagewidget->{'dirty'}) {
    Gtk2::Ex::WidgetCursor->busy;
    $pagewidget->{'dirty'} = 0;
    my $symbol = $self->{'symbol'};
    if (my $datasheet = $pagewidget->{'datasheet'}) {
      ### datasheet query
      $datasheet->query ({bind_values => [$symbol]}, 0);

    } elsif (my $seriestreeview = $pagewidget->{'seriestreeview'}) {
      my $series;
      if ($symbol) {
        require App::Chart::Series::Database;
        $series = App::Chart::Series::Database->new ($symbol);
      }
      $seriestreeview->set (series => $series);

    } elsif (my $rawlatest = $pagewidget->{'rawlatest'}) {

lib/App/Chart/Gtk2/Ticker.pm  view on Meta::CPAN

                  # App::Chart::Gtk2::Symlist::Join is a ListModelConcat not
                  # a Symlist subclass, allow that by just Glib::Object here
                  'Glib::Object',
                  Glib::G_PARAM_READWRITE),
                ];
App::Chart::Gtk2::GUI::chart_style_class (__PACKAGE__);

# priority level "gtk" treating this as widget level default, for overriding
# by application or user RC
Gtk2::Rc->parse_string (<<'HERE');
binding "App__Chart__Gtk2__Ticker_keys" {
  bind "F10"             { "menu_popup" (0, centre) }
  bind "Pointer_Button3" { "menu_popup" (3, pointer) }
}
class "App__Chart__Gtk2__Ticker" binding:gtk "App__Chart__Gtk2__Ticker_keys"
HERE

sub INIT_INSTANCE {
  my ($self) = @_;
  $self->add_events (['button-press-mask', 'key-press-mask']);
  $self->set (fixed_height_mode => 1);
  $self->set_flags ('can-focus');

  my $renderer = Gtk2::CellRendererText->new;
  $renderer->set (xpad => Gtk2::Ex::Units::em($self));

lib/App/Chart/Intraday.pm  view on Meta::CPAN

      VALUES (?,?,?,?,?,?,?,?)');

  my $image = $args{'image'};
  if (defined $image && length($image) == 0) { $image = undef; }
  my $resp = $args{'resp'};
  my $etag = (defined $resp ? scalar $resp->header('ETag') : undef);
  my $last_modified = (defined $resp ? $resp->last_modified : undef);

  my $symbol = $args{'symbol'};
  my $mode   = $args{'mode'};
  $sth->bind_param (1, $symbol);
  $sth->bind_param (2, $mode);
  $sth->bind_param (3, $image, DBI::SQL_BLOB());
  $sth->bind_param (4, $args{'error'});
  $sth->bind_param (5, App::Chart::Download::timestamp_now());
  $sth->bind_param (6, $args{'url'});
  $sth->bind_param (7, $etag);
  $sth->bind_param (8, $last_modified);
  $sth->execute;
  $sth->finish;

  ### send intraday-changed
  ### $symbol
  ### $mode
  App::Chart::chart_dirbroadcast()->send ('intraday-changed', $symbol, $mode);
}

1;

lib/App/Chart/doc/chart.html  view on Meta::CPAN

<li><a href="#Lisp" accesskey="3">Lisp</a></li>
<li><a href="#Simple-Emacs-Spreadsheet" accesskey="4">Simple Emacs Spreadsheet</a></li>
</ul>
<div class="section-level-extent" id="Watchlist-and-Quotes">
<h3 class="section"><span>18.1 Watchlist and Quotes<a class="copiable-link" href="#Watchlist-and-Quotes"> &para;</a></span></h3>

<a class="index-entry-id" id="index-chart_002dwatchlist"></a>
<p><kbd class="kbd">M-x chart-watchlist</kbd> displays the Favourites list in a buffer.  Key
<kbd class="key">a</kbd> adds a symbol.  <kbd class="kbd">C-k</kbd> and <kbd class="kbd">C-y</kbd> kill and yank symbols.
<kbd class="key">g</kbd> refreshes the quotes.  <kbd class="key">L</kbd> selects a different list (like the
Alerts list).  The usual <kbd class="kbd">C-h m</kbd> mode help shows other key bindings.
</p>
<p>Chart communicates changes to the lists between the Emacs display and a
running Chart GUI.  So if you have both open then changes in one are
reflected in the other a moment later.
</p>
<a class="index-entry-id" id="index-chart_002dquote"></a>
<p><kbd class="kbd">M-x chart-quote</kbd> displays a quote for a given symbol in the message area.
It prompts for the symbol with default a symbol at point.  <kbd class="key">Tab</kbd>
completion is available (see <a data-manual="emacs" href="https://www.gnu.org/software/emacs/manual/html_mono/emacs.html#Completion">Completion</a> in <cite class="cite">The Emacs Editor</cite>) using
the database symbols, favourites list, and previously requested symbols.

maybe/Build-PL  view on Meta::CPAN

                 'Gtk2::Ex::WidgetCursor' => 2,

                 'HTML::TableExtract' => 0,

                 # only needed for an LME plastics hack actually
                 'HTML::TreeBuilder' => 0,

                 'IO::String' => 0,
                 'List::MoreUtils' => 0,

                 # need 1.16 for bind_textdomain_filter() to mung gettext
                 # strings
                 'Locale::TextDomain' => '1.16',

                 # dunno what version actually needed, at least 5.803 for a
                 # working "decoded_content".
                 LWP => '5.803',

                 'Math::Round' => 0,
                 'Module::Load' => 0,

maybe/TreeOfTreesModel.pm  view on Meta::CPAN

# return ($model, $subiter, $mnum)
sub _iter_to_subiter {
  my ($self, $iter) = @_;
  my ($mnum, $index) = _iter_to_index ($self, $iter);
  return _index_to_subiter ($self, $index);
}

# return ($model, $subiter, $mnum)
sub _index_to_subiter {
  my ($self, $index) = @_;
  my ($model, $subindex, $mnum) = _index_to_subindex ($self, $index);
  return ($model, $model->iter_nth_child(undef,$subindex), $mnum);
}

# return ($model, $subindex, $mnum)
sub _index_to_subindex {
  my ($self, $index) = @_;
  if ($index < 0) {
    croak 'TreeOfTreesModel: invalid iter (negative index)';
  }
  my $models = $self->{'models'};
  my $positions = _model_positions ($self);
  if ($index >= $positions->[-1]) {
    croak 'TreeOfTreesModel: invalid iter (index too big)';
  }
  for (my $i = $#$positions - 1; $i >= 0; $i--) {

misc/binding-button-event.pl  view on Meta::CPAN

#
# You should have received a copy of the GNU General Public License along
# with Chart.  If not, see <http://www.gnu.org/licenses/>.

use strict;
use warnings;
use Gtk2 '-init';
use App::Chart::Gtk2::Ex::BindingBits;

Gtk2::Rc->parse_string (<<'HERE');
binding "my_bindings" {
  bind "Pointer_Button1" { "mysignal" ('plain button') }
  bind "<Alt>Pointer_Button1" { "mysignal" ('with alt') }
  bind "<Release>Pointer_Button3" { "mysignal" ('release 3') }
}
HERE

{
  package MyWidget;
  use strict;
  use warnings;
  use Gtk2;
  use Glib::Object::Subclass
    'Gtk2::Layout',

misc/binding-button-event.pl  view on Meta::CPAN

    my ($self) = @_;
    $self->add_events (['button-press-mask', 'button-release-mask']);
  }

  sub do_button_event {
    my ($self, $event) = @_;
    print "MyWidget ",$event->type," ",$event->button,
      " invoking activate_button_event()\n";

    my $found = App::Chart::Gtk2::Ex::BindingBits::activate_button_event
      ('my_bindings', $event, $self);
    if ($found) {
      print "  binding found and run\n";
    } else {
      print "  no binding found\n";
    }
    shift->signal_chain_from_overridden(@_);
  }

  sub do_mysignal {
    my ($self, $str) = @_;
    print "  mysignal runs: $str\n";
  }
}

misc/bindings-release.pl  view on Meta::CPAN


use strict;
use warnings;
use Gtk2 '-init';
use App::Chart::Gtk2::Ex::BindingBits;

use FindBin;
my $progname = $FindBin::Script;

Gtk2::Rc->parse_string (<<'HERE');
binding "mybindings" {
  bind "Pointer_Button1" { "mysig" ('plain button') }
  bind "<Alt>Pointer_Button1" { "mysig" ('with alt') }
  bind "<Release>Pointer_Button3" { "mysig" ('release 3') }
}
HERE

{
  package MyToplevel;
  use strict;
  use warnings;
  use Gtk2;
  use Glib::Object::Subclass
    'Gtk2::Window',

misc/bindings-release.pl  view on Meta::CPAN

my $toplevel = MyToplevel->new;
$toplevel->add_events (['button-press-mask', 'button-release-mask']);

$toplevel->signal_connect
  (button_press_event =>
   sub {
     my ($toplevel, $event) = @_;
     my $modifiers = $event->get_state;
     print "press modifiers ", ref($modifiers), ", $modifiers\n";
     my $found = App::Chart::Gtk2::Ex::BindingBits::activate_button_event
       ('mybindings', $event, $toplevel);
     print "  activate $found\n";
   });
$toplevel->signal_connect
  (button_release_event =>
   sub {
     my ($toplevel, $event) = @_;
     my $modifiers = $event->get_state;
     print "release modifiers ", ref($modifiers), ", $modifiers\n";
     my $found = App::Chart::Gtk2::Ex::BindingBits::activate_button_event
       ('mybindings', $event, $toplevel);
     print "  activate $found\n";
   });

$toplevel->show_all;
Gtk2->main;

misc/server.pl  view on Meta::CPAN

# with Chart.  If not, see <http://www.gnu.org/licenses/>.

use IO::File;
use strict;
use Socket;

my $port = 12345;

socket (LIST, PF_INET, SOCK_STREAM, getprotobyname('tcp')) or die;
setsockopt (LIST, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) or die;
bind (LIST, sockaddr_in($port, INADDR_ANY)) or die;
listen (LIST, 5) or die;

for (;;) {
  my $paddr = accept (SOCK, LIST) or die;

  if (fork() == 0) {
    SOCK->autoflush(1);
    my $req;
    for (;;) {
      if (sysread (SOCK, $req, 1024) == 0) {

misc/t-bindings.pl  view on Meta::CPAN

  foreach my $i (0 .. 10) {
    print "button $i keyval=",
      Gtk2::Gdk->keyval_from_name("Pointer_Button$i"),"\n";
  }
}

my $label = Gtk2::Label->new;
my $myobj = My::Object->new;

Gtk2::Rc->parse_string (<<'HERE');
binding "foo" {
  bind "x" { "mysig" () }
  bind "X" { "mysig" () }
  bind "Return" { "mysig" () }
  bind "Pointer_Button1" { "mysig" () }
}
HERE
# class "My__Object" binding "foo"

my $foo;
# $myobj->signal_emit ('mysig');

foreach my $class ('Gtk2::Entry', 'My::Object') {
  my $bindingset = Gtk2::BindingSet->by_class($class);
  print "by_class '$class' $bindingset\n";
}

$foo = Gtk2::BindingSet->find('foo');
print "find 'foo' $foo\n";

my $keyname = 'Return';
#my $keyname = 'Pointer_Button1';
my $keyval = Gtk2::Gdk->keyval_from_name($keyname);

{
  print "foo->activate $keyname on myobj\n";
  my $activated = $foo->activate ($keyval, [], $myobj);
  print "  activate result=", ($activated ? "yes" : "no"), "\n";
}
{
  print "myobj->bindings_activate $keyname\n";
  my $activated = $myobj->bindings_activate ($keyval, []);
  print "  bindings_activate result=", ($activated ? "yes" : "no"), "\n";
}

{
  my $keymap = Gtk2::Gdk::Keymap->get_default;
  my @entries = $keymap->get_entries_for_keyval ($keyval);
  require Data::Dumper;
  print Data::Dumper->new([\@entries],['entries'])->Dump;
}

exit 0;

misc/t-entry.pl  view on Meta::CPAN


use strict;
use warnings;
use Gtk2 '-init';

use FindBin;
my $progname = $FindBin::Script;


Gtk2::Rc->parse_string (<<HERE);
binding "my_keys" {
  bind "<ctrl>x" { "move-cursor" (logical-positions, -1, 0) }
}
class "GtkEntry" binding "my_keys"
HERE


my $toplevel = Gtk2::Window->new('toplevel');
$toplevel->signal_connect (destroy => sub { Gtk2->main_quit; });

my $vbox = Gtk2::VBox->new;
$toplevel->add ($vbox);

my $entry = Gtk2::Entry->new;

misc/t-entry.pl  view on Meta::CPAN


my $keyval_left = Gtk2::Gdk->keyval_from_name('Left');

{
  my $button = Gtk2::Button->new_with_label ("keyval left");
  $button->signal_connect
    (clicked => sub {
       Glib::Timeout->add
           (3000, sub {
              print "$progname: keyval left\n";
              $entry->bindings_activate ($keyval_left, []);
              return 0;
            });
     });
  $vbox->pack_start ($button, 0,0,0);
}
{
  my $button = Gtk2::Button->new_with_label ("event left");
  $button->signal_connect
    (clicked => sub {
       my $event = Gtk2::Gdk::Event->new ('key-press');
       $event->window ($entry->window);
       # $event->hardware_keycode (100); # Left
       $event->hardware_keycode (36); # Return
       $event->group (0);
       $event->keyval ($keyval_left);
       $event->set_state ([]);
       Glib::Timeout->add
           (3000, sub {
              print "$progname: event left\n";
              print "  dispatch ",($entry->bindings_activate_event($event)
                                   ? "yes" : "no"), "\n";
              return 0;
            });
     });
  $vbox->pack_start ($button, 0,0,0);
}

$toplevel->show_all;
Gtk2->main;
exit 0;

misc/t-raw.pl  view on Meta::CPAN

  my ($str) = @_;
  return ($str =~ /^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$/);
}

$datasheet_def
  = { dbh => $dbh,
      sql => { select   => 'ex_date, record_date, pay_date, amount, imputation, qualifier, note',
               from     => 'dividend',
               order_by => 'ex_date',
               where    => 'symbol=?',
               bind_values => [ 'BHP.AX' ],
             },
      vbox => $vbox,
      fields => [ { name          => 'ex_date',
                    # renderer      => 'date',
                    validation    => \&validate_date,
                  },
                  { name          => 'record_date',
                    # renderer      => 'date',
                    validation    => \&validate_date,
                  },

misc/t-raw.pl  view on Meta::CPAN

                  },
                ],
    };

$datasheet_def
  = { dbh => App::Chart::DBI->instance,
      sql => { select   => 'date, open, high, low, close, volume, openint',
               from     => 'daily',
               order_by => 'date',
               where    => 'symbol=?',
               bind_values => [ 'BHP.AX' ],
             },
      vbox => $vbox,
      # treeview => $treeview,
      fields => [ { name       => 'date',
                    validation => \&validate_date,
                    x_absolute => 9 * $em,
                  },
                  { name       => 'open',
                    align      => 'right',
                    x_absolute => 9 * $em,

misc/t-raw.pl  view on Meta::CPAN

    };

my $treeview = Gtk2::TreeView->new;
$vbox->pack_start ($treeview, 0,0,0);

$datasheet_def = { dbh => $dbh,
                   sql => { select   => 'key, value',
                            from     => 'extra',
                            order_by => 'key ASC',
                            where    => 'symbol=?',
                            bind_values => [ '' ],
                          },
                   treeview => $treeview,
                   fields => [
                              { name => 'key',
                                header_markup => ('Key'),
                                x_absolute    => 15 * $em,
                              },
                              { name => 'value',
                                header_markup => ('Value'),
                                x_absolute    => 15 * $em,

misc/t-raw.pl  view on Meta::CPAN

  # 
  #     my $treeview = $self->{'treeview'} = Gtk2::TreeView->new;
  #     $scrolled->add ($treeview);
  # 
  #     my $datasheet = Gtk2::Ex::Datasheet::DBI->new
  #       ({ dbh => App::Chart::DBI->instance,
  #          sql => { select   => 'date, open, high, low, close, volume, openint',
  #                   from     => 'daily',
  #                   order_by => 'date DESC',
  #                   where    => 'symbol=?',
  #                   bind_values => [ '' ],
  #                 },
  #          treeview => $treeview,
  #          fields => [ { name          => 'date',
  #                        header_markup => __('Date'),
  #                        x_absolute    => $date_width,
  #                        validation    => \&validate_date,
  #                      },
  #                      { name          => 'open',
  #                        header_markup => __('Open'),
  #                        align         => 'right',



( run in 2.590 seconds using v1.01-cache-2.11-cpan-2398b32b56e )