RVT: Remove TPanel for viewer plugin in internal viewer added in last commit. Without being the form, some plugins think we're in quick vie mode and hide some controls.

This commit is contained in:
Denis Bisson 2018-11-06 10:58:57 +00:00
commit c8cc4beeb1
2 changed files with 30 additions and 30 deletions

View file

@ -1881,16 +1881,6 @@ object frmViewer: TfrmViewer
end
end
end
object pnlPlugin: TPanel
Left = 179
Height = 435
Top = 0
Width = 472
Align = alClient
BevelOuter = bvNone
TabOrder = 6
Visible = False
end
object Splitter: TSplitter
Left = 170
Height = 435

View file

@ -164,7 +164,6 @@ type
pmiCopy: TMenuItem;
pnlImage: TPanel;
pnlText: TPanel;
pnlPlugin: TPanel;
miDiv3: TMenuItem;
miEncoding: TMenuItem;
miPlugins: TMenuItem;
@ -317,6 +316,7 @@ type
FWlxModule: TWlxModule;
ActivePlugin: Integer;
//---------------------
function GetListerRect: TRect;
function CheckPlugins(const sFileName: String; bForce: Boolean = False): Boolean;
function CheckGraphics(const sFileName:String):Boolean;
function LoadGraphics(const sFileName:String): Boolean;
@ -597,7 +597,7 @@ begin
aName:= aFileName;
end;
if CheckPlugins(aName) then
ActivatePanel(pnlPlugin)
ActivatePanel(nil)
else if FPS_ISDIR(dwFileAttributes) then
begin
ActivatePanel(pnlFolder);
@ -628,7 +628,7 @@ begin
begin
if FileParamVSDetectStr(aFileName, False) then
begin
if CallListLoadNext(pnlPlugin.Handle, aFileName, PluginShowFlags) <> LISTPLUGIN_ERROR then
if CallListLoadNext(Self.Handle, aFileName, PluginShowFlags) <> LISTPLUGIN_ERROR then
Exit;
end;
end;
@ -658,7 +658,7 @@ end;
procedure TfrmViewer.FormResize(Sender: TObject);
begin
if bPlugin then FWlxModule.ResizeWindow(pnlPlugin.ClientRect);
if bPlugin then FWlxModule.ResizeWindow(GetListerRect);
end;
procedure TfrmViewer.FormShow(Sender: TObject);
@ -1175,14 +1175,14 @@ begin
if not WlxPlugins.LoadModule(I) then Continue;
WlxModule:= WlxPlugins.GetWlxModule(I);
DCDebug('WlxModule.Name = ', WlxModule.Name);
if WlxModule.CallListLoad(pnlPlugin.Handle, sFileName, ShowFlags) = 0 then
if WlxModule.CallListLoad(Self.Handle, sFileName, ShowFlags) = 0 then
begin
WlxModule.UnloadModule;
Continue;
end;
ActivePlugin:= I;
FWlxModule:= WlxModule;
WlxModule.ResizeWindow(pnlPlugin.ClientRect);
WlxModule.ResizeWindow(GetListerRect);
miPrint.Enabled:= WlxModule.CanPrint;
// Set focus to plugin window
if not bQuickView then WlxModule.SetFocus;
@ -1484,7 +1484,7 @@ begin
DrawPreview.RowCount:= FileList.Count div DrawPreview.ColCount + 1
else
DrawPreview.RowCount:= FileList.Count div DrawPreview.ColCount;
if bPlugin then FWlxModule.ResizeWindow(pnlPlugin.ClientRect);
if bPlugin then FWlxModule.ResizeWindow(GetListerRect);
end;
procedure TfrmViewer.TimerScreenshotTimer(Sender: TObject);
@ -2002,6 +2002,16 @@ begin
Status.Panels[sbpFullResolution].Text:= Format(fmtImageInfo, [Image.Picture.Width,Image.Picture.Height, 100.0]);
end;
function TfrmViewer.GetListerRect: TRect;
begin
Result:= ClientRect;
Dec(Result.Bottom, Status.Height);
if Splitter.Visible then
begin
Inc(Result.Left, Splitter.Left + Splitter.Width);
end;
end;
function TfrmViewer.LoadGraphics(const sFileName:String): Boolean;
var
sExt: String;
@ -2281,13 +2291,13 @@ end;
procedure TfrmViewer.ActivatePanel(Panel: TPanel);
begin
if pnlFolder <> Panel then pnlFolder.Hide;
if pnlImage <> Panel then pnlImage.Hide;
if pnlText <> Panel then pnlText.Hide;
if pnlPlugin <> Panel then pnlPlugin.Hide;
if Assigned(Panel) AND (not Panel.Visible) then Panel.Visible := True;
pnlFolder.Hide;
pnlImage.Hide;
pnlText.Hide;
if Panel = pnlPlugin then
if Assigned(Panel) then Panel.Visible := True;
if Panel = nil then
begin
Status.Panels[sbpPluginName].Text:= FWlxModule.Name;
end
@ -2317,11 +2327,11 @@ begin
bAnimation := (Panel = pnlImage) and (GifAnim.Visible);
bImage := (Panel = pnlImage) and (bAnimation = False);
bPlugin := (Panel = pnlPlugin);
miPlugins.Checked := (Panel = pnlPlugin);
bPlugin := (Panel = nil);
miPlugins.Checked := (Panel = nil);
miGraphics.Checked := (Panel = pnlImage);
miEncoding.Visible := (Panel = pnlText);
miEdit.Visible := (Panel = pnlText) or (Panel = pnlPlugin);
miEdit.Visible := (Panel = pnlText) or (Panel = nil);
miImage.Visible := (bImage or bPlugin);
miRotate.Visible := bImage;
miZoomIn.Visible := bImage;
@ -2356,7 +2366,7 @@ begin
if bPlugin then
begin
if (FWlxModule.CallListLoadNext(pnlPlugin.Handle, FileList[I], PluginShowFlags) <> LISTPLUGIN_ERROR) then
if (FWlxModule.CallListLoadNext(Self.Handle, FileList[I], PluginShowFlags) <> LISTPLUGIN_ERROR) then
Exit;
end;
ExitPluginMode;
@ -2383,7 +2393,7 @@ begin
if bPlugin then
begin
if (FWlxModule.CallListLoadNext(pnlPlugin.Handle, FileList[I], PluginShowFlags) <> LISTPLUGIN_ERROR) then
if (FWlxModule.CallListLoadNext(Self.Handle, FileList[I], PluginShowFlags) <> LISTPLUGIN_ERROR) then
Exit;
end;
ExitPluginMode;
@ -2722,7 +2732,7 @@ begin
FThread.Terminate;
FThread.WaitFor;
end;
if bPlugin then FWlxModule.ResizeWindow(pnlPlugin.ClientRect);
if bPlugin then FWlxModule.ResizeWindow(GetListerRect);
end;
procedure TfrmViewer.cm_ShowAsText(const Params: array of string);
@ -2781,7 +2791,7 @@ begin
if bPlugin then
begin
ViewerControl.FileName := ''; // unload current file if any is loaded
ActivatePanel(pnlPlugin);
ActivatePanel(nil);
end;
end;