Index: /extensions/pLoader/trunk/locale/fr_FR/pLoader.po
===================================================================
--- /extensions/pLoader/trunk/locale/fr_FR/pLoader.po (revision 5103)
+++ /extensions/pLoader/trunk/locale/fr_FR/pLoader.po (revision 5104)
@@ -658,2 +658,11 @@
msgid "Changes apply to the whole batch"
msgstr "Les modifications s'appliquent à toutes les photos de la sélection"
+
+msgid "Drag photos here to get started"
+msgstr "Glissez-déposez vos photos ici pour démarrer"
+
+msgid "Or click"
+msgstr "Ou cliquez sur"
+
+msgid "to choose files on your computer"
+msgstr "pour choisir des fichiers de votre ordinateur"
Index: /extensions/pLoader/trunk/src/Uploader/GUI/Frame.pm
===================================================================
--- /extensions/pLoader/trunk/src/Uploader/GUI/Frame.pm (revision 5103)
+++ /extensions/pLoader/trunk/src/Uploader/GUI/Frame.pm (revision 5104)
@@ -43,4 +43,5 @@
wxBITMAP_TYPE_ANY
wxTB_FLAT
+ wxTB_TEXT
wxSIZE
wxWHITE
@@ -79,4 +80,5 @@
wxHORIZONTAL
wxVERTICAL
+ wxEXPAND
/;
use base qw/Wx::Frame Class::Accessor::Fast/;
@@ -101,5 +103,4 @@
logwnd
oldlogwnd
- getting_started
categories
imagelist
@@ -728,4 +729,6 @@
);
+ # message displayed in the image listctrl when empty
+ $self->imageviewer->InitEmptyMsg;
$self->init_panels;
@@ -765,20 +768,39 @@
);
+ $self->OnUpdateImageviewerNotEmpty;
+ }
+ else{
+ $self->OnUpdateImageviewerEmpty;
}
# the imageviewer has a stretch factor of 1 : expands its size on frame resize
- $sizer_h->AddWindow( $self->imageviewer, 1, wxGROW|wxALIGN_CENTER_HORIZONTAL|wxALL||wxSHAPED, 2 );
- $sizer_h->AddWindow( $self->dlg_piwigo_photo_properties, 0, wxGROW|wxALIGN_CENTER_HORIZONTAL|wxALL||wxSHAPED, 2 );
+ $sizer_h->Add( $self->imageviewer, 1, wxEXPAND|wxALL, 2 );
+ $sizer_h->Add( $self->dlg_piwigo_photo_properties, 0, wxEXPAND|wxALL, 2 );
+
+
$self->SetSizer(
$sizer_h
);
-
- $sizer_h->SetSizeHints(
+ my $new_size = $sizer_h->Fit(
$self
);
-
-
-
-}
+ $self->SetMinSize([600, 500]);
+ $self->Center;
+}
+
+sub OnUpdateImageviewerEmpty {
+ my ( $self ) = @_;
+
+ $self->dlg_piwigo_photo_properties->Enable(0);
+ $self->imageviewer->OnEmpty;
+}
+
+sub OnUpdateImageviewerNotEmpty {
+ my ( $self ) = @_;
+
+ $self->dlg_piwigo_photo_properties->Enable(1);
+ $self->imageviewer->OnNotEmpty;
+}
+
sub _refresh_settings_panels_properties {
@@ -842,63 +864,8 @@
my ( $self ) = @_;
- $self->getting_started(
- Uploader::GUI::wxHtmlWindow->new(
- {
- html => $self->_gs_html(
- {
- label => gettext("Click links below to start using pLoader."),
- lnk1 => gettext("Add a new album."),
- lnk2 => gettext("Add photos to the selection."),
- lnk3 => gettext("Upload the photo selection into your album."),
- }
- ),
- caption => gettext("Getting started"),
- size => [450, 350],
- }
- )
- );
-
-
- $self->getting_started->InitHrefCallbacks(
- {
- new_album => sub {$self->OnAddCategories(@_) },
- add_photos => sub { $self->OnAddImages(@_) },
- upload_photos => sub { $self->ProcessImageSelection(@_)},
- }
- );
- $self->getting_started->Hide;
-
$self->_init_settings_panels;
}
# HTML code for getting started dialog box
-sub _gs_html {
- my ( $self, $params ) = @_;
-
-
- my $logo = File::Spec->catfile(wxTheApp->root_dir, wxTheApp->resource_dir, 'piwigo_logo.PNG');
-
-
- my $html = '';
- $html .= '
';
- $html .= '';
- $html .= '';
- $html .= sprintf("
", $logo);
- $html .= $params->{label};
- $html .= "
";
- $html .= '1. ';
- $html .= $params->{lnk1};
- $html .= '
';
- $html .= '2. ';
- $html .= $params->{lnk2};
- $html .= '
';
- $html .= '3. ';
- $html .= $params->{lnk3};
- $html .= '
';
-
- $html .= '';
-
- $html;
-}
@@ -937,9 +904,4 @@
}
-sub OnGettingStarted {
- my ( $self ) = @_;
-
- $self->getting_started->Show(1);
-}
sub OnGlobalSettings {
@@ -1210,5 +1172,4 @@
my ( $self ) = @_ ;
- Wx::Event::EVT_MENU( $self, 100, \&OnGettingStarted );
Wx::Event::EVT_MENU( $self, 101, \&OnAddImages );
Wx::Event::EVT_MENU( $self, 102, \&OnRemoveImages );
@@ -1240,4 +1201,5 @@
Wx::Event::EVT_BUTTON( $self, $main::PHOTO_PROPERTIES_UPLOAD, \&OnUploadImages );
+ Wx::Event::EVT_BUTTON( $self, $self->imageviewer->add_button->GetId, \&OnAddImages );
}
@@ -1298,5 +1260,10 @@
$self->piwigo_photo_properties_tags->ClearAllSelection;
$self->imagelist->SetCurrentImage(-1);
- }
+ $self->OnUpdateImageviewerEmpty;
+ }
+ else{
+ $self->OnUpdateImageviewerNotEmpty;
+ }
+
if(!$self->multi_selection_mode){
$self->OnUpdateSingleSelectionModeUI;
@@ -1687,8 +1654,8 @@
$self->imageviewer->Refresh;
- $self->image_preview->image(
- 0
- ) if !$self->imageviewer->GetItemCount;
-
+ if(!$self->imageviewer->GetItemCount){
+ $self->image_preview->image(0);
+ $self->OnUpdateImageviewerEmpty;
+ }
# reset previous selection
$self->imagelist->image_selection(
@@ -1808,4 +1775,6 @@
$wximagelist
);
+
+ $self->OnUpdateImageviewerNotEmpty if $self->imageviewer->GetItemCount;
Wx::Yield();
@@ -1934,5 +1903,4 @@
$self->image_preview->Destroy;
$self->image_prop_exif->Destroy;
- $self->getting_started->Destroy;
$self->progressdlg->Destroy if defined $self->progressdlg;
@@ -1966,13 +1934,4 @@
}
(
- [
- 100,
- gettext("Getting started"),
- wxTheApp->resource_path('tb_getting_started.png'),
- wxBITMAP_TYPE_PNG,
- 1,
- wxTheApp->resource_path('tb_getting_started.png'),
- gettext("Display getting started panel")
- ],
[
101,
Index: /extensions/pLoader/trunk/src/Uploader/GUI/wxImageListCtrl.pm
===================================================================
--- /extensions/pLoader/trunk/src/Uploader/GUI/wxImageListCtrl.pm (revision 5103)
+++ /extensions/pLoader/trunk/src/Uploader/GUI/wxImageListCtrl.pm (revision 5104)
@@ -23,4 +23,5 @@
use Wx::DND;
use POSIX qw(ceil floor);
+use Wx::Locale qw/:default/;
use Wx qw/
wxDefaultPosition
@@ -47,4 +48,16 @@
wxIMAGE_LIST_SMALL
wxTheApp
+ wxVERTICAL
+ wxALIGN_CENTER
+ wxHORIZONTAL
+ wxALIGN_CENTER_VERTICAL
+ wxALIGN_CENTER_HORIZONTAL
+ wxALL
+ wxGROW
+ wxWHITE
+ wxSWISS
+ wxNORMAL
+ wxBOLD
+ wxBITMAP_TYPE_PNG
/;
use Wx::Event qw/
@@ -83,5 +96,5 @@
-1,
wxDefaultPosition,
- [ 180, -1],
+ [ -1, -1],
);
@@ -110,4 +123,5 @@
$self->prevItemCount(-1);
+
EVT_LIST_BEGIN_DRAG( $self, $self, \&OnBeginDrag);
@@ -135,8 +149,26 @@
$self->Refresh;
$self->change_display_mode(0);
- }
- $event->Skip;
- }
- );
+ }
+ $event->Skip;
+ }
+ );
+
+ # manages empty panel position
+ Wx::Event::EVT_PAINT( $self, sub {
+ my ( $self, $event ) = @_;
+ if(exists $self->{_empty_panel}){
+ my ($w, $h) = $self->GetSizeWH;
+ my ($x, $y) = $self->GetPositionXY;
+ my ($wp, $hp) = $self->{_empty_panel}->GetSizeWH;
+ my $x_off = ($w-$wp)/3 > 0 ? ($w-$wp)/3 : 0;
+ my $y_off = ($h-$hp)/3 > 0 ? ($h-$hp)/3 : 0;
+ $self->{_empty_panel}->Move(
+ [ $x+$x_off, $y+$y_off ]
+ );
+ }
+ $event->Skip;
+ }
+ );
+
$self->initialize(
@@ -353,4 +385,83 @@
}
+sub OnEmpty {
+ my ( $self ) = @_;
+
+ $self->_OnEmptyLayout;
+
+}
+
+sub OnNotEmpty {
+ my ( $self ) = @_;
+
+ $self->{_empty_panel}->Show(0) if exists $self->{_empty_panel};
+}
+
+sub _OnEmptyLayout {
+
+ my( $self ) = @_;
+ $self->{_empty_panel}->Show(1);
+
+}
+
+sub add_button {
+ my ( $self ) = @_;
+
+ $self->{_add_bt};
+}
+
+sub InitEmptyMsg {
+
+ my ( $self ) = @_;
+ # add a panel
+ my $empty_panel = Wx::Panel->new($self, -1, wxDefaultPosition, wxDefaultSize);
+ my( $item0 ) = Wx::BoxSizer->new( wxVERTICAL );
+
+ my $fb = Wx::Font->new( 12, wxSWISS, wxNORMAL, wxBOLD );
+ my $fn = Wx::Font->new( 12, wxSWISS, wxNORMAL, wxNORMAL );
+
+ my( $item1 ) = Wx::StaticText->new( $empty_panel, -1, gettext("Drag photos here to get started"), wxDefaultPosition, wxDefaultSize, 0 );
+ $item1->SetFont($fb);
+ $item0->AddWindow( $item1, 0, wxALIGN_CENTER|wxALL, 5 );
+
+ my( $item2 ) = Wx::BoxSizer->new( wxHORIZONTAL );
+
+ my( $item3 ) = Wx::StaticText->new( $empty_panel, -1, gettext("Or click"), wxDefaultPosition, wxDefaultSize, 0 );
+ $item3->SetFont($fn);
+ $item2->AddWindow( $item3, 0, wxALIGN_CENTER|wxALL, 5 );
+
+ my $icon1 = Wx::Icon->new();
+ eval {
+ $icon1->LoadFile(
+ wxTheApp->resource_path('tb_add.png'),
+ wxBITMAP_TYPE_PNG
+ );
+ };
+ my $bmp = Wx::Bitmap->new( $icon1 );
+
+ my( $item4 ) = Wx::BitmapButton->new( $empty_panel, -1, $bmp, wxDefaultPosition, wxDefaultSize );
+ $item2->AddWindow( $item4, 0, wxALIGN_CENTER|wxALL, 5 );
+
+ my( $item5 ) = Wx::StaticText->new( $empty_panel, -1, gettext("to choose files on your computer"), wxDefaultPosition, wxDefaultSize, 0 );
+ $item5->SetFont($fn);
+ $item2->AddWindow( $item5, 0, wxALIGN_CENTER|wxALL, 5 );
+
+ $item0->Add( $item2, 0, wxALIGN_CENTER|wxALL, 0 );
+
+ $empty_panel->SetSizer( $item0 );
+ $item0->SetSizeHints( $empty_panel );
+
+ $self->{_empty_panel} = $empty_panel;
+ $self->{_add_bt} = $item4;
+ $self->{_empty_panel}->SetBackgroundColour(wxWHITE);
+
+ my ($wp, $hp) = $self->{_empty_panel}->GetSizeWH;
+
+ $self->SetMinSize( [20+$wp, -1 ]);
+
+}
+
+
+
1;