From 4e924ae6a20918260ecd7e2a80ab70c2ed45abf3 Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 12 Dec 2004 03:54:09 +0000 Subject: [PATCH] implemented open project after open standard windows git-svn-id: trunk@6367 - --- components/codetools/stdcodetools.pas | 60 ++++++++++++++++----------- ide/customformeditor.pp | 33 +++++++++++---- ide/lazarus.pp | 4 ++ ide/main.pp | 24 +++++++---- ide/mainbase.pas | 1 + lcl/grids.pas | 4 +- lcl/include/progressbar.inc | 5 ++- lcl/menus.pp | 5 ++- 8 files changed, 90 insertions(+), 46 deletions(-) diff --git a/components/codetools/stdcodetools.pas b/components/codetools/stdcodetools.pas index a0aa8bc4c2..2475bf68af 100644 --- a/components/codetools/stdcodetools.pas +++ b/components/codetools/stdcodetools.pas @@ -1205,6 +1205,7 @@ var var IdentContext: TFindContext): boolean; var Params: TFindDeclarationParams; + IdentifierNotPublished: Boolean; begin Result:=false; IdentContext:=CleanFindContext; @@ -1215,18 +1216,18 @@ var Params:=TFindDeclarationParams.Create; try Params.Flags:=[fdfSearchInAncestors,fdfExceptionOnNotFound, - fdfExceptionOnPredefinedIdent,fdfIgnoreMissingParams, - fdfIgnoreOverloadedProcs]; + fdfExceptionOnPredefinedIdent,fdfIgnoreMissingParams, + fdfIgnoreOverloadedProcs]; Params.ContextNode:=ClassContext.Node; Params.SetIdentifier(ClassContext.Tool,PChar(IdentName),nil); try - {DebugLn('FindLFMIdentifier A ', - ' Ident=', - '"',GetIdentifier(Params.Identifier),'"', - ' Context="',ClassContext.Node.DescAsString,'" "',StringToPascalConst(copy(ClassContext.Tool.Src,ClassContext.Node.StartPos,20)),'"', - ' File="',ExtractFilename(ClassContext.Tool.MainFilename)+'"', - ' Flags=[',FindDeclarationFlagsAsString(Params.Flags),']' - );} + //DebugLn('FindLFMIdentifier A ', + // ' Ident=', + // '"'+GetIdentifier(Params.Identifier)+'"', + // ' Context="'+ClassContext.Node.DescAsString,'" "',StringToPascalConst(copy(ClassContext.Tool.Src,ClassContext.Node.StartPos,20))+'"', + // ' File="'+ExtractFilename(ClassContext.Tool.MainFilename)+'"', + // ' Flags=['+FindDeclarationFlagsAsString(Params.Flags)+']' + // ); if ClassContext.Tool.FindIdentifierInContext(Params) then begin IdentContext:=CreateFindContext(Params); end; @@ -1237,21 +1238,22 @@ var finally Params.Free; end; - - if IdentContext.Node<>nil then begin - Result:=true; + + IdentifierNotPublished:=false; + if (IdentContext.Node<>nil) then begin if (IdentContext.Node.Parent<>nil) and (IdentContext.Node.Parent.Desc<>ctnClassPublished) - then begin - LFMTree.AddError(lfmeIdentifierNotPublished,LFMNode, - 'identifier '+IdentName+' is not published', - DefaultErrorPosition); - exit; - end; - end else begin - // no node found + then + IdentifierNotPublished:=true + else + Result:=true; + end; + + if (IdentContext.Node=nil) or IdentifierNotPublished then begin + // no proper node found // -> search in DefineProperties if SearchAlsoInDefineProperties then begin + //debugln('FindLFMIdentifier A SearchAlsoInDefineProperties=',dbgs(SearchAlsoInDefineProperties)); if FindNonPublishedDefineProperty(LFMNode,DefaultErrorPosition, IdentName,ClassContext) then begin @@ -1260,10 +1262,17 @@ var end; end; if (not Result) and ErrorOnNotFound then begin - LFMTree.AddError(lfmeIdentifierNotFound,LFMNode, - 'identifier '+IdentName+' not found', - DefaultErrorPosition); - exit; + if (IdentContext.Node<>nil) and IdentifierNotPublished then begin + LFMTree.AddError(lfmeIdentifierNotPublished,LFMNode, + 'identifier '+IdentName+' is not published in class ' + +'"'+ClassContext.Tool.ExtractClassName(ClassContext.Node,false)+'"', + DefaultErrorPosition); + end else begin + LFMTree.AddError(lfmeIdentifierNotFound,LFMNode, + 'identifier '+IdentName+' not found in class ' + +'"'+ClassContext.Tool.ExtractClassName(ClassContext.Node,false)+'"', + DefaultErrorPosition); + end; end; end; @@ -1301,8 +1310,9 @@ var Params.Free; end; if Result.Node=nil then begin + // FindClassNodeForLFMObject LFMTree.AddError(lfmeIdentifierNotFound,LFMNode, - 'identifier '+GetIdentifier(Identifier)+' not found', + 'class '+GetIdentifier(Identifier)+' not found', DefaultErrorPosition); exit; end; diff --git a/ide/customformeditor.pp b/ide/customformeditor.pp index efb457a913..d068a11e90 100644 --- a/ide/customformeditor.pp +++ b/ide/customformeditor.pp @@ -67,11 +67,9 @@ each control that's dropped onto the form Function FSetProp(PRI : PPropInfo; const Value) : Boolean; Function FGetProp(PRI : PPropInfo; var Value) : Boolean; function GetDesigner: TComponentEditorDesigner; - protected - Function GetPPropInfobyIndex(Index : Integer) : PPropInfo; - Function GetPPropInfobyName(Name : ShortString) : PPropInfo; - + Function GetPPropInfoByIndex(Index : Integer) : PPropInfo; + Function GetPPropInfoByName(Name : ShortString) : PPropInfo; public constructor Create; constructor Create(AComponent: TComponent); @@ -273,6 +271,8 @@ function CompareComponentAndInterface(Key, Data: Pointer): integer; function CompareDefPropCacheItems(Item1, Item2: TDefinePropertiesCacheItem): integer; function ComparePersClassNameAndDefPropCacheItem(Key: Pointer; Item: TDefinePropertiesCacheItem): integer; +procedure RegisterStandardClasses; + implementation @@ -309,6 +309,11 @@ begin Result:=CompareText(AnsiString(Key),Item.PersistentClassname); end; +procedure RegisterStandardClasses; +begin + RegisterClasses([TStrings]); +end; + { TComponentInterface } constructor TComponentInterface.Create; @@ -1464,6 +1469,8 @@ var const APersistentClass: TPersistentClass): boolean; begin Result:=false; + if APersistent<>nil then + RaiseGDBException('TCustomFormEditor.FindDefineProperty.CreateTempPersistent Inconsistency'); try if APersistentClass.InheritsFrom(TComponent) then APersistent:=TComponentClass(APersistentClass).Create(nil) @@ -1530,11 +1537,16 @@ var end; begin + //debugln('TCustomFormEditor.GetDefineProperties ', + // ' APersistentClassName="',APersistentClassName,'"', + // ' AncestorClassName="',AncestorClassName,'"', + // ' Identifier="',Identifier,'"'); IsDefined:=false; if FDefineProperties=nil then - FDefineProperties:=TAVLTree.Create(TListSortCompare(@CompareDefPropCacheItems)); + FDefineProperties:= + TAVLTree.Create(TListSortCompare(@CompareDefPropCacheItems)); ANode:=FDefineProperties.FindKey(PChar(APersistentClassName), - TListSortCompare(@ComparePersClassNameAndDefPropCacheItem)); + TListSortCompare(@ComparePersClassNameAndDefPropCacheItem)); if ANode=nil then begin // cache component class, try to retrieve the define properties CacheItem:=TDefinePropertiesCacheItem.Create; @@ -1922,7 +1934,7 @@ end; procedure TDefinePropertiesReader.AddPropertyName(const Name: string); begin - //debugln('TDefinePropertiesReader.AddPropertyName Name="',Name,'"'); + debugln('TDefinePropertiesReader.AddPropertyName Name="',Name,'"'); if FDefinePropertyNames=nil then FDefinePropertyNames:=TStringList.Create; if FDefinePropertyNames.IndexOf(Name)<=0 then FDefinePropertyNames.Add(Name); @@ -1955,10 +1967,13 @@ end; procedure TDefinePropertiesPersistent.PublicDefineProperties(Filer: TFiler); begin - //debugln('TDefinePropertiesPersistent.PublicDefineProperties A ',ClassName); + debugln('TDefinePropertiesPersistent.PublicDefineProperties A ',ClassName,' ',dbgsName(FTarget)); Target.DefineProperties(Filer); - //debugln('TDefinePropertiesPersistent.PublicDefineProperties END ',ClassName); + debugln('TDefinePropertiesPersistent.PublicDefineProperties END ',ClassName,' ',dbgsName(FTarget)); end; +initialization + RegisterStandardClasses; + end. diff --git a/ide/lazarus.pp b/ide/lazarus.pp index 2ce9dfa850..7898295c6d 100644 --- a/ide/lazarus.pp +++ b/ide/lazarus.pp @@ -73,6 +73,7 @@ begin MainIDE:=TMainIDE.Create(Application); MainIDE.CreateOftenUsedForms; + MainIDE.StartIDE; {$IFDEF IDE_MEM_CHECK} CheckHeapWrtMemCnt('lazarus.pp: TMainIDE created'); {$ENDIF} @@ -99,6 +100,9 @@ end. { $Log$ + Revision 1.64 2004/12/12 03:54:08 mattias + implemented open project after open standard windows + Revision 1.63 2004/11/10 15:25:32 mattias updated memcheck.pas from heaptrc.pp diff --git a/ide/main.pp b/ide/main.pp index 0fec1a6394..02281bacb9 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -533,8 +533,9 @@ type class procedure ParseCmdLineOptions; constructor Create(TheOwner: TComponent); override; - procedure CreateOftenUsedForms; override; + procedure StartIDE; override; destructor Destroy; override; + procedure CreateOftenUsedForms; override; procedure CreateSearchResultWindow; procedure UpdateDefaultPascalFileExtensions; @@ -987,18 +988,21 @@ begin HelpBoss.LoadHelpOptions; UpdateWindowsMenu; +end; + +procedure TMainIDE.StartIDE; +begin + // set OnIdle handlers + Application.AddOnUserInputHandler(@OnApplicationUserInput,true); + Application.AddOnIdleHandler(@OnApplicationIdle,true); + Screen.AddHandlerRemoveForm(@OnScreenRemoveForm,true); + SetupHints; // Now load a project SetupStartProject; // reopen extra windows ReOpenIDEWindows; - - // set OnIdle handlers - Application.AddOnUserInputHandler(@OnApplicationUserInput,true); - Application.AddOnIdleHandler(@OnApplicationIdle,true); - Screen.AddHandlerRemoveForm(@OnScreenRemoveForm,true); - SetupHints; end; destructor TMainIDE.Destroy; @@ -6757,7 +6761,8 @@ begin // open messages window SourceNotebook.ClearErrorLines; - MessagesView.Clear; + if MessagesView<>nil then + MessagesView.Clear; DoArrangeSourceEditorAndMessageView(false); // parse the LFM file and the pascal unit @@ -10971,6 +10976,9 @@ end. { ============================================================================= $Log$ + Revision 1.808 2004/12/12 03:54:08 mattias + implemented open project after open standard windows + Revision 1.807 2004/12/11 01:17:22 mattias implemented global debugger search path diff --git a/ide/mainbase.pas b/ide/mainbase.pas index deeed6a755..b384c9252d 100644 --- a/ide/mainbase.pas +++ b/ide/mainbase.pas @@ -118,6 +118,7 @@ type property ToolStatus: TIDEToolStatus read FToolStatus write SetToolStatus; constructor Create(TheOwner: TComponent); override; + procedure StartIDE; virtual; abstract; destructor Destroy; override; procedure CreateOftenUsedForms; virtual; abstract; diff --git a/lcl/grids.pas b/lcl/grids.pas index 3a7a50f96a..5af8d602df 100644 --- a/lcl/grids.pas +++ b/lcl/grids.pas @@ -264,7 +264,7 @@ type end; type - TCustomGrid=class(TCustomControl) + TCustomGrid = class(TCustomControl) private FAutoAdvance: TAutoAdvance; FDefaultDrawing: Boolean; @@ -545,7 +545,7 @@ type TGetEditEvent = procedure (Sender: TObject; ACol, ARow: Integer; var Value: string) of object; TSetEditEvent = procedure (Sender: TObject; ACol, ARow: Integer; const Value: string) of object; - TDrawGrid=class(TCustomGrid) + TDrawGrid = class(TCustomGrid) private FOnColRowDeleted: TgridOperationEvent; FOnColRowExchanged: TgridOperationEvent; diff --git a/lcl/include/progressbar.inc b/lcl/include/progressbar.inc index 6f8a16bb96..459345c0bd 100644 --- a/lcl/include/progressbar.inc +++ b/lcl/include/progressbar.inc @@ -42,7 +42,7 @@ ------------------------------------------------------------------------------} constructor TProgressBar.Create (AOwner : TComponent); begin - inherited Create (AOwner); + inherited Create(AOwner); fCompStyle := csProgressBar; FPosition := 0; FStep := 10; @@ -302,6 +302,9 @@ end; { $Log$ + Revision 1.11 2004/12/12 03:54:09 mattias + implemented open project after open standard windows + Revision 1.10 2004/09/23 14:50:47 micha convert LM_SETPROPERTIES message to interface method for TProgressBar diff --git a/lcl/menus.pp b/lcl/menus.pp index e1c7223e36..16eebfbdc0 100644 --- a/lcl/menus.pp +++ b/lcl/menus.pp @@ -313,7 +313,7 @@ type public constructor Create(AOwner: TComponent); override; destructor Destroy; override; - procedure PopUp(X, Y : Integer); + procedure PopUp(X, Y: Integer); property PopupComponent: TComponent read FPopupComponent write FPopupComponent; property PopupPoint: TPoint read FPopupPoint; @@ -403,6 +403,9 @@ end. { $Log$ + Revision 1.76 2004/12/12 03:54:09 mattias + implemented open project after open standard windows + Revision 1.75 2004/12/10 21:36:27 mattias implemented TMenuItem.SetVisible