Removed IDEEDITOR. This causes the PROJECT class to not function.

Saving projects no longer works.

I added TSourceNotebook and TSourceEditor.  They do all the work for saving/closing/opening units.  Somethings work but they are in early development.
Shane

git-svn-id: trunk@68 -
This commit is contained in:
lazarus 2000-12-19 18:43:13 +00:00
parent 1cacf661b1
commit 4ccb1fbc5a
15 changed files with 208 additions and 1018 deletions

1
.gitattributes vendored
View File

@ -114,7 +114,6 @@ ide/formeditor.pp svneol=native#text/pascal
ide/global.inc svneol=native#text/pascal
ide/global.pp svneol=native#text/pascal
ide/idecomp.pp svneol=native#text/pascal
ide/ideeditor.pp svneol=native#text/pascal
ide/include/linux/lazconf.inc svneol=native#text/pascal
ide/include/win32/lazconf.inc svneol=native#text/pascal
ide/lazarus.pp svneol=native#text/pascal

View File

@ -25,7 +25,7 @@ unit designer;
interface
uses
classes, Forms, controls, lmessages, graphics, ControlSelection, FormEditor;
classes, Forms, controls, lmessages, graphics, ControlSelection, FormEditor, UnitEditor;
type
TGridPoint = record
@ -37,17 +37,15 @@ type
private
FCustomForm: TCustomForm;
FFormEditor : TFormEditor;
FSourceEditor : TSourceEditor;
function GetIsControl: Boolean;
procedure SetIsControl(Value: Boolean);
FSource : TStringList;
Function GetFormAncestor : String;
protected
Function NewModuleSource(nmUnitName, nmForm, nmAncestor: String) : Boolean;
public
ControlSelection : TControlSelection;
constructor Create(customform : TCustomform);
destructor Destroy; override;
Function AddControlCode(Control : TComponent) : Boolean;
Procedure AddControlCode(Control : TComponent);
procedure CreateNew(FileName : string);
procedure LoadFile(FileName: string);
@ -59,7 +57,7 @@ type
property IsControl: Boolean read GetIsControl write SetIsControl;
property Form: TCustomForm read FCustomForm write FCustomForm;
property FormEditor : TFormEditor read FFormEditor write FFormEditor;
property FormAncestor : String read GetFormAncestor;
property SourceEditor : TSourceEditor read FSourceEditor write FSourceEditor;
end;
implementation
@ -77,50 +75,21 @@ var
I : Integer;
begin
inherited Create;
FCustomForm := CustomForm;
FSource := TStringList.Create;
//create the code for the unit
if UpperCase(copy(FormAncestor,1,4))='FORM' then
nmUnit:='Unit'+copy(FormAncestor,5,length(FormAncestor)-4)
else
nmUnit:='Unit1';
NewModuleSource(nmUnit,CustomForm.Name,FormAncestor);
// The controlselection should NOT be owned by the form.
// When it is it shows up in the OI
// XXX ToDo: The OI should ask the formeditor for a good list of components
ControlSelection := TControlSelection.Create(CustomForm);
try
Writeln('**********************************************');
for I := 1 to FSource.Count do
writeln(FSource.Strings[i-1]);
Writeln('**********************************************');
except
Application.MessageBox('error','error',0);
end;
//the source is created when the form is created.
//the TDesigner is created is MAin.pp and then TDesigner.SourceEditor := SourceNotebook.CreateFormFromUnit(CustomForm);
end;
destructor TDesigner.Destroy;
Begin
ControlSelection.free;
FSource.Free;
Inherited;
end;
Function TDesigner.GetFormAncestor : String;
var
PI : PTypeInfo;
begin
PI := FCustomForm.ClassInfo;
Result := PI^.Name;
Delete(Result,1,1);
end;
procedure TDesigner.CreateNew(FileName : string);
begin
@ -142,7 +111,7 @@ Begin
end;
Function TDesigner.NewModuleSource(nmUnitName, nmForm, nmAncestor: String): Boolean;
{Function TDesigner.NewModuleSource(nmUnitName, nmForm, nmAncestor: String): Boolean;
Var
I : Integer;
Begin
@ -173,59 +142,15 @@ Begin
except
Result := False;
end;
end;
Function TDesigner.AddControlCode(Control : TComponent) : Boolean;
var
PT : PTypeData;
PI : PTypeInfo;
nmControlType : String;
I : Integer;
NewSource : String;
begin
//get the control name
PI := Control.ClassInfo;
nmControlType := PI^.Name;
//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
//not very good because it could be a comment or just a description of the class.
//but for now I'll use it.
For I := 0 to FSource.Count-1 do
if (pos(FormAncestor,FSource.Strings[i]) <> 0) and (pos(FCustomForm.Name,FSource.Strings[i]) <> 0) and (pos('CLASS',Uppercase(FSource.Strings[i])) <> 0) then
Break;
//if I => FSource.Count then I didn't find the line...
If I < FSource.Count then
Begin
//alphabetical
inc(i);
NewSource := Control.Name+' : '+nmControlType+';';
// Here I decide if I need to try and insert the control's text code in any certain order.
//if there's no controls then I just insert it, otherwise...
if TWincontrol(Control.Owner).ControlCount > 0 then
while NewSource > (trim(FSource.Strings[i])) do
inc(i);
FSource.Insert(i,' '+NewSource);
end;
//debugging
try
Writeln('**********************************************');
for I := 1 to FSource.Count do
writeln(FSource.Strings[i-1]);
Writeln('**********************************************');
except
Application.MessageBox('error','error',0);
end;
//debugging end
end;
}
Procedure TDesigner.AddControlCode(Control : TComponent);
Begin
FSourceEditor.AddControlCode(Control);
end;
procedure TDesigner.Notification(AComponent: TComponent; Operation: TOperation);
Begin

View File

@ -28,54 +28,6 @@ var
Replace : Boolean;
TempEdit : TmwCustomEdit;
begin
if (FFormName <> Value) and (FFormName <> '') and (FSource.Count > 0) then
begin
{
run through the source and replace FFormName with Value
this needs to first check for FFormName, then see if the character before it
and after it are either space or non valid characters.
if so, then replace it, otherwise it's simply part of a word.
}
for I := 0 to FSource.Count-1 do
begin
Texts := FSource.Strings[i];
TempNum := 1;
while TempNum <> 0 do
begin
Replace := True;
TempNum := pos(FFormName,Texts);
if TempNum > 0
then begin
//check the surrounding characters for valid ones. If valid, leave it.
if (TempNum > 1)
and ((Texts[Tempnum - 1] in ['a'..'z']) or (Texts[TempNum - 1] in ['A'..'Z']) or (Texts[Tempnum - 1] in ['0'..'1']))
then Replace := False;
if Replace
and (((TempNum-1) + Length(FFormName)) <= Length(Texts)) //doesn't extend to the last character in the line
and ((Texts[Tempnum+ Length(FFormName)] in ['a'..'z']) or (Texts[TempNum+ Length(FFormName)] in ['A'..'Z']) or (Texts[Tempnum+ Length(FFormName)] in ['0'..'1']))
then Replace := False;
if Replace
then begin
Delete(Texts,TempNum,Length(FFormName));
Insert(Texts,Value,Tempnum);
end;
end; //Tempnum > 0 ...
end; //while ...
FSource.Strings[I] := Texts;
end; //for I ...
//update the editor with the new source if the page <> -1;
if FPage <> -1
then begin
TempEdit := IdeEditor1.GetEditorFromPage(FPage);
TempEdit.Lines.Assign(FSource);
end;
end; //if (FFormname <> value) and ...
//Update FFormname
FFormName := Value;
end;
function TUnitInfo.GetFormName : String;
@ -118,43 +70,6 @@ var
TempEdit : TmwCustomEdit;
num,i : Integer;
begin
for num := 0 to Source.Count-1 do
begin
if (pos('END.',uppercase(Source.Strings[num])) <> 0)
then begin
//validate that this is an actual procedure line
break;
end;
end;
I := num - 1;
if I < Source.Count
then begin //found it
Source.Insert(I + 1, Value);
Source.Insert(I + 2, 'Begin');
Source.Insert(I + 3, '');
Source.Insert(I + 4, 'end;');
Source.Insert(I + 5, '');
//reassign source to editor.
if FPage <> -1
then begin
TempEdit := IdeEditor1.GetEditorFromPage(FPage);
if TempEdit <> nil
then begin
TempEdit.Lines.Assign(Source);
IdeEditor1.Notebook1.pages.Strings[Page] := Name;
//move cursor to the right spot between begin end
TempEdit.CaretX := 1;
TempEdit.CaretY := i+3;
IdeEditor1.Notebook1.Pageindex := page;
IdeEditor1.Bringtofront;
TempEdit.SetFocus;
end;
end;
end
else
Writeln('!!!!!!!!!!!no END. found!!!!!!!!!!!!!!!!');
end;
@ -167,74 +82,18 @@ var
Num : Integer;
END_Found,PROC_Found, PUBLIC_Found, PRIVATE_Found : Boolean;
begin
END_Found := False;
PROC_Found := False;
PUBLIC_Found := False;
PRIVATE_Found := False;
//parse the file until either procedures appear or the private section starts
I := findStartClass(Formname,0);
//repeat until you find a procedure, private, public, protected, published, or an end
for num := i to Source.Count-1 do
begin
if ( pos('PROCEDURE',uppercase(Source.Strings[num])) <> 0)
then begin
//validate that this is an actual procedure line
PROC_Found := True;
break;
end;
if ( pos('PRIVATE',uppercase(Source.Strings[num])) <> 0)
then begin
//validate that this is the actual PRIVATE section
PRIVATE_Found := True;
break;
end;
if ( pos('PUBLIC',uppercase(Source.Strings[num])) <> 0)
then begin
//validate that this is the actual PUBLIC section
PUBLIC_Found := True;
break;
end;
if ( pos('END;',uppercase(Source.Strings[num])) <> 0)
then begin
//validate that this is the actual END of the class
END_Found := True;
break;
end;
end;
I := num-1;
if I < Source.Count
then begin //found it
//figure out how many spaces are in front of it.
SpaceCount := length(Source.Strings[i+1]) - length(trimleft(Source.Strings[i+1]));
//Should drop down into the section before any procedures
//and private section but for now, just add the line
Value := TrimLeft(Value);
//Add 1+spacecount spaces of it's a private, public or end
if not(PROC_FOUND) then Inc(SpaceCount);
for num := 1 to SpaceCount do Value := ' ' + Value;
Source.Insert(I + 1, Value);
//reassign source to editor.
if Fpage <> -1 then
begin
TempEdit := IdeEditor1.GetEditorFromPage(Page);
if TempEdit <> nil
then begin
TempEdit.Lines.Assign(Source);
IdeEditor1.Notebook1.pages.Strings[Page] := Name;
end;
end;
end;
end;
{ =============================================================================
$Log$
Revision 1.2 2000/12/19 18:43:12 lazarus
Removed IDEEDITOR. This causes the PROJECT class to not function.
Saving projects no longer works.
I added TSourceNotebook and TSourceEditor. They do all the work for saving/closing/opening units. Somethings work but they are in early development.
Shane
Revision 1.1 2000/07/13 10:27:46 michael
+ Initial import

View File

@ -63,7 +63,7 @@ var
implementation
uses
IdeEditor, mwCustomEdit;
mwCustomEdit;
{$I global.inc}
@ -73,6 +73,13 @@ end.
{ =============================================================================
$Log$
Revision 1.4 2000/12/19 18:43:12 lazarus
Removed IDEEDITOR. This causes the PROJECT class to not function.
Saving projects no longer works.
I added TSourceNotebook and TSourceEditor. They do all the work for saving/closing/opening units. Somethings work but they are in early development.
Shane
Revision 1.3 2000/12/01 18:12:40 lazarus
Modified Gloabal so TDesignForm isn't included anymore.
Shane

View File

@ -1,339 +0,0 @@
{
/***************************************************************************
IDEEditor.pp
-------------------
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
}
{$H+}
//{$DEFINE NEW_EDITOR}
//{$DEFINE NEW_EDITOR_SYNEDIT}
unit IDEEditor;
{$mode objfpc}
interface
uses
classes, Controls, forms,buttons,sysutils,
{$ifdef NEW_EDITOR_SYNEDIT}
synedit,SysHighlighterpas,
{$else}
mwcustomedit,mwPasSyn,
{$endif}
Graphics,Extctrls;
type
{$ifdef NEW_EDITOR_SYNEDIT}
TmwCustomEdit = TSynEdit;
TmwPasSyn = TSynPasSyn;
{$endif}
TIDEEditor = class(TFORM)
Notebook1 : TNotebook;
private
FEmpty : Boolean;
{$ifdef NEW_EDITOR_SYNEDIT}
FHighlighter: TSynPasSyn;
{$else}
FHighlighter: TmwPasSyn;
{$endif}
FCurrentSource : TStrings;
FCurrentCursorXLine : Integer;
FCurrentCursorYLine : Integer;
function CreateNewEditor(const AParent: TWinControl): TmwCustomEdit;
Function GetCurrentSource : TStrings;
Function GetCurrentCursorXLine : Integer;
Procedure SetCurrentCursorXLine(num : Integer);
Function GetCurrentCursorYLine : Integer;
Procedure SetCurrentCursorYLine(num : Integer);
protected
Procedure IDEEditorPaint(Sender : TObject);
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
Function AddPage(title: String; Lines : TStringList) : TmwCustomEdit;
Procedure DeletePage(Value : Integer);
Function GetEditorfromPage(Value : Integer) : TmwCustomEdit;
Procedure SelectText(LineNum,CharStart,LineNum2,CharEnd : Integer);
Procedure KeyPressed(Sender : TObject; var key: char);
property CurrentSource : TStrings read GetCurrentSource;
property CurrentCursorXLine : Integer read GetCurrentCursorXLine write SetCurrentCursorXLine;
property CurrentCursorYLine : Integer read GetCurrentCursorYLine write SetCurrentCursorYLine;
property Empty : Boolean read FEmpty write FEmpty;
end;
var
IDEEditor1 : TIDEEditor;
implementation
uses
LCLLinux;
constructor TIDEEDitor.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Caption := 'Lazarus Editor';
Left := 0;
Top := 0;
Width := 600;
height := 600;
Notebook1 := TNotebook.Create(Self);
Notebook1.Parent := Self;
Notebook1.Align := alClient;
Notebook1.Left := 0;
Notebook1.Top :=2;
Notebook1.Width := ClientWidth;
Notebook1.Height := ClientHeight-Notebook1.top;
Notebook1.Pages.Strings[0] := 'NewUnit.pp';
Notebook1.PageIndex := 0; // Set it to the first page
Notebook1.Show;
Empty := True;
FHighlighter := nil;
{
FHighlighter := TmwPasSyn.Create(Self);
FHighlighter.CommentAttri.Foreground := clNavy;
FHighlighter.NumberAttri.Foreground := clRed;
FHighlighter.KeyAttri.Foreground := clGreen;
}
//OnPaint := @IDEEditorPaint;
end;
destructor TIDEEditor.Destroy;
begin
FHighlighter.Free;
inherited Destroy;
end;
function TIDEEditor.CreateNewEditor(const AParent: TWinControl): TmwCustomEdit;
begin
if FHighlighter = nil
then begin
FHighlighter := TmwPasSyn.Create(Self);
FHighlighter.CommentAttri.Foreground := clNavy;
FHighlighter.NumberAttri.Foreground := clRed;
FHighlighter.KeyAttri.Foreground := clGreen;
end;
Result := TmwCustomEdit.Create(Self);
with Result do
begin
Parent := AParent;
Top := 25;
Left := 0;
Align := alClient;
Width := Notebook1.ClientWidth - 10;//clientwidth;//500;
Height := Notebook1.ClientHeight -10;//clientheight;//250;
{$IFDEF NEW_EDITOR}
Gutter.Color := clBtnface;
Gutter.ShowLineNumbers := True;
{$ELSE}
GutterColor := clBtnface;
{$ENDIF}
Color := clWindow;
Visible := True;
Font.Name := 'courier';
Font.Size := 12;
if FHighlighter = nil
then begin
// MWE: Don't ask me wy but a highlighter created outside
// an editor doesn't work
Highlighter := TmwPasSyn.Create(Self);
with TmwPasSyn(HighLighter) do
begin
CommentAttri.Foreground := clNavy;
NumberAttri.Foreground := clRed;
KeyAttri.Foreground := clGreen;
end;
FHighLighter := HighLighter;
end
else HighLighter := FHighLighter;
// HighLighter := TmwPasSyn.Create(Self);
// TmwPasSyn(HighLighter).CommentAttri.Foreground := clNavy;
// TmwPasSyn(HighLighter).NumberAttri.Foreground := clRed;
// TmwPasSyn(HighLighter).KeyAttri.Foreground := clGreen;
OnKeyPress := @KeyPRessed;
end;
end;
Procedure TIDEEditor.KeyPressed(Sender : TObject; var key: char);
Begin
writeln('KEYPRESS '+inttostr(ord(key)));
end;
Procedure TIDEEditor.IDEEditorPaint(Sender : TObject);
Begin
Assert(False, 'Trace:IDEEDitor paint...');
end;
Function TIDEEditor.AddPage(title: String; Lines : TStringList) : TmwCustomEdit;
var
PageIndex: Integer;
Begin
if Empty
then begin
// temp fix for empty notebook (it has one page)
Empty := False;
Notebook1.Pages.Strings[0] := Title;
PageIndex := 0;
end
else PageIndex := Notebook1.Pages.Add(Title);
Result := CreateNewEditor(Notebook1.Page[PageIndex]);
Result.Lines.Assign(Lines);
with Notebook1.Pages do
Assert(False, Format('Trace:New Page title is %s --- New Page Index is %d',[Strings[Count - 1], Count - 1]));
end;
Procedure TIDEEditor.DeletePage(Value : Integer);
var
tempedit : TmwCustomEdit;
Begin
//Check to see if the page is changed
with Notebook1.Page[Value] do
Begin
TempEdit := GetEditorFromPage(Value);
if tempEdit <> nil then
Begin
if TempEdit.Modified then
begin
if Application.Messagebox('Save this unit first?', 'Question', MB_YESNO) = IDYES then
Assert(False, 'Trace:**************************MRYES')
else
Assert(False, 'Trace:**************************MRNO');
end;
end;
end;
Notebook1.Pages.Delete(Value);
if Notebook1.Pages.Count = 0 then
Begin
Empty := True;
Close;
end;
end;
Function TIdeEditor.GetEditorfromPage(Value : Integer) : TmwCustomEdit;
var
I : Integer;
Begin
Result := nil;
with Notebook1.Page[Value] do
Begin
for I := 0 to ControlCount-1 do
Begin
if Controls[I] is TmwCustomEdit then
Begin
Assert(False, 'Trace:*******************************FOUND TmwCUSTOMEDIT**************');
Result := TmwCustomEdit(Controls[I]);
break;
end;
end;
end;
end;
Function TIdeEditor.GetCurrentSource : TStrings;
var
temp : TmwCustomEdit;
begin
Temp := GetEditorFromPage(Notebook1.PageIndex);
if Temp <> nil then
Result := Temp.Lines
else
Result := nil;
end;
Function TIdeEditor.GetCurrentCursorYLine : Integer;
var
temp : TmwCustomEdit;
begin
Temp := GetEditorFromPage(Notebook1.PageIndex);
if Temp <> nil then
Result := Temp.CaretY
else
Result := 0;
end;
Procedure TIdeEditor.SetCurrentCursorYLine(num : Integer);
var
temp : TmwCustomEdit;
begin
FCurrentCursorYLine := Num;
Temp := GetEditorFromPage(Notebook1.PageIndex);
if Temp <> nil then
Temp.CaretY := Num;
end;
Function TIdeEditor.GetCurrentCursorXLine : Integer;
var
temp : TmwCustomEdit;
begin
Temp := GetEditorFromPage(Notebook1.PageIndex);
if Temp <> nil then
Result := Temp.CaretX
else
Result := 0;
end;
Procedure TIdeEditor.SetCurrentCursorXLine(num : Integer);
var
temp : TmwCustomEdit;
begin
FCurrentCursorXLine := Num;
Temp := GetEditorFromPage(Notebook1.PageIndex);
if Temp <> nil then
Temp.CaretX := Num;
end;
Procedure TideEditor.SelectText(LineNum,CharStart,LineNum2,CharEnd : Integer);
var
temp : TmwCustomEdit;
P : TPoint;
begin
Temp := GetEditorFromPage(Notebook1.PageIndex);
Writeln('In SelectText');
if Temp <> nil then
Begin
P.X := CharStart;
P.Y := LineNum;
Temp.BlockBegin := P;
P.X := CharEnd;
P.Y := LineNum2;
Temp.BlockEnd := P;
end;
end;
end.

View File

@ -33,7 +33,6 @@ uses
main,
testform,
compileroptions,
IdeEditor,
viewunit_dlg, //dialog used to list the units in a project
viewform_dlg; //dialog to display the forms in the project
@ -55,7 +54,6 @@ begin
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TfrmCompilerOptions, frmCompilerOptions);
Application.CreateForm(TTestForm, TestForm1);
Application.CreateForm(TIDEEditor, IdeEditor1);
Application.CreateForm(TViewUnits1, ViewUnits1);
Application.CreateForm(TViewForms1, ViewForms1);
SplashForm.StartTimer;
@ -65,6 +63,13 @@ end.
{
$Log$
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.
I added TSourceNotebook and TSourceEditor. They do all the work for saving/closing/opening units. Somethings work but they are in early development.
Shane
Revision 1.4 2000/09/10 23:08:29 lazarus
MWE:
+ Added CreateCompatibeleBitamp function

View File

@ -32,7 +32,7 @@ uses
Spin, project,sysutils, global,
compileroptions, Controls, graphics, extctrls, Dialogs, dlgMEssage,
Designer, process, idecomp, Find_dlg, FormEditor, AbstractFormEditor,
CustomFormEditor, ObjectInspector, ControlSelection;
CustomFormEditor, ObjectInspector, ControlSelection, UnitEditor;
const
STANDARDBTNCOUNT = 50;
@ -129,6 +129,9 @@ type
Procedure mnuViewUnitsClicked(Sender : TObject);
Procedure mnuViewFormsClicked(Sender : TObject);
Procedure mnuToggleFormClicked(Sender : TObject);
Procedure CodeorFormActivated(Sender : TObject);
Procedure mnuViewColorClicked(Sender : TObject);
Procedure mnuViewFontClicked(Sender : TObject);
procedure mnuNewProjectClicked(Sender : TObject);
@ -152,6 +155,8 @@ type
procedure OIOnAddAvailableComponent(AComponent:TComponent; var Allowed:boolean);
procedure OIOnSelectComponent(AComponent:TComponent);
private
FCodeLastActivated : Boolean; //used for toggling between code and forms
FControlLastActivated : TObject;
Function CreateSeperator : TMenuItem;
Procedure SetBtnDefaults(Control : Pointer;I,Page : Integer);
Function ReturnActiveUnitList : TUnitInfo;
@ -199,12 +204,12 @@ var
Form1 : TForm1;
FormEditor1 : TFormEditor;
ObjectInspector1 : TObjectInspector;
SourceNotebook : TSourceNotebook;
TagInc : Integer;
implementation
uses
TestForm, IDEEditor,mwCustomEdit,gtk,ViewUnit_dlg,ViewForm_dlg, Math;
TestForm, ViewUnit_dlg,ViewForm_dlg, Math;
{ TForm1 }
@ -226,6 +231,8 @@ begin
height := 125;
Position:= poDesigned;
Name := 'Form1';
LoadMainMenu;
MouseDownControl:=nil;
@ -414,7 +421,7 @@ begin
Enabled := True;
Top := 25;
Left := Speedbutton6.Left + 26;
// OnClick := @mnuToggleFormCLicked;
OnClick := @mnuToggleFormCLicked;
Glyph := Pixmap1;
Visible := True;
Name := 'Speedbutton7';
@ -643,6 +650,7 @@ begin
Compiler1 := TCompiler.Create;
Compiler1.OutputString := @Messagedlg.Add;
{ Create other forms }
ObjectInspector1 := TObjectInspector.Create(Self);
ObjectInspector1.SetBounds(0,Top+Height+5,230,600);
ObjectInspector1.OnAddAvailComponent:=@OIOnAddAvailableComponent;
@ -653,6 +661,14 @@ begin
FormEditor1 := TFormEditor.Create;
FormEditor1.Obj_Inspector := ObjectInspector1;
SourceNotebook := TSourceNotebook.Create(self);
SourceNotebook.OnActivate := @CodeorFormActivated;
itmFileSave.OnClick := @SourceNotebook.SaveClicked;
itmFileSaveAs.OnClick := @SourceNotebook.SaveAsClicked;
itmFileSaveAll.OnClick := @SourceNotebook.SaveAllClicked;
itmFileClose.OnClick := @SourceNotebook.CloseClicked;
end;
procedure TForm1.OIOnAddAvailableComponent(AComponent:TComponent;
@ -690,20 +706,11 @@ end;
procedure TForm1.ButtonClick(Sender : TObject);
Begin
TestForm1.Show;
IDEEditor1.Show;
End;
{------------------------------------------------------------------------------}
procedure TForm1.FormShow(Sender : TObject);
Begin
//Set default location for IDEEDitor;
IDEEditor1.Position := poDesigned;
IDEeditor1.Left := 0;
IdeEditor1.Top := Top+Height;
Assert(False, 'Trace:++++++++++++++____________++++++++++IN TMAINs FORMSHOW');
end;
@ -780,23 +787,19 @@ begin
itmFileSave := TMenuItem.Create(Self);
itmFileSave.Caption := 'Save';
itmFileSave.OnClick := @mnuSaveClicked;
mnuFile.Add(itmFileSave);
itmFileSaveAs := TMenuItem.Create(Self);
itmFileSaveAs.Caption := 'Save As';
itmFileSaveAs.OnClick := @mnuSaveAsClicked;
mnuFile.Add(itmFileSaveAs);
itmFileSaveAll := TMenuItem.Create(Self);
itmFileSaveAll.Caption := 'Save All';
itmFileSaveAll.OnClick := @mnuSaveAllClicked;
mnuFile.Add(itmFileSaveAll);
itmFileClose := TMenuItem.Create(Self);
itmFileClose.Caption := 'Close';
itmFileClose.OnClick := @mnuCloseClicked;
itmFileClose.Enabled := False;
mnuFile.Add(itmFileClose);
@ -985,16 +988,7 @@ var
SList : TUnitInfo;
TempNum : Integer;
begin
TempNum := ideEditor1.Notebook1.PageIndex;
if TempNum < 0 then Exit;
for I := 0 to Project1.UnitList.Count-1 do
begin
SList := TUnitInfo(Project1.UnitList.Items[I]);
if SList.Page = TempNum
then break;
end;
Result := SList;
end;
function TForm1.RenameUnit(OldUnitName, NewUnitName : string; SList : TUnitInfo) : Boolean;
@ -1078,35 +1072,12 @@ Begin
End;
Procedure TForm1.ReAssignEditorLines(SList : TUnitInfo);
var
TempEdit : TmwCustomEdit;
Begin
if SList.page <> -1 then
begin
TempEdit := IdeEditor1.GetEditorFromPage(SList.Page);
if TempEdit <> nil then
Begin
TempEdit.Lines.Assign(SList.Source);
IdeEditor1.Notebook1.pages.Strings[SList.Page] := SList.Name;
end;
end;
end;
Procedure TForm1.ReAssignSourcefromEditor(var SList : TUnitInfo);
var
TempEdit : TmwCustomEdit;
Begin
if SList.page <> -1 then
begin
TempEdit := IdeEditor1.GetEditorFromPage(SList.Page);
if TempEdit <> nil then
Begin
SList.Source.Assign(TempEdit.Lines);
end;
end;
end;
@ -1257,57 +1228,43 @@ Begin
end;
procedure TForm1.mnuSaveClicked(Sender : TObject);
var SList : TUnitInfo;
begin
Assert(False, 'Trace:In save dialog');
SList := ReturnActiveUnitList;
if SList = nil then Exit;
Assert(False, 'Trace:Calling save by unit');
SaveByUnit(SList);
//this is no longer used. TSourceNotebook.SaveClicked is called
end;
{------------------------------------------------------------------------------}
Procedure TForm1.mnuSaveAsClicked(Sender : TObject);
var
SList : TUnitInfo;
Begin
SList := ReturnActiveUnitList;
if SList = nil then Exit;
Assert(False, 'Trace:SLIST.PAGE is '+inttostr(SList.Page));
SaveDialog1.Title := 'Save '+SList.Name+' as :';
if SList.Filename <> '' then
SaveDialog1.Filename := SList.Filename
else
SaveDialog1.Filename := ExtractFilePath(Project1.Name)+SList.Name;
if SaveDialog1.Execute then
begin
RenameUnit(SList.Name, ExtractFileName(SaveDialog1.Filename),SList);
SList.Filename := SaveDialog1.Filename;
end
else
Exit;
SaveByUnit(SList);
//this is no longer used. TSourceNotebook.SaveAsClicked is called
end;
Procedure TForm1.mnuSaveAllClicked(Sender : TObject);
var
SList : TUnitInfo;
TempNum : Integer;
I : Integer;
Begin
For I := 0 to Project1.UnitList.Count-1 do
Begin
SList := TUnitInfo(Project1.UnitList.Items[I]);
if not(SaveByUnit(SList)) then exit;
end;
//this is no longer used. TSourceNotebook.SaveAllClicked is called
End;
Procedure TForm1.mnuToggleFormClicked(Sender : TObject);
Begin
writeln('Toggle form clicked');
if FCodeLastActivated then
SourceNotebook.DisplayFormforActivePage
else
SourceNotebook.DisplayCodeforControl(FControlLastActivated);
end;
Procedure TForm1.CodeorFormActivated(Sender : TObject);
Begin
FCodeLastActivated := (TForm(Sender) = TForm(SourceNotebook));
if FCodeLastActivated then Writeln('TRUE') else Writeln('False');
FControlLastActivated := Sender;
end;
{
@ -1398,32 +1355,8 @@ end;
{ mnuNewClicked}
procedure TForm1.mnuNewClicked(Sender : TObject);
var
SList : TUnitInfo;
TempName : string;
begin
TempName:= '';
SList:= CreateUnit(TempName);
SList.Flags := pfSource;
with SList.Source do begin
{ Add the default lines }
Add('unit ' + TempName + ';');
Add('');
Add('{$mode objfpc}');
Add('');
Add('interface');
Add('');
Add('implementation');
Add('');
Add('end.');
end;
ideEditor1.AddPage(SList.Name,SList.Source);
SList.Page := ideEditor1.Notebook1.Pageindex; //keep track of what page it is on
Project1.AddUnit(SList);
UpdateViewDialogs;
IdeEditor1.Visible:= true;
end;
function TForm1.FindDesigner(ChildComponent:TComponent):TDesigner;
@ -1676,9 +1609,13 @@ begin
TempForm.Designer :=
TDesigner.Create(TCustomForm(CInterface.Control));
TDesigner(TempForm.Designer).FormEditor := FormEditor1;
TDesigner(tempForm.Designer).SourceEditor := SourceNotebook.CreateUnitFromForm(TempForm);
TempForm.OnMouseDown := @MouseDownOnControl;
TempForm.OnMouseUp := @MouseUpOnControl;
TempForm.OnMouseMove := @MouseMoveOnControl;
TempForm.OnActivate := @CodeOrFormActivated;
TempForm.Show;
ObjectInspector1.RootComponent := TForm(CInterface.Control);
@ -1694,77 +1631,12 @@ var
SList : TUnitInfo;
Texts : String;
begin
Assert(False, 'Trace:******************OPEN DIALOG***************');
OpenDialog1.Title := 'Open file:';
if OpenDialog1.Execute then
begin
Str := TStringList.Create;
try
SList := TUnitInfo.Create;
SList.Filename := OpenDialog1.Filename;
Assert(False, 'Trace:Filename := '+OpenDialog1.Filename);
with SList.Source do
LoadFromFile(SList.Filename);
Assert(False, 'Trace:Filename := '+SList.Filename);
//Determine unit name and form name
SetFlags(SList);
SetName_Form(SLIst);
Assert(False, 'Trace:Name of new formname is '+SList.FormName);
IDEEditor1.AddPage(SList.Name,SList.Source);
SList.Page := ideEditor1.Notebook1.Pageindex; //keep track of what page it's on
Project1.AddUnit(SList);
UpdateViewDialogs;
ideEditor1.Show;
except
end;
itmFileClose.Enabled := True;
end;
Assert(False, 'Trace:******************OPEN DIALOG EXIT***************');
end;
{------------------------------------------------------------------------------}
Procedure TForm1.mnuCloseClicked(Sender : TObject);
Var
TempNum : Integer;
I : Integer;
SList : TUnitInfo;
Found : Boolean;
TempEdit : TmwCustomEdit;
Begin
// close the active notebook page. If there isn't one then this menu shouldn't be enabled
Found := False;
TempNum := ideEditor1.Notebook1.PageIndex;
if TempNum < 0 then Exit;
For I := 0 to Project1.UnitList.Count-1 do
Begin
SList := TUnitInfo(Project1.UnitList.Items[I]);
If SList.Page = TempNum then
Begin
TempEdit := IdeEditor1.GetEditorFromPage(TempNum);
if TempEdit <> nil then
SList.Source.Assign(TempEdit.Lines);
SList.Page := -1;
Found := True;
break;
end;
End;
if Found then
Begin
ideEditor1.DeletePage(ideEditor1.Notebook1.PageIndex);
{ Subtract one from each unit's "page" that's after the deleted page to
account for the deletion of this page.}
for I := 0 to Project1.UnitList.Count-1 do
Begin
SList := TUnitInfo(Project1.UnitList.Items[I]);
if SList.Page > TempNum then
SList.page := SList.page -1;
end;
end;
end;
@ -1805,90 +1677,18 @@ begin
end;
Procedure TForm1.mnuViewUnitsClicked(Sender : TObject);
var
SList : TUnitInfo;
I : Integer;
Tempstr : String;
Begin
if Project1.Unitlist.COunt = 0 then Exit;
ViewUnits1.ShowModal;
if (ViewUnits1.ModalResult = mrOK) then
Begin
SList := nil;
//Find it by name based on what's in Edit1.text
if ViewUnits1.Edit1.Text = '' then Exit;
TempStr := ViewUnits1.Edit1.Text;
For I := 0 to Project1.UnitList.Count -1 do
if Uppercase(TUnitInfo(Project1.UnitList.Items[i]).Name) = Uppercase(TempStr) then
Begin
SList := TUnitInfo(Project1.UnitList.Items[I]);
Break;
end;
if SList <> nil then
Begin
Assert(False, 'Trace:' + SList.Name+' selected via the listbox');
Assert(False, 'Trace:Page = '+inttostr(SList.Page));
If SList.Page = -1 then
begin
ideEditor1.AddPage(SList.Name,SList.Source);
SList.Page := ideEditor1.Notebook1.Pageindex;
end
else
IdeEditor1.Notebook1.Pageindex := SList.Page;
ideEditor1.Show;
End;
End
else
Assert(False, 'Trace:OK NOT PRESSED');
end;
Procedure TForm1.mnuViewFormsClicked(Sender : TObject);
var
SList : TUnitInfo;
Texts : String;
I : Integer;
Begin
if Project1.Unitlist.COunt = 0 then Exit;
ViewForms1.ShowModal;
if ViewForms1.ModalResult = mrOK
then begin
if ViewForms1.Listbox1.Items.Count > 0
then begin
for I := 0 to ViewForms1.ListBox1.Items.Count-1 do
if ViewForms1.ListBox1.Selected[I]
then Texts := ViewForms1.Listbox1.Items.Strings[I];
//Try and find an SList item where the formname equals Texts
for I := 0 to Project1.UnitList.Count-1 do
begin
SList := TUnitInfo(Project1.UnitList.Items[I]);
if SList.FormName = Texts
then Break
else SList := nil;
end;
end;
if SList <> nil
then begin
Assert(False, 'Trace:' + SList.Name+' selected via the listbox');
If SList.Page = -1
then begin
ideEditor1.AddPage(SList.Name,SList.Source);
SList.Page := ideEditor1.Notebook1.Pageindex;
end
else
IdeEditor1.Notebook1.Pageindex := SList.Page;
ideEditor1.Show;
//TODO: Write the following procedure to draw the DESIGN form
// DrawForm(SList);
end;
end;
end;
Procedure TForm1.mnuViewCodeExplorerClick(Sender : TObject);
begin
IDEEditor1.Show;
SourceNotebook.Show;
end;
Procedure TForm1.mnuViewMessagesClick(Sender : TObject);
@ -1897,116 +1697,7 @@ Begin
End;
Procedure TForm1.DoFind(Sender : TObject);
var
Source : TStrings;
Str : String;
CaseSensitive : Boolean;
I : Integer;
Findtext : String;
CharCount : Integer;
Found : Boolean;
StartLineNUmber : Integer;
Searchto : Integer;
FoundAt : Integer;
Begin
Found := False;
if (IDeEditor1.Visible) then
begin
if (Sender is TFindDialog) then StartLineNumber := 0
else
StartLineNumber := IDEEditor1.CurrentCursorYLine-1;
IDEEditor1.BringToFront;
CaseSensitive := FindDialog1.cbCaseSensitive.Checked;
FindText := FindDialog1.FindText;
if not CaseSensitive then
FindText := Uppercase(FindText);
Source := IDEEditor1.CurrentSource;
if Source <> nil then
begin
CharCount := 0;
if FindDialog1.rgForwardBack.ItemIndex = 0 then
Begin
for I := StartLineNumber to Source.Count-1 do
Begin
Str := Source.Strings[i];
Writeln('Str = '+Str);
Writeln(Source.Strings[i]);
//check to see if you should be checking CASE
if not CaseSensitive then Str := UpperCase(str);
if (pos(FindText,Str) <> 0) then
begin
FoundAt := Pos(FindText,Str);
{if the text we are searching for appears more than once on a line,
the POS function only finds the first one. Therefore, if we find the text
and this function is called by something other than the FindDialog,
and we are on the same line as the cursor we need to DELETE what we found and
search again. The problem is that effects placing the cursor in the right spot.
So, when we delete it, if we find it again we place th cursor to the spot the POS
function stated plus the difference between the STRING we are searching and the one
in the editor}
//first check to see if we are still on the first line
Found := True;
if (I = StartLineNumber) and not(Sender is TFindDialog) then
Begin
while (pos(FindText,str) +(Length(Source.Strings[i]) - Length(Str)) <= IDEEDITOR1.CurrentCursorXLine) and (pos(findtext,str) <> 0) do
Begin
Delete(Str,FoundAt,Length(FindText));
end;
if (pos(FindText,str) <> 0) then
Begin
Found := true;
FoundAt :=pos(FindText,str);
end;
end;
FoundAt := pos(FindText,str) + (Length(Source.Strings[i]) - Length(Str));
Writeln('***********************************************');
Writeln('***********************************************');
Writeln('***********************************************');
Writeln('***FOUNDAT='+inttostr(foundat)+'********************************************');
Writeln('***********************************************');
Writeln('***********************************************');
if Found then
Begin
IDEEditor1.CurrentCursorYLine := I+1;
IDEEditor1.CurrentCursorXLine := FoundAt;
IDEEditor1.SelectText(I+1,FoundAt,I+1,FoundAt+Length(FindText));
Break;
end;
end;
CharCount := CharCount + Length(Str);
end;
end
else {search backwards}
Begin
if StartLineNumber = 0 then StartLineNUmber := Source.Count-1;
for I := StartLineNumber downto 0 do
Begin
Str := Source.Strings[i];
//check to see if you should be checking CASE
if not CaseSensitive then Str := UpperCase(str);
if pos(FindText,Str) <> 0 then
begin
IDEEditor1.CurrentCursorYLine := I+1;
IDEEditor1.CurrentCursorXLine := pos(FindText,Str);
IDEEditor1.SelectText(I+1,pos(FindText,Str),I+1,pos(FindText,Str)+Length(FindText));
Found := True;
Break;
end;
CharCount := CharCount + Length(Str);
end;
end;
end;
end;
if not found then
Application.Messagebox('Text not found','Error',MB_OK);
end;
@ -2193,62 +1884,7 @@ result := Texts;
end;
Procedure TForm1.MessageViewDblClick(Sender : TObject);
var
Texts : String;
num : Integer;
LineNum, ColNum : Integer;
UnitName : String;
SList : TUnitInfo;
I : Integer;
Found : Boolean;
tempEditor : TmwCustomEdit;
Begin
//get line number and unit name
Texts := Messagedlg.Message;
If Texts = '' then Exit;
LineNum := Compiler1.GetLineNumber(Texts);
ColNum := Compiler1.GetColumnNumber(Texts);
UnitName := Compiler1.GetUnitName(Texts);
//run through the units and load the offending one
//this needs to be changed in case the offending one isn't a "project" file.
if pos('.',UnitName) > 0 then
UnitName := Copy(ExtractFileName(UnitName),1,pos('.',UnitName)-1);
found := False;
Assert(False, 'Trace:Unitname is '+unitname);
for I := 0 to Project1.UnitList.Count-1 do
Begin
SList := TUnitInfo(Project1.UnitList[i]);
Assert(False, 'Trace:Slist says the name is '+slist.name);
if uppercase(SList.Name) = Uppercase(UnitName) then break;
end;
if uppercase(SList.Name) = Uppercase(UnitName) then
Begin
Assert(False, 'Trace:Found a match');
if SList.Page <> -1 then
IdeEditor1.Notebook1.Pageindex := SList.Page
else
Begin
ideEditor1.AddPage(SList.Name,SList.Source);
SList.Page := ideEditor1.Notebook1.Pageindex; //keep track of what page it is on
end;
if not(ideeditor1.visible) then ideeditor1.Show
else
ideEditor1.SetFocus;
TempEditor := ideEditor1.GetEditorfromPage(SList.page);
if TempEditor = nil then Exit;
TempEditor.CaretX := ColNum;
TempEditor.CaretY := LineNum;
TempEditor.SetFocus;
End;
end;
@ -2260,6 +1896,13 @@ end.
{ =============================================================================
$Log$
Revision 1.19 2000/12/19 18:43:12 lazarus
Removed IDEEDITOR. This causes the PROJECT class to not function.
Saving projects no longer works.
I added TSourceNotebook and TSourceEditor. They do all the work for saving/closing/opening units. Somethings work but they are in early development.
Shane
Revision 1.18 2000/12/15 18:25:16 lazarus
Changes from Mattias and I.
Shane

View File

@ -27,7 +27,7 @@ unit project;
interface
uses
Classes, Global, SysUtils, IdeEditor, IniFiles,mwCustomEdit, FORMS,dlgMessage;
Classes, Global, SysUtils, IniFiles,mwCustomEdit, FORMS,dlgMessage;
type
@ -100,9 +100,9 @@ begin
//have to check this later
INIFIle.WriteString('Modules','EditWindowCount','1');
INIFile.WriteInteger('EditWindow0','ViewCount',IdeEditor1.Notebook1.Pages.Count);
INIFile.WriteInteger('EditWindow0','CurrentView',IdeEditor1.Notebook1.PageIndex);
for I := 0 to ideEditor1.Notebook1.Pages.Count-1 do
// INIFile.WriteInteger('EditWindow0','ViewCount',IdeEditor1.Notebook1.Pages.Count);
// INIFile.WriteInteger('EditWindow0','CurrentView',IdeEditor1.Notebook1.PageIndex);
{ for I := 0 to ideEditor1.Notebook1.Pages.Count-1 do
begin
//Determine what entry each notebook is displaying.
@ -130,17 +130,17 @@ begin
end;
end;
end;
if IdeEditor1.Visible
if IdeEditor1.Visible
then INIFile.WriteInteger('EditWindow0','Visible',1)
else INIFile.WriteInteger('EditWindow0','Visible',0);
}
//Write out screen coords
INIFile.WriteInteger('EditWindow0','Left',ideEditor1.Left);
{ INIFile.WriteInteger('EditWindow0','Left',ideEditor1.Left);
INIFile.WriteInteger('EditWindow0','Top',ideEditor1.Top);
INIFile.WriteInteger('EditWindow0','Height',ideEditor1.Height);
INIFile.WriteInteger('EditWindow0','Width',ideEditor1.Width);
INIFile.WriteInteger('EditWindow0','CurrentView',ideEditor1.Notebook1.Pageindex);
}
INIFile.WriteInteger('Main Window','Create',1);
INIFile.WriteInteger('Main Window','Visible',1);
INIFile.WriteInteger('Main Window','State',0); //0 = normal?
@ -223,28 +223,28 @@ begin
{debug}
Assert(False, 'Trace:NAME = '+TUnitInfo(FUnits.Items[TempInt]).Name);
ideEditor1.AddPage(TUnitInfo(FUnits.Items[TempInt]).Name,TUnitInfo(FUnits.Items[TempInt]).Source);
// ideEditor1.AddPage(TUnitInfo(FUnits.Items[TempInt]).Name,TUnitInfo(FUnits.Items[TempInt]).Source);
end;
TempInt := INIFIle.ReadInteger('EditWindow'+inttostr(i),'CurrentView',0);
ideEditor1.Notebook1.Pageindex := tempint;
// ideEditor1.Notebook1.Pageindex := tempint;
end;
Assert(False, 'Trace:Read Visible');
Assert(False, 'Trace:I = '+Inttostr(i));
ideEditor1.Visible := (INIFile.ReadInteger('EditWindow'+inttostr(i),'Visible',0) = 1);
{ ideEditor1.Visible := (INIFile.ReadInteger('EditWindow'+inttostr(i),'Visible',0) = 1);
ideEditor1.Left := INIFIle.ReadInteger('EditWindow'+inttostr(i),'Left',0);
ideEditor1.Top := INIFIle.ReadInteger('EditWindow'+inttostr(i),'Top',0);
ideEditor1.Width := INIFIle.ReadInteger('EditWindow'+inttostr(i),'Width',300);
ideEditor1.Height := INIFIle.ReadInteger('EditWindow'+inttostr(i),'Height',400);
}
end;
Assert(False, 'Trace:For loop : ViewCount = '+Inttostr(ViewCount));
for i := 0 to ViewCount - 1 do
begin
TempEditor := ideEditor1.GetEditorfromPage(i);
// TempEditor := ideEditor1.GetEditorfromPage(i);
tempEditor.CaretX := INIFIle.ReadInteger('View'+inttostr(i),'CursorX',0);
tempEditor.CaretY := INIFIle.ReadInteger('View'+inttostr(i),'CursorY',0);
tempEditor.TopLine := INIFIle.ReadInteger('View'+inttostr(i),'TopLine',0);
@ -293,6 +293,13 @@ end;
end.
{
$Log$
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.
I added TSourceNotebook and TSourceEditor. They do all the work for saving/closing/opening units. Somethings work but they are in early development.
Shane
Revision 1.1 2000/07/13 10:27:48 michael
+ Initial import

View File

@ -76,6 +76,7 @@ type
FKeyPreview: Boolean;
FMenu : TMainMenu;
FModalResult : TModalResult;
FOnActivate: TNotifyEvent;
FOnCreate: TNotifyEvent;
FOnDestroy: TNotifyEvent;
FOnHide: TNotifyEvent;
@ -98,6 +99,7 @@ type
Function GetCanvas: TControlCanvas;
Function IsForm : Boolean;
{ events }
Procedure WMActivate(var Message : TLMActivate); message LM_Activate;
procedure WMPaint(var message: TLMPaint); message LM_PAINT;
procedure WMSize(var message: TLMSize); message LM_Size;
procedure WMShowWindow(var message: TLMShowWindow); message LM_SHOWWINDOW;
@ -125,6 +127,7 @@ type
property FormStyle : TFormStyle read FFormStyle write SetFormStyle default fsNormal;
property Position : TPosition read FPosition write SetPosition default poDesigned;
{events}
property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;
property OnCreate: TNotifyEvent read FOnCreate write FOnCreate;
property OnDestroy: TNotifyEvent read FOnDestroy write FOnDestroy;
property OnHide: TNotifyEvent read FOnHide write FOnHide;
@ -175,6 +178,7 @@ type
property Position;
property Visible;
// property WindowState;
property OnActivate;
property OnCreate;
property OnDestroy;
property OnShow;
@ -325,6 +329,7 @@ end;
initialization
Screen:= TScreen.Create(nil);
Application:= TApplication.Create(nil);
Focusmessages := True;
finalization
Application.Free;

View File

@ -9,6 +9,7 @@ begin
inherited AttachSignals;
SetCallback(LM_CONFIGUREEVENT);
SetCallback(LM_CLOSEQUERY);
SetCallBack(LM_Activate);
end;
{------------------------------------------------------------------------------}
@ -133,6 +134,18 @@ begin
end;
{------------------------------------------------------------------------------
Method: TCustomForm.WMActivate
Params: Msg: When the form is Activated
Returns: nothing
Paint event handler.
------------------------------------------------------------------------------}
Procedure TCustomForm.WMActivate(var Message : TLMActivate);
Begin
if Assigned(FOnActivate) then FOnActivate(Self);
end;
{------------------------------------------------------------------------------
Method: TCustomForm.WMPaint
Params: Msg: The paint message
@ -336,11 +349,12 @@ var
begin
// Assert(False, 'Trace:-----------------IN TCUSTOMFORM WNDPROC-------------------');
with Message do
case Msg of
LM_ACTIVATE, LM_SETFOCUS, LM_KILLFOCUS:
begin
if not FocusMEssages then Exit;
if not FocusMessages then Exit;
if (MSg = LM_SetFocus) and not (csDesigning in ComponentState)
then begin
FocusHandle := 0;
@ -806,6 +820,13 @@ end;
{ =============================================================================
$Log$
Revision 1.7 2000/12/19 18:43:13 lazarus
Removed IDEEDITOR. This causes the PROJECT class to not function.
Saving projects no longer works.
I added TSourceNotebook and TSourceEditor. They do all the work for saving/closing/opening units. Somethings work but they are in early development.
Shane
Revision 1.6 2000/11/30 21:43:38 lazarus
Changed TDesigner. It's now notified when a control is added to it's CustomForm.
It's created in main.pp when New Form is selected.

View File

@ -5,5 +5,6 @@
constructor TScrollBar.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
// FCompStlye := csVScrollBar;
fOwner := TControl(AOwner);
end;

View File

@ -75,12 +75,6 @@ begin
Result := DeliverMessage(Data, Mess) = 0;
end;
// TLMPaint = packed record
// Msg: Cardinal;
// DC: HDC;
// Unused: Longint;
// Result: Longint;
// end;
function gtkdraw(Widget: PGtkWidget; area : PgdkRectangle; data: gPointer) : GBoolean; cdecl;
var
MSG: TLMPaint;
@ -108,6 +102,25 @@ begin
Result := DeliverPostMessage(Data, MSG);
end;
function gtkfrmactivate( widget: PGtkWidget; Event : TgdkEventFocus; data: gPointer) : GBoolean; cdecl;
var
Mess : TLMActivate;
begin
EventTrace('activate', data);
Mess.Msg := LM_ACTIVATE;
Result := DeliverPostMessage(Data, Mess);
end;
function gtkfrmdeactivate( widget: PGtkWidget; Event : TgdkEventFocus; data: gPointer) : GBoolean; cdecl;
var
Mess : TLMActivate;
begin
EventTrace('deactivate', data);
Mess.Msg := LM_DEACTIVATE;
Result := DeliverPostMessage(Data, Mess);
end;
function GTKMap(Widget: PGTKWidget; Data: gPointer): GBoolean; cdecl;
var
Mess : TLMessage;
@ -1077,6 +1090,13 @@ end;
{ =============================================================================
$Log$
Revision 1.9 2000/12/19 18:43:13 lazarus
Removed IDEEDITOR. This causes the PROJECT class to not function.
Saving projects no longer works.
I added TSourceNotebook and TSourceEditor. They do all the work for saving/closing/opening units. Somethings work but they are in early development.
Shane
Revision 1.8 2000/11/29 21:22:35 lazarus
New Object Inspector code
Shane

View File

@ -1206,7 +1206,13 @@ begin
LM_ACTIVATE :
begin
ConnectSignal(gObject, 'activate', @gtkactivateCB);
if (Sender is TCustomForm) then
Begin
ConnectSignal(gObject, 'focus-in-event', @gtkfrmactivate);
ConnectSignal(gObject, 'focus-out-event', @gtkfrmdeactivate);
end
else
ConnectSignal(gObject, 'activate', @gtkactivateCB);
end;
LM_ACTIVATEITEM :
@ -2666,6 +2672,13 @@ end;
{ =============================================================================
$Log$
Revision 1.10 2000/12/19 18:43:13 lazarus
Removed IDEEDITOR. This causes the PROJECT class to not function.
Saving projects no longer works.
I added TSourceNotebook and TSourceEditor. They do all the work for saving/closing/opening units. Somethings work but they are in early development.
Shane
Revision 1.9 2000/10/09 22:50:32 lazarus
MWE:
* fixed some selection code

View File

@ -453,7 +453,7 @@ end;
{------------------------------------------------------------------------------
Procedure: DeliverMessage
Params: Message: thje message to process
Params: Message: the message to process
Returns: True if handled
Generic function whih calls the WindowProc if defined, otherwise the
@ -668,6 +668,13 @@ end;
{ =============================================================================
$Log$
Revision 1.6 2000/12/19 18:43:13 lazarus
Removed IDEEDITOR. This causes the PROJECT class to not function.
Saving projects no longer works.
I added TSourceNotebook and TSourceEditor. They do all the work for saving/closing/opening units. Somethings work but they are in early development.
Shane
Revision 1.5 2000/10/09 22:50:32 lazarus
MWE:
* fixed some selection code

View File

@ -271,12 +271,14 @@ LM_EXIT = LM_USER+60;
LM_SCREENINIT = LM_USER+61;
LM_CLOSEQUERY = LM_USER+62;
LM_DRAGSTART = LM_USER+63;
LM_CB_FIRST = LM_USER+64;
LM_DEACTIVATE = LM_USER+64; //used when a form is no longer in front
LM_CB_FIRST = LM_USER+100;
LM_CB_GETCOUNT = LM_CB_FIRST+1;
LM_CB_GETTEXT = LM_CB_FIRST+2;
LM_CB_ADDTEXT = LM_CB_FIRST+3;
LM_CB_LAST = LM_CB_FIRST+10; //LM_USER+74
LM_CB_LAST = LM_CB_FIRST+10; //LM_USER+110
LM_UNKNOWN = LM_User+99;
@ -426,6 +428,14 @@ TLMMove = record
Result: Longint);
end;
TLMActivate = record
Msg: Cardinal;
Active: BOOL;
Minimized : WordBool;
ActiveWindow : HWND;
Result: Longint;
end;
TLMNCActivate = record
Msg: Cardinal;
Active: BOOL;
@ -773,6 +783,13 @@ end.
{
$Log$
Revision 1.6 2000/12/19 18:43:13 lazarus
Removed IDEEDITOR. This causes the PROJECT class to not function.
Saving projects no longer works.
I added TSourceNotebook and TSourceEditor. They do all the work for saving/closing/opening units. Somethings work but they are in early development.
Shane
Revision 1.5 2000/11/29 21:22:35 lazarus
New Object Inspector code
Shane