mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-05 22:38:03 +02:00
Made PRoject Build compile the active unit. This way we can actually play with it by compiling units.
git-svn-id: trunk@73 -
This commit is contained in:
parent
90b0558cba
commit
d7128b6823
@ -111,40 +111,6 @@ Begin
|
||||
|
||||
end;
|
||||
|
||||
{Function TDesigner.NewModuleSource(nmUnitName, nmForm, nmAncestor: String): Boolean;
|
||||
Var
|
||||
I : Integer;
|
||||
Begin
|
||||
FSource.Clear;
|
||||
Result := True;
|
||||
with FSource do
|
||||
try
|
||||
Add(Format('unit %s;', [nmUnitname]));
|
||||
Add('');
|
||||
Add('interface');
|
||||
Add('');
|
||||
Add('uses Classes, Graphics, Controls, Forms, Dialogs;');
|
||||
Add('');
|
||||
Add('type');
|
||||
Add(Format(' T%s = class(T%s)', [nmForm,nmAncestor]));
|
||||
Add(' private');
|
||||
Add(' { private declarations}');
|
||||
Add(' public');
|
||||
Add(' { public declarations }');
|
||||
Add(' end;');
|
||||
Add('');
|
||||
Add('var');
|
||||
Add(Format(' %s: T%0:s;', [nmForm]));
|
||||
Add('');
|
||||
Add('implementation');
|
||||
Add('');
|
||||
Add('end.');
|
||||
except
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
end;
|
||||
}
|
||||
|
||||
Procedure TDesigner.AddControlCode(Control : TComponent);
|
||||
Begin
|
||||
|
@ -44,7 +44,7 @@ type
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Compile;
|
||||
procedure Compile(MainUnit : String);
|
||||
function GetLineNumber(Value : String) : Integer;
|
||||
function GetColumnNumber(Value : String) : Integer;
|
||||
function GetMessageType(Value : String) : TErrorType;
|
||||
@ -78,7 +78,7 @@ end;
|
||||
{------------------------------------------------------------------------------}
|
||||
{ TCompiler Compile }
|
||||
{------------------------------------------------------------------------------}
|
||||
procedure TCompiler.Compile;
|
||||
procedure TCompiler.Compile(MainUnit : String);
|
||||
const
|
||||
BufSize = 1024;
|
||||
var
|
||||
@ -91,13 +91,16 @@ var
|
||||
|
||||
TheProcess : TProcess;
|
||||
begin
|
||||
Writeln('In Compile');
|
||||
|
||||
Texts := '';
|
||||
FOutputList.Clear;
|
||||
TheProgram := CompilerOPts.CompilerPath;
|
||||
//TheProgram := TheProgram + ' -Ch'+inttostr(CompilerOpts.HeapSize);
|
||||
TheProgram := TheProgram + ' '+ CompilerOpts.MakeOptionsString;
|
||||
TheProgram := TheProgram + ' '+ TUnitInfo(Project1.UnitList[0]).Filename;
|
||||
|
||||
TheProgram := TheProgram + ' '+ MainUnit;
|
||||
Writeln('TheProgram = '+TheProgram);
|
||||
|
||||
Assert(False, 'Trace:' + TheProgram);
|
||||
|
||||
TheProcess:=TProcess.Create(TheProgram,[poRunSuspended,poUsePipes,poNoConsole]);
|
||||
@ -233,6 +236,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.2 2000/12/20 20:04:30 lazarus
|
||||
Made PRoject Build compile the active unit. This way we can actually play with it by compiling units.
|
||||
|
||||
Revision 1.1 2000/07/13 10:27:46 michael
|
||||
+ Initial import
|
||||
|
||||
|
22
ide/main.pp
22
ide/main.pp
@ -662,6 +662,7 @@ begin
|
||||
itmFileSaveAs.OnClick := @SourceNotebook.SaveAsClicked;
|
||||
itmFileSaveAll.OnClick := @SourceNotebook.SaveAllClicked;
|
||||
itmFileClose.OnClick := @SourceNotebook.CloseClicked;
|
||||
itmFileNew.OnClick := @SourceNotebook.NewClicked;
|
||||
itmFileOpen.OnClick := @SourceNotebook.OpenClicked;
|
||||
SpeedButton4.OnClick := @SourceNotebook.OpenClicked;
|
||||
SpeedButton5.OnClick := @SourceNotebook.SaveClicked;
|
||||
@ -1549,6 +1550,22 @@ end;
|
||||
|
||||
Procedure TForm1.mnuBuildProjectClicked(Sender : TObject);
|
||||
Begin
|
||||
//for now just compile the active unit;
|
||||
SourceNotebook.SaveClicked(Sender);
|
||||
|
||||
if not(MessageDlg.Visible) then
|
||||
Begin //display the dialog under the TSourceNotebook
|
||||
MessageDlg.Show;
|
||||
MessageDlg.Top := Screen.Height - 150;
|
||||
MessageDlg.Height := 150;
|
||||
{ if (SourceNotebook.Top+SourceNotebook.Height) > MEssageDlg.Top then
|
||||
SourceNotebook.Height := SourceNotebook.Height - (ABS(MessageDlg.Top - (SourceNotebook.Top+SourceNotebook.Height)));
|
||||
}
|
||||
MessageDlg.Left := SourceNotebook.Left;
|
||||
MessageDlg.Width := SourceNotebook.Width;
|
||||
end;
|
||||
MessageDlg.Clear;
|
||||
Compiler1.Compile(SourceNotebook.ActiveUnitName);
|
||||
|
||||
end;
|
||||
|
||||
@ -1711,9 +1728,8 @@ end.
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.21 2000/12/20 17:35:58 lazarus
|
||||
Added GetChildren
|
||||
Shane
|
||||
Revision 1.22 2000/12/20 20:04:30 lazarus
|
||||
Made PRoject Build compile the active unit. This way we can actually play with it by compiling units.
|
||||
|
||||
Revision 1.19 2000/12/19 18:43:12 lazarus
|
||||
Removed IDEEDITOR. This causes the PROJECT class to not function.
|
||||
|
@ -87,6 +87,7 @@ type
|
||||
Procedure SelectText(LineNum,CharStart,LineNum2,CharEnd : Integer);
|
||||
Procedure KeyPressed(Sender : TObject; var key: char);
|
||||
Procedure CreateFormUnit(AForm : TCustomForm);
|
||||
Procedure CreateNewUnit;
|
||||
Function Close : Boolean;
|
||||
Function Save : Boolean;
|
||||
Function Open : Boolean;
|
||||
@ -120,17 +121,18 @@ type
|
||||
protected
|
||||
Function CreateNotebook : Boolean;
|
||||
Function GetActiveSE : TSourceEditor;
|
||||
Function ActiveUnitName : String;
|
||||
Function ActiveFileName : String;
|
||||
Function DisplayPage(SE : TSourceEditor) : Boolean;
|
||||
Function NewSE(Pagenum : Integer) : TSourceEditor;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
Function ActiveUnitName : String;
|
||||
Function ActiveFileName : String;
|
||||
Procedure DisplayFormforActivePage;
|
||||
Procedure DisplayCodeforControl(Control : TObject);
|
||||
Function CreateUnitFromForm(AForm : TForm) : TSourceEditor;
|
||||
procedure CloseClicked(Sender : TObject);
|
||||
Procedure NewClicked(Sender: TObject);
|
||||
procedure OpenClicked(Sender : TObject);
|
||||
procedure SaveClicked(Sender : TObject);
|
||||
procedure SaveAllClicked(Sender : TObject);
|
||||
@ -215,6 +217,7 @@ begin
|
||||
PI := _Control.ClassInfo;
|
||||
nmControlType := PI^.Name;
|
||||
Ancestor := GetAncestor;
|
||||
|
||||
//find the place in the code to add this now.
|
||||
//Anyone have good method sfor parsing the source to find spots like this?
|
||||
//here I look for the Name of the customform, the word "Class", and it's ancestor on the same line
|
||||
@ -248,7 +251,8 @@ end;
|
||||
|
||||
Procedure TSourceEditor.DisplayControl;
|
||||
Begin
|
||||
Writeln('DisplayCOntrol');
|
||||
if FControl = nil then Exit;
|
||||
|
||||
if (FControl is TCustomForm) then TCustomForm(FControl).Show
|
||||
else
|
||||
if (FCOntrol is TControl) then TControl(FCOntrol).Visible := True;
|
||||
@ -256,9 +260,9 @@ if (FControl is TCustomForm) then TCustomForm(FControl).Show
|
||||
//Bringtofront does not work yet.
|
||||
//TControl(FControl).BringToFront;
|
||||
//so I hide it and unhide it.
|
||||
TCOntrol(FCOntrol).Visible :=False;
|
||||
TCOntrol(FCOntrol).Visible := True;
|
||||
Writeln('Exit DisplayCOntrol');
|
||||
|
||||
TControl(FCOntrol).Visible := False;
|
||||
TControl(FCOntrol).Visible := True;
|
||||
end;
|
||||
|
||||
|
||||
@ -370,6 +374,35 @@ Begin
|
||||
tempSource.Free;
|
||||
end;
|
||||
|
||||
Procedure TSourceEditor.CreateNewUnit;
|
||||
Var
|
||||
I : Integer;
|
||||
TempSource : TStringList;
|
||||
Begin
|
||||
TempSource := TStringList.Create;
|
||||
|
||||
|
||||
//figure out what the unit name should be...
|
||||
FUnitName:='Unit1'; //just assigning it to this for now
|
||||
|
||||
with TempSource do
|
||||
try
|
||||
Add(Format('unit %s;', [FUnitName]));
|
||||
Add('');
|
||||
Add('interface');
|
||||
Add('');
|
||||
Add('implementation');
|
||||
Add('');
|
||||
Add('end.');
|
||||
except
|
||||
//raise an exception
|
||||
end;
|
||||
Source := TempSource;
|
||||
tempSource.Free;
|
||||
End;
|
||||
|
||||
|
||||
|
||||
Function TSourceEditor.Close : Boolean;
|
||||
Begin
|
||||
Result := True;
|
||||
@ -616,22 +649,27 @@ Procedure TSourceNotebook.OpenClicked(Sender: TObject);
|
||||
Var
|
||||
TempEditor : TSourceEditor;
|
||||
Begin
|
||||
Writeln('***********************OPENCLICKED');
|
||||
FOpenDialog.Title := 'Open';
|
||||
Writeln('1');
|
||||
if FOpenDialog.Execute then Begin
|
||||
Writeln('2');
|
||||
//create a new page
|
||||
TempEditor := NewSE(-1);
|
||||
Writeln('3');
|
||||
TempEditor.Filename := FOpenDialog.Filename;
|
||||
TempEditor.OPen;
|
||||
Notebook1.Pages.Strings[Notebook1.Pageindex] := TempEditor.UnitName;
|
||||
Writeln('4');
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
Procedure TSourceNotebook.NewClicked(Sender: TObject);
|
||||
Var
|
||||
TempEditor : TSourceEditor;
|
||||
Begin
|
||||
//create a new page
|
||||
TempEditor := NewSE(-1);
|
||||
TempEditor.CreateNewUnit;
|
||||
Notebook1.Pages.Strings[Notebook1.Pageindex] := TempEditor.UnitName;
|
||||
End;
|
||||
|
||||
Procedure TSourceNotebook.SaveClicked(Sender: TObject);
|
||||
Begin
|
||||
if ActiveFileName <> '' then
|
||||
|
Loading…
Reference in New Issue
Block a user