Index: /extensions/pLoader/trunk/src/Uploader/GUI/wxFrameAUI.pm
===================================================================
--- /extensions/pLoader/trunk/src/Uploader/GUI/wxFrameAUI.pm	(revision 3371)
+++ /extensions/pLoader/trunk/src/Uploader/GUI/wxFrameAUI.pm	(revision 3372)
@@ -24,4 +24,5 @@
 use Wx::DND;
 use Wx qw/
+             wxITEM_NORMAL
              wxNullBitmap
              wxID_OK
@@ -340,4 +341,6 @@
           perspective
           current_imageviewer_index
+          imageviewer_mnu
+          tree_mnu
       /;
 __PACKAGE__->mk_accessors( @properties );
@@ -456,5 +459,6 @@
     $self->_set_setting_properties;
     $self->_initFrame;
-    $self->_InitEventHandlers;
+    $self->_initMenus;
+    $self->_initEventHandlers;
     $self->_initImgTypes;   
 
@@ -1293,6 +1297,98 @@
 
 
-
-sub _InitEventHandlers {
+sub _initMenus {
+    my ( $self ) = @_ ;
+
+    $self->_tree_mnu;
+    $self->_imageviewer_mnu;	
+}
+
+
+sub _tree_mnu {
+    my ( $self ) = @_;	
+
+    my $ctx_mnu = Wx::Menu->new;
+    
+    map {
+    	$ctx_mnu->Append(
+    	    @$_[0..2], wxITEM_NORMAL
+    	)->SetBitmap(Wx::Bitmap->new($_->[3],wxBITMAP_TYPE_PNG));
+    }
+    (
+        # workaround : first item does not show bitmap
+        [
+            0, 
+            "",
+            "",
+            '../res/mnu_folder_new.png',
+        ],
+        [
+            1+$ID_TREE_CTX_MENU, 
+            wxTheApp->branding->{'Add new category'},
+            sprintf(
+                "%s %s %s %s", 
+                gettext("Add a new"), 
+                wxTheApp->branding->{category},
+                gettext("to the currently selected"),
+                wxTheApp->branding->{category},
+            ),
+            '../res/mnu_folder_new.png',
+        ],
+        [
+            2+$ID_TREE_CTX_MENU, 
+            "Refresh",
+            sprintf(
+                "Refresh %s list.",
+                wxTheApp->branding->{category},
+            ),
+            '../res/mnu_refresh.png',
+        ],
+    );
+
+    $ctx_mnu->Delete(0);
+    $self->tree_mnu(
+         $ctx_mnu
+    );	
+}	
+
+sub _imageviewer_mnu {
+    my ( $self ) = @_;	
+
+    my $ctx_mnu = Wx::Menu->new;
+    
+    map {
+    	$ctx_mnu->Append(
+    	    @$_[0..2]
+    	)->SetBitmap(Wx::Bitmap->new($_->[3],wxBITMAP_TYPE_PNG));
+    }
+    (
+        # workaround : first item does not show bitmap
+        [
+            0, 
+            "",
+            "",
+            '../res/mnu_properties.png',
+        ],
+        [
+            1+$ID_IMAGEVIEWER_CTX_MENU, 
+            gettext("Properties"),
+            gettext("Modify photo properties"),
+            '../res/mnu_properties.png',
+        ],
+        [
+            2+$ID_IMAGEVIEWER_CTX_MENU, 
+            gettext("Preview"),
+            gettext("Display photo preview"),
+            '../res/mnu_preview.png',
+        ],
+    );
+	
+    $ctx_mnu->Delete(0);
+    $self->imageviewer_mnu(
+         $ctx_mnu
+    );	
+}
+
+sub _initEventHandlers {
     my ( $self ) = @_ ;
 	
@@ -1304,5 +1400,5 @@
     Wx::Event::EVT_MENU( $self, 105, \&OnChooseLanguage );
     EVT_TREE_SEL_CHANGED( $self, $self->tree, \&OnTreeSelChanged );
-    EVT_TREE_ITEM_RIGHT_CLICK( $self->tree, $self->tree, \&OnTreeItemRightClick );
+    EVT_TREE_ITEM_RIGHT_CLICK( $self, $self->tree, \&OnTreeItemRightClick );
 
     EVT_LIST_END_LABEL_EDIT( $self, $self->imageviewer, \&OnImageViewerEndLabelEdit );
@@ -1363,4 +1459,5 @@
         }
     }
+
 }
 
@@ -1371,4 +1468,5 @@
     $self->imagelist->RemoveImageSelection;
     $self->imageviewer->Refresh;	
+
 }
 
@@ -1422,37 +1520,6 @@
     my( $self, $event ) = @_;
 
-    my $point = $event->GetPoint ;
-    my $ctx_mnu = Wx::Menu->new;
-    
-    map {
-    	$ctx_mnu->Append(
-    	    @$_[0..2]
-    	)->SetBitmap(Wx::Bitmap->new($_->[3],wxBITMAP_TYPE_PNG));
-    }
-    (
-        [
-            1+$ID_TREE_CTX_MENU, 
-            wxTheApp->branding->{'Add new category'},
-            sprintf(
-                "%s %s %s %s", 
-                gettext("Add a new"), 
-                wxTheApp->branding->{category},
-                gettext("to the currently selected"),
-                wxTheApp->branding->{category},
-            ),
-            '../res/mnu_folder_new.png',
-        ],
-        [
-            2+$ID_TREE_CTX_MENU, 
-            "Refresh",
-            sprintf(
-                "Refresh %s list.",
-                wxTheApp->branding->{category},
-            ),
-            '../res/mnu_refresh.png',
-        ],
-    );
-
-    $self->PopupMenu($ctx_mnu, wxDefaultPosition);
+
+    $self->PopupMenu($self->tree_mnu, wxDefaultPosition);
 	
 }
@@ -1462,28 +1529,6 @@
     my( $self, $event ) = @_;
 
-    my $point = $event->GetPoint ;
-    my $ctx_mnu = Wx::Menu->new;
-    
-    map {
-    	$ctx_mnu->Append(
-    	    @$_[0..2]
-    	)->SetBitmap(Wx::Bitmap->new($_->[3],wxBITMAP_TYPE_PNG));
-    }
-    (
-        [
-            1+$ID_IMAGEVIEWER_CTX_MENU, 
-            gettext("Properties"),
-            gettext("Modify photo properties"),
-            '../res/mnu_properties.png',
-        ],
-        [
-            2+$ID_IMAGEVIEWER_CTX_MENU, 
-            gettext("Preview"),
-            gettext("Display photo preview"),
-            '../res/mnu_preview.png',
-        ],
-    );
-    
-    $self->PopupMenu($ctx_mnu, wxDefaultPosition);
+    
+    $self->PopupMenu($self->imageviewer_mnu, wxDefaultPosition);
 	
 	
@@ -1607,6 +1652,9 @@
     if(WXK_DELETE == $event->GetKeyCode){
         $self->OnRemoveImages();
+        
+        my $index = $self->current_imageviewer_index < $self->imageviewer->GetItemCount ?
+            $self->current_imageviewer_index : $self->current_imageviewer_index -1 ;
         $self->imageviewer->SelectItem(
-            $self->current_imageviewer_index
+            $index
         );
     }	
