Show
Ignore:
Timestamp:
12/29/09 01:02:23 (8 months ago)
Author:
code4pay
Message:

Fix for #390, Padre should now behave as per other X11 editors. more
middle mouse button actions.
--This line, and th se below, will be ignored--

M Editor.pm

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/Padre/lib/Padre/Wx/Editor.pm

    r10022 r10023  
    813813sub on_smart_highlight_begin { 
    814814        my ( $self, $event ) = @_; 
    815  
    816815        my $selection        = $self->GetSelectedText; 
     816         
     817        $self->put_text_to_clipboard($selection, 1); 
    817818        my $selection_length = length $selection; 
    818819        return if $selection_length == 0; 
     
    854855                } 
    855856        } 
    856  
     857         
    857858} 
    858859 
     
    870871        if ( Padre::Constant::WXGTK and defined $text and $text ne '' ) { 
    871872 
    872                 # Only on X11 based platforms 
    873                 #               Wx::wxTheClipboard->UsePrimarySelection(1); 
    874                 $self->put_text_to_clipboard($text); 
    875  
    876                 #               Wx::wxTheClipboard->UsePrimarySelection(0); 
     873                 
     874                $self->put_text_to_clipboard($text,1); 
     875 
     876                 
    877877        } 
    878878 
     
    892892        # It seems that another event is doing something but not within this module. 
    893893        # Please look at ticket #390 for details! 
    894  
    895         Padre::Current->editor->Paste; 
    896  
     894        Wx::wxTheClipboard->UsePrimarySelection(1); 
     895        if (Padre::Constant::WIN32) 
     896        { 
     897                Padre::Current->editor->Paste; 
     898        } 
     899         
    897900        my $doc = $self->{Document}; 
    898901        if ( $doc->can('event_on_middle_up') ) { 
    899902                $doc->event_on_middle_up( $self, $event ); 
    900903        } 
    901  
     904        Wx::wxTheClipboard->UsePrimarySelection(0); 
    902905        $event->Skip; 
    903906        return; 
    904907} 
    905  
    906908# Manipulate the window manager selection buffer when editor looses focus 
    907909sub on_kill_focus { 
     
    10591061sub Paste { 
    10601062        my $self = shift; 
    1061  
    1062         # Workaround for Copy/Paste bug ticket #390 
     1063         
    10631064        my $text = $self->get_text_from_clipboard; 
    1064  
     1065         
    10651066        if ($text) { 
    10661067 
     
    11251126} 
    11261127 
     1128# put_text_to_clipboard 
     1129# $self->put_text_to_clipboard($text, $clipboard_Number ) 
     1130# where X11 based display systems  
     1131# clipboard number is either the GTK clipboard or the X11 
     1132# clipboard.  Clipboard 1 is used for normal X11 copy onselect and 
     1133# paste on middle button. Has no affect on windows. 
     1134# Puts Text on the clipboard 
     1135 
    11271136sub put_text_to_clipboard { 
    1128         my ( $self, $text ) = @_; 
     1137        my ( $self, $text , $clipboard) = @_; 
    11291138        @_ = (); # Feeble attempt to kill Scalars Leaked 
    1130  
    1131         return if $text eq ''; 
    1132  
     1139         
     1140         
     1141        if (!defined($clipboard)){ 
     1142                $clipboard = 0 ; 
     1143        } 
     1144         
     1145        if ($text eq ''){return;} 
    11331146        # Backup last clipboard value: 
    11341147        $self->{Clipboard_Old} = $self->get_text_from_clipboard; 
    1135  
    1136         #         if $self->{Clipboard_Old} ne $self->get_text_from_clipboard; 
    1137  
     1148         
     1149         
     1150         
    11381151        Wx::wxTheClipboard->Open; 
     1152        Wx::wxTheClipboard->UsePrimarySelection($clipboard); 
    11391153        Wx::wxTheClipboard->SetData( Wx::TextDataObject->new($text) ); 
    11401154        Wx::wxTheClipboard->Close; 
    1141  
     1155         
    11421156        return; 
    11431157} 
     
    11461160 
    11471161        my $self = shift; 
    1148  
     1162         
    11491163        my $text = ''; 
    11501164        Wx::wxTheClipboard->Open;