@@ -177,7 +177,8 @@ private void InitLanguage()
177177 backCustomBtn . Text = LangMan . Get ( "choose-color" ) + " ..." ;
178178 wallpaperBtn . Text = LangMan . Get ( "set-as-desktop-background" ) + " ..." ;
179179 printButton . Text = LangMan . Get ( "print" ) + " ..." ;
180- deleteBtn . Text = LangMan . Get ( "move-to-trash" ) + " ..." ;
180+ deleteBtn . Text = LangMan . Get ( "move-to-trash" ) ;
181+ permDeleteBtn . Text = LangMan . Get ( "perm-delete" ) + " ..." ;
181182 reloadButton . Text = LangMan . Get ( "reload-file" ) ;
182183
183184 selectionBtn . Text = LangMan . Get ( "selection-tool" ) + " | S" ;
@@ -448,7 +449,8 @@ private void openFile(string path)
448449 }
449450 catch
450451 {
451- showSuggestion ( LangMan . Get ( "unable-open-file" ) + ": " + Path . GetFileName ( path ) , SuggestionIcon . Warning ) ;
452+ if ( NextFile ( true ) > 1 ) showSuggestion ( LangMan . Get ( "unable-open-file-skipped" ) + ": " + Path . GetFileName ( path ) , SuggestionIcon . Next ) ;
453+ else showSuggestion ( LangMan . Get ( "unable-open-file" ) + ": " + Path . GetFileName ( path ) , SuggestionIcon . Warning ) ;
452454 }
453455 }
454456
@@ -466,7 +468,7 @@ public void openImage(Bitmap bitmap, string directoryName, string fileName)
466468 yesBtnImage : saveAsButton . Image ,
467469 showNoBtn : true ,
468470 noBtnText : LangMan . Get ( "dont-save" ) ,
469- noBtnImage : deleteBtn . Image ,
471+ noBtnImage : permDeleteBtn . Image ,
470472 darkMode : darkMode
471473 ) ;
472474 if ( window == DialogResult . Yes ) saveAsButton . PerformClick ( ) ;
@@ -530,6 +532,7 @@ public void openImage(Bitmap bitmap, string directoryName, string fileName)
530532 prevButton . Enabled = directoryName != null ;
531533 slideshowButton . Enabled = directoryName != null ;
532534 deleteBtn . Enabled = directoryName != null ;
535+ permDeleteBtn . Enabled = directoryName != null ;
533536 externalRunBtn . Enabled = directoryName != null ;
534537 externalChooseBtn . Enabled = directoryName != null ;
535538 externalFavoriteBtn . Enabled = directoryName != null ;
@@ -664,10 +667,13 @@ private void UpdatePictureBoxLocation()
664667
665668 pictureBox . Location = new Point ( x , y ) ;
666669
667- if ( pictureBox . Width > picturePanel . Width && pictureBox . Height > picturePanel . Height ) NativeMan . ShowScrollBar ( picturePanel . Handle , NativeMan . ScrollBarDirection . SB_BOTH , true ) ;
668- else if ( pictureBox . Width > picturePanel . Width ) NativeMan . ShowScrollBar ( picturePanel . Handle , NativeMan . ScrollBarDirection . SB_HORZ , true ) ;
669- else if ( pictureBox . Height > picturePanel . Height ) NativeMan . ShowScrollBar ( picturePanel . Handle , NativeMan . ScrollBarDirection . SB_VERT , true ) ;
670- else NativeMan . ShowScrollBar ( picturePanel . Handle , NativeMan . ScrollBarDirection . SB_BOTH , false ) ;
670+ if ( picturePanel != null && pictureBox != null )
671+ {
672+ if ( pictureBox . Width > picturePanel . Width && pictureBox . Height > picturePanel . Height ) NativeMan . ShowScrollBar ( picturePanel . Handle , NativeMan . ScrollBarDirection . SB_BOTH , true ) ;
673+ else if ( pictureBox . Width > picturePanel . Width ) NativeMan . ShowScrollBar ( picturePanel . Handle , NativeMan . ScrollBarDirection . SB_HORZ , true ) ;
674+ else if ( pictureBox . Height > picturePanel . Height ) NativeMan . ShowScrollBar ( picturePanel . Handle , NativeMan . ScrollBarDirection . SB_VERT , true ) ;
675+ else NativeMan . ShowScrollBar ( picturePanel . Handle , NativeMan . ScrollBarDirection . SB_BOTH , false ) ;
676+ }
671677 }
672678
673679 private void setZoomText ( string text )
@@ -1206,7 +1212,6 @@ protected override void OnDragDrop(DragEventArgs drgevent)
12061212 CheckRecursiveFolder ( files [ 0 ] ) ;
12071213 openFile ( files [ 0 ] ) ;
12081214 }
1209-
12101215 }
12111216 base . OnDragDrop ( drgevent ) ;
12121217 }
@@ -1231,17 +1236,20 @@ private void onTopButton_Click(object sender, EventArgs e)
12311236 setAlwaysOnTop ( ! alwaysOnTop , true ) ;
12321237 }
12331238
1234- public int NextFile ( )
1239+ public int NextFile ( bool skipNextFile = false )
12351240 {
12361241 string [ ] filePaths = GetCurrentFiles ( ) ;
12371242
12381243 int currentIndex = - 1 ;
1239- for ( int i = 0 ; i < filePaths . Length ; i ++ )
1244+ if ( currentFile != null )
12401245 {
1241- if ( filePaths [ i ] . ToLower ( ) == Path . Combine ( currentFolder , currentFile ) . ToLower ( ) )
1246+ for ( int i = 0 ; i < filePaths . Length ; i ++ )
12421247 {
1243- currentIndex = i ;
1244- break ;
1248+ if ( filePaths [ i ] . ToLower ( ) == Path . Combine ( currentFolder , currentFile ) . ToLower ( ) )
1249+ {
1250+ currentIndex = i ;
1251+ break ;
1252+ }
12451253 }
12461254 }
12471255
@@ -1253,6 +1261,7 @@ public int NextFile()
12531261 }
12541262 else
12551263 {
1264+ if ( skipNextFile ) currentIndex ++ ;
12561265 openFile ( currentIndex == filePaths . Length - 1 ? filePaths [ 0 ] : filePaths [ currentIndex + 1 ] ) ;
12571266 return filePaths . Length ;
12581267 }
@@ -1313,30 +1322,21 @@ private void openFirstFileInFolder(string folderPath)
13131322
13141323 private void deleteButton_Click ( object sender , EventArgs e )
13151324 {
1316- DialogResult d = DialogMan . ShowConfirm (
1317- this ,
1318- LangMan . Get ( "sure-move-to-trash" ) ,
1319- yesBtnImage : deleteBtn . Image ,
1320- windowTitle : LangMan . Get ( "delete-file" ) ,
1321- darkMode : darkMode
1322- ) ;
1323- if ( d == DialogResult . Yes )
1325+ string path = Path . Combine ( currentFolder , currentFile ) ;
1326+ if ( File . Exists ( path ) )
13241327 {
1325- string path = Path . Combine ( currentFolder , currentFile ) ;
1326- if ( File . Exists ( path ) )
1327- {
1328- originalImage . Dispose ( ) ;
1329- originalImage = null ;
1330- pictureBox . Image . Dispose ( ) ;
1331- pictureBox . Image = null ;
1328+ originalImage . Dispose ( ) ;
1329+ originalImage = null ;
1330+ pictureBox . Image . Dispose ( ) ;
1331+ pictureBox . Image = null ;
13321332
1333- if ( NextFile ( ) <= 1 ) closeFile ( ) ;
1334- FileMan . MoveFileOrFolderToRecycleBin ( path ) ;
1335- }
1336- else
1337- {
1338- showSuggestion ( LangMan . Get ( "cur-file-not-found" ) , SuggestionIcon . Warning ) ;
1339- }
1333+ if ( NextFile ( ) <= 1 ) closeFile ( ) ;
1334+ FileMan . MoveFileOrFolderToRecycleBin ( path ) ;
1335+ showSuggestion ( LangMan . Get ( "file-moved-to-trash" ) + ": " + Path . GetFileName ( path ) , SuggestionIcon . Trash ) ;
1336+ }
1337+ else
1338+ {
1339+ showSuggestion ( LangMan . Get ( "cur-file-not-found" ) , SuggestionIcon . Warning ) ;
13401340 }
13411341 }
13421342
@@ -1355,6 +1355,7 @@ private void closeFile()
13551355
13561356 saveAsButton . Enabled = false ;
13571357 deleteBtn . Enabled = false ;
1358+ permDeleteBtn . Enabled = false ;
13581359 prevButton . Enabled = false ;
13591360 nextButton . Enabled = false ;
13601361 slideshowButton . Enabled = false ;
@@ -1445,6 +1446,7 @@ private void SetDarkMode(bool dark)
14451446 saveAsButton . Image = Properties . Resources . white_saveas ;
14461447 printButton . Image = Properties . Resources . white_print ;
14471448 deleteBtn . Image = Properties . Resources . white_trash ;
1449+ permDeleteBtn . Image = Properties . Resources . white_permdel ;
14481450
14491451 externalBtn . Image = Properties . Resources . white_popup ;
14501452 externalRunBtn . Image = Properties . Resources . white_exe ;
@@ -1608,7 +1610,7 @@ private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
16081610 yesBtnImage : saveAsButton . Image ,
16091611 showNoBtn : true ,
16101612 noBtnText : LangMan . Get ( "dont-save" ) ,
1611- noBtnImage : deleteBtn . Image ,
1613+ noBtnImage : permDeleteBtn . Image ,
16121614 darkMode : darkMode
16131615 ) ;
16141616 if ( window == DialogResult . Yes ) saveAsButton . PerformClick ( ) ;
@@ -1652,7 +1654,9 @@ public enum SuggestionIcon
16521654 Check = 1 ,
16531655 Warning = 2 ,
16541656 Slideshow = 3 ,
1655- Fullscreen = 4
1657+ Fullscreen = 4 ,
1658+ Next = 5 ,
1659+ Trash = 6
16561660 }
16571661
16581662 public void showSuggestion ( string text , SuggestionIcon icon )
@@ -1661,12 +1665,30 @@ public void showSuggestion(string text, SuggestionIcon icon)
16611665 {
16621666 suggestionLabel . Text = text ;
16631667 suggestionLabel . Visible = true ;
1664- if ( icon == SuggestionIcon . Info ) suggestionIcon . Image = Properties . Resources . white_info ;
1665- else if ( icon == SuggestionIcon . Check ) suggestionIcon . Image = Properties . Resources . white_check ;
1666- else if ( icon == SuggestionIcon . Warning ) suggestionIcon . Image = Properties . Resources . white_warning ;
1667- else if ( icon == SuggestionIcon . Slideshow ) suggestionIcon . Image = Properties . Resources . white_slideshow ;
1668- else suggestionIcon . Image = Properties . Resources . white_fullscreen ;
1669-
1668+ switch ( icon )
1669+ {
1670+ case SuggestionIcon . Check :
1671+ suggestionIcon . Image = Properties . Resources . white_check ;
1672+ break ;
1673+ case SuggestionIcon . Warning :
1674+ suggestionIcon . Image = Properties . Resources . white_warning ;
1675+ break ;
1676+ case SuggestionIcon . Slideshow :
1677+ suggestionIcon . Image = Properties . Resources . white_slideshow ;
1678+ break ;
1679+ case SuggestionIcon . Fullscreen :
1680+ suggestionIcon . Image = Properties . Resources . white_fullscreen ;
1681+ break ;
1682+ case SuggestionIcon . Next :
1683+ suggestionIcon . Image = Properties . Resources . white_next ;
1684+ break ;
1685+ case SuggestionIcon . Trash :
1686+ suggestionIcon . Image = Properties . Resources . white_trash ;
1687+ break ;
1688+ default :
1689+ suggestionIcon . Image = Properties . Resources . white_info ;
1690+ break ;
1691+ }
16701692 suggestionIcon . Height = suggestionLabel . Height ;
16711693 suggestionIcon . Visible = true ;
16721694 } ) ) ;
@@ -2348,5 +2370,34 @@ private void directoryLabel_Click(object sender, EventArgs e)
23482370 showSuggestion ( LangMan . Get ( "cur-file-not-found" ) , SuggestionIcon . Warning ) ;
23492371 }
23502372 }
2373+
2374+ private void permDeleteBtn_Click ( object sender , EventArgs e )
2375+ {
2376+ DialogResult d = DialogMan . ShowConfirm (
2377+ this ,
2378+ LangMan . Get ( "sure-perm-delete" ) ,
2379+ yesBtnImage : permDeleteBtn . Image ,
2380+ windowTitle : LangMan . Get ( "delete-file" ) ,
2381+ darkMode : darkMode
2382+ ) ;
2383+ if ( d == DialogResult . Yes )
2384+ {
2385+ string path = Path . Combine ( currentFolder , currentFile ) ;
2386+ if ( File . Exists ( path ) )
2387+ {
2388+ originalImage . Dispose ( ) ;
2389+ originalImage = null ;
2390+ pictureBox . Image . Dispose ( ) ;
2391+ pictureBox . Image = null ;
2392+
2393+ if ( NextFile ( ) <= 1 ) closeFile ( ) ;
2394+ File . Delete ( path ) ;
2395+ }
2396+ else
2397+ {
2398+ showSuggestion ( LangMan . Get ( "cur-file-not-found" ) , SuggestionIcon . Warning ) ;
2399+ }
2400+ }
2401+ }
23512402 }
23522403}
0 commit comments