From 632b401809a9ad17666ae8bcc41406c5e40bc650 Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 17 Aug 2002 23:40:22 +0000 Subject: [PATCH] added included by to unitinfo and a few win32 functions git-svn-id: trunk@1952 - --- ide/unitinfodlg.pp | 392 ++++++++++++++++++------------- lcl/interfaces/gtk/gtkobject.inc | 7 +- 2 files changed, 230 insertions(+), 169 deletions(-) diff --git a/ide/unitinfodlg.pp b/ide/unitinfodlg.pp index 9e49540456..a66bc3a51a 100644 --- a/ide/unitinfodlg.pp +++ b/ide/unitinfodlg.pp @@ -44,22 +44,29 @@ type outsize: TLabel; outlines: TLabel; outpath: TLabel; + uIncludedBy: TLabel; + outIncludedBy: TLabel; + clearIncludedBy: TBitBtn; procedure UnitInfoDlgResize(Sender: TObject); procedure OkButtonClick(Sender:TObject); + procedure clearIncludedByClick(Sender: TObject); private + function getIncludedBy: string; procedure setShortName(const str:string); procedure setType(const str:string); procedure setInProject(const str:string); procedure setSize(const str:string); procedure setLines(const str:string); procedure setPath(const str:string); + procedure setIncludedBy(const IncludedBy: string); public constructor Create(AOwner:TComponent); override; end; function ShowUnitInfoDlg(const AnUnitName, AType: string; IsPartOfProject: boolean; SizeInBytes, LineCount: integer; - const FilePath: string): TModalResult; + const FilePath: string; + const IncludedBy: string; var ClearIncludedBy: boolean): TModalResult; implementation @@ -68,27 +75,28 @@ uses LResources; function ShowUnitInfoDlg(const AnUnitName, AType: string; IsPartOfProject: boolean; SizeInBytes, LineCount: integer; - const FilePath: string): TModalResult; + const FilePath: string; + const IncludedBy: string; var ClearIncludedBy: boolean): TModalResult; var Dlg: TUnitInfoDlg; begin Dlg:=TUnitInfoDlg.Create(Application); - try - with Dlg do begin - Caption:='Information about '+AnUnitName; - setShortName(AnUnitName); - setType(AType); - if IsPartOfProject then - setInProject('yes') - else - setInProject('no'); - setSize(IntToStr(SizeInBytes)+' bytes'); - setLines(IntToStr(LineCount)); - setPath(FilePath); - end; - Result:=Dlg.ShowModal; - finally - Dlg.Free; + with Dlg do begin + Caption:='Information about '+AnUnitName; + setShortName(AnUnitName); + setType(AType); + if IsPartOfProject then + setInProject('yes') + else + setInProject('no'); + setSize(IntToStr(SizeInBytes)+' bytes'); + setLines(IntToStr(LineCount)); + setPath(FilePath); + setIncludedBy(IncludedBy); end; + Result:=Dlg.ShowModal; + ClearIncludedBy:=(Result=mrOk) + and (IncludedBy<>'') and (Dlg.getIncludedBy=''); + Dlg.Free; end; { TUnitInfoDlg } @@ -99,151 +107,170 @@ begin if LazarusResources.Find(ClassName)=nil then begin Caption:='Unit Info for unit ???'; - Width:=400; - Height:=164; + Width:=500; + Height:=200; position:=poScreenCenter; OnResize:=@UnitInfoDlgResize; + UName:=TLabel.create(self); + with uname do begin + Name:='Name'; + Parent:=self; + Left:=4; + top:=4; + caption:='Name:'; + end; + + utype:=TLabel.create(self); + with utype do begin + Name:='Type'; + Parent:=self; + Left:=UName.Left; + top:=24; + caption:='Type:'; + end; + + uinproject:=TLabel.create(self); + with uinproject do begin + Name:='InProject'; + Parent:=self; + Left:=UName.Left; + top:=44; + caption:='in Project:'; + end; + + usize:=TLabel.create(self); + with usize do begin + Name:='Size'; + Parent:=self; + Left:=UName.Left; + top:=64; + caption:='Size:'; + end; + + ulines:=TLabel.create(self); + with ulines do begin + Name:='Lines'; + Parent:=self; + Left:=UName.Left; + top:=84; + caption:='Lines:'; + end; + + upath:=TLabel.create(self); + with upath do begin + Name:='Path'; + Parent:=self; + Left:=UName.Left; + top:=104; + caption:='Path:'; + end; + + uIncludedBy:=TLabel.create(self); + with uIncludedBy do begin + Name:='Included by'; + Parent:=self; + Left:=UName.Left; + top:=124; + caption:='Included by:'; + end; + + outname:=TLabel.create(self); + with outname do begin + Name:='OutName'; + Parent:=self; + Left:=80; + top:=4; + Width:=Self.ClientWidth-Left-5; + caption:='temp'; + end; + + outtype:=TLabel.create(self); + with outtype do begin + Name:='OutType'; + Parent:=self; + Left:=outname.Left; + top:=24; + Width:=Self.ClientWidth-Left-5; + caption:='temp'; + end; + + outinproject:=TLabel.create(self); + with outinproject do begin + Name:='OutInProject'; + Parent:=self; + Left:=outname.Left; + top:=44; + Width:=Self.ClientWidth-Left-5; + caption:='temp'; + end; + + outsize:=TLabel.create(self); + with outsize do begin + Name:='OutSize'; + Parent:=self; + Left:=outname.Left; + top:=64; + Width:=Self.ClientWidth-Left-5; + caption:='temp'; + end; + + outlines:=TLabel.create(self); + with outlines do begin + Name:='OutLines'; + Parent:=self; + Left:=outname.Left; + top:=84; + Width:=Self.ClientWidth-Left-5; + caption:='temp'; + end; + + outpath:=TLabel.create(self); + with outpath do begin + Name:='OutPath'; + Parent:=self; + Left:=outname.Left; + top:=104; + caption:='temp'; + Width:=Self.ClientWidth-Left-5; + autosize:=true; + end; + + outIncludedBy:=TLabel.create(self); + with outIncludedBy do begin + Name:='outIncludedBy'; + Parent:=self; + Left:=outname.Left; + top:=124; + caption:='temp'; + Width:=Self.ClientWidth-Left-57; + autosize:=true; + end; + + clearIncludedBy:=TBitBtn.Create(Self); + with clearIncludedBy do begin + Name:='clearIncludedBy'; + Parent:=Self; + Left:=Self.ClientWidth-55; + Top:=122; + Width:=50; + Caption:='Clear'; + OnClick:=@clearIncludedByClick; + end; + OkButton:=TButton.Create(Self); with OkButton do begin Name:='OkButton'; Parent:=Self; - Top:=132; + Top:=152; Width:=75; Height:=25; Left:=(Self.ClientWidth-Width) div 2; Caption:='Ok'; + Default:=true; OnClick:=@OkButtonClick; - Show; end; - UName:=TLabel.create(self); - with uname do begin - Name:='Name'; - Parent:=self; - Left:=4; - top:=4; - caption:='Name:'; - Show; - end; - - utype:=TLabel.create(self); - with utype do begin - Name:='Type'; - Parent:=self; - Left:=4; - top:=24; - caption:='Type:'; - Show; - end; - - uinproject:=TLabel.create(self); - with uinproject do begin - Name:='InProject'; - Parent:=self; - Left:=4; - top:=44; - caption:='in Project:'; - Show; - end; - - usize:=TLabel.create(self); - with usize do begin - Name:='Size'; - Parent:=self; - Left:=4; - top:=64; - caption:='Size:'; - Show; - end; - - ulines:=TLabel.create(self); - with ulines do begin - Name:='Lines'; - Parent:=self; - Left:=4; - top:=84; - caption:='Lines:'; - Show; - end; - - upath:=TLabel.create(self); - with upath do begin - Name:='Path'; - Parent:=self; - Left:=4; - top:=104; - caption:='Path:'; - Show; - end; - - outname:=TLabel.create(self); - with outname do begin - Name:='OutName'; - Parent:=self; - Left:=68; - top:=4; - Width:=Self.ClientWidth-Left-5; - caption:='temp'; - Show; - end; - - outtype:=TLabel.create(self); - with outtype do begin - Name:='OutType'; - Parent:=self; - Left:=68; - top:=24; - Width:=Self.ClientWidth-Left-5; - caption:='temp'; - Show; - end; - - outinproject:=TLabel.create(self); - with outinproject do begin - Name:='OutInProject'; - Parent:=self; - Left:=68; - top:=44; - Width:=Self.ClientWidth-Left-5; - caption:='temp'; - Show; - end; - - outsize:=TLabel.create(self); - with outsize do begin - Name:='OutSize'; - Parent:=self; - Left:=68; - top:=64; - Width:=Self.ClientWidth-Left-5; - caption:='temp'; - Show; - end; - - outlines:=TLabel.create(self); - with outlines do begin - Name:='OutLines'; - Parent:=self; - Left:=68; - top:=84; - Width:=Self.ClientWidth-Left-5; - caption:='temp'; - Show; - end; - - outpath:=TLabel.create(self); - with outpath do begin - Name:='OutPath'; - Parent:=self; - Left:=68; - top:=104; - width:=181; - caption:='temp'; - Width:=Self.ClientWidth-Left-5; - autosize:=true; - Show; - end; end; UnitInfoDlgResize(nil); end; @@ -278,80 +305,101 @@ begin outpath.caption:=str; end; +procedure TUnitInfoDlg.setIncludedBy(const IncludedBy: string); +begin + outIncludedBy.Caption:=IncludedBy; +end; + procedure TUnitInfoDlg.UnitInfoDlgResize(Sender: TObject); begin - with OkButton do begin - Top:=132; - Width:=75; - Height:=25; - Left:=(Self.ClientWidth-Width) div 2; - end; - with uname do begin Left:=4; Top:=4; end; with utype do begin - Left:=4; + Left:=uname.Left; Top:=24; end; with uinproject do begin - Left:=4; + Left:=uname.Left; Top:=44; end; with usize do begin - Left:=4; + Left:=uname.Left; top:=64; end; with ulines do begin - Left:=4; + Left:=uname.Left; top:=84; end; with upath do begin - Left:=4; + Left:=uname.Left; top:=104; end; + with uIncludedBy do begin + Left:=uname.Left; + top:=124; + end; + with outname do begin - Left:=68; + Left:=80; top:=4; Width:=Self.ClientWidth-Left-5; end; with outtype do begin - Left:=68; + Left:=outname.Left; top:=24; Width:=Self.ClientWidth-Left-5; end; with outinproject do begin - Left:=68; + Left:=outname.Left; top:=44; Width:=Self.ClientWidth-Left-5; end; with outsize do begin - Left:=68; + Left:=outname.Left; top:=64; Width:=Self.ClientWidth-Left-5; end; with outlines do begin - Left:=68; + Left:=outname.Left; top:=84; Width:=Self.ClientWidth-Left-5; end; with outpath do begin - Left:=68; + Left:=outname.Left; top:=104; Width:=Self.ClientWidth-Left-5; end; + + with outIncludedBy do begin + Left:=outname.Left; + top:=124; + Width:=Self.ClientWidth-Left-57; + end; + + with clearIncludedBy do begin + Left:=Self.ClientWidth-55; + top:=124; + end; + + with OkButton do begin + Top:=152; + Width:=75; + Height:=25; + Left:=(Self.ClientWidth-Width) div 2; + end; end; procedure TUnitInfoDlg.OkButtonClick(Sender:TObject); @@ -359,5 +407,15 @@ begin ModalResult:=mrOk; end; +procedure TUnitInfoDlg.clearIncludedByClick(Sender: TObject); +begin + outIncludedBy.Caption:=''; +end; + +function TUnitInfoDlg.getIncludedBy: string; +begin + Result:=outIncludedBy.Caption; +end; + end. diff --git a/lcl/interfaces/gtk/gtkobject.inc b/lcl/interfaces/gtk/gtkobject.inc index 57e7631ddd..0ae40e47e1 100644 --- a/lcl/interfaces/gtk/gtkobject.inc +++ b/lcl/interfaces/gtk/gtkobject.inc @@ -1342,7 +1342,7 @@ begin ShowHide(Sender); end; - LM_SetCursor : SetCursor(TWinControl(Sender), Data); + LM_SetCursor : gtkproc.SetCursor(TWinControl(Sender), Data); LM_SetLabel : SetLabel(Sender,Data); @@ -1358,7 +1358,7 @@ begin begin // change cursor if Sender is TWinControl then - SetCursor(TWinControl(Sender), Data); + gtkproc.SetCursor(TWinControl(Sender), Data); end; LM_RECREATEWND : Result := RecreateWnd(sender); @@ -6733,6 +6733,9 @@ end; { ============================================================================= $Log$ + Revision 1.306 2002/12/26 11:00:14 mattias + added included by to unitinfo and a few win32 functions + Revision 1.305 2002/12/25 14:21:28 mattias fixed setting activecontrol to nil when removing component