mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 02:49:30 +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
|
||||
if stream.z = nil then exit;
|
||||
{$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;
|
||||
TFreeTypeStream(p).FUsed := false;
|
||||
{$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;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
@ -9,7 +34,7 @@ uses
|
||||
Grids, Buttons, Menus, ButtonPanel, LCLProc,
|
||||
ProjectIntf, IDEImagesIntf, IDEOptionsIntf, CompOptsIntf, IDEDialogs,
|
||||
PackageDefs, TransferMacros, PathEditorDlg, Project, LazarusIDEStrConsts,
|
||||
CompilerOptions, IDEProcs, BuildModeDiffDlg;
|
||||
CompilerOptions, IDEProcs, Compiler_ModeMatrix, BuildModeDiffDlg;
|
||||
|
||||
type
|
||||
|
||||
@ -102,6 +127,8 @@ begin
|
||||
Project1.ActiveBuildModeID:=frm.fActiveBuildMode.Identifier;
|
||||
IncreaseBuildMacroChangeStamp;
|
||||
// Load options
|
||||
if ModeMatrixFrame<>nil then
|
||||
ModeMatrixFrame.UpdateModes(true);
|
||||
OnLoadIDEOptionsHook(Nil, Project1.CompilerOptions);
|
||||
end;
|
||||
finally
|
||||
@ -344,7 +371,7 @@ var
|
||||
i: Integer;
|
||||
b: Boolean;
|
||||
begin
|
||||
debugln(['TBuildModesForm.BuildModesStringGridValidateEntry Row=',aRow,' Col=',aCol]);
|
||||
//debugln(['TBuildModesForm.BuildModesStringGridValidateEntry Row=',aRow,' Col=',aCol]);
|
||||
i:=aRow-1;
|
||||
if (i<0) or (i>=fBuildModes.Count) then exit;
|
||||
CurMode:=fBuildModes[i];
|
||||
@ -378,6 +405,7 @@ begin
|
||||
NewValue:=CurMode.Identifier;
|
||||
end;
|
||||
end;
|
||||
Project1.BuildModes.RenameMatrixMode(CurMode.Identifier,s);
|
||||
CurMode.Identifier:=s;
|
||||
end;
|
||||
end;
|
||||
|
@ -18,9 +18,17 @@
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
Author: Mattias Gaertner
|
||||
|
||||
Abstract:
|
||||
Options frame for build mode matrix options.
|
||||
|
||||
ToDo:
|
||||
- when rename build mode, update option modes
|
||||
- when rename build mode, update grid checkboxes
|
||||
- check modified
|
||||
- build modes diff
|
||||
- add button to ideoptionsdlg
|
||||
- add diffs for matrix options
|
||||
- wiki
|
||||
- undo: combine changes while editing a cell
|
||||
- remove old frame (idemacrovalues.pas,lfm)
|
||||
@ -759,8 +767,11 @@ var
|
||||
GridHasChanged: Boolean;
|
||||
aMode: TGroupedMatrixMode;
|
||||
BuildModes: TProjectBuildModes;
|
||||
ValuesHaveChanged: Boolean;
|
||||
begin
|
||||
GridHasChanged:=false;
|
||||
ValuesHaveChanged:=false;
|
||||
|
||||
// add/update build modes
|
||||
BuildModes:=LazProject.BuildModes;
|
||||
for i:=0 to BuildModes.Count-1 do begin
|
||||
@ -773,19 +784,24 @@ begin
|
||||
end
|
||||
else begin
|
||||
aMode:=Grid.Modes[i];
|
||||
//debugln(['TCompOptModeMatrix.UpdateModes aMode.Caption=',aMode.Caption,' BuildMode.Identifier=',BuildMode.Identifier]);
|
||||
if aMode.Caption<>BuildMode.Identifier then begin
|
||||
aMode.Caption:=BuildMode.Identifier;
|
||||
GridHasChanged:=true;
|
||||
end;
|
||||
aMode.Color:=aColor;
|
||||
if aMode.Color<>aColor then begin
|
||||
ValuesHaveChanged:=true;
|
||||
aMode.Color:=aColor;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
UpdateActiveMode;
|
||||
|
||||
//debugln(['TCompOptModeMatrix.UpdateModes UpdateGrid=',UpdateGrid,' GridHasChanged=',GridHasChanged]);
|
||||
if UpdateGrid and GridHasChanged then
|
||||
Grid.MatrixChanged
|
||||
else
|
||||
else if GridHasChanged or ValuesHaveChanged then
|
||||
Grid.Invalidate;
|
||||
end;
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
Abstract:
|
||||
This unit defines a dialog for the lazarus options.
|
||||
}
|
||||
unit IdeOptionsDlg;
|
||||
unit IDEOptionsDlg;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
|
@ -95,6 +95,7 @@ type
|
||||
procedure SetModesFromCommaSeparatedList(aList: string);
|
||||
procedure DisableModes(const DisableModeEvent: TStrToBoolEvent);
|
||||
procedure EnableMode(const aMode: string);
|
||||
procedure RenameMode(const OldMode, NewMode: string);
|
||||
procedure LoadFromConfig(Cfg: TConfigStorage);
|
||||
procedure SaveToConfig(Cfg: TConfigStorage; const SkipModes: TStrToBoolEvent);
|
||||
procedure LoadFromXMLConfig(Cfg: TXMLConfig; const aPath: string);
|
||||
@ -120,12 +121,13 @@ type
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Clear;
|
||||
procedure DisableModes(const IsModeEvent: TStrToBoolEvent);
|
||||
function Count: integer;
|
||||
property Items[Index: integer]: TBuildMatrixOption read GetItems; default;
|
||||
function IndexOf(Option: TBuildMatrixOption): integer;
|
||||
function Add(Typ: TBuildMatrixOptionType = bmotCustom; Targets: string = '*'): TBuildMatrixOption;
|
||||
procedure Delete(Index: integer);
|
||||
procedure DisableModes(const IsModeEvent: TStrToBoolEvent);
|
||||
procedure RenameMode(const OldMode, NewMode: string);
|
||||
|
||||
// equals, modified
|
||||
property ChangeStep: int64 read FChangeStep;
|
||||
@ -467,6 +469,14 @@ begin
|
||||
Items[i].DisableModes(IsModeEvent);
|
||||
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;
|
||||
begin
|
||||
Result:=fItems.Count;
|
||||
@ -792,6 +802,30 @@ begin
|
||||
Modes:=Modes+aMode+LineEnding;
|
||||
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);
|
||||
begin
|
||||
ID:=Cfg.GetValue('ID','');
|
||||
|
@ -743,6 +743,7 @@ type
|
||||
function IsModified(InSession: boolean): boolean;
|
||||
function GetSessionModes: TStringList;
|
||||
function IsSessionMode(const ModeIdentifier: string): boolean;
|
||||
procedure RenameMatrixMode(const OldName, NewName: string);
|
||||
public
|
||||
property Items[Index: integer]: TProjectBuildMode read GetItems; default;
|
||||
property ChangeStamp: integer read FChangeStamp;
|
||||
@ -7564,6 +7565,12 @@ begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
procedure TProjectBuildModes.RenameMatrixMode(const OldName, NewName: string);
|
||||
begin
|
||||
SharedMatrixOptions.RenameMode(OldName,NewName);
|
||||
SessionMatrixOptions.RenameMode(OldName,NewName);
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterIDEOptionsGroup(GroupProject, TProject);
|
||||
RegisterIDEOptionsGroup(GroupCompiler, TProjectCompilerOptions);
|
||||
|
Loading…
Reference in New Issue
Block a user