home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sibdemo3.zip / SOURCE.DAT / SOURCE / SPCC / DIALOGS.PAS < prev    next >
Pascal/Delphi Source File  |  1998-05-19  |  102KB  |  3,074 lines

  1.  
  2. {╔══════════════════════════════════════════════════════════════════════════╗
  3.  ║                                                                          ║
  4.  ║     Sibyl Portable Component Classes                                     ║
  5.  ║                                                                          ║
  6.  ║     Copyright (C) 1995,97 SpeedSoft Germany,   All rights reserved.      ║
  7.  ║                                                                          ║
  8.  ╚══════════════════════════════════════════════════════════════════════════╝}
  9.  
  10. Unit Dialogs;
  11.  
  12.  
  13. Interface
  14.  
  15. {$IFDEF OS2}
  16. Uses BseDos,BseErr,PmWin,PmStdDlg;
  17. {$ENDIF}
  18. {$IFDEF Win95}
  19. Uses WinDef,WinBase,WinUser,CommDlg;
  20. {$ENDIF}
  21.  
  22. Uses Dos,SysUtils,Classes,Graphics,Forms,Buttons,StdCtrls,ExtCtrls,ComCtrls,
  23.      FileCtrl,Printers;
  24.  
  25. Type
  26.     TDialog=Class(TForm)
  27.       Protected
  28.          Procedure SetupComponent;Override;
  29.          Property AutoScroll;
  30.          Property EnableDocking;
  31.          Property HorzScrollBar;
  32.          Property MinTrackWidth;
  33.          Property MinTrackHeight;
  34.          Property MaxTrackWidth;
  35.          Property MaxTrackHeight;
  36.          Property Menu;
  37.          Property FormStyle;
  38.          Property VertScrollBar;
  39.          Property OnMDIActivate;
  40.          Property OnMDIDeactivate;
  41.          Property OnMenuInit;
  42.          Property OnMenuEnd;
  43.          Property OnMenuItemFocus;
  44.       Public
  45.          Function Execute:Boolean;Virtual;
  46.          Property Align;
  47.          Property BorderIcons;
  48.          Property BorderStyle;
  49.          Property Bottom;
  50.          Property ClientHeight;
  51.          Property ClientWidth;
  52.          Property Color;
  53.          Property Cursor;
  54.          Property Enabled;
  55.          Property Font;
  56.          Property Height;
  57.          Property Hint;
  58.          Property Icon;
  59.          Property Left;
  60.          Property PenColor;
  61.          Property PopupMenu;
  62.          Property Right;
  63.          Property ScrollBars;
  64.          Property ShowHint;
  65.          Property Top;
  66.          Property Visible;
  67.          Property Width;
  68.          Property WindowState;
  69.          Property XAlign;
  70.          Property XStretch;
  71.          Property YAlign;
  72.          Property YStretch;
  73.  
  74.          Property OnActivate;
  75.          Property OnClose;
  76.          Property OnCloseQuery;
  77.          Property OnCommand;
  78.          Property OnCreate;
  79.          Property OnDeactivate;
  80.          Property OnDestroy;
  81.          Property OnDismissDlg;
  82.          Property OnDragDrop;
  83.          Property OnDragOver;
  84.          Property OnEndDrag;
  85.          Property OnFontChange;
  86.          Property OnHide;
  87.          Property OnKeyPress;
  88.          Property OnMaximize;
  89.          Property OnMinimize;
  90.          Property OnMouseClick;
  91.          Property OnMouseDblClick;
  92.          Property OnMouseDown;
  93.          Property OnMouseMove;
  94.          Property OnMouseUp;
  95.          Property OnMove;
  96.          Property OnPaint;
  97.          Property OnResize;
  98.          Property OnRestore;
  99.          Property OnScan;
  100.          Property OnSetupShow;
  101.          Property OnShow;
  102.          Property OnTranslateShortCut;
  103.     End;
  104.  
  105.  
  106.     TSystemOpenSaveDialog=Class(TComponent)
  107.       Private
  108.          FOkName:String;
  109.          FTitle:String;
  110.          FFileName:String;
  111.          FDefaultExt:String;
  112.          FFilter:String;
  113.          FFilterIndex:LongInt;
  114.          FMaskList:TStringList;
  115.       Protected
  116.          Procedure SetupComponent;Override;
  117.       Public
  118.          Destructor Destroy;Override;
  119.       Published
  120.          Property DefaultExt:String Read FDefaultExt Write FDefaultExt;
  121.          Property FileName:String Read FFileName Write FFileName;
  122.          Property Filter:String Read FFilter Write FFilter;
  123.          Property FilterIndex:LongInt Read FFilterIndex Write FFilterIndex;
  124.          Property OkName:String Read FOkName Write FOkName;
  125.          Property Title:String Read FTitle Write FTitle;
  126.     End;
  127.  
  128.  
  129.     TSystemOpenDialog=Class(TSystemOpenSaveDialog)
  130.       Protected
  131.          Procedure SetupComponent;Override;
  132.       Public
  133.          Function Execute:Boolean;
  134.     End;
  135.  
  136.  
  137.     TSystemSaveDialog=Class(TSystemOpenSaveDialog)
  138.       Protected
  139.          Procedure SetupComponent;Override;
  140.       Public
  141.          Function Execute:Boolean;
  142.     End;
  143.  
  144.  
  145.     TOpenDialog=Class(TDialog)
  146.       Private
  147.          FCurDir:String;
  148.          FTitle:String;
  149.          FFileName:String;
  150.          FFilter:String;
  151.          FFilterIndex:LongInt;
  152.          FDefaultExt:String;
  153.          FOkName:String;
  154.          FFileNameEdit:TEdit;
  155.          FFilterCombo:TFilterComboBox;
  156.          FDriveCombo:TDriveComboBox;
  157.          FFileList:TFileListBox;
  158.          FDirectoryList:TDirectoryListBox;
  159.          FCurrentNamePanel:TPanel;
  160.          FOkButton:TBitBtn;
  161.          FCancelButton:TBitBtn;
  162.          FHelpButton:TBitBtn;
  163.          Procedure SetFileName(Value:String);
  164.          Function GetFileName:String;
  165.          Procedure SetCurDir(Value:String);
  166.          Procedure FileChange(Sender:TObject);
  167.          Procedure FileSelect(Sender:TObject;Index:LongInt);
  168.          Procedure EvKillFocus(Sender:TObject);
  169.          Procedure CMTextChanged(Var Msg:TMessage);Message CM_TEXTCHANGED;
  170.       Protected
  171.          Procedure SetupComponent;Override;
  172.          Procedure SetupShow;Override;
  173.       Public
  174.          Procedure DismissDlg(Result:TCommand);Override;
  175.          Procedure AddFilter(Name,Mask:String);
  176.          Property Caption;
  177.       Published
  178.          Property DefaultExt:String Read FDefaultExt Write FDefaultExt;
  179.          Property FileName:String Read FFileName Write FFileName;
  180.          Property Filter:String Read FFilter Write FFilter;
  181.          Property FilterIndex:LongInt Read FFilterIndex Write FFilterIndex;
  182.          Property OkName:String Read FOkName Write FOkName;
  183.          Property Title:String Read FTitle Write FTitle;
  184.     End;
  185.  
  186.  
  187.     TSaveDialog=Class(TOpenDialog)
  188.       Private
  189.          FCreateButton:TSpeedButton;
  190.          Procedure EvCreateDir(Sender:TObject);
  191.       Protected
  192.          Procedure SetupComponent;Override;
  193.     End;
  194.  
  195.  
  196.     TCreateDirDialog=Class(TDialog)
  197.       Private
  198.          FOkName:String;
  199.          FDirectory:String;
  200.          FChangeDir:Boolean;
  201.          FDirEdit:TEdit;
  202.          FChangeCheck:TCheckBox;
  203.          FOkButton:TBitBtn;
  204.          FCancelButton:TBitBtn;
  205.          FHelpButton:TBitBtn;
  206.       Protected
  207.          Procedure SetupComponent;Override;
  208.          Procedure SetupShow;Override;
  209.       Public
  210.          Procedure DismissDlg(Result:TCommand);Override;
  211.       Published
  212.          Property ChangeDir:Boolean Read FChangeDir Write FChangeDir;
  213.          Property Directory:String Read FDirectory Write FDirectory;
  214.          Property OkName:String Read FOkName Write FOkName;
  215.     End;
  216.  
  217.  
  218.     TChangeDirDialog=Class(TDialog)
  219.       Private
  220.          FOkName:String;
  221.          FDirectory:String;
  222.          FFileNameEdit:TEdit;
  223.          FDriveCombo:TDriveComboBox;
  224.          FDirectoryList:TDirectoryListBox;
  225.          FOkButton:TBitBtn;
  226.          FCancelButton:TBitBtn;
  227.          FCreateButton:TBitBtn;
  228.          FHelpButton:TBitBtn;
  229.          Procedure DirectoryChange(Sender:TObject);
  230.          Procedure EvCreateDir(Sender:TObject);
  231.       Protected
  232.          Procedure SetupComponent;Override;
  233.          Procedure SetupShow;Override;
  234.       Public
  235.          Function Execute:Boolean;Override;
  236.       Published
  237.          Property Directory:String Read FDirectory Write FDirectory;
  238.          Property OkName:String Read FOkName Write FOkName;
  239.     End;
  240.  
  241.  
  242.     {$M+}
  243.     TFindDirection = (fdForward,fdBackward);
  244.     TFindOrigin    = (foEntireScope,foCursor);
  245.     TFindScope     = (fsGlobal,fsSelection);
  246.     TFindOptions   = Set Of (foCaseSensitive,foWordsOnly);
  247.     {$M-}
  248.  
  249.     TFindDialog=Class(TDialog)
  250.       Private
  251.          Lab_Find:TLabel;
  252.          CoB_Find:TComboBox;
  253.          Grp_Options:TGroupBox;
  254.          ChB_CaseSense:TCheckBox;
  255.          ChB_WordsOnly:TCheckBox;
  256.          Grp_Scope:TGroupBox;
  257.          RaB_Global:TRadioButton;
  258.          RaB_Selection:TRadioButton;
  259.          Grp_Origin:TGroupBox;
  260.          RaB_EntireScope:TRadioButton;
  261.          RaB_Cursor:TRadioButton;
  262.          Grp_Direction:TGroupBox;
  263.          RaB_Forward:TRadioButton;
  264.          RaB_Backward:TRadioButton;
  265.          BiB_Find:TBitBtn;
  266.          BiB_Cancel:TBitBtn;
  267.          BiB_Help:TBitBtn;
  268.          FFindTextExt:String;
  269.          Function GetFindOptions:TFindOptions;
  270.          Procedure SetFindOptions(Value:TFindOptions);
  271.          Function GetFindOrigin:TFindOrigin;
  272.          Procedure SetFindOrigin(Value:TFindOrigin);
  273.          Function GetFindScope:TFindScope;
  274.          Procedure SetFindScope(Value:TFindScope);
  275.          Function GetFindDirection:TFindDirection;
  276.          Procedure SetFindDirection(Value:TFindDirection);
  277.          Function GetFindText:String;
  278.          Procedure SetFindText(Const Value:String);
  279.          Procedure SetFindTextExtend(Const Value:String);
  280.          Procedure SetFindHistory(Const Strings:TStringList);
  281.       Protected
  282.          Procedure SetupComponent;Override;
  283.          Procedure SetupShow;Override;
  284.       Public
  285.          Property FindHistory:TStringList Write SetFindHistory;
  286.       Published
  287.          Property Options:TFindOptions Read GetFindOptions Write SetFindOptions;
  288.          Property Origin:TFindOrigin Read GetFindOrigin Write SetFindOrigin;
  289.          Property Scope:TFindScope Read GetFindScope Write SetFindScope;
  290.          Property Direction:TFindDirection Read GetFindDirection Write SetFindDirection;
  291.          Property FindText:String Read GetFindText Write SetFindText;
  292.          Property FindTextExtend:String Read FFindTextExt Write SetFindTextExtend;
  293.     End;
  294.  
  295.  
  296.     TReplaceDialog=Class(TFindDialog)
  297.       Private
  298.          CoB_Replace:TComboBox;
  299.          ChB_Confirm:TCheckBox;
  300.          Function GetConfirm:Boolean;
  301.          Procedure SetConfirm(Value:Boolean);
  302.          Function GetReplaceText:String;
  303.          Procedure SetReplaceText(Const Value:String);
  304.          Procedure SetReplaceHistory(Const Strings:TStringList);
  305.       Protected
  306.          Procedure SetupComponent;Override;
  307.       Public
  308.          Property ReplaceHistory:TStringList Write SetReplaceHistory;
  309.       Published
  310.          Property Confirm:Boolean Read GetConfirm Write SetConfirm;
  311.          Property ReplaceText:String Read GetReplaceText Write SetReplaceText;
  312.     End;
  313.  
  314.  
  315.     TColorDialog=Class(TDialog)
  316.       Private
  317.          FSelColor:TColor;
  318.          FRedScroll,FGreenScroll,FBlueScroll:TScrollBar;
  319.          FColorArea:TPanel;
  320.          FOkBtn:TBitBtn;
  321.          FDefaultCombo:TComboBox;
  322.          Procedure SetSelColor(Value:TColor);
  323.          Procedure EvSelectComboItem(Sender:TObject;Index:LongInt);
  324.       Protected
  325.          Procedure SetupComponent;Override;
  326.          Procedure SetupShow;Override;
  327.          Procedure Scroll(ScrollBar:TScrollBar;ScrollCode:TScrollCode;Var ScrollPos:LongInt);Override;
  328.          Procedure UpdateColorArea;
  329.       Public
  330.          Property RGBColor:TColor Read FSelColor Write SetSelColor;
  331.     End;
  332.  
  333.  
  334.     TFontDialog=Class(TDialog)
  335.       Private
  336.          FNameCombo:TComboBox;
  337.          FSizeCombo:TComboBox;
  338.          FExampleText:TButton;
  339.          FItalicCheck:TCheckBox;
  340.          FBoldCheck:TCheckBox;
  341.          FOutlineCheck:TCheckBox;
  342.          FUnderscoreCheck:TCheckBox;
  343.          FStrikeOutCheck:TCheckBox;
  344.          FOkBtn:TBitBtn;
  345.          Function GetFontName:String;
  346.          Procedure SetFontName(Value:String);
  347.          Function GetFaceName:String;
  348.          Procedure SetFaceName(Value:String);
  349.          Function GetPointSize:LongInt;
  350.          Procedure SetPointSize(Value:LongInt);
  351.          Procedure SetTheFont;
  352.          Procedure InsertSizes(Var TheFont:TFont);
  353.          Procedure EvComboSelect(Sender:TObject;Index:LongInt);
  354.          Procedure EvComboSizeSelect(Sender:TObject;Index:LongInt);
  355.          Function GetEditFont:TFont;
  356.          Procedure SetEditFont(NewFont:TFont);
  357.          Function GetAttributes:TFontAttributes;
  358.          Procedure SetAttributes(NewValue:TFontAttributes);
  359.          Procedure StyleChanged(Sender:TObject);
  360.       Protected
  361.          Procedure SetupComponent;Override;
  362.          Procedure SetupShow;Override;
  363.       Public
  364.          Property FaceName:String Read GetFaceName Write SetFaceName;
  365.          Property PointSize:LongInt Read GetPointSize Write SetPointSize;
  366.       Published
  367.          Property FontName:String Read GetFontName Write SetFontName;
  368.          Property EditFont:TFont Read GetEditFont Write SetEditFont;
  369.          Property Attributes:TFontAttributes Read GetAttributes Write SetAttributes;
  370.     End;
  371.  
  372.  
  373.     TPrinterSetupDialog = Class (TDialog)
  374.       Private
  375.          FPrinterListHeadLine: TLabel;
  376.          FPrinterList: TListBox;
  377.          FPrinterGroupCaption: String;
  378.          FSetPrinterButton: TBitBtn;
  379.          FCancelButton: TBitBtn;
  380.          FPropertyButton: TBitBtn;
  381.          FHelpButton: TBitBtn;
  382.          FOkName: String;
  383.          FOldPrinterIndex: LongInt;
  384.          Procedure PrinterSelected (Sender: TObject; Index: LongInt);
  385.          Procedure PrinterFocused (Sender: TObject; Index: LongInt);
  386.          Procedure PropertyBtnClicked (Sender: TObject);
  387.          Procedure SetOkName (NewName: String);
  388.       Protected
  389.          Procedure SetupComponent; Override;
  390.       Public
  391.          Function Execute: Boolean; Override;
  392.       Published
  393.          Property OkName: String Read FOkName Write SetOkName;
  394.     End;
  395.  
  396.  
  397.     TPrintDialog = Class (TDialog)
  398.       Private
  399.          FTitleBox: TGroupBox;
  400.          FTitle: TEdit;
  401.          FOptionsGroupBox: TGroupBox;
  402.          FNumberOfCopiesLabel: TLabel;
  403.          FNumberOfCopies: TUpDown;
  404.          FNumberOfCopiesEdit: TEdit;
  405.          FPagesBox: TRadioGroup;
  406.          FPrintFromLabel: TRadioButton;
  407.          FPrintFrom: TUpDown;
  408.          FPrintFromEdit: TEdit;
  409.          FPrintToLabel: TLabel;
  410.          FPrintTo: TUpDown;
  411.          FPrintToEdit: TEdit;
  412.          FPrintAll: TRadioButton;
  413.          FOptionsBox: TRadioGroup;
  414.          FPrinter: TRadioButton;
  415.          FFileOutPut: TRadioButton;
  416.          FFile: TEdit;
  417.          FPrintButton: TBitBtn;
  418.          FCancelButton: TBitBtn;
  419.          FPropertyButton: TBitBtn;
  420.          FHelpButton: TBitBtn;
  421.          FCopies: LongInt;
  422.          FMinPage: LongInt;
  423.          FMaxPage: LongInt;
  424.          FFromPage: LongInt;
  425.          FToPage: LongInt;
  426.          FAllPages: Boolean;
  427.          FOkName: String;
  428.          FOldPrinterIndex: LongInt;
  429.       Protected
  430.          Procedure PropertyBtnClicked (Sender: TObject);
  431.          Procedure SetupComponent; Override;
  432.          Procedure SetMinPage (NewValue: LongInt);
  433.          Procedure SetMaxPage (NewValue: LongInt);
  434.          Procedure SetToPage (NewValue: LongInt);
  435.          Procedure SetFromPage (NewValue: LongInt);
  436.          Procedure SetOkName (NewName: String);
  437.          Procedure UpdateSpinSize (Sender: TObject);
  438.       Public
  439.          Function Execute: Boolean; Override;
  440.          Property AllPages: Boolean Read FAllPages;
  441.          Property MinPage: LongInt Read FMinPage Write SetMinPage;
  442.          Property MaxPage: LongInt Read FMaxPage Write SetMaxPage;
  443.          Property FromPage: LongInt Read FFromPage Write SetFromPage;
  444.          Property ToPage: LongInt Read FToPage Write SetToPage;
  445.       Published
  446.          Property OkName: String Read FOkName Write SetOkName;
  447.     End;
  448.  
  449.  
  450.     TMessageBox=Class(TDialog)
  451.       Private
  452.          FMsg:String;
  453.          FHelpCtx:THelpContext;
  454.          FButtons:TMsgDlgButtons;
  455.          fType:TMsgDlgType;
  456.       Protected
  457.          Procedure SetupShow;Override;
  458.          Procedure SetupComponent;Override;
  459.       Published
  460.          Property Message:String Read FMsg Write FMsg;
  461.          Property Buttons:TMsgDlgButtons Read FButtons Write FButtons;
  462.          Property DlgType:TMsgDlgType Read fType Write fType;
  463.          Property HelpCtx:THelpContext Read FHelpCtx Write FHelpCtx;
  464.     End;
  465.  
  466.  
  467.  
  468. Function MessageBox(Const Msg:String;Typ:TMsgDlgType;Buttons:TMsgDlgButtons):TMsgDlgReturn;
  469. Function ErrorBox(Const Msg:String):TMsgDlgReturn;
  470.  
  471. Function CreateMessageDialog(Const Msg:String;DlgType:TMsgDlgType;DlgButtons:TMsgDlgButtons):TForm;
  472. Function MessageDlg(Const Msg:String;DlgType:TMsgDlgType;DlgButtons:TMsgDlgButtons;HelpCtx:THelpContext):TMsgDlgReturn;
  473. Function MessageDlgPos(Const Msg:String;DlgType: TMsgDlgType;DlgButtons:TMsgDlgButtons;HelpCtx:THelpContext;
  474.                        X,Y:LongInt):TMsgDlgReturn;
  475. Procedure ShowMessage(Const Msg:String);
  476. Procedure ShowMessagePos(Const Msg:String;X,Y:LongInt);
  477. Function InputBox(Const ACaption,APrompt,ADefault:String):String;
  478. Function InputQuery(Const ACaption,APrompt:String;Var Value:String):Boolean;
  479.  
  480.  
  481. Implementation
  482.  
  483. {
  484. ╔═══════════════════════════════════════════════════════════════════════════╗
  485. ║                                                                           ║
  486. ║ Speed-Pascal/2 Version 2.0                                                ║
  487. ║                                                                           ║
  488. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  489. ║                                                                           ║
  490. ║ This section: Some useful FUNCTIONs                                       ║
  491. ║                                                                           ║
  492. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  493. ║                                                                           ║
  494. ╚═══════════════════════════════════════════════════════════════════════════╝
  495. }
  496.  
  497. Function MessageBox(Const Msg:String;Typ:TMsgDlgType;Buttons:TMsgDlgButtons):TMsgDlgReturn;
  498. Var  Dlg:TMessageBox;
  499.      OldDesignerForm:TForm;
  500. Begin
  501.      OldDesignerForm := Nil;
  502.      If Screen.ActiveForm <> Nil Then
  503.        If Screen.ActiveForm.Designed Then
  504.        Begin {Clear the designer flag To Assign the correct Font}
  505.             OldDesignerForm := Screen.ActiveForm;
  506.             Exclude(OldDesignerForm.ComponentState, csDesigning);
  507.        End;
  508.  
  509.      Dlg.Create(Screen.ActiveForm);
  510.      Dlg.Width:=200;
  511.      Dlg.Height:=200;
  512.      Dlg.Buttons:=Buttons;
  513.      Dlg.DlgType:=Typ;
  514.      Dlg.FMsg:=Msg;
  515.  
  516.      If OldDesignerForm <> Nil {Reset the designer flag}
  517.      Then Include(OldDesignerForm.ComponentState, csDesigning);
  518.  
  519.      Dlg.Execute;
  520.      Case Dlg.ModalResult Of
  521.        cmOk:     Result:=mrOk;
  522.        cmCancel: Result:=mrCancel;
  523.        cmYes:    Result:=mrYes;
  524.        cmNo:     Result:=mrNo;
  525.        cmIgnore: Result:=mrIgnore;
  526.        cmRetry:  Result:=mrRetry;
  527.        cmAbort:  Result:=mrAbort;
  528.        Else      Result:=mrCancel;
  529.      End;
  530.      Dlg.Destroy;
  531. End;
  532.  
  533.  
  534. Function ErrorBox(Const Msg:String):TMsgDlgReturn;
  535. Begin
  536.      Beep(1000,200);
  537.      Result:=MessageBox(Msg,mtError,[mbOk]);
  538. End;
  539.  
  540.  
  541. Procedure ShowMessage(Const Msg:String);
  542. Var  Dlg:TMessageBox;
  543.      OldDesignerForm:TForm;
  544. Begin
  545.      OldDesignerForm := Nil;
  546.      If Screen.ActiveForm <> Nil Then
  547.        If Screen.ActiveForm.Designed Then
  548.        Begin {Clear the designer flag To Assign the correct Font}
  549.             OldDesignerForm := Screen.ActiveForm;
  550.             Exclude(OldDesignerForm.ComponentState, csDesigning);
  551.        End;
  552.  
  553.      Dlg.Create(Screen.ActiveForm);
  554.      Dlg.Width:=200;
  555.      Dlg.Height:=200;
  556.      Dlg.FButtons:=[mbOk];
  557.      Dlg.fType:=mtInformation;
  558.      Dlg.FMsg:=Msg;
  559.      Dlg.Caption:=ParamStr(0);
  560.  
  561.      If OldDesignerForm <> Nil {Reset the designer flag}
  562.      Then Include(OldDesignerForm.ComponentState, csDesigning);
  563.  
  564.      Dlg.Execute;
  565.      Dlg.Destroy;
  566. End;
  567.  
  568. Procedure ShowMessagePos(Const Msg:String;X,Y:LongInt);
  569. Var  Dlg:TMessageBox;
  570.      OldDesignerForm:TForm;
  571. Begin
  572.      OldDesignerForm := Nil;
  573.      If Screen.ActiveForm <> Nil Then
  574.        If Screen.ActiveForm.Designed Then
  575.        Begin {Clear the designer flag To Assign the correct Font}
  576.             OldDesignerForm := Screen.ActiveForm;
  577.             Exclude(OldDesignerForm.ComponentState, csDesigning);
  578.        End;
  579.  
  580.      Dlg.Create(Screen.ActiveForm);
  581.      Dlg.Width:=200;
  582.      Dlg.Height:=200;
  583.      Dlg.Left:=X;
  584.      Dlg.Top:=Y;
  585.      Dlg.FButtons:=[mbOk];
  586.      Dlg.fType:=mtInformation;
  587.      Dlg.FMsg:=Msg;
  588.      Dlg.Caption:=ParamStr(0);
  589.  
  590.      If OldDesignerForm <> Nil {Reset the designer flag}
  591.      Then Include(OldDesignerForm.ComponentState, csDesigning);
  592.  
  593.      Dlg.Execute;
  594.      Dlg.Destroy;
  595. End;
  596.  
  597. Function CreateMessageDialog(Const Msg:String;DlgType:TMsgDlgType;DlgButtons:TMsgDlgButtons):TForm;
  598. Var Dlg:TMessageBox;
  599.     OldDesignerForm:TForm;
  600. Begin
  601.     OldDesignerForm := Nil;
  602.      If Screen.ActiveForm <> Nil Then
  603.        If Screen.ActiveForm.Designed Then
  604.        Begin {Clear the designer flag To Assign the correct Font}
  605.             OldDesignerForm := Screen.ActiveForm;
  606.             Exclude(OldDesignerForm.ComponentState, csDesigning);
  607.        End;
  608.  
  609.     Dlg.Create(Screen.ActiveForm);
  610.     Dlg.Width:=200;
  611.     Dlg.Height:=200;
  612.     Dlg.DlgType:=DlgType;
  613.     Dlg.Buttons:=DlgButtons;
  614.     Dlg.FMsg:=Msg;
  615.  
  616.     If OldDesignerForm <> Nil {Reset the designer flag}
  617.       Then Include(OldDesignerForm.ComponentState, csDesigning);
  618.  
  619.     Result:=Dlg;
  620. End;
  621.  
  622. Function MessageDlg(Const Msg:String;DlgType:TMsgDlgType;DlgButtons:TMsgDlgButtons;HelpCtx:THelpContext):TMsgDlgReturn;
  623. Var Dlg:TMessageBox;
  624. Begin
  625.      Dlg:=TMessageBox(CreateMessageDialog(Msg,DlgType,DlgButtons));
  626.      Dlg.HelpCtx:=HelpCtx;
  627.      Dlg.Execute;
  628.      Case Dlg.ModalResult Of
  629.        cmOk:     Result:=mrOk;
  630.        cmCancel: Result:=mrCancel;
  631.        cmYes:    Result:=mrYes;
  632.        cmNo:     Result:=mrNo;
  633.        cmIgnore: Result:=mrIgnore;
  634.        cmRetry:  Result:=mrRetry;
  635.        cmAbort:  Result:=mrAbort;
  636.        Else      Result:=mrCancel;
  637.      End;
  638.      Dlg.Destroy;
  639. End;
  640.  
  641. Function MessageDlgPos(Const Msg:String;DlgType: TMsgDlgType;DlgButtons:TMsgDlgButtons;HelpCtx:THelpContext;
  642.                        X,Y:LongInt):TMsgDlgReturn;
  643. Var Dlg:TMessageBox;
  644. Begin
  645.      Dlg:=TMessageBox(CreateMessageDialog(Msg,DlgType,DlgButtons));
  646.      Dlg.HelpCtx:=HelpCtx;
  647.      Dlg.Left:=X;
  648.      Dlg.Top:=Y;
  649.      Dlg.Execute;
  650.      Case Dlg.ModalResult Of
  651.        cmOk:     Result:=mrOk;
  652.        cmCancel: Result:=mrCancel;
  653.        cmYes:    Result:=mrYes;
  654.        cmNo:     Result:=mrNo;
  655.        cmIgnore: Result:=mrIgnore;
  656.        cmRetry:  Result:=mrRetry;
  657.        cmAbort:  Result:=mrAbort;
  658.        Else      Result:=mrCancel;
  659.      End;
  660.      Dlg.Destroy;
  661. End;
  662.  
  663. Function InputBox(Const ACaption,APrompt,ADefault:String):String;
  664. Begin
  665.      Result:=ADefault;
  666.      InputQuery(ACaption,APrompt,Result);
  667. End;
  668.  
  669. Function InputQuery(Const ACaption,APrompt:String;Var Value:String):Boolean;
  670. Var
  671.    Dlg:TDialog;
  672.    OldDesignerForm:TForm;
  673.    FEdit:TEdit;
  674. Begin
  675.      OldDesignerForm := Nil;
  676.      If Screen.ActiveForm <> Nil Then
  677.        If Screen.ActiveForm.Designed Then
  678.        Begin {Clear the designer flag To Assign the correct Font}
  679.             OldDesignerForm := Screen.ActiveForm;
  680.             Exclude(OldDesignerForm.ComponentState, csDesigning);
  681.        End;
  682.  
  683.      Dlg.Create(Screen.ActiveForm);
  684.      Dlg.Width:=355;
  685.      Dlg.Height:=150;
  686.      Dlg.Caption:=ACaption;
  687.  
  688.      InsertBitBtn(Dlg,20,10,90,30,bkOk,LoadNLSStr(SOkButton),'');
  689.      InsertBitBtn(Dlg,120,10,90,30,bkCancel,LoadNLSStr(SCancelButton),'');
  690.  
  691.      InsertLabel(Dlg,20,90,310,20,APrompt);
  692.  
  693.      FEdit.Create(Dlg);
  694.      FEdit.SetWindowPos(20,60,310,20);
  695.      FEdit.Text:=Value;
  696.      FEdit.parent:=Dlg;
  697.      FEdit.Focus;
  698.  
  699.      If OldDesignerForm <> Nil {Reset the designer flag}
  700.       Then Include(OldDesignerForm.ComponentState, csDesigning);
  701.  
  702.      Dlg.Execute;
  703.      Case Dlg.ModalResult Of
  704.         cmOk:
  705.         Begin
  706.              Value:=FEdit.Text;
  707.              Result:=True;
  708.         End;
  709.         Else Result:=False;
  710.      End; {Case}
  711.      Dlg.Destroy;
  712. End;
  713.  
  714. {
  715. ╔═══════════════════════════════════════════════════════════════════════════╗
  716. ║                                                                           ║
  717. ║ Speed-Pascal/2 Version 2.0                                                ║
  718. ║                                                                           ║
  719. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  720. ║                                                                           ║
  721. ║ This section: TDialog Class Implementation                                ║
  722. ║                                                                           ║
  723. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  724. ║                                                                           ║
  725. ╚═══════════════════════════════════════════════════════════════════════════╝
  726. }
  727.  
  728. Procedure TDialog.SetupComponent;
  729. Begin
  730.      Inherited SetupComponent;
  731.  
  732.      Name := 'Dialog';
  733.      XAlign := xaCenter;
  734.      YAlign := yaCenter;
  735.      PenColor := clStaticText;
  736.      Color := clDlgWindow;
  737.      ParentPenColor := False;
  738.      ParentColor := False;
  739.      BorderIcons := [biSystemMenu];
  740.      BorderStyle := bsDialog;
  741.      Visible := FALSE;
  742. End;
  743.  
  744.  
  745. Function TDialog.Execute:Boolean;
  746. Begin
  747.      ShowModal;
  748.      Result := ModalResult In [cmOk,cmYes];
  749.      DestroyHandle;
  750. End;
  751.  
  752.  
  753. {
  754. ╔═══════════════════════════════════════════════════════════════════════════╗
  755. ║                                                                           ║
  756. ║ Speed-Pascal/2 Version 2.0                                                ║
  757. ║                                                                           ║
  758. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  759. ║                                                                           ║
  760. ║ This section: TSystemOpenSaveDialog Class Implementation                  ║
  761. ║                                                                           ║
  762. ║ (C) 1995,98 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  763. ║                                                                           ║
  764. ╚═══════════════════════════════════════════════════════════════════════════╝
  765. }
  766.  
  767. Procedure TSystemOpenSaveDialog.SetupComponent;
  768. Begin
  769.      Inherited SetupComponent;
  770.  
  771.      Name := 'SystemOpenSaveDialog';
  772.      FFileName := '';
  773.      FDefaultExt := '';
  774.      FFilter := '';
  775.      FFilterIndex := 1;
  776.      FMaskList.Create;
  777. End;
  778.  
  779.  
  780. Destructor TSystemOpenSaveDialog.Destroy;
  781. Begin
  782.      Inherited Destroy;
  783.  
  784.      FMaskList.Destroy;
  785.      FMaskList := Nil;
  786. End;
  787.  
  788. {$IFDEF OS2}
  789. Procedure SetupFilters(hFCB:Longword;SOSD:TSystemOpenSaveDialog);
  790. Var  AMask,AFilter:String;
  791.      S:String;
  792.      cs:CString;
  793.      P:Integer;
  794. Begin
  795.      If hFCB = 0 Then exit;
  796.      If SOSD = Nil Then exit;
  797.  
  798.      WinSendMsg(hFCB,LM_DELETEALL,0,0);
  799.      WinSetWindowText(hFCB,'');
  800.  
  801.      SOSD.FMaskList.Clear;
  802.  
  803.      S := SOSD.FFilter;
  804.      P := Pos('|',S);
  805.      While P > 0 Do
  806.      Begin
  807.           AFilter := Copy(S,1,P-1);
  808.           Delete(S,1,P);
  809.           P := Pos('|',S);
  810.           If P > 0 Then
  811.           Begin
  812.                AMask := Copy(S,1,P-1);
  813.                Delete(S,1,P);
  814.           End
  815.           Else
  816.           Begin
  817.                AMask := S;
  818.                S := '';
  819.           End;
  820.           cs := AFilter;
  821.           WinSendMsg(hFCB,LM_INSERTITEM,LIT_END,LongWord(@cs));
  822.           SOSD.FMaskList.Add(AMask);
  823.           P := Pos('|',S);
  824.      End;
  825.      WinSendMsg(hFCB,LM_SELECTITEM,SOSD.FFilterIndex-1,1);
  826. End;
  827.  
  828.  
  829. Function GetMask(hFCB:Longword;SOSD:TSystemOpenSaveDialog):String;
  830. Var  itp:LONGINT;
  831. Begin
  832.      Result := '';
  833.      If hFCB = 0 Then exit;
  834.      If SOSD = Nil Then exit;
  835.  
  836.      itp := WinSendMsg(hFCB,LM_QUERYSELECTION,MPFROMSHORT(LIT_FIRST),0);
  837.  
  838.      If (itp >= 0) And (itp < SOSD.FMaskList.Count)
  839.      Then Result := SOSD.FMaskList[itp]
  840. End;
  841.  
  842. Function FileDlgWndProc(Win:HWindow;Msg:LONGWORD;Param1,Param2:LONGWORD):LONGWORD;CDECL;
  843. Var  hFCB,hFNEd:HWindow;
  844.      Ext:CString;
  845.      DlgAdr:^FileDlg;
  846.      SOSD:TSystemOpenSaveDialog;
  847. Begin
  848.      If (Msg = WM_INITDLG) Then
  849.      Begin
  850.           DlgAdr := Pointer(WinQueryWindowULong(Win,QWL_USER));
  851.           SOSD := TSystemOpenSaveDialog (DlgAdr^.ulUser);
  852.           hFCB := WinWindowFromId(Win,DID_FILTER_CB);
  853.           hFNEd := WinWindowFromId(Win,DID_FILENAME_ED);
  854.           // init the filter combobox
  855.           SetupFilters(hFCB, SOSD);
  856.           (*
  857.           If SOSD.FFileName = '' Then
  858.             If SOSD.FFilterIndex > 0 Then
  859.               If SOSD.FFilterIndex <= SOSD.FMaskList.Count Then
  860.               Begin
  861.                    Ext := SOSD.FMaskList[SOSD.FFilterIndex-1];
  862.                    WinSetWindowText(hFNEd,Ext);
  863.                    WinSetFocus(HWND_DESKTOP,hFNEd);
  864.                    WinPostMsg(hFNEd, WM_CHAR, MPFROM2SHORT(KC_VIRTUALKEY,0),MPFROM2SHORT(0,VK_ENTER));
  865.               End;
  866.           *)
  867.      End;
  868.  
  869.      If (Msg = WM_CONTROL) And
  870.         (Lo(param1) = DID_FILTER_CB) And (Hi(param1) = CBN_ENTER) Then
  871.      Begin
  872.           DlgAdr := Pointer(WinQueryWindowULong(Win,QWL_USER));
  873.           SOSD := TSystemOpenSaveDialog (DlgAdr^.ulUser);
  874.           hFCB := WinWindowFromId(Win,DID_FILTER_CB);
  875.           hFNEd := WinWindowFromId(Win,DID_FILENAME_ED);
  876.           // get selected extension
  877.           Ext := GetMask(hFCB, SOSD);
  878.           WinSetWindowText(hFNEd,Ext);
  879.           WinSetFocus(HWND_DESKTOP,hFNEd);
  880.           WinPostMsg(hFNEd, WM_CHAR, MPFROM2SHORT(KC_VIRTUALKEY,0),MPFROM2SHORT(0,VK_ENTER));
  881.           FileDlgWndProc := 0;
  882.           exit;
  883.      End;
  884.  
  885.      FileDlgWndProc := WinDefFileDlgProc(Win, Msg, Param1, Param2);
  886. End;
  887. {$ENDIF}
  888.  
  889. {
  890. ╔═══════════════════════════════════════════════════════════════════════════╗
  891. ║                                                                           ║
  892. ║ Speed-Pascal/2 Version 2.0                                                ║
  893. ║                                                                           ║
  894. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  895. ║                                                                           ║
  896. ║ This section: TSystemOpenDialog Class Implementation                      ║
  897. ║                                                                           ║
  898. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  899. ║                                                                           ║
  900. ╚═══════════════════════════════════════════════════════════════════════════╝
  901. }
  902.  
  903. Procedure TSystemOpenDialog.SetupComponent;
  904. Begin
  905.      Inherited SetupComponent;
  906.  
  907.      Name := 'SystemOpenDialog';
  908.      FTitle := LoadNLSStr(SOpenAFile);
  909.      FOkName := LoadNLSStr(SOpen);
  910. End;
  911.  
  912.  
  913. Function TSystemOpenDialog.Execute:Boolean;
  914. Var  cTitle,cOKName:cstring;
  915.      D,N,E:String;
  916.      {$IFDEF OS2}
  917.      Dlg:FileDlg;
  918.      {$ENDIF}
  919.      {$IFDEF Win95}
  920.      O:OPENFILENAME;
  921.      cDefExt:cstring;
  922.      cres:cstring;
  923.      {$ENDIF}
  924. Begin
  925.      cTitle:=FTitle;
  926.      cOKName:=FOkName;
  927.      {$IFDEF OS2}
  928.      FillChar(Dlg,SizeOf(FileDlg),0); {Clear Dialog structure}
  929.  
  930.      Dlg.cbSize:=SizeOf(FileDlg);
  931.      Dlg.fl:=FDS_OPEN_DIALOG | FDS_CENTER | FDS_ENABLEFILELB | FDS_FILTERUNION;
  932.      Dlg.pszTitle:=@cTitle;
  933.      Dlg.pszOkButton:=@cOKName;
  934.      Dlg.szFullFile:=FFileName;
  935.      Dlg.ulUser := Longword(Self);
  936.      Dlg.pfnDlgProc := @FileDlgWndProc;
  937.  
  938.      WinFileDlg(HWND_DESKTOP,HWND_DESKTOP,Dlg);
  939.      Result := Dlg.lReturn = 1; {DID_OK}
  940.      If Result Then FFileName := Dlg.szFullFile;
  941.      {$ENDIF}
  942.  
  943.      {$IFDEF Win95}
  944.      FillChar(O,SizeOf(OPENFILENAME),0); {Clear Dialog structure}
  945.  
  946.      O.lStructSize:=SizeOf(OPENFILENAME);
  947.      If Owner Is TControl Then O.hwndOwner:=TControl(Owner).Handle
  948.      Else O.hwndOwner:=0;
  949.      O.lpStrTitle:=@cTitle;
  950.      cDefExt:=FDefaultExt;
  951.      O.lpstrDefExt:=@cDefExt;
  952.      O.Flags:=OFN_PATHMUSTEXIST Or OFN_FILEMUSTEXIST;
  953.      cres:=FFileName;
  954.      O.lpStrFile:=@cres;
  955.      O.nMaxFile:=254;
  956.      O.hInstance:=AppHandle;
  957.      Result := GetOpenFileName(O);
  958.      If Result Then FFileName := O.lpStrFile^;
  959.      {$ENDIF}
  960.  
  961.      If Result Then
  962.      Begin
  963.           FSplit(FFileName,D,N,E);
  964.           If E = '' Then FFileName := FFileName + '.' + FDefaultExt;
  965.      End;
  966. End;
  967.  
  968. {
  969. ╔═══════════════════════════════════════════════════════════════════════════╗
  970. ║                                                                           ║
  971. ║ Speed-Pascal/2 Version 2.0                                                ║
  972. ║                                                                           ║
  973. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  974. ║                                                                           ║
  975. ║ This section: TSystemSaveDialog Class Implementation                      ║
  976. ║                                                                           ║
  977. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  978. ║                                                                           ║
  979. ╚═══════════════════════════════════════════════════════════════════════════╝
  980. }
  981.  
  982. Procedure TSystemSaveDialog.SetupComponent;
  983. Begin
  984.      Inherited SetupComponent;
  985.  
  986.      Name := 'SystemSaveDialog';
  987.      FTitle := LoadNLSStr(SSaveFileAs);
  988.      FOkName := LoadNLSStr(SSave);
  989. End;
  990.  
  991.  
  992. Function TSystemSaveDialog.Execute:Boolean;
  993. Var  cTitle,cOKName:cstring;
  994.      D,N,E:String;
  995.      {$IFDEF OS2}
  996.      Dlg:FileDlg;
  997.      {$ENDIF}
  998.      {$IFDEF Win95}
  999.      O:OPENFILENAME;
  1000.      cDefExt:cstring;
  1001.      cres:cstring;
  1002.      {$ENDIF}
  1003. Begin
  1004.      cTitle:=FTitle;
  1005.      cOKName:=FOkName;
  1006.      {$IFDEF OS2}
  1007.      FillChar(Dlg,SizeOf(FileDlg),0); {Clear Dialog structure}
  1008.  
  1009.      Dlg.cbSize:=SizeOf(FileDlg);
  1010.      Dlg.fl:=FDS_SAVEAS_DIALOG | FDS_CENTER | FDS_ENABLEFILELB;
  1011.      Dlg.pszTitle:=@cTitle;
  1012.      Dlg.pszOkButton:=@cOKName;
  1013.      Dlg.szFullFile:=FFileName;
  1014.      Dlg.ulUser := Longword(Self);
  1015.      Dlg.pfnDlgProc := @FileDlgWndProc;
  1016.  
  1017.      WinFileDlg(HWND_DESKTOP,HWND_DESKTOP,Dlg);
  1018.      Result := Dlg.lReturn = 1; {DID_OK}
  1019.      If Result Then FFileName := Dlg.szFullFile;
  1020.      {$ENDIF}
  1021.      {$IFDEF Win95}
  1022.      FillChar(O,SizeOf(OPENFILENAME),0); {Clear Dialog structure}
  1023.  
  1024.      O.lStructSize:=SizeOf(OPENFILENAME);
  1025.      If Owner Is TControl Then O.hwndOwner:=TControl(Owner).Handle
  1026.      Else O.hwndOwner:=0;
  1027.      O.lpStrTitle:=@cTitle;
  1028.      cDefExt:=FDefaultExt;
  1029.      O.lpstrDefExt:=@cDefExt;
  1030.      O.Flags:=0;
  1031.      cres:=FFileName;
  1032.      O.lpStrFile:=@cres;
  1033.      O.nMaxFile:=254;
  1034.      O.hInstance:=AppHandle;
  1035.      Result := GetOpenFileName(O);
  1036.      If Result Then FFileName := O.lpStrFile^;
  1037.      {$ENDIF}
  1038.  
  1039.      If Result Then
  1040.      Begin
  1041.           FSplit(FFileName,D,N,E);
  1042.           If E = '' Then FFileName := FFileName + '.' + FDefaultExt;
  1043.      End;
  1044. End;
  1045.  
  1046.  
  1047. {
  1048. ╔═══════════════════════════════════════════════════════════════════════════╗
  1049. ║                                                                           ║
  1050. ║ Speed-Pascal/2 Version 2.0                                                ║
  1051. ║                                                                           ║
  1052. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  1053. ║                                                                           ║
  1054. ║ This section: TOpenDialog Class Implementation                            ║
  1055. ║                                                                           ║
  1056. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  1057. ║                                                                           ║
  1058. ╚═══════════════════════════════════════════════════════════════════════════╝
  1059. }
  1060.  
  1061. Procedure TOpenDialog.SetupComponent;
  1062. Begin
  1063.      Inherited SetupComponent;
  1064.  
  1065.      ClientWidth := 470;
  1066.      ClientHeight := 370;
  1067.      Name := 'OpenDialog';
  1068.      FOkName := LoadNLSStr(SOpenButton);
  1069.      FTitle := LoadNLSStr(SOpenAFile);
  1070.      FFileName := '';
  1071.      FFilter := '';
  1072.      FFilterIndex := 1;
  1073.      FDefaultExt := '';
  1074.  
  1075.      InsertLabel(Self,20,340,390,20,LoadNLSStr(SFilename)+':');
  1076.      FFileNameEdit := InsertEdit(Self,20,314,430,26,'',''); {oder Combo}
  1077.  
  1078.      InsertLabel(Self,20,290,160,20,LoadNLSStr(SDrive)+':');
  1079.      FDriveCombo := InsertDriveComboBox(Self,20,264,170,26);
  1080.  
  1081.      InsertLabel(Self,200,290,250,20,LoadNLSStr(SFileType)+':');
  1082.      FFilterCombo := InsertFilterComboBox(Self,200,264,250,26);
  1083.  
  1084.      InsertLabel(Self,20,240,160,20,LoadNLSStr(SDirectories)+':');
  1085.      FDirectoryList := InsertDirectoryListBox(Self,20,90,170,148);
  1086.      FDirectoryList.HorzScroll := True;
  1087.      FDirectoryList.OnExit := EvKillFocus;
  1088.  
  1089.      InsertLabel(Self,200,240,250,20,LoadNLSStr(SFiles)+':');
  1090.      FFileList := InsertFileListBox(Self,200,90,250,148);
  1091.      FFileList.HorzScroll := True;
  1092.      FFileList.OnChange := FileChange;
  1093.      FFileList.OnItemSelect := FileSelect;
  1094.      FFileList.OnExit := EvKillFocus;
  1095.  
  1096.      FCurrentNamePanel := InsertPanel(Self,20,55,430,25,bvNone,bvLowered,1,'');
  1097.      FCurrentNamePanel.Alignment := taLeftJustify;
  1098.      FCurrentNamePanel.PenColor := clWindowText;
  1099.  
  1100.      FOkButton := InsertBitBtn(Self,20,15,100,30,bkOk,LoadNLSStr(SOpenButton),LoadNLSStr(SClickHereToAccept));
  1101.      FCancelButton := InsertBitBtn(Self,130,15,100,30,bkCancel,LoadNLSStr(SCancelButton),LoadNLSStr(SClickHereToCancel));
  1102.      FHelpButton := InsertBitBtn(Self,350,15,100,30,bkHelp,LoadNLSStr(SHelpButton),LoadNLSStr(SClickHereToGetHelp));
  1103.  
  1104.      {Connect}
  1105.      FDriveCombo.DirList := FDirectoryList;
  1106.      FFilterCombo.FileList := FFileList;
  1107.      FDirectoryList.FileList := FFileList;
  1108.      {FFileList.FileEdit := FFileNameEdit; See FileChange}
  1109.  
  1110.      SetCurDir(''); {Current dir}
  1111. End;
  1112.  
  1113.  
  1114. Procedure TOpenDialog.SetupShow;
  1115. Begin
  1116.      Inherited SetupShow;
  1117.  
  1118.      Caption := FTitle;
  1119.      FOkButton.Caption := FOkName;
  1120.  
  1121.      If FFilter <> '' Then FFilterCombo.Filter := FFilter;
  1122.      If FFilterIndex >= 1 Then FFilterCombo.ItemIndex := FFilterIndex - 1;
  1123.      SetFileName(FFileName);
  1124.      FileChange(Nil);
  1125.  
  1126.      {$IFDEF Win32}
  1127.      FFileList.SetWindowPos(200,90,250,148);
  1128.      {$ENDIF}
  1129.  
  1130.      FFileNameEdit.Focus;
  1131.      FOkButton.Default := True;
  1132. End;
  1133.  
  1134.  
  1135. Function ExpandPath(Path,CurDir:String):String;
  1136. Var  I,P:Byte;
  1137.      S:String;
  1138. Label L,l2;
  1139. Begin
  1140.      S := CurDir;
  1141.      If Length(S) = 3 Then
  1142.        If S[2] = ':' Then
  1143.          If S[3] In ['\','/'] Then Dec(S[0]);
  1144.  
  1145.      If (Pos('\',Path) = 1) Or (Pos('/',Path) = 1)
  1146.      Then Path := Copy(S,1,2) + Path;
  1147.  
  1148.      If (Length(Path) >= 2) And (Path[2] = ':') Then
  1149.      Begin
  1150.           S := Copy(Path,1,2);
  1151.           Delete(Path,1,2);
  1152.      End;
  1153.      If Not (Path[1] In ['\','/']) Then Path := '\'+ Path;
  1154.  
  1155.      Repeat
  1156.            If ((Pos('\..',Path) = 1) Or (Pos('/..',Path) = 1)) Then
  1157.            Begin
  1158.                 If (Length(Path) >= 4) And (Not (Path[4] In ['\','/'])) Then Goto l2;
  1159.                 Delete(Path,1,3);
  1160.                 For I := Length(S) DownTo 3 Do
  1161.                 Begin
  1162.                      If S[I] = ':' Then break;
  1163.                      Dec(S[0]);
  1164.                      If S[I] In ['\','/'] Then break;
  1165.                 End;
  1166.            End
  1167.            Else
  1168.            If ((Pos('\.',Path) = 1) Or (Pos('/.',Path) =1)) Then
  1169.            Begin
  1170.                 If (Length(Path) >= 3) And (Not (Path[3] In ['\','/'])) Then Goto l2;
  1171.                 Delete(Path,1,2);
  1172.            End
  1173.            Else
  1174.            If ((Pos('\',Path) = 1) Or (Pos('/',Path) = 1)) Then
  1175.            Begin
  1176. l2:
  1177.                 Delete(Path,1,1);
  1178.                 S := S + '\';
  1179.            End
  1180.            Else
  1181.            Begin
  1182. L:
  1183.                 P := Pos('\',Path);
  1184.                 If P = 0 Then P := Pos('/',Path);
  1185.                 If P > 0 Then
  1186.                 Begin
  1187.                      S := S + Copy(Path,1,P-1);
  1188.                      Delete(Path,1,P-1);
  1189.                 End
  1190.                 Else
  1191.                 Begin
  1192.                      S := S + Path;
  1193.                      Path := '';
  1194.                 End;
  1195.            End;
  1196.      Until Path = '';
  1197.      If Length(S) = 2 Then S := S +'\';
  1198.  
  1199.      Result := S;
  1200. End;
  1201.  
  1202.  
  1203. Procedure TOpenDialog.DismissDlg(Result:TCommand);
  1204. Var  S,D,N,E,lw,dn:String;
  1205.      dismiss:Boolean;
  1206.      Status:Integer;
  1207.      Search:TSearchRec;
  1208.      pn:Integer;
  1209. Begin
  1210.      If Result = cmOk Then
  1211.      Begin
  1212.           {check If we can dismiss}
  1213.           S := FFileNameEdit.Caption;
  1214.           While S[Length(S)] = #32 Do Dec(S[0]);
  1215.           If S = '' Then
  1216.           Begin
  1217.                ModalResult := cmNull; {Reset}
  1218.                Exit;
  1219.           End;
  1220.  
  1221.           dismiss := True;
  1222.           {check If we MUST Change dir}
  1223.           S := ExpandPath(S,FCurDir);
  1224.           FSplit(S,D,N,E);
  1225.           pn := Pos('*',N);
  1226.           If (E = '') Or (pn <> 0) Then
  1227.           Begin {Test If we MUST Change Directory}
  1228.                lw := D+N;
  1229.                Delete(lw,1,1); {Test 'x:\'; FindFirst can't detect it}
  1230.  
  1231.                dn := D + N;
  1232.                If dn[Length(dn)] In ['\','/'] Then SetLength(dn,Length(dn)-1);
  1233.  
  1234.                Status := FindFirst(dn,faDirectory,Search);
  1235.                If (Status = 0) Or (lw = ':\') Or (lw = ':/') Then
  1236.                Begin
  1237.                     If pn <> 0 Then SetCurDir(D)
  1238.                     Else SetCurDir(D+N);
  1239.  
  1240.                     If pn = 0 Then {no wildcards}
  1241.                     Begin
  1242.                          FFileList.Directory := FCurDir; {?}
  1243.                          If E = '' Then FFileNameEdit.Caption := FFileList.Mask
  1244.                          Else FFileNameEdit.Caption := E; {???}
  1245.                          FFileNameEdit.SelectAll;
  1246.                          dismiss := False;
  1247.                     End;
  1248.                End;
  1249.                FindClose(Search);
  1250.           End;
  1251.  
  1252.           If pn <> 0 Then
  1253.           Begin
  1254.                FFileList.Directory := FCurDir; {?}
  1255.                FFileList.Mask := N + E;
  1256.                FFileNameEdit.Caption := FFileList.Mask;
  1257.                FFileNameEdit.SelectAll;
  1258.                dismiss := False;
  1259.           End;
  1260.  
  1261.           If Not dismiss Then
  1262.           Begin
  1263.                ModalResult := cmNull; {Reset}
  1264.                Exit;
  1265.           End;
  1266.      End;
  1267.  
  1268.      FFileName := GetFileName;
  1269.      FFilterIndex := FFilterCombo.ItemIndex + 1;
  1270.  
  1271.      Inherited DismissDlg(Result);
  1272. End;
  1273.  
  1274.  
  1275. Procedure TOpenDialog.AddFilter(Name,Mask:String);
  1276. Begin
  1277.      If FFilter <> '' Then Name := '|' + Name;
  1278.      FFilter := FFilter + Name + '|' + Mask;
  1279. End;
  1280.  
  1281.  
  1282. {$HINTS OFF}
  1283. Procedure TOpenDialog.FileChange(Sender:TObject);
  1284. Var  S,D,N,E:String;
  1285. Begin
  1286.      {TFileListBox.Change}
  1287.      If ExtractFileName(FFileList.FileName) <> '' Then
  1288.      Begin
  1289.           FFileNameEdit.Caption := ExtractFileName(FFileList.FileName);
  1290.           FFileNameEdit.SelectAll;
  1291.      End; {Else the old FileName}
  1292.  
  1293.      FCurDir := FFileList.Directory;
  1294.      S := FCurDir + '\' + FFileNameEdit.Caption;
  1295.      If FDefaultExt <> '' Then
  1296.      Begin
  1297.           FSplit(S,D,N,E);
  1298.           If E = '' Then S := S + '.' + FDefaultExt;
  1299.      End;
  1300.      FCurrentNamePanel.Caption := S;
  1301. End;
  1302.  
  1303.  
  1304. Procedure TOpenDialog.FileSelect(Sender:TObject;Index:LongInt);
  1305. Begin
  1306.      FileChange(Sender);
  1307.      DismissDlg(cmOk);
  1308. End;
  1309. {$HINTS ON}
  1310.  
  1311.  
  1312. Procedure TOpenDialog.SetFileName(Value:String);
  1313. Var  D,N,E,actdir:String;
  1314. Begin
  1315.      FSplit(Value,D,N,E);
  1316.  
  1317.      {$I-}
  1318.      GetDir(0,actdir);
  1319.      If Length(D) > 3 Then Dec(D[0]);
  1320.      ChDir(D);
  1321.      If InOutRes = 0 Then
  1322.      Begin
  1323.           SetCurDir(D);
  1324.           FFileList.Directory := FCurDir; {?}
  1325.      End;
  1326.      ChDir(actdir);
  1327.      {$I+}
  1328.  
  1329.      If N + E <> '' Then FFileNameEdit.Caption := N + e
  1330.      Else FFileNameEdit.Caption := FFileList.Mask;
  1331. End;
  1332.  
  1333.  
  1334. Function TOpenDialog.GetFileName:String;
  1335. Var  D,N,E:String;
  1336. Begin
  1337.      Result := FFileNameEdit.Caption;
  1338.      If Pos('\',Result) = 0 Then Result := FCurDir + '\' + Result;
  1339.  
  1340.      FSplit(Result,D,N,E);
  1341.      If E = '' Then If N<>'' Then Result := D + N + '.' + FDefaultExt;
  1342. End;
  1343.  
  1344.  
  1345. Procedure TOpenDialog.SetCurDir(Value:String);
  1346. Begin
  1347.      If Value = '' Then
  1348.      Begin
  1349.           {$I-}
  1350.           GetDir(0,FCurDir);
  1351.           {$I+}
  1352.      End
  1353.      Else FCurDir := Value;
  1354.  
  1355.      If FCurDir[Length(FCurDir)] In ['\','/'] Then Dec(FCurDir[0]);
  1356.      FCurrentNamePanel.Caption := FCurDir + '\' + FFileNameEdit.Caption;
  1357. End;
  1358.  
  1359.  
  1360. {$HINTS OFF}
  1361. Procedure TOpenDialog.CMTextChanged(Var Msg:TMessage);
  1362. Begin
  1363.      FTitle := Caption;
  1364. End;
  1365.  
  1366.  
  1367. Procedure TOpenDialog.EvKillFocus(Sender:TObject);
  1368. Begin
  1369.      If Sender Is TListBox Then TListBox(Sender).ItemIndex := -1;
  1370. End;
  1371. {$HINTS ON}
  1372.  
  1373. {
  1374. ╔═══════════════════════════════════════════════════════════════════════════╗
  1375. ║                                                                           ║
  1376. ║ Speed-Pascal/2 Version 2.0                                                ║
  1377. ║                                                                           ║
  1378. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  1379. ║                                                                           ║
  1380. ║ This section: TSaveDialog Class Implementation                            ║
  1381. ║                                                                           ║
  1382. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  1383. ║                                                                           ║
  1384. ╚═══════════════════════════════════════════════════════════════════════════╝
  1385. }
  1386.  
  1387. Procedure TSaveDialog.SetupComponent;
  1388. Begin
  1389.      Inherited SetupComponent;
  1390.  
  1391.      Name := 'SaveDialog';
  1392.      FOkName := LoadNLSStr(SSaveButton);
  1393.      FTitle := LoadNLSStr(SSaveFileAs);
  1394.  
  1395.      FFileNameEdit.Width := FFileNameEdit.Width - 30;
  1396.  
  1397.      FCreateButton := InsertSpeedButton(Self,450-25,314,25,25,0,'',
  1398.                                         LoadNLSStr(SCreateDirectory));
  1399.      FCreateButton.Kind := bkOpen;
  1400.      FCreateButton.Caption := '';
  1401.      FCreateButton.OnClick := EvCreateDir;
  1402. End;
  1403.  
  1404. {$HINTS OFF}
  1405. Procedure TSaveDialog.EvCreateDir(Sender:TObject);
  1406. Var  CreateDirDlg:TCreateDirDialog;
  1407. Begin
  1408.      CreateDirDlg.Create(Self);
  1409.      CreateDirDlg.Directory := FDirectoryList.Directory;
  1410.      If CreateDirDlg.Execute Then
  1411.      Begin
  1412.           If CreateDirDlg.ChangeDir
  1413.           Then FDirectoryList.Directory := CreateDirDlg.Directory
  1414.           Else FDirectoryList.Directory := FDirectoryList.Directory; {rebuild List}
  1415.      End;
  1416.      CreateDirDlg.Destroy;
  1417. End;
  1418. {$HINTS ON}
  1419.  
  1420. {
  1421. ╔═══════════════════════════════════════════════════════════════════════════╗
  1422. ║                                                                           ║
  1423. ║ Speed-Pascal/2 Version 2.0                                                ║
  1424. ║                                                                           ║
  1425. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  1426. ║                                                                           ║
  1427. ║ This section: TCreateDirDialog Class Implementation                       ║
  1428. ║                                                                           ║
  1429. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  1430. ║                                                                           ║
  1431. ╚═══════════════════════════════════════════════════════════════════════════╝
  1432. }
  1433.  
  1434. Procedure TCreateDirDialog.SetupComponent;
  1435. Var  group:TGroupBox;
  1436. Begin
  1437.      Inherited SetupComponent;
  1438.  
  1439.      ClientWidth := 370;
  1440.      ClientHeight := 180;
  1441.  
  1442.      Name := 'CreateDirDialog';
  1443.      Caption := LoadNLSStr(SCreateDirectory);
  1444.      FOkName := LoadNLSStr(SCreateButton);
  1445.      FDirectory := '';
  1446.  
  1447.      group := InsertGroupBox(Self,20,60,330,100,LoadNLSStr(SEnterNewDirectory));
  1448.      FDirEdit := InsertEdit(group,15,45,300,26,'','');
  1449.      FChangeCheck := InsertCheckBox(group,15,15,300,20,LoadNLSStr(SChangeToTargetDir),'');
  1450.  
  1451.      FOkButton := InsertBitBtn(Self,20,15,100,30,bkOk,FOkName,LoadNLSStr(SClickHereToAccept));
  1452.      FCancelButton := InsertBitBtn(Self,130,15,100,30,bkCancel,LoadNLSStr(SCancelButton),LoadNLSStr(SClickHereToCancel));
  1453.      FHelpButton := InsertBitBtn(Self,240,15,100,30,bkHelp,LoadNLSStr(SHelpButton),LoadNLSStr(SClickHereToGetHelp));
  1454. End;
  1455.  
  1456.  
  1457. Procedure TCreateDirDialog.SetupShow;
  1458. Begin
  1459.      Inherited SetupShow;
  1460.  
  1461.      If FDirectory = '' Then
  1462.      Begin
  1463.           {$I-}
  1464.           GetDir(0,FDirectory);
  1465.           {$I+}
  1466.           If FDirectory[Length(FDirectory)] In ['\','/']
  1467.           Then Dec(FDirectory[0]);
  1468.      End;
  1469.  
  1470.      FDirEdit.Text := FDirectory;
  1471.      FDirEdit.Focus;
  1472.      FDirEdit.SelectAll;
  1473.      FChangeCheck.Checked := FChangeDir;
  1474.      FOkButton.Caption := FOkName;
  1475.      FOkButton.Default := True;
  1476. End;
  1477.  
  1478.  
  1479. Function CreateDir(Init,dir:String):Boolean;
  1480. {$IFDEF OS2}
  1481. Const
  1482.   NoError = NO_ERROR;
  1483.   PathNotFound = ERROR_PATH_NOT_FOUND;
  1484. {$ENDIF}
  1485. {$IFDEF WIN32}
  1486. Const
  1487.   NoError = 0;
  1488.   PathNotFound = 3;
  1489. {$ENDIF}
  1490.  
  1491.   Procedure NormalizeDir(Var S:String);
  1492.   Begin
  1493.        If Length(S) > 3 Then
  1494.          If S[Length(S)] = '\' Then SetLength(S,Length(S)-1);
  1495.   End;
  1496.  
  1497. Var
  1498.   Name,ext,makedir,dir1:String;
  1499.   rc,P:LongWord;
  1500. Label err;
  1501. Begin
  1502.      Result := True;
  1503.      If Init = '' Then
  1504.      Begin
  1505.           {$I-}
  1506.           GetDir(0,Init);
  1507.           {$I+}
  1508.      End;
  1509.      NormalizeDir(dir);
  1510.  
  1511.      If Pos('\',dir) = 1 Then dir := Copy(Init,1,2) + dir;
  1512.      If Pos(':',dir) = 0 Then dir := Init + '\' + dir;
  1513.      NormalizeDir(dir);
  1514.  
  1515.      makedir := '';
  1516.      rc := PathNotFound;
  1517.      While rc <> NoError Do
  1518.      Begin
  1519.           {$I-}
  1520.           MkDir(dir);
  1521.           {$I+}
  1522.           rc := IOResult;
  1523.           If rc = PathNotFound Then
  1524.           Begin
  1525.                FSplit(dir,dir1,Name,ext);
  1526.                dir := dir1;
  1527.                NormalizeDir(dir);
  1528.                If dir[Length(dir)] = ':' Then Goto err;
  1529.                makedir := Name + '\' + makedir;
  1530.           End
  1531.           Else If rc <> NoError Then Goto err;
  1532.      End;
  1533.  
  1534.      While makedir <> '' Do
  1535.      Begin
  1536.           P := Pos('\',makedir);
  1537.           dir := dir + '\' + Copy(makedir,1,P-1);
  1538.           Delete(makedir,1,P);
  1539.           {$I-}
  1540.           MkDir(dir);
  1541.           {$I+}
  1542.           rc := IOResult;
  1543.           If rc <> NoError Then Goto err;
  1544.      End;
  1545.      Exit;
  1546. err:
  1547.      ErrorBox(LoadNLSStr(SError)+' [' + tostr(rc) + '] : '+LoadNLSStr(SCannotCreateDir)+' !');
  1548.      Result := False;
  1549. End;
  1550.  
  1551.  
  1552. Procedure TCreateDirDialog.DismissDlg(Result:TCommand);
  1553. Var  FInitDir:String;
  1554. Begin
  1555.      If Result = cmOk Then
  1556.      Begin
  1557.           FInitDir := FDirectory;  {Initial Directory from App}
  1558.           FDirectory := ExpandPath(FDirEdit.Text,FInitDir);
  1559.           FChangeDir := FChangeCheck.Checked;
  1560.  
  1561.           If CreateDir(FInitDir,FDirectory) Then
  1562.           Begin
  1563.                If FChangeDir Then
  1564.                Begin
  1565.                     {$I-}
  1566.                     ChDir(FDirectory);
  1567.                     {$I+}
  1568.                End;
  1569.           End
  1570.           Else
  1571.           Begin
  1572.                ModalResult := cmNull; {Reset}
  1573.                FDirEdit.CaptureFocus;
  1574.                Exit;
  1575.           End;
  1576.      End;
  1577.  
  1578.      Inherited DismissDlg(Result);
  1579. End;
  1580.  
  1581.  
  1582. {
  1583. ╔═══════════════════════════════════════════════════════════════════════════╗
  1584. ║                                                                           ║
  1585. ║ Speed-Pascal/2 Version 2.0                                                ║
  1586. ║                                                                           ║
  1587. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  1588. ║                                                                           ║
  1589. ║ This section: TChangeDirDialog Class Implementation                       ║
  1590. ║                                                                           ║
  1591. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  1592. ║                                                                           ║
  1593. ╚═══════════════════════════════════════════════════════════════════════════╝
  1594. }
  1595.  
  1596. Procedure TChangeDirDialog.SetupComponent;
  1597. Begin
  1598.      Inherited SetupComponent;
  1599.  
  1600.      ClientWidth := 440;
  1601.      ClientHeight := 300;
  1602.  
  1603.      Name := 'ChangeDirDialog';
  1604.      Caption := LoadNLSStr(SChangeDirectory);
  1605.      FOkName := LoadNLSStr(SChangeButton);
  1606.      InsertLabel(Self,20,265,270,20,LoadNLSStr(SDirectoryName)+':');
  1607.      FFileNameEdit := InsertEdit(Self,20,240,270,26,'','');
  1608.  
  1609.      InsertLabel(Self,20,215,270,20,LoadNLSStr(SDrive)+':');
  1610.      FDriveCombo := InsertDriveComboBox(Self,20,185,270,26);
  1611.  
  1612.      InsertLabel(Self,20,160,270,20,LoadNLSStr(SDirectories)+':');
  1613.      {$IFDEF OS2}
  1614.      FDirectoryList := InsertDirectoryListBox(Self,20,20,270,140);
  1615.      {$ENDIF}
  1616.      {$IFDEF WIN32}
  1617.      FDirectoryList := InsertDirectoryListBox(Self,20,45{???},270,140);
  1618.      {$ENDIF}
  1619.      FDirectoryList.OnChange := DirectoryChange;
  1620.      FDriveCombo.DirList := FDirectoryList;
  1621.  
  1622.      FOkButton := InsertBitBtn(Self,315,240,105,30,bkOk,FOkName,LoadNLSStr(SClickHereToAccept));
  1623.      FOkButton.Margin := 10;
  1624.      FCancelButton := InsertBitBtn(Self,315,200,105,30,bkCancel,LoadNLSStr(SCancelButton),LoadNLSStr(SClickHereToCancel));
  1625.      FCancelButton.Margin := 10;
  1626.      FCreateButton := InsertBitBtn(Self,315,160,105,30,bkOpen,LoadNLSStr(SCreateButton),LoadNLSStr(SClickHereToCreateADir));
  1627.      FCreateButton.Margin := 10;
  1628.      FCreateButton.ModalResult := 0; {dont Close the Dialog}
  1629.      FCreateButton.OnClick := EvCreateDir;
  1630.      FHelpButton := InsertBitBtn(Self,315,120,105,30,bkHelp,LoadNLSStr(SHelpButton),LoadNLSStr(SClickHereToGetHelp));
  1631.      FHelpButton.Margin := 10;
  1632. End;
  1633.  
  1634.  
  1635. Procedure TChangeDirDialog.SetupShow;
  1636. Begin
  1637.      Inherited SetupShow;
  1638.  
  1639.      If FDirectory = '' Then
  1640.      Begin
  1641.           {$I-}
  1642.           GetDir(0,FDirectory);
  1643.           {$I+}
  1644.           If FDirectory[Length(FDirectory)] In ['\','/']
  1645.           Then Dec(FDirectory[0]);
  1646.      End;
  1647.      FDirectoryList.Directory := FDirectory;
  1648.  
  1649.      FFileNameEdit.Focus;
  1650.      FFileNameEdit.SelectAll;
  1651.      FOkButton.Caption := FOkName;
  1652.      FOkButton.Default := True;
  1653. End;
  1654.  
  1655.  
  1656. {$HINTS OFF}
  1657. Procedure TChangeDirDialog.DirectoryChange(Sender:TObject);
  1658. Begin
  1659.      FFileNameEdit.Caption := FDirectoryList.Directory;
  1660. End;
  1661. {$HINTS ON}
  1662.  
  1663.  
  1664. Function TChangeDirDialog.Execute:Boolean;
  1665. Begin
  1666.      Result := Inherited Execute;
  1667.      If Result Then
  1668.      Begin
  1669.           FDirectory := ExpandPath(FFileNameEdit.Caption, FDirectoryList.Directory);
  1670.  
  1671.           If Length(FDirectory) > 3 Then
  1672.             If FDirectory[Length(FDirectory)] = '\'
  1673.             Then SetLength(FDirectory,Length(FDirectory)-1);
  1674.           {$I-}
  1675.           ChDir(FDirectory);
  1676.           {$I+}
  1677.      End;
  1678. End;
  1679.  
  1680. {$HINTS OFF}
  1681. Procedure TChangeDirDialog.EvCreateDir(Sender:TObject);
  1682. Var  CreateDirDlg:TCreateDirDialog;
  1683. Begin
  1684.      CreateDirDlg.Create(Self);
  1685.      CreateDirDlg.Directory := FDirectoryList.Directory;
  1686.      If CreateDirDlg.Execute Then
  1687.      Begin
  1688.           If CreateDirDlg.ChangeDir
  1689.           Then FDirectoryList.Directory := CreateDirDlg.Directory
  1690.           Else FDirectoryList.Directory := FDirectoryList.Directory; {rebuild List}
  1691.      End;
  1692.      CreateDirDlg.Destroy;
  1693. End;
  1694. {$HINTS ON}
  1695.  
  1696. {
  1697. ╔═══════════════════════════════════════════════════════════════════════════╗
  1698. ║                                                                           ║
  1699. ║ Speed-Pascal/2 Version 2.0                                                ║
  1700. ║                                                                           ║
  1701. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  1702. ║                                                                           ║
  1703. ║ This section: TFindDialog Class Implementation                            ║
  1704. ║                                                                           ║
  1705. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  1706. ║                                                                           ║
  1707. ╚═══════════════════════════════════════════════════════════════════════════╝
  1708. }
  1709.  
  1710. Procedure TFindDialog.SetupComponent;
  1711. Begin
  1712.      Inherited SetupComponent;
  1713.  
  1714.      Name := 'FindDialog';
  1715.      Caption := LoadNLSStr(SFindText);
  1716.      ClientWidth := 430;
  1717.      ClientHeight := 310;
  1718.  
  1719.      Lab_Find := InsertLabel(Self,20,270,70,20,LoadNLSStr(SFind)+':');
  1720.      CoB_Find := InsertComboBox(Self,110,270,300,20,csDropDown);
  1721.  
  1722.      Grp_Options := InsertGroupBox(Self,20,170,180,75,LoadNLSStr(SOptions));
  1723.      ChB_CaseSense := InsertCheckBox(Grp_Options,15,30,160,20,LoadNLSStr(SCaseSensitive),'');
  1724.      ChB_WordsOnly := InsertCheckBox(Grp_Options,15,10,160,20,LoadNLSStr(SWordsOnly),'');
  1725.  
  1726.      Grp_Scope := InsertGroupBox(Self,230,170,180,75,LoadNLSStr(SScope));
  1727.      RaB_Global := InsertRadioButton(Grp_Scope,15,30,160,20,LoadNLSStr(SGlobal),'');
  1728.      RaB_Selection := InsertRadioButton(Grp_Scope,15,10,160,20,LoadNLSStr(SSelectedText),'');
  1729.  
  1730.      Grp_Origin := InsertGroupBox(Self,20,70,180,75,LoadNLSStr(SOrigin));
  1731.      RaB_EntireScope := InsertRadioButton(Grp_Origin,15,30,160,20,LoadNLSStr(SEntireScope),'');
  1732.      RaB_Cursor := InsertRadioButton(Grp_Origin,15,10,160,20,LoadNLSStr(SFromCursor),'');
  1733.  
  1734.      Grp_Direction := InsertGroupBox(Self,230,70,180,75,LoadNLSStr(SDirection));
  1735.      RaB_Forward := InsertRadioButton(Grp_Direction,15,30,160,20,LoadNLSStr(SForwardButton),'');
  1736.      RaB_Backward := InsertRadioButton(Grp_Direction,15,10,160,20,LoadNLSStr(SBackwardButton),'');
  1737.  
  1738.      BiB_Find := InsertBitBtn(Self,20,20,90,30,bkOk,LoadNLSStr(SFindButton),LoadNLSStr(SClickHereToAccept));
  1739.      BiB_Cancel := InsertBitBtn(Self,130,20,100,30,bkCancel,LoadNLSStr(SCancelButton),LoadNLSStr(SClickHereToCancel));
  1740.      BiB_Help := InsertBitBtn(Self,320,20,90,30,bkHelp,LoadNLSStr(SHelpButton),LoadNLSStr(SClickHereToGetHelp));
  1741. End;
  1742.  
  1743.  
  1744. Procedure TFindDialog.SetupShow;
  1745. Begin
  1746.      Inherited SetupShow;
  1747.  
  1748.      CoB_Find.Focus;
  1749.      BiB_Find.Default := True;
  1750. End;
  1751.  
  1752.  
  1753. Function TFindDialog.GetFindOptions:TFindOptions;
  1754. Begin
  1755.      Result := [];
  1756.      If ChB_CaseSense.Checked Then Result := Result + [foCaseSensitive];
  1757.      If ChB_WordsOnly.Checked Then Result := Result + [foWordsOnly];
  1758. End;
  1759.  
  1760. Procedure TFindDialog.SetFindOptions(Value:TFindOptions);
  1761. Begin
  1762.      ChB_CaseSense.Checked := Value * [foCaseSensitive] <> [];
  1763.      ChB_WordsOnly.Checked := Value * [foWordsOnly] <> [];
  1764. End;
  1765.  
  1766. Function TFindDialog.GetFindOrigin:TFindOrigin;
  1767. Begin
  1768.      If RaB_EntireScope.Checked Then Result := foEntireScope
  1769.      Else Result := foCursor;
  1770. End;
  1771.  
  1772. Procedure TFindDialog.SetFindOrigin(Value:TFindOrigin);
  1773. Begin
  1774.      RaB_EntireScope.Checked := Value = foEntireScope;
  1775.      RaB_Cursor.Checked := Value = foCursor;
  1776. End;
  1777.  
  1778. Function TFindDialog.GetFindScope:TFindScope;
  1779. Begin
  1780.      If RaB_Global.Checked Then Result := fsGlobal
  1781.      Else Result := fsSelection;
  1782. End;
  1783.  
  1784. Procedure TFindDialog.SetFindScope(Value:TFindScope);
  1785. Begin
  1786.      RaB_Global.Checked := Value = fsGlobal;
  1787.      RaB_Selection.Checked := Value = fsSelection;
  1788. End;
  1789.  
  1790. Function TFindDialog.GetFindDirection:TFindDirection;
  1791. Begin
  1792.      If RaB_Forward.Checked Then Result := fdForward
  1793.      Else Result := fdBackward;
  1794. End;
  1795.  
  1796. Procedure TFindDialog.SetFindDirection(Value:TFindDirection);
  1797. Begin
  1798.      RaB_Forward.Checked := Value = fdForward;
  1799.      RaB_Backward.Checked := Value = fdBackward;
  1800. End;
  1801.  
  1802. Function TFindDialog.GetFindText:String;
  1803. Begin
  1804.      Result := CoB_Find.Caption;
  1805. End;
  1806.  
  1807. Procedure TFindDialog.SetFindText(Const Value:String);
  1808. Begin
  1809.      CoB_Find.Caption := Value;
  1810. End;
  1811.  
  1812. Procedure TFindDialog.SetFindTextExtend(Const Value:String);
  1813. Begin
  1814.      CoB_Find.TextExtension := Value;
  1815.      FFindTextExt := Value;
  1816. End;
  1817.  
  1818. Procedure TFindDialog.SetFindHistory(Const Strings:TStringList);
  1819. Begin
  1820.      CoB_Find.Items := Strings;
  1821. End;
  1822.  
  1823.  
  1824. {
  1825. ╔═══════════════════════════════════════════════════════════════════════════╗
  1826. ║                                                                           ║
  1827. ║ Speed-Pascal/2 Version 2.0                                                ║
  1828. ║                                                                           ║
  1829. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  1830. ║                                                                           ║
  1831. ║ This section: TReplaceDialog Class Implementation                         ║
  1832. ║                                                                           ║
  1833. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  1834. ║                                                                           ║
  1835. ╚═══════════════════════════════════════════════════════════════════════════╝
  1836. }
  1837.  
  1838. Procedure TReplaceDialog.SetupComponent;
  1839. Var  BiB_All:TBitBtn;
  1840. Begin
  1841.      Inherited SetupComponent;
  1842.  
  1843.      Name := 'ReplaceDialog';
  1844.      Caption := LoadNLSStr(SReplaceText);
  1845.      ClientWidth := 430;
  1846.      ClientHeight := 350;
  1847.  
  1848.      Lab_Find.Bottom := 310;
  1849.      CoB_Find.Bottom := 310;
  1850.      InsertLabel(Self,20,270,70,20,LoadNLSStr(SReplace)+':');
  1851.      CoB_Replace := InsertComboBox(Self,110,270,300,20,csDropDown);
  1852.      CoB_Replace.TabOrder := CoB_Find.TabOrder +1;
  1853.  
  1854.      Grp_Options.SetWindowPos(20,150,180,95);
  1855.      ChB_CaseSense.Bottom := 50;
  1856.      ChB_WordsOnly.Bottom := 30;
  1857.      ChB_Confirm := InsertCheckBox(Grp_Options,15,10,160,20,LoadNLSStr(SConfirmButton),'');
  1858.      ChB_Confirm.TabOrder := ChB_WordsOnly.TabOrder +1;
  1859.  
  1860.      BiB_Find.Width := 110;
  1861.      BiB_Find.Caption := LoadNLSStr(SReplaceButton);
  1862.      BiB_All := InsertBitBtn(Self,140,20,75,30,bkAll,LoadNLSStr(SAllButton),'');
  1863.      BiB_All.TabOrder := BiB_Find.TabOrder +1;
  1864.      BiB_Cancel.SetWindowPos(225,20,95,30);
  1865.      BiB_Help.SetWindowPos(330,20,80,30);
  1866. End;
  1867.  
  1868. Function TReplaceDialog.GetConfirm:Boolean;
  1869. Begin
  1870.      Result := ChB_Confirm.Checked;
  1871. End;
  1872.  
  1873. Procedure TReplaceDialog.SetConfirm(Value:Boolean);
  1874. Begin
  1875.      ChB_Confirm.Checked := Value;
  1876. End;
  1877.  
  1878. Function TReplaceDialog.GetReplaceText:String;
  1879. Begin
  1880.      Result := CoB_Replace.Caption;
  1881. End;
  1882.  
  1883. Procedure TReplaceDialog.SetReplaceText(Const Value:String);
  1884. Begin
  1885.      CoB_Replace.Caption := Value;
  1886. End;
  1887.  
  1888. Procedure TReplaceDialog.SetReplaceHistory(Const Strings:TStringList);
  1889. Begin
  1890.      CoB_Replace.Items := Strings;
  1891. End;
  1892.  
  1893.  
  1894. {
  1895. ╔═══════════════════════════════════════════════════════════════════════════╗
  1896. ║                                                                           ║
  1897. ║ Speed-Pascal/2 Version 2.0                                                ║
  1898. ║                                                                           ║
  1899. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  1900. ║                                                                           ║
  1901. ║ This section: TColorDialog Class Implementation                           ║
  1902. ║                                                                           ║
  1903. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  1904. ║                                                                           ║
  1905. ╚═══════════════════════════════════════════════════════════════════════════╝
  1906. }
  1907.  
  1908. Procedure TColorDialog.SetupComponent;
  1909. Var  T:LongInt;
  1910.      Btn:TBitBtn;
  1911. Begin
  1912.      Inherited SetupComponent;
  1913.  
  1914.      ClientWidth:=420;
  1915.      ClientHeight:=200;
  1916.      Name:='ColorDialog';
  1917.      Caption:=LoadNLSStr(SSelectAColor);
  1918.  
  1919.      FRedScroll:=InsertScrollBar(Self,20,20,16,160,sbVertical);
  1920.      FRedScroll.color:=clRed;
  1921.      FRedScroll.SetScrollRange(0,255,1);
  1922.      FRedScroll.LargeChange:=8;
  1923.      FGreenScroll:=InsertScrollBar(Self,50,20,16,160,sbVertical);
  1924.      FGreenScroll.color:=clLime;
  1925.      FGreenScroll.SetScrollRange(0,255,1);
  1926.      FGreenScroll.LargeChange:=8;
  1927.      FBlueScroll:=InsertScrollBar(Self,80,20,16,160,sbVertical);
  1928.      FBlueScroll.color:=clBlue;
  1929.      FBlueScroll.SetScrollRange(0,255,1);
  1930.      FBlueScroll.LargeChange:=8;
  1931.  
  1932.      FDefaultCombo:=InsertComboBox(Self,120,160,150,20,csDropDownList);
  1933.      FDefaultCombo.Text:=LoadNLSStr(SDefaultColors);
  1934.      FDefaultCombo.sorted:=True;
  1935.      FDefaultCombo.DropDownCount := 7;
  1936.      FDefaultCombo.OnItemSelect:=EvSelectComboItem;
  1937.      For T:=1 To MaxDefaultColors
  1938.         Do FDefaultCombo.Items.Add(DefaultColors[T].Name);
  1939.      For T:=1 To MaxSystemColors
  1940.         Do FDefaultCombo.Items.Add(SystemColors[T].Name);
  1941.  
  1942.      FColorArea.Create(Self);
  1943.      FColorArea.SetWindowPos(120,20,150,120);
  1944.      FColorArea.BorderStyle:=bsSingle;
  1945.      FColorArea.BevelInner:=bvNone;
  1946.      FColorArea.BevelOuter:=bvNone;
  1947.      InsertControl(FColorArea);
  1948.      SetSelColor(FSelColor);
  1949.  
  1950.      FOkBtn := InsertBitBtn(Self,300,145,100,35,bkOk,LoadNLSStr(SSelectButton),LoadNLSStr(SClickHereToAccept));
  1951.      FOkBtn.Margin := 10;
  1952.      Btn := InsertBitBtn(Self,300,105,100,35,bkCancel,LoadNLSStr(SCancelButton),LoadNLSStr(SClickHereToCancel));
  1953.      Btn.Margin := 10;
  1954.      Btn := InsertBitBtn(Self,300,65,100,35,bkHelp,LoadNLSStr(SHelpButton),LoadNLSStr(SClickHereToGetHelp));
  1955.      Btn.Margin := 10;
  1956. End;
  1957.  
  1958.  
  1959. Procedure TColorDialog.SetupShow;
  1960. Begin
  1961.      Inherited SetupShow;
  1962.  
  1963.      FColorArea.Canvas.Brush.Mode := bmTransparent;
  1964.  
  1965.      FDefaultCombo.Focus;
  1966.      FOkBtn.Default := True;
  1967. End;
  1968.  
  1969.  
  1970. Procedure TColorDialog.SetSelColor(Value:TColor);
  1971. Begin
  1972.      FSelColor := SysColorToRGB(Value);
  1973.      FColorArea.color := FSelColor;
  1974.      FRedScroll.Position := TRGB(FSelColor).Red;
  1975.      FGreenScroll.Position := TRGB(FSelColor).Green;
  1976.      FBlueScroll.Position := TRGB(FSelColor).Blue;
  1977.      UpdateColorArea;
  1978. End;
  1979.  
  1980. {$HINTS OFF}
  1981. Procedure TColorDialog.Scroll(ScrollBar:TScrollBar;ScrollCode:TScrollCode;Var ScrollPos:LongInt);
  1982. Begin
  1983.      TRGB(FSelColor).Fill:=0;
  1984.      If ScrollBar=FRedScroll Then TRGB(FSelColor).Red:=ScrollPos
  1985.      Else If ScrollBar=FGreenScroll Then TRGB(FSelColor).Green:=ScrollPos
  1986.      Else If ScrollBar=FBlueScroll Then TRGB(FSelColor).Blue:=ScrollPos;
  1987.  
  1988.      FDefaultCombo.Text := LoadNLSStr(SDefaultColors);
  1989.      UpdateColorArea;
  1990. End;
  1991.  
  1992.  
  1993. Procedure TColorDialog.EvSelectComboItem(Sender:TObject;Index:LongInt);
  1994. Var S:String;
  1995.     Col:TColor;
  1996.     T:LongInt;
  1997. Label found;
  1998. Begin
  1999.      S:=FDefaultCombo.Caption;
  2000.  
  2001.      For T:=1 To MaxDefaultColors Do
  2002.      Begin
  2003.           If DefaultColors[T].Name=S Then
  2004.           Begin
  2005.                FSelColor:=DefaultColors[T].Value;
  2006.                Goto found;
  2007.           End;
  2008.      End;
  2009.  
  2010.      For T:=1 To MaxSystemColors Do
  2011.      Begin
  2012.           If SystemColors[T].Name=S Then
  2013.           Begin
  2014.                FSelColor:=SystemColors[T].Value;
  2015.                break;
  2016.           End;
  2017.      End;
  2018. found:
  2019.  
  2020.      Col:=SysColorToRGB(FSelColor);
  2021.      FRedScroll.Position:=TRGB(Col).Red;
  2022.      FGreenScroll.Position:=TRGB(Col).Green;
  2023.      FBlueScroll.Position:=TRGB(Col).Blue;
  2024.  
  2025.      UpdateColorArea;
  2026. End;
  2027. {$HINTS ON}
  2028.  
  2029.  
  2030. Procedure TColorDialog.UpdateColorArea;
  2031. Var  Col:TColor;
  2032. Begin
  2033.      Col:=SysColorToRGB(FSelColor);
  2034.      FColorArea.PenColor := OppositeRGB(Col);
  2035.      FColorArea.color := Col;
  2036.      FColorArea.Caption := 'RGB('+tostr(TRGB(Col).Red)+','
  2037.                                  +tostr(TRGB(Col).Green)+','
  2038.                                  +tostr(TRGB(Col).Blue)+')';
  2039. End;
  2040.  
  2041. {
  2042. ╔═══════════════════════════════════════════════════════════════════════════╗
  2043. ║                                                                           ║
  2044. ║ Speed-Pascal/2 Version 2.0                                                ║
  2045. ║                                                                           ║
  2046. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  2047. ║                                                                           ║
  2048. ║ This section: TFontDialog Class Implementation                            ║
  2049. ║                                                                           ║
  2050. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  2051. ║                                                                           ║
  2052. ╚═══════════════════════════════════════════════════════════════════════════╝
  2053. }
  2054.  
  2055. Procedure TFontDialog.SetupComponent;
  2056. Var  T:LongInt;
  2057.      aFont:TFont;
  2058.      group:TGroupBox;
  2059. Begin
  2060.      Inherited SetupComponent;
  2061.  
  2062.      Name:='FontDialog';
  2063.      Caption:=LoadNLSStr(SSelectAFont);
  2064.      Width:=400;
  2065.      Height:=330;
  2066.      color:=clLtGray;
  2067.  
  2068.      group:=InsertGroupBox(Self,5,5,280,Height-40,'');
  2069.      group.ZOrder:=zoBottom;
  2070.  
  2071.      InsertLabel(Self,12,270,80,20,LoadNLSStr(SName)+':');
  2072.      FNameCombo:=InsertComboBox(Self,12,250-100,200,120,csDropDownList);
  2073.      FNameCombo.sorted := True;
  2074.      FNameCombo.Duplicates:=False;
  2075.      FNameCombo.OnItemSelect:=EvComboSelect;
  2076.  
  2077.      InsertLabel(Self,218,270,50,20,LoadNLSStr(SSize)+':');
  2078.      FSizeCombo:=InsertComboBox(Self,218,250-100,60,120,csDropDown);
  2079.      FSizeCombo.OnItemSelect:=EvComboSizeSelect;
  2080.      FSizeCombo.Duplicates:=False;
  2081.  
  2082.      group:=InsertGroupBox(Self,12,150,110,90,LoadNLSStr(SStyle));
  2083.      group.ZOrder:=zoTop;
  2084.      FItalicCheck:=InsertCheckBox(Self,20,200,95,20,LoadNLSStr(SItalic),'');
  2085.      FItalicCheck.OnClick:=StyleChanged;
  2086.      FBoldCheck:=InsertCheckBox(Self,20,180,95,20,LoadNLSStr(SBold),'');
  2087.      FBoldCheck.OnClick:=StyleChanged;
  2088.  
  2089.      group:=InsertGroupBox(Self,127,150,150,90,LoadNLSStr(SEmphasis));
  2090.      group.ZOrder:=zoTop;
  2091.      FOutlineCheck:=InsertCheckBox(Self,135,200,135,20,LoadNLSStr(SOutline),'');
  2092.      FOutlineCheck.OnClick:=StyleChanged;
  2093.      FStrikeOutCheck:=InsertCheckBox(Self,135,180,135,20,LoadNLSStr(SStrikeout),'');
  2094.      FStrikeOutCheck.OnClick:=StyleChanged;
  2095.      FUnderscoreCheck:=InsertCheckBox(Self,135,160,135,20,LoadNLSStr(SUnderscore),'');
  2096.      FUnderscoreCheck.OnClick:=StyleChanged;
  2097.  
  2098.      FExampleText:=InsertButton(Self,10,20,270,120,LoadNLSStr(SExampleText),'');
  2099.      FExampleText.OnClick:=StyleChanged;
  2100.  
  2101.      For T:=0 To Screen.FontCount-1 Do
  2102.      Begin
  2103.           aFont:=Screen.Fonts[T];
  2104.           FNameCombo.Items.Add(aFont.FaceName);
  2105.      End;
  2106.      FNameCombo.Items.Add('System Default Font');
  2107.  
  2108.      FOkBtn := InsertBitBtn(Self,290,240,90,30,bkOk,LoadNLSStr(SOkButton),LoadNLSStr(SClickHereToAccept));
  2109.      InsertBitBtn(Self,290,200,90,30,bkCancel,LoadNLSStr(SCancelButton),LoadNLSStr(SClickHereToCancel));
  2110.      InsertBitBtn(Self,290,160,90,30,bkHelp,LoadNLSStr(SHelpButton),LoadNLSStr(SClickHereToGetHelp));
  2111.  
  2112.      SetFontName('');  {Init}
  2113. End;
  2114.  
  2115.  
  2116. Procedure TFontDialog.SetupShow;
  2117. Begin
  2118.      SetTheFont;
  2119.  
  2120.      Inherited SetupShow;
  2121.  
  2122.      FNameCombo.Focus;
  2123.      FOkBtn.Default := True;
  2124. End;
  2125.  
  2126. Function ModifyFontName(FontName:String;Const Attrs:TFontAttributes):String;
  2127. Begin
  2128.      Result:=FontName;
  2129.      UpcaseStr(FontName);
  2130.      If Attrs*[faItalic]<>[] Then If Pos(' ITALIC',FontName)=0 Then Result:=Result+'.Italic';
  2131.      If Attrs*[faBold]<>[] Then If Pos(' BOLD',FontName)=0 Then Result:=Result+'.Bold';
  2132.      If Attrs*[faOutline]<>[] Then Result:=Result+'.Outline';
  2133.      If Attrs*[faStrikeOut]<>[] Then Result:=Result+'.Strikeout';
  2134.      If Attrs*[faUnderScore]<>[] Then Result:=Result+'.Underscore';
  2135. End;
  2136.  
  2137. Function TFontDialog.GetAttributes:TFontAttributes;
  2138. Var S:String;
  2139. Begin
  2140.      Result:=[];
  2141.  
  2142.      S:=FNameCombo.Caption;
  2143.      UpcaseStr(S);
  2144.      If FItalicCheck.Checked Then
  2145.        If Pos(' ITALIC',S)=0 Then Result:=Result+[faItalic];
  2146.      If FBoldCheck.Checked Then
  2147.        If Pos(' BOLD',S)=0 Then Result:=Result+[faBold];
  2148.      If FOutlineCheck.Checked Then Result:=Result+[faOutline];
  2149.      If FStrikeOutCheck.Checked Then Result:=Result+[faStrikeOut];
  2150.      If FUnderscoreCheck.Checked Then Result:=Result+[faUnderScore];
  2151. End;
  2152.  
  2153. Procedure TFontDialog.SetAttributes(NewValue:TFontAttributes);
  2154. Var S:String;
  2155. Begin
  2156.      S:=FNameCombo.Caption;
  2157.      S:=ModifyFontName(S,NewValue);
  2158.      If PointSize<>0 Then FontName:=tostr(PointSize)+'.'+s
  2159.      Else FontName:=S;
  2160. End;
  2161.  
  2162. Function TFontDialog.GetFaceName:String;
  2163. Begin
  2164.      Result:=FNameCombo.Caption;
  2165.      Result:=ModifyFontName(Result,Attributes);
  2166. End;
  2167.  
  2168. Procedure TFontDialog.SetFaceName(Value:String);
  2169. Var S:String;
  2170. Begin
  2171.      S:=Value;
  2172.      UpcaseStr(S);
  2173.      FBoldCheck.Checked:=FBoldCheck.Checked Or(Pos(' BOLD',S)<>0);
  2174.      FItalicCheck.Checked:=FItalicCheck.Checked Or(Pos(' ITALIC',S)<>0);
  2175.      Value:=ModifyFontName(Value,Attributes);
  2176.      If PointSize<>0 Then FontName:=tostr(PointSize)+'.'+Value
  2177.      Else FontName:=Value;
  2178. End;
  2179.  
  2180.  
  2181. Function TFontDialog.GetPointSize:LongInt;
  2182. Var S:String;
  2183.     C:Integer;
  2184. Begin
  2185.      If FNameCombo.Caption='System Default Font' Then Result:=Screen.DefaultFont.PointSize
  2186.      Else
  2187.      Begin
  2188.          S:=FSizeCombo.Caption;
  2189.          Val(S,Result,C);
  2190.          If C<>0 Then Result:=0;
  2191.      End;
  2192. End;
  2193.  
  2194.  
  2195. Procedure TFontDialog.SetPointSize(Value:LongInt);
  2196. Begin
  2197.      If Value=0 Then Value:=8;
  2198.      FontName:=tostr(Value)+'.'+FaceName;
  2199. End;
  2200.  
  2201.  
  2202. Function TFontDialog.GetEditFont:TFont;
  2203. Begin
  2204.      Result:=Screen.GetFontFromPointSize(FaceName,PointSize);
  2205. End;
  2206.  
  2207. Procedure TFontDialog.SetEditFont(NewFont:TFont);
  2208. Var S:String;
  2209.     Attrs:TFontAttributes;
  2210. Begin
  2211.      If NewFont=Nil Then NewFont:=Screen.DefaultFont;
  2212.  
  2213.      If NewFont.IsDefault Then
  2214.      Begin
  2215.           S:=tostr(Screen.DefaultFont.PointSize)+'.'+'System Default Font';;
  2216.           FBoldCheck.Checked:=False;
  2217.           FItalicCheck.Checked:=False;
  2218.           FontName:=S;
  2219.      End
  2220.      Else
  2221.      Begin
  2222.           S:=NewFont.FaceName;
  2223.           UpcaseStr(S);
  2224.           Attrs:=NewFont.Attributes;
  2225.           FBoldCheck.Checked:=(Pos(' BOLD',S)<>0)Or(Attrs*[faBold]<>[]);
  2226.           FItalicCheck.Checked:=(Pos(' ITALIC',S)<>0)Or(Attrs*[faItalic]<>[]);
  2227.           S:=NewFont.FaceName;
  2228.           S:=ModifyFontName(S,NewFont.Attributes);
  2229.           If NewFont.PointSize<>0 Then FontName:=tostr(NewFont.PointSize)+'.'+s
  2230.           Else FontName:=S;
  2231.      End;
  2232. End;
  2233.  
  2234. {$HINTS OFF}
  2235. Procedure TFontDialog.StyleChanged(Sender:TObject);
  2236. Begin
  2237.      If Handle<>0 Then SetTheFont;
  2238. End;
  2239. {$HINTS ON}
  2240.  
  2241. Function TFontDialog.GetFontName:String;
  2242. Begin
  2243.      Result := tostr(PointSize) + '.' + FaceName;
  2244. End;
  2245.  
  2246.  
  2247. Procedure TFontDialog.SetFontName(Value:String);
  2248. Var  S,s1:String;
  2249.      DefPointSize,T:LongInt;
  2250.      B:Byte;
  2251.      C:Integer;
  2252.      Attrs:TFontAttributes;
  2253. Label L;
  2254. Begin
  2255.      If Value = '' Then Value := '8.Helv';
  2256.      B := Pos('.',Value);
  2257.      If B <> 0 Then
  2258.      Begin
  2259.           S := Copy(Value,1,B-1);
  2260.           Delete(Value,1,B);
  2261.           If Value='' Then Value:='Helv';
  2262.           Val(S,DefPointSize,C);
  2263.           If C <> 0 Then DefPointSize := 8;
  2264.      End
  2265.      Else DefPointSize := 8;
  2266.  
  2267.      Attrs:=[];
  2268.      S:=Value;
  2269.      UpcaseStr(S);
  2270. L:
  2271.      For T:=Length(S) DownTo 1 Do
  2272.      Begin
  2273.           If S[T]='.' Then
  2274.           Begin
  2275.                s1:=Copy(S,T+1,255);
  2276.                If ((s1='BOLD')Or(s1='ITALIC')Or(s1='UNDERSCORE')Or(s1='STRIKEOUT')Or
  2277.                    (s1='OUTLINE')) Then
  2278.                Begin
  2279.                     S[0]:=Chr(T-1);
  2280.                     Value[0]:=Chr(T-1);
  2281.  
  2282.                     If s1='BOLD' Then Attrs:=Attrs+[faBold]
  2283.                     Else If s1='ITALIC' Then Attrs:=Attrs+[faItalic]
  2284.                     Else If s1='UNDERSCORE' Then Attrs:=Attrs+[faUnderScore]
  2285.                     Else If s1='STRIKEOUT' Then Attrs:=Attrs+[faStrikeOut]
  2286.                     Else If s1='OUTLINE' Then Attrs:=Attrs+[faOutline];
  2287.                End;
  2288.           End;
  2289.      End;
  2290.  
  2291.      If Value='System Default Font' Then
  2292.      Begin
  2293.           FNameCombo.Caption := Value;
  2294.           FSizeCombo.Caption := tostr(Screen.DefaultFont.PointSize);
  2295.      End
  2296.      Else
  2297.      Begin
  2298.           For T := 0 To Screen.FontCount-1 Do If Screen.Fonts[T].FaceName = Value Then
  2299.           Begin
  2300.                FNameCombo.Caption := Value;
  2301.                FSizeCombo.Caption := tostr(DefPointSize);
  2302.                break;
  2303.           End;
  2304.      End;
  2305.  
  2306.      UpcaseStr(Value);
  2307.      FItalicCheck.Checked:=((Attrs*[faItalic]<>[])Or(Pos(' ITALIC',Value)<>0));
  2308.      FBoldCheck.Checked:=((Attrs*[faBold]<>[])Or(Pos(' BOLD',Value)<>0));
  2309.  
  2310.      FOutlineCheck.Checked:=Attrs*[faOutline]<>[];
  2311.      FUnderscoreCheck.Checked:=Attrs*[faUnderScore]<>[];
  2312.      FStrikeOutCheck.Checked:=Attrs*[faStrikeOut]<>[];
  2313.  
  2314.      If Handle<>0 Then SetTheFont;
  2315. End;
  2316.  
  2317.  
  2318. Procedure TFontDialog.SetTheFont;
  2319. {$IFDEF OS2}
  2320. Var  C:cstring;
  2321. {$ENDIF}
  2322. Var  Font:TFont;
  2323.      IsDefault:Boolean;
  2324.      S,Value:String;
  2325.      T:LongInt;
  2326.      B:Byte;
  2327. Label L;
  2328. Begin
  2329.      IsDefault:=False;
  2330.      S:=FNameCombo.Caption;
  2331.      If S='System Default Font' Then
  2332.      Begin
  2333.           FSizeCombo.Caption:=tostr(Screen.DefaultFont.PointSize);
  2334.           FSizeCombo.Enabled:=False;
  2335.           IsDefault:=True;
  2336.      End
  2337.      Else FSizeCombo.Enabled:=True;
  2338.  
  2339.      For T:=0 To Screen.FontCount-1 Do
  2340.      Begin
  2341.           Font:=Screen.Fonts[T];
  2342.           If Font.FaceName=S Then
  2343.           Begin
  2344.                If Font.FontType=ftBitmap Then
  2345.                Begin
  2346.                     FOutlineCheck.Checked:=False;
  2347.                     FOutlineCheck.Enabled:=False;
  2348.                End
  2349.                Else FOutlineCheck.Enabled:=Not IsDefault;
  2350.                Goto L;
  2351.           End;
  2352.      End;
  2353.  
  2354.      FOutlineCheck.Enabled:=Not IsDefault;
  2355. L:
  2356.      Value:=FNameCombo.Caption;
  2357.      UpcaseStr(Value);
  2358.  
  2359.      If Pos(' ITALIC',Value)<>0 Then
  2360.      Begin
  2361.           If Not FItalicCheck.Checked Then
  2362.           Begin
  2363.                B:=Pos(' ITALIC',Value);
  2364.                S:=FNameCombo.Caption;
  2365.                Delete(S,B,7);
  2366.                FNameCombo.Caption:=S;
  2367.           End;
  2368.           FItalicCheck.Enabled:=True;
  2369.      End
  2370.      Else FItalicCheck.Enabled:=Not IsDefault;
  2371.  
  2372.      If Pos(' BOLD',Value)<>0 Then
  2373.      Begin
  2374.           If Not FBoldCheck.Checked Then
  2375.           Begin
  2376.                B:=Pos(' BOLD',Value);
  2377.                S:=FNameCombo.Caption;
  2378.                Delete(S,B,5);
  2379.                FNameCombo.Caption:=S;
  2380.           End;
  2381.           FBoldCheck.Enabled:=True;
  2382.      End
  2383.      Else FBoldCheck.Enabled:=Not IsDefault;
  2384.  
  2385.      Value:=FNameCombo.Caption;
  2386.      UpcaseStr(Value);
  2387.      FItalicCheck.Checked:=FItalicCheck.Checked Or (Pos(' ITALIC',Value)<>0);
  2388.      FBoldCheck.Checked:=FBoldCheck.Checked Or (Pos(' BOLD',Value)<>0);
  2389.  
  2390.      FStrikeOutCheck.Enabled:=Not IsDefault;
  2391.      FUnderscoreCheck.Enabled:=Not IsDefault;
  2392.  
  2393.      Font:=Screen.GetFontFromPointSize(FaceName,PointSize);
  2394.      InsertSizes(Font);
  2395.      If Font<>Nil Then
  2396.      Begin
  2397.           Font:=Screen.CreateCompatibleFont(Font);
  2398.           Font.AutoDestroy:=True;
  2399.           FExampleText.Font:=Font;
  2400.           FNameCombo.Caption:=FExampleText.Font.FaceName;
  2401.           FSizeCombo.Caption:=tostr(FExampleText.Font.PointSize);
  2402.      End
  2403.      Else
  2404.      Begin
  2405.           {$IFDEF OS2}
  2406.           C := FontName;
  2407.           WinSetPresParam(FExampleText.Handle,PP_FONTNAMESIZE,Length(C)+1,C);
  2408.           {$ENDIF}
  2409.      End;
  2410. End;
  2411.  
  2412. Procedure TFontDialog.InsertSizes(Var TheFont:TFont);
  2413. Var  C,c1,c2,T,t1:LongInt;
  2414.      OldCaption:String;
  2415.      cc:Integer;
  2416.      CaptionUpdated:Boolean;
  2417.      OldFont:TFont;
  2418. Label weiter,found,TryThis;
  2419. {$IFDEF WIN32}
  2420. Label defSize;
  2421. {$ENDIF}
  2422. Begin
  2423.      OldCaption:=FSizeCombo.Caption;
  2424.  
  2425.      FSizeCombo.BeginUpdate;
  2426.      FSizeCombo.Clear;
  2427.  
  2428.      {$IFDEF WIN32}
  2429.      goto defSize;
  2430.      {$ENDIF}
  2431.  
  2432.      If TheFont=Nil Then
  2433.      Begin
  2434. {$IFDEF WIN32}
  2435. defsize:
  2436. {$ENDIF}
  2437.           C:=4;
  2438.           While C<48 Do
  2439.           Begin
  2440.                FSizeCombo.Items.Add(tostr(C));
  2441.                Inc(C,2);
  2442.           End;
  2443.      End
  2444.      Else
  2445.      Begin
  2446.           If TheFont.MinimumPointSize=TheFont.MaximumPointSize Then
  2447.           Begin
  2448.                CaptionUpdated:=False;
  2449. TryThis:
  2450.                For T:=0 To Screen.FontCount-1 Do
  2451.                Begin
  2452.                     If Screen.Fonts[T].FaceName=FNameCombo.Caption Then
  2453.                     Begin
  2454.                          c2:=Screen.Fonts[T].MinimumPointSize;
  2455.                          If c2<4 Then c2:=4;
  2456.  
  2457.                          While ((c2<48)And(c2<=Screen.Fonts[T].MaximumPointSize)) Do
  2458.                          Begin
  2459.                               C:=c2;
  2460.  
  2461.                               For t1:=0 To FSizeCombo.Items.Count-1 Do
  2462.                               Begin
  2463.                                    Val(FSizeCombo.Items[t1],c1,cc);
  2464.                                    If cc=0 Then
  2465.                                    Begin
  2466.                                        If c1<4 Then c1:=4;
  2467.                                        If c1=C Then Goto weiter;
  2468.                                        If c1>C Then
  2469.                                        Begin
  2470.                                            Goto found;
  2471.                                        End;
  2472.                                    End;
  2473.                               End;
  2474.                               t1:=FSizeCombo.Items.Count;
  2475. found:
  2476.                               FSizeCombo.Items.Insert(t1,tostr(C));
  2477. weiter:
  2478.                               If c2 And 1<>0 Then Inc(c2)
  2479.                               Else Inc(c2,2);
  2480.                          End; //While
  2481.                     End;
  2482.                End;
  2483.  
  2484.                If ((Not CaptionUpdated)And(FSizeCombo.Items.IndexOf(OldCaption)<0)) Then
  2485.                Begin
  2486.                     If ((TheFont.NominalPointSize<>0)And
  2487.                         (FSizeCombo.Items.IndexOf(tostr(TheFont.NominalPointSize))>=0)) Then
  2488.                       OldCaption:=tostr(TheFont.NominalPointSize)
  2489.                     Else If FSizeCombo.Items.Count>0 Then
  2490.                       OldCaption:=FSizeCombo.Items[0];
  2491.                End;
  2492.           End
  2493.           Else
  2494.           Begin
  2495.                C:=TheFont.MinimumPointSize;
  2496.                If C<4 Then C:=4;
  2497.  
  2498.                While ((C<48)And(C<=TheFont.MaximumPointSize)) Do
  2499.                Begin
  2500.                     FSizeCombo.Items.Add(tostr(C));
  2501.                     If C And 1<>0 Then Inc(C)
  2502.                     Else Inc(C,2);
  2503.                End;
  2504.  
  2505.                Val(OldCaption,c1,cc);
  2506.                If cc=0 Then
  2507.                Begin
  2508.                     If ((c1<TheFont.MinimumPointSize)Or(c1>TheFont.MaximumPointSize)) Then
  2509.                     Begin
  2510.                          If TheFont.NominalPointSize<>0 Then
  2511.                            OldCaption:=tostr(TheFont.NominalPointSize)
  2512.                          Else If FSizeCombo.Items.Count>0 Then
  2513.                            OldCaption:=FSizeCombo.Items[0];
  2514.                     End;
  2515.                End;
  2516.                CaptionUpdated:=True;
  2517.                Goto TryThis;
  2518.           End;
  2519.      End;
  2520.  
  2521.      FSizeCombo.Caption := OldCaption;
  2522.      FSizeCombo.EndUpdate;
  2523.      //recreate Font In Case that Size changed
  2524.      OldFont:=TheFont;
  2525.      TheFont:=Screen.GetFontFromPointSize(FaceName,PointSize);
  2526.      If TheFont=Nil Then TheFont:=OldFont;
  2527. End;
  2528.  
  2529.  
  2530. {$HINTS OFF}
  2531. Procedure TFontDialog.EvComboSelect(Sender:TObject;Index:LongInt);
  2532. Var S:String;
  2533. Begin
  2534.      S:=FNameCombo.Text;
  2535.      UpcaseStr(S);
  2536.      If Pos(' BOLD',S)<>0 Then
  2537.      Begin
  2538.           If Pos(' ITALIC',S)<>0 Then
  2539.           Begin
  2540.                FBoldCheck.Checked:=True;
  2541.                FItalicCheck.Checked:=True;
  2542.           End
  2543.           Else
  2544.           Begin
  2545.                FBoldCheck.Checked:=True;
  2546.                FItalicCheck.Checked:=False;
  2547.           End;
  2548.      End
  2549.      Else If Pos(' ITALIC',S)<>0 Then
  2550.      Begin
  2551.           FBoldCheck.Checked:=False;
  2552.           FItalicCheck.Checked:=True;
  2553.      End
  2554.      Else
  2555.      Begin
  2556.           FBoldCheck.Checked:=False;
  2557.           FItalicCheck.Checked:=False;
  2558.      End;
  2559.  
  2560.      SetTheFont;
  2561. End;
  2562.  
  2563.  
  2564. Procedure TFontDialog.EvComboSizeSelect(Sender:TObject;Index:LongInt);
  2565. Begin
  2566.      SetTheFont;
  2567. End;
  2568. {$HINTS ON}
  2569.  
  2570.  
  2571. {
  2572. ╔═══════════════════════════════════════════════════════════════════════════╗
  2573. ║                                                                           ║
  2574. ║ Speed-Pascal/2 Version 2.0                                                ║
  2575. ║                                                                           ║
  2576. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  2577. ║                                                                           ║
  2578. ║ This section: TPrintDialog Class Implementation                           ║
  2579. ║                                                                           ║
  2580. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  2581. ║                                                                           ║
  2582. ╚═══════════════════════════════════════════════════════════════════════════╝
  2583. }
  2584.  
  2585. Function TPrintDialog.Execute;
  2586. Begin
  2587.   FPrintAll.Checked := True;
  2588.   FPrinter.Checked := True;
  2589.   FPrinter.Caption := Printer.Printers [Printer.PrinterIndex];
  2590.   FNumberOfCopiesEdit.Caption := '1';
  2591.   FPrintFromEdit.Caption := IntToStr (FMinPage);
  2592.   FPrintToEdit.Caption := IntToStr (FMaxPage);
  2593.   FNumberOfCopies.Min := 1;
  2594.   FNumberOfCopies.Max := 9999;
  2595.   FTitle.Caption := Printer.Title;
  2596.   Result := Inherited Execute;
  2597.   If Result Then
  2598.   Begin
  2599.     Printer.Title := FTitle.Caption;
  2600.     If FFileOutPut.Checked Then
  2601.     Begin
  2602.       Printer.PrintToFile := True;
  2603.       Printer.FileName := FFile.Caption;
  2604.     End
  2605.     Else
  2606.       Printer.PrintToFile := False;
  2607.     If FPrintAll.Checked Then
  2608.     Begin
  2609.       FAllPages := True;
  2610.       FromPage := MinPage;
  2611.       ToPage := MaxPage;
  2612.     End
  2613.     Else
  2614.     Begin
  2615.       FAllPages := False;
  2616.       FromPage := StrToInt (FPrintFromEdit.Caption);
  2617.       ToPage := StrToInt (FPrintToEdit.Caption);
  2618.       MinPage := StrToInt (FPrintFromEdit.Caption);
  2619.       MaxPage := StrToInt (FPrintToEdit.Caption);
  2620.     End;
  2621.     Printer.copies := StrToInt (FNumberOfCopiesEdit.Caption);
  2622.   End;
  2623. End;
  2624.  
  2625. Procedure TPrintDialog.SetMinPage;
  2626. Begin
  2627.   FMinPage := NewValue;
  2628.   FFromPage := FMinPage;
  2629.   FPrintFrom.Min := FFromPage;
  2630.   FPrintTo.Min := FFromPage;
  2631. End;
  2632.  
  2633. Procedure TPrintDialog.SetMaxPage;
  2634. Begin
  2635.   FMaxPage := NewValue;
  2636.   FToPage := FMaxPage;
  2637.   FPrintFrom.Max := FToPage;
  2638.   FPrintTo.Max := FToPage;
  2639. End;
  2640.  
  2641. Procedure TPrintDialog.SetToPage;
  2642. Begin
  2643.   FToPage := NewValue;
  2644.   FPrintFrom.Max := FToPage;
  2645.   FPrintTo.Max := FToPage;
  2646. End;
  2647.  
  2648. Procedure TPrintDialog.SetFromPage;
  2649. Begin
  2650.   FFromPage := NewValue;
  2651.   FPrintFrom.Min := FFromPage;
  2652.   FPrintTo.Min := FFromPage;
  2653. End;
  2654.  
  2655. Procedure TPrintDialog.SetOkName;
  2656. Begin
  2657.   FPrintButton.Caption := NewName;
  2658.   FOkName := NewName;
  2659. End;
  2660.  
  2661. {$HINTS OFF}
  2662. Procedure TPrintDialog.PropertyBtnClicked;
  2663. Begin
  2664.   Printer.OptionsDlg;
  2665. End;
  2666. {$HINTS ON}
  2667.  
  2668. Procedure TPrintDialog.SetupComponent;
  2669. Begin
  2670.   Inherited SetupComponent;
  2671.   Name := 'PrintDialog';
  2672.   Caption := LoadNLSStr(SPrint);
  2673.   FOkName := LoadNLSStr(SPrintButton);
  2674.   Width := 500;
  2675.   Height := 330;
  2676.   FPrintButton := TBitBtn.Create (Self);
  2677.   FPrintButton.Kind := bkOk;
  2678.   FPrintButton.Margin := 10;
  2679.   FCancelButton := TBitBtn.Create (Self);
  2680.   FCancelButton.Kind := bkCancel;
  2681.   FCancelButton.Margin := 10;
  2682.   FPropertyButton := TBitBtn.Create (Self);
  2683.   FPropertyButton.Glyph.LoadFromResourceName('StdBmpProp');
  2684.   FPropertyButton.Kind := bkCustom;
  2685.   FPropertyButton.Margin := 10;
  2686.   FHelpButton := TBitBtn.Create (Self);
  2687.   FHelpButton.Kind := bkHelp;
  2688.   FHelpButton.Command := cmHelp;
  2689.   FHelpButton.Margin := 10;
  2690.   FTitleBox := TGroupBox.Create (Self);
  2691.   FTitle := TEdit.Create (Self);
  2692.   FPagesBox := TRadioGroup.Create (Self);
  2693.   FPrintFromLabel := TRadioButton.Create (Self);
  2694.   FPrintFromEdit := TEdit.Create (Self);
  2695.   FPrintFrom := TUpDown.Create (Self);
  2696.   FPrintToLabel := TLabel.Create (Self);
  2697.   FPrintToEdit := TEdit.Create (Self);
  2698.   FPrintTo := TUpDown.Create (Self);
  2699.   FPrintAll := TRadioButton.Create (Self);
  2700.   FOptionsBox := TRadioGroup.Create (Self);
  2701.   FPrinter := TRadioButton.Create (Self);
  2702.   FFileOutPut := TRadioButton.Create (Self);
  2703.   FFile := TEdit.Create (Self);
  2704.   FNumberOfCopiesLabel := TLabel.Create (Self);
  2705.   FNumberOfCopiesEdit := TEdit.Create (Self);
  2706.   FNumberOfCopies := TUpDown.Create (Self);
  2707.   FPrintButton.SetWindowPos (330, 250, 150, 30);
  2708.   FCancelButton.SetWindowPos (330, 210, 150, 30);
  2709.   FPropertyButton.SetWindowPos (330, 170, 150, 30);
  2710.   FHelpButton.SetWindowPos (330, 15, 150, 30);
  2711.   FTitleBox.SetWindowPos (15, 230, 300, 60);
  2712.   FTitle.SetWindowPos (10, 13, 280, 20);
  2713.   FPagesBox.SetWindowPos (15, 140, 300, 85);
  2714.   FPrintFromLabel.SetWindowPos (10, 40, 70, 20);
  2715.   FPrintFromEdit.SetWindowPos (85, 37, 60, 20);
  2716.   FPrintFrom.SetWindowPos (145, 37, 21, 20);
  2717.   FPrintToLabel.SetWindowPos (175, 37, 30, 20);
  2718.   FPrintToLabel.PenColor := clBlack;
  2719.   FPrintToEdit.SetWindowPos (205, 37, 60, 20);
  2720.   FPrintTo.SetWindowPos (265, 37, 21, 20);
  2721.   FPrintAll.SetWindowPos (10, 15, 60, 20);
  2722.   FOptionsBox.SetWindowPos (15, 15, 300, 120);
  2723.   FPrinter.SetWindowPos (10, 75, 280, 20);
  2724.   FFileOutPut.SetWindowPos (10, 50, 50, 20);
  2725.   FFile.SetWindowPos (85, 48, 200, 20);
  2726.   FNumberOfCopiesLabel.SetWindowPos (12, 17, 60, 20);
  2727.   FNumberOfCopiesLabel.PenColor := clBlack;
  2728.   FNumberOfCopiesEdit.SetWindowPos (85, 15, 60, 20);
  2729.   FNumberOfCopies.SetWindowPos (145, 15, 21, 20);
  2730.   InsertControl (FPrintButton);
  2731.   InsertControl (FCancelButton);
  2732.   InsertControl (FPropertyButton);
  2733.   InsertControl (FHelpButton);
  2734.   InsertControl (FTitleBox);
  2735.   FTitleBox.InsertControl (FTitle);
  2736.   InsertControl (FOptionsBox);
  2737.   FOptionsBox.InsertControl (FNumberOfCopiesLabel);
  2738.   FOptionsBox.InsertControl (FNumberOfCopies);
  2739.   FOptionsBox.InsertControl (FNumberOfCopiesEdit);
  2740.   InsertControl (FPagesBox);
  2741.   FPagesBox.InsertControl (FPrintFromLabel);
  2742.   FPagesBox.InsertControl (FPrintFrom);
  2743.   FPagesBox.InsertControl (FPrintFromEdit);
  2744.   FPagesBox.InsertControl (FPrintToLabel);
  2745.   FPagesBox.InsertControl (FPrintTo);
  2746.   FPagesBox.InsertControl (FPrintToEdit);
  2747.   FPagesBox.InsertControl (FPrintAll);
  2748.   FOptionsBox.InsertControl (FPrinter);
  2749.   FOptionsBox.InsertControl (FFileOutPut);
  2750.   FOptionsBox.InsertControl (FFile);
  2751.   FPrintButton.Caption := LoadNLSStr(SPrintButton);
  2752.   FCancelButton.Caption := LoadNLSStr(SCancelButton);
  2753.   FPropertyButton.Caption := LoadNLSStr(SProperties);
  2754.   FHelpButton.Caption := LoadNLSStr(SHelpButton);
  2755.   FTitleBox.Caption := LoadNLSStr(STitle);
  2756.   FOptionsBox.Caption := LoadNLSStr(SOptions);
  2757.   FNumberOfCopiesLabel.Caption := LoadNLSStr(SCopies);
  2758.   FPagesBox.Caption := LoadNLSStr(SPages);
  2759.   FPrintFromLabel.Caption := LoadNLSStr(SFrom);
  2760.   FPrintToLabel.Caption := LoadNLSStr(STo);
  2761.   FPrintAll.Caption := LoadNLSStr(SAllButton);
  2762.   FOptionsBox.Caption := LoadNLSStr(SOptions);
  2763.   FFileOutPut.Caption := LoadNLSStr(SFile);
  2764.   FPrintFrom.Associate := FPrintFromEdit;
  2765.   FPrintTo.Associate := FPrintToEdit;
  2766.   FNumberOfCopies.Associate := FNumberOfCopiesEdit;
  2767.   FTitle.Caption := Printer.Title;
  2768.   FPropertyButton.OnClick := PropertyBtnClicked;
  2769.   FMaxPage := 1;
  2770.   FMinPage := 1;
  2771.   FFromPage := FMinPage;
  2772.   FToPage := FMaxPage;
  2773.   FPrintFrom.Min := FFromPage;
  2774.   FPrintFrom.Max := FToPage;
  2775.   FPrintTo.Min := FFromPage;
  2776.   FPrintTo.Max := FToPage;
  2777.   FPrintButton.Hint := LoadNLSStr(SClickHereToAccept);
  2778.   FCancelButton.Hint := LoadNLSStr(SClickHereToCancel);
  2779.   FPropertyButton.Hint := LoadNLSStr(SClickHereToSetProperties);
  2780.   FHelpButton.Hint := LoadNLSStr(SClickHereToGetHelp);
  2781.   FNumberOfCopiesEdit.OnFontChange := UpdateSpinSize;
  2782.   FPrintFromEdit.OnFontChange := UpdateSpinSize;
  2783.   FPrintToEdit.OnFontChange := UpdateSpinSize;
  2784.   FPrintButton.Focus;
  2785.   FPrintButton.TabStop := True;
  2786.   FCancelButton.TabStop := True;
  2787.   FPropertyButton.TabStop := True;
  2788.   FHelpButton.TabStop := True;
  2789.   FTitle.TabStop := True;
  2790.   FNumberOfCopiesEdit.TabStop := True;
  2791.   FPrintFromLabel.TabStop := True;
  2792.   FPrintFromEdit.TabStop := True;
  2793.   FTitleBox.TabStop := False;
  2794.   FOptionsBox.TabStop := False;
  2795.   FNumberOfCopiesLabel.TabStop := False;
  2796.   FNumberOfCopies.TabStop := False;
  2797.   FPagesBox.TabStop := False;
  2798.   FPrintFrom.TabStop := False;
  2799.   FPrintToLabel.TabStop := False;
  2800.   FPrintTo.TabStop := False;
  2801.   FPrintButton.TabOrder := 0;
  2802.   FCancelButton.TabOrder := 1;
  2803.   FPropertyButton.TabOrder := 2;
  2804.   FHelpButton.TabOrder := 3;
  2805.   FTitle.TabOrder := 4;
  2806.   FPrintFromLabel.TabOrder := 5;
  2807.   FPrintFromEdit.TabOrder := 6;
  2808.   FPrintToEdit.TabOrder := 7;
  2809.   FPrintAll.TabOrder := 8;
  2810.   FPrinter.TabOrder := 9;
  2811.   FFileOutPut.TabOrder := 10;
  2812.   FFile.TabOrder := 11;
  2813.   FNumberOfCopiesEdit.TabOrder := 12;
  2814. End;
  2815.  
  2816. {$HINTS OFF}
  2817. Procedure TPrintDialog.UpdateSpinSize;
  2818. Begin
  2819.   FNumberOfCopies.Height := FNumberOfCopiesEdit.Height;
  2820.   FPrintFrom.Height := FPrintFromEdit.Height;
  2821.   FPrintTo.Height := FPrintToEdit.Height;
  2822. End;
  2823. {$HINTS ON}
  2824.  
  2825.  
  2826.  
  2827. {
  2828. ╔═══════════════════════════════════════════════════════════════════════════╗
  2829. ║                                                                           ║
  2830. ║ Speed-Pascal/2 Version 2.0                                                ║
  2831. ║                                                                           ║
  2832. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  2833. ║                                                                           ║
  2834. ║ This section: TPrinterSetupDialog Class Implementation                    ║
  2835. ║                                                                           ║
  2836. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  2837. ║                                                                           ║
  2838. ╚═══════════════════════════════════════════════════════════════════════════╝
  2839. }
  2840.  
  2841. {$HINTS OFF}
  2842. Procedure TPrinterSetupDialog.PrinterSelected(Sender:TObject;Index:LongInt);
  2843. Begin
  2844.   Printer.PrinterIndex := FPrinterList.ItemIndex;
  2845.   DismissDlg (cmOk);
  2846. End;
  2847.  
  2848. Procedure TPrinterSetupDialog.PrinterFocused(Sender:TObject;Index:LongInt);
  2849. Begin
  2850.   Printer.PrinterIndex := FPrinterList.ItemIndex;
  2851. End;
  2852.  
  2853. Procedure TPrinterSetupDialog.PropertyBtnClicked(Sender:TObject);
  2854. Begin
  2855.   Printer.OptionsDlg;
  2856. End;
  2857. {$HINTS ON}
  2858.  
  2859. Procedure TPrinterSetupDialog.SetOkName;
  2860. Begin
  2861.   FSetPrinterButton.Caption := NewName;
  2862.   FOkName := NewName;
  2863. End;
  2864.  
  2865. Procedure TPrinterSetupDialog.SetupComponent;
  2866. Begin
  2867.   Inherited SetupComponent;
  2868.   Name := 'PrinterSetupDialog';
  2869.   Caption := LoadNLSStr(SSetupPrinter);
  2870.   FOkName := LoadNLSStr(SSetPrinter);
  2871.   Width := 450;
  2872.   Height := 285;
  2873.   color := clDlgWindow;
  2874.   FPrinterListHeadLine := TLabel.Create (Self);
  2875.   FPrinterList := TListBox.Create (Self);
  2876.   FSetPrinterButton := TBitBtn.Create (Self);
  2877.   FSetPrinterButton.Kind := bkOk;
  2878.   FSetPrinterButton.Margin := 10;
  2879.   FCancelButton := TBitBtn.Create (Self);
  2880.   FCancelButton.Kind := bkCancel;
  2881.   FCancelButton.Margin := 10;
  2882.   FPropertyButton := TBitBtn.Create (Self);
  2883.   FPropertyButton.ModalResult := cmNull;
  2884.   FPropertyButton.Glyph.LoadFromResourceName('StdBmpProp');
  2885.   FPropertyButton.Margin := 10;
  2886.   FHelpButton := TBitBtn.Create (Self);
  2887.   FHelpButton.Kind := bkHelp;
  2888.   FHelpButton.Command := cmHelp;
  2889.   FHelpButton.Margin := 10;
  2890.   FPrinterListHeadLine.SetWindowPos (15, 230, 250, 20);
  2891.   FPrinterList.SetWindowPos (15, 15, 250, 215);
  2892.   FSetPrinterButton.SetWindowPos (280, 200, 150, 30);
  2893.   FCancelButton.SetWindowPos (280, 160, 150, 30);
  2894.   FPropertyButton.SetWindowPos (280, 120, 150, 30);
  2895.   FHelpButton.SetWindowPos (280, 15, 150, 30);
  2896.   InsertControl (FPrinterListHeadLine);
  2897.   InsertControl (FPrinterList);
  2898.   InsertControl (FSetPrinterButton);
  2899.   InsertControl (FCancelButton);
  2900.   InsertControl (FPropertyButton);
  2901.   InsertControl (FHelpButton);
  2902.   FPropertyButton.OnClick := PropertyBtnClicked;
  2903.   FPrinterList.OnItemSelect := PrinterSelected;
  2904.   FPrinterList.OnItemFocus := PrinterFocused;
  2905.   FPrinterListHeadLine.Caption := LoadNLSStr(SCurrentPrinter)+':';
  2906.   FSetPrinterButton.Caption := LoadNLSStr(SSetPrinter);
  2907.   FCancelButton.Caption := LoadNLSStr(SCancelButton);
  2908.   FPropertyButton.Caption := LoadNLSStr(SProperties);
  2909.   FSetPrinterButton.Hint := LoadNLSStr(SClickHereToAccept);
  2910.   FPropertyButton.Hint := LoadNLSStr(SClickHereToSetProperties);
  2911.   FCancelButton.Hint := LoadNLSStr(SClickHereToCancel);
  2912.   FHelpButton.Hint := LoadNLSStr(SClickHereToGetHelp);
  2913.   FPrinterListHeadLine.TabStop := False;
  2914.   FPrinterList.TabStop := True;
  2915.   FSetPrinterButton.TabStop := True;
  2916.   FPropertyButton.TabStop := True;
  2917.   FCancelButton.TabStop := True;
  2918.   FHelpButton.TabStop := True;
  2919.   FPrinterList.TabOrder := 1;
  2920.   FSetPrinterButton.TabOrder := 2;
  2921.   FCancelButton.TabOrder := 3;
  2922.   FPropertyButton.TabOrder := 4;
  2923.   FHelpButton.TabOrder := 5;
  2924.   FSetPrinterButton.Focus;
  2925. End;
  2926.  
  2927. Function TPrinterSetupDialog.Execute;
  2928. Begin
  2929.   FPrinterList.Items := Printer.Printers;
  2930.   FOldPrinterIndex := Printer.PrinterIndex;
  2931.   FPrinterList.ItemIndex := FOldPrinterIndex;
  2932.   Result := Inherited Execute;
  2933.   If Not Result Then
  2934.     Printer.PrinterIndex := FOldPrinterIndex;
  2935. End;
  2936.  
  2937.  
  2938. {
  2939. ╔═══════════════════════════════════════════════════════════════════════════╗
  2940. ║                                                                           ║
  2941. ║ Speed-Pascal/2 Version 2.0                                                ║
  2942. ║                                                                           ║
  2943. ║ Speed-Pascal Component Classes (SPCC)                                     ║
  2944. ║                                                                           ║
  2945. ║ This section: TMessageBox Class Implementation                            ║
  2946. ║                                                                           ║
  2947. ║ (C) 1995,97 SpeedSoft. All rights reserved. Disclosure probibited !       ║
  2948. ║                                                                           ║
  2949. ╚═══════════════════════════════════════════════════════════════════════════╝
  2950. }
  2951.  
  2952. Procedure TMessageBox.SetupComponent;
  2953. Begin
  2954.      Inherited SetupComponent;
  2955.  
  2956.      FButtons:=[mbOk];
  2957.      fType:=mtInformation;
  2958.      Caption:='';
  2959. End;
  2960.  
  2961. Procedure TMessageBox.SetupShow;
  2962. Const SButtonNames:Array[mbYes..mbHelp] Of String[15]=
  2963.           (
  2964.            '~Yes','~No','~Ok','~Cancel','~Abort','~Retry','~Ignore','~All','~Help'
  2965.           );
  2966.       SButtonKinds:Array[mbYes..mbHelp] Of TBitBtnKind=
  2967.           (
  2968.            bkYes,bkNo,bkOk,bkCancel,bkAbort,bkRetry,bkIgnore,bkAll,bkHelp
  2969.           );
  2970. Var  FLabel:TLabel;
  2971.      CX,CY:LongInt;
  2972.      LabelX:LongInt;
  2973.      BtnX:LongInt;
  2974.      tw:LongInt;
  2975.      PictureY:LongWord;
  2976.      ButtonNames:Array[1..10] Of String[15];
  2977.      ButtonKinds:Array[1..10] Of TBitBtnKind;
  2978.      ButtonCount,T:LongInt;
  2979.      Btn:TBitBtn;
  2980.      Counter:TMsgDlgBtn;
  2981.      MaxWidth,W:LongInt;
  2982. Begin
  2983.      Inherited SetupShow;
  2984.  
  2985.      SButtonNames[mbYes]:=LoadNLSStr(SYesButton);
  2986.      SButtonNames[mbNo]:=LoadNLSStr(SNoButton);
  2987.      SButtonNames[mbOk]:=LoadNLSStr(SOkButton);
  2988.      SButtonNames[mbCancel]:=LoadNLSStr(SCancelButton);
  2989.      SButtonNames[mbAbort]:=LoadNLSStr(SAbortButton);
  2990.      SButtonNames[mbRetry]:=LoadNLSStr(SRetryButton);
  2991.      SButtonNames[mbIgnore]:=LoadNLSStr(SIgnoreButton);
  2992.      SButtonNames[mbAll]:=LoadNLSStr(SAllButton);
  2993.      SButtonNames[mbHelp]:=LoadNLSStr(SHelpButton);
  2994.  
  2995.      //check Single Buttons. only the following values are Valid And can be or'ed
  2996.      //mbYes,mbNo,mbOk,mbCancel,mbHelp,mbAbort.mbRetry,mbIgnore,mbAll
  2997.      //All Buttons are invisible
  2998.      MaxWidth:=340;
  2999.      W:=0;
  3000.      ButtonCount:=0;
  3001.  
  3002.      For Counter:=mbYes To mbHelp Do
  3003.      Begin
  3004.           If Counter IN FButtons Then
  3005.           Begin
  3006.                Inc(ButtonCount);
  3007.                ButtonNames[ButtonCount]:=SButtonNames[Counter];
  3008.                ButtonKinds[ButtonCount]:=SButtonKinds[Counter];
  3009.  
  3010.                Inc(W, Canvas.TextWidth(ButtonNames[ButtonCount]) + 20);
  3011.                If ShowBitBtnGlyph Then Inc(W, 25);
  3012.                //Inc(W,100);
  3013.  
  3014.                If W > MaxWidth Then
  3015.                Begin
  3016.                     If W > Screen.Width-50 Then break;
  3017.                     MaxWidth := W;
  3018.                End;
  3019.           End;
  3020.      End;
  3021.  
  3022.      LabelX := 20;
  3023.      If fType<>mtCustom Then Inc(LabelX,32);
  3024.  
  3025.      FLabel := InsertLabel(Self,LabelX,60,MaxWidth,20,FMsg);
  3026.      FLabel.WordWrap := True;
  3027.      FLabel.ShowAccelChar := False;
  3028.      FLabel.Height := FLabel.Canvas.Font.Height * FLabel.Rows;
  3029.  
  3030.      PictureY := FLabel.Bottom + FLabel.Height - 32;
  3031.  
  3032.      CX := LabelX + MaxWidth + 25;
  3033.      CY := 10 + 30 + 20 + FLabel.Height + 45;
  3034.  
  3035.      {Center Box}
  3036.      SetWindowPos(Left,Bottom,CX,CY);
  3037.  
  3038.      If fType<>mtCustom Then
  3039.      Begin
  3040.           If fType=mtConfirmation Then InsertImageName(Self,10,PictureY,32,32,'StdBmpAsk')
  3041.           Else If fType In [mtError,mtCritical,mtWarning] Then InsertImageName(Self,10,PictureY,32,32,'StdBmpHand')
  3042.           Else InsertImageName(Self,10,PictureY,32,32,'StdBmpInfo');
  3043.      End;
  3044.  
  3045.      If Caption='' Then  //overwrite Default
  3046.      Begin
  3047.          If fType=mtWarning Then Caption:=LoadNLSStr(SWarning)
  3048.          Else If fType=mtInformation Then Caption:=LoadNLSStr(sInformation)
  3049.          Else If fType=mtConfirmation Then Caption:=LoadNLSStr(SConfirmation)
  3050.          Else If fType=mtCritical Then Caption:=LoadNLSStr(SCriticalError)
  3051.          Else If fType=mtError Then Caption:=LoadNLSStr(SError)
  3052.          Else If fType=mtCustom Then Caption:=ParamStr(0)
  3053.          Else Caption:=LoadNLSStr(sInformation);
  3054.      End;
  3055.  
  3056.      //Create the Buttons
  3057.      BtnX:=10;
  3058.      For T:=1 To ButtonCount Do
  3059.      Begin
  3060.           tw := Canvas.TextWidth(ButtonNames[T]) + 20;
  3061.           If ShowBitBtnGlyph Then Inc(tw, 25);
  3062.           Btn := InsertBitBtn(Self,BtnX,10,tw,30,ButtonKinds[T],ButtonNames[T],'');
  3063.           Inc(BtnX, tw + 10);
  3064.           //Inc(BtnX,100);
  3065.           If T=1 Then Btn.Focus;
  3066.      End;
  3067. End;
  3068.  
  3069.  
  3070.  
  3071. Begin
  3072. End.
  3073.  
  3074.