This commit is contained in:
parent
79b18c0bf6
commit
82485ca0a0
Binary file not shown.
@ -58,11 +58,9 @@ begin
|
|||||||
Assert(Supports(BorlandIDEServices, IOTAModuleServices),
|
Assert(Supports(BorlandIDEServices, IOTAModuleServices),
|
||||||
'BorlandIDEServices does not support the ' +
|
'BorlandIDEServices does not support the ' +
|
||||||
'IOTAModuleServices interface.');
|
'IOTAModuleServices interface.');
|
||||||
{$IFDEF DELPHI7ORLOWER}
|
|
||||||
Assert(Supports(BorlandIDEServices, IOTAActionServices),
|
Assert(Supports(BorlandIDEServices, IOTAActionServices),
|
||||||
'BorlandIDEServices does not support the ' +
|
'BorlandIDEServices does not support the ' +
|
||||||
'IOTAActionServices interface.');
|
'IOTAActionServices interface.');
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
for actionIndex := 0 to Pred(ntaServices.ActionList.ActionCount) do
|
for actionIndex := 0 to Pred(ntaServices.ActionList.ActionCount) do
|
||||||
begin
|
begin
|
||||||
@ -174,6 +172,9 @@ var
|
|||||||
project: IOTAProject;
|
project: IOTAProject;
|
||||||
selectedUnits: TUnSwUnitList;
|
selectedUnits: TUnSwUnitList;
|
||||||
unitList: TUnSwUnitList;
|
unitList: TUnSwUnitList;
|
||||||
|
openDFM: Boolean;
|
||||||
|
openType: TUnSwActivateType;
|
||||||
|
fileName: string;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
project := ActiveProject();
|
project := ActiveProject();
|
||||||
@ -188,16 +189,27 @@ begin
|
|||||||
unitList.Add(TUnSwModuleUnit.Create(project.GetModule(moduleIndex)));
|
unitList.Add(TUnSwModuleUnit.Create(project.GetModule(moduleIndex)));
|
||||||
|
|
||||||
activeUnit := nil;
|
activeUnit := nil;
|
||||||
activeIndex := unitList.IndexOfFileName(ActiveFileName());
|
fileName := ActiveFileName();
|
||||||
|
|
||||||
|
if SameText(ExtractFileExt(fileName), '.dfm') then
|
||||||
|
fileName := ChangeFileExt(fileName, '.pas');
|
||||||
|
|
||||||
|
activeIndex := unitList.IndexOfFileName(fileName);
|
||||||
if activeIndex > -1 then
|
if activeIndex > -1 then
|
||||||
activeUnit := unitList[activeIndex];
|
activeUnit := unitList[activeIndex];
|
||||||
|
|
||||||
selectedUnits := TfrmUnSwDialog.Execute(unitList, (Sender = FViewFormAction),
|
selectedUnits := TfrmUnSwDialog.Execute(unitList, (Sender = FViewFormAction),
|
||||||
activeUnit);
|
openDFM, activeUnit);
|
||||||
if Assigned(selectedUnits) then
|
if Assigned(selectedUnits) then
|
||||||
try
|
try
|
||||||
|
openType := atSource;
|
||||||
|
if openDFM then
|
||||||
|
openType := atDFM
|
||||||
|
else if Sender = FViewFormAction then
|
||||||
|
openType := atForm;
|
||||||
|
|
||||||
for itemIndex := 0 to Pred(selectedUnits.Count) do
|
for itemIndex := 0 to Pred(selectedUnits.Count) do
|
||||||
selectedUnits[itemIndex].Activate((Sender = FViewUnitAction));
|
selectedUnits[itemIndex].Activate(openType);
|
||||||
finally
|
finally
|
||||||
FreeAndNil(selectedUnits);
|
FreeAndNil(selectedUnits);
|
||||||
end;
|
end;
|
||||||
|
@ -4,7 +4,7 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
|
|||||||
BorderIcons = [biSystemMenu]
|
BorderIcons = [biSystemMenu]
|
||||||
BorderStyle = bsDialog
|
BorderStyle = bsDialog
|
||||||
Caption = 'UnitSwitcher Configuration'
|
Caption = 'UnitSwitcher Configuration'
|
||||||
ClientHeight = 250
|
ClientHeight = 272
|
||||||
ClientWidth = 303
|
ClientWidth = 303
|
||||||
Color = clBtnFace
|
Color = clBtnFace
|
||||||
Font.Charset = DEFAULT_CHARSET
|
Font.Charset = DEFAULT_CHARSET
|
||||||
@ -16,14 +16,14 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
|
|||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
DesignSize = (
|
DesignSize = (
|
||||||
303
|
303
|
||||||
250)
|
272)
|
||||||
PixelsPerInch = 96
|
PixelsPerInch = 96
|
||||||
TextHeight = 13
|
TextHeight = 13
|
||||||
object pcConfiguration: TPageControl
|
object pcConfiguration: TPageControl
|
||||||
Left = 4
|
Left = 4
|
||||||
Top = 4
|
Top = 4
|
||||||
Width = 295
|
Width = 295
|
||||||
Height = 209
|
Height = 231
|
||||||
ActivePage = tsGeneral
|
ActivePage = tsGeneral
|
||||||
Anchors = [akLeft, akTop, akRight, akBottom]
|
Anchors = [akLeft, akTop, akRight, akBottom]
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
@ -204,20 +204,28 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
|
|||||||
end
|
end
|
||||||
object btnDefault: TButton
|
object btnDefault: TButton
|
||||||
Left = 8
|
Left = 8
|
||||||
Top = 135
|
Top = 167
|
||||||
Width = 109
|
Width = 109
|
||||||
Height = 25
|
Height = 25
|
||||||
Caption = 'Reset to &default'
|
Caption = 'Reset to &default'
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
OnClick = btnDefaultClick
|
OnClick = btnDefaultClick
|
||||||
end
|
end
|
||||||
|
object chkAllowEmptyResults: TCheckBox
|
||||||
|
Left = 8
|
||||||
|
Top = 136
|
||||||
|
Width = 273
|
||||||
|
Height = 17
|
||||||
|
Caption = 'Allow &empty results'
|
||||||
|
TabOrder = 3
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object tsAbout: TTabSheet
|
object tsAbout: TTabSheet
|
||||||
Caption = 'About...'
|
Caption = 'About...'
|
||||||
ImageIndex = 1
|
ImageIndex = 1
|
||||||
DesignSize = (
|
DesignSize = (
|
||||||
287
|
287
|
||||||
181)
|
203)
|
||||||
object imgAbout: TImage
|
object imgAbout: TImage
|
||||||
Left = 8
|
Left = 8
|
||||||
Top = 8
|
Top = 8
|
||||||
@ -275,7 +283,7 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
|
|||||||
Top = 23
|
Top = 23
|
||||||
Width = 145
|
Width = 145
|
||||||
Height = 13
|
Height = 13
|
||||||
Anchors = [akLeft, akBottom]
|
Anchors = [akTop, akRight]
|
||||||
Caption = 'Copyright '#169' 2006 X'#178'Software'
|
Caption = 'Copyright '#169' 2006 X'#178'Software'
|
||||||
end
|
end
|
||||||
object TLabel
|
object TLabel
|
||||||
@ -283,7 +291,6 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
|
|||||||
Top = 90
|
Top = 90
|
||||||
Width = 225
|
Width = 225
|
||||||
Height = 41
|
Height = 41
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
|
||||||
AutoSize = False
|
AutoSize = False
|
||||||
Caption =
|
Caption =
|
||||||
'UnitSwitcher is released as open-source under the zlib/libpng OS' +
|
'UnitSwitcher is released as open-source under the zlib/libpng OS' +
|
||||||
@ -304,10 +311,11 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
|
|||||||
end
|
end
|
||||||
object lblBugReport: TLabel
|
object lblBugReport: TLabel
|
||||||
Left = 56
|
Left = 56
|
||||||
Top = 156
|
Top = 177
|
||||||
Width = 75
|
Width = 75
|
||||||
Height = 13
|
Height = 13
|
||||||
Cursor = crHandPoint
|
Cursor = crHandPoint
|
||||||
|
Anchors = [akLeft, akBottom]
|
||||||
Caption = 'Report a bug...'
|
Caption = 'Report a bug...'
|
||||||
Font.Charset = DEFAULT_CHARSET
|
Font.Charset = DEFAULT_CHARSET
|
||||||
Font.Color = clBlue
|
Font.Color = clBlue
|
||||||
@ -319,10 +327,11 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
|
|||||||
end
|
end
|
||||||
object lblShortcutKeys: TLabel
|
object lblShortcutKeys: TLabel
|
||||||
Left = 56
|
Left = 56
|
||||||
Top = 141
|
Top = 162
|
||||||
Width = 127
|
Width = 127
|
||||||
Height = 13
|
Height = 13
|
||||||
Cursor = crHandPoint
|
Cursor = crHandPoint
|
||||||
|
Anchors = [akLeft, akBottom]
|
||||||
Caption = 'Overview of shortcut keys'
|
Caption = 'Overview of shortcut keys'
|
||||||
Font.Charset = DEFAULT_CHARSET
|
Font.Charset = DEFAULT_CHARSET
|
||||||
Font.Color = clBlue
|
Font.Color = clBlue
|
||||||
@ -336,7 +345,7 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
|
|||||||
end
|
end
|
||||||
object btnCancel: TButton
|
object btnCancel: TButton
|
||||||
Left = 224
|
Left = 224
|
||||||
Top = 219
|
Top = 241
|
||||||
Width = 75
|
Width = 75
|
||||||
Height = 25
|
Height = 25
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
@ -347,7 +356,7 @@ object frmUnSwConfiguration: TfrmUnSwConfiguration
|
|||||||
end
|
end
|
||||||
object btnOk: TButton
|
object btnOk: TButton
|
||||||
Left = 143
|
Left = 143
|
||||||
Top = 219
|
Top = 241
|
||||||
Width = 75
|
Width = 75
|
||||||
Height = 25
|
Height = 25
|
||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
|
@ -26,6 +26,7 @@ type
|
|||||||
btnOk: TButton;
|
btnOk: TButton;
|
||||||
btnProjectColor: TButton;
|
btnProjectColor: TButton;
|
||||||
btnUnitColor: TButton;
|
btnUnitColor: TButton;
|
||||||
|
chkAllowEmptyResults: TCheckBox;
|
||||||
chkCustomColor: TCheckBox;
|
chkCustomColor: TCheckBox;
|
||||||
dlgColor: TColorDialog;
|
dlgColor: TColorDialog;
|
||||||
imgAbout: TImage;
|
imgAbout: TImage;
|
||||||
@ -65,8 +66,10 @@ uses
|
|||||||
UnSwSettings,
|
UnSwSettings,
|
||||||
UnSwShortcuts;
|
UnSwShortcuts;
|
||||||
|
|
||||||
|
|
||||||
{$R *.dfm}
|
{$R *.dfm}
|
||||||
|
|
||||||
|
|
||||||
{ TfrmUnSwConfiguration }
|
{ TfrmUnSwConfiguration }
|
||||||
class function TfrmUnSwConfiguration.Execute(): Boolean;
|
class function TfrmUnSwConfiguration.Execute(): Boolean;
|
||||||
begin
|
begin
|
||||||
@ -80,6 +83,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TfrmUnSwConfiguration.InternalExecute(): Boolean;
|
function TfrmUnSwConfiguration.InternalExecute(): Boolean;
|
||||||
var
|
var
|
||||||
iLabel: Integer;
|
iLabel: Integer;
|
||||||
@ -103,11 +107,13 @@ begin
|
|||||||
ShellExecute(0, 'open', 'http://projects.kamadev.net/', nil, nil, SW_SHOWNORMAL);
|
ShellExecute(0, 'open', 'http://projects.kamadev.net/', nil, nil, SW_SHOWNORMAL);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TfrmUnSwConfiguration.lblShortcutKeysClick(Sender: TObject);
|
procedure TfrmUnSwConfiguration.lblShortcutKeysClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
TfrmUnSwShortcuts.Execute();
|
TfrmUnSwShortcuts.Execute();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TfrmUnSwConfiguration.LoadSettings();
|
procedure TfrmUnSwConfiguration.LoadSettings();
|
||||||
begin
|
begin
|
||||||
chkCustomColor.Checked := Settings.Colors.Enabled;
|
chkCustomColor.Checked := Settings.Colors.Enabled;
|
||||||
@ -115,8 +121,10 @@ begin
|
|||||||
lblFormColor.Font.Color := Settings.Colors.Forms;
|
lblFormColor.Font.Color := Settings.Colors.Forms;
|
||||||
lblProjectColor.Font.Color := Settings.Colors.ProjectSource;
|
lblProjectColor.Font.Color := Settings.Colors.ProjectSource;
|
||||||
lblUnitColor.Font.Color := Settings.Colors.Units;
|
lblUnitColor.Font.Color := Settings.Colors.Units;
|
||||||
|
chkAllowEmptyResults.Checked := Settings.Filter.AllowEmptyResult;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TfrmUnSwConfiguration.SaveSettings();
|
procedure TfrmUnSwConfiguration.SaveSettings();
|
||||||
begin
|
begin
|
||||||
Settings.Colors.Enabled := chkCustomColor.Checked;
|
Settings.Colors.Enabled := chkCustomColor.Checked;
|
||||||
@ -124,22 +132,24 @@ begin
|
|||||||
Settings.Colors.Forms := lblFormColor.Font.Color;
|
Settings.Colors.Forms := lblFormColor.Font.Color;
|
||||||
Settings.Colors.ProjectSource := lblProjectColor.Font.Color;
|
Settings.Colors.ProjectSource := lblProjectColor.Font.Color;
|
||||||
Settings.Colors.Units := lblUnitColor.Font.Color;
|
Settings.Colors.Units := lblUnitColor.Font.Color;
|
||||||
|
Settings.Filter.AllowEmptyResult := chkAllowEmptyResults.Checked;
|
||||||
Settings.Save();
|
Settings.Save();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TfrmUnSwConfiguration.btnDefaultClick(Sender: TObject);
|
procedure TfrmUnSwConfiguration.btnDefaultClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if MessageBox(Self.Handle, 'Are you sure you want to revert the color ' +
|
if MessageBox(Self.Handle, 'Are you sure you want to revert the ' +
|
||||||
'settings? This action can not be undone.',
|
'settings? This action can not be undone.',
|
||||||
'Reset to default', MB_YESNO or MB_ICONQUESTION) = ID_YES then
|
'Reset to default', MB_YESNO or MB_ICONQUESTION) = ID_YES then
|
||||||
begin
|
begin
|
||||||
Settings.ResetDefaults(True);
|
Settings.ResetDefaults();
|
||||||
Settings.Save();
|
Settings.Save();
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TfrmUnSwConfiguration.chkCustomColorClick(Sender: TObject);
|
procedure TfrmUnSwConfiguration.chkCustomColorClick(Sender: TObject);
|
||||||
const
|
const
|
||||||
Colors: array[Boolean] of TColor = (clBtnFace, clWindow);
|
Colors: array[Boolean] of TColor = (clBtnFace, clWindow);
|
||||||
@ -149,6 +159,7 @@ begin
|
|||||||
pnlCustomColor.Color := Colors[pnlCustomColor.Enabled];
|
pnlCustomColor.Color := Colors[pnlCustomColor.Enabled];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TfrmUnSwConfiguration.PickColor(Sender: TObject);
|
procedure TfrmUnSwConfiguration.PickColor(Sender: TObject);
|
||||||
var
|
var
|
||||||
typeLabel: TLabel;
|
typeLabel: TLabel;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
object frmUnSwDialog: TfrmUnSwDialog
|
object frmUnSwDialog: TfrmUnSwDialog
|
||||||
Left = 187
|
Left = 284
|
||||||
Top = 83
|
Top = 120
|
||||||
Width = 320
|
Width = 320
|
||||||
Height = 425
|
Height = 425
|
||||||
BorderIcons = [biSystemMenu]
|
BorderIcons = [biSystemMenu]
|
||||||
@ -145,8 +145,8 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
Anchors = [akRight, akBottom]
|
Anchors = [akRight, akBottom]
|
||||||
Caption = 'OK'
|
Caption = 'OK'
|
||||||
Default = True
|
Default = True
|
||||||
ModalResult = 1
|
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
|
OnClick = btnOKClick
|
||||||
end
|
end
|
||||||
object btnConfiguration: TButton
|
object btnConfiguration: TButton
|
||||||
Left = 4
|
Left = 4
|
||||||
@ -646,7 +646,7 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
OnExecute = actOpenPropertiesExecute
|
OnExecute = actOpenPropertiesExecute
|
||||||
end
|
end
|
||||||
object actOpenDFMProperties: TAction
|
object actOpenDFMProperties: TAction
|
||||||
Caption = '&.DFM Properties'
|
Caption = '.&DFM Properties'
|
||||||
ShortCut = 24589
|
ShortCut = 24589
|
||||||
OnExecute = actOpenDFMPropertiesExecute
|
OnExecute = actOpenDFMPropertiesExecute
|
||||||
end
|
end
|
||||||
@ -665,17 +665,36 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
ShortCut = 49234
|
ShortCut = 49234
|
||||||
OnExecute = actReadOnlyExecute
|
OnExecute = actReadOnlyExecute
|
||||||
end
|
end
|
||||||
|
object actOpen: TAction
|
||||||
|
Caption = '&Open'
|
||||||
|
ShortCut = 13
|
||||||
|
OnExecute = actOpenExecute
|
||||||
|
end
|
||||||
|
object actOpenDFM: TAction
|
||||||
|
Caption = 'Open D&FM'
|
||||||
|
ShortCut = 8205
|
||||||
|
OnExecute = actOpenDFMExecute
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object pmnUnits: TPopupMenu
|
object pmnUnits: TPopupMenu
|
||||||
Left = 140
|
Left = 140
|
||||||
Top = 228
|
Top = 228
|
||||||
|
object pmnUnitsOpen: TMenuItem
|
||||||
|
Action = actOpen
|
||||||
|
end
|
||||||
|
object pmnUnitsOpenDFM: TMenuItem
|
||||||
|
Action = actOpenDFM
|
||||||
|
end
|
||||||
|
object pmnUnitsSep1: TMenuItem
|
||||||
|
Caption = '-'
|
||||||
|
end
|
||||||
object pmnUnitsSelectAll: TMenuItem
|
object pmnUnitsSelectAll: TMenuItem
|
||||||
Action = actSelectAll
|
Action = actSelectAll
|
||||||
end
|
end
|
||||||
object pmnUnitsSelectInvert: TMenuItem
|
object pmnUnitsSelectInvert: TMenuItem
|
||||||
Action = actSelectInvert
|
Action = actSelectInvert
|
||||||
end
|
end
|
||||||
object pmnUnitsSep1: TMenuItem
|
object pmnUnitsSep2: TMenuItem
|
||||||
Caption = '-'
|
Caption = '-'
|
||||||
end
|
end
|
||||||
object pmnUnitsSortByName: TMenuItem
|
object pmnUnitsSortByName: TMenuItem
|
||||||
@ -684,13 +703,13 @@ object frmUnSwDialog: TfrmUnSwDialog
|
|||||||
object pmnUnitsSortByType: TMenuItem
|
object pmnUnitsSortByType: TMenuItem
|
||||||
Action = actSortByType
|
Action = actSortByType
|
||||||
end
|
end
|
||||||
object pmnUnitsSep2: TMenuItem
|
object pmnUnitsSep3: TMenuItem
|
||||||
Caption = '-'
|
Caption = '-'
|
||||||
end
|
end
|
||||||
object pmnUnitsReadOnly: TMenuItem
|
object pmnUnitsReadOnly: TMenuItem
|
||||||
Action = actReadOnly
|
Action = actReadOnly
|
||||||
end
|
end
|
||||||
object pmnUnitsSep3: TMenuItem
|
object pmnUnitsSep4: TMenuItem
|
||||||
Caption = '-'
|
Caption = '-'
|
||||||
end
|
end
|
||||||
object pmnUnitsOpenFolder: TMenuItem
|
object pmnUnitsOpenFolder: TMenuItem
|
||||||
|
@ -26,7 +26,7 @@ uses
|
|||||||
UnSwFilters;
|
UnSwFilters;
|
||||||
|
|
||||||
type
|
type
|
||||||
TUnSwStyleVisitor = class(TUnSwNoRefIntfObject, IUnSwVisitor)
|
TUnSwStyleVisitor = class(TInterfacedPersistent, IUnSwVisitor)
|
||||||
private
|
private
|
||||||
FColor: TColor;
|
FColor: TColor;
|
||||||
FImageIndex: Integer;
|
FImageIndex: Integer;
|
||||||
@ -44,6 +44,8 @@ type
|
|||||||
TfrmUnSwDialog = class(TForm)
|
TfrmUnSwDialog = class(TForm)
|
||||||
actMRUNext: TAction;
|
actMRUNext: TAction;
|
||||||
actMRUPrior: TAction;
|
actMRUPrior: TAction;
|
||||||
|
actOpen: TAction;
|
||||||
|
actOpenDFM: TAction;
|
||||||
actOpenDFMProperties: TAction;
|
actOpenDFMProperties: TAction;
|
||||||
actOpenFolder: TAction;
|
actOpenFolder: TAction;
|
||||||
actOpenProperties: TAction;
|
actOpenProperties: TAction;
|
||||||
@ -65,6 +67,8 @@ type
|
|||||||
lblSubFilters: TLabel;
|
lblSubFilters: TLabel;
|
||||||
lstUnits: TListBox;
|
lstUnits: TListBox;
|
||||||
pmnUnits: TPopupMenu;
|
pmnUnits: TPopupMenu;
|
||||||
|
pmnUnitsOpen: TMenuItem;
|
||||||
|
pmnUnitsOpenDFM: TMenuItem;
|
||||||
pmnUnitsOpenDFMProperties: TMenuItem;
|
pmnUnitsOpenDFMProperties: TMenuItem;
|
||||||
pmnUnitsOpenFolder: TMenuItem;
|
pmnUnitsOpenFolder: TMenuItem;
|
||||||
pmnUnitsOpenProperties: TMenuItem;
|
pmnUnitsOpenProperties: TMenuItem;
|
||||||
@ -74,6 +78,7 @@ type
|
|||||||
pmnUnitsSep1: TMenuItem;
|
pmnUnitsSep1: TMenuItem;
|
||||||
pmnUnitsSep2: TMenuItem;
|
pmnUnitsSep2: TMenuItem;
|
||||||
pmnUnitsSep3: TMenuItem;
|
pmnUnitsSep3: TMenuItem;
|
||||||
|
pmnUnitsSep4: TMenuItem;
|
||||||
pmnUnitsSortByName: TMenuItem;
|
pmnUnitsSortByName: TMenuItem;
|
||||||
pmnUnitsSortByType: TMenuItem;
|
pmnUnitsSortByType: TMenuItem;
|
||||||
pnlButtons: TPanel;
|
pnlButtons: TPanel;
|
||||||
@ -104,6 +109,9 @@ type
|
|||||||
procedure lstUnitsMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
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);
|
||||||
|
procedure actOpenExecute(Sender: TObject);
|
||||||
|
procedure actOpenDFMExecute(Sender: TObject);
|
||||||
|
procedure btnOKClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
FLoading: Boolean;
|
FLoading: Boolean;
|
||||||
FUnitList: TUnSwUnitList;
|
FUnitList: TUnSwUnitList;
|
||||||
@ -112,6 +120,7 @@ type
|
|||||||
FMRUList: TStrings;
|
FMRUList: TStrings;
|
||||||
FMRUIndex: Integer;
|
FMRUIndex: Integer;
|
||||||
FSubFilters: TStringList;
|
FSubFilters: TStringList;
|
||||||
|
FOpenDFM: Boolean;
|
||||||
|
|
||||||
FTypeFilteredList: TUnSwUnitList;
|
FTypeFilteredList: TUnSwUnitList;
|
||||||
FSubFilteredList: TUnSwUnitList;
|
FSubFilteredList: TUnSwUnitList;
|
||||||
@ -142,6 +151,7 @@ type
|
|||||||
public
|
public
|
||||||
class function Execute(const AUnits: TUnSwUnitList;
|
class function Execute(const AUnits: TUnSwUnitList;
|
||||||
const AFormsOnly: Boolean;
|
const AFormsOnly: Boolean;
|
||||||
|
out AOpenDFM: Boolean;
|
||||||
const AActive: TUnSwUnit = nil): TUnSwUnitList;
|
const AActive: TUnSwUnit = nil): TUnSwUnitList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -409,6 +419,7 @@ end;
|
|||||||
{ TfrmUnSwDialog }
|
{ TfrmUnSwDialog }
|
||||||
class function TfrmUnSwDialog.Execute(const AUnits: TUnSwUnitList;
|
class function TfrmUnSwDialog.Execute(const AUnits: TUnSwUnitList;
|
||||||
const AFormsOnly: Boolean;
|
const AFormsOnly: Boolean;
|
||||||
|
out AOpenDFM: Boolean;
|
||||||
const AActive: TUnSwUnit): TUnSwUnitList;
|
const AActive: TUnSwUnit): TUnSwUnitList;
|
||||||
begin
|
begin
|
||||||
with Self.Create(nil) do
|
with Self.Create(nil) do
|
||||||
@ -416,7 +427,9 @@ begin
|
|||||||
FUnitList := AUnits;
|
FUnitList := AUnits;
|
||||||
FActiveUnit := AActive;
|
FActiveUnit := AActive;
|
||||||
FFormsOnly := AFormsOnly;
|
FFormsOnly := AFormsOnly;
|
||||||
|
|
||||||
Result := InternalExecute();
|
Result := InternalExecute();
|
||||||
|
AOpenDFM := FOpenDFM;
|
||||||
finally
|
finally
|
||||||
Free();
|
Free();
|
||||||
end;
|
end;
|
||||||
@ -773,6 +786,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
Result := TUnSwUnitList.Create();
|
Result := TUnSwUnitList.Create();
|
||||||
Result.OwnsObjects := False;
|
Result.OwnsObjects := False;
|
||||||
|
|
||||||
for itemIndex := 0 to Pred(lstUnits.Items.Count) do
|
for itemIndex := 0 to Pred(lstUnits.Items.Count) do
|
||||||
if lstUnits.Selected[itemIndex] then
|
if lstUnits.Selected[itemIndex] then
|
||||||
Result.Add(FInputFilteredList[itemIndex]);
|
Result.Add(FInputFilteredList[itemIndex]);
|
||||||
@ -1108,4 +1122,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmUnSwDialog.actOpenExecute(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FOpenDFM := False;
|
||||||
|
ModalResult := mrOk;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmUnSwDialog.actOpenDFMExecute(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FOpenDFM := True;
|
||||||
|
ModalResult := mrOk;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmUnSwDialog.btnOKClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FOpenDFM := ((GetKeyState(VK_SHIFT) and 128) <> 0);
|
||||||
|
ModalResult := mrOk;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -8,10 +8,12 @@ unit UnSwFilters;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
uses
|
uses
|
||||||
|
Classes,
|
||||||
|
|
||||||
UnSwObjects;
|
UnSwObjects;
|
||||||
|
|
||||||
type
|
type
|
||||||
TUnSwUnitFilter = class(TUnSwNoRefIntfObject, IUnSwVisitor)
|
TUnSwUnitFilter = class(TInterfacedPersistent, IUnSwVisitor)
|
||||||
private
|
private
|
||||||
FList: TUnSwUnitList;
|
FList: TUnSwUnitList;
|
||||||
protected
|
protected
|
||||||
|
@ -33,26 +33,19 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
TUnSwNoRefIntfObject = class(TPersistent, IInterface)
|
TUnSwActivateType = (atForm, atSource, atDFM);
|
||||||
protected
|
|
||||||
// IInterface
|
|
||||||
function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
|
|
||||||
function _AddRef(): Integer; stdcall;
|
|
||||||
function _Release(): Integer; stdcall;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
TUnSwUnit = class(TInterfacedPersistent, IUnSwVisited)
|
||||||
TUnSwUnit = class(TUnSwNoRefIntfObject, IUnSwVisited)
|
|
||||||
protected
|
protected
|
||||||
function GetName(): String; virtual;
|
function GetName(): String; virtual;
|
||||||
function GetFileName(): String; virtual;
|
function GetFileName(): String; virtual;
|
||||||
|
|
||||||
procedure OpenModule(const AModule: IOTAModule; const ASource: Boolean); virtual;
|
procedure OpenModule(const AModule: IOTAModule; const AType: TUnSwActivateType); virtual;
|
||||||
public
|
public
|
||||||
// IUnSwVisited
|
// IUnSwVisited
|
||||||
procedure AcceptVisitor(const AVisitor: IUnSwVisitor); virtual; abstract;
|
procedure AcceptVisitor(const AVisitor: IUnSwVisitor); virtual; abstract;
|
||||||
|
|
||||||
procedure Activate(const ASource: Boolean); virtual; abstract;
|
procedure Activate(const AType: TUnSwActivateType); virtual; abstract;
|
||||||
|
|
||||||
property Name: String read GetName;
|
property Name: String read GetName;
|
||||||
property FileName: String read GetFileName;
|
property FileName: String read GetFileName;
|
||||||
@ -91,7 +84,7 @@ type
|
|||||||
constructor Create(const AModule: IOTAModuleInfo);
|
constructor Create(const AModule: IOTAModuleInfo);
|
||||||
procedure AcceptVisitor(const AVisitor: IUnSwVisitor); override;
|
procedure AcceptVisitor(const AVisitor: IUnSwVisitor); override;
|
||||||
|
|
||||||
procedure Activate(const ASource: Boolean); override;
|
procedure Activate(const AType: TUnSwActivateType); override;
|
||||||
|
|
||||||
property FormName: String read GetFormName;
|
property FormName: String read GetFormName;
|
||||||
property UnitType: TUnSwUnitType read GetUnitType;
|
property UnitType: TUnSwUnitType read GetUnitType;
|
||||||
@ -107,11 +100,11 @@ type
|
|||||||
constructor Create(const AProject: IOTAProject);
|
constructor Create(const AProject: IOTAProject);
|
||||||
procedure AcceptVisitor(const AVisitor: IUnSwVisitor); override;
|
procedure AcceptVisitor(const AVisitor: IUnSwVisitor); override;
|
||||||
|
|
||||||
procedure Activate(const ASource: Boolean); override;
|
procedure Activate(const AType: TUnSwActivateType); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
TUnSwUnitList = class(TUnSwNoRefIntfObject, IUnSwVisited)
|
TUnSwUnitList = class(TInterfacedPersistent, IUnSwVisited)
|
||||||
private
|
private
|
||||||
FItems: TObjectList;
|
FItems: TObjectList;
|
||||||
|
|
||||||
@ -151,25 +144,6 @@ uses
|
|||||||
SysUtils;
|
SysUtils;
|
||||||
|
|
||||||
|
|
||||||
{ TUnSwNoRefIntfObject }
|
|
||||||
function TUnSwNoRefIntfObject.QueryInterface(const IID: TGUID; out Obj): HResult;
|
|
||||||
begin
|
|
||||||
if GetInterface(IID, Obj) then
|
|
||||||
Result := S_OK
|
|
||||||
else
|
|
||||||
Result := E_NOINTERFACE;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TUnSwNoRefIntfObject._AddRef(): Integer;
|
|
||||||
begin
|
|
||||||
Result := -1;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TUnSwNoRefIntfObject._Release(): Integer;
|
|
||||||
begin
|
|
||||||
Result := -1;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{ TUnSwUnit }
|
{ TUnSwUnit }
|
||||||
function TUnSwUnit.GetName(): String;
|
function TUnSwUnit.GetName(): String;
|
||||||
@ -183,7 +157,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TUnSwUnit.OpenModule(const AModule: IOTAModule; const ASource: Boolean);
|
procedure TUnSwUnit.OpenModule(const AModule: IOTAModule; const AType: TUnSwActivateType);
|
||||||
var
|
var
|
||||||
editor: IOTAEditor;
|
editor: IOTAEditor;
|
||||||
formEditor: IOTAFormEditor;
|
formEditor: IOTAFormEditor;
|
||||||
@ -191,17 +165,19 @@ var
|
|||||||
moduleIndex: Integer;
|
moduleIndex: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
Assert(AType <> atDFM, 'atDFM can not be handled by the OpenModule method');
|
||||||
|
|
||||||
formEditor := nil;
|
formEditor := nil;
|
||||||
for moduleIndex := 0 to Pred(AModule.ModuleFileCount) do
|
for moduleIndex := 0 to Pred(AModule.ModuleFileCount) do
|
||||||
begin
|
begin
|
||||||
editor := AModule.ModuleFileEditors[moduleIndex];
|
editor := AModule.ModuleFileEditors[moduleIndex];
|
||||||
isForm := Supports(editor, IOTAFormEditor);
|
isForm := Supports(editor, IOTAFormEditor);
|
||||||
|
|
||||||
if (not ASource) and (isForm) and (not Assigned(formEditor)) then
|
if (AType = atForm) and isForm and (not Assigned(formEditor)) then
|
||||||
formEditor := (editor as IOTAFormEditor);
|
formEditor := (editor as IOTAFormEditor);
|
||||||
|
|
||||||
if not isForm then
|
if not isForm then
|
||||||
editor.Show();
|
editor.Show;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if Assigned(formEditor) then
|
if Assigned(formEditor) then
|
||||||
@ -217,14 +193,33 @@ begin
|
|||||||
FModule := AModule;
|
FModule := AModule;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TUnSwModuleUnit.Activate(const ASource: Boolean);
|
procedure TUnSwModuleUnit.Activate(const AType: TUnSwActivateType);
|
||||||
var
|
var
|
||||||
|
dfmFile: string;
|
||||||
ifModule: IOTAModule;
|
ifModule: IOTAModule;
|
||||||
|
handled: Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
handled := False;
|
||||||
|
|
||||||
|
{ Don't use OpenModule for DFM files; can't have a reference to the
|
||||||
|
IOTAModule or there'll be errors all over the place. }
|
||||||
|
if AType = atDFM then
|
||||||
|
begin
|
||||||
|
dfmFile := ChangeFileExt(FModule.FileName, '.dfm');
|
||||||
|
if FileExists(dfmFile) then
|
||||||
|
begin
|
||||||
|
(BorlandIDEServices as IOTAActionServices).OpenFile(dfmFile);
|
||||||
|
handled := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if not handled then
|
||||||
|
begin
|
||||||
ifModule := FModule.OpenModule();
|
ifModule := FModule.OpenModule();
|
||||||
if Assigned(ifModule) then
|
if Assigned(ifModule) then
|
||||||
OpenModule(ifModule, ASource);
|
OpenModule(ifModule, AType);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TUnSwModuleUnit.AcceptVisitor(const AVisitor: IUnSwVisitor);
|
procedure TUnSwModuleUnit.AcceptVisitor(const AVisitor: IUnSwVisitor);
|
||||||
@ -270,7 +265,7 @@ begin
|
|||||||
FProject := AProject;
|
FProject := AProject;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TUnSwProjectUnit.Activate(const ASource: Boolean);
|
procedure TUnSwProjectUnit.Activate(const AType: TUnSwActivateType);
|
||||||
{$IFDEF DELPHI7ORLOWER}
|
{$IFDEF DELPHI7ORLOWER}
|
||||||
var
|
var
|
||||||
actionIndex: Integer;
|
actionIndex: Integer;
|
||||||
|
@ -91,6 +91,8 @@ type
|
|||||||
property AllowEmptyResult: Boolean read FAllowEmptyResults write FAllowEmptyResults;
|
property AllowEmptyResult: Boolean read FAllowEmptyResults write FAllowEmptyResults;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
TUnSwResetSetting = (rsColors, rsFilter, rsForms, rsUnits);
|
||||||
|
TUnSwResetSettings = set of TUnSwResetSetting;
|
||||||
|
|
||||||
TUnSwSettings = class(TObject)
|
TUnSwSettings = class(TObject)
|
||||||
private
|
private
|
||||||
@ -106,7 +108,7 @@ type
|
|||||||
constructor Create();
|
constructor Create();
|
||||||
destructor Destroy(); override;
|
destructor Destroy(); override;
|
||||||
|
|
||||||
procedure ResetDefaults(const AColorsOnly: Boolean = False);
|
procedure ResetDefaults(const ASettings: TUnSwResetSettings = [rsColors, rsFilter]);
|
||||||
procedure Save();
|
procedure Save();
|
||||||
|
|
||||||
property Colors: TUnSwColorSettings read FColors write FColors;
|
property Colors: TUnSwColorSettings read FColors write FColors;
|
||||||
@ -352,7 +354,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TUnSwSettings.ResetDefaults(const AColorsOnly: Boolean);
|
procedure TUnSwSettings.ResetDefaults(const ASettings: TUnSwResetSettings);
|
||||||
|
|
||||||
procedure ResetDialog(const ADialog: TUnSwDialogSettings);
|
procedure ResetDialog(const ADialog: TUnSwDialogSettings);
|
||||||
begin
|
begin
|
||||||
@ -367,18 +369,22 @@ procedure TUnSwSettings.ResetDefaults(const AColorsOnly: Boolean);
|
|||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if not AColorsOnly then
|
if rsForms in ASettings then
|
||||||
begin
|
|
||||||
ResetDialog(FFormsDialog);
|
ResetDialog(FFormsDialog);
|
||||||
ResetDialog(FUnitsDialog);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
if rsUnits in ASettings then
|
||||||
|
ResetDialog(FUnitsDialog);
|
||||||
|
|
||||||
|
if rsColors in ASettings then
|
||||||
|
begin
|
||||||
FColors.Enabled := True;
|
FColors.Enabled := True;
|
||||||
FColors.DataModules := RGB( 35, 120, 35); // Green
|
FColors.DataModules := RGB( 35, 120, 35); // Green
|
||||||
FColors.Forms := RGB( 50, 70, 120); // Blue
|
FColors.Forms := RGB( 50, 70, 120); // Blue
|
||||||
FColors.ProjectSource := RGB(120, 120, 35); // Yellow
|
FColors.ProjectSource := RGB(120, 120, 35); // Yellow
|
||||||
FColors.Units := RGB(150, 35, 35); // Red
|
FColors.Units := RGB(150, 35, 35); // Red
|
||||||
|
end;
|
||||||
|
|
||||||
|
if rsFilter in ASettings then
|
||||||
FFilter.AllowEmptyResult := False;
|
FFilter.AllowEmptyResult := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user