mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-05 19:46:01 +02:00
Merged revision(s) 64307 #3f43cd260e, 64353 #24637b3d03, 64377 #adee13bfdd, 64379 #68f758f8e2 from trunk:
ProjectTemplates: Use the template.lpi file for a new project. Issue #38244, patch from Rolf Wetjen. ........ TAChart: Fix too thick connection line between stacked bars. ........ LCL-GTK2: Fix SpeedButton when non-modal form is opened by popup menu. Issue #38345, patch from Andrzej Kilijanski. ........ TAChart: Fix usage of incorrect drawing backend in OnAfterCustomDrawBackwall (https://www.lazarusforum.de/viewtopic.php?f=18&t=13347). ........ git-svn-id: branches/fixes_2_0@64613 -
This commit is contained in:
parent
2c03a634c5
commit
2961d09e9e
@ -9,14 +9,14 @@ object ProjectVariablesForm: TProjectVariablesForm
|
|||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnShow = ProjectVariablesFormShow
|
OnShow = ProjectVariablesFormShow
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '1.9.0.0'
|
LCLVersion = '2.1.0.0'
|
||||||
object ProjNameLabel: TLabel
|
object ProjNameLabel: TLabel
|
||||||
AnchorSideTop.Control = EProjectName
|
AnchorSideTop.Control = EProjectName
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 13
|
Height = 15
|
||||||
Top = 21
|
Top = 20
|
||||||
Width = 124
|
Width = 118
|
||||||
Alignment = taRightJustify
|
Alignment = taRightJustify
|
||||||
Caption = '&Name for new project:'
|
Caption = '&Name for new project:'
|
||||||
Layout = tlCenter
|
Layout = tlCenter
|
||||||
@ -26,9 +26,9 @@ object ProjectVariablesForm: TProjectVariablesForm
|
|||||||
AnchorSideTop.Control = DEDestDir
|
AnchorSideTop.Control = DEDestDir
|
||||||
AnchorSideTop.Side = asrCenter
|
AnchorSideTop.Side = asrCenter
|
||||||
Left = 8
|
Left = 8
|
||||||
Height = 13
|
Height = 15
|
||||||
Top = 53
|
Top = 52
|
||||||
Width = 107
|
Width = 100
|
||||||
Alignment = taRightJustify
|
Alignment = taRightJustify
|
||||||
Caption = 'Create in &directory:'
|
Caption = 'Create in &directory:'
|
||||||
Layout = tlCenter
|
Layout = tlCenter
|
||||||
@ -60,7 +60,7 @@ object ProjectVariablesForm: TProjectVariablesForm
|
|||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
AnchorSideBottom.Control = ButtonPanel1
|
AnchorSideBottom.Control = ButtonPanel1
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 156
|
Height = 158
|
||||||
Top = 141
|
Top = 141
|
||||||
Width = 527
|
Width = 527
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
@ -70,10 +70,11 @@ object ProjectVariablesForm: TProjectVariablesForm
|
|||||||
DefaultColWidth = 120
|
DefaultColWidth = 120
|
||||||
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goEditing, goAlwaysShowEditor, goDblClickAutoSize, goSmoothScroll]
|
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goEditing, goAlwaysShowEditor, goDblClickAutoSize, goSmoothScroll]
|
||||||
TabOrder = 3
|
TabOrder = 3
|
||||||
|
OnSelectEditor = SGVariablesSelectEditor
|
||||||
ColWidths = (
|
ColWidths = (
|
||||||
120
|
120
|
||||||
|
201
|
||||||
202
|
202
|
||||||
203
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
object EProjectName: TEdit
|
object EProjectName: TEdit
|
||||||
@ -81,10 +82,10 @@ object ProjectVariablesForm: TProjectVariablesForm
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 138
|
Left = 132
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 16
|
Top = 16
|
||||||
Width = 395
|
Width = 401
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Right = 6
|
BorderSpacing.Right = 6
|
||||||
@ -93,10 +94,10 @@ object ProjectVariablesForm: TProjectVariablesForm
|
|||||||
object DEDestDir: TDirectoryEdit
|
object DEDestDir: TDirectoryEdit
|
||||||
AnchorSideLeft.Control = EProjectName
|
AnchorSideLeft.Control = EProjectName
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 138
|
Left = 132
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 48
|
Top = 48
|
||||||
Width = 393
|
Width = 399
|
||||||
ShowHidden = False
|
ShowHidden = False
|
||||||
ButtonWidth = 23
|
ButtonWidth = 23
|
||||||
NumGlyphs = 1
|
NumGlyphs = 1
|
||||||
@ -106,8 +107,8 @@ object ProjectVariablesForm: TProjectVariablesForm
|
|||||||
end
|
end
|
||||||
object ButtonPanel1: TButtonPanel
|
object ButtonPanel1: TButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 36
|
Height = 34
|
||||||
Top = 303
|
Top = 305
|
||||||
Width = 527
|
Width = 527
|
||||||
OKButton.Name = 'OKButton'
|
OKButton.Name = 'OKButton'
|
||||||
OKButton.DefaultCaption = True
|
OKButton.DefaultCaption = True
|
||||||
|
@ -7,7 +7,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes,
|
Classes,
|
||||||
// LCL
|
// LCL
|
||||||
Forms, ExtCtrls, Grids, StdCtrls, EditBtn, ButtonPanel,
|
Controls, Forms, ExtCtrls, Grids, StdCtrls, EditBtn, ButtonPanel,
|
||||||
// ProjectTemplates
|
// ProjectTemplates
|
||||||
ProjectTemplates;
|
ProjectTemplates;
|
||||||
|
|
||||||
@ -26,6 +26,8 @@ type
|
|||||||
procedure BOKClick(Sender: TObject);
|
procedure BOKClick(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure ProjectVariablesFormShow(Sender: TObject);
|
procedure ProjectVariablesFormShow(Sender: TObject);
|
||||||
|
procedure SGVariablesSelectEditor(Sender: TObject; aCol, aRow: Integer;
|
||||||
|
var Editor: TWinControl);
|
||||||
private
|
private
|
||||||
FSChanged: Boolean;
|
FSChanged: Boolean;
|
||||||
FTemplates: TProjectTemplates;
|
FTemplates: TProjectTemplates;
|
||||||
@ -68,6 +70,13 @@ begin
|
|||||||
SGVariables.Cells[2,0]:=SDescription;
|
SGVariables.Cells[2,0]:=SDescription;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TProjectVariablesForm.SGVariablesSelectEditor(Sender: TObject; aCol,
|
||||||
|
aRow: Integer; var Editor: TWinControl);
|
||||||
|
begin
|
||||||
|
if aCol<>1 then
|
||||||
|
Editor:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TProjectVariablesForm.BOKClick(Sender: TObject);
|
procedure TProjectVariablesForm.BOKClick(Sender: TObject);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
|
@ -5,7 +5,7 @@ unit IDETemplateProject;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, ContNrs,
|
Classes, SysUtils, StrUtils, ContNrs,
|
||||||
// LCL
|
// LCL
|
||||||
LResources, Forms, Controls, Graphics, Dialogs,
|
LResources, Forms, Controls, Graphics, Dialogs,
|
||||||
// LazUtils
|
// LazUtils
|
||||||
@ -29,13 +29,13 @@ type
|
|||||||
Function ShowOptionsDialog : TModalResult;
|
Function ShowOptionsDialog : TModalResult;
|
||||||
public
|
public
|
||||||
constructor Create(ATemplate : TProjectTemplate); overload;
|
constructor Create(ATemplate : TProjectTemplate); overload;
|
||||||
destructor destroy; override;
|
destructor Destroy; override;
|
||||||
Function DoInitDescriptor : TModalResult; override;
|
Function DoInitDescriptor : TModalResult; override;
|
||||||
function GetLocalizedName: string; override;
|
function GetLocalizedName: string; override;
|
||||||
function GetLocalizedDescription: string; override;
|
function GetLocalizedDescription: string; override;
|
||||||
function InitProject(AProject: TLazProject) : TModalResult; override;
|
function InitProject(AProject: TLazProject) : TModalResult; override;
|
||||||
function CreateStartFiles({%H-}AProject: TLazProject) : TModalResult; override;
|
function CreateStartFiles({%H-}AProject: TLazProject) : TModalResult; override;
|
||||||
Property template : TProjectTemplate Read FTemplate Write FTemplate;
|
Property Template : TProjectTemplate Read FTemplate Write FTemplate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
@ -113,11 +113,30 @@ begin
|
|||||||
NewIDEItems.Add(TNewIDEItemCategory.Create(STemplateCategory));
|
NewIDEItems.Add(TNewIDEItemCategory.Create(STemplateCategory));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure FileReplaceText(FN, AFrom, ATo: string);
|
||||||
|
var
|
||||||
|
sl: TStringList;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if not FileExistsUTF8(FN) then
|
||||||
|
exit;
|
||||||
|
sl:=TStringList.Create;
|
||||||
|
try
|
||||||
|
sl.LoadFromFile(FN);
|
||||||
|
for i:=0 to sl.Count-1 do
|
||||||
|
sl[i]:=ReplaceText(sl[i],AFrom,ATo);
|
||||||
|
sl.SaveToFile(fn);
|
||||||
|
finally
|
||||||
|
sl.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
Procedure DoProject(Sender : TObject);
|
Procedure DoProject(Sender : TObject);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
I : Integer;
|
I : Integer;
|
||||||
Desc : TTemplateProjectDescriptor;
|
Desc : TTemplateProjectDescriptor;
|
||||||
|
fn: string;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
I:=MenuList.count-1;
|
I:=MenuList.count-1;
|
||||||
@ -129,8 +148,18 @@ begin
|
|||||||
Desc:=FProjDesc;
|
Desc:=FProjDesc;
|
||||||
Dec(i);
|
Dec(i);
|
||||||
end;
|
end;
|
||||||
If Desc<>Nil then
|
If Desc=Nil then
|
||||||
LazarusIDE.DoNewProject(Desc);
|
exit;
|
||||||
|
|
||||||
|
If Desc.ShowOptionsDialog<>mrOk then
|
||||||
|
exit;
|
||||||
|
Desc.Template.CreateProject(Desc.FProjectDirectory,Desc.FVariables);
|
||||||
|
fn:=Desc.FProjectDirectory+Desc.FProjectName;
|
||||||
|
FileReplaceText(fn+'.lpi',Desc.FTemplate.ProjectFile,Desc.FProjectName);
|
||||||
|
FileReplaceText(fn+'.lpr',Desc.FTemplate.ProjectFile,Desc.FProjectName);
|
||||||
|
FileReplaceText(fn+'.lps',Desc.FTemplate.ProjectFile,Desc.FProjectName);
|
||||||
|
LazarusIDE.DoOpenProjectFile(Desc.FProjectDirectory+Desc.FProjectName+'.lpi',
|
||||||
|
[ofProjectLoading,ofOnlyIfExists,ofConvertMacros,ofDoLoadResource]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure RegisterKnowntemplates;
|
procedure RegisterKnowntemplates;
|
||||||
@ -216,10 +245,16 @@ begin
|
|||||||
FVariables.Assign(FTemplate.Variables);
|
FVariables.Assign(FTemplate.Variables);
|
||||||
I:=FVariables.IndexOfName('ProjName');
|
I:=FVariables.IndexOfName('ProjName');
|
||||||
if (I<>-1) then
|
if (I<>-1) then
|
||||||
|
begin
|
||||||
|
EProjectName.Text:=FVariables.Values['ProjName'];
|
||||||
FVariables.Delete(I);
|
FVariables.Delete(I);
|
||||||
|
end;
|
||||||
I:=FVariables.IndexOfName('ProjDir');
|
I:=FVariables.IndexOfName('ProjDir');
|
||||||
if (I<>-1) then
|
if (I<>-1) then
|
||||||
|
begin
|
||||||
|
DEDestDir.Text:=FVariables.Values['ProjDir'];
|
||||||
FVariables.Delete(I);
|
FVariables.Delete(I);
|
||||||
|
end;
|
||||||
Templates:=Templates;
|
Templates:=Templates;
|
||||||
Variables:=FVariables;
|
Variables:=FVariables;
|
||||||
Result:=ShowModal;
|
Result:=ShowModal;
|
||||||
@ -270,11 +305,23 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
function TTemplateProjectDescriptor.DoInitDescriptor: TModalResult;
|
function TTemplateProjectDescriptor.DoInitDescriptor: TModalResult;
|
||||||
|
var
|
||||||
|
I : integer;
|
||||||
|
Desc : TTemplateProjectDescriptor;
|
||||||
begin
|
begin
|
||||||
Result:=ShowOptionsDialog;
|
Result:=mrCancel;
|
||||||
If (Result=mrOK) then
|
I:=MenuList.count-1;
|
||||||
FTemplate.CreateProject(FProjectDirectory,FVariables);
|
Desc:=Nil;
|
||||||
|
While (Desc=Nil) and (I>=0) do
|
||||||
|
begin
|
||||||
|
With TIDEObject(MenuList[i]) do
|
||||||
|
if FProjDesc=self then
|
||||||
|
begin
|
||||||
|
DoProject(FProjMenu);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
Dec(i);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -322,6 +369,9 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
|
|
||||||
|
Result:=mrCancel;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function TTemplateProjectDescriptor.CreateStartFiles(AProject: TLazProject) : TModalresult;
|
Function TTemplateProjectDescriptor.CreateStartFiles(AProject: TLazProject) : TModalresult;
|
||||||
|
@ -143,10 +143,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Function SimpleFileCopy(Const Source,Dest : String) : Boolean;
|
Function SimpleFileCopy(Const Source,Dest : String) : Boolean;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
F1,F2 : TFileStream;
|
F1,F2 : TFileStream;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=False;
|
Result:=False;
|
||||||
try
|
try
|
||||||
@ -314,6 +312,11 @@ begin
|
|||||||
FExclude:=ReadString(SProject,KeyExclude,'');
|
FExclude:=ReadString(SProject,KeyExclude,'');
|
||||||
If (FExclude<>'') then
|
If (FExclude<>'') then
|
||||||
FExclude:=FExclude+',';
|
FExclude:=FExclude+',';
|
||||||
|
// Don't change ico and res files
|
||||||
|
If pos('.ico,',FExclude)<=0 then
|
||||||
|
FExclude:=FExclude+'.ico,';
|
||||||
|
If pos('.res,',FExclude)<=0 then
|
||||||
|
FExclude:=FExclude+'.res,';
|
||||||
ReadSectionValues(SVariables,FVariables);
|
ReadSectionValues(SVariables,FVariables);
|
||||||
Finally
|
Finally
|
||||||
Free;
|
Free;
|
||||||
@ -501,6 +504,4 @@ begin
|
|||||||
CopyAndSubstituteDir(Directory,ProjectDir,Values);
|
CopyAndSubstituteDir(Directory,ProjectDir,Values);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -1007,7 +1007,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
if Assigned(OnAfterCustomDrawBackWall) then
|
if Assigned(OnAfterCustomDrawBackWall) then
|
||||||
OnAfterCustomDrawBackwall(Self, Drawer, FClipRect);
|
OnAfterCustomDrawBackwall(Self, ADrawer, FClipRect);
|
||||||
if Supports(ADrawer, IChartTCanvasDrawer, ic) and Assigned(OnAfterDrawBackWall) then
|
if Supports(ADrawer, IChartTCanvasDrawer, ic) and Assigned(OnAfterDrawBackWall) then
|
||||||
OnAfterDrawBackWall(Self, ic.Canvas, FClipRect);
|
OnAfterDrawBackWall(Self, ic.Canvas, FClipRect);
|
||||||
|
|
||||||
|
@ -1152,6 +1152,7 @@ var
|
|||||||
TopLeft := ParentChart.GraphToImage(graphBar.a);
|
TopLeft := ParentChart.GraphToImage(graphBar.a);
|
||||||
BottomRight := ParentChart.GraphToImage(graphBar.b);
|
BottomRight := ParentChart.GraphToImage(graphBar.b);
|
||||||
TAGeometry.NormalizeRect(imageBar);
|
TAGeometry.NormalizeRect(imageBar);
|
||||||
|
if IsRotated then inc(imageBar.Right) else dec(imageBar.Top);
|
||||||
|
|
||||||
// Draw a line instead of an empty rectangle.
|
// Draw a line instead of an empty rectangle.
|
||||||
// if Bottom = Top then Dec(Top);
|
// if Bottom = Top then Dec(Top);
|
||||||
|
@ -735,7 +735,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
GtkWindow := {%H-}PGtkWindow(AForm.Handle);
|
GtkWindow := {%H-}PGtkWindow(AForm.Handle);
|
||||||
if (fsModal in AForm.FormState) and AForm.HandleObjectShouldBeVisible then
|
|
||||||
|
if AForm.HandleObjectShouldBeVisible then
|
||||||
begin
|
begin
|
||||||
LastMouse.Button := 0;
|
LastMouse.Button := 0;
|
||||||
LastMouse.ClickCount := 0;
|
LastMouse.ClickCount := 0;
|
||||||
@ -743,6 +744,10 @@ begin
|
|||||||
LastMouse.MousePos := Point(0, 0);
|
LastMouse.MousePos := Point(0, 0);
|
||||||
LastMouse.Time := 0;
|
LastMouse.Time := 0;
|
||||||
LastMouse.WinControl := nil;
|
LastMouse.WinControl := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (fsModal in AForm.FormState) and AForm.HandleObjectShouldBeVisible then
|
||||||
|
begin
|
||||||
gtk_window_set_default_size(GtkWindow, Max(1,AForm.Width), Max(1,AForm.Height));
|
gtk_window_set_default_size(GtkWindow, Max(1,AForm.Width), Max(1,AForm.Height));
|
||||||
gtk_widget_set_uposition(PGtkWidget(GtkWindow), AForm.Left, AForm.Top);
|
gtk_widget_set_uposition(PGtkWidget(GtkWindow), AForm.Left, AForm.Top);
|
||||||
gtk_window_set_type_hint({%H-}PGtkWindow(AForm.Handle),
|
gtk_window_set_type_hint({%H-}PGtkWindow(AForm.Handle),
|
||||||
|
Loading…
Reference in New Issue
Block a user