mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Virtual drive button
This commit is contained in:
parent
5da7eb3377
commit
856bccfab4
6 changed files with 73 additions and 3 deletions
BIN
pixmaps/dctheme/16x16/places/folder-virtual.png
Normal file
BIN
pixmaps/dctheme/16x16/places/folder-virtual.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 760 B |
BIN
pixmaps/dctheme/22x22/places/folder-virtual.png
Normal file
BIN
pixmaps/dctheme/22x22/places/folder-virtual.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
BIN
pixmaps/dctheme/32x32/places/folder-virtual.png
Normal file
BIN
pixmaps/dctheme/32x32/places/folder-virtual.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
|
|
@ -414,6 +414,7 @@ type
|
|||
PanelSelect: TFilePanelSelect);
|
||||
procedure DeleteClick(Sender: TObject);
|
||||
procedure dskToolButtonClick(Sender: TObject; NumberOfButton: Integer);
|
||||
procedure btnVirtualDriveClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
|
|
@ -522,6 +523,7 @@ type
|
|||
Draging : boolean;
|
||||
|
||||
function ExecuteCommandFromEdit(sCmd: String; bRunInTerm: Boolean): Boolean;
|
||||
procedure AddVirtualDriveButton(dskPanel: TKASToolBar);
|
||||
procedure AddSpecialButtons(dskPanel: TKASToolBar);
|
||||
procedure HideToTray;
|
||||
procedure RestoreFromTray;
|
||||
|
|
@ -1554,6 +1556,11 @@ begin
|
|||
SetActiveFrame(PanelSelected);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.btnVirtualDriveClick(Sender: TObject);
|
||||
begin
|
||||
Actions.cm_OpenVirtualFileSystemList(((Sender as TSpeedButton).Parent as TKASToolBar).Name);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.MainToolBarMouseUp(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
var
|
||||
|
|
@ -3129,6 +3136,24 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmMain.AddVirtualDriveButton(dskPanel: TKASToolBar);
|
||||
const
|
||||
btnCaption = ':' + PathDelim + PathDelim;
|
||||
var
|
||||
btnIndex : Integer;
|
||||
bmpBitmap: TBitmap = nil;
|
||||
begin
|
||||
(*virtual drive button*)
|
||||
bmpBitmap:= PixMapManager.GetVirtualDriveIcon(dskPanel.GlyphSize, clBtnFace);
|
||||
btnIndex := dskPanel.AddButtonX(btnCaption, '', '', '', '', '', bmpBitmap);
|
||||
dskPanel.Buttons[btnIndex].Caption:= btnCaption;
|
||||
dskPanel.Buttons[btnIndex].Hint:= actOpenVirtualFileSystemList.Caption;
|
||||
dskPanel.Buttons[btnIndex].GroupIndex := 0;
|
||||
dskPanel.Buttons[btnIndex].Layout := blGlyphLeft;
|
||||
dskPanel.Buttons[btnIndex].OnClick:= @btnVirtualDriveClick;
|
||||
FreeAndNil(bmpBitmap);
|
||||
end;
|
||||
|
||||
procedure TfrmMain.AddSpecialButtons(dskPanel: TKASToolBar);
|
||||
var
|
||||
btnIndex : Integer;
|
||||
|
|
@ -3172,7 +3197,11 @@ begin
|
|||
dskPanel.Buttons[I].Layout := blGlyphLeft;
|
||||
end; // for
|
||||
|
||||
if not gDriveMenuButton then {Add special buttons}
|
||||
// Add virtual drive button
|
||||
AddVirtualDriveButton(dskPanel);
|
||||
|
||||
// Add special buttons
|
||||
if not gDriveMenuButton then
|
||||
AddSpecialButtons(dskPanel);
|
||||
end;
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,8 @@ type
|
|||
bmDriveHardDisk,
|
||||
bmMediaFlash,
|
||||
bmMediaOptical,
|
||||
bmDriveNetwork: TBitmap;
|
||||
bmDriveNetwork,
|
||||
bmDriveVirtual: TBitmap;
|
||||
end;
|
||||
|
||||
{ TPixMapManager }
|
||||
|
|
@ -268,6 +269,7 @@ type
|
|||
function GetIconByName(const AIconName: UTF8String): PtrInt;
|
||||
function GetDriveIcon(Drive : PDrive; IconSize : Integer; clBackColor : TColor) : Graphics.TBitmap;
|
||||
function GetDefaultDriveIcon(IconSize : Integer; clBackColor : TColor) : Graphics.TBitmap;
|
||||
function GetVirtualDriveIcon(IconSize : Integer; clBackColor : TColor) : Graphics.TBitmap;
|
||||
function GetArchiveIcon(IconSize: Integer; clBackColor : TColor) : Graphics.TBitmap;
|
||||
{en
|
||||
Returns default icon for a file.
|
||||
|
|
@ -1082,6 +1084,7 @@ begin
|
|||
if Assigned(bmMediaFlash) then FreeAndNil(bmMediaFlash);
|
||||
if Assigned(bmMediaOptical) then FreeAndNil(bmMediaOptical);
|
||||
if Assigned(bmDriveNetwork) then FreeAndNil(bmDriveNetwork);
|
||||
if Assigned(bmDriveVirtual) then FreeAndNil(bmDriveVirtual);
|
||||
end;
|
||||
|
||||
{$IF DEFINED(MSWINDOWS)}
|
||||
|
|
@ -1145,6 +1148,7 @@ begin
|
|||
bmMediaFlash := LoadIconThemeBitmapLocked('media-flash', iPixmapSize);
|
||||
bmMediaOptical := LoadIconThemeBitmapLocked('media-optical', iPixmapSize);
|
||||
bmDriveNetwork:= LoadIconThemeBitmapLocked('network-wired', iPixmapSize);
|
||||
bmDriveVirtual:= LoadIconThemeBitmapLocked('folder-virtual', iPixmapSize);
|
||||
end;
|
||||
|
||||
// load emblems
|
||||
|
|
@ -1766,6 +1770,36 @@ begin
|
|||
Result := GetBuiltInDriveIcon(@Drive, IconSize, clBackColor);
|
||||
end;
|
||||
|
||||
function TPixMapManager.GetVirtualDriveIcon(IconSize: Integer;
|
||||
clBackColor: TColor): Graphics.TBitmap;
|
||||
var
|
||||
DriveIconListIndex: Integer;
|
||||
begin
|
||||
case IconSize of
|
||||
16: // Standart 16x16 icon size
|
||||
DriveIconListIndex := 0;
|
||||
22: // Standart 22x22 icon size
|
||||
DriveIconListIndex := 1;
|
||||
32: // Standart 32x32 icon size
|
||||
DriveIconListIndex := 2;
|
||||
else // for non standart icon size use more large icon for stretch
|
||||
DriveIconListIndex := 2;
|
||||
end;
|
||||
with FDriveIconList[DriveIconListIndex] do
|
||||
begin
|
||||
// if need stretch icon
|
||||
if (IconSize <> 16) and (IconSize <> 22) and (IconSize <> 32) then
|
||||
begin
|
||||
Result := StretchBitmap(bmDriveVirtual, IconSize, clBackColor, False);
|
||||
end
|
||||
else
|
||||
begin
|
||||
Result := Graphics.TBitmap.Create;
|
||||
Result.Assign(bmDriveVirtual);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TPixMapManager.GetArchiveIcon(IconSize: Integer; clBackColor : TColor) : Graphics.TBitmap;
|
||||
begin
|
||||
Result := GetBitmap(FiArcIconID);
|
||||
|
|
|
|||
|
|
@ -1016,7 +1016,14 @@ begin
|
|||
if gWFXPlugins.Count = 0 then Exit;
|
||||
FileSource:= TVfsFileSource.Create(gWFXPlugins);
|
||||
if Assigned(FileSource) then
|
||||
ActiveFrame.AddFileSource(FileSource, FileSource.GetRootDir);
|
||||
begin
|
||||
if dskLeft.Name = param then
|
||||
FrameLeft.AddFileSource(FileSource, FileSource.GetRootDir)
|
||||
else if dskRight.Name = param then
|
||||
FrameRight.AddFileSource(FileSource, FileSource.GetRootDir)
|
||||
else
|
||||
ActiveFrame.AddFileSource(FileSource, FileSource.GetRootDir)
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue