View Issue Details

IDProjectCategoryView StatusLast Update
0000266Double CommanderViewerpublic2015-09-17 18:13
Reportervo.x Assigned ToAlexx2000  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
ProjectionnoneETAnone 
Fixed in Version0.5.5 
Summary0000266: [patch] Reload file using keyboard shortcut
DescriptionWould be wonderful to reload file in viewer using keyboard shortcut. The attached patch fixes this. Please note that I did not bump the hkVersion constant. I am not sure what is the policy regarding it.
TagsNo tags attached.
Attached Files
reload-file-using-shortcut.patch (6,534 bytes)   
Index: src/fviewer.lfm
===================================================================
--- src/fviewer.lfm	(revision 4104)
+++ src/fviewer.lfm	(working copy)
@@ -911,9 +911,9 @@
       object btnReload: TSpeedButton
         Left = 1
         Height = 46
-        Hint = 'Reload'
         Top = 1
         Width = 48
+        Action = actReload
         Align = alLeft
         BorderSpacing.Bottom = 2
         Glyph.Data = {
@@ -982,7 +982,7 @@
           FF00FFFFFF00FFFFFF00
         }
         NumGlyphs = 0
-        OnClick = btnReloadClick
+        ShowCaption = False
       end
       object btnPaint: TSpeedButton
         Left = 462
@@ -1599,9 +1599,9 @@
         AnchorSideBottom.Control = btnPrev1
         Left = 1
         Height = 28
-        Hint = 'Reload'
         Top = 1
         Width = 32
+        Action = actReload
         Align = alLeft
         Glyph.Data = {
           C6070000424DC607000000000000360000002800000016000000160000000100
@@ -1669,7 +1669,7 @@
           FF00FFFFFF00FFFFFF00
         }
         NumGlyphs = 0
-        OnClick = btnReloadClick
+        ShowCaption = False
       end
       object btnPrev1: TSpeedButton
         Left = 33
@@ -2112,6 +2112,9 @@
         ShortCut = 16464
         OnClick = miPrintClick
       end
+      object miReload: TMenuItem
+        Action = actReload
+      end
       object miSeparator: TMenuItem
         Caption = '-'
       end
@@ -2272,7 +2275,6 @@
       Caption = 'About'
       object miAbout2: TMenuItem
         Action = actAbout
-        OnClick = miAbout2Click
       end
     end
   end
@@ -2306,9 +2308,16 @@
     left = 365
     top = 66
     object actAbout: TAction
+      Category = 'Help'
       Caption = 'About Viewer...'
       Hint = 'Displays the About message'
       OnExecute = miAbout2Click
     end
+    object actReload: TAction
+      Category = 'File'
+      Caption = 'Reload'
+      Hint = 'Reload current file'
+      OnExecute = actExecute
+    end
   end
 end
Index: src/fviewer.lrt
===================================================================
--- src/fviewer.lrt	(revision 4104)
+++ src/fviewer.lrt	(working copy)
@@ -19,7 +19,6 @@
 TFRMVIEWER.BTNNEXTGIFFRAME.CAPTION=||>
 TFRMVIEWER.BTNPREVGIFFRAME.CAPTION=<||
 TFRMVIEWER.BTNRESIZE.HINT=Resize
-TFRMVIEWER.BTNRELOAD.HINT=Reload
 TFRMVIEWER.BTNPAINT.HINT=Paint
 TFRMVIEWER.BTNFULLSCREEN.HINT=Full Screen
 TFRMVIEWER.GBOXSLIDESHOW.CAPTION=Slide Show
@@ -29,7 +28,6 @@
 TFRMVIEWER.BTNCOPYFILE.HINT=Copy
 TFRMVIEWER.BTNMOVEFILE.HINT=Move
 TFRMVIEWER.BTNDELETEFILE.HINT=Delete
-TFRMVIEWER.BTNRELOAD1.HINT=Reload
 TFRMVIEWER.BTNPREV1.HINT=Previous
 TFRMVIEWER.BTNNEXT1.HINT=Next
 TFRMVIEWER.BTNCOPYFILE1.HINT=Copy
@@ -80,3 +78,5 @@
 TFRMVIEWER.PMISELECTALL.CAPTION=Select All
 TFRMVIEWER.ACTABOUT.CAPTION=About Viewer...
 TFRMVIEWER.ACTABOUT.HINT=Displays the About message
+TFRMVIEWER.ACTRELOAD.CAPTION=Reload
+TFRMVIEWER.ACTRELOAD.HINT=Reload current file
Index: src/fviewer.pas
===================================================================
--- src/fviewer.pas	(revision 4104)
+++ src/fviewer.pas	(working copy)
@@ -48,6 +48,7 @@
 
   TfrmViewer = class(TForm, IFormCommands)
     actAbout: TAction;
+    actReload: TAction;
     actionList: TActionList;
     btnCopyFile1: TSpeedButton;
     btnDeleteFile1: TSpeedButton;
@@ -64,6 +65,7 @@
     gboxView: TGroupBox;
     gboxSlideShow: TGroupBox;
     GifAnim: TGifAnim;
+    miReload: TMenuItem;
     miLookBook: TMenuItem;
     miDiv4: TMenuItem;
     miPreview: TMenuItem;
@@ -148,6 +150,7 @@
     miCopyToClipboard: TMenuItem;
     TimerViewer: TTimer;
     ViewerControl: TViewerControl;
+    procedure actExecute(Sender: TObject);
     procedure btnCopyMoveFileClick(Sender: TObject);
     procedure btnCutTuImageClick(Sender: TObject);
     procedure btnDeleteFileClick(Sender: TObject);
@@ -159,7 +162,6 @@
     procedure btnPrevClick(Sender: TObject);
     procedure btnPrevGifFrameClick(Sender: TObject);
     procedure btnRedEyeClick(Sender: TObject);
-    procedure btnReloadClick(Sender: TObject);
     procedure btnResizeClick(Sender: TObject);
     procedure btnUndoClick(Sender: TObject);
     procedure DrawPreviewDrawCell(Sender: TObject; aCol, aRow: Integer;
@@ -261,9 +263,7 @@
     procedure SaveImageAs (Var sExt: String; senderSave: boolean; Quality: integer);
     procedure CreatePreview(FullPathToFile:string; index:integer; delete: boolean = false);
 
-    {$IF FPC_FULLVERSION >= 020501}
-    property Commands: TFormCommands read FCommands implements IFormCommands;
-    {$ENDIF}
+    property Commands: TFormCommands read FCommands{$IF FPC_FULLVERSION >= 020501} implements IFormCommands{$ENDIF};
 
   public
     constructor Create(TheOwner: TComponent; aFileSource: IFileSource); overload;
@@ -284,6 +284,7 @@
     property QuickView: Boolean read bQuickView write bQuickView;
   published
     procedure cm_About(Param: String='');
+    procedure cm_Reload(Param: String='');
   end;
 
 procedure ShowViewer(const FilesToView:TStringList; const aFileSource: IFileSource = nil);
@@ -1026,6 +1027,11 @@
   miAbout2Click(Self);
 end;
 
+procedure TfrmViewer.cm_Reload(Param: String);
+begin
+  LoadFile(iActiveFile);
+end;
+
 procedure TfrmViewer.miPluginsClick(Sender: TObject);
 begin
   bPlugin:= CheckPlugins(FileList.Strings[iActiveFile], True);
@@ -1536,6 +1542,15 @@
      Exit;
 end;
 
+procedure TfrmViewer.actExecute(Sender: TObject);
+var
+  cmd: string;
+begin
+  cmd := (Sender as TAction).Name;
+  cmd := 'cm_' + Copy(cmd, 4, Length(cmd) - 3);
+  Commands.ExecuteCommand(cmd, '');
+end;
+
 procedure TfrmViewer.btnFullScreenClick(Sender: TObject);
 begin
   miFullScreenClick(Sender);
@@ -1629,11 +1644,6 @@
   RedEyes;
 end;
 
-procedure TfrmViewer.btnReloadClick(Sender: TObject);
-begin
-   LoadFile (iActiveFile);
-end;
-
 procedure TfrmViewer.btnResizeClick(Sender: TObject);
 begin
   if not Assigned(FModSizeDialog) then
Index: src/uglobs.pas
===================================================================
--- src/uglobs.pas	(revision 4104)
+++ src/uglobs.pas	(working copy)
@@ -440,8 +440,8 @@
   HMForm := HotMan.Forms.FindOrCreate('Viewer');
   with HMForm.Hotkeys do
     begin
-      AddIfNotExists('F1','cm_Viewer_About','');
-      AddIfNotExists('F1','cm_Viewer_DeleteFile','');
+      AddIfNotExists('F1','cm_About','');
+      AddIfNotExists('F2','cm_Reload','');
     end;
 end;
 
reload-file-using-shortcut-v2.patch (6,816 bytes)   
Index: src/fviewer.lfm
===================================================================
--- src/fviewer.lfm	(revision 4104)
+++ src/fviewer.lfm	(working copy)
@@ -911,9 +911,9 @@
       object btnReload: TSpeedButton
         Left = 1
         Height = 46
-        Hint = 'Reload'
         Top = 1
         Width = 48
+        Action = actReload
         Align = alLeft
         BorderSpacing.Bottom = 2
         Glyph.Data = {
@@ -982,7 +982,7 @@
           FF00FFFFFF00FFFFFF00
         }
         NumGlyphs = 0
-        OnClick = btnReloadClick
+        ShowCaption = False
       end
       object btnPaint: TSpeedButton
         Left = 462
@@ -1599,9 +1599,9 @@
         AnchorSideBottom.Control = btnPrev1
         Left = 1
         Height = 28
-        Hint = 'Reload'
         Top = 1
         Width = 32
+        Action = actReload
         Align = alLeft
         Glyph.Data = {
           C6070000424DC607000000000000360000002800000016000000160000000100
@@ -1669,7 +1669,7 @@
           FF00FFFFFF00FFFFFF00
         }
         NumGlyphs = 0
-        OnClick = btnReloadClick
+        ShowCaption = False
       end
       object btnPrev1: TSpeedButton
         Left = 33
@@ -2112,6 +2112,9 @@
         ShortCut = 16464
         OnClick = miPrintClick
       end
+      object miReload: TMenuItem
+        Action = actReload
+      end
       object miSeparator: TMenuItem
         Caption = '-'
       end
@@ -2272,7 +2275,6 @@
       Caption = 'About'
       object miAbout2: TMenuItem
         Action = actAbout
-        OnClick = miAbout2Click
       end
     end
   end
@@ -2306,9 +2308,16 @@
     left = 365
     top = 66
     object actAbout: TAction
+      Category = 'Help'
       Caption = 'About Viewer...'
       Hint = 'Displays the About message'
       OnExecute = miAbout2Click
     end
+    object actReload: TAction
+      Category = 'File'
+      Caption = 'Reload'
+      Hint = 'Reload current file'
+      OnExecute = actExecute
+    end
   end
 end
Index: src/fviewer.lrt
===================================================================
--- src/fviewer.lrt	(revision 4104)
+++ src/fviewer.lrt	(working copy)
@@ -19,7 +19,6 @@
 TFRMVIEWER.BTNNEXTGIFFRAME.CAPTION=||>
 TFRMVIEWER.BTNPREVGIFFRAME.CAPTION=<||
 TFRMVIEWER.BTNRESIZE.HINT=Resize
-TFRMVIEWER.BTNRELOAD.HINT=Reload
 TFRMVIEWER.BTNPAINT.HINT=Paint
 TFRMVIEWER.BTNFULLSCREEN.HINT=Full Screen
 TFRMVIEWER.GBOXSLIDESHOW.CAPTION=Slide Show
@@ -29,7 +28,6 @@
 TFRMVIEWER.BTNCOPYFILE.HINT=Copy
 TFRMVIEWER.BTNMOVEFILE.HINT=Move
 TFRMVIEWER.BTNDELETEFILE.HINT=Delete
-TFRMVIEWER.BTNRELOAD1.HINT=Reload
 TFRMVIEWER.BTNPREV1.HINT=Previous
 TFRMVIEWER.BTNNEXT1.HINT=Next
 TFRMVIEWER.BTNCOPYFILE1.HINT=Copy
@@ -80,3 +78,5 @@
 TFRMVIEWER.PMISELECTALL.CAPTION=Select All
 TFRMVIEWER.ACTABOUT.CAPTION=About Viewer...
 TFRMVIEWER.ACTABOUT.HINT=Displays the About message
+TFRMVIEWER.ACTRELOAD.CAPTION=Reload
+TFRMVIEWER.ACTRELOAD.HINT=Reload current file
Index: src/fviewer.pas
===================================================================
--- src/fviewer.pas	(revision 4104)
+++ src/fviewer.pas	(working copy)
@@ -48,6 +48,7 @@
 
   TfrmViewer = class(TForm, IFormCommands)
     actAbout: TAction;
+    actReload: TAction;
     actionList: TActionList;
     btnCopyFile1: TSpeedButton;
     btnDeleteFile1: TSpeedButton;
@@ -64,6 +65,7 @@
     gboxView: TGroupBox;
     gboxSlideShow: TGroupBox;
     GifAnim: TGifAnim;
+    miReload: TMenuItem;
     miLookBook: TMenuItem;
     miDiv4: TMenuItem;
     miPreview: TMenuItem;
@@ -148,6 +150,7 @@
     miCopyToClipboard: TMenuItem;
     TimerViewer: TTimer;
     ViewerControl: TViewerControl;
+    procedure actExecute(Sender: TObject);
     procedure btnCopyMoveFileClick(Sender: TObject);
     procedure btnCutTuImageClick(Sender: TObject);
     procedure btnDeleteFileClick(Sender: TObject);
@@ -159,7 +162,6 @@
     procedure btnPrevClick(Sender: TObject);
     procedure btnPrevGifFrameClick(Sender: TObject);
     procedure btnRedEyeClick(Sender: TObject);
-    procedure btnReloadClick(Sender: TObject);
     procedure btnResizeClick(Sender: TObject);
     procedure btnUndoClick(Sender: TObject);
     procedure DrawPreviewDrawCell(Sender: TObject; aCol, aRow: Integer;
@@ -261,9 +263,7 @@
     procedure SaveImageAs (Var sExt: String; senderSave: boolean; Quality: integer);
     procedure CreatePreview(FullPathToFile:string; index:integer; delete: boolean = false);
 
-    {$IF FPC_FULLVERSION >= 020501}
-    property Commands: TFormCommands read FCommands implements IFormCommands;
-    {$ENDIF}
+    property Commands: TFormCommands read FCommands{$IF FPC_FULLVERSION >= 020501} implements IFormCommands{$ENDIF};
 
   public
     constructor Create(TheOwner: TComponent; aFileSource: IFileSource); overload;
@@ -284,6 +284,7 @@
     property QuickView: Boolean read bQuickView write bQuickView;
   published
     procedure cm_About(Param: String='');
+    procedure cm_Reload(Param: String='');
   end;
 
 procedure ShowViewer(const FilesToView:TStringList; const aFileSource: IFileSource = nil);
@@ -1026,6 +1027,11 @@
   miAbout2Click(Self);
 end;
 
+procedure TfrmViewer.cm_Reload(Param: String);
+begin
+  LoadFile(iActiveFile);
+end;
+
 procedure TfrmViewer.miPluginsClick(Sender: TObject);
 begin
   bPlugin:= CheckPlugins(FileList.Strings[iActiveFile], True);
@@ -1536,6 +1542,15 @@
      Exit;
 end;
 
+procedure TfrmViewer.actExecute(Sender: TObject);
+var
+  cmd: string;
+begin
+  cmd := (Sender as TAction).Name;
+  cmd := 'cm_' + Copy(cmd, 4, Length(cmd) - 3);
+  Commands.ExecuteCommand(cmd, '');
+end;
+
 procedure TfrmViewer.btnFullScreenClick(Sender: TObject);
 begin
   miFullScreenClick(Sender);
@@ -1629,11 +1644,6 @@
   RedEyes;
 end;
 
-procedure TfrmViewer.btnReloadClick(Sender: TObject);
-begin
-   LoadFile (iActiveFile);
-end;
-
 procedure TfrmViewer.btnResizeClick(Sender: TObject);
 begin
   if not Assigned(FModSizeDialog) then
Index: src/uglobs.pas
===================================================================
--- src/uglobs.pas	(revision 4104)
+++ src/uglobs.pas	(working copy)
@@ -82,7 +82,7 @@

 const
   { Default hotkey list version number }
-  hkVersion     = 5;
+  hkVersion     = 6;

   // Previously existing names if reused must check for ConfigVersion >= X.
   // History:
@@ -440,8 +440,8 @@
   HMForm := HotMan.Forms.FindOrCreate('Viewer');
   with HMForm.Hotkeys do
     begin
-      AddIfNotExists('F1','cm_Viewer_About','');
-      AddIfNotExists('F1','cm_Viewer_DeleteFile','');
+      AddIfNotExists('F1','cm_About','');
+      AddIfNotExists('F2','cm_Reload','');
     end;
 end;
 
Fixed in Revision4108
Operating system
Widgetset
Architecture

Relationships

related to 0000170 closedAlexx2000 Refresh option in Viewer 

Activities

cobines

2011-11-22 10:09

administrator   ~0000175

hkVersion needs to be increased if you want to apply any changes in the default hotkeys to already existing installations. Otherwise it looks OK.

Why not Ctrl+R for hotkey?

vo.x

2011-11-22 11:19

reporter   ~0000180

Yes, I understand that the hkVersion needs to be updated. I was just unsure if you do not update the constant for example just once before release. But it probably doesn't matter that much, its just number, so I'll update the patch.

You are right, it might be. On the other hand, F2 is default in Total Commander I believe. What about both? I did not check if it is possible but I guess it is if you can set so in the hotkey option page :)

vo.x

2011-11-23 00:36

reporter   ~0000196

The new version of patch includes bumped hkVersion.

Alexx2000

2011-11-23 10:44

administrator   ~0000199

OK, I applied it. As I see we can not assign some hotkeys at one command now.

Issue History

Date Modified Username Field Change
2011-11-22 02:06 vo.x New Issue
2011-11-22 02:06 vo.x File Added: reload-file-using-shortcut.patch
2011-11-22 10:09 cobines Note Added: 0000175
2011-11-22 11:19 vo.x Note Added: 0000180
2011-11-23 00:34 vo.x File Added: reload-file-using-shortcut-v2.patch
2011-11-23 00:36 vo.x Note Added: 0000196
2011-11-23 08:18 Alexx2000 Assigned To => Alexx2000
2011-11-23 08:18 Alexx2000 Status new => assigned
2011-11-23 10:42 Alexx2000 Fixed in Revision => 4108
2011-11-23 10:42 Alexx2000 Status assigned => resolved
2011-11-23 10:42 Alexx2000 Fixed in Version => 0.5.5
2011-11-23 10:42 Alexx2000 Resolution open => fixed
2011-11-23 10:44 Alexx2000 Note Added: 0000199
2012-04-15 20:23 Alexx2000 Status resolved => closed
2015-09-17 18:13 Alexx2000 Relationship added related to 0000170