📄 cpwdial.pas
字号:
{*********************************************}
{ }
{ COMPONENT for MS DOS and MS WINDOWS }
{ }
{ Source code for Turbo Pascal 6.0 and }
{ Turbo Pasacal for Windows 1.0 compilers. }
{ }
{ (c) 1991, Roderic D. M. Page }
{ }
{*********************************************}
{ Module for COMPONENT specific dialog boxes }
{$I CPDIR.INC}
{*
Objects
CPWDialog
|
+-----
{*
Code for paired list boxes for delete/restore leaves and
outgroup commands.
6/12/91 Sketched out
6/13/91 A descendant of TListBox was created. TListBox's
Transfer function transfers a string collection
to the list box, but only returns the index of
the currently selected item. I need the list
box to return the string collection as well so that
I can reconstruct the list of active leaves.
TListBox wasn't designed to handle lists that
are user modified, so it had no facility to
deal with them.
To do this I overrode Transfer by altering how
it handles the tf_GetData flag.
13/8/91 SaveTreeDialog added, since Turbo Pascal's
FileDialog does not call TransferData.
19 Aug 1991 PeekMessage function added to
dialog counter box allowing
a user abort.
18 Oct 1991 TNumEdit control improved to give instant feedback
if user is out of range.
ShowTrees dialog added.
17 Jun 1992 Bug found in Borland buttons. Even if button is
disabled it still sends a message to its
parent, which means that simply graying
an OK button will not necessarily work.
17 Nov 1992 TreesSaveDialog box improived by checking for invalid
path to avoid Runtime error 3.
*}
unit cpwdial;
interface
uses
Strings,
WinCrt,
WinTypes,
WinProcs,
WinDos,
{$IFDEF BWCC} { use Borland-style dialogs }
BWCC,
{$IFDEF VER10} { TPW 1.0 }
WObjectB,
StdDlgsB,
{$ELSE}
WObjects,
StdDlgs,
{$ENDIF} {VER10}
{$ELSE} { use standard dialogs }
WObjects,
StdDlgs,
{$ENDIF}
cpfile,
cpvars,
cpwvars,
cpheader,
{$IFDEF NEWBUFFER}
cpwntbuf,
{$ELSE}
cptbuf,
{$ENDIF}
cplabels,
cpwcontl, { some new control types }
cpwdlg, { std dialog with help button }
cpwodial; { dialog box type that supports an "Options>>" button }
const
SEL_SIZE = 20; { bytes in combo box string }
COMMENTSLEN = 320; { size of comment allowed to be entered in
comment dialog box opened by user in
Trees Save dialog box. }
type
{-----------------Transfer buffer records------------ }
{ File format data }
FormatTransfer = record
Radio1,
Radio2,
Radio3,
Radio4,
Radio5,
Check1: word;
end;
{ Data for consensus dialog }
ConTransfer=record
Check1: word;
Check2: word;
Check3: word;
Check4: word;
Check5: word;
Check6: word;
end;
{ Data for tree distance measure dialog }
TreeToTreeBuffer = record
Radio1,
Radio2,
Radio3,
Radio4,
Radio5,
Radio6,
Radio7,
Radio8,
Radio9,
Radio10,
Radio11,
Radio12,
Radio13,
Check1: word;
end;
{ Data for delete/restore leaves and outgroup dialog }
LeafTransfer = record
List1Strings : PStrCollection;
List1Selection : Integer;
List2Strings : PStrCollection;
List2Selection : integer;
end;
{ Data for tree order dialog }
OrderTransfer = record
Radio1,
Radio2,
Radio3,
Radio4 : word;
end;
{ Data type for transfering info to(from) list box }
PMyTransferData = ^MyTransferData;
MyTransferData=record
D1: PStrCollection;
D2: Integer;
end;
{ Data|Reconcile dialog transfer buffer }
ReconRec = record
N : longint;
InputChk,
DistChk,
MapChk,
ReconChk : word;
end;
{ Data|Search dialog transfer buffer }
DSearchRec = record
Radio1,
Radio2,
Radio3 : word;
Check1 : word;
end;
{ Alltrees dialog buffer }
AllBuf=record
Check1:word;
Check2:word;
Edit1:longint;
end;
{ Random trees dialog buffer }
RandBuf = record
Radio1,
Radio2,
Radio3,
Check1 : word;
Edit1,
Edit2:longint;
Radio4,
Radio5 : word;
Edit3 : longint;
end;
PMyListBox = ^MyListBox;
MyListBox = object(TListBox)
function Transfer(DataPtr:Pointer; TransferFlag:word):word;virtual;
end;
{--------------Dialogs---------------}
{ Two list box dialog for Trees|Delete/restore leaves }
PTwoBoxDialog = ^TwoBoxDialog;
TwoBoxDialog = object(CPWDialog)
procedure SetUpWindow;virtual;
procedure SetLimit;virtual;
procedure EnableLeft (Flag:Bool);
procedure EnableRight (Flag:Bool);
procedure Delete (Idx:word);
procedure Restore (Idx:word);
procedure DeleteButton (var Msg:TMessage);virtual id_First + id_Delete;
procedure RestoreButton (var Msg:TMessage);virtual id_First + id_Restore;
procedure LeftListBox(var Msg: TMessage); virtual id_First + id_NonDeletedLB;
procedure RightListBox(var Msg:TMessage);virtual id_First + id_DeletedLB;
private
Limit: integer;
end;
{ Two list box dialog for Trees|Outgroup }
PTwoBoxDialogOutGrp = ^TwoBoxDialogOutGrp;
TwoBoxDialogOutGrp = object(TwoBoxDialog)
procedure SetLimit;virtual;
end;
PProfileDialog = ^ProfileDialog;
ProfileDialog = object (CPWDialog)
procedure HandleMsg (var Msg:TMessage);virtual id_First + id_ProfileLB;
end;
{ Trees|Tree-to-Tree dialog with "Options>>" button }
PT2TDialog = ^T2TDialog;
T2TDialog = object(TOptionsDialog)
constructor Init(Aparent:PWindowsObject; ATitle: PChar;
AHelpID:longint; F:word);
procedure SetUpWindow;virtual;
private
Buttons:word;
end;
{ Trees|Select trees dialog box with from-to number boxes }
PSelectTreesDialog = ^SelectTreesDialog;
SelectTreesDialog = object(CPWDialog)
procedure SetUpWindow;virtual;
procedure IDFrom (var Msg:TMessage);virtual id_First + id_From;
procedure IDTo (var Msg:TMessage);virtual id_First + id_To;
end;
{ Trees|Compare tree with dialog box with some buttons disabled }
PCTWDialog = ^CTWDialog;
CTWDialog = object(CPWDialog)
constructor Init(Aparent:PWindowsObject; ATitle: PChar;
AHelpID:longint; F:word);
procedure SetUpWindow;virtual;
private
Buttons:word;
end;
PAllTreesDlg = ^AllTreesDlg;
AllTreesDlg=object(CPWDialog)
Rooted : Boolean;
procedure SetUpWindow;virtual;
procedure IDRooted (var Msg:TMessage);
virtual id_First + id_Rooted;
procedure IDLabeled (var Msg:TMessage);
virtual id_First + id_Labeled;
procedure IDLeaves (var Msg:TMessage);
virtual id_First + id_Leaves;
procedure OK (var Msg:TMessage);
virtual id_First + id_OK;
end;
PRandTreesDlg=^RandTreesDlg;
RandTreesDlg = object(CPWDialog)
Rooted : Boolean;
procedure SetUpWindow;virtual;
function CanClose:Boolean;virtual;
procedure IDRooted (var Msg:TMessage);
virtual id_First + id_Rooted;
procedure IDLeaves (var Msg:TMessage);
virtual id_First + id_Leaves;
procedure IDnTrees (var Msg:TMessage);
virtual id_First + id_nTrees;
procedure OK (var Msg:TMessage);
virtual id_First + id_OK;
end;
PConsensusDlg=^ConsensusDlg;
ConsensusDlg=object(CPWDialog)
function CanClose:Boolean;virtual;
end;
PTreeOrderDlg=^TreeOrderDlg;
TreeOrderDlg=object(CPWDialog)
constructor Init(Aparent:PWindowsObject; ATitle: PChar;
AHelpID:longint; CanLLR:Boolean);
procedure SetUpWindow;virtual;
private
LLROn:Boolean;
end;
{ A dialog box displaying a edit control for user
to enter comments. }
PCommentsDialog = ^CommentsDialog;
CommentsDialog = object(CPWDialog)
procedure OK (var Msg:TMessage);
virtual id_First + id_OK;
end;
{ Trees | Save dialog. }
PTreesSaveDlg = ^TreesSaveDlg;
TreesSaveDlg = object(TFileDialog)
constructor Init(Aparent:PWindowsObject; ATitle, FileName, Comments: PChar);
function CanClose:Boolean;virtual;
procedure IDComments (var Msg:TMessage);virtual id_First + id_Comments;
private
lpszComments : PChar;
end;
{ Trees|Compare tree with dialog box with some buttons disabled }
PHSearchDialog = ^HSearchDialog;
HSearchDialog = object(CPWDialog)
constructor Init(Aparent:PWindowsObject; ATitle: PChar;
AHelpID:longint; UserMoreThanOne:Boolean);
procedure SetUpWindow;virtual;
private
MoreThanOne : Boolean;
end;
PAboutDialog = ^TAboutDialog;
TAboutDialog = object(TDialog)
procedure SetUpWindow;virtual;
end;
PAboutTreesDialog = ^TAboutTreesDialog;
TAboutTreesDialog = object(CPWDialog)
procedure SetUpWindow;virtual;
end;
PUserDialog = ^TUserDialog;
TUserDialog = object(TDialog)
procedure IDUserName (var Msg:TMessage);
virtual id_First + id_UserName;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -