mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 14:39:13 +02:00
MG: fixed view units/forms
git-svn-id: trunk@1440 -
This commit is contained in:
parent
e095b4c22e
commit
256c7e8928
29
ide/main.pp
29
ide/main.pp
@ -3194,7 +3194,11 @@ var UnitList: TList;
|
|||||||
MainUnitName, Ext, DlgCaption: string;
|
MainUnitName, Ext, DlgCaption: string;
|
||||||
MainUnitInfo, AnUnitInfo: TUnitInfo;
|
MainUnitInfo, AnUnitInfo: TUnitInfo;
|
||||||
MainUnitIndex: integer;
|
MainUnitIndex: integer;
|
||||||
|
ActiveSourceEditor: TSourceEditor;
|
||||||
|
ActiveUnitInfo: TUnitInfo;
|
||||||
|
AForm: TForm;
|
||||||
Begin
|
Begin
|
||||||
|
GetCurrentUnit(ActiveSourceEditor,ActiveUnitInfo);
|
||||||
UnitList:=TList.Create;
|
UnitList:=TList.Create;
|
||||||
try
|
try
|
||||||
MainUnitIndex:=-1;
|
MainUnitIndex:=-1;
|
||||||
@ -3204,12 +3208,12 @@ Begin
|
|||||||
if Project.MainUnit=i then MainUnitIndex:=i;
|
if Project.MainUnit=i then MainUnitIndex:=i;
|
||||||
if Project.Units[i].FormName<>'' then
|
if Project.Units[i].FormName<>'' then
|
||||||
UnitList.Add(TViewUnitsEntry.Create(
|
UnitList.Add(TViewUnitsEntry.Create(
|
||||||
Project.Units[i].FormName,i,false));
|
Project.Units[i].FormName,i,Project.Units[i]=ActiveUnitInfo));
|
||||||
end else begin
|
end else begin
|
||||||
if Project.Units[i].UnitName<>'' then begin
|
if Project.Units[i].UnitName<>'' then begin
|
||||||
if Project.MainUnit=i then MainUnitIndex:=i;
|
if Project.MainUnit=i then MainUnitIndex:=i;
|
||||||
UnitList.Add(TViewUnitsEntry.Create(
|
UnitList.Add(TViewUnitsEntry.Create(
|
||||||
Project.Units[i].UnitName,i,false));
|
Project.Units[i].UnitName,i,Project.Units[i]=ActiveUnitInfo));
|
||||||
end else if Project.MainUnit=i then begin
|
end else if Project.MainUnit=i then begin
|
||||||
MainUnitInfo:=Project.Units[Project.MainUnit];
|
MainUnitInfo:=Project.Units[Project.MainUnit];
|
||||||
if Project.ProjectType in [ptProgram,ptApplication,ptCustomProgram]
|
if Project.ProjectType in [ptProgram,ptApplication,ptCustomProgram]
|
||||||
@ -3228,7 +3232,7 @@ Begin
|
|||||||
if MainUnitName<>'' then begin
|
if MainUnitName<>'' then begin
|
||||||
MainUnitIndex:=UnitList.Count;
|
MainUnitIndex:=UnitList.Count;
|
||||||
UnitList.Add(TViewUnitsEntry.Create(
|
UnitList.Add(TViewUnitsEntry.Create(
|
||||||
MainUnitName,i,false));
|
MainUnitName,i,MainUnitInfo=ActiveUnitInfo));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -3240,12 +3244,13 @@ Begin
|
|||||||
else
|
else
|
||||||
DlgCaption:='View units';
|
DlgCaption:='View units';
|
||||||
if ShowViewUnitsDlg(UnitList,true,DlgCaption)=mrOk then begin
|
if ShowViewUnitsDlg(UnitList,true,DlgCaption)=mrOk then begin
|
||||||
|
AnUnitInfo:=nil;
|
||||||
for i:=0 to UnitList.Count-1 do begin
|
for i:=0 to UnitList.Count-1 do begin
|
||||||
if TViewUnitsEntry(UnitList[i]).Selected then begin
|
if TViewUnitsEntry(UnitList[i]).Selected then begin
|
||||||
AnUnitInfo:=Project.Units[TViewUnitsEntry(UnitList[i]).ID];
|
AnUnitInfo:=Project.Units[TViewUnitsEntry(UnitList[i]).ID];
|
||||||
if AnUnitInfo.Loaded then
|
if AnUnitInfo.Loaded then begin
|
||||||
SourceNoteBook.NoteBook.PageIndex:=AnUnitInfo.EditorIndex
|
SourceNoteBook.NoteBook.PageIndex:=AnUnitInfo.EditorIndex;
|
||||||
else begin
|
end else begin
|
||||||
if MainUnitIndex=i then
|
if MainUnitIndex=i then
|
||||||
Result:=DoOpenMainUnit(false)
|
Result:=DoOpenMainUnit(false)
|
||||||
else
|
else
|
||||||
@ -3254,8 +3259,13 @@ Begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
FCodeLastActivated:=not OnlyForms;
|
if (AnUnitInfo<>nil) then begin
|
||||||
DoBringToFrontFormOrUnit;
|
AForm:=SourceNotebook;
|
||||||
|
if OnlyForms and (AnUnitInfo.Form<>nil) then begin
|
||||||
|
AForm:=TForm(AnUnitInfo.Form);
|
||||||
|
end;
|
||||||
|
BringWindowToTop(AForm.Handle)
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
UnitList.Free;
|
UnitList.Free;
|
||||||
@ -5962,6 +5972,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.223 2002/02/17 19:34:44 lazarus
|
||||||
|
MG: fixed view units/forms
|
||||||
|
|
||||||
Revision 1.222 2002/02/11 15:12:00 lazarus
|
Revision 1.222 2002/02/11 15:12:00 lazarus
|
||||||
MG: started OI events
|
MG: started OI events
|
||||||
|
|
||||||
|
@ -42,8 +42,10 @@ type
|
|||||||
ListBox: TListBox;
|
ListBox: TListBox;
|
||||||
btnOK : TButton;
|
btnOK : TButton;
|
||||||
btnCancel : TButton;
|
btnCancel : TButton;
|
||||||
Procedure btnOKClick(Sender : TOBject);
|
MultiselectCheckBox: TCheckBox;
|
||||||
Procedure btnCancelClick(Sender : TOBject);
|
Procedure btnOKClick(Sender :TObject);
|
||||||
|
Procedure btnCancelClick(Sender :TObject);
|
||||||
|
procedure MultiselectCheckBoxClick(Sender :TObject);
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
end;
|
end;
|
||||||
@ -66,7 +68,7 @@ begin
|
|||||||
try
|
try
|
||||||
ViewUnits.Caption:=Caption;
|
ViewUnits.Caption:=Caption;
|
||||||
ViewUnits.ListBox.Visible:=false;
|
ViewUnits.ListBox.Visible:=false;
|
||||||
ViewUnits.ListBox.MultiSelect:=MultiSelect;
|
ViewUnits.MultiselectCheckBox.Enabled:=MultiSelect;
|
||||||
with ViewUnits.ListBox.Items do begin
|
with ViewUnits.ListBox.Items do begin
|
||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
Clear;
|
Clear;
|
||||||
@ -79,8 +81,9 @@ begin
|
|||||||
ViewUnits.ListBox.Visible:=true;
|
ViewUnits.ListBox.Visible:=true;
|
||||||
Result:=ViewUnits.ShowModal;
|
Result:=ViewUnits.ShowModal;
|
||||||
if Result=mrOk then begin
|
if Result=mrOk then begin
|
||||||
for i:=0 to Entries.Count-1 do
|
for i:=0 to Entries.Count-1 do begin
|
||||||
TViewUnitsEntry(Entries[i]).Selected:=ViewUnits.ListBox.Selected[i];
|
TViewUnitsEntry(Entries[i]).Selected:=ViewUnits.ListBox.Selected[i];
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
ViewUnits.Free;
|
ViewUnits.Free;
|
||||||
@ -144,9 +147,23 @@ begin
|
|||||||
Left:= Pad;
|
Left:= Pad;
|
||||||
Width:= Self.Width - (Self.Width - btnOK.Left) - (2*pad);
|
Width:= Self.Width - (Self.Width - btnOK.Left) - (2*pad);
|
||||||
Height:= Self.Height - Top - Pad;
|
Height:= Self.Height - Top - Pad;
|
||||||
Visible:= true;
|
|
||||||
MultiSelect:= false;
|
MultiSelect:= false;
|
||||||
Name := 'Listbox';
|
Name := 'Listbox';
|
||||||
|
Visible:= true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
MultiselectCheckBox:=TCheckBox.Create(Self);
|
||||||
|
with MultiselectCheckBox do begin
|
||||||
|
Parent:=Self;
|
||||||
|
Name:='MultiselectCheckBox';
|
||||||
|
Left:=btnOK.Left;
|
||||||
|
Top:=btnCancel.Top+btnCancel.Height+2*pad;
|
||||||
|
Width:=btnOk.Width;
|
||||||
|
Height:=25;
|
||||||
|
Caption:='Multi';
|
||||||
|
Checked:=false;
|
||||||
|
OnClick:=@MultiselectCheckBoxClick;
|
||||||
|
Visible:=true;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -163,6 +180,11 @@ Begin
|
|||||||
ModalResult := mrCancel;
|
ModalResult := mrCancel;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TViewUnits.MultiselectCheckBoxClick(Sender :TObject);
|
||||||
|
begin
|
||||||
|
ListBox.Multiselect:=MultiselectCheckBox.Checked;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
{ $I viewunits1.lrs}
|
{ $I viewunits1.lrs}
|
||||||
@ -171,6 +193,9 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.9 2002/02/17 19:34:45 lazarus
|
||||||
|
MG: fixed view units/forms
|
||||||
|
|
||||||
Revision 1.8 2001/04/04 12:20:34 lazarus
|
Revision 1.8 2001/04/04 12:20:34 lazarus
|
||||||
MG: added add to/remove from project, small bugfixes
|
MG: added add to/remove from project, small bugfixes
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user