Ignore:
Timestamp:
Dec 27, 2009, 9:28:03 AM (14 years ago)
Author:
ronosman
Message:

Feature 1346 added : new global settings management.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/pLoader/trunk/src/Uploader/GUI/wxFrameAUI.pm

    r4504 r4569  
    1 # +-----------------------------------------------------------------------+
     1# +-----------------------------------------------------------------------+
    22# | pLoader - a Perl photo uploader for Piwigo                            |
    33# +-----------------------------------------------------------------------+
     
    3636             wxBITMAP_TYPE_GIF
    3737             wxBITMAP_TYPE_PNG
    38                         wxBITMAP_TYPE_ANY
     38            wxBITMAP_TYPE_ANY
    3939             wxTB_FLAT
    4040             wxSIZE
     
    7070             wxICON_INFORMATION
    7171             WXK_DELETE
     72             wxHORIZONTAL
     73             wxVERTICAL
    7274         /;
    7375use base qw/Wx::Frame Class::Accessor::Fast/;
     
    8486          upload_progressdlg
    8587          imageviewer
    86                   imageviewer_img
     88          imageviewer_img
    8789          tree
    8890          tree_root
     
    104106          notebook_image_properties
    105107          notebook_global_settings
    106           general_settings_panel
    107           resized_settings_panel
    108           thumbnail_settings_panel
    109                   hd_settings_panel
    110           advanced_settings_panel
    111           watermark_settings_panel
    112           piwigo_properties
     108          global_settings_panel
     109          piwigo_property_list
    113110          exif_properties
    114           general_settings
    115           resized_settings
    116           thumbnail_settings
    117                   hd_settings
    118           advanced_settings
    119           watermark_settings
     111          global_settings
    120112          toolbar
    121113          branding
     
    128120          piwigo_tags
    129121          image_tags
    130                   piwigo_photo_properties
    131                   dlg_piwigo_photo_properties
    132                   piwigo_photo_properties_tags
    133                   image_preview_refresh
    134                   imageviewer_refresh
    135                   imageviewer_item_refresh
     122          piwigo_photo_properties
     123          dlg_piwigo_photo_properties
     124          piwigo_photo_properties_tags
     125          image_preview_refresh
     126          imageviewer_refresh
     127          imageviewer_item_refresh
    136128      /;
    137129__PACKAGE__->mk_accessors( @properties );
     
    140132    qw/
    141133          EVT_MENU
     134          EVT_BUTTON
    142135          EVT_TREE_SEL_CHANGED
    143136          EVT_TREE_END_LABEL_EDIT
     
    149142          EVT_TREE_ITEM_RIGHT_CLICK
    150143          EVT_LIST_KEY_DOWN
    151           EVT_UPDATE_UI       
    152144      /;
    153145     
     146use Wx::Perl::TextValidator;
    154147use Uploader::GUI::wxImageListCtrl;
    155148use Uploader::GUI::wxImageProcessingProgressDlg;
     
    164157use Uploader::GUI::wxPropertyGridPanel;
    165158use Uploader::GUI::wxPhotoProperties;
     159use Uploader::GUI::wxGlobalSettings;
    166160use utf8;
    167161$|=1;
     
    171165
    172166sub new {
    173   my( $class, $params ) = @_;
    174   my( $self ) = $class->SUPER::new(
    175                                       undef,
    176                                       -1,
    177                                       $params->{title},
    178                                       wxDefaultPosition,
    179                                       wxDefaultSize,
    180                                       wxDEFAULT_FRAME_STYLE
    181                                    );
     167    my( $class, $params ) = @_;
     168    my( $self ) = $class->SUPER::new(
     169        undef,
     170        -1,
     171        $params->{title},
     172        wxDefaultPosition,
     173        wxDefaultSize,
     174        wxDEFAULT_FRAME_STYLE
     175    );
    182176
    183177    $self->perspective(
     
    211205    );
    212206
    213 
    214207    # callback for GUI refresh : remove thumbnail images from imageviewer control
    215208    $self->imagelist->UploadImagesViewerCallback(
    216209        sub { $self->UploadImagesViewerRefresh(@_) }
    217210    );
    218        
    219         $self->imagelist->ReuploadCallback(
    220             sub {
    221                     Uploader::GUI::wxImageReuploadDlg->new(
    222             {
    223                                 title      => gettext("Photo update management"),
    224                 properties => {
    225                                         $main::ID_REUPLOAD_ACTION_FILES        => {
    226                                                                                                                     selection=>sub {$self->imagelist->reupload_action_files(@_)},
    227                                                                                                                                                                 label=>gettext("What shall we do with files? (thumbnail, resized, high resolution)"),
    228                                                                                 labels=>[
    229                                                                                                                                                                            gettext("nothing"),
    230                                                                                                                                                                            gettext("replace"),
    231                                                                                                                                                                        ],                                                                                                                                                               
    232                                                                                                             },
    233                                                                     $main::ID_REUPLOAD_ACTION_PROPERTIES   => {
    234                                                                                                                     selection=>sub{$self->imagelist->reupload_action_properties(@_)},
    235                                                                                                                                                                 label=>gettext("What shall we do with single value properties?(caption, comment, author, create date)"),
    236                                                                                 labels=>[
    237                                                                                                                                                                            gettext("nothing"),
    238                                                                                                                                                                            gettext("fill if empty (only replace properties currently empty in Piwigo)"),
    239                                                                                                                                                                            gettext("replace"),
    240                                                                                                                                                                        ],                                                                                                                                                               
    241                                                                                                                   },
    242                                                                         $main::ID_REUPLOAD_ACTION_PROPERTIES_M => {
    243                                                                                                                     selection=>sub{$self->imagelist->reupload_action_properties_m(@_)},
    244                                                                                                                                                                 label=>gettext("What shall we do with multiple values properties? (categories, tags)"),
    245                                                                                 labels=>[
    246                                                                                                                                                                            gettext("nothing"),
    247                                                                                                                                                                            gettext("append (keep existing and add new)"),
    248                                                                                                                                                                            gettext("replace"),
    249                                                                                                                                                                        ],                                                                                                                                                               
    250                                                                                                                   },
    251                                                                         $main::ID_REUPLOAD_NOT_ASK             => {
    252                                                                                                                     value=>sub{$self->imagelist->reupload_not_ask(@_)},
    253                                                                                 label=>gettext("Do not ask me again"),                                                                                                                                                         
    254                                                                                                                   },
    255                                                                         $main::ID_REUPLOAD_TEXT                => {
    256                                                                                 label=>gettext("A least one photo has already been added in the past."),                                                                                                                                                               
    257                                                                                                                   },
    258                                                 },
    259             }
    260                         )->ShowModal();
    261                 }
    262         );
     211   
     212    $self->imagelist->ReuploadCallback(
     213    sub
     214    {
     215        Uploader::GUI::wxImageReuploadDlg->new(
     216        {
     217            title => gettext("Photo update management"),
     218            properties =>
     219            {
     220                $main::ID_REUPLOAD_ACTION_FILES =>
     221                {
     222                    selection=>sub {$self->imagelist->reupload_action_files(@_)},
     223                    label=>gettext("What shall we do with files? (thumbnail, resized, high resolution)"),
     224                    labels=>[
     225                        gettext("nothing"),
     226                        gettext("replace"),
     227                    ],
     228                },
     229                $main::ID_REUPLOAD_ACTION_PROPERTIES =>
     230                {
     231                    selection=>sub{$self->imagelist->reupload_action_properties(@_)},
     232                    label=>gettext("What shall we do with single value properties?(caption, comment, author, create date)"),
     233                    labels=>[
     234                        gettext("nothing"),
     235                        gettext("fill if empty (only replace properties currently empty in Piwigo)"),
     236                        gettext("replace"),
     237                    ],
     238                },
     239                $main::ID_REUPLOAD_ACTION_PROPERTIES_M =>
     240                {
     241                    selection=>sub{$self->imagelist->reupload_action_properties_m(@_)},
     242                    label=>gettext("What shall we do with multiple values properties? (categories, tags)"),
     243                    labels=>[
     244                        gettext("nothing"),
     245                        gettext("append (keep existing and add new)"),
     246                        gettext("replace"),
     247                    ],
     248                },
     249                $main::ID_REUPLOAD_NOT_ASK =>
     250                {
     251                    value=>sub{$self->imagelist->reupload_not_ask(@_)},
     252                    label=>gettext("Do not ask me again"),
     253                },
     254                $main::ID_REUPLOAD_TEXT =>
     255                {
     256                    label=>gettext("A least one photo has already been added in the past."),
     257                },
     258            },
     259        } )->ShowModal();}
     260    );
    263261
    264262
     
    302300    $self->_initImgTypes;   
    303301
    304         # only refresh when calling event is finished
    305         Wx::Event::EVT_UPDATE_UI(
    306             $self,
    307             $self,
    308                 sub {
     302    # only refresh when calling event is finished
     303    Wx::Event::EVT_IDLE(
     304        $self,
     305        sub {
    309306            my ( $self, $event ) = @_;
    310                 if ( $self->image_preview_refresh and $self->image_preview->IsShown ){
    311                 $self->_image_preview_refresh;
     307            if ( $self->image_preview_refresh and $self->image_preview->IsShown ){
     308                $self->set_preview_image;
    312309                $self->image_preview->Refresh;
    313                                 $self->image_preview_refresh(0);
    314                     }
    315                        
    316                         if($self->imageviewer_refresh){
    317                             $self->imageviewer->Refresh;
    318                                 $self->imageviewer_refresh(0);
    319                         }
    320 
    321                         if($self->imageviewer_item_refresh){
    322                             $self->imageviewer->ItemRefresh(
    323                                     $self->current_imageviewer_index
    324                                 );
    325                                 $self->imageviewer_item_refresh(0);
    326                         }
    327                 },
    328         );
     310                $self->image_preview_refresh(0);
     311            }
     312
     313            if($self->imageviewer_refresh){
     314                $self->imageviewer->Refresh;
     315                $self->imageviewer_refresh(0);
     316            }
     317
     318            if($self->imageviewer_item_refresh){
     319                $self->imageviewer->ItemRefresh(
     320                    $self->current_imageviewer_index
     321                );
     322                $self->imageviewer_item_refresh(0);
     323            }
     324            $self->OnUpdateToolbar;
     325            $event->Skip;
     326        }
     327    );
    329328
    330329    $self->imageviewer->SelectItem(
     
    340339
    341340    $self->{IMGTYPE} = {
    342              'jpg' => wxBITMAP_TYPE_JPEG,
    343              'gif' => wxBITMAP_TYPE_GIF,
    344              'png' => wxBITMAP_TYPE_PNG,
     341        'jpg' => wxBITMAP_TYPE_JPEG,
     342        'gif' => wxBITMAP_TYPE_GIF,
     343        'png' => wxBITMAP_TYPE_PNG,
    345344    };
    346345}
     
    360359    $self->piwigo_photo_properties(
    361360        {
    362                     $main::CAPTION => { label=>gettext("Photo caption :")},
    363                         $main::PHOTO_PROPERTIES_CAPTION => {
    364                                                                value => sub { $self->imagelist->current_image->site_name(@_) },
    365                                                                                                    frame_callback => sub { $self->imageviewer_item_refresh(1); },
    366                                                            },
    367                     $main::COMMENT => { label=>gettext("Comment :")},
    368                         $main::PHOTO_PROPERTIES_COMMENT => {
    369                                                                value => sub { $self->imagelist->current_image->site_comment(@_) },
    370                                                                                                    frame_callback => sub { $self->imageviewer_item_refresh(1); },
    371                                                            },
    372                     $main::AUTHOR => { label=>gettext("Author :")},
    373                         $main::PHOTO_PROPERTIES_AUTHOR => {
    374                                                                value => sub { $self->imagelist->current_image->site_author(@_) },
    375                                                                                                    frame_callback => sub { $self->imageviewer_item_refresh(1); },
    376                                                            },
    377                     $main::TAGS => { label=>gettext("Tags :")},
    378                     $main::CREATE_DATE => { label=>gettext("Create date :")},
    379                         $main::PHOTO_PROPERTIES_CREATE_DATE => {
    380                                                                value => sub { $self->imagelist->current_image->create_date(@_) },
    381                                                                                                    frame_callback => sub { $self->imageviewer_item_refresh(1); },
    382                                                            },
    383                     $main::PRIVACY_LEVEL => { label=>gettext("Who can see the photo?")},
    384                         $main::PHOTO_PROPERTIES_PRIVACY_LEVEL => {
    385                                                          selection => sub { $self->imagelist->current_image->privacy_level(@_)},
    386                                                          choices => wxTheApp->privacy_level_choices,                                                                                                                       ,                                                                                                             
    387                                                                  },
    388                 }
    389     ); 
    390 
    391     $self->piwigo_properties(
     361            $main::CAPTION => { label=>gettext("Photo caption")},
     362            $main::PHOTO_PROPERTIES_CAPTION => {
     363                value => sub { $self->imagelist->current_image->site_name(@_) },
     364                frame_callback => sub { $self->imageviewer_item_refresh(1); },
     365            },
     366            $main::COMMENT => { label=>gettext("Comment")},
     367            $main::PHOTO_PROPERTIES_COMMENT => {
     368                value => sub { $self->imagelist->current_image->site_comment(@_) },
     369                frame_callback => sub { $self->imageviewer_item_refresh(1); },
     370            },
     371            $main::AUTHOR => { label=>gettext("Author")},
     372            $main::PHOTO_PROPERTIES_AUTHOR => {
     373                value => sub { $self->imagelist->current_image->site_author(@_) },
     374                frame_callback => sub { $self->imageviewer_item_refresh(1); },
     375            },
     376            $main::TAGS => { label=>gettext("Tags")},
     377            $main::CREATE_DATE => { label=>gettext("Create date")},
     378            $main::PHOTO_PROPERTIES_CREATE_DATE => {
     379                value => sub { $self->imagelist->current_image->create_date(@_) },
     380                frame_callback => sub { $self->imageviewer_item_refresh(1); },
     381            },
     382            $main::PRIVACY_LEVEL => { label=>gettext("Who can see the photo?")},
     383            $main::PHOTO_PROPERTIES_PRIVACY_LEVEL => {
     384                selection => sub { $self->imagelist->current_image->privacy_level(@_)},
     385                choices => wxTheApp->privacy_level_choices,
     386            }
     387        }
     388    );   
     389
     390    $self->global_settings(
     391        {
     392            $main::DEFAULT_PHOTO_CAPTION => { label => gettext("Default photo caption") },
     393            $main::CPANE_RESIZE_ADVANCED => { label => gettext("Advanced") },
     394            $main::CPANE_HD_ADVANCED => { label => gettext("Advanced") },
     395            $main::CPANE_TRANSFERT_ADVANCED => { label => gettext("Advanced") },
     396            sb_photo_properties => { staticbox_label => gettext("Photo properties") },
     397            sb_web_sized_photo => { staticbox_label => gettext("Web sized") },
     398            sb_high_definition_photo => { staticbox_label => gettext("High definition") },
     399            sb_watermark => { staticbox_label => gettext("Watermark") },
     400            sb_transfert => { staticbox_label => gettext("Transfert") },
     401            $main::GS_CLOSE => { label => gettext("Close")},
     402            $main::GS_DEFAULT_PHOTO_CAPTION => {
     403                string_selection => sub { $self->imagelist->default_photo_name(@_) },
     404                choices =>
     405                [
     406                    map { gettext $_ } @{wxTheApp->default_photo_names}
     407                ],
     408                pre_process => sub { my ( $value ) = @_; wxTheApp->eng_default_photo_names->{$value} },
     409                frame_callback => sub {
     410                    my( $self, $ctrl, $event ) = @_;
     411                    $self->OnDefaultPhotoCaption($event);
     412                },
     413            },
     414            $main::PHOTO_CAPTION_PREFIX => { label => gettext("Photo caption  prefix") },
     415            $main::GS_PHOTO_CAPTION_PREFIX => {
     416                value => sub { $self->imagelist->default_name_prefix(@_) },
     417            },
     418            $main::GS_AUTO_ROTATE => {
     419                label => gettext("Auto rotate image"),
     420                value => sub { $self->imagelist->auto_rotate(@_) }
     421           },
     422            $main::DEFAULT_AUTHOR => { label => gettext("Default author")},
     423            $main::GS_DEFAULT_AUTHOR => { value => sub { $self->imagelist->author(@_) } },
     424            $main::GS_CREATE_RESIZED => {
     425                selection => sub { $self->imagelist->create_resized(@_) },
     426                choices =>
     427                [
     428                    map { gettext $_ } ( "Use resized original", "Use original" )
     429                ],
     430                frame_callback => sub {
     431                    my( $dlg, $ctrl, $event ) = @_;
     432                    $dlg->OnCreateResized($event);
     433                },
     434            },
     435            $main::SITE_IMG_WIDTH => { label => gettext("Site image width") },
     436            $main::GS_SITE_IMG_WIDTH => {
     437                value => sub { $self->imagelist->resize_w(@_) },
     438                validator => Wx::Perl::TextValidator->new( '\d' )
     439            },
     440            $main::SITE_IMG_HEIGHT => { label => gettext("Site image height") },
     441            $main::GS_SITE_IMG_HEIGHT => {
     442                value => sub { $self->imagelist->resize_h(@_) },
     443                validator => Wx::Perl::TextValidator->new( '\d' )
     444            },
     445            $main::SITE_IMG_JPEG_QUALITY => { label => gettext("Site image jpeg quality") },
     446            $main::GS_SITE_IMG_JPEG_QUALITY => {
     447                value => sub { $self->imagelist->quality(@_) },
     448                validator => Wx::Perl::TextValidator->new( '\d' )
     449            },
     450            $main::SITE_IMG_FILTER => { label => gettext("Site image filter") },
     451            $main::GS_SITE_IMG_FILTER => {
     452                selection =>  sub { $self->imagelist->filter(@_) },
     453                choices =>
     454                [
     455                    qw/Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc/ 
     456                ],
     457            },
     458            $main::SITE_IMG_BLUR => { label => gettext("Site image blur") },
     459            $main::GS_SITE_IMG_BLUR => {
     460                value => sub { $self->imagelist->blur(@_) },
     461                validator => Wx::Perl::TextValidator->new( '\d' )
     462            },
     463            $main::SITE_IMG_INTERLACE => { label => gettext("Site image interlace") },
     464            $main::GS_SITE_IMG_INTERLACE => {
     465                selection => sub { $self->imagelist->interlace(@_) },
     466                choices =>
     467                [
     468                    qw/None Line Plane Partition JPEG GIF PNG/ 
     469                ],
     470            },
     471            $main::GS_REMOVE_UPLOADED_FROM_SELECTION => {
     472                label => gettext("Remove uploaded photo from selection"),
     473                value => sub { $self->imagelist->remove_uploaded_from_selection(@_) },
     474            },
     475            $main::GS_HD_UPLOAD => {
     476                choices  =>
     477                [
     478                    map { gettext $_ } @{wxTheApp->upload_hd}
     479                ],
     480                pre_process => sub { my ( $value ) = @_; wxTheApp->eng_upload_hd->{$value} },
     481                string_selection => sub { $self->imagelist->upload_hd(@_) },
     482                frame_callback => sub {
     483                    my( $self, $ctrl, $event ) = @_;
     484                    $self->OnHDUpload($event);
     485                },
     486            },
     487            $main::HD_IMG_WIDTH => { label => gettext("HD image width") },
     488            $main::GS_HD_IMG_WIDTH => {
     489                label => gettext("HD image width"),
     490                value => sub { $self->imagelist->hd_w(@_) },
     491                validator => Wx::Perl::TextValidator->new( '\d' )
     492            },
     493            $main::HD_IMG_HEIGHT => { label => gettext("HD image height") },
     494            $main::GS_HD_IMG_HEIGHT => {
     495                label => gettext("HD image height"),
     496                value => sub { $self->imagelist->hd_h(@_) },
     497                validator => Wx::Perl::TextValidator->new( '\d' )
     498            },
     499            $main::HD_IMG_JPEG_QUALITY => { label => gettext("HD image jpeg quality") },
     500            $main::GS_HD_IMG_JPEG_QUALITY => {
     501                value => sub { $self->imagelist->hd_quality(@_) },
     502                validator => Wx::Perl::TextValidator->new( '\d' )
     503            },
     504            $main::HD_IMG_FILTER => { label => gettext("HD image filter") },
     505            $main::GS_HD_IMG_FILTER => {
     506                selection =>  sub { $self->imagelist->hd_filter(@_) },
     507                choices =>
     508                [
     509                    qw/Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc/ 
     510                ],
     511            },
     512            $main::HD_IMG_BLUR => { label => gettext("HD image blur") },
     513            $main::GS_HD_IMG_BLUR => {
     514                value => sub { $self->imagelist->hd_blur(@_) },
     515                validator => Wx::Perl::TextValidator->new( '\d' )
     516            },
     517            $main::HD_IMG_INTERLACE => { label => gettext("HD image interlace") },
     518            $main::GS_HD_IMG_INTERLACE => {
     519                selection => sub { $self->imagelist->hd_interlace(@_) },
     520                choices =>
     521                [
     522                    qw/None Line Plane Partition JPEG GIF PNG/ 
     523                ],
     524            },
     525            $main::GS_WMARK_ACTIVATE => {
     526              label  => gettext("Activate watermark"),
     527              value  => sub { $self->imagelist->watermark_activate(@_) },
     528              frame_callback => sub {
     529                  my( $self, $ctrl, $event ) = @_;
     530                  $self->OnWatermark($event);
     531              },
     532            },
     533            $main::GS_WMARK_ACTIVATE_HD => {
     534              label => gettext("Activate watermark on high definition"),
     535              value => sub { $self->imagelist->watermark_activate_pwg_high(@_) },
     536              frame_callback => sub {
     537                  my( $self, $ctrl, $event ) = @_;
     538                  $self->OnWatermark($event);
     539              },
     540            },
     541            $main::WMARK_TEXT => { label  => gettext("Text") },
     542            $main::GS_WMARK_TEXT => {
     543              value  => sub { $self->imagelist->watermark_text(@_) },
     544            },
     545            $main::WMARK_TEXT_SIZE => { label     => gettext("Text size") },
     546            $main::GS_WMARK_TEXT_SIZE => {
     547                value   => sub { $self->imagelist->watermark_text_size(@_) },
     548            },
     549            $main::WMARK_COLOR => { label     => gettext("Color") },
     550            $main::GS_WMARK_COLOR => {
     551                selection => sub { $self->imagelist->watermark_color(@_) },
     552                choices   => [
     553                               map { gettext $_ } @{wxTheApp->colors}
     554                             ],
     555                pre_process => sub { my ( $value ) = @_; wxTheApp->eng_colors->{$value} },
     556            },
     557            $main::WMARK_POSITION => { label     => gettext("Position") },
     558            $main::GS_WMARK_POSITION => {
     559                selection => sub { $self->imagelist->watermark_position(@_) },
     560                choices  => [
     561                               map { gettext $_ } @{wxTheApp->positions}
     562                           ],
     563                pre_process => sub { my ( $value ) = @_; wxTheApp->eng_positions->{$value} },
     564            },
     565            $main::WMARK_MARGIN_TOP => { label => gettext("Top margin") },
     566            $main::GS_WMARK_MARGIN_TOP => {
     567                value   => sub { $self->imagelist->watermark_y(@_) },
     568            },
     569            $main::WMARK_MARGIN_LEFT => { label => gettext("Left margin") },
     570            $main::GS_WMARK_MARGIN_LEFT => {
     571                value   => sub { $self->imagelist->watermark_x(@_) },
     572            },
     573            $main::CHUNK_SIZE => { label => gettext("Transfert chunk size") },
     574            $main::GS_CHUNK_SIZE => {
     575                value   => sub { wxTheApp->chunk_size(@_) },
     576            },
     577        }   
     578    );
     579
     580    $self->piwigo_property_list(
    392581        [
    393582            {
    394                 label          => gettext("Photo caption :"),
    395                 value          => sub { $self->imagelist->current_image->site_name(@_) },
    396                 frame_callback => sub { $self->imageviewer_item_refresh(1) },
     583                label => gettext("Photo caption"),
    397584            },
    398585            {
    399                 label => gettext("Comment :"),
    400                 value => sub { $self->imagelist->current_image->site_comment(@_) },
    401                 type  => "LongText",
     586                label => gettext("Comment"),
    402587            },
    403588            {
    404                 label => gettext("Author :"),
    405                 value => sub { $self->imagelist->current_image->site_author(@_) },
     589                label => gettext("Author"),
    406590            },
    407591            {
    408                 label    => gettext("File name :"),
    409                 value    => sub { $self->imagelist->current_image->file(@_) },
    410                 readonly => 1,
     592                label => gettext("File name"),
    411593            },
    412594            {
    413                 label    => gettext("Create date :"),
    414                 value    => sub { $self->imagelist->current_image->create_date(@_) },
    415                 readonly => 1,
     595                label => gettext("Create date"),
    416596            },
    417597        ]   
     
    421601        [
    422602            {
    423                 label    => gettext("Create date :"),
     603                label    => gettext("Create date"),
    424604                value    => sub { $self->imagelist->current_image->create_date },
    425605                readonly => 1,
    426             }, 
     606            },   
    427607            {
    428                 label    => gettext("Model :"),
     608                label    => gettext("Model"),
    429609                value    => sub { $self->imagelist->current_image->exif_tag('Model') },
    430610                readonly => 1,
    431             }, 
     611            },   
    432612            {
    433                 label    => gettext("Width :"),
     613                label    => gettext("Width"),
    434614                value    => sub { $self->imagelist->current_image->exif_tag('ImageWidth') },
    435615                readonly => 1,
    436             }, 
     616            },   
    437617            {
    438                 label    => gettext("Height :"),
     618                label    => gettext("Height"),
    439619                value    => sub { $self->imagelist->current_image->exif_tag('ImageHeight') },
    440620                readonly => 1,
    441             }, 
     621            },   
    442622            {
    443                 label    => gettext("Orientation :"),
     623                label    => gettext("Orientation"),
    444624                value    => sub { $self->imagelist->current_image->exif_tag('Orientation') },
    445625                readonly => 1,
    446             }, 
     626            },   
    447627            {
    448                 label    => "ISO :",
     628                label    => "ISO",
    449629                value    => sub { $self->imagelist->current_image->exif_tag('ISO') },
    450630                readonly => 1,
    451             }, 
     631            },   
    452632            {
    453                 label    => gettext("Shutter speed :"),
     633                label    => gettext("Shutter speed"),
    454634                value    => sub { $self->imagelist->current_image->exif_tag('ExposureTime') },
    455635                readonly => 1,
    456             }, 
     636            },   
    457637            {
    458                 label    => gettext("Aperture :"),
     638                label    => gettext("Aperture"),
    459639                value    => sub { $self->imagelist->current_image->exif_tag('ApertureValue') },
    460640                readonly => 1,
    461             }, 
     641            },   
    462642            {
    463                 label    => gettext("Focal length :"),
     643                label    => gettext("Focal length"),
    464644                value    => sub { $self->imagelist->current_image->exif_tag('FocalLength') },
    465645                readonly => 1,
    466             }, 
     646            },   
    467647            {
    468                 label    => gettext("Lens :"),
     648                label    => gettext("Lens"),
    469649                value    => sub { $self->imagelist->current_image->exif_tag('Lens') },
    470650                readonly => 1,
    471             }, 
     651            },   
    472652        ]
    473653    );   
    474654
    475 
    476     $self->general_settings(
    477         [
    478             {
    479                 label     => gettext("Default author :"),
    480                 value   => sub { $self->imagelist->author(@_) },
    481             },
    482             {
    483                 label     => gettext("Default photo caption :"),
    484                 type      => 'Choice',
    485                 value   => sub { $self->imagelist->default_photo_name(@_) },
    486                 choice  => [
    487                                map { gettext $_ } @{wxTheApp->default_photo_names}
    488                            ],
    489                 pre_process => sub { my ( $value ) = @_; wxTheApp->eng_default_photo_names->{$value} },
    490             },
    491             {
    492                 label     => gettext("Photo caption  prefix :"),
    493                 value   => sub { $self->imagelist->default_name_prefix(@_) },
    494             },
    495             {
    496                 label     => gettext("Resize site image :"),
    497                 type      => 'Bool',
    498                 value   => sub { $self->imagelist->create_resized(@_) },
    499             },
    500             {
    501                 label     => gettext("Auto rotate image :"),
    502                 type      => 'Bool',
    503                 value   => sub { $self->imagelist->auto_rotate(@_) },
    504             },
    505             {
    506                 label     => gettext("Upload high definition  :"),
    507                 type      => 'Choice',
    508                 choice  => [
    509                                map { gettext $_ } @{wxTheApp->upload_hd}
    510                            ],
    511                 pre_process => sub { my ( $value ) = @_; wxTheApp->eng_upload_hd->{$value} },
    512                 value   => sub { $self->imagelist->upload_hd(@_) },
    513             },
    514             {
    515                 label     => gettext("Remove uploaded photo from selection :"),
    516                 type      => 'Bool',
    517                 value   => sub { $self->imagelist->remove_uploaded_from_selection(@_) },
    518             },
    519         ]   
    520     );
    521    
    522     $self->resized_settings(
    523         [
    524             {
    525                 label     => gettext("Site image width :"),
    526                 type      => 'Number',
    527                 value   => sub { $self->imagelist->resize_w(@_) },
    528             },
    529             {
    530                 label     => gettext("Site image height :"),
    531                 type      => 'Number',
    532                 value   => sub { $self->imagelist->resize_h(@_) },
    533             },
    534             {
    535                 label     => gettext("Site image jpeg quality :"),
    536                 type      => 'Number',
    537                 value   => sub { $self->imagelist->quality(@_) },
    538             },
    539             {
    540                 label     => gettext("Site image filter :"),
    541                 type      => 'Choice',
    542                 value   => sub { $self->imagelist->filter(@_) },
    543                 choice    => [ qw/Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc/ ],
    544             },
    545             {
    546                 label     => gettext("Site image blur :"),
    547                 type      => 'Float',
    548                 value   => sub { $self->imagelist->blur(@_) },
    549             },
    550             {
    551                 label     => gettext("Site image interlace :"),
    552                 type      => 'Choice',
    553                 value   => sub { $self->imagelist->interlace(@_) },
    554                 choice    => [ qw/None Line Plane Partition JPEG GIF PNG/ ],
    555             },
    556         ]   
    557     );
    558 
    559     $self->hd_settings(
    560         [
    561             {
    562                 label     => gettext("HD image width :"),
    563                 type      => 'Number',
    564                 value   => sub { $self->imagelist->hd_w(@_) },
    565             },
    566             {
    567                 label     => gettext("HD image height :"),
    568                 type      => 'Number',
    569                 value   => sub { $self->imagelist->hd_h(@_) },
    570             },
    571             {
    572                 label     => gettext("HD image jpeg quality :"),
    573                 type      => 'Number',
    574                 value   => sub { $self->imagelist->hd_quality(@_) },
    575             },
    576             {
    577                 label     => gettext("HD image filter :"),
    578                 type      => 'Choice',
    579                 value   => sub { $self->imagelist->hd_filter(@_) },
    580                 choice    => [ qw/Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc/ ],
    581             },
    582             {
    583                 label     => gettext("HD image blur :"),
    584                 type      => 'Float',
    585                 value   => sub { $self->imagelist->hd_blur(@_) },
    586             },
    587             {
    588                 label     => gettext("HD image interlace :"),
    589                 type      => 'Choice',
    590                 value   => sub { $self->imagelist->hd_interlace(@_) },
    591                 choice    => [ qw/None Line Plane Partition JPEG GIF PNG/ ],
    592             },
    593         ]   
    594     );
    595        
    596     $self->thumbnail_settings(
    597         [
    598             {
    599                 label     => gettext("Site thumbnail size :"),
    600                 type      => 'Number',
    601                 value   => sub { $self->imagelist->thumb_size(@_) },
    602             },
    603             {
    604                 label     => gettext("Site thumbnail jpeg quality :"),
    605                 type      => 'Number',
    606                 value   => sub { $self->imagelist->th_quality(@_) },
    607             },
    608             {
    609                 label     => gettext("Photo selection thumbnail size :"),
    610                 type      => 'Number',
    611                 value   => sub { $self->imagelist->wx_thumb_size(@_) },
    612             },
    613             {
    614                 label     => gettext("Photo selection thumbnail jpeg quality :"),
    615                 type      => 'Number',
    616                 value   => sub { $self->imagelist->wx_quality(@_) },
    617             },
    618         ]   
    619     );
    620    
    621 
    622     $self->advanced_settings(
    623         [
    624             {
    625                 label     => gettext("Transfert chunk size :"),
    626                 type      => 'Number',
    627                 value   => sub { wxTheApp->chunk_size(@_) },
    628             },
    629         ]   
    630     );
    631 
    632     $self->watermark_settings(
    633         [
    634             {
    635               label  => gettext("Activate watermark :"),
    636               type   => 'Bool',
    637               value  => sub { $self->imagelist->watermark_activate(@_) },
    638             },
    639             {
    640               label => gettext("Activate watermark on high definition :"),
    641               type  => 'Bool',
    642               value => sub { $self->imagelist->watermark_activate_pwg_high(@_) },
    643             },
    644             {
    645               label  => gettext("Text :"),
    646               value  => sub { $self->imagelist->watermark_text(@_) },
    647             },
    648             {
    649                 label     => gettext("Text size :"),
    650                 type      => 'Number',
    651                 value   => sub { $self->imagelist->watermark_text_size(@_) },
    652             },
    653             {
    654                 label     => gettext("Color :"),
    655                 type      => 'Choice',
    656                 value     => sub { $self->imagelist->watermark_color(@_) },
    657                 choice    => [
    658                                map { gettext $_ } @{wxTheApp->colors}
    659                              ],
    660                 pre_process => sub { my ( $value ) = @_; wxTheApp->eng_colors->{$value} },
    661             },           
    662             {
    663                 label     => gettext("Position :"),
    664                 type      => 'Choice',
    665                 value   => sub { $self->imagelist->watermark_position(@_) },
    666                 choice  => [
    667                                map { gettext $_ } @{wxTheApp->positions}
    668                            ],
    669                 pre_process => sub { my ( $value ) = @_; wxTheApp->eng_positions->{$value} },
    670             },
    671             {
    672                 label     => gettext("Top margin :"),
    673                 type      => 'Number',
    674                 value   => sub { $self->imagelist->watermark_y(@_) },
    675             },
    676             {
    677                 label     => gettext("Left margin :"),
    678                 type      => 'Number',
    679                 value   => sub { $self->imagelist->watermark_x(@_) },
    680             },           
    681         ]
    682     );
    683 
    684655    $self->image_tags(
    685656        sub { eval { $self->imagelist->current_image->site_tags(@_) } }
     
    688659    $self->piwigo_tags(
    689660        sub { wxTheApp->pwg->tags }
    690     ); 
     661    );   
    691662}
    692663
     
    697668        Wx::MessageBox(
    698669            sprintf(
    699                 gettext("Do you want to create \"%s\" ?"),
     670                "%s \"%s\" ?",
     671                gettext("Do you want to create"),
    700672                $name,
    701673            ),
     
    704676        ) == wxYES
    705677    ){   
    706         $self->pwg->AddTags($name);
     678        $self->pwg->AddTags($name);
    707679        $self->pwg->RefreshTags;
    708680    }
     
    712684    my ( $self ) = @_;
    713685   
    714     $self->_set_setting_properties;
     686    eval { $self->_set_setting_properties; };
    715687    $self->_refresh_settings_panels_properties;
    716688    map {
    717         $_->Refresh;   
     689        $_->Refresh;   
    718690    }
    719691    (
    720         $self->image_prop_piwigo,
    721692        $self->image_prop_exif,
    722         $self->image_prop_tags,
    723         $self->general_settings_panel,
    724         $self->resized_settings_panel,
    725         $self->thumbnail_settings_panel,
    726         $self->hd_settings_panel,
    727         $self->advanced_settings_panel,
    728         $self->watermark_settings_panel,
    729                 $self->piwigo_photo_properties_tags
     693        $self->global_settings_panel,
     694        $self->piwigo_photo_properties_tags
    730695    );
    731696   
     
    745710    if( $self->imagelist->wx_thumb_imglist->GetImageCount){
    746711        printf("%s images\n", $self->imagelist->wx_thumb_imglist->GetImageCount);
    747         $self->ShowImageViewer;
     712        $self->ShowImageViewer;
    748713       
    749714        $self->imageviewer->Refresh(
     
    756721
    757722sub _refresh_settings_panels_properties {
    758     my ( $self ) = @_; 
    759 
    760         $self->dlg_piwigo_photo_properties->properties(
     723    my ( $self ) = @_;   
     724
     725    $self->dlg_piwigo_photo_properties->properties(
    761726        $self->piwigo_photo_properties
    762         );
    763        
    764     $self->image_prop_piwigo->properties(
    765         $self->piwigo_properties
    766     );
     727    );
     728
    767729   
    768730    $self->image_prop_exif->properties(
     
    770732    );
    771733
    772 
    773     $self->general_settings_panel->properties(
    774         $self->general_settings
     734    $self->global_settings_panel->properties(
     735        $self->global_settings
    775736    );   
    776737
    777     $self->resized_settings_panel->properties(
    778         $self->resized_settings
    779     );   
    780 
    781     $self->thumbnail_settings_panel->properties(
    782         $self->thumbnail_settings,
    783     );   
    784 
    785     $self->hd_settings_panel->properties(
    786         $self->hd_settings,
    787     );   
    788 
    789     $self->advanced_settings_panel->properties(
    790         $self->advanced_settings,
    791     );   
    792 
    793     $self->watermark_settings_panel->properties(
    794         $self->watermark_settings,
    795     ); 
    796        
    797738}
    798739
    799740sub _init_settings_panels {
    800     my ( $self ) = @_; 
    801 
    802     $self->image_prop_piwigo(
    803         Uploader::GUI::wxPropertyGridPanel->new(
    804             {
    805                 parentwnd       => $self,
    806                 properties      => $self->piwigo_properties,
    807             }
    808         )
    809     );
     741    my ( $self ) = @_;   
     742
    810743
    811744    $self->image_prop_exif(
     
    818751    );
    819752
    820 
    821     $self->general_settings_panel(
    822         Uploader::GUI::wxPropertyGridPanel->new(
     753    $self->global_settings_panel(
     754        Uploader::GUI::wxGlobalSettings->new(
    823755            {
    824756                parentwnd       => $self,
    825                 properties      => $self->general_settings,
     757                properties      => $self->global_settings,
    826758            }
    827759        )
    828     );   
    829 
    830     $self->resized_settings_panel(
    831         Uploader::GUI::wxPropertyGridPanel->new(
    832             {
     760    );
     761
     762
     763    $self->dlg_piwigo_photo_properties (
     764        Uploader::GUI::wxPhotoProperties->new(
     765            {
    833766                parentwnd       => $self,
    834                 properties      => $self->resized_settings,
    835 
    836             }
    837         )   
    838     );   
    839 
    840     $self->thumbnail_settings_panel(
    841         Uploader::GUI::wxPropertyGridPanel->new(
    842             {
    843                 parentwnd       => $self,
    844                 properties      => $self->thumbnail_settings,
    845             }
    846         )   
    847     );   
    848     $self->hd_settings_panel(
    849         Uploader::GUI::wxPropertyGridPanel->new(
    850             {
    851                 parentwnd       => $self,
    852                 properties      => $self->hd_settings,
    853             }
    854         )   
    855     );   
    856 
    857     $self->watermark_settings_panel(
    858         Uploader::GUI::wxPropertyGridPanel->new(
    859             {
    860                 parentwnd   => $self,
    861                 properties  => $self->watermark_settings,
     767                properties      => $self->piwigo_photo_properties,
     768                tags            =>
     769                {
     770                    id => $main::PHOTO_PROPERTIES_TAG,
     771                    choices => $self->piwigo_tags,
     772                    selection => $self->image_tags,
     773                    creation_callback => sub { $self->_create_piwigo_tag(@_) },
     774               },
    862775            }
    863776        )
    864777    );
    865        
    866     $self->advanced_settings_panel(
    867         Uploader::GUI::wxPropertyGridPanel->new(
    868             {
    869                 parentwnd       => $self,
    870                 properties      => $self->advanced_settings,
    871             }
    872         )   
    873     );   
    874 
    875     $self->image_prop_tags(
    876         Uploader::GUI::wxChoiceFilteredPanel->new(
    877             {
    878                 parentwnd    => $self,
    879                 choices      => $self->piwigo_tags,
    880                 selection    => $self->image_tags,
    881                 creation_callback => sub { $self->_create_piwigo_tag(@_) },
    882             }
    883         )   
    884     );   
    885 
    886     $self->dlg_piwigo_photo_properties(
    887         Uploader::GUI::wxPhotoProperties->new(
    888                     {
    889                 parentwnd       => $self,
    890                 properties      => $self->piwigo_photo_properties,
    891                                 tags            => {
    892                                                         id => $main::PHOTO_PROPERTIES_TAG,
    893                                         choices => $self->piwigo_tags,
    894                                         selection => $self->image_tags,
    895                                         creation_callback => sub { $self->_create_piwigo_tag(@_) },
    896                                                                    },
    897                         }
    898                 )
    899     ); 
    900 
    901         $self->piwigo_photo_properties_tags(
    902             $self->dlg_piwigo_photo_properties->FindWindow($main::PHOTO_PROPERTIES_TAG)
    903         );
    904 
    905    
    906     $self->general_settings_panel->Show(0);
     778
     779    $self->piwigo_photo_properties_tags(
     780        $self->dlg_piwigo_photo_properties->FindWindow($main::PHOTO_PROPERTIES_TAG)
     781    );
     782
    907783
    908784    $self->image_preview(
     
    914790    );
    915791
    916     $self->image_preview->Show(0);
    917     $self->image_prop_piwigo->Show(0);
    918     $self->image_prop_exif->Show(0);
    919        
    920792}
    921793
    922794sub init_panels {
    923     my ( $self ) = @_; 
     795    my ( $self ) = @_;   
    924796
    925797    my $file = sprintf(
     
    940812            new_album => sub {$self->OnAddCategories(@_) },
    941813            add_photos => sub { $self->OnAddImages(@_) },
    942             upload_photos => sub { $self->ProcessImageSelection(@_)},   
     814            upload_photos => sub { $self->ProcessImageSelection(@_)},   
    943815        }
    944816    );
     
    949821                parentwnd => $self,
    950822                imagelist => $self->imagelist,
    951                                 image_size => $self->imagelist->wx_thumb_size,
    952                                 columns => $self->piwigo_properties,
     823                image_size => $self->imagelist->wx_thumb_size,
     824                columns => $self->piwigo_property_list,
    953825            }
    954826        )
    955827    );
    956828   
    957     $self->_init_settings_panels;       
     829    $self->_init_settings_panels;   
    958830}
    959831
    960832sub init_dnd_targets {
    961     my ( $self ) = @_; 
     833    my ( $self ) = @_;   
    962834
    963835    $self->imageviewer->SetDropTarget(
     
    972844        )
    973845    );
    974        
     846   
    975847}
    976848
     
    983855
    984856    $self->manager->AddPane
    985       ( $self->create_notebook_imagelist, Wx::AuiPaneInfo->new->Name( "ImageViewer" )
    986         ->CenterPane->Resizable->CloseButton(0) );
    987 
    988         $self->manager->AddPane(
     857      ( $self->imageviewer, Wx::AuiPaneInfo->new->Name( "ImageViewer" )
     858        ->Left->Position(1)->DefaultPane->Caption(gettext("Photo selection"))->CaptionVisible->CloseButton(0) );
     859
     860    $self->manager->AddPane(
    989861        $self->dlg_piwigo_photo_properties,
    990862        Wx::AuiPaneInfo->new->Name( "piwigo_photo_properties" )
    991         ->Right->Position( 0 )->Resizable->CloseButton(0)
    992     );
    993                
     863        ->CenterPane->Position(0)->BestSize([600, 400])
     864        ->Caption(gettext("Photo properties"))->CaptionVisible
     865        ->CloseButton(0)
     866        ->MinSize([300, 200])
     867    );
     868
    994869    $self->manager->AddPane(
    995870        $self->create_tree,
    996871        Wx::AuiPaneInfo->new->Name( "categories" )
    997         ->Right->Position( 1 )->Resizable->CloseButton(0),
    998     );
    999 
    1000 
     872        ->CenterPane->Position( 1 )->MinSize([300, 200])
     873    );
    1001874
    1002875    $self->_init_aui_settings_panels;
     
    1018891
    1019892
    1020     if($self->perspective){
     893    if(0 and $self->perspective){
    1021894        $self->manager->LoadPerspective($self->perspective);
    1022895    }
    1023896    else {
    1024         $self->manager->GetPane("piwigo_photo_properties")->MinSize(600,350);
    1025         $self->manager->GetPane("categories")->MinSize(600,100);
    1026 
    1027897        $self->manager->GetPane("tb1")->Caption( gettext("Tools") );
    1028         $self->manager->GetPane("image_preview")->Caption(gettext("Preview"))->Show(0);
    1029         $self->manager->GetPane("getting_started")->Caption(gettext("Getting started"))->Float->Show(1);
    1030         $self->manager->GetPane("photo_properties")->Caption(gettext("Photo properties"))->Float->Show(0);
    1031         $self->manager->GetPane("global_settings")->Caption(gettext("Global settings"))->Float->Show(0);
     898        $self->manager->GetPane("image_preview")->Caption(gettext("Preview"));
     899        $self->manager->GetPane("getting_started")->Caption(gettext("Getting started"));
     900        $self->manager->GetPane("photo_properties")->Caption(gettext("Photo exif properties"));
     901        $self->manager->GetPane("global_settings")->Caption(gettext("Global settings"));
    1032902    }
    1033903
    1034904    $self->manager->GetPane("categories")->Caption(
    1035           sprintf("%s - %s", sprintf("Piwigo %s", wxTheApp->branding->{categories}), $url )
     905          sprintf("%s", sprintf("Piwigo %s", wxTheApp->branding->{categories}))
    1036906    );
    1037907   
     
    1042912
    1043913sub _init_aui_settings_panels {
    1044     my ( $self ) = @_; 
     914    my ( $self ) = @_;   
    1045915
    1046916    $self->manager->AddPane
    1047917      ( $self->image_preview, Wx::AuiPaneInfo->new->Name( "image_preview" )
    1048         ->Floatable(1)->Resizable->CloseButton(1));
     918        ->DefaultPane->MaximizeButton(1)->MinSize([200,150])->Float->Hide);
    1049919
    1050920    $self->manager->AddPane
    1051921      ( $self->htmlhome, Wx::AuiPaneInfo->new->Name( "getting_started" )
    1052        ->Floatable(1)->Resizable->CloseButton(1) );
     922       ->Left->Position(0)->DefaultPane->CloseButton(1) );
    1053923
    1054924    $self->manager->AddPane
    1055       ( $self->create_notebook_image_properties, Wx::AuiPaneInfo->new->Name( "photo_properties" )
    1056         ->Floatable(1)->Resizable->CloseButton(1) );
     925      ( $self->image_prop_exif, Wx::AuiPaneInfo->new->Name( "photo_properties" )
     926        ->DefaultPane->CloseButton(1)->MinSize([200,150])->Float->Hide );
    1057927
    1058928    $self->manager->AddPane
    1059       ( $self->create_notebook_global_settings, Wx::AuiPaneInfo->new->Name( "global_settings" )
    1060         ->Floatable(1)->Resizable->CloseButton(1) );
     929      (
     930        $self->global_settings_panel,
     931        Wx::AuiPaneInfo->new->Name( "global_settings" )
     932        ->DefaultPane->CloseButton(1)->MinSize([720, 620])->Float->Hide );
    1061933
    1062934}
     
    1066938
    1067939    $self->manager->GetPane("photo_properties")->Show(1);
    1068     $self->manager->Update();   
    1069        
     940    $self->manager->Update();
     941   
    1070942}
    1071943
     
    1073945    my ( $self ) = @_;
    1074946
    1075         my $preview_pane = $self->manager->GetPane("image_preview");
     947    my $preview_pane = $self->manager->GetPane("image_preview");
    1076948    if (! $preview_pane->IsShown){
    1077             $preview_pane->MinSize(100,75)->Float->Show(1);
    1078         $self->manager->Update();   
    1079 
    1080         $self->_image_preview_refresh;
    1081         $self->image_preview->Refresh;         
    1082         };
    1083        
     949        $preview_pane->Show(1);
     950        $self->manager->Update();
     951
     952        $self->set_preview_image;
     953        $self->image_preview->Refresh;
     954    };
     955
    1084956}
    1085957
     
    1087959    my ( $self ) = @_;
    1088960
    1089     $self->toolbar->EnableTool(100, 0 );
    1090     $self->manager->GetPane("getting_started")->Float->Show(1);
    1091     $self->manager->Update();   
    1092        
     961    $self->manager->GetPane("getting_started")->Show(1);
     962    $self->manager->Update();
     963   
    1093964}
    1094965
     
    1096967    my ( $self ) = @_;
    1097968
    1098     $self->toolbar->EnableTool(104, 0 );
    1099     $self->manager->GetPane("global_settings")->Float->Show(1);
    1100     $self->manager->Update();   
     969    $self->manager->GetPane("global_settings")->Show(1);
     970    $self->manager->Update();
    1101971}
    1102972
    1103973sub OnChooseLanguage {
    1104     my ( $self ) = @_; 
     974    my ( $self ) = @_;   
    1105975
    1106976  my $languages = wxTheApp->available_languages;
     
    11361006    my ( $self ) = @_;
    11371007   
    1138     Wx::LogMessage("New default_photo_name %s", $self->imagelist->default_photo_name); 
    1139 }
    1140 
    1141 
    1142 sub create_notebook_imagelist {
    1143     my( $self ) = @_;
    1144     my $book = Wx::AuiNotebook->new( $self, -1, [-1, -1], [300, 450],
    1145                                      wxBORDER_NONE|wxAUI_NB_TAB_MOVE|wxAUI_NB_TAB_SPLIT);
    1146 
    1147         my $imglistpage = [
    1148             [
    1149                 $self->imageviewer,
    1150                 gettext("Photo selection"),
    1151                 '../res/images.png',
    1152                 wxBITMAP_TYPE_PNG,
    1153             ],
    1154         ];
    1155 
    1156     $self->notebook($book);
    1157     $self->_populate_notebook($self->notebook, $imglistpage, 0);
    1158     return $book;
    1159 }
    1160 
    1161 sub create_notebook_image_properties {
    1162     my( $self ) = @_;
    1163     my $book = Wx::AuiNotebook->new( $self, -1, [-1, -1], [450, 450],
    1164                                      wxBORDER_NONE|wxAUI_NB_TAB_MOVE|wxAUI_NB_TAB_SPLIT);
    1165     my $pages = [   
    1166         [
    1167             $self->image_prop_piwigo,
    1168             "Piwigo",
    1169         ],
    1170         [
    1171             $self->image_prop_tags,
    1172             "Tags",
    1173         ],
    1174         [
    1175             $self->image_prop_exif,
    1176             "Exif",
    1177         ],
    1178     ];
    1179    
    1180     $self->_populate_notebook( $book, $pages );
    1181 
    1182     $self->notebook_image_properties($book);
    1183 
    1184     return $book;
    1185 }
    1186 
    1187 sub create_notebook_global_settings {
    1188     my( $self ) = @_;
    1189     my $book = Wx::AuiNotebook->new( $self, -1, [-1, -1], [450, 450],
    1190                                      wxBORDER_NONE|wxAUI_NB_TAB_MOVE|wxAUI_NB_TAB_SPLIT);
    1191     my $pages = [   
    1192         [
    1193             $self->general_settings_panel,
    1194             gettext("General"),
    1195         ],
    1196         [
    1197             $self->resized_settings_panel,
    1198             gettext("Resized"),
    1199         ],
    1200         [
    1201             $self->thumbnail_settings_panel,
    1202             gettext("Thumbnail"),
    1203         ],
    1204         [
    1205             $self->hd_settings_panel,
    1206             gettext("High definition"),
    1207         ],
    1208         [
    1209             $self->watermark_settings_panel,
    1210             gettext("Watermark"),
    1211         ],   
    1212         [
    1213             $self->advanced_settings_panel,
    1214             gettext("Advanced"),
    1215         ],
    1216     ];
    1217    
    1218     $self->_populate_notebook( $book, $pages );
    1219 
    1220     $self->notebook_global_settings($book);
    1221 
    1222     return $book;
    1223 }
    1224 
    1225 
    1226 
     1008    Wx::LogMessage("New default_photo_name %s", $self->imagelist->default_photo_name);   
     1009}
     1010
     1011sub OnGeneralSettingsClose {
     1012    my ( $self, $event ) = @_;
     1013
     1014    $self->manager->GetPane("global_settings")->Hide;
     1015    $self->manager->Update();
     1016}
    12271017
    12281018sub create_tree {
     
    12321022        map {
    12331023            Wx::Bitmap->new( $_, wxBITMAP_TYPE_PNG )
    1234                
     1024           
    12351025        }
    12361026        (
     
    12421032    $self->treeimglist( Wx::ImageList->new( 16, 16, 1 ) );
    12431033    map {
    1244         $self->treeimglist->Add($_);
     1034        $self->treeimglist->Add($_);
    12451035    }
    12461036    @$images;
     
    13281118
    13291119sub _populate_notebook {
    1330     my ( $self, $book, $pages, $position ) = @_;       
     1120    my ( $self, $book, $pages, $position ) = @_;   
    13311121
    13321122    my $i = 0;
     
    13531143
    13541144    $self->_tree_mnu;
    1355     $self->_imageviewer_mnu;   
     1145    $self->_imageviewer_mnu;   
    13561146}
    13571147
    13581148
    13591149sub _tree_mnu {
    1360     my ( $self ) = @_; 
     1150    my ( $self ) = @_;   
    13611151
    13621152    my $ctx_mnu = Wx::Menu->new;
    13631153   
    13641154    map {
    1365         $ctx_mnu->Append(
    1366             @$_[0..2], wxITEM_NORMAL
    1367         )->SetBitmap(Wx::Bitmap->new($_->[3],wxBITMAP_TYPE_PNG));
     1155        $ctx_mnu->Append(
     1156            @$_[0..2], wxITEM_NORMAL
     1157        )->SetBitmap(Wx::Bitmap->new($_->[3],wxBITMAP_TYPE_PNG));
    13681158    }
    13691159    (
     
    14191209    $self->tree_mnu(
    14201210         $ctx_mnu
    1421     ); 
    1422 }       
     1211    );   
     1212}   
    14231213
    14241214sub _imageviewer_mnu {
    1425     my ( $self ) = @_; 
     1215    my ( $self ) = @_;   
    14261216
    14271217    my $ctx_mnu = Wx::Menu->new;
    14281218   
    14291219    map {
    1430         $ctx_mnu->Append(
    1431             @$_[0..2]
    1432         )->SetBitmap(Wx::Bitmap->new($_->[3],wxBITMAP_TYPE_PNG));
     1220        $ctx_mnu->Append(
     1221            @$_[0..2]
     1222        )->SetBitmap(Wx::Bitmap->new($_->[3],wxBITMAP_TYPE_PNG));
    14331223    }
    14341224    (
     
    14531243        ],
    14541244    );
    1455        
     1245   
    14561246    $ctx_mnu->Delete(0);
    14571247    $self->imageviewer_mnu(
    14581248         $ctx_mnu
    1459     ); 
     1249    );   
    14601250}
    14611251
    14621252sub _initEventHandlers {
    14631253    my ( $self ) = @_ ;
    1464        
     1254   
    14651255    Wx::Event::EVT_MENU( $self, 100, \&OnGettingStarted );
    14661256    Wx::Event::EVT_MENU( $self, 101, \&OnAddImages );
     
    14821272
    14831273    EVT_CLOSE( $self, \&OnClose );
    1484     Wx::Event::EVT_UPDATE_UI( $self, $self, \&OnUpdateUI );
    14851274
    14861275
     
    14921281    Wx::Event::EVT_MENU( $self, 1+$ID_IMAGEVIEWER_CTX_MENU, \&OnPhotoProperties );
    14931282    Wx::Event::EVT_MENU( $self, 2+$ID_IMAGEVIEWER_CTX_MENU, \&OnPreview );
     1283    EVT_BUTTON( $self, $main::GS_CLOSE, \&OnGeneralSettingsClose );
     1284
    14941285
    14951286
     
    15131304    }
    15141305    $dialog->Destroy;
    1515 #    $event->Skip;
     1306    $event->Skip;
    15161307  }
    15171308}
    15181309
    1519 sub OnUpdateUI {
    1520     my( $self, $event ) = @_;
     1310sub OnUpdateToolbar {
     1311    my( $self ) = @_;
    15211312   
    15221313    if( $self->manager ){
    15231314        if($self->manager->GetPane("global_settings")->IsShown){
    1524             $self->toolbar->EnableTool(104, 0);                 
     1315            $self->toolbar->EnableTool(104, 0);
    15251316        }
    15261317        else{
    1527             $self->toolbar->EnableTool(104, 1);                 
     1318            $self->toolbar->EnableTool(104, 1);
    15281319        }
    15291320
    15301321        if($self->manager->GetPane("getting_started")->IsShown){
    1531             $self->toolbar->EnableTool(100, 0);                 
     1322            $self->toolbar->EnableTool(100, 0);
    15321323        }
    15331324        else{
    1534             $self->toolbar->EnableTool(100, 1);                 
     1325            $self->toolbar->EnableTool(100, 1);
    15351326        }
    15361327    }
     
    15431334   
    15441335    $self->imagelist->RemoveImageSelection;
    1545     $self->imageviewer->Refresh;       
    1546 
    1547         if (!$self->imageviewer->GetItemCount){
     1336    $self->imageviewer->Refresh;   
     1337
     1338    if (!$self->imageviewer->GetItemCount){
    15481339        $self->image_preview->image(
    15491340            0
    15501341        );
    1551             # have to reset
    1552                 $self->dlg_piwigo_photo_properties->ClearProperties;
     1342        # have to reset
     1343        $self->dlg_piwigo_photo_properties->ClearProperties;
    15531344        $self->piwigo_photo_properties_tags->ClearAllSelection;
    1554                 $self->imagelist->SetCurrentImage(-1);
    1555         }
     1345        $self->imagelist->SetCurrentImage(-1);
     1346    }
    15561347
    15571348    $self->image_preview->Refresh;
     
    16151406
    16161407    $self->PopupMenu($self->tree_mnu, wxDefaultPosition);
    1617        
     1408   
    16181409}
    16191410
     
    16291420    }
    16301421    else{
    1631         $event->Veto;
     1422        $event->Veto;
    16321423    }
    16331424}
     
    16351426sub _SetLabel {
    16361427    my( $self, $event ) = @_;
    1637        
     1428   
    16381429    my $category = $self->tree->GetPlData($event->GetItem);
    16391430    my $category_id;
     
    16501441   
    16511442    if(!$success){
    1652         $ok = 0;
     1443        $ok = 0;
    16531444    }
    16541445
    16551446    if('fail' eq $content->{stat}){
    1656         $ok = 0;
     1447        $ok = 0;
    16571448    }
    16581449
    16591450    # method call failed
    16601451    if(!$ok){
    1661         $event->Veto;
     1452        $event->Veto;
    16621453        Wx::MessageBox(
    16631454            sprintf(
     
    16781469   
    16791470    $self->PopupMenu($self->imageviewer_mnu, wxDefaultPosition);
    1680        
    1681        
     1471   
     1472   
    16821473}
    16831474
     
    17161507
    17171508    if( $dialog->ShowModal != wxID_CANCEL ) {
    1718         my $name = $dialog->GetValue;
     1509        my $name = $dialog->GetValue;
    17191510        my ( $success, $status_msg, $content ) = $self->pwg->AddCategories( $name, $category_id);
    17201511
     
    17341525
    17351526sub _refresh_all_categories_helper {
    1736     my ( $self ) = @_; 
     1527    my ( $self ) = @_;   
    17371528
    17381529    my $busycursor = Wx::BusyCursor->new();
     
    17651556        $event->GetLabel
    17661557    );
    1767        
     1558       
    17681559    $self->dlg_piwigo_photo_properties->SetProperties;
    1769     $self->image_prop_piwigo->Refresh;
    17701560}
    17711561
     
    17931583
    17941584sub _on_imageviewer_item_selected {
    1795     my ( $self, $index ) = @_; 
     1585    my ( $self, $index ) = @_;   
    17961586    $self->current_imageviewer_index($index);
    17971587    $self->imagelist->SetCurrentImage($index);
     
    18001590        $self->imageviewer->GetSelectedItems
    18011591    );
    1802        
    1803         # process image_preview in idle time
    1804         # and when current event is processed
    1805         # see call to EVT_IDLE
     1592
     1593    # process image_preview in idle time
     1594    # and when current event is processed
     1595    # see call to EVT_IDLE
    18061596    $self->image_preview_refresh(1);
    18071597
    1808     $self->dlg_piwigo_photo_properties->SetProperties;
    1809     $self->image_prop_piwigo->Refresh;
     1598    $self->dlg_piwigo_photo_properties->SetProperties if defined $self->dlg_piwigo_photo_properties;
    18101599    $self->image_prop_exif->Refresh;
    1811     $self->image_prop_tags->Refresh;
    1812         $self->piwigo_photo_properties_tags->Refresh;
    1813 
    1814 }
    1815 
    1816 sub _image_preview_refresh {
    1817     my ( $self ) = @_; 
    1818 
    1819         my $current_image = $self->imagelist->current_image;
     1600    $self->piwigo_photo_properties_tags->Refresh;
     1601
     1602}
     1603
     1604sub set_preview_image {
     1605    my ( $self ) = @_;   
     1606
     1607    my $current_image = $self->imagelist->current_image;
    18201608    my $image = Wx::Image->new;
    18211609    $image->LoadFile(
     
    18301618        # Valid for Rotate 180, Rotate 90 CW, Rotate 270 CW
    18311619        if( $orientation =~ m/Rotate (\d+)/ ){
    1832                         for(my $i=0; $i < floor($1/90) ; $i++){
     1620            for(my $i=0; $i < floor($1/90) ; $i++){
    18331621                $image = $image->Rotate90;
    1834             }                           
     1622            }               
    18351623        }
    18361624    }
    18371625
    1838   $self->image_preview->image_size(
    1839       [$image->GetWidth, $image->GetHeight, ]
    1840   );       
    1841 
    1842   $self->image_preview->image(
    1843       $image
    1844   );       
    1845  
     1626    $self->image_preview->image_size(
     1627        [$image->GetWidth, $image->GetHeight, ]
     1628    );       
     1629
     1630    $self->image_preview->image(
     1631        $image
     1632    );       
    18461633}
    18471634
     
    18601647            $index
    18611648        );
    1862     }   
     1649    }   
    18631650
    18641651}
     
    18741661# remove image from imagelist when uploaded
    18751662sub UploadImagesViewerRefresh {
    1876     my ( $self ) = @_; 
     1663    my ( $self ) = @_;   
    18771664
    18781665
     
    18891676
    18901677sub UploadProgressMessageRefresh {
    1891     my ( $self, $msg ) = @_;   
     1678    my ( $self, $msg ) = @_;   
    18921679
    18931680    Wx::Yield();
     
    18951682    $self->upload_progressdlg->processing(
    18961683        $msg   
    1897     ); 
     1684    );   
    18981685    $self->upload_progressdlg->LogProgress();
    18991686
     
    19021689
    19031690sub UploadProgressMessageDetailsRefresh {
    1904     my ( $self, $msg ) = @_;   
     1691    my ( $self, $msg ) = @_;   
    19051692
    19061693    Wx::Yield();
     
    19081695    $self->upload_progressdlg->processing_details(
    19091696        $msg   
    1910     ); 
     1697    );   
    19111698    $self->upload_progressdlg->LogProgress();
    19121699
     
    19161703
    19171704sub UploadProgressThumbnailRefresh {
    1918     my ( $self ) = @_; 
     1705    my ( $self ) = @_;   
    19191706
    19201707    my $imagelist = $self->imagelist ;
     
    19331720
    19341721sub UploadProgressBarRefresh {
    1935     my ( $self, $value ) = @_; 
     1722    my ( $self, $value ) = @_;   
    19361723
    19371724    eval {
     
    19471734
    19481735sub SetNewFilesDisplayEndInfo {
    1949     my ( $self, $msg ) = @_;   
    1950        
     1736    my ( $self, $msg ) = @_;   
     1737   
    19511738    $self->progressdlg->DisplayEndInfo($msg);
    19521739}
    19531740
    19541741sub UploadDisplayEndInfo {
    1955     my ( $self, $msg ) = @_;   
     1742    my ( $self, $msg ) = @_;   
    19561743   
    19571744    my $imagelist = $self->imagelist ;
     
    19611748
    19621749sub ShowImageViewer {
    1963     my ( $self ) = @_; 
     1750    my ( $self ) = @_;   
    19641751
    19651752    if(!$self->imageviewer->IsShown){
     
    19701757
    19711758sub ActivateImageViewer {
    1972     my ( $self ) = @_; 
    1973        
     1759    my ( $self ) = @_;   
     1760   
    19741761}
    19751762
     
    19771764sub SetNewFilesViewerRefresh {
    19781765
    1979     my ( $self ) = @_; 
     1766    my ( $self ) = @_;   
    19801767
    19811768    my $wximagelist = $self->imagelist->wx_thumb_imglist;
     
    19881775    ) if defined $self->imagelist->current_image->wx_thumb_file;
    19891776    print $self->imagelist->current_image->wx_thumb_file, " added with index ", $indx, "\n";   
    1990        
     1777   
    19911778    $self->imageviewer->Refresh(
    19921779        $wximagelist
     
    20071794        # all selected is implicit
    20081795        if(!scalar @{$self->imageviewer->GetSelectedItems}){
    2009        
     1796       
    20101797            $self->imagelist->image_selection(
    20111798                $self->imageviewer->GetAllItems
    20121799            );
    2013         }
    2014         
     1800        }
     1801      
    20151802        return if( !defined $self->imagelist->image_selection );
    20161803        return if( !scalar @{$self->imagelist->image_selection} );
     
    20961883   
    20971884    $self->imagelist->Store;
    2098     wxTheApp->login_dlg->Destroy;       
     1885    wxTheApp->login_dlg->Destroy;   
    20991886
    21001887    wxTheApp->perspective(
     
    22001987   
    22011988    );
    2202        
    2203         $tb->AddSeparator;
    2204        
    2205         $tb->AddControl(
    2206             Wx::Choice->new(
    2207                     $tb,
    2208                         106,
    2209                         wxDefaultPosition,
    2210                         wxDefaultSize,
    2211                         [],
    2212                 )
    2213         );
    2214         my $ch = $tb->FindWindow(106);
     1989   
     1990    $tb->AddSeparator;
     1991   
     1992    $tb->AddControl(
     1993        Wx::Choice->new(
     1994        $tb,
     1995            106,
     1996            wxDefaultPosition,
     1997            [300, -1],
     1998            [],
     1999        )
     2000    );
     2001    my $ch = $tb->FindWindow(106);
    22152002    $ch->SetToolTip(gettext("How photo selection is displayed"));
    2216         map {
    2217             $ch->Append(gettext($_), $_);
    2218         }(
    2219             "Thumbnail and caption",
    2220                 "Thumbnail",
    2221                 "Property list"
    2222         );
    2223        
    2224         $ch->SetStringSelection(gettext($self->imagelist->display_mode));
     2003    map {
     2004        $ch->Append(gettext($_), $_);
     2005    }(
     2006        "Thumbnail and caption",
     2007        "Thumbnail",
     2008        "Property list"
     2009    );
     2010   
     2011    $ch->SetStringSelection(gettext($self->imagelist->display_mode));
    22252012    $tb->Realize;
    22262013
     
    22302017sub OnPhotoSelMode {
    22312018    my ( $self, $event )= @_;
    2232        
    2233         $self->imagelist->display_mode(
    2234             $event->GetClientData
    2235         );
    2236 
    2237         $self->imageviewer->change_display_mode(1);
     2019   
     2020    $self->imagelist->display_mode(
     2021        $event->GetClientData
     2022    );
     2023
     2024    $self->imageviewer->change_display_mode(1);
    22382025}
    22392026
     
    23322119  eval {
    23332120      if(scalar @$VAR1){
    2334            my @items;
    2335            if(scalar @items < 2) {
     2121             my @items;
     2122             if(scalar @items < 2) {
    23362123               my ($dropItem, $flag) = $self->tree->HitTest([$x, $y]);
    2337                 push @items, $dropItem;
    2338            }
    2339            else {
    2340                 @items = $self->tree->GetSelections;
    2341            }
    2342            
    2343            # remove root item which is not a valid category
    2344            @items = grep { $self->tree->GetPlData( $_ ) != -1 } @items;
    2345            
     2124                 push @items, $dropItem;
     2125             }
     2126             else {
     2127                 @items = $self->tree->GetSelections;
     2128             }
     2129             
     2130             # remove root item which is not a valid category
     2131             @items = grep { $self->tree->GetPlData( $_ ) != -1 } @items;
     2132             
    23462133           $self->frame->imagelist->categories(
    23472134               [
     
    23532140           );
    23542141           
    2355            $self->frame->imagelist->image_selection($VAR1);
    2356            $self->frame->ProcessImageSelection ;
    2357       } 
     2142             $self->frame->imagelist->image_selection($VAR1);
     2143             $self->frame->ProcessImageSelection ;
     2144      }   
    23582145  };
    23592146}
Note: See TracChangeset for help on using the changeset viewer.