소스 검색

ADD: Viewer plugins - itm_fit and itm_fontstyle support

Alexander Koblov 3 년 전
부모
커밋
9c73674c83
1개의 변경된 파일37개의 추가작업 그리고 1개의 파일을 삭제
  1. 37 1
      src/fviewer.pas

+ 37 - 1
src/fviewer.pas

@@ -1151,6 +1151,8 @@ begin
 end;
 end;
 
 
 procedure TfrmViewer.WMCommand(var Message: TLMCommand);
 procedure TfrmViewer.WMCommand(var Message: TLMCommand);
+var
+  Index: Integer;
 begin
 begin
   case Message.NotifyCode of
   case Message.NotifyCode of
     itm_center:
     itm_center:
@@ -1162,6 +1164,41 @@ begin
       gViewerWrapText:= Boolean(Message.ItemID);
       gViewerWrapText:= Boolean(Message.ItemID);
       actWrapText.Checked:= gViewerWrapText;
       actWrapText.Checked:= gViewerWrapText;
     end;
     end;
+    itm_fit: begin
+      case Message.ItemID of
+        0:
+        begin
+          miStretch.Checked:= False;
+          miStretchOnlyLarge.Checked:= False;
+        end;
+        2, 3:
+        begin
+          miStretch.Checked:= (Message.ItemID = 2);
+          miStretchOnlyLarge.Checked:= (Message.ItemID = 3);
+        end;
+      end;
+    end;
+    itm_fontstyle: begin
+      case Message.ItemID of
+        lcp_ansi:
+        begin
+          FPluginEncoding:= lcp_ansi;
+          Index:= miEncoding.IndexOfCaption(ViewerEncodingsNames[veAnsi]);
+        end;
+        lcp_ascii:
+        begin
+          FPluginEncoding:= lcp_ascii;
+          Index:= miEncoding.IndexOfCaption(ViewerEncodingsNames[veOem]);
+        end;
+        else begin
+          Index:= 0;
+          FPluginEncoding:= 0;
+        end;
+        miEncoding.Items[Index].Checked:= True;
+        ViewerControl.Encoding:= TViewerEncoding(Index);
+        Status.Panels[sbpTextEncoding].Text := rsViewEncoding + ': ' + ViewerControl.EncodingName;
+      end;
+    end;
   end;
   end;
 end;
 end;
 
 
@@ -2674,7 +2711,6 @@ begin
   if Panel = nil then
   if Panel = nil then
   begin
   begin
     Status.Panels[sbpFileSize].Text:= EmptyStr;
     Status.Panels[sbpFileSize].Text:= EmptyStr;
-    Status.Panels[sbpTextEncoding].Text:= EmptyStr;
     Status.Panels[sbpPluginName].Text:= FWlxModule.Name;
     Status.Panels[sbpPluginName].Text:= FWlxModule.Name;
 
 
     UpdateTextEncodingsMenu(True);
     UpdateTextEncodingsMenu(True);