Changeset 4568 for extensions/pLoader/trunk
- Timestamp:
- Dec 27, 2009, 9:19:46 AM (15 years ago)
- Location:
- extensions/pLoader/trunk/src/Uploader
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/pLoader/trunk/src/Uploader/GUI/wxImageListCtrl.pm
r4507 r4568 30 30 wxLC_EDIT_LABELS 31 31 wxLC_ICON 32 32 wxLC_REPORT 33 33 wxLC_SMALL_ICON 34 34 wxIMAGE_LIST_NORMAL … … 38 38 wxLC_VIRTUAL 39 39 wxLC_REPORT 40 40 wxLC_AUTOARRANGE 41 41 wxBORDER_THEME 42 42 wxLIST_HITTEST_ONITEM … … 45 45 wxLIST_STATE_DONTCARE 46 46 wxLIST_STATE_FOCUSED 47 47 wxIMAGE_LIST_SMALL 48 48 /; 49 49 use Wx::Event qw/ 50 50 EVT_LIST_BEGIN_DRAG 51 51 EVT_LIST_ITEM_SELECTED 52 52 EVT_SIZE 53 53 /; 54 54 … … 60 60 imagelist 61 61 wx_imagelist 62 63 64 65 66 67 68 69 70 62 image_size 63 arrange_items 64 styles 65 insert_items 66 initialize 67 columns 68 change_display_mode 69 wx_img 70 item_refresh 71 71 / 72 72 ); … … 83 83 wxDefaultPosition, 84 84 wxDefaultSize, 85 86 ); 87 88 85 wxNO_BORDER 86 ); 87 88 $self->wx_img( 89 89 Wx::ImageList->new( 16, 16, 1 ) 90 91 92 Wx::Bitmap->new( '../res/image.png', wxBITMAP_TYPE_PNG ) 93 90 ); 91 $self->wx_img->Add( 92 Wx::Bitmap->new( '../res/image.png', wxBITMAP_TYPE_PNG ) 93 ); 94 94 95 95 $self->imagelist( … … 105 105 ); 106 106 107 108 109 110 107 $self->columns( 108 $params->{columns} 109 ); 110 print Dumper $self->columns; 111 111 $self->prevItemCount(-1); 112 112 … … 116 116 my ( $this, $event ) = @_; 117 117 118 118 $this->arrange_items(1); 119 119 $event->Skip(); 120 120 } 121 121 ); 122 123 124 125 126 127 128 129 130 131 132 133 134 135 122 123 Wx::Event::EVT_IDLE( 124 $self, 125 sub { 126 my ($self, $event)=@_; 127 128 if($self->arrange_items){ 129 $self->Refresh; 130 $self->arrange_items(0); 131 } 132 if($self->change_display_mode){ 133 my $dm = $self->imagelist->display_mode; 134 $self->initialize->{$dm}->($self) if exists $self->initialize->{$dm}; 135 $self->Refresh; 136 136 $self->change_display_mode(0); 137 } 138 } 139 ); 140 141 $self->initialize( 142 { 137 } 138 $event->Skip; 139 } 140 ); 141 142 $self->initialize( 143 { 143 144 144 145 'Thumbnail' => sub { my ( $self ) = @_; 145 146 147 148 146 $self->Freeze; 147 $self->ClearAll; 148 $self->SetSingleStyle(wxLC_ICON); 149 $self->SetSingleStyle(wxLC_EDIT_LABELS, 0); 149 150 $self->SetImageList( $self->wx_imagelist, wxIMAGE_LIST_NORMAL ) ; 150 151 }, 151 $self->Thaw; 152 }, 152 153 'Thumbnail and caption' => sub { my ( $self ) = @_; 153 154 155 156 154 $self->Freeze; 155 $self->ClearAll; 156 $self->SetSingleStyle(wxLC_ICON); 157 $self->SetSingleStyle(wxLC_EDIT_LABELS); 157 158 $self->SetImageList( $self->wx_imagelist, wxIMAGE_LIST_NORMAL ) ; 158 159 }, 160 161 162 163 164 165 166 159 $self->Thaw; 160 }, 161 'Property list' => sub { my ( $self ) = @_; 162 my $i=0; 163 164 $self->Freeze; 165 $self->ClearAll; 166 $self->SetSingleStyle(wxLC_REPORT); 167 $self->SetSingleStyle(wxLC_EDIT_LABELS); 167 168 $self->SetImageList( $self->wx_img, wxIMAGE_LIST_SMALL ) ; 168 map 169 170 171 }@{$self->columns}; 172 173 174 175 176 177 178 179 180 169 map { 170 $self->InsertColumn($i, $_->{label}); 171 $i++; 172 }@{$self->columns}; 173 $self->Thaw; 174 }, 175 } 176 ); 177 178 $self->item_refresh( 179 { 180 'Thumbnail' => sub {}, 181 'Thumbnail and caption' => sub { my ( $self, $index ) = @_; 181 182 my $image = $self->imagelist->GetImage($index); 182 183 184 185 183 $self->SetItem( 184 $index, 185 0, 186 $image->site_name, 186 187 ) if defined $image; 187 188 }, 188 189 'Property list' => sub { my ( $self, $index ) = @_; 189 190 my $col = 0; … … 199 200 qw/site_name site_comment site_author file create_date/; 200 201 }, 201 202 203 204 205 206 207 208 202 } 203 ); 204 205 $self->insert_items( 206 { 207 'Thumbnail' => sub { my ( $self, $index ) = @_; $self->InsertImageItem($index, $index);}, 208 'Thumbnail and caption' => sub { my ( $self, $index ) = @_; 209 $self->InsertImageStringItem( 209 210 $index, 210 211 $self->imagelist->GetImage($index)->site_name, … … 213 214 }, 214 215 'Property list' => sub { my ( $self, $index ) = @_; 215 216 216 217 $self->InsertImageStringItem( 217 218 $index, 218 219 "", 219 220 221 222 223 224 225 226 227 228 220 0 221 ); 222 $self->ItemRefresh($index); 223 224 }, 225 } 226 ); 227 228 229 $self->initialize->{$self->imagelist->display_mode}->($self) if exists $self->initialize->{$self->imagelist->display_mode}; 229 230 230 231 $self; … … 233 234 sub ItemRefresh { 234 235 my ( $self, $index ) = @_; 235 236 236 237 $self->item_refresh->{$self->imagelist->display_mode}->($self, $index) if exists $self->item_refresh->{$self->imagelist->display_mode}; 237 238 } 238 239 … … 252 253 253 254 sub GetSelectedItems { 254 my ( $self ) = @_; 255 my ( $self ) = @_; 255 256 256 257 # find selected items … … 265 266 last if(-1 == $item); 266 267 267 # item is selected 268 # item is selected 268 269 push @$items, $item 269 270 } … … 273 274 274 275 sub GetAllItems { 275 my ( $self ) = @_; 276 my ( $self ) = @_; 276 277 277 278 # find selected items … … 286 287 last if(-1 == $item); 287 288 288 # item is selected 289 # item is selected 289 290 push @$items, $item 290 291 } 291 292 292 293 $items; 293 294 294 295 } 295 296 296 297 297 298 sub Refresh { 298 my ( $self ) = @_; 299 my ( $self ) = @_; 299 300 300 301 $self->Freeze(); … … 308 309 my $ipr = floor(($self->GetClientSize->GetWidth - 0.20*$x_spacing)/$x_spacing)||1; 309 310 for( my $i = 0 ; $i < $self->wx_imagelist->GetImageCount ; $i++){ 310 311 # call the method corresponding to the display mode 311 312 my $indx = $self->insert_items->{$self->imagelist->display_mode}->($self, $i); 312 313 if( 'Thumbnail' eq $self->imagelist->display_mode){ 313 314 my $row = floor($i/$ipr); 314 315 my $col = $i%$ipr; … … 320 321 ), 321 322 ); 322 323 } 323 324 } 324 325 }; … … 328 329 $_ 329 330 ); 330 331 331 332 $self->EnsureVisible($_); 332 333 } @{$self->imagelist->image_selection||[]}; 333 334 … … 343 344 wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, 344 345 wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED 345 ); 346 ); 346 347 } 347 348 -
extensions/pLoader/trunk/src/Uploader/ImageList.pm
r4504 r4568 36 36 __PACKAGE__->mk_accessors( 37 37 qw/ 38 38 thumb_size 39 39 preview_ratio 40 40 categories 41 42 43 44 41 type 42 filter 43 blur 44 quality 45 45 resize_w 46 46 resize_h 47 48 49 47 hd_filter 48 hd_blur 49 hd_quality 50 50 hd_w 51 51 hd_h 52 53 54 55 52 hd_interlace 53 prefix 54 author 55 count 56 56 new_files 57 57 storable_file 58 58 wx_thumb_size 59 59 current_image 60 60 images … … 70 70 default_photo_name 71 71 default_photo_name_method 72 72 default_name_prefix 73 73 SetNewFilesViewerRefreshCallback 74 74 SetNewFilesProgressCallback … … 86 86 pwg 87 87 upload_high 88 88 upload_hd 89 89 remove_uploaded_from_selection 90 90 wx_quality … … 95 95 use_exif_preview 96 96 image_sums 97 97 upload_image_sums 98 98 sums 99 99 version … … 121 121 upload_file 122 122 upload_name 123 124 125 126 127 128 123 ReuploadCallback 124 reupload_action_files 125 reupload_action_properties 126 reupload_action_properties_m 127 reupload_not_ask 128 display_mode 129 129 / 130 130 ); … … 329 329 my ( $self, $file, $info, $i ) = @_; 330 330 331 printf("_default_photo_name %s\n", $self->default_photo_name); 331 332 332 333 my $name; … … 378 379 $self->default_name_prefix, 379 380 ) 380 } 381 382 $name; 381 } 382 383 printf("_default_photo_name %s\n", $name); 384 $name; 383 385 } 384 386
Note: See TracChangeset
for help on using the changeset viewer.