~ubuntu-branches/ubuntu/saucy/padre/saucy-proposed

« back to all changes in this revision

Viewing changes to lib/Padre/Wx/TodoList.pm

  • Committer: Package Import Robot
  • Author(s): Dominique Dumont, gregor herrmann, Dominique Dumont
  • Date: 2012-01-04 12:04:20 UTC
  • mfrom: (1.3.3)
  • Revision ID: package-import@ubuntu.com-20120104120420-i5oybqwf91m1d3il
Tags: 0.92.ds1-1
[ gregor herrmann ]
* Remove debian/source/local-options; abort-on-upstream-changes
  and unapply-patches are default in dpkg-source since 1.16.1.
* Swap order of alternative (build) dependencies after the perl
  5.14 transition.

[ Dominique Dumont ]
* Imported Upstream version 0.92.ds1
* removed fix-spelling patch (applied upstream)
* lintian-override: use wildcard to avoid listing a gazillion files
* updated size of some 'not-real-man-page' entries
* rules: remove dekstop cruft (replaced by a file provided in debian
  directory)
* control: removed Breaks statement. Add /me to uploaders. Updated
  dependencies
* rules: make sure that non-DFSG file (i.e. the cute butterfly, sigh)
  is not distributed

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
use warnings;
6
6
use Scalar::Util          ();
7
7
use Params::Util          ();
 
8
use Padre::Feature        ();
8
9
use Padre::Role::Task     ();
9
10
use Padre::Wx::Role::View ();
10
11
use Padre::Wx::Role::Main ();
11
12
use Padre::Wx             ();
12
13
 
13
 
our $VERSION = '0.90';
 
14
our $VERSION = '0.92';
14
15
our @ISA     = qw{
15
16
        Padre::Role::Task
16
17
        Padre::Wx::Role::View
34
35
        my $self = $class->SUPER::new(
35
36
                $panel,
36
37
                -1,
37
 
                Wx::wxDefaultPosition,
38
 
                Wx::wxDefaultSize,
 
38
                Wx::DefaultPosition,
 
39
                Wx::DefaultSize,
39
40
        );
40
41
 
41
42
        # Temporary store for the todo list.
49
50
                $self,
50
51
                -1,
51
52
                '',
52
 
                Wx::wxDefaultPosition,
53
 
                Wx::wxDefaultSize,
54
 
                Wx::wxTE_PROCESS_ENTER | Wx::wxSIMPLE_BORDER,
 
53
                Wx::DefaultPosition,
 
54
                Wx::DefaultSize,
 
55
                Wx::TE_PROCESS_ENTER | Wx::SIMPLE_BORDER,
55
56
        );
56
57
 
57
58
        # Create the Todo list
58
59
        $self->{list} = Wx::ListBox->new(
59
60
                $self,
60
61
                -1,
61
 
                Wx::wxDefaultPosition,
62
 
                Wx::wxDefaultSize,
 
62
                Wx::DefaultPosition,
 
63
                Wx::DefaultSize,
63
64
                [],
64
 
                Wx::wxLB_SINGLE | Wx::wxBORDER_NONE
 
65
                Wx::LB_SINGLE | Wx::BORDER_NONE
65
66
        );
66
67
 
67
68
        # Create a sizer
68
 
        my $sizer = Wx::BoxSizer->new(Wx::wxVERTICAL);
69
 
        $sizer->Add( $self->{search}, 0, Wx::wxALL | Wx::wxEXPAND );
70
 
        $sizer->Add( $self->{list},   1, Wx::wxALL | Wx::wxEXPAND );
 
69
        my $sizer = Wx::BoxSizer->new(Wx::VERTICAL);
 
70
        $sizer->Add( $self->{search}, 0, Wx::ALL | Wx::EXPAND );
 
71
        $sizer->Add( $self->{list},   1, Wx::ALL | Wx::EXPAND );
71
72
 
72
73
        # Fits panel layout
73
74
        $self->SetSizerAndFit($sizer);
82
83
                }
83
84
        );
84
85
 
85
 
        # Handle double click on list
86
 
        # overwrite this handler to avoid stealing the focus back from the editor
87
 
        Wx::Event::EVT_LEFT_DCLICK(
88
 
                $self->{list},
89
 
                sub { return; }
90
 
        );
 
86
        # Handle double click on list.
 
87
        # Overwrite to avoid stealing the focus back from the editor.
 
88
        # On Windows this appears to kill the double-click feature entirely.
 
89
        unless (Padre::Constant::WIN32) {
 
90
                Wx::Event::EVT_LEFT_DCLICK(
 
91
                        $self->{list},
 
92
                        sub {
 
93
                                return;
 
94
                        }
 
95
                );
 
96
        }
91
97
 
92
98
        # Handle key events
93
99
        Wx::Event::EVT_KEY_UP(
96
102
                        my ( $this, $event ) = @_;
97
103
 
98
104
                        my $code = $event->GetKeyCode;
99
 
                        if ( $code == Wx::WXK_RETURN ) {
 
105
                        if ( $code == Wx::K_RETURN ) {
100
106
                                $self->on_list_item_activated($event);
101
 
                        } elsif ( $code == Wx::WXK_ESCAPE ) {
 
107
                        } elsif ( $code == Wx::K_ESCAPE ) {
102
108
 
103
109
                                # Escape key clears search and returns focus
104
110
                                # to the editor
120
126
                        my $event = shift;
121
127
                        my $code  = $event->GetKeyCode;
122
128
 
123
 
                        if ( $code == Wx::WXK_DOWN || $code == Wx::WXK_UP || $code == Wx::WXK_RETURN ) {
 
129
                        if ( $code == Wx::K_DOWN || $code == Wx::K_UP || $code == Wx::K_RETURN ) {
124
130
 
125
131
                                # Up/Down and return keys focus on the functions lists
126
132
                                $self->{list}->SetFocus;
130
136
                                }
131
137
                                $self->{list}->Select($selection);
132
138
 
133
 
                        } elsif ( $code == Wx::WXK_ESCAPE ) {
 
139
                        } elsif ( $code == Wx::K_ESCAPE ) {
134
140
 
135
141
                                # Escape key clears search and returns the
136
142
                                # focus to the editor.
154
160
 
155
161
        $main->add_refresh_listener($self);
156
162
 
 
163
        if (Padre::Feature::STYLE_GUI) {
 
164
                $self->main->theme->apply($self);
 
165
        }
 
166
 
157
167
        return $self;
158
168
}
159
169
 
223
233
 
224
234
        # Flush and hide the list if there is no active document
225
235
        unless ($document) {
226
 
                my $lock = $self->main->lock('UPDATE');
 
236
                my $lock = $self->lock_update;
227
237
                $search->Hide;
228
238
                $list->Hide;
229
239
                $list->Clear;
287
297
 
288
298
        # Show the components and populate the function list
289
299
        SCOPE: {
290
 
                my $lock = $self->main->lock('UPDATE');
 
300
                my $lock = $self->lock_update;
291
301
                $search->Show(1);
292
302
                $list->Show(1);
293
303
                $list->Clear;