diff --git a/components/projecttemplates/frmtemplatevariables.lfm b/components/projecttemplates/frmtemplatevariables.lfm index 67117a2552..7481b120a5 100644 --- a/components/projecttemplates/frmtemplatevariables.lfm +++ b/components/projecttemplates/frmtemplatevariables.lfm @@ -9,14 +9,14 @@ object ProjectVariablesForm: TProjectVariablesForm OnCreate = FormCreate OnShow = ProjectVariablesFormShow Position = poScreenCenter - LCLVersion = '1.9.0.0' + LCLVersion = '2.1.0.0' object ProjNameLabel: TLabel AnchorSideTop.Control = EProjectName AnchorSideTop.Side = asrCenter Left = 8 - Height = 13 - Top = 21 - Width = 124 + Height = 15 + Top = 20 + Width = 118 Alignment = taRightJustify Caption = '&Name for new project:' Layout = tlCenter @@ -26,9 +26,9 @@ object ProjectVariablesForm: TProjectVariablesForm AnchorSideTop.Control = DEDestDir AnchorSideTop.Side = asrCenter Left = 8 - Height = 13 - Top = 53 - Width = 107 + Height = 15 + Top = 52 + Width = 100 Alignment = taRightJustify Caption = 'Create in &directory:' Layout = tlCenter @@ -60,7 +60,7 @@ object ProjectVariablesForm: TProjectVariablesForm AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = ButtonPanel1 Left = 6 - Height = 156 + Height = 158 Top = 141 Width = 527 Anchors = [akTop, akLeft, akRight, akBottom] @@ -70,10 +70,11 @@ object ProjectVariablesForm: TProjectVariablesForm DefaultColWidth = 120 Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goEditing, goAlwaysShowEditor, goDblClickAutoSize, goSmoothScroll] TabOrder = 3 + OnSelectEditor = SGVariablesSelectEditor ColWidths = ( 120 + 201 202 - 203 ) end object EProjectName: TEdit @@ -81,10 +82,10 @@ object ProjectVariablesForm: TProjectVariablesForm AnchorSideLeft.Side = asrBottom AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom - Left = 138 + Left = 132 Height = 23 Top = 16 - Width = 395 + Width = 401 Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 6 BorderSpacing.Right = 6 @@ -93,10 +94,10 @@ object ProjectVariablesForm: TProjectVariablesForm object DEDestDir: TDirectoryEdit AnchorSideLeft.Control = EProjectName AnchorSideRight.Side = asrBottom - Left = 138 + Left = 132 Height = 23 Top = 48 - Width = 393 + Width = 399 ShowHidden = False ButtonWidth = 23 NumGlyphs = 1 @@ -106,8 +107,8 @@ object ProjectVariablesForm: TProjectVariablesForm end object ButtonPanel1: TButtonPanel Left = 6 - Height = 36 - Top = 303 + Height = 34 + Top = 305 Width = 527 OKButton.Name = 'OKButton' OKButton.DefaultCaption = True diff --git a/components/projecttemplates/frmtemplatevariables.pas b/components/projecttemplates/frmtemplatevariables.pas index 9ac71e355a..171376a8c4 100644 --- a/components/projecttemplates/frmtemplatevariables.pas +++ b/components/projecttemplates/frmtemplatevariables.pas @@ -7,7 +7,7 @@ interface uses Classes, // LCL - Forms, ExtCtrls, Grids, StdCtrls, EditBtn, ButtonPanel, + Controls, Forms, ExtCtrls, Grids, StdCtrls, EditBtn, ButtonPanel, // ProjectTemplates ProjectTemplates; @@ -26,6 +26,8 @@ type procedure BOKClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure ProjectVariablesFormShow(Sender: TObject); + procedure SGVariablesSelectEditor(Sender: TObject; aCol, aRow: Integer; + var Editor: TWinControl); private FSChanged: Boolean; FTemplates: TProjectTemplates; @@ -68,6 +70,13 @@ begin SGVariables.Cells[2,0]:=SDescription; 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); Var diff --git a/components/projecttemplates/idetemplateproject.pp b/components/projecttemplates/idetemplateproject.pp index ead55c972c..2eb5796a06 100644 --- a/components/projecttemplates/idetemplateproject.pp +++ b/components/projecttemplates/idetemplateproject.pp @@ -5,7 +5,7 @@ unit IDETemplateProject; interface uses - Classes, SysUtils, ContNrs, + Classes, SysUtils, StrUtils, ContNrs, // LCL LResources, Forms, Controls, Graphics, Dialogs, // LazUtils @@ -29,13 +29,13 @@ type Function ShowOptionsDialog : TModalResult; public constructor Create(ATemplate : TProjectTemplate); overload; - destructor destroy; override; + destructor Destroy; override; Function DoInitDescriptor : TModalResult; override; function GetLocalizedName: string; override; function GetLocalizedDescription: string; override; function InitProject(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; procedure Register; @@ -113,11 +113,30 @@ begin NewIDEItems.Add(TNewIDEItemCategory.Create(STemplateCategory)); 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); Var I : Integer; Desc : TTemplateProjectDescriptor; + fn: string; begin I:=MenuList.count-1; @@ -129,8 +148,18 @@ begin Desc:=FProjDesc; Dec(i); end; - If Desc<>Nil then - LazarusIDE.DoNewProject(Desc); + If Desc=Nil then + 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; procedure RegisterKnowntemplates; @@ -216,10 +245,16 @@ begin FVariables.Assign(FTemplate.Variables); I:=FVariables.IndexOfName('ProjName'); if (I<>-1) then + begin + EProjectName.Text:=FVariables.Values['ProjName']; FVariables.Delete(I); + end; I:=FVariables.IndexOfName('ProjDir'); if (I<>-1) then + begin + DEDestDir.Text:=FVariables.Values['ProjDir']; FVariables.Delete(I); + end; Templates:=Templates; Variables:=FVariables; Result:=ShowModal; @@ -270,11 +305,23 @@ end; function TTemplateProjectDescriptor.DoInitDescriptor: TModalResult; - +var + I : integer; + Desc : TTemplateProjectDescriptor; begin - Result:=ShowOptionsDialog; - If (Result=mrOK) then - FTemplate.CreateProject(FProjectDirectory,FVariables); + Result:=mrCancel; + I:=MenuList.count-1; + 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; @@ -322,6 +369,9 @@ begin end else Result:=mrCancel; + +Result:=mrCancel; + end; Function TTemplateProjectDescriptor.CreateStartFiles(AProject: TLazProject) : TModalresult; diff --git a/components/projecttemplates/projecttemplates.pp b/components/projecttemplates/projecttemplates.pp index 80bf21d12d..081e1bda5d 100644 --- a/components/projecttemplates/projecttemplates.pp +++ b/components/projecttemplates/projecttemplates.pp @@ -143,10 +143,8 @@ begin end; Function SimpleFileCopy(Const Source,Dest : String) : Boolean; - Var F1,F2 : TFileStream; - begin Result:=False; try @@ -314,6 +312,11 @@ begin FExclude:=ReadString(SProject,KeyExclude,''); If (FExclude<>'') then 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); Finally Free; @@ -501,6 +504,4 @@ begin CopyAndSubstituteDir(Directory,ProjectDir,Values); end; - - end. diff --git a/components/tachart/tagraph.pas b/components/tachart/tagraph.pas index 90127e9d9d..34c5f9ab7e 100644 --- a/components/tachart/tagraph.pas +++ b/components/tachart/tagraph.pas @@ -1007,7 +1007,7 @@ begin end; if Assigned(OnAfterCustomDrawBackWall) then - OnAfterCustomDrawBackwall(Self, Drawer, FClipRect); + OnAfterCustomDrawBackwall(Self, ADrawer, FClipRect); if Supports(ADrawer, IChartTCanvasDrawer, ic) and Assigned(OnAfterDrawBackWall) then OnAfterDrawBackWall(Self, ic.Canvas, FClipRect); diff --git a/components/tachart/taseries.pas b/components/tachart/taseries.pas index cf3f8c8f25..9baf624d6d 100644 --- a/components/tachart/taseries.pas +++ b/components/tachart/taseries.pas @@ -1152,6 +1152,7 @@ var TopLeft := ParentChart.GraphToImage(graphBar.a); BottomRight := ParentChart.GraphToImage(graphBar.b); TAGeometry.NormalizeRect(imageBar); + if IsRotated then inc(imageBar.Right) else dec(imageBar.Top); // Draw a line instead of an empty rectangle. // if Bottom = Top then Dec(Top); diff --git a/lcl/interfaces/gtk2/gtk2wsforms.pp b/lcl/interfaces/gtk2/gtk2wsforms.pp index 103791b741..3fedfdd068 100644 --- a/lcl/interfaces/gtk2/gtk2wsforms.pp +++ b/lcl/interfaces/gtk2/gtk2wsforms.pp @@ -735,7 +735,8 @@ begin end; GtkWindow := {%H-}PGtkWindow(AForm.Handle); - if (fsModal in AForm.FormState) and AForm.HandleObjectShouldBeVisible then + + if AForm.HandleObjectShouldBeVisible then begin LastMouse.Button := 0; LastMouse.ClickCount := 0; @@ -743,6 +744,10 @@ begin LastMouse.MousePos := Point(0, 0); LastMouse.Time := 0; 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_widget_set_uposition(PGtkWidget(GtkWindow), AForm.Left, AForm.Top); gtk_window_set_type_hint({%H-}PGtkWindow(AForm.Handle),