fixed TAnchorSide.Side default value

git-svn-id: trunk@7650 -
This commit is contained in:
mattias 2005-09-09 08:42:33 +00:00
parent b7c4f58fbd
commit 9d59986db5
11 changed files with 171 additions and 50 deletions

View File

@ -2098,6 +2098,7 @@ var
ReadValue(DirDef,copy(CurValue,MacroFuncNameEnd+1 ReadValue(DirDef,copy(CurValue,MacroFuncNameEnd+1
,MacroEnd-MacroFuncNameEnd-2),CurDefinePath,MacroParam); ,MacroEnd-MacroFuncNameEnd-2),CurDefinePath,MacroParam);
// execute the macro function // execute the macro function
//debugln('Substitute MacroFuncName="',MacroFuncName,'" MacroParam="',MacroParam,'"');
MacroStr:=ExecuteMacroFunction(MacroFuncName,MacroParam); MacroStr:=ExecuteMacroFunction(MacroFuncName,MacroParam);
end else begin end else begin
// Macro variable // Macro variable
@ -2147,9 +2148,11 @@ var
inc(BufferPos,RestLen); inc(BufferPos,RestLen);
end; end;
// copy the buffer into NewValue // copy the buffer into NewValue
//DebugLn(' [ReadValue] Old="',copy(NewValue,1,100),'"');
SetLength(NewValue,BufferPos); SetLength(NewValue,BufferPos);
if BufferPos>0 then if BufferPos>0 then
Move(Buffer^,NewValue[1],BufferPos); Move(Buffer^,NewValue[1],BufferPos);
//DebugLn(' [ReadValue] New="',copy(NewValue,1,100),'"');
// clean up // clean up
FreeMem(Buffer); FreeMem(Buffer);
Buffer:=nil; Buffer:=nil;
@ -2158,7 +2161,7 @@ var
var MacroStart,MacroEnd: integer; var MacroStart,MacroEnd: integer;
ValueLen: Integer; ValueLen: Integer;
begin begin
// DebugLn(' [ReadValue] A "',PreValue,'"'); // DebugLn(' [ReadValue] A "',copy(PreValue,1,100),'"');
NewValue:=PreValue; NewValue:=PreValue;
if NewValue='' then exit; if NewValue='' then exit;
MacroStart:=1; MacroStart:=1;
@ -2187,7 +2190,6 @@ begin
MacroStart:=MacroEnd; MacroStart:=MacroEnd;
end; end;
if Buffer<>nil then SetNewValue; if Buffer<>nil then SetNewValue;
// DebugLn(' [ReadValue] END "',NewValue,'"');
end; end;
procedure TDefineTree.MarkTemplatesOwnedBy(TheOwner: TObject; const MustFlags, procedure TDefineTree.MarkTemplatesOwnedBy(TheOwner: TObject; const MustFlags,

View File

@ -280,7 +280,8 @@ type
procedure Clear; override; procedure Clear; override;
procedure Delete(Index: Integer); override; procedure Delete(Index: Integer); override;
constructor Create(const AName, ADescription: string; constructor Create(const AName, ADescription: string;
TheAreas: TCommandAreas); {$IFDEF UseIDEScopes}TheScope: TIDECommandScope
{$ELSE}TheAreas: TCommandAreas{$ENDIF});
end; end;
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -303,7 +304,8 @@ type
function GetRelation(Index:integer):TKeyCommandRelation; function GetRelation(Index:integer):TKeyCommandRelation;
function GetRelationCount:integer; function GetRelationCount:integer;
function AddCategory(const Name, Description: string; 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; function Add(Category: TKeyCommandCategory; const Name: string;
Command:word; const TheKeyA, TheKeyB: TIDEShortCut):integer; Command:word; const TheKeyA, TheKeyB: TIDEShortCut):integer;
function AddDefault(Category: TKeyCommandCategory; const Name: string; function AddDefault(Category: TKeyCommandCategory; const Name: string;
@ -317,16 +319,22 @@ type
procedure Clear; procedure Clear;
function Count: integer; function Count: integer;
function CategoryCount: 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 FindByCommand(ACommand:word): TKeyCommandRelation;
function FindCategoryByName(const CategoryName: string): TKeyCommandCategory; 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 IndexOf(ARelation: TKeyCommandRelation): integer;
function CommandToShortCut(ACommand: word): TShortCut; function CommandToShortCut(ACommand: word): TShortCut;
function LoadFromXMLConfig(XMLConfig:TXMLConfig; const Prefix: String):boolean; function LoadFromXMLConfig(XMLConfig:TXMLConfig; const Prefix: String):boolean;
function SaveToXMLConfig(XMLConfig:TXMLConfig; const Prefix: String):boolean; function SaveToXMLConfig(XMLConfig:TXMLConfig; const Prefix: String):boolean;
procedure AssignTo(ASynEditKeyStrokes:TSynEditKeyStrokes; procedure AssignTo(ASynEditKeyStrokes:TSynEditKeyStrokes;
Areas: TCommandAreas); {$IFDEF UseIDEScopes}IDEWindow: TCustomForm
{$ELSE}Areas: TCommandAreas{$ENDIF});
procedure Assign(List: TKeyCommandRelationList); procedure Assign(List: TKeyCommandRelationList);
procedure LoadScheme(const SchemeName: string); procedure LoadScheme(const SchemeName: string);
public public
@ -364,7 +372,9 @@ type
procedure ActivateGrabbing(AGrabbingKey: integer); procedure ActivateGrabbing(AGrabbingKey: integer);
procedure DeactivateGrabbing; procedure DeactivateGrabbing;
procedure SetComboBox(AComboBox: TComboBox; const AValue: string); 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 public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
KeyCommandRelationList:TKeyCommandRelationList; KeyCommandRelationList:TKeyCommandRelationList;
@ -2044,7 +2054,8 @@ begin
end; end;
function TKeyMappingEditForm.ResolveConflicts(Key: TIDEShortCut; function TKeyMappingEditForm.ResolveConflicts(Key: TIDEShortCut;
Areas: TCommandAreas): boolean; {$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF}
): boolean;
var var
ConflictRelation: TKeyCommandRelation; ConflictRelation: TKeyCommandRelation;
ConflictName: String; ConflictName: String;
@ -2747,14 +2758,19 @@ begin
end; end;
function TKeyCommandRelationList.Find(Key: TIDEShortCut; function TKeyCommandRelationList.Find(Key: TIDEShortCut;
Areas: TCommandAreas):TKeyCommandRelation; {$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF}
): TKeyCommandRelation;
var var
a:integer; a:integer;
begin begin
Result:=nil; Result:=nil;
if Key.Key1=VK_UNKNOWN then exit; if Key.Key1=VK_UNKNOWN then exit;
for a:=0 to FRelations.Count-1 do with Relations[a] do begin 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; if Category.Areas*Areas=[] then continue;
{$ENDIF}
if ((KeyA.Key1=Key.Key1) and (KeyA.Shift1=Key.Shift1) and if ((KeyA.Key1=Key.Key1) and (KeyA.Shift1=Key.Shift1) and
(KeyA.Key2=Key.Key2) and (KeyA.Shift2=Key.Shift2)) (KeyA.Key2=Key.Key2) and (KeyA.Shift2=Key.Shift2))
or ((KeyB.Key1=Key.Key1) and (KeyB.Shift1=Key.Shift1) and or ((KeyB.Key1=Key.Key1) and (KeyB.Shift1=Key.Shift1) and
@ -2779,7 +2795,9 @@ begin
end; end;
procedure TKeyCommandRelationList.AssignTo( procedure TKeyCommandRelationList.AssignTo(
ASynEditKeyStrokes:TSynEditKeyStrokes; Areas: TCommandAreas); ASynEditKeyStrokes:TSynEditKeyStrokes;
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF}
);
var var
a,b,MaxKeyCnt,KeyCnt:integer; a,b,MaxKeyCnt,KeyCnt:integer;
Key: TSynEditKeyStroke; Key: TSynEditKeyStroke;
@ -2900,9 +2918,11 @@ begin
end; end;
function TKeyCommandRelationList.AddCategory(const Name, Description: string; function TKeyCommandRelationList.AddCategory(const Name, Description: string;
TheAreas: TCommandAreas): integer; {$IFDEF UseIDEScopes}TheScope: TIDECommandScope
{$ELSE}TheAreas: TCommandAreas{$ENDIF}): integer;
begin begin
Result:=fCategories.Add(TKeyCommandCategory.Create(Name,Description,TheAreas)); Result:=fCategories.Add(TKeyCommandCategory.Create(Name,Description,
{$IFDEF UseIDEScopes}TheScope{$ELSE}TheAreas{$ENDIF}));
end; end;
function TKeyCommandRelationList.FindCategoryByName(const CategoryName: string function TKeyCommandRelationList.FindCategoryByName(const CategoryName: string
@ -2917,23 +2937,40 @@ begin
Result:=nil; Result:=nil;
end; 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 var
ARelation: TKeyCommandRelation; ARelation: TKeyCommandRelation;
begin begin
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.Key2 := Key;
fLastKey.Shift2 := Shift; fLastKey.Shift2 := Shift;
ARelation := Find(fLastKey, Areas); ARelation := Find(fLastKey,{$IFDEF UseIDEScopes}IDEWindow{$ELSE}Areas{$ENDIF});
end else begin
ARelation := nil;
end;
if ARelation = nil then if ARelation = nil then
begin begin
// search for a one key command
fLastKey.Key1 := Key; fLastKey.Key1 := Key;
fLastKey.Shift1 := Shift; fLastKey.Shift1 := Shift;
fLastKey.Key2 := VK_UNKNOWN; fLastKey.Key2 := VK_UNKNOWN;
fLastKey.Shift2 := []; fLastKey.Shift2 := [];
ARelation := Find(fLastKey, Areas); ARelation := Find(fLastKey,{$IFDEF UseIDEScopes}IDEWindow{$ELSE}Areas{$ENDIF});
end; end;
if ARelation<>nil then if ARelation<>nil then
begin begin
// the key has a command -> key was used => clear fLastKey
fLastKey.Key1 := VK_UNKNOWN; fLastKey.Key1 := VK_UNKNOWN;
fLastKey.Shift1 := []; fLastKey.Shift1 := [];
fLastKey.Key2 := VK_UNKNOWN; fLastKey.Key2 := VK_UNKNOWN;
@ -2944,7 +2981,8 @@ begin
Result:=ecNone; Result:=ecNone;
end; end;
function TKeyCommandRelationList.IndexOf(ARelation: TKeyCommandRelation): integer; function TKeyCommandRelationList.IndexOf(ARelation: TKeyCommandRelation
): integer;
begin begin
Result:=fRelations.IndexOf(ARelation); Result:=fRelations.IndexOf(ARelation);
end; end;
@ -2976,12 +3014,17 @@ begin
end; end;
constructor TKeyCommandCategory.Create(const AName, ADescription: string; constructor TKeyCommandCategory.Create(const AName, ADescription: string;
TheAreas: TCommandAreas); {$IFDEF UseIDEScopes}TheScope: TIDECommandScope
{$ELSE}TheAreas: TCommandAreas{$ENDIF});
begin begin
inherited Create; inherited Create;
FName:=AName; FName:=AName;
FDescription:=ADescription; FDescription:=ADescription;
{$IFDEF UseIDEScopes}
FScope:=TheScope;
{$ELSE}
FAreas:=TheAreas; FAreas:=TheAreas;
{$ENDIF}
end; end;

View File

@ -97,6 +97,7 @@ resourcestring
lisProjectIncPath = 'Project Include Path'; lisProjectIncPath = 'Project Include Path';
lisProjectSrcPath = 'Project Src Path'; lisProjectSrcPath = 'Project Src Path';
lisMakeExe = 'Make Executable'; lisMakeExe = 'Make Executable';
lisProjectMakroProperties = 'Project makro properties';
lisConfigDirectory = 'Lazarus config directory'; lisConfigDirectory = 'Lazarus config directory';
// main bar menu // main bar menu

View File

@ -288,7 +288,9 @@ type
procedure OnProcessIDECommand(Sender: TObject; Command: word; procedure OnProcessIDECommand(Sender: TObject; Command: word;
var Handled: boolean); var Handled: boolean);
procedure OnExecuteIDEShortCut(Sender: TObject; 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); procedure OnExecuteIDECommand(Sender: TObject; Command: word);
// Environment options dialog events // Environment options dialog events
@ -771,13 +773,14 @@ type
function IsTestUnitFilename(const AFilename: string): boolean; override; function IsTestUnitFilename(const AFilename: string): boolean; override;
function GetRunCommandLine: string; override; function GetRunCommandLine: string; override;
function GetProjPublishDir: string; function GetProjPublishDir: string;
procedure OnMacroSubstitution(TheMacro: TTransferMacro; var s:string; procedure OnMacroSubstitution(TheMacro: TTransferMacro; var s: string;
var Handled, Abort: boolean); var Handled, Abort: boolean);
function OnSubstituteCompilerOption(Options: TParsedCompilerOptions; function OnSubstituteCompilerOption(Options: TParsedCompilerOptions;
const UnparsedValue: string): string; const UnparsedValue: string): string;
function OnMacroPromptFunction(const s:string; var Abort: boolean):string; function OnMacroPromptFunction(const s:string; var Abort: boolean): string;
function OnMacroFuncMakeExe(const Filename:string; var Abort: boolean):string; function OnMacroFuncMakeExe(const Filename:string; var Abort: boolean): string;
procedure OnCmdLineCreate(var CmdLine: string; var Abort:boolean); function OnMacroFuncProject(const Param: string; var Abort: boolean): string;
procedure OnCmdLineCreate(var CmdLine: string; var Abort: boolean);
procedure GetIDEFileState(Sender: TObject; const AFilename: string; procedure GetIDEFileState(Sender: TObject; const AFilename: string;
NeededFlags: TIDEFileStateFlags; var ResultFlags: TIDEFileStateFlags); override; NeededFlags: TIDEFileStateFlags; var ResultFlags: TIDEFileStateFlags); override;
@ -1528,6 +1531,8 @@ begin
lisProjectSrcPath,nil,[])); lisProjectSrcPath,nil,[]));
MacroList.Add(TTransferMacro.Create('MakeExe','', MacroList.Add(TTransferMacro.Create('MakeExe','',
lisMakeExe,@OnMacroFuncMakeExe,[])); lisMakeExe,@OnMacroFuncMakeExe,[]));
MacroList.Add(TTransferMacro.Create('Project','',
lisProjectMakroProperties,@OnMacroFuncProject,[]));
MacroList.OnSubstitution:=@OnMacroSubstitution; MacroList.OnSubstitution:=@OnMacroSubstitution;
CompilerOptions.OnParseString:=@OnSubstituteCompilerOption; CompilerOptions.OnParseString:=@OnSubstituteCompilerOption;
@ -2368,7 +2373,8 @@ begin
end; end;
procedure TMainIDE.OnExecuteIDEShortCut(Sender: TObject; var Key: word; procedure TMainIDE.OnExecuteIDEShortCut(Sender: TObject; var Key: word;
Shift: TShiftState; Areas: TCommandAreas); Shift: TShiftState;
{$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}TheAreas: TCommandAreas{$ENDIF});
var var
// CommandRelation: TKeyCommandRelation; // CommandRelation: TKeyCommandRelation;
// Handled: Boolean; // Handled: Boolean;
@ -2381,7 +2387,7 @@ begin
// OnProcessIDECommand(Sender,CommandRelation.Command,Handled); // OnProcessIDECommand(Sender,CommandRelation.Command,Handled);
// if Handled then Key:=VK_UNKNOWN; // if Handled then Key:=VK_UNKNOWN;
//debugln('TMainIDE.OnExecuteIDEShortCut Key '+dbgs(Key)+' pressed'); //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; if (Command = ecNone) then exit;
Handled := false; Handled := false;
OnProcessIDECommand(Sender, Command, Handled); OnProcessIDECommand(Sender, Command, Handled);
@ -8650,6 +8656,25 @@ begin
DebugLn('TMainIDE.OnMacroFuncMakeExe A ',Filename,' ',Result); DebugLn('TMainIDE.OnMacroFuncMakeExe A ',Filename,' ',Result);
end; 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); procedure TMainIDE.OnCmdLineCreate(var CmdLine: string; var Abort:boolean);
// replace all transfer macros in command line // replace all transfer macros in command line
begin begin
@ -9944,14 +9969,17 @@ begin
if Project1=nil then exit; if Project1=nil then exit;
FuncData:=PReadFunctionData(Data); FuncData:=PReadFunctionData(Data);
Param:=FuncData^.Param; 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) 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) 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) FuncData^.Result:=Project1.CompilerOptions.GetUnitPath(false)
else else begin
FuncData^.Result:=''; FuncData^.Result:='<unknown parameter for CodeTools Makro project:"'+Param+'">';
debugln('TMainIDE.MacroFunctionProject WARNING: ',FuncData^.Result);
end;
end; end;
procedure TMainIDE.OnCompilerGraphStampIncreased; procedure TMainIDE.OnCompilerGraphStampIncreased;

View File

@ -413,7 +413,6 @@ type
CheckIfAllowed: boolean; var Allowed: boolean); CheckIfAllowed: boolean; var Allowed: boolean);
procedure SetAutoOpenDesignerFormsDisabled(const AValue: boolean); procedure SetAutoOpenDesignerFormsDisabled(const AValue: boolean);
procedure SetCompilerOptions(const AValue: TProjectCompilerOptions); procedure SetCompilerOptions(const AValue: TProjectCompilerOptions);
procedure SetModified(const AValue: boolean);
procedure SetTargetFilename(const NewTargetFilename: string); procedure SetTargetFilename(const NewTargetFilename: string);
procedure SetUnits(Index:integer; AUnitInfo: TUnitInfo); procedure SetUnits(Index:integer; AUnitInfo: TUnitInfo);
procedure SetMainUnitID(const AValue: Integer); procedure SetMainUnitID(const AValue: Integer);
@ -427,6 +426,7 @@ type
procedure SetFlags(const AValue: TProjectFlags); override; procedure SetFlags(const AValue: TProjectFlags); override;
function GetProjectInfoFile: string; override; function GetProjectInfoFile: string; override;
procedure SetProjectInfoFile(const NewFilename: string); override; procedure SetProjectInfoFile(const NewFilename: string); override;
procedure SetModified(const AValue: boolean); override;
protected protected
// special unit lists // special unit lists
procedure AddToList(AnUnitInfo: TUnitInfo; ListType: TUnitInfoList); procedure AddToList(AnUnitInfo: TUnitInfo; ListType: TUnitInfoList);
@ -567,7 +567,6 @@ type
property MainFilename: String read GetMainFilename; property MainFilename: String read GetMainFilename;
property MainUnitID: Integer read FMainUnitID write SetMainUnitID; property MainUnitID: Integer read FMainUnitID write SetMainUnitID;
property MainUnitInfo: TUnitInfo read GetMainUnitInfo; property MainUnitInfo: TUnitInfo read GetMainUnitInfo;
property Modified: boolean read fModified write SetModified;
property OnBeginUpdate: TNotifyEvent read FOnBeginUpdate write FOnBeginUpdate; property OnBeginUpdate: TNotifyEvent read FOnBeginUpdate write FOnBeginUpdate;
property OnEndUpdate: TEndUpdateProjectEvent read FOnEndUpdate write FOnEndUpdate; property OnEndUpdate: TEndUpdateProjectEvent read FOnEndUpdate write FOnEndUpdate;
property OnFileBackup: TOnFileBackup read fOnFileBackup write fOnFileBackup; property OnFileBackup: TOnFileBackup read fOnFileBackup write fOnFileBackup;
@ -1781,8 +1780,8 @@ end;
procedure TProject.SetModified(const AValue: boolean); procedure TProject.SetModified(const AValue: boolean);
begin begin
if AValue=Modified then exit; if AValue=Modified then exit;
fModified:=AValue; inherited SetModified(AValue);
if not fModified then PublishOptions.Modified:=false; if not Modified then PublishOptions.Modified:=false;
end; end;
procedure TProject.SetUnits(Index:integer; AUnitInfo: TUnitInfo); procedure TProject.SetUnits(Index:integer; AUnitInfo: TUnitInfo);
@ -2589,7 +2588,7 @@ end;
function TProject.SomethingModified: boolean; function TProject.SomethingModified: boolean;
var i: integer; var i: integer;
begin begin
Result:=Modified; Result:=Modified or SessionModified;
for i:=0 to UnitCount-1 do Result:=Result or Units[i].Modified; for i:=0 to UnitCount-1 do Result:=Result or Units[i].Modified;
Result:=Result or CompilerOptions.Modified; Result:=Result or CompilerOptions.Modified;
end; end;

View File

@ -46,7 +46,7 @@ unit TransferMacros;
interface interface
uses Classes, SysUtils, FileUtil, LazarusIDEStrConsts, MacroIntf; uses Classes, SysUtils, LCLProc, FileUtil, LazarusIDEStrConsts, MacroIntf;
type type
TTransferMacro = class; TTransferMacro = class;
@ -217,6 +217,8 @@ begin
if (m<fItems.Count) and (AnsiCompareText(NewMacro.Name,Items[m].Name)>0) then if (m<fItems.Count) and (AnsiCompareText(NewMacro.Name,Items[m].Name)>0) then
inc(m); inc(m);
fItems.Insert(m,NewMacro); fItems.Insert(m,NewMacro);
//if NewMacro.MacroFunction<>nil then
// debugln('TTransferMacroList.Add A ',NewMacro.Name);
end; end;
function TTransferMacroList.SubstituteStr(var s:string): boolean; function TTransferMacroList.SubstituteStr(var s:string): boolean;

View File

@ -27,7 +27,7 @@
This is only to help the user find commands. This is only to help the user find commands.
Scopes: 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 For example: When the user presses a key in the source editor, the IDE
first searches in all commands with the Scope IDECmdScopeSrcEdit. first searches in all commands with the Scope IDECmdScopeSrcEdit.
Then it will search in all commands without scope. Then it will search in all commands without scope.
@ -41,6 +41,7 @@ interface
uses uses
Classes, SysUtils, Forms, LCLType, Menus, TextTools; Classes, SysUtils, Forms, LCLType, Menus, TextTools;
{$IFNDEF UseIDEScopes}
type type
TCommandArea = ( TCommandArea = (
caMenu, caMenu,
@ -56,7 +57,7 @@ const
caSrcEditOnly = [caSourceEditor]; caSrcEditOnly = [caSourceEditor];
caDesign = [caMenu,caDesigner]; caDesign = [caMenu,caDesigner];
caDesignOnly = [caDesigner]; caDesignOnly = [caDesigner];
{$ENDIF}
type type
TIDECommandKeys = class; TIDECommandKeys = class;
@ -79,6 +80,7 @@ type
function IDEWindowCount: integer; function IDEWindowCount: integer;
procedure AddCommand(ACommand: TIDECommandKeys); procedure AddCommand(ACommand: TIDECommandKeys);
function CommandCount: integer; function CommandCount: integer;
function HasIDEWindow(AnWindow: TCustomForm): boolean;
public public
property Name: string read FName; property Name: string read FName;
property IDEWindows[Index: integer]: TCustomForm read GetIDEWindows; property IDEWindows[Index: integer]: TCustomForm read GetIDEWindows;
@ -120,7 +122,11 @@ type
TIDECommandCategory = class(TList) TIDECommandCategory = class(TList)
protected protected
{$IFDEF UseIDEScopes}
FScope: TIDECommandScope;
{$ELSE}
FAreas: TCommandAreas; FAreas: TCommandAreas;
{$ENDIF}
FDescription: string; FDescription: string;
FName: string; FName: string;
FParent: TIDECommandCategory; FParent: TIDECommandCategory;
@ -128,8 +134,12 @@ type
property Name: string read FName; property Name: string read FName;
property Description: string read FDescription; property Description: string read FDescription;
property Parent: TIDECommandCategory read FParent; property Parent: TIDECommandCategory read FParent;
property Areas: TCommandAreas read FAreas;
procedure Delete(Index: Integer); virtual; procedure Delete(Index: Integer); virtual;
{$IFDEF UseIDEScopes}
property Scope: TIDECommandScope read FScope write FScope;
{$ELSE}
property Areas: TCommandAreas read FAreas;
{$ENDIF}
end; end;
@ -175,7 +185,11 @@ function IDEShortCut(Key1: word; Shift1: TShiftState;
type type
TExecuteIDEShortCut = procedure(Sender: TObject; TExecuteIDEShortCut = procedure(Sender: TObject;
var Key: word; Shift: TShiftState; 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; TExecuteIDECommand = procedure(Sender: TObject; Command: word) of object;
var var
@ -183,7 +197,7 @@ var
OnExecuteIDECommand: TExecuteIDECommand; OnExecuteIDECommand: TExecuteIDECommand;
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState; 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 ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState);
procedure ExecuteIDECommand(Sender: TObject; Command: word); procedure ExecuteIDECommand(Sender: TObject; Command: word);
@ -214,10 +228,11 @@ begin
end; end;
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState; procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; Shift: TShiftState;
Areas: TCommandAreas); {$IFDEF UseIDEScopes}IDEWindow: TCustomForm{$ELSE}Areas: TCommandAreas{$ENDIF});
begin begin
if (OnExecuteIDECommand<>nil) and (Key<>VK_UNKNOWN) then if (OnExecuteIDECommand<>nil) and (Key<>VK_UNKNOWN) then
OnExecuteIDEShortCut(Sender,Key,Shift,Areas); OnExecuteIDEShortCut(Sender,Key,Shift,
{$IFDEF UseIDEScopes}IDEWindow{$ELSE}Areas{$ENDIF});
end; end;
procedure ExecuteIDEShortCut(Sender: TObject; var Key: word; procedure ExecuteIDEShortCut(Sender: TObject; var Key: word;
@ -452,5 +467,14 @@ begin
Result:=FCommands.Count; Result:=FCommands.Count;
end; 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. end.

View File

@ -484,6 +484,8 @@ type
TLazProject = class(TPersistent) TLazProject = class(TPersistent)
private private
FLazCompilerOptions: TLazCompilerOptions; FLazCompilerOptions: TLazCompilerOptions;
fModified: boolean;
FSessionModified: boolean;
fTitle: String; fTitle: String;
FSessionStorage: TProjectSessionStorage; FSessionStorage: TProjectSessionStorage;
protected protected
@ -499,6 +501,8 @@ type
function GetProjectInfoFile: string; virtual; abstract; function GetProjectInfoFile: string; virtual; abstract;
procedure SetProjectInfoFile(const NewFilename: string); virtual; abstract; procedure SetProjectInfoFile(const NewFilename: string); virtual; abstract;
procedure SetSessionStorage(const AValue: TProjectSessionStorage); virtual; procedure SetSessionStorage(const AValue: TProjectSessionStorage); virtual;
procedure SetModified(const AValue: boolean); virtual;
procedure SetSessionModified(const AValue: boolean); virtual;
public public
constructor Create(ProjectDescription: TProjectDescriptor); virtual; constructor Create(ProjectDescription: TProjectDescriptor); virtual;
function CreateProjectFile(const Filename: string function CreateProjectFile(const Filename: string
@ -523,6 +527,10 @@ type
read GetProjectInfoFile write SetProjectInfoFile; read GetProjectInfoFile write SetProjectInfoFile;
property SessionStorage: TProjectSessionStorage read FSessionStorage property SessionStorage: TProjectSessionStorage read FSessionStorage
write SetSessionStorage; 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; end;
TLazProjectClass = class of TLazProject; TLazProjectClass = class of TLazProject;
@ -967,6 +975,18 @@ begin
FSessionStorage:=AValue; FSessionStorage:=AValue;
end; 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); procedure TLazProject.SetLazCompilerOptions(const AValue: TLazCompilerOptions);
begin begin
if FLazCompilerOptions=AValue then exit; if FLazCompilerOptions=AValue then exit;

View File

@ -643,7 +643,8 @@ type
property Kind: TAnchorKind read FKind; property Kind: TAnchorKind read FKind;
published published
property Control: TControl read FControl write SetControl; 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; end;
@ -2664,7 +2665,7 @@ end;
function TAnchorSide.IsSideStored: boolean; function TAnchorSide.IsSideStored: boolean;
begin begin
Result:=(Control<>nil) and (FSide<>DefaultSideForAnchorKind[FKind]); Result:=(Control<>nil) and (Side<>DefaultSideForAnchorKind[Kind]);
end; end;
procedure TAnchorSide.SetSide(const AValue: TAnchorSideReference); procedure TAnchorSide.SetSide(const AValue: TAnchorSideReference);

View File

@ -921,7 +921,7 @@ type
property Color default clBtnFace; property Color default clBtnFace;
property Caption read GetText write SetText; property Caption read GetText write SetText;
property FullRepaint: Boolean read FFullRepaint write FFullRepaint default True; property FullRepaint: Boolean read FFullRepaint write FFullRepaint default True;
property ParentColor stored ParentColorIsStored; property ParentColor default true;
property TabStop default False; property TabStop default False;
end; end;

View File

@ -25,6 +25,7 @@ unit FileUtil;
interface interface
uses uses
// For Smart Linking: Do not use the LCL!
Classes, SysUtils, LCLStrConsts; Classes, SysUtils, LCLStrConsts;
// file attributes and states // file attributes and states