TdfsPageSetupDialog v2.14

Description:
  A component to wrap the PageSetupDlg API function that Borland forgot.
  It is a common dialog available on the Win95 platform, so it can not be
  used with Delphi 1.0.

Contact Information:
  The lateset version will always be available on the web at:
    http://www.delphifreestuff.com
  If you have any questions, comments or suggestions, please use the Delphi
  Free Stuff Support Forum at:
    http://www.delphifreestuff.com/discus/
  If, for some reason, you can not use the web-based support forum, you can
  email me at bstowers@delphifreestuff.com.  However, the support forum will
  always take precedence over direct email since it provides a resource that
  others can use when they have a problem.  Every message posted to the forum
  is emailed directly to this account, so emailing me directly will not get
  your message to me any faster.  It will only make the message less important
  for me to respond to since only one person (you) is benefiting from it
  instead of everyone interested.  Having said all that, please do email me
  directly if it is regarding something that isn't really support related,
  i.e. just to say thanks (as novel as that idea is).


Installation:
  Delphi 1:
    * This component is not compatible with Delphi 1.

  Delphi 2, C++Builder 1:
    * Select the 'Component | Install' menu item.
    * In the Install Components dialog, click the Add button.
    * In the Add Module dialog, enter the full path name of the component's
      registration unit (the unit that ends with 'Reg.pas', i.e.
      'BrowseDrReg.pas') and click OK.
    * In the Add Module dialog, click OK.
    * The component library will be rebuilt and a new tab named 'DFS' will be
      available on the Component Palette.

  Delphi 3, 4, 5, C++Builder 3 & 4:
    * Do one of the following:
      + Create a new package by selecting File | New and choosing Package from
        the New tab in the dialog.
      + Open an existing package file.  I suggest you do this if you already
        have a package that you like to use for small, third party components.
        I specifically have a package named "3rdParty.dpk" that I use for
        small components that come from other people.  Or, if you are using
        several of my components, you might create a "DFS.dpk" package and
        use it for all of my DFS components.
    * In the resulting package window, click the Add button.
    * In the Add dialog, on the Add Unit tab, enter the full path name of the
      component's registration unit (the unit that ends with 'Reg.pas', i.e.
      'BrowseDrReg.pas') and click OK.
    * You may want to add the other source files (*.pas) to the package as
      well in the same manner as you did the registration unit.  While this is
      not required, not doing it will cause compiler warnings when the package
      is compiled.  The component will function fine either way, but I
      personally find the warnings very irritating and am not happy until
      every compiler warning and hint is gone.
    * If this package is new, or it has never been installed, click the
      Install button in the package window.  If this package is already
      installed in Delphi, click the Compile button.

  C++Builder 5 and up:
    * Perform the "Delphi 3 and up, C++Builder 3 and up" steps above, except
      for the last step (Compile or Install).
    * Select the package the component has been added to, and choose 
      Project | Edit Option Source to open the package options in the editor.
    * In the entry for PFLAGS, add the "-LUvcl50" option.  For example:
        <PFLAGS value="-$YD -$W -$O -v -JPHNE -M -LUvcl50"/>
    * Perform the final step from above, Compile or Install.
    * For Borland's official word on this situation, open the C++Builder help
      file and search the index for "dsgnintf.dcu" and see the "Compiling
      packages with DsgnIntf" section.

  Delphi 6 and up:
    * Perform the "Delphi 3, 4, 5, C++Builder 3 & 4" steps above, except
      for the last step (Compile or Install).
    * Add the DesignIDE package to the Requires list of the package into which
      the component is being installed.
    * Perform the final step from above, Compile or Install.
    * This is necessary because of changes to the design-time support units
      introduced in Delphi 6.  For complete information, see the Del6New.hlp
      file in your Delphi 6 Help directory.  In the index, search for
      "upgrade issues" and in the resulting list of topics, select the
      "DsgnIntf renamed and related changes" topic.


Known Issues:
  * There appears to be a bug in the PageSetupDlg Win32 API function.  If the
    PSD_INHUNDREDTHSOFMILLIMETERS flag is used, default minimum margins aren't
    enforced by the dialog.  If PSD_INTHOUSANDTHSOFINCHES is used, they are
    enforced. The reason I think it is an API bug is that Notepad exhibits the
    exact same behavior.  Try this:  Run Notepad with the U.S. measurement
    system and the Metric system.  You'll notice under U.S. that when you go
    into the page setup dialog of Notepad, it will default to your printer's
    minimum margins if you enter a value of 0 for any of the margins.  Under
    metric, you'll notice that entering a value of 0 will be accepted.  You
    can change the measurement system you are currently using by going into
    the Regional Settings Control Panel and chaning the Measurement System
    on the Number tab.
    Note that this only affects the dialog when poDefaultMinMargins is set in
    the Options property.  If this flag is not set, the values in the
    MinimumMargins property will be used and enforced by the dialog.  So,
    a possible work-around for this problem might be to simply leave out the
    poDefaultMinMargins flag.  This would result in the default minimum
    margins being read by the component at start up, and then used by the
    dialog as hard-coded values that it will enforce.  I have not tried this,
    but it seems like it should work.
  * Long delays when using the component:  It is possible that using this
    component can cause long delays at certain points in your app (when creating
    a form that has the component on it).  This is caused by "WinPrinters".  For
    those who don't know, many manufacturers are now selling what are known as
    WinPrinters.  These operate on the same principle as WinModems (what used to
    be called RPI modems):  Move some/most/all of the brains out of the printer
    and put it in the software driver.  This has some benefits, upgrades via
    software instead of hardware being the most compelling, but the tradeoff is
    that using the device places a much greater burden on your system since it
    now has to do work that the printer itself used to do.  Usually, on less
    than state-of-the-art machines or with really stupid WinPrinters, this means
    other software's performance suffers when the printer is being used.  I've
    tried to minimize the impact in the component by only talking to the printer
    when I have to, but you still may see delays.  The best suggestion I have at
    the moment is to always make sure that the printer involved has the most
    current drivers available installed for it.  I have seen this issue resolved
    in at least one case by using an updated driver.


Revision History:
2.14   + Updated for Delphi 6 compatibility.  See updated install directions
         above.
2.13   + Updated for C++Builder 5 compatibility.
2.12   + Make the PaperSizeType property read/write, not just read.  This is
         useful for setting the paper size type before showing the dialog.
         Also, it's the only way to set the paper size as changing the PaperSize
         property seems to have no effect on the dialog.  For a description of
         valid values used with the property, look up "DEVMODE" in the Win32 SDK
         help file.  Things like DMPAPER_LETTER and DMPAPER_LEGAL.
2.11   + Reworked when the default property values are retrieved from the
         system.  See Known Issues section above.
2.10   + It's *really* D5 compatible now.  Small change between the D5 eval 
         version and the real, shipping D5 version broke it.
2.09   + Fixed nasty little problem with HInstance not being set correctly in
         the DoExecute method.  Many thanks to Andreas Hoerstemeier for 
         catching this.
2.08   + Classname changed.
       + D5 compatibility.
2.07   + Updated for C++Builder 4 compatibility.
2.06   + Component will now check to see if there are any printers installed
         before trying to call the PageSetupDlg API function.  Before, if there
         wasn't a printer installed, you'd get error messages to that effect by
         simply running a program with the component installed.  Now, the error
         message won't be displayed until the user actually tries to bring up
         the dialog.
2.05   + PaperSizeType public property.  This will return the paper type of the
         currently selected printer.  Constants for these values are defined in
         Windows.pas, and are documented in the Win32.hlp file under the
         "DEVMODE" topic, dmPaperSize member.  A common use for this is to
         determine if the user has selected the user-defined paper size value
         (DMPAPER_USER constant), thus indicating that you need to get the
         size desired from the user.
       + Demo app updated a bit for better rich edit stuff.  Thanks to
         Christopher Sansone for doing this.
2.04   + Added PgSetupReg unit.  All IDE specific code (i.e. registering the
         component, property editors, etc.) are contained in this unit.  This
         was done for two primary reasons:  1) Using the component in a Delphi
         or C++Builder expert would register the component as well.  2) Reduce
         code size in some cases -- usually the smart linker removes this sort
         of stuff since the app never references it, but now it's for certain
         since it isn't even in the unit.  This change means that you need to
         install the component using the new "registration" unit instead of
         the unit containing the component.
2.03:  + Seriously nasty bugs that wouldn't update properties like PageSize
         after the user made a selection.  Fixed.
       + Updated demo project to work with either inches or millimeters.
       + Updated Known Issues above.
2.02:  + PageSize, Margins, MinimumMargins didn't seem to get the system
         default values if the Measurements property was pmDefault.  I've
         reworked the whole thing and it seems to work as it should now.
       + Changing Measurements property would not update custom values of the
         PageSize, Margins, and MinimumMargins properties.  They would only
         update if they contained the system defaults.  Fixed.
       + Forgot to include the updated demo in the distribution archive.  Old
         demo wouldn't compile...
2.01:  + Added Version property.
2.00:  + MinimumMargins weren't being enforced.  Default minimums were always
         being used.  That should only happen if poDefaultMinMargins is set in
         Options.  Fixed.
       + PageSize, Margins, and MinimumMargins are all now published instead of
         public.  They initially have the default values of the system, and if
         you do not change them, they will continue to get the default values
         of the system the application is run on.  That is, if your printer has
         a default margin setting of 1000, 1000, 1000, 1000, but one of your
         user's has a printer that has 750, 750, 750, 750, the component will
         show your settings at design time, but use the system's defaults that
         it is being run on.  However, if you change the values, they are then
         stored in your DFM file and used on everyone's system.  If you change
         the values and they are thus stored this way and you change your mind,
         you can get it to revert back to the system defaults by editing your
         form file (right click on it and select View As Text) and removing the
         entries for that property entirely.
       + PageSize, Margins, and MinimumMargins now contain the system defaults
         when initially created.  This is done by calling ReadCurrentValues in
         the constructor, therefor you will rarely need to call this method
         yourself.
       + The following enhancements were suggested by Indridi Bjornsson
         <indridi@isholf.is> and based on code sent by him.  Many thanks.
       + New DefaultMeasurements read-only property that indicates how the
         current system likes to measure things (inches or millimeters) and an
         associated CurrentMeasurements property that translates pmDefault into
         the system value so you get only a pmInches or pmMillimeters value.
       + Measurements property has a new default value, pmDefault.  If set to
         this, the value of DefaultMeasurments will be used in order to use the
         preferences set on the current system.
       + Added two new methods, FromMeasurementVal and ToMeasurementVal to
         convert a value such as Margins.Top to a double value and vice versa
         based on current measurement type.  For example, if the paper size is
         8 1/2 inches and pmInches is the current measurement system, PageSize.X
         would have a value of 8500.  FromMeasurementVal would convert that to
         8.5.
1.10:  + Added ReadCurrentValues method so the properties can be populated from
         the system and can be read without actually displaying the dialog.
1.04:  + New property: Centered.  I bet you can guess what it's for.
       + Fixed problem with C++Builder 3 run-time packages.
1.03:  + Updated for new DFS.INC file, component tab name, history/comments
         file.
1.02:  + Updated to for compatibility with Delphi 3.
1.01:  + Added "property editor" to allow testing the dialog at design-time.
         Just right click on it and select 'Test Dialog' from the menu.
1.00:  + Initial release.
