Changeset 10023 for trunk/Padre/lib/Padre/Wx/Editor.pm
- Timestamp:
- 12/29/09 01:02:23 (8 months ago)
- Files:
-
- 1 modified
-
trunk/Padre/lib/Padre/Wx/Editor.pm (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/lib/Padre/Wx/Editor.pm
r10022 r10023 813 813 sub on_smart_highlight_begin { 814 814 my ( $self, $event ) = @_; 815 816 815 my $selection = $self->GetSelectedText; 816 817 $self->put_text_to_clipboard($selection, 1); 817 818 my $selection_length = length $selection; 818 819 return if $selection_length == 0; … … 854 855 } 855 856 } 856 857 857 858 } 858 859 … … 870 871 if ( Padre::Constant::WXGTK and defined $text and $text ne '' ) { 871 872 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 877 877 } 878 878 … … 892 892 # It seems that another event is doing something but not within this module. 893 893 # 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 897 900 my $doc = $self->{Document}; 898 901 if ( $doc->can('event_on_middle_up') ) { 899 902 $doc->event_on_middle_up( $self, $event ); 900 903 } 901 904 Wx::wxTheClipboard->UsePrimarySelection(0); 902 905 $event->Skip; 903 906 return; 904 907 } 905 906 908 # Manipulate the window manager selection buffer when editor looses focus 907 909 sub on_kill_focus { … … 1059 1061 sub Paste { 1060 1062 my $self = shift; 1061 1062 # Workaround for Copy/Paste bug ticket #390 1063 1063 1064 my $text = $self->get_text_from_clipboard; 1064 1065 1065 1066 if ($text) { 1066 1067 … … 1125 1126 } 1126 1127 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 1127 1136 sub put_text_to_clipboard { 1128 my ( $self, $text ) = @_;1137 my ( $self, $text , $clipboard) = @_; 1129 1138 @_ = (); # 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;} 1133 1146 # Backup last clipboard value: 1134 1147 $self->{Clipboard_Old} = $self->get_text_from_clipboard; 1135 1136 # if $self->{Clipboard_Old} ne $self->get_text_from_clipboard;1137 1148 1149 1150 1138 1151 Wx::wxTheClipboard->Open; 1152 Wx::wxTheClipboard->UsePrimarySelection($clipboard); 1139 1153 Wx::wxTheClipboard->SetData( Wx::TextDataObject->new($text) ); 1140 1154 Wx::wxTheClipboard->Close; 1141 1155 1142 1156 return; 1143 1157 } … … 1146 1160 1147 1161 my $self = shift; 1148 1162 1149 1163 my $text = ''; 1150 1164 Wx::wxTheClipboard->Open;
