view release on metacpan or search on metacpan
debian/control view on Meta::CPAN
Section: misc
Priority: optional
Build-Depends: cdbs, debhelper (>= 5), texinfo, libfile-slurp-perl
Maintainer: Kevin Ryde <user42_kevin@yahoo.com.au>
Standards-Version: 4.2.1
Homepage: http://user42.tuxfamily.org/chart/index.html
Bugs: mailto:user42_kevin@yahoo.com.au
Package: chart
Architecture: all
Depends: perl (>= 5.10), libclass-singleton-perl (>= 1.4), libclass-weaksingleton-perl, libconstant-defer-perl, libdate-calc-perl (>= 5.0), libdbd-sqlite3-perl (>= 1.27), libdbi-perl, libencode-locale-perl (>= 0.02), libfile-homedir-perl (>= 0.61), l...
Recommends: libcrypt-ssleay-perl, libdevel-stacktrace-perl (>= 1.19), libintl-xs-perl (>= 1.19), libset-intspan-fast-xs-perl (>= 0.05), libspreadsheet-parseexcel-perl
Suggests: bash-completion, emacs | emacsen, libbsd-resource-perl, libdevel-arena-perl, libdevel-findblessedrefs-perl, libdevel-mallinfo-perl, libfinance-quote-perl, libfinance-ta-perl, libgt-perl, sensible-utils
Description: Stock and commodity charting
Chart displays stock and commodity charts from downloaded data.
.
Share quotes and data from Yahoo and some other sources. Fund
quotes and data from MLC and Yahoo (US funds).
.
Chart is written in Perl using Gtk2-Perl to for the Gtk toolkit.
Extensions and customizations can be made using Perl.
lib/App/Chart/Gtk2/AnnDrag.pm view on Meta::CPAN
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;
my $orig_elem; # from database, or undef for new line
my $edit_elem;
use constant::defer init => sub {
$graph->signal_connect (motion_notify_event => \&_do_motion_notify_event);
$graph->signal_connect (button_release_event=> \&_do_button_release_event);
require Gtk2::Ex::WidgetCursor;
$cursor = Gtk2::Ex::WidgetCursor->new (widget => $graph,
cursor => 'left_ptr');
require Gtk2::Ex::WidgetEvents;
$wevents = Gtk2::Ex::WidgetEvents->new ($graph, ['key-press-mask',
'button-motion-mask',
'button-release-mask']);
require Gtk2::Ex::KeySnooper;
$snooper = Gtk2::Ex::KeySnooper->new;
return; # nothing to memoize
};
lib/App/Chart/Gtk2/AnnDrag.pm view on Meta::CPAN
if ($orig_elem) {
$edit_elem = $orig_elem->clone;
$drawn = 1;
} else {
$edit_elem = App::Chart::Annotation::Line->new_for_graph ($graph, $x, $y);
$drawn = 0;
draw(1);
}
$active = 1;
$cursor->active (1);
$snooper->install (\&_do_key_snooper);
}
sub _stop {
$active = 0;
$cursor->active (0);
$snooper->remove;
}
sub done {
if (! $active) { return; }
if (DEBUG) { print "done\n"; }
_stop ();
draw (1);
}
lib/App/Chart/Gtk2/Ex/TextViewBits.pm view on Meta::CPAN
# ### TextViewBits replace_text()
# my $linenum = window_linenum ($textview);
# ### window linenum: $linenum
#
# my $textbuf = $textview->get_buffer;
# $textbuf->set_text ($str);
#
# # Had lots of trouble here. scroll_to_iter didn't take effect unless
# # called twice, and then stubbornly refused to put the last page visible.
# # scroll_to_mark works, but the first time through have to do a
# # place_cursor or else it starts off showing the end of the buffer instead
# # of the start. :-(
# #
# # Still not quite right if you do it too rapidly :-(
# #
# my $iter = $textbuf->get_iter_at_line ($linenum);
# $textbuf->place_cursor ($iter);
# my $mark = $textbuf->get_mark (__PACKAGE__);
# if ($mark) { $textbuf->move_mark ($mark, $iter); }
# else { $mark = $textbuf->create_mark (__PACKAGE__, $iter, 0); }
# $textview->scroll_to_mark ($mark, 0, 1, 0.0, 0.0);
# }
# =item C<< App::Chart::Gtk2::Ex::TextViewBits::replace_text ($textview, $str) >>
#
# Replace the text in C<$textview>'s buffer, preserving its window position.
lib/App/Chart/Gtk2/Ex/WidgetPointerGrab.pm view on Meta::CPAN
# with Chart. If not, see <http://www.gnu.org/licenses/>.
package App::Chart::Gtk2::Ex::WidgetPointerGrab;
use 5.008;
use strict;
use warnings;
use Carp;
use App::Chart::Glib::Ex::MoreUtils;
sub new_pointer_grab {
my ($class, $widget, $owner_events, $event_mask, $confine_to, $cursor, $time)
= @_;
my $window = $widget->window
|| croak "Cannot grab pointer for unrealized widget\n";
my $status = $window->pointer_grab
($window, $owner_events, $event_mask, $confine_to, $cursor, $time);
if ($status ne 'success') {
return $status;
}
my $self = bless { widget => $widget,
time => $time
}, $class;
require Scalar::Util;
Scalar::Util::weaken ($self->{'widget'});
lib/App/Chart/Gtk2/Graph.pm view on Meta::CPAN
my ($self, $button) = @_;
my $hadj = $self->{'hadjustment'} || return; # only when adj set
my $vadj = $self->{'vadjustment'} || return; # only when adj set
my $dragger = ($self->{'dragger'} ||= do {
require Gtk2::Ex::Dragger;
Gtk2::Ex::Dragger->new (widget => $self,
hadjustment => $hadj,
vadjustment => $vadj,
vinverted => 1,
confine => 1,
cursor => 'fleur')
});
$dragger->start (Gtk2->get_current_event);
}
sub _do_start_lasso {
my ($self, $button) = @_;
my $lasso = ($self->{'lasso'} ||= do {
require Gtk2::Ex::Lasso;
my $l = Gtk2::Ex::Lasso->new (widget => $self);
$l->signal_connect (ended => \&_do_lasso_ended);
lib/App/Chart/Gtk2/HAxis.pm view on Meta::CPAN
}
sub _do_start_drag {
my ($self, $button) = @_;
if (DEBUG) { print "HAxis _do_start_drag\n"; }
my $adj = $self->{'adjustment'} || return; # only when an adj set
require Gtk2::Ex::Dragger;
my $dragger = ($self->{'dragger'} ||= Gtk2::Ex::Dragger->new
(widget => $self,
hadjustment => $adj,
cursor => 'sb-h-double-arrow',
confine => 1));
$dragger->start (Gtk2->get_current_event);
}
# 'size_request' class closure
sub _do_size_request {
my ($self, $req) = @_;
my $layout = $self->{'layout'};
my $line_height = Gtk2::Ex::Units::line_height($layout);
lib/App/Chart/Gtk2/IntradayDialog.pm view on Meta::CPAN
my $status_str = ($job ? __('Download: ') . $job->status : '');
$self->{'progress_label'}->set_text ($status_str);
### status: $job && $job->status
$self->set_response_sensitive (RESPONSE_REFRESH,
$symbol && $mode && ! $job_running);
if ($job_running) {
# created when first needed for a running job
$self->{'widgetcursor'} ||= do {
require Gtk2::Ex::WidgetCursor;
Gtk2::Ex::WidgetCursor->new (widgets => [ $self->{'image'},
$self->{'refresh_button'} ],
cursor => 'watch',
priority => 10);
};
}
if (my $wcursor = $self->{'widgetcursor'}) {
$wcursor->active ($job_running);
}
}
sub _do_accel_redraw {
my ($accelgroup, $self, $keyval, $modifiers) = @_;
$self->queue_draw;
}
sub popup {
my ($class, $symbol, $parent) = @_;
lib/App/Chart/Gtk2/OpenDialog.pm view on Meta::CPAN
$main->show;
$self->hide;
$main->goto_symbol ($symbol, $symlist);
}
#------------------------------------------------------------------------------
sub tree_current_symlist {
my ($self) = @_;
my $treeview = $self->{'treeview'};
my ($path, $focus_column) = $treeview->get_cursor;
if (! $path) { return undef; }
my $model = $self->{'model'};
my $iter = $model->get_iter ($path) || return undef;
# OpenModel
return $model->get_value ($iter, $model->COL_SYMLIST_OBJECT);
# if (! $model->iter_has_child ($iter)) {
# $iter = $model->iter_parent ($iter);
lib/App/Chart/Gtk2/OpenDialog.pm view on Meta::CPAN
sub scroll_to_symbol_and_symlist {
my ($self, $symbol, $symlist) = @_;
my $treeview = $self->{'treeview'};
my $model = $self->{'model'};
my $path = $model->path_for_symbol_and_symlist ($symbol, $symlist);
if (! $path) {
die "OpenDialog: oops, no path for $symbol, $symlist";
}
### OpenDialog scroll to: $path->to_string
Gtk2::Ex::TreeViewBits::scroll_cursor_to_path ($treeview, $path);
}
# 'row-activated' signal on the TreeView
sub _do_row_activated {
my ($treeview, $path, $treeviewcolumn) = @_;
### OpenDialog row_activated: $path->to_string
my $self = $treeview->get_toplevel;
my $model = $self->{'model'};
my $iter = $model->get_iter ($path) || do {
$self->error_bell;
lib/App/Chart/Gtk2/RawDialog.pm view on Meta::CPAN
RESPONSE_UNDO => 3,
RESPONSE_REFRESH => 4,
};
# sub _do_edited {
# my ($cell, $pathstr, $newstr, $self) = @_;
# my $path = Gtk2::TreePath->new_from_string ($pathstr);
# my $model = $self->{'model'};
# my $treeview = $self->{'treeview'};
# my $iter = $model->get_iter ($path);
# my ($treepath, $treeviewcolumn) = $treeview->get_cursor;
# my $col = $treeviewcolumn->{'model_col'};
# $model->set_value ($iter, $col, $newstr);
# }
# sub _do_data_changed {
# my ($self, $symbol_hash) = @_;
# my $symbol = $self->{'symbol'};
# if (List::Util::first {$_ eq $symbol} @symbol_list) {
# $self->refresh;
# }
lib/App/Chart/Gtk2/View.pm view on Meta::CPAN
sub _do_vaxis_button_press {
my ($vaxis, $event) = @_;
if ($event->button == 1) {
require Gtk2::Ex::Dragger;
my $dragger = ($vaxis->{'dragger'} ||=
Gtk2::Ex::Dragger->new
(widget => $vaxis,
vadjustment => $vaxis->get('adjustment'),
vinverted => 1,
cursor => 'sb-v-double-arrow',
confine => 1));
$dragger->start ($event);
}
return Gtk2::EVENT_PROPAGATE;
}
sub _set_symbol {
my ($self, $symbol) = @_;
if (! $symbol) { return; }
lib/App/Chart/Gtk2/WatchlistDialog.pm view on Meta::CPAN
# supposed to be visible only when symlists showing, but check anyway
($pagenum == NOTEBOOK_PAGENUM_SYMLISTS) or return;
my $treeview = $self->{'symlists_treeview'};
my $selection = $treeview->get_selection;
my ($symlists_model, $iter) = $selection->get_selected;
# supposed to be insensitive if no selection, but check anyway
if (! defined $iter) { return; }
my $path = $symlists_model->get_path($iter);
### set_cursor to path: $path->to_string
$treeview->grab_focus;
my $renderer = $self->{'symlists_name_renderer'};
$renderer->set (editable => 1);
$treeview->set_cursor ($path, $self->{'symlists_name_treecolumn'}, 1);
$renderer->set (editable => 0);
} elsif ($response eq 'close') {
# as per a keyboard close, defaults to raising 'delete-event', which in
# turn defaults to a destroy
$self->signal_emit ('close');
} elsif ($response eq 'help') {
require App::Chart::Manual;
App::Chart::Manual->open(__p('manual-node','Watchlist'), $self);
lib/App/Chart/Gtk2/WatchlistDialog.pm view on Meta::CPAN
my $self = $entry_or_button->get_toplevel;
my $treeview = $self->{'symlists_treeview'};
my $pos = treeview_pos_after_selected_or_top_of_visible ($treeview);
my $entry = $self->{'symlist_entry'};
my $name = $entry->get_text;
require App::Chart::Gtk2::Symlist::User;
App::Chart::Gtk2::Symlist::User->add_symlist ($pos, $name);
my $path = Gtk2::TreePath->new_from_indices ($pos);
Gtk2::Ex::TreeViewBits::scroll_cursor_to_path ($treeview, $path);
}
# 'activate' signal handler on the Gtk2::Entry for a symbol
sub _do_symbol_entry_activate {
my ($entry_or_button) = @_;
my $self = $entry_or_button->get_toplevel;
my $treeview = $self->{'symbols_treeview'};
my $pos = treeview_pos_after_selected_or_top_of_visible ($treeview);
my $entry = $self->{'symbol_entry'};
lib/App/Chart/Gtk2/WatchlistDialog.pm view on Meta::CPAN
$entry->error_bell;
return;
}
# select text for ease of typing another
Gtk2::Ex::EntryBits::select_region_noclip ($entry, 0, -1);
my $symbol = $entry->get_text;
if (my $path = $symlist->find_symbol_path ($symbol)) {
# already exists, move to it
Gtk2::Ex::TreeViewBits::scroll_cursor_to_path ($treeview, $path);
return;
}
$symlist->insert_with_values ($pos, 0=>$symbol);
my $path = Gtk2::TreePath->new_from_indices ($pos);
Gtk2::Ex::TreeViewBits::scroll_cursor_to_path ($treeview, $path);
# request this, everything else as extras
if ($symbol ne '') {
require App::Chart::Gtk2::Job::Latest;
App::Chart::Gtk2::Job::Latest->start ([$symbol]);
}
}
#------------------------------------------------------------------------------
# generic helpers
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);
misc/t-series-treeview.pl view on Meta::CPAN
$treeview->signal_connect
(button_press_event => sub {
my ($treeview, $event) = @_;
print "$progname: button";
if ($event->button == 3) {
require Gtk2::Ex::Dragger;
my $dragger = ($treeview->{'dragger'} ||=
Gtk2::Ex::Dragger->new
(widget => $treeview,
vadjustment => $scrolled->get_vadjustment,
cursor => 'sb-v-double-arrow',
confine => 1));
$dragger->start ($event);
return 1; # Gtk2::EVENT_STOP
}
return Gtk2::EVENT_PROPAGATE;
});
$toplevel->show_all;
Gtk2->main;
exit 0;