mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 08:09:26 +02:00
fixed TAnchorSide.Side default value
git-svn-id: trunk@7650 -
This commit is contained in:
parent
b7c4f58fbd
commit
9d59986db5
@ -2098,6 +2098,7 @@ var
|
||||
ReadValue(DirDef,copy(CurValue,MacroFuncNameEnd+1
|
||||
,MacroEnd-MacroFuncNameEnd-2),CurDefinePath,MacroParam);
|
||||
// execute the macro function
|
||||
//debugln('Substitute MacroFuncName="',MacroFuncName,'" MacroParam="',MacroParam,'"');
|
||||
MacroStr:=ExecuteMacroFunction(MacroFuncName,MacroParam);
|
||||
end else begin
|
||||
// Macro variable
|
||||
@ -2147,9 +2148,11 @@ var
|
||||
inc(BufferPos,RestLen);
|
||||
end;
|
||||
// copy the buffer into NewValue
|
||||
//DebugLn(' [ReadValue] Old="',copy(NewValue,1,100),'"');
|
||||
SetLength(NewValue,BufferPos);
|
||||
if BufferPos>0 then
|
||||
Move(Buffer^,NewValue[1],BufferPos);
|
||||
//DebugLn(' [ReadValue] New="',copy(NewValue,1,100),'"');
|
||||
// clean up
|
||||
FreeMem(Buffer);
|
||||
Buffer:=nil;
|
||||
@ -2158,7 +2161,7 @@ var
|
||||
var MacroStart,MacroEnd: integer;
|
||||
ValueLen: Integer;
|
||||
begin
|
||||
// DebugLn(' [ReadValue] A "',PreValue,'"');
|
||||
// DebugLn(' [ReadValue] A "',copy(PreValue,1,100),'"');
|
||||
NewValue:=PreValue;
|
||||
if NewValue='' then exit;
|
||||
MacroStart:=1;
|
||||
@ -2187,7 +2190,6 @@ begin
|
||||
MacroStart:=MacroEnd;
|
||||
end;
|
||||
if Buffer<>nil then SetNewValue;
|
||||
// DebugLn(' [ReadValue] END "',NewValue,'"');
|
||||
end;
|
||||
|
||||
procedure TDefineTree.MarkTemplatesOwnedBy(TheOwner: TObject; const MustFlags,
|
||||
|
@ -280,7 +280,8 @@ type
|
||||
procedure Clear; override;
|
||||
procedure Delete(Index: Integer); override;
|
||||
constructor Create(const AName, ADescription: string;
|
||||
TheAreas: TCommandAreas);
|
||||
{$IFDEF UseIDEScopes}TheScope: TIDECommandScope
|
||||
{$ELSE}TheAreas: TCommandAreas{$ENDIF});
|
||||
end;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -303,7 +304,8 @@ type
|
||||
function GetRelation(Index:integer):TKeyCommandRelation;
|
||||
function GetRelationCount:integer;
|
||||
function AddCategory(const Name, Description: string;
|
||||
TheAreas: TCommandAreas): integer;
|
||||
{$IFDEF UseIDEScopes}TheScope: TIDECommandScope
|
||||
{$ELSE}TheAreas: TCommandAreas{$ENDIF}): integer;
|
||||
function Add(Category: TKeyCommandCategory; const Name: string;
|
||||
Command:word; const TheKeyA, TheKeyB: TIDEShortCut):integer;
|
||||
function AddDefault(Category: TKeyCommandCategory; const Name: string;
|
||||
@ -317,16 +319,22 @@ type
|
||||
procedure Clear;
|
||||
function Count: integer;
|
||||
function CategoryCount: integer;
|
||||
function Find(Key: TIDEShortCut; Areas: TCommandAreas): TKeyCommandRelation;
|
||||
function Find(Key: TIDEShortCut;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF}
|
||||
): TKeyCommandRelation;
|
||||
function FindByCommand(ACommand:word): TKeyCommandRelation;
|
||||
function FindCategoryByName(const CategoryName: string): TKeyCommandCategory;
|
||||
function TranslateKey(Key: word; Shift: TShiftState; Areas: TCommandAreas): word;
|
||||
function TranslateKey(Key: word; Shift: TShiftState;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF};
|
||||
UseLastKey: boolean = true
|
||||
): word;
|
||||
function IndexOf(ARelation: TKeyCommandRelation): integer;
|
||||
function CommandToShortCut(ACommand: word): TShortCut;
|
||||
function LoadFromXMLConfig(XMLConfig:TXMLConfig; const Prefix: String):boolean;
|
||||
function SaveToXMLConfig(XMLConfig:TXMLConfig; const Prefix: String):boolean;
|
||||
procedure AssignTo(ASynEditKeyStrokes:TSynEditKeyStrokes;
|
||||
Areas: TCommandAreas);
|
||||
procedure AssignTo(ASynEditKeyStrokes:TSynEditKeyStrokes;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm
|
||||
{$ELSE}Areas: TCommandAreas{$ENDIF});
|
||||
procedure Assign(List: TKeyCommandRelationList);
|
||||
procedure LoadScheme(const SchemeName: string);
|
||||
public
|
||||
@ -364,7 +372,9 @@ type
|
||||
procedure ActivateGrabbing(AGrabbingKey: integer);
|
||||
procedure DeactivateGrabbing;
|
||||
procedure SetComboBox(AComboBox: TComboBox; const AValue: string);
|
||||
function ResolveConflicts(Key: TIDEShortCut; Areas: TCommandAreas): boolean;
|
||||
function ResolveConflicts(Key: TIDEShortCut;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF}
|
||||
): boolean;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
KeyCommandRelationList:TKeyCommandRelationList;
|
||||
@ -2044,7 +2054,8 @@ begin
|
||||
end;
|
||||
|
||||
function TKeyMappingEditForm.ResolveConflicts(Key: TIDEShortCut;
|
||||
Areas: TCommandAreas): boolean;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF}
|
||||
): boolean;
|
||||
var
|
||||
ConflictRelation: TKeyCommandRelation;
|
||||
ConflictName: String;
|
||||
@ -2747,14 +2758,19 @@ begin
|
||||
end;
|
||||
|
||||
function TKeyCommandRelationList.Find(Key: TIDEShortCut;
|
||||
Areas: TCommandAreas):TKeyCommandRelation;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF}
|
||||
): TKeyCommandRelation;
|
||||
var
|
||||
a:integer;
|
||||
begin
|
||||
Result:=nil;
|
||||
if Key.Key1=VK_UNKNOWN then exit;
|
||||
for a:=0 to FRelations.Count-1 do with Relations[a] do begin
|
||||
{$IFDEF UseIDEScopes}
|
||||
if not Category.Scope.HasIDEWindow(IDEWindow) then continue;
|
||||
{$ELSE}
|
||||
if Category.Areas*Areas=[] then continue;
|
||||
{$ENDIF}
|
||||
if ((KeyA.Key1=Key.Key1) and (KeyA.Shift1=Key.Shift1) and
|
||||
(KeyA.Key2=Key.Key2) and (KeyA.Shift2=Key.Shift2))
|
||||
or ((KeyB.Key1=Key.Key1) and (KeyB.Shift1=Key.Shift1) and
|
||||
@ -2779,7 +2795,9 @@ begin
|
||||
end;
|
||||
|
||||
procedure TKeyCommandRelationList.AssignTo(
|
||||
ASynEditKeyStrokes:TSynEditKeyStrokes; Areas: TCommandAreas);
|
||||
ASynEditKeyStrokes:TSynEditKeyStrokes;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF}
|
||||
);
|
||||
var
|
||||
a,b,MaxKeyCnt,KeyCnt:integer;
|
||||
Key: TSynEditKeyStroke;
|
||||
@ -2900,9 +2918,11 @@ begin
|
||||
end;
|
||||
|
||||
function TKeyCommandRelationList.AddCategory(const Name, Description: string;
|
||||
TheAreas: TCommandAreas): integer;
|
||||
{$IFDEF UseIDEScopes}TheScope: TIDECommandScope
|
||||
{$ELSE}TheAreas: TCommandAreas{$ENDIF}): integer;
|
||||
begin
|
||||
Result:=fCategories.Add(TKeyCommandCategory.Create(Name,Description,TheAreas));
|
||||
Result:=fCategories.Add(TKeyCommandCategory.Create(Name,Description,
|
||||
{$IFDEF UseIDEScopes}TheScope{$ELSE}TheAreas{$ENDIF}));
|
||||
end;
|
||||
|
||||
function TKeyCommandRelationList.FindCategoryByName(const CategoryName: string
|
||||
@ -2917,23 +2937,40 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
function TKeyCommandRelationList.TranslateKey(Key: word; Shift: TShiftState; Areas: TCommandAreas): word;
|
||||
function TKeyCommandRelationList.TranslateKey(Key: word; Shift: TShiftState;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF};
|
||||
UseLastKey: boolean
|
||||
): word;
|
||||
{ If UseLastKey = true then only search for commmands with one key.
|
||||
If UseLastKey = false then search first for a command with a two keys
|
||||
combination (i.e. the last key plus this one)
|
||||
and then for a command with one key.
|
||||
If no command was found the key is stored in fLastKey.Key1.
|
||||
}
|
||||
var
|
||||
ARelation: TKeyCommandRelation;
|
||||
begin
|
||||
fLastKey.Key2 := Key;
|
||||
fLastKey.Shift2 := Shift;
|
||||
ARelation := Find(fLastKey, Areas);
|
||||
if UseLastKey and (fLastKey.Key1<>VK_UNKNOWN) then begin
|
||||
// the last key had no command
|
||||
// => try a two key combination command
|
||||
fLastKey.Key2 := Key;
|
||||
fLastKey.Shift2 := Shift;
|
||||
ARelation := Find(fLastKey,{$IFDEF UseIDEScopes}IDEWindow{$ELSE}Areas{$ENDIF});
|
||||
end else begin
|
||||
ARelation := nil;
|
||||
end;
|
||||
if ARelation = nil then
|
||||
begin
|
||||
// search for a one key command
|
||||
fLastKey.Key1 := Key;
|
||||
fLastKey.Shift1 := Shift;
|
||||
fLastKey.Key2 := VK_UNKNOWN;
|
||||
fLastKey.Shift2 := [];
|
||||
ARelation := Find(fLastKey, Areas);
|
||||
ARelation := Find(fLastKey,{$IFDEF UseIDEScopes}IDEWindow{$ELSE}Areas{$ENDIF});
|
||||
end;
|
||||
if ARelation<>nil then
|
||||
begin
|
||||
// the key has a command -> key was used => clear fLastKey
|
||||
fLastKey.Key1 := VK_UNKNOWN;
|
||||
fLastKey.Shift1 := [];
|
||||
fLastKey.Key2 := VK_UNKNOWN;
|
||||
@ -2944,7 +2981,8 @@ begin
|
||||
Result:=ecNone;
|
||||
end;
|
||||
|
||||
function TKeyCommandRelationList.IndexOf(ARelation: TKeyCommandRelation): integer;
|
||||
function TKeyCommandRelationList.IndexOf(ARelation: TKeyCommandRelation
|
||||
): integer;
|
||||
begin
|
||||
Result:=fRelations.IndexOf(ARelation);
|
||||
end;
|
||||
@ -2976,12 +3014,17 @@ begin
|
||||
end;
|
||||
|
||||
constructor TKeyCommandCategory.Create(const AName, ADescription: string;
|
||||
TheAreas: TCommandAreas);
|
||||
{$IFDEF UseIDEScopes}TheScope: TIDECommandScope
|
||||
{$ELSE}TheAreas: TCommandAreas{$ENDIF});
|
||||
begin
|
||||
inherited Create;
|
||||
FName:=AName;
|
||||
FDescription:=ADescription;
|
||||
{$IFDEF UseIDEScopes}
|
||||
FScope:=TheScope;
|
||||
{$ELSE}
|
||||
FAreas:=TheAreas;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
||||
|
@ -97,6 +97,7 @@ resourcestring
|
||||
lisProjectIncPath = 'Project Include Path';
|
||||
lisProjectSrcPath = 'Project Src Path';
|
||||
lisMakeExe = 'Make Executable';
|
||||
lisProjectMakroProperties = 'Project makro properties';
|
||||
lisConfigDirectory = 'Lazarus config directory';
|
||||
|
||||
// main bar menu
|
||||
|
54
ide/main.pp
54
ide/main.pp
@ -288,7 +288,9 @@ type
|
||||
procedure OnProcessIDECommand(Sender: TObject; Command: word;
|
||||
var Handled: boolean);
|
||||
procedure OnExecuteIDEShortCut(Sender: TObject;
|
||||
var Key: word; Shift: TShiftState; Areas: TCommandAreas);
|
||||
var Key: word; Shift: TShiftState;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm
|
||||
{$ELSE}TheAreas: TCommandAreas{$ENDIF});
|
||||
procedure OnExecuteIDECommand(Sender: TObject; Command: word);
|
||||
|
||||
// Environment options dialog events
|
||||
@ -771,13 +773,14 @@ type
|
||||
function IsTestUnitFilename(const AFilename: string): boolean; override;
|
||||
function GetRunCommandLine: string; override;
|
||||
function GetProjPublishDir: string;
|
||||
procedure OnMacroSubstitution(TheMacro: TTransferMacro; var s:string;
|
||||
procedure OnMacroSubstitution(TheMacro: TTransferMacro; var s: string;
|
||||
var Handled, Abort: boolean);
|
||||
function OnSubstituteCompilerOption(Options: TParsedCompilerOptions;
|
||||
const UnparsedValue: string): string;
|
||||
function OnMacroPromptFunction(const s:string; var Abort: boolean):string;
|
||||
function OnMacroFuncMakeExe(const Filename:string; var Abort: boolean):string;
|
||||
procedure OnCmdLineCreate(var CmdLine: string; var Abort:boolean);
|
||||
function OnMacroPromptFunction(const s:string; var Abort: boolean): string;
|
||||
function OnMacroFuncMakeExe(const Filename:string; var Abort: boolean): string;
|
||||
function OnMacroFuncProject(const Param: string; var Abort: boolean): string;
|
||||
procedure OnCmdLineCreate(var CmdLine: string; var Abort: boolean);
|
||||
procedure GetIDEFileState(Sender: TObject; const AFilename: string;
|
||||
NeededFlags: TIDEFileStateFlags; var ResultFlags: TIDEFileStateFlags); override;
|
||||
|
||||
@ -1528,6 +1531,8 @@ begin
|
||||
lisProjectSrcPath,nil,[]));
|
||||
MacroList.Add(TTransferMacro.Create('MakeExe','',
|
||||
lisMakeExe,@OnMacroFuncMakeExe,[]));
|
||||
MacroList.Add(TTransferMacro.Create('Project','',
|
||||
lisProjectMakroProperties,@OnMacroFuncProject,[]));
|
||||
|
||||
MacroList.OnSubstitution:=@OnMacroSubstitution;
|
||||
CompilerOptions.OnParseString:=@OnSubstituteCompilerOption;
|
||||
@ -2368,7 +2373,8 @@ begin
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnExecuteIDEShortCut(Sender: TObject; var Key: word;
|
||||
Shift: TShiftState; Areas: TCommandAreas);
|
||||
Shift: TShiftState;
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}TheAreas: TCommandAreas{$ENDIF});
|
||||
var
|
||||
// CommandRelation: TKeyCommandRelation;
|
||||
// Handled: Boolean;
|
||||
@ -2381,7 +2387,7 @@ begin
|
||||
// OnProcessIDECommand(Sender,CommandRelation.Command,Handled);
|
||||
// if Handled then Key:=VK_UNKNOWN;
|
||||
//debugln('TMainIDE.OnExecuteIDEShortCut Key '+dbgs(Key)+' pressed');
|
||||
Command := EditorOpts.KeyMap.TranslateKey(Key,Shift,Areas);
|
||||
Command := EditorOpts.KeyMap.TranslateKey(Key,Shift,{$IFDEF UseIDEScopes}IDEWindow{$ELSE}TheAreas{$ENDIF});
|
||||
if (Command = ecNone) then exit;
|
||||
Handled := false;
|
||||
OnProcessIDECommand(Sender, Command, Handled);
|
||||
@ -6234,7 +6240,7 @@ begin
|
||||
if Project1.MainUnitID>=0 then begin
|
||||
// read MainUnit Source
|
||||
Result:=LoadCodeBuffer(NewBuf,Project1.MainFilename,
|
||||
[lbfUpdateFromDisk,lbfRevert,lbfCheckIfText]);
|
||||
[lbfUpdateFromDisk,lbfRevert,lbfCheckIfText]);
|
||||
if Result=mrIgnore then Result:=mrAbort;
|
||||
if Result=mrAbort then exit;
|
||||
Project1.MainUnitInfo.Source:=NewBuf;
|
||||
@ -8650,6 +8656,25 @@ begin
|
||||
DebugLn('TMainIDE.OnMacroFuncMakeExe A ',Filename,' ',Result);
|
||||
end;
|
||||
|
||||
function TMainIDE.OnMacroFuncProject(const Param: string; var Abort: boolean
|
||||
): string;
|
||||
begin
|
||||
if Project1<>nil then begin
|
||||
if CompareText(Param,'SrcPath')=0 then
|
||||
Result:=Project1.CompilerOptions.GetSrcPath(false)
|
||||
else if CompareText(Param,'IncPath')=0 then
|
||||
Result:=Project1.CompilerOptions.GetIncludePath(false)
|
||||
else if CompareText(Param,'UnitPath')=0 then
|
||||
Result:=Project1.CompilerOptions.GetUnitPath(false)
|
||||
else begin
|
||||
Result:='<Invalid parameter for makro Project:'+Param+'>';
|
||||
debugln('WARNING: TMainIDE.OnMacroFuncProject: ',Result);
|
||||
end;
|
||||
end else begin
|
||||
Result:='';
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnCmdLineCreate(var CmdLine: string; var Abort:boolean);
|
||||
// replace all transfer macros in command line
|
||||
begin
|
||||
@ -9944,14 +9969,17 @@ begin
|
||||
if Project1=nil then exit;
|
||||
FuncData:=PReadFunctionData(Data);
|
||||
Param:=FuncData^.Param;
|
||||
if AnsiCompareText(Param,'SrcPath')=0 then
|
||||
debugln('TMainIDE.MacroFunctionProject A Param="',Param,'"');
|
||||
if CompareText(Param,'SrcPath')=0 then
|
||||
FuncData^.Result:=Project1.CompilerOptions.GetSrcPath(false)
|
||||
else if AnsiCompareText(Param,'IncPath')=0 then
|
||||
else if CompareText(Param,'IncPath')=0 then
|
||||
FuncData^.Result:=Project1.CompilerOptions.GetIncludePath(false)
|
||||
else if AnsiCompareText(Param,'UnitPath')=0 then
|
||||
else if CompareText(Param,'UnitPath')=0 then
|
||||
FuncData^.Result:=Project1.CompilerOptions.GetUnitPath(false)
|
||||
else
|
||||
FuncData^.Result:='';
|
||||
else begin
|
||||
FuncData^.Result:='<unknown parameter for CodeTools Makro project:"'+Param+'">';
|
||||
debugln('TMainIDE.MacroFunctionProject WARNING: ',FuncData^.Result);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.OnCompilerGraphStampIncreased;
|
||||
|
@ -413,7 +413,6 @@ type
|
||||
CheckIfAllowed: boolean; var Allowed: boolean);
|
||||
procedure SetAutoOpenDesignerFormsDisabled(const AValue: boolean);
|
||||
procedure SetCompilerOptions(const AValue: TProjectCompilerOptions);
|
||||
procedure SetModified(const AValue: boolean);
|
||||
procedure SetTargetFilename(const NewTargetFilename: string);
|
||||
procedure SetUnits(Index:integer; AUnitInfo: TUnitInfo);
|
||||
procedure SetMainUnitID(const AValue: Integer);
|
||||
@ -427,6 +426,7 @@ type
|
||||
procedure SetFlags(const AValue: TProjectFlags); override;
|
||||
function GetProjectInfoFile: string; override;
|
||||
procedure SetProjectInfoFile(const NewFilename: string); override;
|
||||
procedure SetModified(const AValue: boolean); override;
|
||||
protected
|
||||
// special unit lists
|
||||
procedure AddToList(AnUnitInfo: TUnitInfo; ListType: TUnitInfoList);
|
||||
@ -567,7 +567,6 @@ type
|
||||
property MainFilename: String read GetMainFilename;
|
||||
property MainUnitID: Integer read FMainUnitID write SetMainUnitID;
|
||||
property MainUnitInfo: TUnitInfo read GetMainUnitInfo;
|
||||
property Modified: boolean read fModified write SetModified;
|
||||
property OnBeginUpdate: TNotifyEvent read FOnBeginUpdate write FOnBeginUpdate;
|
||||
property OnEndUpdate: TEndUpdateProjectEvent read FOnEndUpdate write FOnEndUpdate;
|
||||
property OnFileBackup: TOnFileBackup read fOnFileBackup write fOnFileBackup;
|
||||
@ -1781,8 +1780,8 @@ end;
|
||||
procedure TProject.SetModified(const AValue: boolean);
|
||||
begin
|
||||
if AValue=Modified then exit;
|
||||
fModified:=AValue;
|
||||
if not fModified then PublishOptions.Modified:=false;
|
||||
inherited SetModified(AValue);
|
||||
if not Modified then PublishOptions.Modified:=false;
|
||||
end;
|
||||
|
||||
procedure TProject.SetUnits(Index:integer; AUnitInfo: TUnitInfo);
|
||||
@ -2589,7 +2588,7 @@ end;
|
||||
function TProject.SomethingModified: boolean;
|
||||
var i: integer;
|
||||
begin
|
||||
Result:=Modified;
|
||||
Result:=Modified or SessionModified;
|
||||
for i:=0 to UnitCount-1 do Result:=Result or Units[i].Modified;
|
||||
Result:=Result or CompilerOptions.Modified;
|
||||
end;
|
||||
|
@ -46,7 +46,7 @@ unit TransferMacros;
|
||||
|
||||
interface
|
||||
|
||||
uses Classes, SysUtils, FileUtil, LazarusIDEStrConsts, MacroIntf;
|
||||
uses Classes, SysUtils, LCLProc, FileUtil, LazarusIDEStrConsts, MacroIntf;
|
||||
|
||||
type
|
||||
TTransferMacro = class;
|
||||
@ -217,6 +217,8 @@ begin
|
||||
if (m<fItems.Count) and (AnsiCompareText(NewMacro.Name,Items[m].Name)>0) then
|
||||
inc(m);
|
||||
fItems.Insert(m,NewMacro);
|
||||
//if NewMacro.MacroFunction<>nil then
|
||||
// debugln('TTransferMacroList.Add A ',NewMacro.Name);
|
||||
end;
|
||||
|
||||
function TTransferMacroList.SubstituteStr(var s:string): boolean;
|
||||
|
@ -27,7 +27,7 @@
|
||||
This is only to help the user find commands.
|
||||
|
||||
Scopes:
|
||||
Command can work globally or only in some IDE windows.
|
||||
A command can work globally or only in some IDE windows.
|
||||
For example: When the user presses a key in the source editor, the IDE
|
||||
first searches in all commands with the Scope IDECmdScopeSrcEdit.
|
||||
Then it will search in all commands without scope.
|
||||
@ -41,6 +41,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, Forms, LCLType, Menus, TextTools;
|
||||
|
||||
{$IFNDEF UseIDEScopes}
|
||||
type
|
||||
TCommandArea = (
|
||||
caMenu,
|
||||
@ -56,7 +57,7 @@ const
|
||||
caSrcEditOnly = [caSourceEditor];
|
||||
caDesign = [caMenu,caDesigner];
|
||||
caDesignOnly = [caDesigner];
|
||||
|
||||
{$ENDIF}
|
||||
|
||||
type
|
||||
TIDECommandKeys = class;
|
||||
@ -79,6 +80,7 @@ type
|
||||
function IDEWindowCount: integer;
|
||||
procedure AddCommand(ACommand: TIDECommandKeys);
|
||||
function CommandCount: integer;
|
||||
function HasIDEWindow(AnWindow: TCustomForm): boolean;
|
||||
public
|
||||
property Name: string read FName;
|
||||
property IDEWindows[Index: integer]: TCustomForm read GetIDEWindows;
|
||||
@ -120,7 +122,11 @@ type
|
||||
|
||||
TIDECommandCategory = class(TList)
|
||||
protected
|
||||
{$IFDEF UseIDEScopes}
|
||||
FScope: TIDECommandScope;
|
||||
{$ELSE}
|
||||
FAreas: TCommandAreas;
|
||||
{$ENDIF}
|
||||
FDescription: string;
|
||||
FName: string;
|
||||
FParent: TIDECommandCategory;
|
||||
@ -128,8 +134,12 @@ type
|
||||
property Name: string read FName;
|
||||
property Description: string read FDescription;
|
||||
property Parent: TIDECommandCategory read FParent;
|
||||
property Areas: TCommandAreas read FAreas;
|
||||
procedure Delete(Index: Integer); virtual;
|
||||
{$IFDEF UseIDEScopes}
|
||||
property Scope: TIDECommandScope read FScope write FScope;
|
||||
{$ELSE}
|
||||
property Areas: TCommandAreas read FAreas;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
||||
@ -175,7 +185,11 @@ function IDEShortCut(Key1: word; Shift1: TShiftState;
|
||||
type
|
||||
TExecuteIDEShortCut = procedure(Sender: TObject;
|
||||
var Key: word; Shift: TShiftState;
|
||||
Areas: TCommandAreas) of object;
|
||||
{$IFDEF UseIDEScopes}
|
||||
IDEWindow: TCustomForm
|
||||
{$ELSE}
|
||||
Areas: TCommandAreas
|
||||
{$ENDIF}) of object;
|
||||
TExecuteIDECommand = procedure(Sender: TObject; Command: word) of object;
|
||||
|
||||
var
|
||||
@ -183,7 +197,7 @@ var
|
||||
OnExecuteIDECommand: TExecuteIDECommand;
|
||||
|
||||
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState;
|
||||
Areas: TCommandAreas);
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF});
|
||||
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState);
|
||||
procedure ExecuteIDECommand(Sender: TObject; Command: word);
|
||||
|
||||
@ -214,10 +228,11 @@ begin
|
||||
end;
|
||||
|
||||
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState;
|
||||
Areas: TCommandAreas);
|
||||
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF});
|
||||
begin
|
||||
if (OnExecuteIDECommand<>nil) and (Key<>VK_UNKNOWN) then
|
||||
OnExecuteIDEShortCut(Sender,Key,Shift,Areas);
|
||||
OnExecuteIDEShortCut(Sender,Key,Shift,
|
||||
{$IFDEF UseIDEScopes}IDEWindow{$ELSE}Areas{$ENDIF});
|
||||
end;
|
||||
|
||||
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word;
|
||||
@ -452,5 +467,14 @@ begin
|
||||
Result:=FCommands.Count;
|
||||
end;
|
||||
|
||||
function TIDECommandScope.HasIDEWindow(AnWindow: TCustomForm): boolean;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:=0 to FIDEWindows.Count-1 do
|
||||
if TCustomForm(FIDEWindows[i])=AnWindow then exit(true);
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
@ -484,6 +484,8 @@ type
|
||||
TLazProject = class(TPersistent)
|
||||
private
|
||||
FLazCompilerOptions: TLazCompilerOptions;
|
||||
fModified: boolean;
|
||||
FSessionModified: boolean;
|
||||
fTitle: String;
|
||||
FSessionStorage: TProjectSessionStorage;
|
||||
protected
|
||||
@ -499,6 +501,8 @@ type
|
||||
function GetProjectInfoFile: string; virtual; abstract;
|
||||
procedure SetProjectInfoFile(const NewFilename: string); virtual; abstract;
|
||||
procedure SetSessionStorage(const AValue: TProjectSessionStorage); virtual;
|
||||
procedure SetModified(const AValue: boolean); virtual;
|
||||
procedure SetSessionModified(const AValue: boolean); virtual;
|
||||
public
|
||||
constructor Create(ProjectDescription: TProjectDescriptor); virtual;
|
||||
function CreateProjectFile(const Filename: string
|
||||
@ -523,6 +527,10 @@ type
|
||||
read GetProjectInfoFile write SetProjectInfoFile;
|
||||
property SessionStorage: TProjectSessionStorage read FSessionStorage
|
||||
write SetSessionStorage;
|
||||
property Modified: boolean read fModified
|
||||
write SetModified; // project data (not units, session)
|
||||
property SessionModified: boolean read FSessionModified
|
||||
write SetSessionModified; // project session data (not units, data)
|
||||
end;
|
||||
TLazProjectClass = class of TLazProject;
|
||||
|
||||
@ -967,6 +975,18 @@ begin
|
||||
FSessionStorage:=AValue;
|
||||
end;
|
||||
|
||||
procedure TLazProject.SetModified(const AValue: boolean);
|
||||
begin
|
||||
if fModified=AValue then exit;
|
||||
fModified:=AValue;
|
||||
end;
|
||||
|
||||
procedure TLazProject.SetSessionModified(const AValue: boolean);
|
||||
begin
|
||||
if FSessionModified=AValue then exit;
|
||||
FSessionModified:=AValue;
|
||||
end;
|
||||
|
||||
procedure TLazProject.SetLazCompilerOptions(const AValue: TLazCompilerOptions);
|
||||
begin
|
||||
if FLazCompilerOptions=AValue then exit;
|
||||
|
@ -643,7 +643,8 @@ type
|
||||
property Kind: TAnchorKind read FKind;
|
||||
published
|
||||
property Control: TControl read FControl write SetControl;
|
||||
property Side: TAnchorSideReference read FSide write SetSide stored IsSideStored;
|
||||
property Side: TAnchorSideReference read FSide write SetSide
|
||||
stored IsSideStored default TAnchorSideReference(-1);
|
||||
end;
|
||||
|
||||
|
||||
@ -2664,7 +2665,7 @@ end;
|
||||
|
||||
function TAnchorSide.IsSideStored: boolean;
|
||||
begin
|
||||
Result:=(Control<>nil) and (FSide<>DefaultSideForAnchorKind[FKind]);
|
||||
Result:=(Control<>nil) and (Side<>DefaultSideForAnchorKind[Kind]);
|
||||
end;
|
||||
|
||||
procedure TAnchorSide.SetSide(const AValue: TAnchorSideReference);
|
||||
|
@ -921,7 +921,7 @@ type
|
||||
property Color default clBtnFace;
|
||||
property Caption read GetText write SetText;
|
||||
property FullRepaint: Boolean read FFullRepaint write FFullRepaint default True;
|
||||
property ParentColor stored ParentColorIsStored;
|
||||
property ParentColor default true;
|
||||
property TabStop default False;
|
||||
end;
|
||||
|
||||
|
@ -25,6 +25,7 @@ unit FileUtil;
|
||||
interface
|
||||
|
||||
uses
|
||||
// For Smart Linking: Do not use the LCL!
|
||||
Classes, SysUtils, LCLStrConsts;
|
||||
|
||||
// file attributes and states
|
||||
|
Loading…
Reference in New Issue
Block a user