Moved lresources.

Moved CreateLFM to Main.pp
Changed Form1 and TFOrm1 to MainIDE and TMainIDE
Shane

git-svn-id: trunk@96 -
This commit is contained in:
lazarus 2001-01-04 20:33:53 +00:00
parent da8f1b2837
commit a1ea547079
9 changed files with 223 additions and 150 deletions

2
.gitattributes vendored
View File

@ -122,7 +122,6 @@ ide/include/win32/lazconf.inc svneol=native#text/pascal
ide/lazarus.pp svneol=native#text/pascal ide/lazarus.pp svneol=native#text/pascal
ide/lazconf.pp svneol=native#text/pascal ide/lazconf.pp svneol=native#text/pascal
ide/lazres.pp svneol=native#text/pascal ide/lazres.pp svneol=native#text/pascal
ide/lresources.pp svneol=native#text/pascal
ide/main.pp svneol=native#text/pascal ide/main.pp svneol=native#text/pascal
ide/project.pp svneol=native#text/pascal ide/project.pp svneol=native#text/pascal
ide/splash.pp svneol=native#text/pascal ide/splash.pp svneol=native#text/pascal
@ -283,6 +282,7 @@ lcl/interfaces/win32/win32int.pp svneol=native#text/pascal
lcl/interfaces/win32/win32object.inc svneol=native#text/pascal lcl/interfaces/win32/win32object.inc svneol=native#text/pascal
lcl/lcllinux.pp svneol=native#text/pascal lcl/lcllinux.pp svneol=native#text/pascal
lcl/lmessages.pp svneol=native#text/pascal lcl/lmessages.pp svneol=native#text/pascal
lcl/lresources.pp svneol=native#text/pascal
lcl/menus.pp svneol=native#text/pascal lcl/menus.pp svneol=native#text/pascal
lcl/messages.pp svneol=native#text/pascal lcl/messages.pp svneol=native#text/pascal
lcl/registry.pp svneol=native#text/pascal lcl/registry.pp svneol=native#text/pascal

View File

@ -51,7 +51,7 @@ begin
Paint; Paint;
end; end;
Application.CreateForm(TForm1, Form1); Application.CreateForm(TMainIDE, MainIDE);
Application.CreateForm(TfrmCompilerOptions, frmCompilerOptions); Application.CreateForm(TfrmCompilerOptions, frmCompilerOptions);
Application.CreateForm(TTestForm, TestForm1); Application.CreateForm(TTestForm, TestForm1);
Application.CreateForm(TViewUnits1, ViewUnits1); Application.CreateForm(TViewUnits1, ViewUnits1);
@ -63,6 +63,12 @@ end.
{ {
$Log$ $Log$
Revision 1.6 2001/01/04 20:33:53 lazarus
Moved lresources.
Moved CreateLFM to Main.pp
Changed Form1 and TFOrm1 to MainIDE and TMainIDE
Shane
Revision 1.5 2000/12/19 18:43:12 lazarus Revision 1.5 2000/12/19 18:43:12 lazarus
Removed IDEEDITOR. This causes the PROJECT class to not function. Removed IDEEDITOR. This causes the PROJECT class to not function.
Saving projects no longer works. Saving projects no longer works.

View File

@ -24,6 +24,7 @@
unit main; unit main;
{$mode objfpc} {$mode objfpc}
{ $mode delphi}
interface interface
@ -40,7 +41,7 @@ const
type type
TForm1 = class(TFORM) TMainIDE = class(TFORM)
FontDialog1 : TFontDialog; FontDialog1 : TFontDialog;
ColorDialog1 : TColorDialog; ColorDialog1 : TColorDialog;
FindDialog1 : TFindDialog; FindDialog1 : TFindDialog;
@ -148,7 +149,9 @@ type
procedure mnuSearchFindAgainClicked(Sender : TObject); procedure mnuSearchFindAgainClicked(Sender : TObject);
Procedure OpenFileDownArrowClicked(Sender : TObject); Procedure OpenFileDownArrowClicked(Sender : TObject);
Procedure FileClosedEvent(Sender : TObject; Filename : String);
Procedure FileOpenedEvent(Sender : TObject; Filename : String); Procedure FileOpenedEvent(Sender : TObject; Filename : String);
Procedure FileSavedEvent(Sender : TObject; Filename : String);
procedure MouseDownOnControl(Sender : TObject; Button: TMouseButton; Shift : TShiftState; X, Y: Integer); procedure MouseDownOnControl(Sender : TObject; Button: TMouseButton; Shift : TShiftState; X, Y: Integer);
procedure MouseMoveOnControl(Sender : TObject; Shift : TShiftState; X, Y: Integer); procedure MouseMoveOnControl(Sender : TObject; Shift : TShiftState; X, Y: Integer);
@ -199,7 +202,7 @@ const
Numbers = ['0'..'1']; Numbers = ['0'..'1'];
var var
Form1 : TForm1; MainIDE : TMainIDE;
FormEditor1 : TFormEditor; FormEditor1 : TFormEditor;
// this should be moved to FormEditor <... // this should be moved to FormEditor <...
ObjectInspector1 : TObjectInspector; ObjectInspector1 : TObjectInspector;
@ -216,9 +219,9 @@ uses
TestForm, ViewUnit_dlg,ViewForm_dlg, Math,lresources; TestForm, ViewUnit_dlg,ViewForm_dlg, Math,lresources;
{ TForm1 } { TMainIDE }
constructor TForm1.Create(AOwner: TComponent); constructor TMainIDE.Create(AOwner: TComponent);
@ -259,14 +262,14 @@ var
begin begin
inherited Create(AOwner); inherited Create(AOwner);
Caption := Format('Lazarus Editor v 0.5- Lazarus path = %s Highlight colors: %d , %d , %d ,%d ,%d',[Application.exename,clHighlight, clHighlighttext, clRed,clBlue,clYellow]); Caption := 'Lazarus Editor v 0.5';
Left := 0; Left := 0;
Top := 0; Top := 0;
Width := Screen.Width-5; Width := Screen.Width-5;
height := 125; height := 125;
Position:= poDesigned; Position:= poDesigned;
Name := 'Form1'; Name := 'MainIDE';
LoadMainMenu; LoadMainMenu;
@ -292,7 +295,7 @@ begin
Notebook1 := TNotebook.Create(Self); Notebook1 := TNotebook.Create(Self);
Notebook1.Parent := Self; Notebook1.Parent := Self;
Notebook1.Align := alBottom; Notebook1.Align := alBottom;
Notebook1.Left := 0; Notebook1.Left := 1;
// Notebook1.Top :=50+ mnuBarMain.Top+MnuBarMain.Height + 2; // Notebook1.Top :=50+ mnuBarMain.Top+MnuBarMain.Height + 2;
Notebook1.Top :=50+ 2; Notebook1.Top :=50+ 2;
Notebook1.Width := ClientWidth; Notebook1.Width := ClientWidth;
@ -352,6 +355,14 @@ begin
Notebook1.Name := 'Notebook1'; Notebook1.Name := 'Notebook1';
Pixmap1:=TPixMap.Create;
Pixmap1.TransparentColor:=clBtnFace;
if not LoadResource('btn_viewforms',Pixmap1) then
begin
LoadResource('default',Pixmap1);
end;
Pixmap1:=TPixMap.Create; Pixmap1:=TPixMap.Create;
Pixmap1.TransparentColor:=clBtnFace; Pixmap1.TransparentColor:=clBtnFace;
if not LoadResource('btn_viewunits',Pixmap1) then if not LoadResource('btn_viewunits',Pixmap1) then
@ -372,20 +383,13 @@ begin
end; end;
Pixmap1:=TPixMap.Create;
Pixmap1.TransparentColor:=clBtnFace;
if not LoadResource('btn_viewforms',Pixmap1) then
begin
LoadResource('default',Pixmap1);
end;
SpeedButton2 := TSpeedButton.Create(Self); SpeedButton2 := TSpeedButton.Create(Self);
with Speedbutton2 do with Speedbutton2 do
Begin Begin
Parent := self; Parent := self;
Enabled := True; Enabled := True;
Top := 28; Top := 28;
Left := Speedbutton1.Left + 26; Left := SpeedButton1.Left +26;
OnClick := @mnuViewFormsCLicked; OnClick := @mnuViewFormsCLicked;
Glyph := Pixmap1; Glyph := Pixmap1;
Visible := True; Visible := True;
@ -393,6 +397,7 @@ begin
Name := 'Speedbutton2'; Name := 'Speedbutton2';
end; end;
Pixmap1:=TPixMap.Create; Pixmap1:=TPixMap.Create;
Pixmap1.TransparentColor:=clBtnFace; Pixmap1.TransparentColor:=clBtnFace;
if not LoadResource('btn_newunit',Pixmap1) then if not LoadResource('btn_newunit',Pixmap1) then
@ -683,7 +688,9 @@ begin
SourceNotebook := TSourceNotebook.Create(self); SourceNotebook := TSourceNotebook.Create(self);
SourceNotebook.OnActivate := @CodeorFormActivated; SourceNotebook.OnActivate := @CodeorFormActivated;
SourceNotebook.OnCloseFile := @FileClosedEvent;
SourceNotebook.OnOpenFile := @FileOpenedEvent; SourceNotebook.OnOpenFile := @FileOpenedEvent;
SourceNotebook.OnSaveFile := @FileSavedEvent;
itmFileSave.OnClick := @SourceNotebook.SaveClicked; itmFileSave.OnClick := @SourceNotebook.SaveClicked;
itmFileSaveAs.OnClick := @SourceNotebook.SaveAsClicked; itmFileSaveAs.OnClick := @SourceNotebook.SaveAsClicked;
@ -697,25 +704,25 @@ begin
end; end;
procedure TForm1.OIOnAddAvailableComponent(AComponent:TComponent; procedure TMainIDE.OIOnAddAvailableComponent(AComponent:TComponent;
var Allowed:boolean); var Allowed:boolean);
begin begin
Allowed:=(not (AComponent is TGrabber)); Allowed:=(not (AComponent is TGrabber));
end; end;
procedure TForm1.OIOnSelectComponent(AComponent:TComponent); procedure TMainIDE.OIOnSelectComponent(AComponent:TComponent);
begin begin
SelectOnlyThisComponent(AComponent); SelectOnlyThisComponent(AComponent);
end; end;
Procedure TForm1.ToolButtonCLick(Sender : TObject); Procedure TMainIDE.ToolButtonCLick(Sender : TObject);
Begin Begin
Assert(False, 'Trace:TOOL BUTTON CLICK!'); Assert(False, 'Trace:TOOL BUTTON CLICK!');
{if ComboBox1.Parent = Toolbar1 then {if ComboBox1.Parent = Toolbar1 then
Begin Begin
ComboBox1.Parent := Form1; ComboBox1.Parent := MainIDE;
ComboBox1.Left := 25; ComboBox1.Left := 25;
ComboBox1.top := 25; ComboBox1.top := 25;
end end
@ -724,29 +731,29 @@ Begin
end; end;
Procedure TForm1.FormPaint(Sender : TObject); Procedure TMainIDE.FormPaint(Sender : TObject);
begin begin
end; end;
procedure TForm1.ButtonClick(Sender : TObject); procedure TMainIDE.ButtonClick(Sender : TObject);
Begin Begin
End; End;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
procedure TForm1.FormShow(Sender : TObject); procedure TMainIDE.FormShow(Sender : TObject);
Begin Begin
end; end;
procedure TForm1.FormKill(Sender : TObject); procedure TMainIDE.FormKill(Sender : TObject);
Begin Begin
Assert(False, 'Trace:DESTROYING FORM'); Assert(False, 'Trace:DESTROYING FORM');
End; End;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
procedure TForm1.LoadMainMenu; procedure TMainIDE.LoadMainMenu;
var var
fContext : Integer; fContext : Integer;
@ -987,14 +994,14 @@ end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
{PRIVATE METHOD} {PRIVATE METHOD}
function TForm1.CreateSeperator : TMenuItem; function TMainIDE.CreateSeperator : TMenuItem;
begin begin
itmSeperator := TMenuItem.Create(Self); itmSeperator := TMenuItem.Create(Self);
itmSeperator.Caption := '-'; itmSeperator.Caption := '-';
Result := itmSeperator; Result := itmSeperator;
end; end;
function TForm1.ReturnActiveUnitList : TUnitInfo; function TMainIDE.ReturnActiveUnitList : TUnitInfo;
var var
I : Integer; I : Integer;
SList : TUnitInfo; SList : TUnitInfo;
@ -1008,7 +1015,7 @@ end;
{Fills the View Units dialog and the View Forms dialog} {Fills the View Units dialog and the View Forms dialog}
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
Procedure TForm1.UpdateViewDialogs; Procedure TMainIDE.UpdateViewDialogs;
Var Var
I : Integer; I : Integer;
SList : TUnitInfo; SList : TUnitInfo;
@ -1036,7 +1043,7 @@ End;
Procedure TForm1.SetFlags(SList : TUnitInfo); Procedure TMainIDE.SetFlags(SList : TUnitInfo);
var var
Texts : String; Texts : String;
tempNUm1, TempNUm2 : Integer; tempNUm1, TempNUm2 : Integer;
@ -1067,7 +1074,7 @@ if SList.Flags = pfNone then
end; end;
Procedure TForm1.SetName_Form(SList : TUnitInfo); Procedure TMainIDE.SetName_Form(SList : TUnitInfo);
Begin Begin
if (SList.flags = pfSource) or (SList.Flags = pfProject) then if (SList.flags = pfSource) or (SList.Flags = pfProject) then
Begin Begin
@ -1090,26 +1097,26 @@ Begin
Assert(False, 'Trace:Exiting SetName_Form'); Assert(False, 'Trace:Exiting SetName_Form');
end; end;
procedure TForm1.mnuSaveClicked(Sender : TObject); procedure TMainIDE.mnuSaveClicked(Sender : TObject);
begin begin
//this is no longer used. TSourceNotebook.SaveClicked is called //this is no longer used. TSourceNotebook.SaveClicked is called
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
Procedure TForm1.mnuSaveAsClicked(Sender : TObject); Procedure TMainIDE.mnuSaveAsClicked(Sender : TObject);
Begin Begin
//this is no longer used. TSourceNotebook.SaveAsClicked is called //this is no longer used. TSourceNotebook.SaveAsClicked is called
end; end;
Procedure TForm1.mnuSaveAllClicked(Sender : TObject); Procedure TMainIDE.mnuSaveAllClicked(Sender : TObject);
Begin Begin
//this is no longer used. TSourceNotebook.SaveAllClicked is called //this is no longer used. TSourceNotebook.SaveAllClicked is called
End; End;
Procedure TForm1.mnuToggleFormClicked(Sender : TObject); Procedure TMainIDE.mnuToggleFormClicked(Sender : TObject);
Begin Begin
writeln('Toggle form clicked'); writeln('Toggle form clicked');
@ -1120,7 +1127,7 @@ if FCodeLastActivated then
end; end;
Procedure TForm1.CodeorFormActivated(Sender : TObject); Procedure TMainIDE.CodeorFormActivated(Sender : TObject);
Begin Begin
FCodeLastActivated := (TForm(Sender) = TForm(SourceNotebook)); FCodeLastActivated := (TForm(Sender) = TForm(SourceNotebook));
if FCodeLastActivated then Writeln('TRUE') else Writeln('False'); if FCodeLastActivated then Writeln('TRUE') else Writeln('False');
@ -1138,7 +1145,7 @@ end;
------------------------------------------------------------------------ ------------------------------------------------------------------------
} }
Procedure TForm1.ControlClick(Sender : TObject); Procedure TMainIDE.ControlClick(Sender : TObject);
var var
Page : Integer; Page : Integer;
I : Integer; I : Integer;
@ -1220,7 +1227,7 @@ begin
end; end;
function TForm1.FindDesigner(ChildComponent:TComponent):TDesigner; function TMainIDE.FindDesigner(ChildComponent:TComponent):TDesigner;
begin begin
if ChildComponent is TForm then if ChildComponent is TForm then
Result:=TDesigner(TForm(ChildComponent).Designer) Result:=TDesigner(TForm(ChildComponent).Designer)
@ -1231,7 +1238,7 @@ begin
Result:=nil; Result:=nil;
end; end;
procedure TForm1.SelectOnlyThisComponent(AComponent:TComponent); procedure TMainIDE.SelectOnlyThisComponent(AComponent:TComponent);
var var
CurDesigner:TDesigner; CurDesigner:TDesigner;
begin begin
@ -1257,7 +1264,7 @@ end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
procedure TForm1.MouseDownOnControl(Sender : TObject; Button: TMouseButton; procedure TMainIDE.MouseDownOnControl(Sender : TObject; Button: TMouseButton;
Shift : TShiftState; X, Y: Integer); Shift : TShiftState; X, Y: Integer);
Begin Begin
if GetCaptureGrabber<>nil then exit; if GetCaptureGrabber<>nil then exit;
@ -1281,7 +1288,7 @@ Begin
end; end;
End; End;
procedure TForm1.MouseMoveOnControl(Sender : TObject; procedure TMainIDE.MouseMoveOnControl(Sender : TObject;
Shift : TShiftState; X, Y: Integer); Shift : TShiftState; X, Y: Integer);
var var
CurDesigner: TDesigner; CurDesigner: TDesigner;
@ -1308,7 +1315,7 @@ Begin
end; end;
End; End;
procedure TForm1.MouseUpOnControl(Sender : TObject; Button: TMouseButton; procedure TMainIDE.MouseUpOnControl(Sender : TObject; Button: TMouseButton;
Shift : TShiftState; X, Y: Integer); Shift : TShiftState; X, Y: Integer);
// We clicked on the form. Let's see what the active selection is in the IDE // We clicked on the form. Let's see what the active selection is in the IDE
// control bar. If it's the pointer, then we set the // control bar. If it's the pointer, then we set the
@ -1383,7 +1390,7 @@ writeln('NewComponent is TControl');
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
procedure TForm1.mnuNewFormClicked(Sender : TObject); procedure TMainIDE.mnuNewFormClicked(Sender : TObject);
var var
I,N: Integer; I,N: Integer;
SList : TUnitInfo; SList : TUnitInfo;
@ -1423,7 +1430,7 @@ end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
procedure TForm1.mnuOpenClicked(Sender : TObject); procedure TMainIDE.mnuOpenClicked(Sender : TObject);
var var
Str : TStringList; Str : TStringList;
SList : TUnitInfo; SList : TUnitInfo;
@ -1438,14 +1445,81 @@ end;
{----------------OpenFileDownArrowClicked--------------------------------------} {----------------OpenFileDownArrowClicked--------------------------------------}
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
Procedure TForm1.OpenFileDownArrowClicked(Sender : TObject); Procedure TMainIDE.OpenFileDownArrowClicked(Sender : TObject);
Begin Begin
//display the PopupMenu //display the PopupMenu
if OpenFilePopupMenu.Items.Count > 0 then if OpenFilePopupMenu.Items.Count > 0 then
OpenFilePopupMenu.Popup(0,0); OpenFilePopupMenu.Popup(0,0);
end; end;
Procedure TForm1.FileOpenedEvent(Sender : TObject; Filename : String); //==============================================================================
{
This function creates a LFM file from any form.
To create the LFC file use the program lazres or the
LFMtoLFCfile function.
}
function CreateLFM(AForm:TCustomForm):integer;
// 0 = ok
// -1 = error while streaming AForm to binary stream
// -2 = error while streaming binary stream to text file
var BinStream,TxtMemStream:TMemoryStream;
Driver: TAbstractObjectWriter;
Writer:TWriter;
TxtFileStream:TFileStream;
begin
BinStream:=TMemoryStream.Create;
try
try
Driver:=TBinaryObjectWriter.Create(BinStream,4096);
try
Writer:=TWriter.Create(Driver);
try
Writer.WriteDescendent(AForm,nil);
finally
Writer.Free;
end;
finally
Driver.Free;
end;
except
Result:=-1;
exit;
end;
try
// transform binary to text and save LFM file
TxtMemStream:=TMemoryStream.Create;
TxtFileStream:=TFileStream.Create(lowercase(AForm.ClassName)+'.lfm',fmCreate);
try
BinStream.Position:=0;
ObjectBinaryToText(BinStream,TxtMemStream);
TxtMemStream.Position:=0;
TxtFileStream.CopyFrom(TxtMemStream,TxtMemStream.Size);
finally
TxtMemStream.Free;
TxtFileStream.Free;
end;
except
Result:=-2;
exit;
end;
finally
BinStream.Free;
end;
end;
//==============================================================================
Procedure TMainIDE.FileClosedEvent(Sender : TObject; Filename : String);
var
MenuItem : TMenuItem;
Begin
end;
Procedure TMainIDE.FileOpenedEvent(Sender : TObject; Filename : String);
var var
MenuItem : TMenuItem; MenuItem : TMenuItem;
Begin Begin
@ -1461,15 +1535,29 @@ RunSpeedButton.Enabled := True;
end; end;
Procedure TMainIDE.FileSavedEvent(Sender : TObject; Filename : String);
var
MenuItem : TMenuItem;
Begin
//sender is the TSourceEditor
writeln('FILESAVEDEVENT');
If TSourceEditor(Sender).IsControlUnit then
begin
Writeln('*****************CREATRING LFM********************');
Writeln('Result = '+Inttostr(CreateLFM(TCustomForm(TSourceEditor(Sender).Control))));
// writeln('RESULT IS '+inttostr(CreateLFM(Self)));
end;
end;
Procedure TForm1.mnuCloseClicked(Sender : TObject);
Procedure TMainIDE.mnuCloseClicked(Sender : TObject);
Begin Begin
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
procedure TForm1.mnuQuitClicked(Sender : TObject); procedure TMainIDE.mnuQuitClicked(Sender : TObject);
var var
I : Integer; I : Integer;
SList : TUnitInfo; SList : TUnitInfo;
@ -1491,55 +1579,55 @@ end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
procedure TForm1.mnuViewInspectorClicked(Sender : TObject); procedure TMainIDE.mnuViewInspectorClicked(Sender : TObject);
begin begin
ObjectInspector1.Show; ObjectInspector1.Show;
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}
procedure TForm1.mnuViewCompilerSettingsClicked(Sender : TObject); procedure TMainIDE.mnuViewCompilerSettingsClicked(Sender : TObject);
begin begin
frmCompilerOptions.Show; frmCompilerOptions.Show;
end; end;
Procedure TForm1.mnuViewUnitsClicked(Sender : TObject); Procedure TMainIDE.mnuViewUnitsClicked(Sender : TObject);
Begin Begin
end; end;
Procedure TForm1.mnuViewFormsClicked(Sender : TObject); Procedure TMainIDE.mnuViewFormsClicked(Sender : TObject);
Begin Begin
end; end;
Procedure TForm1.mnuViewCodeExplorerClick(Sender : TObject); Procedure TMainIDE.mnuViewCodeExplorerClick(Sender : TObject);
begin begin
SourceNotebook.Show; SourceNotebook.Show;
end; end;
Procedure TForm1.mnuViewMessagesClick(Sender : TObject); Procedure TMainIDE.mnuViewMessagesClick(Sender : TObject);
Begin Begin
Messagedlg.Show; Messagedlg.Show;
End; End;
Procedure TForm1.DoFind(Sender : TObject); Procedure TMainIDE.DoFind(Sender : TObject);
Begin Begin
end; end;
Procedure TForm1.mnuSearchFindClicked(Sender : TObject); Procedure TMainIDE.mnuSearchFindClicked(Sender : TObject);
Begin Begin
itmSearchFindAgain.Enabled := True; itmSearchFindAgain.Enabled := True;
FindDialog1.ShowModal; FindDialog1.ShowModal;
End; End;
Procedure TForm1.mnuSearchFindAgainClicked(Sender : TObject); Procedure TMainIDE.mnuSearchFindAgainClicked(Sender : TObject);
Begin Begin
DoFind(itmSearchFindAgain); DoFind(itmSearchFindAgain);
End; End;
Procedure TForm1.mnuNewProjectClicked(Sender : TObject); Procedure TMainIDE.mnuNewProjectClicked(Sender : TObject);
var var
SList : TUnitInfo; SList : TUnitInfo;
Begin Begin
@ -1548,18 +1636,18 @@ end;
{------------------------------------------------------------} {------------------------------------------------------------}
Procedure TForm1.mnuOpenProjectClicked(Sender : TObject); Procedure TMainIDE.mnuOpenProjectClicked(Sender : TObject);
Begin Begin
end; end;
Procedure TForm1.mnuSaveProjectClicked(Sender : TObject); Procedure TMainIDE.mnuSaveProjectClicked(Sender : TObject);
Begin Begin
end; end;
Procedure TForm1.mnuBuildProjectClicked(Sender : TObject); Procedure TMainIDE.mnuBuildProjectClicked(Sender : TObject);
Begin Begin
if SourceNotebook.Empty then Begin if SourceNotebook.Empty then Begin
Application.MessageBox('No units loaded. Load a program first!','Error',mb_OK); Application.MessageBox('No units loaded. Load a program first!','Error',mb_OK);
@ -1586,7 +1674,7 @@ Compiler1.Compile(SourceNotebook.ActiveUnitName);
end; end;
Procedure TForm1.mnuRunProjectClicked(Sender : TObject); Procedure TMainIDE.mnuRunProjectClicked(Sender : TObject);
var var
Filename : String; Filename : String;
TheProcess : TProcess; TheProcess : TProcess;
@ -1616,7 +1704,7 @@ if SourceNotebook.Empty then Begin
end; end;
Procedure TForm1.mnuViewColorClicked(Sender : TObject); Procedure TMainIDE.mnuViewColorClicked(Sender : TObject);
begin begin
ColorDialog1.Execute; ColorDialog1.Execute;
@ -1625,13 +1713,13 @@ ColorDialog1.Execute;
end; end;
Procedure TForm1.mnuViewFontClicked(Sender : TObject); Procedure TMainIDE.mnuViewFontClicked(Sender : TObject);
Begin Begin
FontDialog1.Execute; FontDialog1.Execute;
end; end;
Function TForm1.ReturnFormName(Source : TStringlist) : String; Function TMainIDE.ReturnFormName(Source : TStringlist) : String;
Var Var
I : Integer; I : Integer;
Num,Num2 : Integer; Num,Num2 : Integer;
@ -1754,7 +1842,7 @@ if Found then
result := Texts; result := Texts;
end; end;
Procedure TForm1.MessageViewDblClick(Sender : TObject); Procedure TMainIDE.MessageViewDblClick(Sender : TObject);
Begin Begin
end; end;
@ -1770,8 +1858,10 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.31 2001/01/04 16:12:54 lazarus Revision 1.32 2001/01/04 20:33:53 lazarus
Removed some writelns and changed the property editor for TStrings a bit. Moved lresources.
Moved CreateLFM to Main.pp
Changed Form1 and TFOrm1 to MainIDE and TMainIDE
Shane Shane
Revision 1.30 2001/01/03 18:44:54 lazarus Revision 1.30 2001/01/03 18:44:54 lazarus

View File

@ -144,10 +144,10 @@ begin
INIFile.WriteInteger('Main Window','Create',1); INIFile.WriteInteger('Main Window','Create',1);
INIFile.WriteInteger('Main Window','Visible',1); INIFile.WriteInteger('Main Window','Visible',1);
INIFile.WriteInteger('Main Window','State',0); //0 = normal? INIFile.WriteInteger('Main Window','State',0); //0 = normal?
INIFile.WriteInteger('Main Window','Left',Form1.Left); INIFile.WriteInteger('Main Window','Left',MainIDE.Left);
INIFile.WriteInteger('Main Window','Top',Form1.Top); INIFile.WriteInteger('Main Window','Top',MainIDE.Top);
INIFile.WriteInteger('Main Window','Width',Form1.Width); INIFile.WriteInteger('Main Window','Width',MainIDE.Width);
INIFile.WriteInteger('Main Window','Height',Form1.Height); INIFile.WriteInteger('Main Window','Height',MainIDE.Height);
INIFile.WriteInteger('Message Window','Create',1); INIFile.WriteInteger('Message Window','Create',1);
if Messagedlg.Visible if Messagedlg.Visible
@ -155,10 +155,10 @@ begin
else INIFile.WriteInteger('Message WIndow','Visible',0); else INIFile.WriteInteger('Message WIndow','Visible',0);
INIFile.WriteInteger('Message Window','State',0); //0 = normal? INIFile.WriteInteger('Message Window','State',0); //0 = normal?
INIFile.WriteInteger('Message Window','Left',Form1.Left); INIFile.WriteInteger('Message Window','Left',MainIDE.Left);
INIFile.WriteInteger('Message Window','Top',Form1.Top); INIFile.WriteInteger('Message Window','Top',MainIDE.Top);
INIFile.WriteInteger('Message Window','Width',Form1.Width); INIFile.WriteInteger('Message Window','Width',MainIDE.Width);
INIFile.WriteInteger('Message Window','Height',Form1.Height); INIFile.WriteInteger('Message Window','Height',MainIDE.Height);
IniFile.Free; IniFile.Free;
@ -198,8 +198,8 @@ begin
SList.Filename := TempStr; SList.Filename := TempStr;
SList.Source.LoadFromFile(SList.Filename); SList.Source.LoadFromFile(SList.Filename);
SList.Page := -1; SList.Page := -1;
Form1.SetFlags(SList); MainIDE.SetFlags(SList);
Form1.SetName_Form(SList); MainIDE.SetName_Form(SList);
FUnits.Add(SList); FUnits.Add(SList);
end; end;
end; end;
@ -251,11 +251,11 @@ begin
tempEditor.LeftChar := INIFIle.ReadInteger('View'+inttostr(i),'LeftCol',0); tempEditor.LeftChar := INIFIle.ReadInteger('View'+inttostr(i),'LeftCol',0);
end; end;
Form1.Visible := (INIFile.ReadInteger('Main Window','Visible',1) = 1); MainIDE.Visible := (INIFile.ReadInteger('Main Window','Visible',1) = 1);
Form1.Left := INIFile.ReadInteger('Main Window','Left',0); MainIDE.Left := INIFile.ReadInteger('Main Window','Left',0);
Form1.Top := INIFile.ReadInteger('Main Window','Top',0); MainIDE.Top := INIFile.ReadInteger('Main Window','Top',0);
Form1.Height := INIFile.ReadInteger('Main Window','Height',100); MainIDE.Height := INIFile.ReadInteger('Main Window','Height',100);
Form1.Width := INIFile.ReadInteger('Main Window','Width',800); MainIDE.Width := INIFile.ReadInteger('Main Window','Width',800);
Messagedlg.Visible := (INIFile.ReadInteger('Message WIndow','Visible',1) = 1); Messagedlg.Visible := (INIFile.ReadInteger('Message WIndow','Visible',1) = 1);
Messagedlg.Left := INIFile.ReadInteger('Message Window','Left',0); Messagedlg.Left := INIFile.ReadInteger('Message Window','Left',0);
@ -293,6 +293,12 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.3 2001/01/04 20:33:53 lazarus
Moved lresources.
Moved CreateLFM to Main.pp
Changed Form1 and TFOrm1 to MainIDE and TMainIDE
Shane
Revision 1.2 2000/12/19 18:43:13 lazarus Revision 1.2 2000/12/19 18:43:13 lazarus
Removed IDEEDITOR. This causes the PROJECT class to not function. Removed IDEEDITOR. This causes the PROJECT class to not function.
Saving projects no longer works. Saving projects no longer works.

View File

@ -93,7 +93,6 @@ type
Procedure ToggleBreakpointClicked(Sender : TObject); Procedure ToggleBreakpointClicked(Sender : TObject);
Procedure OpenAtCursorClicked(Sender : TObject); Procedure OpenAtCursorClicked(Sender : TObject);
property Control : TComponent read FControl;
property Editor : TmwCustomEdit read FEditor; property Editor : TmwCustomEdit read FEditor;
public public
@ -104,14 +103,16 @@ type
Procedure KeyPressed(Sender : TObject; var key: char); Procedure KeyPressed(Sender : TObject; var key: char);
Procedure CreateFormUnit(AForm : TCustomForm); Procedure CreateFormUnit(AForm : TCustomForm);
Procedure CreateNewUnit; Procedure CreateNewUnit;
Function IsControlUnit : Boolean;
Function Close : Boolean; Function Close : Boolean;
Function Save : Boolean; Function Save : Boolean;
Function Open : Boolean; Function Open : Boolean;
property Source : TStrings read GetSource write SetSource; property Control : TComponent read FControl;
property CurrentCursorXLine : Integer read GetCurrentCursorXLine write SetCurrentCursorXLine; property CurrentCursorXLine : Integer read GetCurrentCursorXLine write SetCurrentCursorXLine;
property CurrentCursorYLine : Integer read GetCurrentCursorYLine write SetCurrentCursorYLine; property CurrentCursorYLine : Integer read GetCurrentCursorYLine write SetCurrentCursorYLine;
property Owner : TComponent read FAOwner; property Owner : TComponent read FAOwner;
property Source : TStrings read GetSource write SetSource;
property UnitName : String read FUnitName; property UnitName : String read FUnitName;
property FileName : String read FFileName write FFilename; property FileName : String read FFileName write FFilename;
property Modified : Boolean read GetModified; property Modified : Boolean read GetModified;
@ -133,6 +134,8 @@ type
FSaveDialog : TSaveDialog; FSaveDialog : TSaveDialog;
FOpenDialog : TOpenDialog; FOpenDialog : TOpenDialog;
FOnOpenFile : TNotifyFileEvent; FOnOpenFile : TNotifyFileEvent;
FOnCloseFile : TNotifyFileEvent;
FOnSaveFile : TNotifyFileEvent;
Function GetEmpty : Boolean; //look at the # of pages Function GetEmpty : Boolean; //look at the # of pages
protected protected
Function CreateNotebook : Boolean; Function CreateNotebook : Boolean;
@ -147,6 +150,7 @@ type
Procedure DisplayFormforActivePage; Procedure DisplayFormforActivePage;
Procedure DisplayCodeforControl(Control : TObject); Procedure DisplayCodeforControl(Control : TObject);
Function CreateUnitFromForm(AForm : TForm) : TSourceEditor; Function CreateUnitFromForm(AForm : TForm) : TSourceEditor;
procedure CloseClicked(Sender : TObject); procedure CloseClicked(Sender : TObject);
Procedure NewClicked(Sender: TObject); Procedure NewClicked(Sender: TObject);
procedure OpenClicked(Sender : TObject); procedure OpenClicked(Sender : TObject);
@ -157,7 +161,9 @@ type
Procedure OpenFile(FileName: String); Procedure OpenFile(FileName: String);
property OnCloseFile : TNotifyFileEvent read FOnCloseFile write FOnCloseFile;
property OnOpenFile : TNotifyFileEvent read FOnOPenFile write FOnOPenFile; property OnOpenFile : TNotifyFileEvent read FOnOPenFile write FOnOPenFile;
property OnSaveFile : TNotifyFileEvent read FOnSaveFile write FOnSaveFile;
property Empty : Boolean read GetEmpty; property Empty : Boolean read GetEmpty;
end; end;
@ -178,7 +184,7 @@ Begin
FSource := TStringList.create; FSource := TStringList.create;
BuildPopupMenu; BuildPopupMenu;
FControl := nil;
CreateEditor(AOwner,AParent); CreateEditor(AOwner,AParent);
FEditor.PopupMenu := FPopupMenu; FEditor.PopupMenu := FPopupMenu;
@ -638,6 +644,7 @@ Begin
try try
FEditor.Lines.SaveToFile(FileName); FEditor.Lines.SaveToFile(FileName);
FModified := False;
except except
Result := False; Result := False;
end; end;
@ -651,6 +658,11 @@ CreateEditor(FAOwner,AParent);
End; End;
Function TSourceEditor.IsControlUnit : Boolean;
Begin
Result := (FControl <> nil);
end;
{------------------------------------------------------------------------} {------------------------------------------------------------------------}
{ TSourceNotebook } { TSourceNotebook }
@ -891,7 +903,10 @@ End;
Procedure TSourceNotebook.SaveClicked(Sender: TObject); Procedure TSourceNotebook.SaveClicked(Sender: TObject);
Begin Begin
if ActiveFileName <> '' then if ActiveFileName <> '' then
GetActiveSE.Save begin
if (GetActiveSE.Save) then
if assigned(FOnSaveFile) then FOnSaveFile(TObject(GetActiveSE),ActiveFilename)
end
else else
SaveAsClicked(Sender); SaveAsClicked(Sender);
@ -914,7 +929,8 @@ if (GetActiveSE.Modified) then
If Application.MessageBox('Source has changed. Save now?','Warning',mb_YesNo) = mrYes then If Application.MessageBox('Source has changed. Save now?','Warning',mb_YesNo) = mrYes then
SaveClicked(Sender); SaveClicked(Sender);
GetActiveSE.Close; if (GetActiveSE.Close) then
if assigned(FOnCloseFile) then FOnCloseFile(self,ActiveFileName);
Notebook1.Pages.Delete(Notebook1.Pageindex); Notebook1.Pages.Delete(Notebook1.Pageindex);
@ -936,7 +952,8 @@ Begin
if FSaveDialog.Execute then if FSaveDialog.Execute then
begin begin
GetActiveSe.FileName := FSaveDialog.Filename; GetActiveSe.FileName := FSaveDialog.Filename;
GetActiveSE.Save; if (GetActiveSE.Save) then
if assigned(FOnSaveFile) then FOnSaveFile(TObject(GetActiveSE),ActiveFilename);
end end
else else
Exit; Exit;
@ -960,7 +977,8 @@ Begin
if FSaveDialog.Execute then if FSaveDialog.Execute then
begin begin
TempEditor.FileName := FSaveDialog.Filename; TempEditor.FileName := FSaveDialog.Filename;
TempEditor.Save; if (TempEditor.Save) then
if assigned(FOnSaveFile) then FOnSaveFile(TObject(TempEditor),TempEditor.FileName);
end end
else else
Break; Break;

View File

@ -159,7 +159,7 @@ type
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
published
property ActivePage; property ActivePage;
property PageIndex; property PageIndex;
property Pages; property Pages;
@ -321,6 +321,12 @@ end.
{ {
$Log$ $Log$
Revision 1.3 2001/01/04 20:33:53 lazarus
Moved lresources.
Moved CreateLFM to Main.pp
Changed Form1 and TFOrm1 to MainIDE and TMainIDE
Shane
Revision 1.2 2000/12/29 15:04:07 lazarus Revision 1.2 2000/12/29 15:04:07 lazarus
Added more images to the resource. Added more images to the resource.
Shane Shane

View File

@ -273,7 +273,6 @@ function KeysToShiftState(Keys:Word): TShiftState;
function KeyDataToShiftState(KeyData: Longint): TShiftState; function KeyDataToShiftState(KeyData: Longint): TShiftState;
function GetParentForm(Control:TControl): TCustomForm; function GetParentForm(Control:TControl): TCustomForm;
function IsAccel(VK : Word; const Str : String): Boolean; function IsAccel(VK : Word; const Str : String): Boolean;
function CreateLFM(AForm:TCustomForm):integer;
function InitResourceComponent(Instance: TComponent; RootAncestor: TClass):Boolean; function InitResourceComponent(Instance: TComponent; RootAncestor: TClass):Boolean;
@ -326,63 +325,6 @@ begin
end; end;
//==============================================================================
{
This function creates a LFM file from any form.
To create the LFC file use the program lazres or the
LFMtoLFCfile function.
}
function CreateLFM(AForm:TCustomForm):integer;
// 0 = ok
// -1 = error while streaming AForm to binary stream
// -2 = error while streaming binary stream to text file
var BinStream,TxtMemStream:TMemoryStream;
Driver: TAbstractObjectWriter;
Writer:TWriter;
TxtFileStream:TFileStream;
begin
BinStream:=TMemoryStream.Create;
try
try
Driver:=TBinaryObjectWriter.Create(BinStream,4096);
try
Writer:=TWriter.Create(Driver);
try
Writer.WriteDescendent(AForm,nil);
finally
Writer.Free;
end;
finally
Driver.Free;
end;
except
Result:=-1;
exit;
end;
try
// transform binary to text and save LFM file
TxtMemStream:=TMemoryStream.Create;
TxtFileStream:=TFileStream.Create(lowercase(AForm.ClassName)+'.lfm',fmCreate);
try
BinStream.Position:=0;
ObjectBinaryToText(BinStream,TxtMemStream);
TxtMemStream.Position:=0;
TxtFileStream.CopyFrom(TxtMemStream,TxtMemStream.Size);
finally
TxtMemStream.Free;
TxtFileStream.Free;
end;
except
Result:=-2;
exit;
end;
finally
BinStream.Free;
end;
end;
//==============================================================================
//============================================================================== //==============================================================================

View File

@ -176,7 +176,6 @@ begin
//Exclude(fComponentStyle, csInheritable); //Exclude(fComponentStyle, csInheritable);
TabPosition := tpTop; TabPosition := tpTop;
ShowTabs := False; ShowTabs := False;
end; end;
@ -430,6 +429,12 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.2 2001/01/04 20:33:53 lazarus
Moved lresources.
Moved CreateLFM to Main.pp
Changed Form1 and TFOrm1 to MainIDE and TMainIDE
Shane
Revision 1.1 2000/07/13 10:28:25 michael Revision 1.1 2000/07/13 10:28:25 michael
+ Initial import + Initial import