mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-05 10:55:56 +02:00
IDE: rename build modes, update shared and session matrix options
git-svn-id: trunk@41508 -
This commit is contained in:
parent
2c367b3767
commit
641ea1824b
@ -371,7 +371,7 @@ const
|
|||||||
begin
|
begin
|
||||||
if stream.z = nil then exit;
|
if stream.z = nil then exit;
|
||||||
{$IF FPC_FULLVERSION<20701}
|
{$IF FPC_FULLVERSION<20701}
|
||||||
{$HINT workaround for bug 23868 when compiling with -O2}
|
{$HINT workaround for fpc bug 23868 when compiling with -O2}
|
||||||
p:=stream.z;
|
p:=stream.z;
|
||||||
TFreeTypeStream(p).FUsed := false;
|
TFreeTypeStream(p).FUsed := false;
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
|
@ -1,3 +1,28 @@
|
|||||||
|
{
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* This source is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This code is distributed in the hope that it will be useful, but *
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||||
|
* General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* A copy of the GNU General Public License is available on the World *
|
||||||
|
* Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
|
||||||
|
* obtain it by writing to the Free Software Foundation, *
|
||||||
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
|
||||||
|
Author: Mattias Gaertner
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
Dialog for editing build modes: add, delete, reorder, rename
|
||||||
|
}
|
||||||
unit BuildModesManager;
|
unit BuildModesManager;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
@ -9,7 +34,7 @@ uses
|
|||||||
Grids, Buttons, Menus, ButtonPanel, LCLProc,
|
Grids, Buttons, Menus, ButtonPanel, LCLProc,
|
||||||
ProjectIntf, IDEImagesIntf, IDEOptionsIntf, CompOptsIntf, IDEDialogs,
|
ProjectIntf, IDEImagesIntf, IDEOptionsIntf, CompOptsIntf, IDEDialogs,
|
||||||
PackageDefs, TransferMacros, PathEditorDlg, Project, LazarusIDEStrConsts,
|
PackageDefs, TransferMacros, PathEditorDlg, Project, LazarusIDEStrConsts,
|
||||||
CompilerOptions, IDEProcs, BuildModeDiffDlg;
|
CompilerOptions, IDEProcs, Compiler_ModeMatrix, BuildModeDiffDlg;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -102,6 +127,8 @@ begin
|
|||||||
Project1.ActiveBuildModeID:=frm.fActiveBuildMode.Identifier;
|
Project1.ActiveBuildModeID:=frm.fActiveBuildMode.Identifier;
|
||||||
IncreaseBuildMacroChangeStamp;
|
IncreaseBuildMacroChangeStamp;
|
||||||
// Load options
|
// Load options
|
||||||
|
if ModeMatrixFrame<>nil then
|
||||||
|
ModeMatrixFrame.UpdateModes(true);
|
||||||
OnLoadIDEOptionsHook(Nil, Project1.CompilerOptions);
|
OnLoadIDEOptionsHook(Nil, Project1.CompilerOptions);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
@ -344,7 +371,7 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
b: Boolean;
|
b: Boolean;
|
||||||
begin
|
begin
|
||||||
debugln(['TBuildModesForm.BuildModesStringGridValidateEntry Row=',aRow,' Col=',aCol]);
|
//debugln(['TBuildModesForm.BuildModesStringGridValidateEntry Row=',aRow,' Col=',aCol]);
|
||||||
i:=aRow-1;
|
i:=aRow-1;
|
||||||
if (i<0) or (i>=fBuildModes.Count) then exit;
|
if (i<0) or (i>=fBuildModes.Count) then exit;
|
||||||
CurMode:=fBuildModes[i];
|
CurMode:=fBuildModes[i];
|
||||||
@ -378,6 +405,7 @@ begin
|
|||||||
NewValue:=CurMode.Identifier;
|
NewValue:=CurMode.Identifier;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Project1.BuildModes.RenameMatrixMode(CurMode.Identifier,s);
|
||||||
CurMode.Identifier:=s;
|
CurMode.Identifier:=s;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -18,9 +18,17 @@
|
|||||||
* *
|
* *
|
||||||
***************************************************************************
|
***************************************************************************
|
||||||
|
|
||||||
|
Author: Mattias Gaertner
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
Options frame for build mode matrix options.
|
||||||
|
|
||||||
ToDo:
|
ToDo:
|
||||||
- when rename build mode, update option modes
|
- when rename build mode, update grid checkboxes
|
||||||
- check modified
|
- check modified
|
||||||
|
- build modes diff
|
||||||
|
- add button to ideoptionsdlg
|
||||||
|
- add diffs for matrix options
|
||||||
- wiki
|
- wiki
|
||||||
- undo: combine changes while editing a cell
|
- undo: combine changes while editing a cell
|
||||||
- remove old frame (idemacrovalues.pas,lfm)
|
- remove old frame (idemacrovalues.pas,lfm)
|
||||||
@ -759,8 +767,11 @@ var
|
|||||||
GridHasChanged: Boolean;
|
GridHasChanged: Boolean;
|
||||||
aMode: TGroupedMatrixMode;
|
aMode: TGroupedMatrixMode;
|
||||||
BuildModes: TProjectBuildModes;
|
BuildModes: TProjectBuildModes;
|
||||||
|
ValuesHaveChanged: Boolean;
|
||||||
begin
|
begin
|
||||||
GridHasChanged:=false;
|
GridHasChanged:=false;
|
||||||
|
ValuesHaveChanged:=false;
|
||||||
|
|
||||||
// add/update build modes
|
// add/update build modes
|
||||||
BuildModes:=LazProject.BuildModes;
|
BuildModes:=LazProject.BuildModes;
|
||||||
for i:=0 to BuildModes.Count-1 do begin
|
for i:=0 to BuildModes.Count-1 do begin
|
||||||
@ -773,19 +784,24 @@ begin
|
|||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
aMode:=Grid.Modes[i];
|
aMode:=Grid.Modes[i];
|
||||||
|
//debugln(['TCompOptModeMatrix.UpdateModes aMode.Caption=',aMode.Caption,' BuildMode.Identifier=',BuildMode.Identifier]);
|
||||||
if aMode.Caption<>BuildMode.Identifier then begin
|
if aMode.Caption<>BuildMode.Identifier then begin
|
||||||
aMode.Caption:=BuildMode.Identifier;
|
aMode.Caption:=BuildMode.Identifier;
|
||||||
GridHasChanged:=true;
|
GridHasChanged:=true;
|
||||||
end;
|
end;
|
||||||
aMode.Color:=aColor;
|
if aMode.Color<>aColor then begin
|
||||||
|
ValuesHaveChanged:=true;
|
||||||
|
aMode.Color:=aColor;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
UpdateActiveMode;
|
UpdateActiveMode;
|
||||||
|
|
||||||
|
//debugln(['TCompOptModeMatrix.UpdateModes UpdateGrid=',UpdateGrid,' GridHasChanged=',GridHasChanged]);
|
||||||
if UpdateGrid and GridHasChanged then
|
if UpdateGrid and GridHasChanged then
|
||||||
Grid.MatrixChanged
|
Grid.MatrixChanged
|
||||||
else
|
else if GridHasChanged or ValuesHaveChanged then
|
||||||
Grid.Invalidate;
|
Grid.Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
Abstract:
|
Abstract:
|
||||||
This unit defines a dialog for the lazarus options.
|
This unit defines a dialog for the lazarus options.
|
||||||
}
|
}
|
||||||
unit IdeOptionsDlg;
|
unit IDEOptionsDlg;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
@ -95,6 +95,7 @@ type
|
|||||||
procedure SetModesFromCommaSeparatedList(aList: string);
|
procedure SetModesFromCommaSeparatedList(aList: string);
|
||||||
procedure DisableModes(const DisableModeEvent: TStrToBoolEvent);
|
procedure DisableModes(const DisableModeEvent: TStrToBoolEvent);
|
||||||
procedure EnableMode(const aMode: string);
|
procedure EnableMode(const aMode: string);
|
||||||
|
procedure RenameMode(const OldMode, NewMode: string);
|
||||||
procedure LoadFromConfig(Cfg: TConfigStorage);
|
procedure LoadFromConfig(Cfg: TConfigStorage);
|
||||||
procedure SaveToConfig(Cfg: TConfigStorage; const SkipModes: TStrToBoolEvent);
|
procedure SaveToConfig(Cfg: TConfigStorage; const SkipModes: TStrToBoolEvent);
|
||||||
procedure LoadFromXMLConfig(Cfg: TXMLConfig; const aPath: string);
|
procedure LoadFromXMLConfig(Cfg: TXMLConfig; const aPath: string);
|
||||||
@ -120,12 +121,13 @@ type
|
|||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
procedure DisableModes(const IsModeEvent: TStrToBoolEvent);
|
|
||||||
function Count: integer;
|
function Count: integer;
|
||||||
property Items[Index: integer]: TBuildMatrixOption read GetItems; default;
|
property Items[Index: integer]: TBuildMatrixOption read GetItems; default;
|
||||||
function IndexOf(Option: TBuildMatrixOption): integer;
|
function IndexOf(Option: TBuildMatrixOption): integer;
|
||||||
function Add(Typ: TBuildMatrixOptionType = bmotCustom; Targets: string = '*'): TBuildMatrixOption;
|
function Add(Typ: TBuildMatrixOptionType = bmotCustom; Targets: string = '*'): TBuildMatrixOption;
|
||||||
procedure Delete(Index: integer);
|
procedure Delete(Index: integer);
|
||||||
|
procedure DisableModes(const IsModeEvent: TStrToBoolEvent);
|
||||||
|
procedure RenameMode(const OldMode, NewMode: string);
|
||||||
|
|
||||||
// equals, modified
|
// equals, modified
|
||||||
property ChangeStep: int64 read FChangeStep;
|
property ChangeStep: int64 read FChangeStep;
|
||||||
@ -467,6 +469,14 @@ begin
|
|||||||
Items[i].DisableModes(IsModeEvent);
|
Items[i].DisableModes(IsModeEvent);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TBuildMatrixOptions.RenameMode(const OldMode, NewMode: string);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
for i:=0 to Count-1 do
|
||||||
|
Items[i].RenameMode(OldMode,NewMode);
|
||||||
|
end;
|
||||||
|
|
||||||
function TBuildMatrixOptions.Count: integer;
|
function TBuildMatrixOptions.Count: integer;
|
||||||
begin
|
begin
|
||||||
Result:=fItems.Count;
|
Result:=fItems.Count;
|
||||||
@ -792,6 +802,30 @@ begin
|
|||||||
Modes:=Modes+aMode+LineEnding;
|
Modes:=Modes+aMode+LineEnding;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TBuildMatrixOption.RenameMode(const OldMode, NewMode: string);
|
||||||
|
var
|
||||||
|
CurModes: String;
|
||||||
|
p: PChar;
|
||||||
|
StartP: PChar;
|
||||||
|
StartPos: SizeInt;
|
||||||
|
CurMode: String;
|
||||||
|
begin
|
||||||
|
CurModes:=Modes;
|
||||||
|
p:=PChar(CurModes);
|
||||||
|
while p^<>#0 do begin
|
||||||
|
StartP:=p;
|
||||||
|
while not (p^ in [#0,#10,#13]) do inc(p);
|
||||||
|
StartPos:=StartP-PChar(CurModes)+1;
|
||||||
|
CurMode:=copy(CurModes,StartPos,p-StartP);
|
||||||
|
if CompareText(CurMode,OldMode)=0 then begin
|
||||||
|
ReplaceSubstring(CurModes,StartPos,p-StartP,NewMode);
|
||||||
|
p:=Pointer(CurModes)+StartPos-1+length(NewMode);
|
||||||
|
end;
|
||||||
|
while p^ in [#10,#13] do inc(p);
|
||||||
|
end;
|
||||||
|
Modes:=CurModes;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBuildMatrixOption.LoadFromConfig(Cfg: TConfigStorage);
|
procedure TBuildMatrixOption.LoadFromConfig(Cfg: TConfigStorage);
|
||||||
begin
|
begin
|
||||||
ID:=Cfg.GetValue('ID','');
|
ID:=Cfg.GetValue('ID','');
|
||||||
|
@ -743,6 +743,7 @@ type
|
|||||||
function IsModified(InSession: boolean): boolean;
|
function IsModified(InSession: boolean): boolean;
|
||||||
function GetSessionModes: TStringList;
|
function GetSessionModes: TStringList;
|
||||||
function IsSessionMode(const ModeIdentifier: string): boolean;
|
function IsSessionMode(const ModeIdentifier: string): boolean;
|
||||||
|
procedure RenameMatrixMode(const OldName, NewName: string);
|
||||||
public
|
public
|
||||||
property Items[Index: integer]: TProjectBuildMode read GetItems; default;
|
property Items[Index: integer]: TProjectBuildMode read GetItems; default;
|
||||||
property ChangeStamp: integer read FChangeStamp;
|
property ChangeStamp: integer read FChangeStamp;
|
||||||
@ -7564,6 +7565,12 @@ begin
|
|||||||
Result:=false;
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TProjectBuildModes.RenameMatrixMode(const OldName, NewName: string);
|
||||||
|
begin
|
||||||
|
SharedMatrixOptions.RenameMode(OldName,NewName);
|
||||||
|
SessionMatrixOptions.RenameMode(OldName,NewName);
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
RegisterIDEOptionsGroup(GroupProject, TProject);
|
RegisterIDEOptionsGroup(GroupProject, TProject);
|
||||||
RegisterIDEOptionsGroup(GroupCompiler, TProjectCompilerOptions);
|
RegisterIDEOptionsGroup(GroupCompiler, TProjectCompilerOptions);
|
||||||
|
Loading…
Reference in New Issue
Block a user