Added: precompiled packages included in version control
Added: Read-Only toggle (applies to all related files; .pas, .dfm, .ddp) Added: Read-Only overlay indicator Fixed: right-click in the list now selects the item under the cursor (preserving a multi-select when right-clicking an already selected item) Fixed: Ctrl-Up/Down (for the MRU list) did not filter the list immediately Fixed: Issue #174 Fixed: Issue #178
This commit is contained in:
parent
946100936f
commit
4a3019e6dd
BIN
Lib/D2006/UnitSwitcherD2006.bpl
Normal file
BIN
Lib/D2006/UnitSwitcherD2006.bpl
Normal file
Binary file not shown.
BIN
Lib/D7/UnitSwitcherD7.bpl
Normal file
BIN
Lib/D7/UnitSwitcherD7.bpl
Normal file
Binary file not shown.
BIN
Resources/ReadOnly.ico
Normal file
BIN
Resources/ReadOnly.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 318 B |
@ -90,6 +90,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
OnData = lstUnitsData
|
OnData = lstUnitsData
|
||||||
OnDblClick = lstUnitsDblClick
|
OnDblClick = lstUnitsDblClick
|
||||||
OnDrawItem = lstUnitsDrawItem
|
OnDrawItem = lstUnitsDrawItem
|
||||||
|
OnMouseDown = lstUnitsMouseDown
|
||||||
end
|
end
|
||||||
object pnlSubFilters: TPanel
|
object pnlSubFilters: TPanel
|
||||||
Left = 4
|
Left = 4
|
||||||
@ -206,7 +207,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
Left = 16
|
Left = 16
|
||||||
Top = 264
|
Top = 264
|
||||||
Bitmap = {
|
Bitmap = {
|
||||||
494C010105000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
|
494C010106000900040010001000FFFFFFFFFF00FFFFFFFFFFFFFFFF424D3600
|
||||||
0000000000003600000028000000400000003000000001002000000000000030
|
0000000000003600000028000000400000003000000001002000000000000030
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -340,7 +341,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000C0C0C000C0C0C000C0C0C000C0C0C0000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -348,7 +349,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
8000808080008080800080808000808080008080800080808000808080008080
|
8000808080008080800080808000808080008080800080808000808080008080
|
||||||
8000808080000000000000000000000000000000000000000000000000000000
|
8000808080000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000FFFFFF000000800000008000C0C0C0000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -356,7 +357,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
|
C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0C000FFFFFF00C0C0
|
||||||
C000808080000000000000000000000000000000000000000000000000000000
|
C000808080000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -364,7 +365,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
FF00C0C0C000FFFFFF00C0C0C000000000000000000000000000000000000000
|
FF00C0C0C000FFFFFF00C0C0C000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000FFFFFF00FFFFFF00FFFFFF00C0C0C0000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -372,7 +373,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
C000FFFFFF00C0C0C000FFFFFF0000000000FFFFFF0080808000808080008080
|
C000FFFFFF00C0C0C000FFFFFF0000000000FFFFFF0080808000808080008080
|
||||||
8000808080008080800080808000000000000000000000000000000000000000
|
8000808080008080800080808000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000FFFFFF000000800000008000C0C0C0000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -380,7 +381,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
FF00C0C0C000FFFFFF00C0C0C00000000000FFFFFF00FFFFFF00C0C0C000FFFF
|
FF00C0C0C000FFFFFF00C0C0C00000000000FFFFFF00FFFFFF00C0C0C000FFFF
|
||||||
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
|
FF00C0C0C000FFFFFF0080808000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -388,7 +389,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
C000FFFFFF00C0C0C000FFFFFF0000000000FFFFFF00C0C0C000FFFFFF00C0C0
|
C000FFFFFF00C0C0C000FFFFFF0000000000FFFFFF00C0C0C000FFFFFF00C0C0
|
||||||
C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000
|
C000FFFFFF00C0C0C00080808000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -396,7 +397,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
FF00C0C0C000FFFFFF00C0C0C00000000000FFFFFF00FFFFFF00FFFFFF00FFFF
|
FF00C0C0C000FFFFFF00C0C0C00000000000FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000
|
FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -404,7 +405,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000
|
C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -412,7 +413,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
FF00C0C0C000FFFFFF00C0C0C00000000000FF000000FF000000FF000000FF00
|
FF00C0C0C000FFFFFF00C0C0C00000000000FF000000FF000000FF000000FF00
|
||||||
0000FF00000000000000C0C0C000000000000000000000000000000000000000
|
0000FF00000000000000C0C0C000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000FFFFFF000000FF0000008000C0C0C0000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -420,7 +421,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000
|
C000FFFFFF00C0C0C000FFFFFF00000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000FFFFFF00FFFFFF00FFFFFF00C0C0C0000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
@ -598,16 +599,15 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000000000000000000000000000000000000000000000000000000000000000
|
||||||
0000000000000000000000000000000000030000000000000003000000000000
|
000000000000000000000000000000000003FFF0000000000003FFF000000000
|
||||||
0003000000000000000000000000000000000000000000000000000000000000
|
0003FFF0000000000000FFF0000000000000FFF0000000000000FFF000000000
|
||||||
0000000000000000000000000000000000000000000000000000000000000000
|
0000FFF0000000000000FFF0000000000000FFF0000000000000FFF000000000
|
||||||
0000000000000000000300000000000000030000000000000003000000000000
|
0000FFF0000000000003FFFF000000000003FFFF000000000003FFFF00000000
|
||||||
00030000000000000003000000000000E000E000FFFFEC0FE000E000FFFF840F
|
0003FFFF000000000003FFFF00000000E000E000FFFFEC0FE000E000FFFF840F
|
||||||
E000E0000000AC0FE000E0000000BF3FE000E0000000FFFFE000600000001000
|
E000E0000000AC0FE000E0000000BF3FE000E0000000FFFFE000600000001000
|
||||||
E000200000001000E00000000000B000E00020000000F000E00060000000F000
|
E000200000001000E00000000000B000E00020000000F000E00060000000F000
|
||||||
E000E0000000F000E000E0000000F000E000E0000000F000E001E0010000F000
|
E000E0000000F000E000E0000000F000E000E0000000F000E001E0010000F000
|
||||||
E003E003FFFFF000E007E007FFFFF00000000000000000000000000000000000
|
E003E003FFFFF000E007E007FFFFF000}
|
||||||
000000000000}
|
|
||||||
end
|
end
|
||||||
object alMain: TActionList
|
object alMain: TActionList
|
||||||
Left = 44
|
Left = 44
|
||||||
@ -659,9 +659,13 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
ShortCut = 16424
|
ShortCut = 16424
|
||||||
OnExecute = actMRUNextExecute
|
OnExecute = actMRUNextExecute
|
||||||
end
|
end
|
||||||
|
object actReadOnly: TAction
|
||||||
|
Caption = '&Read only'
|
||||||
|
ShortCut = 49234
|
||||||
|
OnExecute = actReadOnlyExecute
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object pmnUnits: TPopupMenu
|
object pmnUnits: TPopupMenu
|
||||||
OnPopup = pmnUnitsPopup
|
|
||||||
Left = 72
|
Left = 72
|
||||||
Top = 264
|
Top = 264
|
||||||
object pmnUnitsSelectAll: TMenuItem
|
object pmnUnitsSelectAll: TMenuItem
|
||||||
@ -682,6 +686,12 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
object pmnUnitsSep2: TMenuItem
|
object pmnUnitsSep2: TMenuItem
|
||||||
Caption = '-'
|
Caption = '-'
|
||||||
end
|
end
|
||||||
|
object pmnUnitsReadOnly: TMenuItem
|
||||||
|
Action = actReadOnly
|
||||||
|
end
|
||||||
|
object pmnUnitsSep3: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
object pmnUnitsOpenFolder: TMenuItem
|
object pmnUnitsOpenFolder: TMenuItem
|
||||||
Action = actOpenFolder
|
Action = actOpenFolder
|
||||||
end
|
end
|
||||||
|
@ -30,12 +30,15 @@ type
|
|||||||
private
|
private
|
||||||
FColor: TColor;
|
FColor: TColor;
|
||||||
FImageIndex: Integer;
|
FImageIndex: Integer;
|
||||||
|
FOverlayIndex: Integer;
|
||||||
protected
|
protected
|
||||||
|
procedure VisitUnit(const AUnit: TUnSwUnit);
|
||||||
procedure VisitModule(const AUnit: TUnSwModuleUnit);
|
procedure VisitModule(const AUnit: TUnSwModuleUnit);
|
||||||
procedure VisitProject(const AUnit: TUnSwProjectUnit);
|
procedure VisitProject(const AUnit: TUnSwProjectUnit);
|
||||||
public
|
public
|
||||||
property Color: TColor read FColor;
|
property Color: TColor read FColor;
|
||||||
property ImageIndex: Integer read FImageIndex;
|
property ImageIndex: Integer read FImageIndex;
|
||||||
|
property OverlayIndex: Integer read FOverlayIndex;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TfrmUnSwDialog = class(TForm)
|
TfrmUnSwDialog = class(TForm)
|
||||||
@ -44,6 +47,7 @@ type
|
|||||||
actOpenDFMProperties: TAction;
|
actOpenDFMProperties: TAction;
|
||||||
actOpenFolder: TAction;
|
actOpenFolder: TAction;
|
||||||
actOpenProperties: TAction;
|
actOpenProperties: TAction;
|
||||||
|
actReadOnly: TAction;
|
||||||
actSelectAll: TAction;
|
actSelectAll: TAction;
|
||||||
actSelectInvert: TAction;
|
actSelectInvert: TAction;
|
||||||
actSortByName: TAction;
|
actSortByName: TAction;
|
||||||
@ -64,10 +68,12 @@ type
|
|||||||
pmnUnitsOpenDFMProperties: TMenuItem;
|
pmnUnitsOpenDFMProperties: TMenuItem;
|
||||||
pmnUnitsOpenFolder: TMenuItem;
|
pmnUnitsOpenFolder: TMenuItem;
|
||||||
pmnUnitsOpenProperties: TMenuItem;
|
pmnUnitsOpenProperties: TMenuItem;
|
||||||
|
pmnUnitsReadOnly: TMenuItem;
|
||||||
pmnUnitsSelectAll: TMenuItem;
|
pmnUnitsSelectAll: TMenuItem;
|
||||||
pmnUnitsSelectInvert: TMenuItem;
|
pmnUnitsSelectInvert: TMenuItem;
|
||||||
pmnUnitsSep1: TMenuItem;
|
pmnUnitsSep1: TMenuItem;
|
||||||
pmnUnitsSep2: TMenuItem;
|
pmnUnitsSep2: TMenuItem;
|
||||||
|
pmnUnitsSep3: TMenuItem;
|
||||||
pmnUnitsSortByName: TMenuItem;
|
pmnUnitsSortByName: TMenuItem;
|
||||||
pmnUnitsSortByType: TMenuItem;
|
pmnUnitsSortByType: TMenuItem;
|
||||||
pnlButtons: TPanel;
|
pnlButtons: TPanel;
|
||||||
@ -82,6 +88,7 @@ type
|
|||||||
procedure actOpenDFMPropertiesExecute(Sender: TObject);
|
procedure actOpenDFMPropertiesExecute(Sender: TObject);
|
||||||
procedure actOpenFolderExecute(Sender: TObject);
|
procedure actOpenFolderExecute(Sender: TObject);
|
||||||
procedure actOpenPropertiesExecute(Sender: TObject);
|
procedure actOpenPropertiesExecute(Sender: TObject);
|
||||||
|
procedure actReadOnlyExecute(Sender: TObject);
|
||||||
procedure actSelectAllExecute(Sender: TObject);
|
procedure actSelectAllExecute(Sender: TObject);
|
||||||
procedure actSelectInvertExecute(Sender: TObject);
|
procedure actSelectInvertExecute(Sender: TObject);
|
||||||
procedure btnConfigurationClick(Sender: TObject);
|
procedure btnConfigurationClick(Sender: TObject);
|
||||||
@ -94,7 +101,7 @@ type
|
|||||||
procedure lstUnitsData(Control: TWinControl; Index: Integer; var Data: string);
|
procedure lstUnitsData(Control: TWinControl; Index: Integer; var Data: string);
|
||||||
procedure lstUnitsDblClick(Sender: TObject);
|
procedure lstUnitsDblClick(Sender: TObject);
|
||||||
procedure lstUnitsDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
|
procedure lstUnitsDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
|
||||||
procedure pmnUnitsPopup(Sender: TObject);
|
procedure lstUnitsMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
procedure SortExecute(Sender: TObject);
|
procedure SortExecute(Sender: TObject);
|
||||||
procedure TypeFilterChange(Sender: TObject);
|
procedure TypeFilterChange(Sender: TObject);
|
||||||
private
|
private
|
||||||
@ -129,6 +136,8 @@ type
|
|||||||
|
|
||||||
procedure LoadSettings();
|
procedure LoadSettings();
|
||||||
procedure SaveSettings();
|
procedure SaveSettings();
|
||||||
|
|
||||||
|
procedure UpdateUnitActions();
|
||||||
public
|
public
|
||||||
class function Execute(const AUnits: TUnSwUnitList;
|
class function Execute(const AUnits: TUnSwUnitList;
|
||||||
const AFormsOnly: Boolean;
|
const AFormsOnly: Boolean;
|
||||||
@ -184,10 +193,29 @@ type
|
|||||||
property ReadOnlyCount: Integer read FReadOnlyCount;
|
property ReadOnlyCount: Integer read FReadOnlyCount;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TUnSwSetReadOnlyVisitor = class(TUnSwOpenVisitor)
|
||||||
|
private
|
||||||
|
FReadOnlyFlag: Boolean;
|
||||||
|
protected
|
||||||
|
procedure OpenFile(const AFileName: String); override;
|
||||||
|
public
|
||||||
|
property ReadOnlyFlag: Boolean read FReadOnlyFlag write FReadOnlyFlag;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$R *.dfm}
|
{$R *.dfm}
|
||||||
|
|
||||||
|
|
||||||
|
function IsReadOnly(const AFileName: String): Boolean;
|
||||||
|
var
|
||||||
|
iAttr: Integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
iAttr := FileGetAttr(AFileName);
|
||||||
|
Result := (iAttr <> -1) and ((iAttr and faReadOnly) <> 0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TUnSwOpenVisitor }
|
{ TUnSwOpenVisitor }
|
||||||
constructor TUnSwOpenVisitor.Create();
|
constructor TUnSwOpenVisitor.Create();
|
||||||
begin
|
begin
|
||||||
@ -207,9 +235,13 @@ end;
|
|||||||
function TUnSwOpenVisitor.IsProcessed(const AFileName: String;
|
function TUnSwOpenVisitor.IsProcessed(const AFileName: String;
|
||||||
const ARegister: Boolean): Boolean;
|
const ARegister: Boolean): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := (FProcessed.IndexOf(AFileName) > -1);
|
Result := True;
|
||||||
if (not Result) and ARegister then
|
if FileExists(AFileName) or DirectoryExists(AFileName) then
|
||||||
FProcessed.Add(AFileName);
|
begin
|
||||||
|
Result := (FProcessed.IndexOf(AFileName) > -1);
|
||||||
|
if (not Result) and ARegister then
|
||||||
|
FProcessed.Add(AFileName);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TUnSwOpenVisitor.VisitModule(const AUnit: TUnSwModuleUnit);
|
procedure TUnSwOpenVisitor.VisitModule(const AUnit: TUnSwModuleUnit);
|
||||||
@ -238,7 +270,7 @@ begin
|
|||||||
sParams := '/e,';
|
sParams := '/e,';
|
||||||
|
|
||||||
// If it's a file, have explorer highlight it
|
// If it's a file, have explorer highlight it
|
||||||
if not DirectoryExists(AFileName) then
|
if not DirectoryExists(sFile) then
|
||||||
sParams := sParams + '/select,';
|
sParams := sParams + '/select,';
|
||||||
|
|
||||||
sParams := sParams + ExtractShortPathName(sFile);
|
sParams := sParams + ExtractShortPathName(sFile);
|
||||||
@ -280,22 +312,57 @@ end;
|
|||||||
|
|
||||||
{ TUnSwReadOnlyVisitor }
|
{ TUnSwReadOnlyVisitor }
|
||||||
procedure TUnSwReadOnlyVisitor.OpenFile(const AFileName: String);
|
procedure TUnSwReadOnlyVisitor.OpenFile(const AFileName: String);
|
||||||
|
begin
|
||||||
|
if not IsProcessed(AFileName) then
|
||||||
|
if IsReadOnly(AFileName) then
|
||||||
|
Inc(FReadOnlyCount);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TUnSwSetReadOnlyVisitor }
|
||||||
|
procedure TUnSwSetReadOnlyVisitor.OpenFile(const AFileName: String);
|
||||||
var
|
var
|
||||||
iAttr: Integer;
|
fileInfo: TSearchRec;
|
||||||
|
fileAttr: Integer;
|
||||||
|
path: String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if not IsProcessed(AFileName) then
|
if not IsProcessed(AFileName) then
|
||||||
begin
|
begin
|
||||||
iAttr := FileGetAttr(AFileName);
|
path := ExtractFilePath(AFileName);
|
||||||
if (iAttr and faReadOnly) <> 0 then
|
if FindFirst(ChangeFileExt(AFileName, '.*'), faAnyFile, fileInfo) = 0 then
|
||||||
Inc(FReadOnlyCount);
|
begin
|
||||||
|
repeat
|
||||||
|
fileAttr := FileGetAttr(path + fileInfo.Name);
|
||||||
|
if fileAttr <> -1 then
|
||||||
|
begin
|
||||||
|
if ReadOnlyFlag then
|
||||||
|
fileAttr := fileAttr or faReadOnly
|
||||||
|
else
|
||||||
|
fileAttr := fileAttr and not faReadOnly;
|
||||||
|
|
||||||
|
FileSetAttr(path + fileInfo.Name, fileAttr);
|
||||||
|
end;
|
||||||
|
until FindNext(fileInfo) <> 0;
|
||||||
|
|
||||||
|
FindClose(fileInfo);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TUnSwStyleVisitor }
|
{ TUnSwStyleVisitor }
|
||||||
|
procedure TUnSwStyleVisitor.VisitUnit(const AUnit: TUnSwUnit);
|
||||||
|
begin
|
||||||
|
if IsReadOnly(AUnit.FileName) then
|
||||||
|
FOverlayIndex := 5
|
||||||
|
else
|
||||||
|
FOverlayIndex := -1;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TUnSwStyleVisitor.VisitModule(const AUnit: TUnSwModuleUnit);
|
procedure TUnSwStyleVisitor.VisitModule(const AUnit: TUnSwModuleUnit);
|
||||||
begin
|
begin
|
||||||
|
VisitUnit(AUnit);
|
||||||
case AUnit.UnitType of
|
case AUnit.UnitType of
|
||||||
swutUnit:
|
swutUnit:
|
||||||
begin
|
begin
|
||||||
@ -320,8 +387,9 @@ end;
|
|||||||
|
|
||||||
procedure TUnSwStyleVisitor.VisitProject(const AUnit: TUnSwProjectUnit);
|
procedure TUnSwStyleVisitor.VisitProject(const AUnit: TUnSwProjectUnit);
|
||||||
begin
|
begin
|
||||||
FColor := Settings.Colors.ProjectSource;
|
VisitUnit(AUnit);
|
||||||
FImageIndex := 4;
|
FColor := Settings.Colors.ProjectSource;
|
||||||
|
FImageIndex := 4;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -421,6 +489,66 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TfrmUnSwDialog.UpdateUnitActions();
|
||||||
|
var
|
||||||
|
bDFM: Boolean;
|
||||||
|
bUnits: Boolean;
|
||||||
|
iUnit: Integer;
|
||||||
|
pUnits: TUnSwUnitList;
|
||||||
|
pVisitor: TUnSwReadOnlyVisitor;
|
||||||
|
sStatus: String;
|
||||||
|
|
||||||
|
begin
|
||||||
|
{ Read-only status }
|
||||||
|
pUnits := GetActiveUnits();
|
||||||
|
if Assigned(pUnits) then
|
||||||
|
try
|
||||||
|
pVisitor := TUnSwReadOnlyVisitor.Create();
|
||||||
|
try
|
||||||
|
pUnits.AcceptVisitor(pVisitor);
|
||||||
|
actReadOnly.Checked := (pVisitor.ReadOnlyCount > 0);
|
||||||
|
|
||||||
|
sStatus := '';
|
||||||
|
if pVisitor.ReadOnlyCount > 0 then
|
||||||
|
if pVisitor.ReadOnlyCount = 1 then
|
||||||
|
sStatus := '1 read-only unit selected'
|
||||||
|
else
|
||||||
|
sStatus := Format('%d read-only units selected',
|
||||||
|
[pVisitor.ReadOnlyCount]);
|
||||||
|
|
||||||
|
sbStatus.Panels[0].Text := sStatus;
|
||||||
|
finally
|
||||||
|
FreeAndNil(pVisitor);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
FreeAndNil(pUnits);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ Properties }
|
||||||
|
bDFM := False;
|
||||||
|
bUnits := False;
|
||||||
|
|
||||||
|
pUnits := GetActiveUnits();
|
||||||
|
if Assigned(pUnits) then
|
||||||
|
try
|
||||||
|
bUnits := (pUnits.Count > 0);
|
||||||
|
|
||||||
|
for iUnit := 0 to Pred(pUnits.Count) do
|
||||||
|
if (pUnits[iUnit] is TUnSwModuleUnit) and
|
||||||
|
(TUnSwModuleUnit(pUnits[iUnit]).UnitType in [swutForm, swutDataModule]) then
|
||||||
|
begin
|
||||||
|
bDFM := True;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
FreeAndNil(pUnits);
|
||||||
|
end;
|
||||||
|
|
||||||
|
actOpenFolder.Enabled := bUnits;
|
||||||
|
actOpenProperties.Enabled := bUnits;
|
||||||
|
actOpenDFMProperties.Enabled := bDFM;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TfrmUnSwDialog.UpdateList();
|
procedure TfrmUnSwDialog.UpdateList();
|
||||||
var
|
var
|
||||||
activeUnit: TUnSwUnit;
|
activeUnit: TUnSwUnit;
|
||||||
@ -689,6 +817,9 @@ begin
|
|||||||
cmbSearch.ItemIndex := FMRUIndex;
|
cmbSearch.ItemIndex := FMRUIndex;
|
||||||
ActiveControl := cmbSearch;
|
ActiveControl := cmbSearch;
|
||||||
cmbSearch.SelectAll();
|
cmbSearch.SelectAll();
|
||||||
|
|
||||||
|
if Assigned(cmbSearch.OnChange) then
|
||||||
|
cmbSearch.OnChange(nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmUnSwDialog.actMRUNextExecute(Sender: TObject);
|
procedure TfrmUnSwDialog.actMRUNextExecute(Sender: TObject);
|
||||||
@ -810,34 +941,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmUnSwDialog.lstUnitsClick(Sender: TObject);
|
procedure TfrmUnSwDialog.lstUnitsClick(Sender: TObject);
|
||||||
var
|
|
||||||
pUnits: TUnSwUnitList;
|
|
||||||
pVisitor: TUnSwReadOnlyVisitor;
|
|
||||||
sStatus: String;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
pUnits := GetActiveUnits();
|
UpdateUnitActions();
|
||||||
if Assigned(pUnits) then
|
|
||||||
try
|
|
||||||
pVisitor := TUnSwReadOnlyVisitor.Create();
|
|
||||||
try
|
|
||||||
pUnits.AcceptVisitor(pVisitor);
|
|
||||||
|
|
||||||
sStatus := '';
|
|
||||||
if pVisitor.ReadOnlyCount > 0 then
|
|
||||||
if pVisitor.ReadOnlyCount = 1 then
|
|
||||||
sStatus := '1 read-only unit selected'
|
|
||||||
else
|
|
||||||
sStatus := Format('%d read-only units selected',
|
|
||||||
[pVisitor.ReadOnlyCount]);
|
|
||||||
|
|
||||||
sbStatus.Panels[0].Text := sStatus;
|
|
||||||
finally
|
|
||||||
FreeAndNil(pVisitor);
|
|
||||||
end;
|
|
||||||
finally
|
|
||||||
FreeAndNil(pUnits);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmUnSwDialog.lstUnitsData(Control: TWinControl; Index: Integer;
|
procedure TfrmUnSwDialog.lstUnitsData(Control: TWinControl; Index: Integer;
|
||||||
@ -882,42 +987,56 @@ begin
|
|||||||
InflateRect(textRect, -2, -2);
|
InflateRect(textRect, -2, -2);
|
||||||
ilsTypes.Draw(Canvas, textRect.Left, textRect.Top, FStyleVisitor.ImageIndex);
|
ilsTypes.Draw(Canvas, textRect.Left, textRect.Top, FStyleVisitor.ImageIndex);
|
||||||
|
|
||||||
|
if FStyleVisitor.OverlayIndex > -1 then
|
||||||
|
ilsTypes.Draw(Canvas, textRect.Left, textRect.Top, FStyleVisitor.OverlayIndex);
|
||||||
|
|
||||||
Inc(textRect.Left, ilsTypes.Width + 4);
|
Inc(textRect.Left, ilsTypes.Width + 4);
|
||||||
DrawText(Canvas.Handle, PChar(text), Length(text), textRect, DT_SINGLELINE or
|
DrawText(Canvas.Handle, PChar(text), Length(text), textRect, DT_SINGLELINE or
|
||||||
DT_LEFT or DT_VCENTER or DT_END_ELLIPSIS);
|
DT_LEFT or DT_VCENTER or DT_END_ELLIPSIS);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmUnSwDialog.pmnUnitsPopup(Sender: TObject);
|
procedure TfrmUnSwDialog.lstUnitsMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||||||
var
|
var
|
||||||
bDFM: Boolean;
|
itemIndex: Integer;
|
||||||
bUnits: Boolean;
|
|
||||||
iUnit: Integer;
|
|
||||||
pUnits: TUnSwUnitList;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
bDFM := False;
|
{ Bij rechtermuisknop het item selecteren indien deze niet al
|
||||||
bUnits := False;
|
geselecteerd was }
|
||||||
|
if Button = mbRight then
|
||||||
|
begin
|
||||||
|
itemIndex := lstUnits.ItemAtPos(Point(X, Y), True);
|
||||||
|
if (itemIndex > -1) and (not lstUnits.Selected[itemIndex]) then
|
||||||
|
begin
|
||||||
|
lstUnits.ClearSelection;
|
||||||
|
lstUnits.Selected[itemIndex] := True;
|
||||||
|
UpdateUnitActions();
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
pUnits := GetActiveUnits();
|
procedure TfrmUnSwDialog.actReadOnlyExecute(Sender: TObject);
|
||||||
|
var
|
||||||
|
pUnits: TUnSwUnitList;
|
||||||
|
pVisitor: TUnSwSetReadOnlyVisitor;
|
||||||
|
|
||||||
|
begin
|
||||||
|
pUnits := GetActiveUnits();
|
||||||
if Assigned(pUnits) then
|
if Assigned(pUnits) then
|
||||||
try
|
try
|
||||||
bUnits := (pUnits.Count > 0);
|
pVisitor := TUnSwSetReadOnlyVisitor.Create();
|
||||||
|
try
|
||||||
for iUnit := 0 to Pred(pUnits.Count) do
|
pVisitor.ReadOnlyFlag := not actReadOnly.Checked;
|
||||||
if (pUnits[iUnit] is TUnSwModuleUnit) and
|
pUnits.AcceptVisitor(pVisitor);
|
||||||
(TUnSwModuleUnit(pUnits[iUnit]).UnitType in [swutForm, swutDataModule]) then
|
finally
|
||||||
begin
|
FreeAndNil(pVisitor);
|
||||||
bDFM := True;
|
end;
|
||||||
break;
|
|
||||||
end;
|
|
||||||
finally
|
finally
|
||||||
FreeAndNil(pUnits);
|
FreeAndNil(pUnits);
|
||||||
|
|
||||||
|
lstUnits.Invalidate();
|
||||||
|
UpdateUnitActions();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
actOpenFolder.Enabled := bUnits;
|
|
||||||
actOpenProperties.Enabled := bUnits;
|
|
||||||
actOpenDFMProperties.Enabled := bDFM;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user