| 1 | package Padre::Plugin::My; |
|---|
| 2 | |
|---|
| 3 | use 5.008; |
|---|
| 4 | use strict; |
|---|
| 5 | use warnings; |
|---|
| 6 | use Padre::Config::Constants qw( $PADRE_CONFIG_DIR ); |
|---|
| 7 | use Padre::Wx (); |
|---|
| 8 | use Padre::Plugin (); |
|---|
| 9 | use Padre; |
|---|
| 10 | use Padre::Plugin::Todo::UI; |
|---|
| 11 | |
|---|
| 12 | our $VERSION = '0.29'; |
|---|
| 13 | use base 'Padre::Plugin'; |
|---|
| 14 | |
|---|
| 15 | ##################################################################### |
|---|
| 16 | # Padre::Plugin Methods |
|---|
| 17 | |
|---|
| 18 | sub padre_interfaces { |
|---|
| 19 | 'Padre::Plugin' => 0.24 |
|---|
| 20 | } |
|---|
| 21 | |
|---|
| 22 | sub plugin_name { |
|---|
| 23 | 'Todo'; |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | sub menu_plugins_simple { |
|---|
| 27 | my $self = shift; |
|---|
| 28 | return $self->plugin_name => [ |
|---|
| 29 | 'About' => sub { $self->show_about }, |
|---|
| 30 | 'Show' => sub { $self->show_todo }, |
|---|
| 31 | # 'Another Menu Entry' => sub { $self->about }, |
|---|
| 32 | # 'A Sub-Menu...' => [ |
|---|
| 33 | # 'Sub-Menu Entry' => sub { $self->about }, |
|---|
| 34 | # ], |
|---|
| 35 | ]; |
|---|
| 36 | } |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | ##################################################################### |
|---|
| 43 | # Custom Methods |
|---|
| 44 | |
|---|
| 45 | sub show_about { |
|---|
| 46 | my $self = shift; |
|---|
| 47 | |
|---|
| 48 | # Locate this plugin |
|---|
| 49 | my $path = File::Spec->catfile( |
|---|
| 50 | $PADRE_CONFIG_DIR, |
|---|
| 51 | qw{ plugins Padre Plugin My.pm } |
|---|
| 52 | ); |
|---|
| 53 | |
|---|
| 54 | # Generate the About dialog |
|---|
| 55 | my $about = Wx::AboutDialogInfo->new; |
|---|
| 56 | $about->SetName("Todo"); |
|---|
| 57 | $about->SetDescription( <<"END_MESSAGE" ); |
|---|
| 58 | Dynamic "To-do" list for Padre |
|---|
| 59 | END_MESSAGE |
|---|
| 60 | |
|---|
| 61 | # Show the About dialog |
|---|
| 62 | Wx::AboutBox( $about ); |
|---|
| 63 | |
|---|
| 64 | return; |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | # XXX This should go into a proper show/hide function |
|---|
| 68 | sub show_todo { |
|---|
| 69 | my ($self,$show) = shift; |
|---|
| 70 | $show = 1; |
|---|
| 71 | my $main = Padre->ide->wx->main; |
|---|
| 72 | #$main->right->hide( $main->{todo} ); |
|---|
| 73 | if ($main->{todo}) { |
|---|
| 74 | $main->right->hide( $main->{todo} ); |
|---|
| 75 | } |
|---|
| 76 | if ($show) { |
|---|
| 77 | #if (! $main->{todo}) { |
|---|
| 78 | $main->{todo} = Padre::Plugin::Todo::UI->new($main); |
|---|
| 79 | #}; |
|---|
| 80 | $main->right->show( $main->{todo} ); |
|---|
| 81 | $main->{todo}->refresh($main->current); |
|---|
| 82 | } else { |
|---|
| 83 | if ($main->{todo}) { |
|---|
| 84 | $main->right->hide( $main->{todo} ); |
|---|
| 85 | } |
|---|
| 86 | }; |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | 1; |
|---|
| 90 | |
|---|
| 91 | # Copyright 2008-2009 The Padre development team as listed in Padre.pm. |
|---|
| 92 | # LICENSE |
|---|
| 93 | # This program is free software; you can redistribute it and/or |
|---|
| 94 | # modify it under the same terms as Perl 5 itself. |
|---|