App-Chart

 view release on metacpan or  search on metacpan

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

# Graph widget.

# Copyright 2007, 2008, 2009, 2010, 2011, 2013, 2018 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 version.
#
# Chart is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with Chart.  If not, see <http://www.gnu.org/licenses/>.

package App::Chart::Gtk2::Graph;
use 5.010;
use strict;
use warnings;
use Gtk2 1.220;
use List::Util qw(min max);
use List::MoreUtils 0.24; # version 0.24 for bug fixes
use Module::Load;
use POSIX ();
use Set::IntSpan::Fast 1.10;  # 1.10 for contains_all_range()
use Locale::Messages;
use Locale::TextDomain ('App-Chart');

# alerts and lines last since they're xor based, umm, maybe
use Module::Pluggable require => 1;
my @plugins = sort __PACKAGE__->plugins;
### Graph plugins: @plugins

use Glib::Ex::SignalIds;
use Gtk2::Ex::AdjustmentBits 43; # v.43 for set_maybe()
use Gtk2::Ex::GdkBits 23;        # v.23 for window_clear_region()

use App::Chart::Glib::Ex::MoreUtils;
use App::Chart::Gtk2::GUI;
use App::Chart::Series;
use App::Chart::Gtk2::Graph::Plugin::Latest;

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

use Glib::Object::Subclass
  'Gtk2::DrawingArea',
  signals => { button_press_event => \&_do_button_press,
               expose_event       => \&_do_expose_event,
               # size_allocate      => \&_do_size_allocate,
               scroll_event       => \&_do_scroll_event,

               # GtkToolbar in gtk 2.14.7 has a bug in its finalize
               # provoking a ref_count>0 log error if anyone is hooked onto
               # 'parent-set', even if in an unrelated class, so use notify
               # instead
               #
               # parent_set => \&_do_parent_set,
               #
               # notify             => \&_do_notify,

               set_scroll_adjustments =>
               { param_types => ['Gtk2::Adjustment',
                                 'Gtk2::Adjustment'],
                 return_type => undef,
                 class_closure => \&_do_set_scroll_adjustments },

               start_drag => { param_types => ['Glib::Int'],
                               return_type => undef,
                               class_closure => \&_do_start_drag,
                               flags => ['run-first','action'] },
               start_lasso => { param_types => ['Glib::Int'],
                                return_type => undef,
                                class_closure => \&_do_start_lasso,
                                flags => ['run-first','action'] },
               start_annotation_drag =>
               { param_types => ['Glib::Int'],
                 return_type => undef,
                 class_closure => \&_do_start_annotation_drag,
                 flags => ['run-first','action'] },

             },



( run in 2.614 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )