fixed testing packge output directory writable

git-svn-id: trunk@7841 -
This commit is contained in:
mattias 2005-09-27 18:50:27 +00:00
parent 24b1fe1587
commit 469ae305aa
5 changed files with 132 additions and 85 deletions

View File

@ -214,17 +214,17 @@ type
function ReadPascalColorScheme: string;
procedure WriteColorScheme(const LanguageName, SynColorScheme: string);
procedure GetDefaultsForPascalAttribute(Attr: TSynHighlightElement;
const SynColorScheme: string);
const SynColorScheme: string);
procedure ReadHighlighterSettings(Syn: TCustomSyn; SynColorScheme: string);
procedure ReadDefaultsForHighlighterSettings(Syn: TCustomSyn;
SynColorScheme: string; DefaultPascalSyn: TPreviewPasSyn);
SynColorScheme: string; DefaultPascalSyn: TPreviewPasSyn);
procedure WriteHighlighterSettings(Syn: TCustomSyn; SynColorScheme: string);
procedure GetSpecialLineColors(Syn: TCustomSyn;
AddHilightAttr: TAdditionalHilightAttribute; var Special: boolean;
var FG, BG: TColor);
AddHilightAttr: TAdditionalHilightAttribute;
var Special: boolean; var FG, BG: TColor);
published
// general options
property SynEditOptions:TSynEditorOptions read fSynEditOptions
property SynEditOptions: TSynEditorOptions read fSynEditOptions
write fSynEditOptions default SynEditDefaultOptions;
property CtrlMouseLinks: boolean read fCtrlMouseLinks write fCtrlMouseLinks;
property ShowTabCloseButtons: boolean read fShowTabCloseButtons
@ -233,31 +233,31 @@ type
write fUndoAfterSave default true;
property FindTextAtCursor: boolean read fFindTextAtCursor
write fFindTextAtCursor default true;
property UseSyntaxHighlight:boolean
property UseSyntaxHighlight: boolean
read fUseSyntaxHighlight write fUseSyntaxHighlight default true;
property CopyWordAtCursorOnCopyNone: boolean read FCopyWordAtCursorOnCopyNone
write FCopyWordAtCursorOnCopyNone;
property ShowGutterHints: boolean read FShowGutterHints write FShowGutterHints;
property BlockIndent:integer read fBlockIndent write fBlockIndent default 2;
property UndoLimit:integer read fUndoLimit write fUndoLimit default 32767;
property TabWidth:integer read fTabWidth write fTabWidth default 8;
property BlockIndent: integer read fBlockIndent write fBlockIndent default 2;
property UndoLimit: integer read fUndoLimit write fUndoLimit default 32767;
property TabWidth: integer read fTabWidth write fTabWidth default 8;
// Display options
property VisibleRightMargin:boolean
read fVisibleRightMargin write fVisibleRightMargin default true;
property VisibleGutter:boolean
read fVisibleGutter write fVisibleGutter default true;
property ShowLineNumbers:boolean
read fShowLineNumbers write fShowLineNumbers default false;
property GutterColor:TColor read fGutterColor write fGutterColor default clBtnFace;
property GutterWidth:integer read fGutterWidth write fGutterWidth default 30;
property RightMargin:integer read fRightMargin write fRightMargin default 80;
property RightMarginColor:integer
read fRightMarginColor write fRightMarginColor default clBtnFace;
property EditorFont:Ansistring read fEditorFont write fEditorFont;
property EditorFontHeight:integer read fEditorFontHeight write FEditorFontHeight;
property ExtraLineSpacing:integer
read fExtraLineSpacing write fExtraLineSpacing default 0;
property VisibleRightMargin: boolean read fVisibleRightMargin
write fVisibleRightMargin default true;
property VisibleGutter: boolean read fVisibleGutter
write fVisibleGutter default true;
property ShowLineNumbers: boolean read fShowLineNumbers
write fShowLineNumbers default false;
property GutterColor: TColor read fGutterColor write fGutterColor default clBtnFace;
property GutterWidth: integer read fGutterWidth write fGutterWidth default 30;
property RightMargin: integer read fRightMargin write fRightMargin default 80;
property RightMarginColor: integer read fRightMarginColor
write fRightMarginColor default clBtnFace;
property EditorFont: string read fEditorFont write fEditorFont;
property EditorFontHeight: integer read fEditorFontHeight write FEditorFontHeight;
property ExtraLineSpacing: integer read fExtraLineSpacing
write fExtraLineSpacing default 0;
// Key Mappings
property KeyMappingScheme:Ansistring
@ -378,48 +378,48 @@ type
ColorPreview:TPreviewEditor;
// Code Tools options
AutomaticFeaturesGroupBox:TGroupBox;
AutomaticFeaturesGroupBox: TGroupBox;
AutoIdentifierCompletionCheckBox: TCheckBox;
AutoCodeParametersCheckBox: TCheckBox;
AutoToolTipExprEvalCheckBox: TCheckBox;
AutoToolTipSymbToolsCheckBox: TCheckBox;
AutoDelayLabel:TLabel;
AutoDelayTrackBar:TTrackBar;
AutoDelayMinLabel:TLabel;
AutoDelayMaxLabel:TLabel;
AutoDelayLabel: TLabel;
AutoDelayTrackBar: TTrackBar;
AutoDelayMinLabel: TLabel;
AutoDelayMaxLabel: TLabel;
// buttons at bottom
OkButton:TButton;
CancelButton:TButton;
OkButton: TButton;
CancelButton: TButton;
// form
procedure EditorOptionsFormResize(Sender: TObject);
// general
procedure GeneralCheckBoxOnClick(Sender: TObject);
procedure ComboBoxOnChange(Sender:TObject);
procedure ComboBoxOnExit(Sender:TObject);
procedure ComboBoxOnChange(Sender: TObject);
procedure ComboBoxOnExit(Sender: TObject);
procedure ComboBoxOnKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
procedure ColorButtonColorChanged(Sender:TObject);
// display
procedure FontDialogApplyClicked(Sender: TObject);
procedure EditorFontButtonClick(Sender:TObject);
procedure EditorFontButtonClick(Sender: TObject);
// key mapping
procedure KeyMappingChooseSchemeButtonClick(Sender: TObject);
procedure KeyMappingTreeViewMouseUp(Sender:TObject;
Button:TMouseButton; Shift:TShiftState; X,Y:integer);
procedure KeyMappingTreeViewMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: integer);
procedure KeyMappingConsistencyCheckButtonClick(Sender: TObject);
// color
procedure ColorElementListBoxSelectionChange(Sender: TObject;
User: boolean);
User: boolean);
procedure ColorPreviewMouseUp(Sender:TObject;
Button:TMouseButton; Shift:TShiftState; X,Y:integer);
Button: TMouseButton; Shift: TShiftState; X, Y: integer);
procedure OnSpecialLineColors(Sender: TObject; Line: integer;
var Special: boolean; var FG, BG: TColor);
var Special: boolean; var FG, BG: TColor);
procedure SetAttributeToDefaultButtonClick(Sender: TObject);
procedure SetAllAttributesToDefaultButtonClick(Sender: TObject);
@ -2808,7 +2808,7 @@ var Protocol:TStringList;
begin
Protocol:=TStringList.Create;
try
ErrorCount:=KeyStrokesConsistencyErrors(EditingKeyMap,Protocol,Index1,Index2);
ErrorCount:=FindKeymapConflicts(EditingKeyMap,Protocol,Index1,Index2);
if ErrorCount>0 then begin
KeyMapErrorsForm:=TKeyMapErrorsForm.Create(nil);
try

View File

@ -284,7 +284,13 @@ type
//---------------------------------------------------------------------------
// class for storing the keys of a single command (key-command relationship)
{ TKeyCommandRelation }
TKeyCommandRelation = class(TIDECommand)
protected
procedure SetShortcutA(const AValue: TIDEShortCut); override;
procedure SetShortcutB(const AValue: TIDEShortCut); override;
public
function GetLocalizedName: string; override;
end;
@ -385,10 +391,10 @@ type
end;
function KeyAndShiftStateToEditorKeyString(Key: word; ShiftState: TShiftState): String;
function KeyAndShiftStateToEditorKeyString(Key: TIDEShortCut): String;
function KeyAndShiftStateToEditorKeyString(const Key: TIDEShortCut): String;
function ShowKeyMappingEditForm(Index:integer;
AKeyCommandRelationList:TKeyCommandRelationList):TModalResult;
function KeyStrokesConsistencyErrors(Keymap: TKeyCommandRelationList;
function FindKeymapConflicts(Keymap: TKeyCommandRelationList;
Protocol: TStrings; var Index1,Index2:integer):integer;
function EditorCommandToDescriptionString(cmd: word): String;
function EditorCommandLocalizedName(cmd: word;
@ -577,7 +583,7 @@ begin
ecViewJumpHistory: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
ecJumpToPrevError: SetResult(VK_F8,[ssCtrl, ssShift],VK_UNKNOWN,[]);
ecJumpToNextError: SetResult(VK_F8,[ssCtrl],VK_UNKNOWN,[]);
ecOpenFileAtCursor: SetResult2(VK_RETURN,[ssCtrl],VK_UNKNOWN,[],VK_O,[ssCtrl],VK_A,[]);
ecOpenFileAtCursor: SetResult2(VK_RETURN,[ssCtrl],VK_UNKNOWN,[],VK_UNKNOWN,[],VK_UNKNOWN,[]);
// marker
ecSetFreeBookmark: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
@ -1631,7 +1637,7 @@ begin
end;
end;
function KeyStrokesConsistencyErrors(Keymap: TKeyCommandRelationList;
function FindKeymapConflicts(Keymap: TKeyCommandRelationList;
Protocol: TStrings; var Index1,Index2:integer):integer;
// 0 = ok, no errors
// >0 number of errors found
@ -1648,10 +1654,11 @@ var
procedure Check(const ShortCut1, ShortCut2: TIDEShortCut);
begin
if (ShortCut1.Key1<>VK_UNKNOWN)
and (ShortCut1.Key1=ShortCut2.Key1) and (ShortCut1.Shift1=ShortCut2.Shift1)
and (((ShortCut1.Key2=ShortCut2.Key2) and (ShortCut1.Shift2=ShortCut2.Shift2))
or (ShortCut1.Key2=VK_UNKNOWN) or (ShortCut2.Key2=VK_UNKNOWN))
if (ShortCut1.Key1=VK_UNKNOWN) then exit;
if (ShortCut1.Key1<>ShortCut2.Key1) or (ShortCut1.Shift1<>ShortCut2.Shift1)
then exit;
if ((ShortCut1.Key2=ShortCut2.Key2) and (ShortCut1.Shift2=ShortCut2.Shift2))
or (ShortCut1.Key2=VK_UNKNOWN) or (ShortCut2.Key2=VK_UNKNOWN)
then begin
// conflict found
if Result=0 then begin
@ -1682,6 +1689,10 @@ begin
Key1:=Keymap[a];
for b:=a+1 to Keymap.Count-1 do begin
Key2:=Keymap[b];
{if (Key2.Command=ecConfigBuildLazarus)
and (Key1.Command=ecFindNext) then begin
debugln('FindKeymapConflicts ',dbgs(Key1.Category.ScopeIntersects(Key2.Category.Scope)),' ',dbgsName(Key1.Category.Scope),' ',dbgsName(Key2.Category.Scope));
end;}
if (not Key1.Category.ScopeIntersects(Key2.Category.Scope)) then
continue;
Check(Key1.ShortcutA,Key2.ShortcutA);
@ -1807,7 +1818,7 @@ begin
AddAttributesAndKey;
end;
function KeyAndShiftStateToEditorKeyString(Key: TIDEShortCut): String;
function KeyAndShiftStateToEditorKeyString(const Key: TIDEShortCut): String;
begin
Result := KeyAndShiftStateToEditorKeyString(Key.Key1, Key.Shift1);
if (Key.Key2<>VK_UNKNOWN) then
@ -2195,6 +2206,24 @@ end;
{ TKeyCommandRelation }
procedure TKeyCommandRelation.SetShortcutA(const AValue: TIDEShortCut);
begin
inherited SetShortcutA(AValue);
{if Command=ecBlockIndent then begin
debugln('TKeyCommandRelation.SetShortcutA ',KeyAndShiftStateToEditorKeyString(ShortcutA),' ',KeyAndShiftStateToEditorKeyString(ShortcutB));
end;}
end;
procedure TKeyCommandRelation.SetShortcutB(const AValue: TIDEShortCut);
begin
inherited SetShortcutB(AValue);
{if Command=ecBlockIndent then begin
debugln('TKeyCommandRelation.SetShortcutB ',KeyAndShiftStateToEditorKeyString(ShortcutA),' ',KeyAndShiftStateToEditorKeyString(ShortcutB));
if ShortcutB.Key2=VK_UNKNOWN then
RaiseGDBException('');
end;}
end;
function TKeyCommandRelation.GetLocalizedName: string;
begin
Result:=EditorCommandLocalizedName(Command,Name);
@ -2572,6 +2601,9 @@ var
TheKeyA, TheKeyB: TIDEShortCut;
begin
GetDefaultKeyForCommand(Command,TheKeyA,TheKeyB);
{if Command=ecBlockIndent then begin
debugln('TKeyCommandRelationList.AddDefault A ',KeyAndShiftStateToEditorKeyString(TheKeyA),' ',KeyAndShiftStateToEditorKeyString(TheKeyB));
end;}
Result:=Add(Category,Name,Command,TheKeyA,TheKeyB);
end;
@ -2612,7 +2644,7 @@ function TKeyCommandRelationList.LoadFromXMLConfig(
XMLConfig:TXMLConfig; const Prefix: String):boolean;
var a,b,p:integer;
Name:ShortString;
DefaultStr,NewValue: String;
NewValue: String;
function ReadNextInt:integer;
begin
@ -2655,39 +2687,39 @@ begin
for b:=1 to length(Name) do
if not (Name[b] in ['a'..'z','A'..'Z','0'..'9']) then Name[b]:='_';
GetDefaultKeyForCommand(Relations[a].Command,TheKeyA,TheKeyB);
if FileVersion>2 then
DefaultStr:=KeyValuesToStr(TheKeyA, TheKeyB)
else
DefaultStr:=OldKeyValuesToStr(TheKeyA, TheKeyB);
//if Relations[a].Command=ecCopy then debugln(' DefaultStr=',DefaultStr);
if FileVersion<2 then
NewValue:=XMLConfig.GetValue(Prefix+Name,DefaultStr)
NewValue:=XMLConfig.GetValue(Prefix+Name,'')
else
NewValue:=XMLConfig.GetValue(Prefix+Name+'/Value',DefaultStr);
//if Relations[a].Command=ecCopy then debugln(' NewValue=',NewValue);
NewValue:=XMLConfig.GetValue(Prefix+Name+'/Value','');
//if Relations[a].Command=ecBlockIndent then debugln(' NewValue=',NewValue);
if NewValue='' then begin
Relations[a].ShortcutA:=TheKeyA;
Relations[a].ShortcutB:=TheKeyB;
end else begin
p:=1;
Key1:=word(ReadNextInt);
Shift1:=IntToShiftState(ReadNextInt);
if FileVersion>2 then begin
Key2:=word(ReadNextInt);
Shift2:=IntToShiftState(ReadNextInt);
end else begin
Key2:=VK_UNKNOWN;
Shift2:=[];
end;
Relations[a].ShortcutA:=IDEShortCut(Key1, Shift1, Key2, Shift2);
p:=1;
Key1:=word(ReadNextInt);
Shift1:=IntToShiftState(ReadNextInt);
if FileVersion>2 then begin
Key2:=word(ReadNextInt);
Shift2:=IntToShiftState(ReadNextInt);
end else begin
Key2:=0;
Shift2:=[];
Key1:=word(ReadNextInt);
Shift1:=IntToShiftState(ReadNextInt);
if FileVersion>2 then begin
Key2:=word(ReadNextInt);
Shift2:=IntToShiftState(ReadNextInt);
end else begin
Key2:=VK_UNKNOWN;
Shift2:=[];
end;
Relations[a].ShortcutB:=IDEShortCut(Key1, Shift1, Key2, Shift2);
end;
Relations[a].ShortcutA:=IDEShortCut(Key1, Shift1, Key2, Shift2);
Key1:=word(ReadNextInt);
Shift1:=IntToShiftState(ReadNextInt);
if FileVersion>2 then begin
Key2:=word(ReadNextInt);
Shift2:=IntToShiftState(ReadNextInt);
end else begin
Key2:=0;
Shift2:=[];
end;
Relations[a].ShortcutB:=IDEShortCut(Key1, Shift1, Key2, Shift2);
end;
Result:=true;
end;

View File

@ -553,8 +553,8 @@ end;
function TIDECommandCategory.ScopeIntersects(AScope: TIDECommandScope
): boolean;
begin
if Scope=nil then
Result:=(AScope=nil) or (AScope.HasIDEWindowClass(nil))
if (Scope=nil) or (AScope=nil) then
Result:=true
else
Result:=Scope.Intersects(AScope);
end;
@ -644,12 +644,15 @@ end;
function TIDECommandScope.Intersects(AScope: TIDECommandScope): boolean;
var
i: Integer;
CurClass: TCustomFormClass;
begin
if AScope=nil then
Result:=FIDEWindowClasses.IndexOf(nil)>=0
Result:=true
else begin
for i:=0 to FIDEWindowClasses.Count-1 do begin
if AScope.FIDEWindowClasses.IndexOf(FIDEWindowClasses[i])>=0 then
CurClass:=TCustomFormClass(FIDEWindowClasses[i]);
if (CurClass=nil)
or (AScope.FIDEWindowClasses.IndexOf(FIDEWindowClasses[i])>=0) then
exit(true);
end;
Result:=false;

View File

@ -2226,7 +2226,8 @@ begin
if not (lpfDestroying in FFlags) then begin
FFlags:=[lpfAutoIncrementVersionOnBuild];
FAutoUpdate:=pupAsNeeded;
fCompilerOptions.UnitOutputDirectory:='lib'+PathDelim;
fCompilerOptions.UnitOutputDirectory:=
'lib'+PathDelim+'$(TargetCPU)-$(Target_OS)'+PathDelim;
FUsageOptions.UnitPath:='$(PkgOutDir)';
end else begin
FFlags:=[lpfDestroying];

View File

@ -567,9 +567,14 @@ var
NewOutDir: String;
begin
if DirectoryIsWritableCached(AnOutDirectory) then exit;
ForceDirectory(AnOutDirectory);
if DirectoryIsWritableCached(AnOutDirectory) then exit;
//debugln('TPkgManager.GetWritablePkgOutputDirectory AnOutDirectory=',AnOutDirectory,' ',dbgs(DirectoryIsWritable(AnOutDirectory)));
// output directory is not writable
// -> redirect to home directory
NewOutDir:=SetDirSeparators('/$(TargetCPU)/$(TargetOS)');
NewOutDir:=SetDirSeparators('/$(TargetCPU)-$(TargetOS)');
MainIDE.MacroList.SubstituteStr(NewOutDir);
NewOutDir:=TrimFilename(GetPrimaryConfigPath+PathDelim+'lib'+PathDelim
+APackage.Name+NewOutDir);
@ -689,11 +694,17 @@ function TPkgManager.OnPackageEditorCompilePackage(Sender: TObject;
APackage: TLazPackage; CompileClean, CompileRequired: boolean): TModalResult;
var
Flags: TPkgCompileFlags;
Globals: TGlobalCompilerOptions;
begin
Flags:=[];
if CompileClean then Include(Flags,pcfCleanCompile);
if CompileRequired then Include(Flags,pcfCompileDependenciesClean);
Result:=DoCompilePackage(APackage,Flags,nil);
if Project1<>nil then
Globals:=Project1.CompilerOptions.Globals
else
Globals:=nil;
//debugln('TPkgManager.OnPackageEditorCompilePackage OS=',Globals.TargetOS);
Result:=DoCompilePackage(APackage,Flags,Globals);
end;
function TPkgManager.OnPackageEditorCreateMakefile(Sender: TObject;