mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-20 10:31:38 +02:00

+ Implemented Editor,Mouse Options dialog + Added location of .INI and .CFG file + Option (INI) file managment implemented (see bottom of Options Menu) + Switches updated + Run program
183 lines
4.4 KiB
PHP
183 lines
4.4 KiB
PHP
{
|
|
$Id$
|
|
This file is part of the Free Pascal Integrated Development Environment
|
|
Copyright (c) 1998 by Berczi Gabor
|
|
|
|
Window menu entries
|
|
|
|
See the file COPYING.FPC, included in this distribution,
|
|
for details about the copyright.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
**********************************************************************}
|
|
|
|
procedure TIDEApp.CloseAll;
|
|
|
|
procedure SendClose(P: PView); {$ifndef FPC}far;{$endif}
|
|
begin
|
|
Message(P,evCommand,cmClose,nil);
|
|
end;
|
|
|
|
begin
|
|
Desktop^.ForEach(@SendClose);
|
|
end;
|
|
|
|
|
|
type
|
|
PWindowListBox = ^TWindowListBox;
|
|
TWindowListBox = object(TAdvancedListBox)
|
|
constructor Init(var Bounds: TRect; AScrollBar: PScrollBar);
|
|
function GetText(Item,MaxLen: Sw_Integer): String; virtual;
|
|
end;
|
|
|
|
PWindowListDialog = ^TWindowListDialog;
|
|
TWindowListDialog = object(TCenterDialog)
|
|
constructor Init;
|
|
procedure HandleEvent(var Event: TEvent); virtual;
|
|
destructor Done; virtual;
|
|
private
|
|
LB: PWindowListBox;
|
|
C : PCollection;
|
|
procedure UpdateList;
|
|
end;
|
|
|
|
constructor TWindowListBox.Init(var Bounds: TRect; AScrollBar: PScrollBar);
|
|
begin
|
|
inherited Init(Bounds,1,AScrollBar);
|
|
end;
|
|
|
|
function TWindowListBox.GetText(Item,MaxLen: Sw_Integer): String;
|
|
var P: PView;
|
|
S: string;
|
|
begin
|
|
P:=List^.At(Item);
|
|
case P^.HelpCtx of
|
|
hcSourceWindow : S:=PSourceWindow(P)^.GetTitle(MaxLen);
|
|
hcHelpWindow : S:=PHelpWindow(P)^.GetTitle(MaxLen);
|
|
hcCalcWindow : S:=PCalculator(P)^.GetTitle(MaxLen);
|
|
else S:='???? - '+PWindow(P)^.GetTitle(MaxLen);
|
|
end;
|
|
GetText:=copy(S,1,MaxLen);
|
|
end;
|
|
|
|
constructor TWindowListDialog.Init;
|
|
var R,R2: TRect;
|
|
SB: PScrollBar;
|
|
begin
|
|
R.Assign(0,0,50,15);
|
|
inherited Init(R, 'Window List');
|
|
|
|
New(C, Init(20,10));
|
|
|
|
GetExtent(R); R.Grow(-2,-2); Inc(R.A.Y); R.B.X:=37;
|
|
R2.Copy(R); R2.Move(1,0); R2.A.X:=R2.B.X-1;
|
|
New(SB, Init(R2)); Insert(SB);
|
|
New(LB, Init(R, SB));
|
|
LB^.Default:=true;
|
|
LB^.NewList(C);
|
|
UpdateList;
|
|
if C^.Count>=2 then LB^.FocusItem(1); { focus the 2nd one }
|
|
Insert(LB);
|
|
R2.Copy(R); Dec(R2.A.Y); R2.B.Y:=R2.A.Y+1;
|
|
Insert(New(PLabel, Init(R2, '~W~indows', LB)));
|
|
|
|
GetExtent(R); R.Grow(-2,-2); Inc(R.A.Y); R.A.X:=38; R.B.Y:=R.A.Y+2;
|
|
Insert(New(PButton, Init(R, 'O~K~', cmOK, bfDefault)));
|
|
R.Move(0,3);
|
|
Insert(New(PButton, Init(R, '~D~elete', cmDeleteWnd, bfNormal)));
|
|
R.Move(0,3);
|
|
Insert(New(PButton, Init(R, 'Cancel', cmCancel, bfNormal)));
|
|
|
|
LB^.Select;
|
|
end;
|
|
|
|
procedure TWindowListDialog.UpdateList;
|
|
procedure AddIt(P: PView); {$ifndef FPC}far;{$endif}
|
|
begin
|
|
if (P<>pointer(Desktop^.Background)) and (P^.GetState(sfVisible)) then
|
|
C^.Insert(P);
|
|
end;
|
|
begin
|
|
C^.DeleteAll;
|
|
Desktop^.ForEach(@AddIt);
|
|
LB^.SetRange(C^.Count);
|
|
ReDraw;
|
|
end;
|
|
|
|
procedure TWindowListDialog.HandleEvent(var Event: TEvent);
|
|
begin
|
|
case Event.What of
|
|
evKeyDown :
|
|
case Event.KeyCode of
|
|
kbDel :
|
|
begin
|
|
Message(@Self,evCommand,cmDeleteWnd,nil);
|
|
ClearEvent(Event);
|
|
end;
|
|
end;
|
|
evCommand :
|
|
case Event.Command of
|
|
cmDeleteWnd :
|
|
if C^.Count>0 then
|
|
begin
|
|
Message(C^.At(LB^.Focused),evCommand,cmClose,nil);
|
|
UpdateList;
|
|
ClearEvent(Event);
|
|
end;
|
|
cmOK :
|
|
PView(C^.At(LB^.Focused))^.MakeFirst;
|
|
end;
|
|
end;
|
|
inherited HandleEvent(Event);
|
|
end;
|
|
|
|
destructor TWindowListDialog.Done;
|
|
begin
|
|
if C<>nil then begin C^.DeleteAll; Dispose(C, Done); end;
|
|
inherited Done;
|
|
end;
|
|
|
|
procedure TIDEApp.WindowList;
|
|
var W: PWindowListDialog;
|
|
begin
|
|
New(W,Init);
|
|
ExecView(W);
|
|
Dispose(W,Done);
|
|
end;
|
|
|
|
procedure TIDEApp.ShowScreenWindow;
|
|
begin
|
|
if UserScreenWindow=nil then Exit;
|
|
with UserScreenWindow^ do
|
|
begin
|
|
if not GetState(sfVisible) then
|
|
Show;
|
|
MakeFirst;
|
|
end;
|
|
end;
|
|
|
|
{
|
|
$Log$
|
|
Revision 1.3 1998-12-28 15:47:50 peter
|
|
+ Added user screen support, display & window
|
|
+ Implemented Editor,Mouse Options dialog
|
|
+ Added location of .INI and .CFG file
|
|
+ Option (INI) file managment implemented (see bottom of Options Menu)
|
|
+ Switches updated
|
|
+ Run program
|
|
|
|
Revision 1.2 1998/12/23 22:58:19 peter
|
|
* fixed windowlist for fpc
|
|
|
|
Revision 1.1 1998/12/22 14:27:54 peter
|
|
* moved
|
|
|
|
Revision 1.3 1998/12/22 10:39:50 peter
|
|
+ options are now written/read
|
|
+ find and replace routines
|
|
|
|
}
|