From a1ea547079f08baaa316095bedb87bced0dceb48 Mon Sep 17 00:00:00 2001 From: lazarus Date: Thu, 4 Jan 2001 20:33:53 +0000 Subject: [PATCH] Moved lresources. Moved CreateLFM to Main.pp Changed Form1 and TFOrm1 to MainIDE and TMainIDE Shane git-svn-id: trunk@96 - --- .gitattributes | 2 +- ide/lazarus.pp | 8 +- ide/main.pp | 222 +++++++++++++++++++++++---------- ide/project.pp | 36 +++--- ide/uniteditor.pp | 32 +++-- lcl/extctrls.pp | 8 +- lcl/forms.pp | 58 --------- lcl/include/customnotebook.inc | 7 +- {ide => lcl}/lresources.pp | 0 9 files changed, 223 insertions(+), 150 deletions(-) rename {ide => lcl}/lresources.pp (100%) diff --git a/.gitattributes b/.gitattributes index 719f3a32f6..9e2817360a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -122,7 +122,6 @@ ide/include/win32/lazconf.inc svneol=native#text/pascal ide/lazarus.pp svneol=native#text/pascal ide/lazconf.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/project.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/lcllinux.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/messages.pp svneol=native#text/pascal lcl/registry.pp svneol=native#text/pascal diff --git a/ide/lazarus.pp b/ide/lazarus.pp index e548602a77..5ab1936472 100644 --- a/ide/lazarus.pp +++ b/ide/lazarus.pp @@ -51,7 +51,7 @@ begin Paint; end; - Application.CreateForm(TForm1, Form1); + Application.CreateForm(TMainIDE, MainIDE); Application.CreateForm(TfrmCompilerOptions, frmCompilerOptions); Application.CreateForm(TTestForm, TestForm1); Application.CreateForm(TViewUnits1, ViewUnits1); @@ -63,6 +63,12 @@ end. { $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 Removed IDEEDITOR. This causes the PROJECT class to not function. Saving projects no longer works. diff --git a/ide/main.pp b/ide/main.pp index e683beae3c..3bfaca3850 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -24,6 +24,7 @@ unit main; {$mode objfpc} +{ $mode delphi} interface @@ -40,7 +41,7 @@ const type - TForm1 = class(TFORM) + TMainIDE = class(TFORM) FontDialog1 : TFontDialog; ColorDialog1 : TColorDialog; FindDialog1 : TFindDialog; @@ -148,7 +149,9 @@ type procedure mnuSearchFindAgainClicked(Sender : TObject); Procedure OpenFileDownArrowClicked(Sender : TObject); + Procedure FileClosedEvent(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 MouseMoveOnControl(Sender : TObject; Shift : TShiftState; X, Y: Integer); @@ -199,7 +202,7 @@ const Numbers = ['0'..'1']; var - Form1 : TForm1; + MainIDE : TMainIDE; FormEditor1 : TFormEditor; // this should be moved to FormEditor <... ObjectInspector1 : TObjectInspector; @@ -216,9 +219,9 @@ uses 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 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; Top := 0; Width := Screen.Width-5; height := 125; Position:= poDesigned; - Name := 'Form1'; + Name := 'MainIDE'; LoadMainMenu; @@ -292,7 +295,7 @@ begin Notebook1 := TNotebook.Create(Self); Notebook1.Parent := Self; Notebook1.Align := alBottom; - Notebook1.Left := 0; + Notebook1.Left := 1; // Notebook1.Top :=50+ mnuBarMain.Top+MnuBarMain.Height + 2; Notebook1.Top :=50+ 2; Notebook1.Width := ClientWidth; @@ -352,6 +355,14 @@ begin 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.TransparentColor:=clBtnFace; if not LoadResource('btn_viewunits',Pixmap1) then @@ -372,20 +383,13 @@ begin end; - Pixmap1:=TPixMap.Create; - Pixmap1.TransparentColor:=clBtnFace; - if not LoadResource('btn_viewforms',Pixmap1) then - begin - LoadResource('default',Pixmap1); - end; - SpeedButton2 := TSpeedButton.Create(Self); with Speedbutton2 do Begin Parent := self; Enabled := True; Top := 28; - Left := Speedbutton1.Left + 26; + Left := SpeedButton1.Left +26; OnClick := @mnuViewFormsCLicked; Glyph := Pixmap1; Visible := True; @@ -393,6 +397,7 @@ begin Name := 'Speedbutton2'; end; + Pixmap1:=TPixMap.Create; Pixmap1.TransparentColor:=clBtnFace; if not LoadResource('btn_newunit',Pixmap1) then @@ -683,7 +688,9 @@ begin SourceNotebook := TSourceNotebook.Create(self); SourceNotebook.OnActivate := @CodeorFormActivated; + SourceNotebook.OnCloseFile := @FileClosedEvent; SourceNotebook.OnOpenFile := @FileOpenedEvent; + SourceNotebook.OnSaveFile := @FileSavedEvent; itmFileSave.OnClick := @SourceNotebook.SaveClicked; itmFileSaveAs.OnClick := @SourceNotebook.SaveAsClicked; @@ -697,25 +704,25 @@ begin end; -procedure TForm1.OIOnAddAvailableComponent(AComponent:TComponent; +procedure TMainIDE.OIOnAddAvailableComponent(AComponent:TComponent; var Allowed:boolean); begin Allowed:=(not (AComponent is TGrabber)); end; -procedure TForm1.OIOnSelectComponent(AComponent:TComponent); +procedure TMainIDE.OIOnSelectComponent(AComponent:TComponent); begin SelectOnlyThisComponent(AComponent); end; -Procedure TForm1.ToolButtonCLick(Sender : TObject); +Procedure TMainIDE.ToolButtonCLick(Sender : TObject); Begin Assert(False, 'Trace:TOOL BUTTON CLICK!'); {if ComboBox1.Parent = Toolbar1 then Begin - ComboBox1.Parent := Form1; + ComboBox1.Parent := MainIDE; ComboBox1.Left := 25; ComboBox1.top := 25; end @@ -724,29 +731,29 @@ Begin end; -Procedure TForm1.FormPaint(Sender : TObject); +Procedure TMainIDE.FormPaint(Sender : TObject); begin end; -procedure TForm1.ButtonClick(Sender : TObject); +procedure TMainIDE.ButtonClick(Sender : TObject); Begin End; {------------------------------------------------------------------------------} -procedure TForm1.FormShow(Sender : TObject); +procedure TMainIDE.FormShow(Sender : TObject); Begin end; -procedure TForm1.FormKill(Sender : TObject); +procedure TMainIDE.FormKill(Sender : TObject); Begin Assert(False, 'Trace:DESTROYING FORM'); End; {------------------------------------------------------------------------------} -procedure TForm1.LoadMainMenu; +procedure TMainIDE.LoadMainMenu; var fContext : Integer; @@ -987,14 +994,14 @@ end; {------------------------------------------------------------------------------} {PRIVATE METHOD} -function TForm1.CreateSeperator : TMenuItem; +function TMainIDE.CreateSeperator : TMenuItem; begin itmSeperator := TMenuItem.Create(Self); itmSeperator.Caption := '-'; Result := itmSeperator; end; -function TForm1.ReturnActiveUnitList : TUnitInfo; +function TMainIDE.ReturnActiveUnitList : TUnitInfo; var I : Integer; SList : TUnitInfo; @@ -1008,7 +1015,7 @@ end; {Fills the View Units dialog and the View Forms dialog} {------------------------------------------------------------------------------} -Procedure TForm1.UpdateViewDialogs; +Procedure TMainIDE.UpdateViewDialogs; Var I : Integer; SList : TUnitInfo; @@ -1036,7 +1043,7 @@ End; -Procedure TForm1.SetFlags(SList : TUnitInfo); +Procedure TMainIDE.SetFlags(SList : TUnitInfo); var Texts : String; tempNUm1, TempNUm2 : Integer; @@ -1067,7 +1074,7 @@ if SList.Flags = pfNone then end; -Procedure TForm1.SetName_Form(SList : TUnitInfo); +Procedure TMainIDE.SetName_Form(SList : TUnitInfo); Begin if (SList.flags = pfSource) or (SList.Flags = pfProject) then Begin @@ -1090,26 +1097,26 @@ Begin Assert(False, 'Trace:Exiting SetName_Form'); end; -procedure TForm1.mnuSaveClicked(Sender : TObject); +procedure TMainIDE.mnuSaveClicked(Sender : TObject); begin //this is no longer used. TSourceNotebook.SaveClicked is called end; {------------------------------------------------------------------------------} -Procedure TForm1.mnuSaveAsClicked(Sender : TObject); +Procedure TMainIDE.mnuSaveAsClicked(Sender : TObject); Begin //this is no longer used. TSourceNotebook.SaveAsClicked is called end; -Procedure TForm1.mnuSaveAllClicked(Sender : TObject); +Procedure TMainIDE.mnuSaveAllClicked(Sender : TObject); Begin //this is no longer used. TSourceNotebook.SaveAllClicked is called End; -Procedure TForm1.mnuToggleFormClicked(Sender : TObject); +Procedure TMainIDE.mnuToggleFormClicked(Sender : TObject); Begin writeln('Toggle form clicked'); @@ -1120,7 +1127,7 @@ if FCodeLastActivated then end; -Procedure TForm1.CodeorFormActivated(Sender : TObject); +Procedure TMainIDE.CodeorFormActivated(Sender : TObject); Begin FCodeLastActivated := (TForm(Sender) = TForm(SourceNotebook)); if FCodeLastActivated then Writeln('TRUE') else Writeln('False'); @@ -1138,7 +1145,7 @@ end; ------------------------------------------------------------------------ } -Procedure TForm1.ControlClick(Sender : TObject); +Procedure TMainIDE.ControlClick(Sender : TObject); var Page : Integer; I : Integer; @@ -1220,7 +1227,7 @@ begin end; -function TForm1.FindDesigner(ChildComponent:TComponent):TDesigner; +function TMainIDE.FindDesigner(ChildComponent:TComponent):TDesigner; begin if ChildComponent is TForm then Result:=TDesigner(TForm(ChildComponent).Designer) @@ -1231,7 +1238,7 @@ begin Result:=nil; end; -procedure TForm1.SelectOnlyThisComponent(AComponent:TComponent); +procedure TMainIDE.SelectOnlyThisComponent(AComponent:TComponent); var CurDesigner:TDesigner; 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); Begin if GetCaptureGrabber<>nil then exit; @@ -1281,7 +1288,7 @@ Begin end; End; -procedure TForm1.MouseMoveOnControl(Sender : TObject; +procedure TMainIDE.MouseMoveOnControl(Sender : TObject; Shift : TShiftState; X, Y: Integer); var CurDesigner: TDesigner; @@ -1308,7 +1315,7 @@ Begin end; End; -procedure TForm1.MouseUpOnControl(Sender : TObject; Button: TMouseButton; +procedure TMainIDE.MouseUpOnControl(Sender : TObject; Button: TMouseButton; Shift : TShiftState; X, Y: Integer); // 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 @@ -1383,7 +1390,7 @@ writeln('NewComponent is TControl'); end; {------------------------------------------------------------------------------} -procedure TForm1.mnuNewFormClicked(Sender : TObject); +procedure TMainIDE.mnuNewFormClicked(Sender : TObject); var I,N: Integer; SList : TUnitInfo; @@ -1423,7 +1430,7 @@ end; {------------------------------------------------------------------------------} -procedure TForm1.mnuOpenClicked(Sender : TObject); +procedure TMainIDE.mnuOpenClicked(Sender : TObject); var Str : TStringList; SList : TUnitInfo; @@ -1438,14 +1445,81 @@ end; {----------------OpenFileDownArrowClicked--------------------------------------} {------------------------------------------------------------------------------} -Procedure TForm1.OpenFileDownArrowClicked(Sender : TObject); +Procedure TMainIDE.OpenFileDownArrowClicked(Sender : TObject); Begin //display the PopupMenu if OpenFilePopupMenu.Items.Count > 0 then OpenFilePopupMenu.Popup(0,0); 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 MenuItem : TMenuItem; Begin @@ -1461,15 +1535,29 @@ RunSpeedButton.Enabled := True; 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 end; {------------------------------------------------------------------------------} -procedure TForm1.mnuQuitClicked(Sender : TObject); +procedure TMainIDE.mnuQuitClicked(Sender : TObject); var I : Integer; SList : TUnitInfo; @@ -1491,55 +1579,55 @@ end; {------------------------------------------------------------------------------} -procedure TForm1.mnuViewInspectorClicked(Sender : TObject); +procedure TMainIDE.mnuViewInspectorClicked(Sender : TObject); begin ObjectInspector1.Show; end; {------------------------------------------------------------------------------} -procedure TForm1.mnuViewCompilerSettingsClicked(Sender : TObject); +procedure TMainIDE.mnuViewCompilerSettingsClicked(Sender : TObject); begin frmCompilerOptions.Show; end; -Procedure TForm1.mnuViewUnitsClicked(Sender : TObject); +Procedure TMainIDE.mnuViewUnitsClicked(Sender : TObject); Begin end; -Procedure TForm1.mnuViewFormsClicked(Sender : TObject); +Procedure TMainIDE.mnuViewFormsClicked(Sender : TObject); Begin end; -Procedure TForm1.mnuViewCodeExplorerClick(Sender : TObject); +Procedure TMainIDE.mnuViewCodeExplorerClick(Sender : TObject); begin SourceNotebook.Show; end; -Procedure TForm1.mnuViewMessagesClick(Sender : TObject); +Procedure TMainIDE.mnuViewMessagesClick(Sender : TObject); Begin Messagedlg.Show; End; -Procedure TForm1.DoFind(Sender : TObject); +Procedure TMainIDE.DoFind(Sender : TObject); Begin end; -Procedure TForm1.mnuSearchFindClicked(Sender : TObject); +Procedure TMainIDE.mnuSearchFindClicked(Sender : TObject); Begin itmSearchFindAgain.Enabled := True; FindDialog1.ShowModal; End; -Procedure TForm1.mnuSearchFindAgainClicked(Sender : TObject); +Procedure TMainIDE.mnuSearchFindAgainClicked(Sender : TObject); Begin DoFind(itmSearchFindAgain); End; -Procedure TForm1.mnuNewProjectClicked(Sender : TObject); +Procedure TMainIDE.mnuNewProjectClicked(Sender : TObject); var SList : TUnitInfo; Begin @@ -1548,18 +1636,18 @@ end; {------------------------------------------------------------} -Procedure TForm1.mnuOpenProjectClicked(Sender : TObject); +Procedure TMainIDE.mnuOpenProjectClicked(Sender : TObject); Begin end; -Procedure TForm1.mnuSaveProjectClicked(Sender : TObject); +Procedure TMainIDE.mnuSaveProjectClicked(Sender : TObject); Begin end; -Procedure TForm1.mnuBuildProjectClicked(Sender : TObject); +Procedure TMainIDE.mnuBuildProjectClicked(Sender : TObject); Begin if SourceNotebook.Empty then Begin Application.MessageBox('No units loaded. Load a program first!','Error',mb_OK); @@ -1586,7 +1674,7 @@ Compiler1.Compile(SourceNotebook.ActiveUnitName); end; -Procedure TForm1.mnuRunProjectClicked(Sender : TObject); +Procedure TMainIDE.mnuRunProjectClicked(Sender : TObject); var Filename : String; TheProcess : TProcess; @@ -1616,7 +1704,7 @@ if SourceNotebook.Empty then Begin end; -Procedure TForm1.mnuViewColorClicked(Sender : TObject); +Procedure TMainIDE.mnuViewColorClicked(Sender : TObject); begin ColorDialog1.Execute; @@ -1625,13 +1713,13 @@ ColorDialog1.Execute; end; -Procedure TForm1.mnuViewFontClicked(Sender : TObject); +Procedure TMainIDE.mnuViewFontClicked(Sender : TObject); Begin FontDialog1.Execute; end; -Function TForm1.ReturnFormName(Source : TStringlist) : String; +Function TMainIDE.ReturnFormName(Source : TStringlist) : String; Var I : Integer; Num,Num2 : Integer; @@ -1754,7 +1842,7 @@ if Found then result := Texts; end; -Procedure TForm1.MessageViewDblClick(Sender : TObject); +Procedure TMainIDE.MessageViewDblClick(Sender : TObject); Begin end; @@ -1770,8 +1858,10 @@ end. { ============================================================================= $Log$ - Revision 1.31 2001/01/04 16:12:54 lazarus - Removed some writelns and changed the property editor for TStrings a bit. + Revision 1.32 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.30 2001/01/03 18:44:54 lazarus diff --git a/ide/project.pp b/ide/project.pp index 85c95743ce..02ba6eb05c 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -144,10 +144,10 @@ begin INIFile.WriteInteger('Main Window','Create',1); INIFile.WriteInteger('Main Window','Visible',1); INIFile.WriteInteger('Main Window','State',0); //0 = normal? - INIFile.WriteInteger('Main Window','Left',Form1.Left); - INIFile.WriteInteger('Main Window','Top',Form1.Top); - INIFile.WriteInteger('Main Window','Width',Form1.Width); - INIFile.WriteInteger('Main Window','Height',Form1.Height); + INIFile.WriteInteger('Main Window','Left',MainIDE.Left); + INIFile.WriteInteger('Main Window','Top',MainIDE.Top); + INIFile.WriteInteger('Main Window','Width',MainIDE.Width); + INIFile.WriteInteger('Main Window','Height',MainIDE.Height); INIFile.WriteInteger('Message Window','Create',1); if Messagedlg.Visible @@ -155,10 +155,10 @@ begin else INIFile.WriteInteger('Message WIndow','Visible',0); INIFile.WriteInteger('Message Window','State',0); //0 = normal? - INIFile.WriteInteger('Message Window','Left',Form1.Left); - INIFile.WriteInteger('Message Window','Top',Form1.Top); - INIFile.WriteInteger('Message Window','Width',Form1.Width); - INIFile.WriteInteger('Message Window','Height',Form1.Height); + INIFile.WriteInteger('Message Window','Left',MainIDE.Left); + INIFile.WriteInteger('Message Window','Top',MainIDE.Top); + INIFile.WriteInteger('Message Window','Width',MainIDE.Width); + INIFile.WriteInteger('Message Window','Height',MainIDE.Height); IniFile.Free; @@ -198,8 +198,8 @@ begin SList.Filename := TempStr; SList.Source.LoadFromFile(SList.Filename); SList.Page := -1; - Form1.SetFlags(SList); - Form1.SetName_Form(SList); + MainIDE.SetFlags(SList); + MainIDE.SetName_Form(SList); FUnits.Add(SList); end; end; @@ -251,11 +251,11 @@ begin tempEditor.LeftChar := INIFIle.ReadInteger('View'+inttostr(i),'LeftCol',0); end; - Form1.Visible := (INIFile.ReadInteger('Main Window','Visible',1) = 1); - Form1.Left := INIFile.ReadInteger('Main Window','Left',0); - Form1.Top := INIFile.ReadInteger('Main Window','Top',0); - Form1.Height := INIFile.ReadInteger('Main Window','Height',100); - Form1.Width := INIFile.ReadInteger('Main Window','Width',800); + MainIDE.Visible := (INIFile.ReadInteger('Main Window','Visible',1) = 1); + MainIDE.Left := INIFile.ReadInteger('Main Window','Left',0); + MainIDE.Top := INIFile.ReadInteger('Main Window','Top',0); + MainIDE.Height := INIFile.ReadInteger('Main Window','Height',100); + MainIDE.Width := INIFile.ReadInteger('Main Window','Width',800); Messagedlg.Visible := (INIFile.ReadInteger('Message WIndow','Visible',1) = 1); Messagedlg.Left := INIFile.ReadInteger('Message Window','Left',0); @@ -293,6 +293,12 @@ end; end. { $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 Removed IDEEDITOR. This causes the PROJECT class to not function. Saving projects no longer works. diff --git a/ide/uniteditor.pp b/ide/uniteditor.pp index f44cd5ae36..9dec811b8c 100644 --- a/ide/uniteditor.pp +++ b/ide/uniteditor.pp @@ -93,7 +93,6 @@ type Procedure ToggleBreakpointClicked(Sender : TObject); Procedure OpenAtCursorClicked(Sender : TObject); - property Control : TComponent read FControl; property Editor : TmwCustomEdit read FEditor; public @@ -104,14 +103,16 @@ type Procedure KeyPressed(Sender : TObject; var key: char); Procedure CreateFormUnit(AForm : TCustomForm); Procedure CreateNewUnit; + Function IsControlUnit : Boolean; Function Close : Boolean; Function Save : Boolean; Function Open : Boolean; - property Source : TStrings read GetSource write SetSource; + property Control : TComponent read FControl; property CurrentCursorXLine : Integer read GetCurrentCursorXLine write SetCurrentCursorXLine; property CurrentCursorYLine : Integer read GetCurrentCursorYLine write SetCurrentCursorYLine; property Owner : TComponent read FAOwner; + property Source : TStrings read GetSource write SetSource; property UnitName : String read FUnitName; property FileName : String read FFileName write FFilename; property Modified : Boolean read GetModified; @@ -133,6 +134,8 @@ type FSaveDialog : TSaveDialog; FOpenDialog : TOpenDialog; FOnOpenFile : TNotifyFileEvent; + FOnCloseFile : TNotifyFileEvent; + FOnSaveFile : TNotifyFileEvent; Function GetEmpty : Boolean; //look at the # of pages protected Function CreateNotebook : Boolean; @@ -147,6 +150,7 @@ type Procedure DisplayFormforActivePage; Procedure DisplayCodeforControl(Control : TObject); Function CreateUnitFromForm(AForm : TForm) : TSourceEditor; + procedure CloseClicked(Sender : TObject); Procedure NewClicked(Sender: TObject); procedure OpenClicked(Sender : TObject); @@ -157,7 +161,9 @@ type Procedure OpenFile(FileName: String); + property OnCloseFile : TNotifyFileEvent read FOnCloseFile write FOnCloseFile; property OnOpenFile : TNotifyFileEvent read FOnOPenFile write FOnOPenFile; + property OnSaveFile : TNotifyFileEvent read FOnSaveFile write FOnSaveFile; property Empty : Boolean read GetEmpty; end; @@ -178,7 +184,7 @@ Begin FSource := TStringList.create; BuildPopupMenu; - + FControl := nil; CreateEditor(AOwner,AParent); FEditor.PopupMenu := FPopupMenu; @@ -638,6 +644,7 @@ Begin try FEditor.Lines.SaveToFile(FileName); + FModified := False; except Result := False; end; @@ -651,6 +658,11 @@ CreateEditor(FAOwner,AParent); End; +Function TSourceEditor.IsControlUnit : Boolean; +Begin +Result := (FControl <> nil); +end; + {------------------------------------------------------------------------} { TSourceNotebook } @@ -891,7 +903,10 @@ End; Procedure TSourceNotebook.SaveClicked(Sender: TObject); Begin if ActiveFileName <> '' then -GetActiveSE.Save + begin + if (GetActiveSE.Save) then + if assigned(FOnSaveFile) then FOnSaveFile(TObject(GetActiveSE),ActiveFilename) + end else SaveAsClicked(Sender); @@ -914,7 +929,8 @@ if (GetActiveSE.Modified) then If Application.MessageBox('Source has changed. Save now?','Warning',mb_YesNo) = mrYes then SaveClicked(Sender); - GetActiveSE.Close; + if (GetActiveSE.Close) then + if assigned(FOnCloseFile) then FOnCloseFile(self,ActiveFileName); Notebook1.Pages.Delete(Notebook1.Pageindex); @@ -936,7 +952,8 @@ Begin if FSaveDialog.Execute then begin GetActiveSe.FileName := FSaveDialog.Filename; - GetActiveSE.Save; + if (GetActiveSE.Save) then + if assigned(FOnSaveFile) then FOnSaveFile(TObject(GetActiveSE),ActiveFilename); end else Exit; @@ -960,7 +977,8 @@ Begin if FSaveDialog.Execute then begin TempEditor.FileName := FSaveDialog.Filename; - TempEditor.Save; + if (TempEditor.Save) then + if assigned(FOnSaveFile) then FOnSaveFile(TObject(TempEditor),TempEditor.FileName); end else Break; diff --git a/lcl/extctrls.pp b/lcl/extctrls.pp index 167034620e..0d67a3df1c 100644 --- a/lcl/extctrls.pp +++ b/lcl/extctrls.pp @@ -159,7 +159,7 @@ type public constructor Create(AOwner: TComponent); override; destructor Destroy; override; - + published property ActivePage; property PageIndex; property Pages; @@ -321,6 +321,12 @@ end. { $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 Added more images to the resource. Shane diff --git a/lcl/forms.pp b/lcl/forms.pp index 35c1985ffd..88d98011e7 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -273,7 +273,6 @@ function KeysToShiftState(Keys:Word): TShiftState; function KeyDataToShiftState(KeyData: Longint): TShiftState; function GetParentForm(Control:TControl): TCustomForm; function IsAccel(VK : Word; const Str : String): Boolean; -function CreateLFM(AForm:TCustomForm):integer; function InitResourceComponent(Instance: TComponent; RootAncestor: TClass):Boolean; @@ -326,63 +325,6 @@ begin 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; - -//============================================================================== - //============================================================================== diff --git a/lcl/include/customnotebook.inc b/lcl/include/customnotebook.inc index c57fdccaa1..50fdbf134d 100644 --- a/lcl/include/customnotebook.inc +++ b/lcl/include/customnotebook.inc @@ -176,7 +176,6 @@ begin //Exclude(fComponentStyle, csInheritable); TabPosition := tpTop; - ShowTabs := False; end; @@ -430,6 +429,12 @@ end; { ============================================================================= $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 + Initial import diff --git a/ide/lresources.pp b/lcl/lresources.pp similarity index 100% rename from ide/lresources.pp rename to lcl/lresources.pp