//--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // b t n G e t P r o p e r t i e s _ C l i c k                        //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Called when the 'Get Properties' button is clicked.                //
        //                                                                    //
        //--------------------------------------------------------------------//

        private void btnGetProperties_Click(object sender, RoutedEventArgs e)
        {
            Int32 result = 0;

            Int32 srcWidth  = 0,
                  srcHeight = 0,
                  srcResX   = 0,
                  srcResY   = 0;

            UInt32 srcCompression    = 0,
                   srcPaletteEntries = 0;

            UInt16 srcBitsPerPixel = 0;

            Boolean srcBlackWhite = false;

            Boolean bitmapOpen = false;

            bitmapOpen = ToolImageBitmapCore.bitmapOpen(_bitmapFilename);

            if (!bitmapOpen)
            {
                result = -1;
            }

            if (result == 0)
            {
                result = ToolImageBitmapCore.readBmpFileHeader();
            }

            if (result == 0)
            {
                result = ToolImageBitmapCore.readBmpInfoHeader();
            }

            if (result == 0)
            {
                result = ToolImageBitmapCore.readBmpPalette();
            }

            ToolImageBitmapCore.getBmpInfo(ref srcWidth,
                                           ref srcHeight,
                                           ref srcBitsPerPixel,
                                           ref srcCompression,
                                           ref srcResX,
                                           ref srcResY,
                                           ref srcPaletteEntries,
                                           ref srcBlackWhite);

            txtSrcWidth.Text       = srcWidth.ToString();
            txtSrcHeight.Text      = srcHeight.ToString();
            txtSrcResX.Text        = srcResX.ToString();
            txtSrcResY.Text        = srcResY.ToString();
            txtSrcResXDpi.Text     = ((Int32)(srcResX / 39.37)).ToString();
            txtSrcResYDpi.Text     = ((Int32)(srcResY / 39.37)).ToString();
            txtSrcBPP.Text         = srcBitsPerPixel.ToString();
            txtSrcCompression.Text = srcCompression.ToString();
            txtSrcMonoBW.Text      = srcBlackWhite.ToString();

            grpProps.Visibility = Visibility.Visible;

            if (bitmapOpen)
            {
                ToolImageBitmapCore.bitmapClose();
            }
        }
        //--------------------------------------------------------------------//
        //                                                        M e t h o d //
        // b t n G e n e r a t e _ C l i c k                                  //
        //--------------------------------------------------------------------//
        //                                                                    //
        // Called when the 'Generate' button is clicked.                      //
        //                                                                    //
        //--------------------------------------------------------------------//

        private void btnGenerate_Click(object sender, RoutedEventArgs e)
        {
            Int32 result = 0;

            Boolean bitmapOpen = false;

            //----------------------------------------------------------------//
            //                                                                //
            // Get current test metrics.                                      //
            // Note that the relevant (PDL-specific) stored option values     //
            // SHOULD already be up-to-date, since the fields all have        //
            // associated 'OnChange' actions. ***** Not with WPF ????? *****  //
            // But we'll save them all anyway, to make sure.                  //
            //                                                                //
            //----------------------------------------------------------------//

            _indxPDL = cbPDL.SelectedIndex;
            _crntPDL = (ToolCommonData.ePrintLang)_subsetPDLs[_indxPDL];

            pdlOptionsStore();

            //----------------------------------------------------------------//
            //                                                                //
            // Generate test print file.                                      //
            //                                                                //
            //----------------------------------------------------------------//

            bitmapOpen = ToolImageBitmapCore.bitmapOpen(_bitmapFilename);

            if (!bitmapOpen)
            {
                result = -1;
            }

            if (result == 0)
            {
                result = ToolImageBitmapCore.readBmpFileHeader();
            }

            if (result == 0)
            {
                result = ToolImageBitmapCore.readBmpInfoHeader();
            }

            if (result == 0)
            {
                result = ToolImageBitmapCore.readBmpPalette();
            }

            if (result == 0)
            {
                BinaryWriter binWriter = null;

                TargetCore.requestStreamOpen(
                    ref binWriter,
                    ToolCommonData.eToolIds.ImageBitmap,
                    ToolCommonData.eToolSubIds.None,
                    _crntPDL);

                if (result == 0)
                {
                    //--------------------------------------------------------//
                    //                                                        //
                    // Write test data to output file.                        //
                    //                                                        //
                    //--------------------------------------------------------//

                    if (_crntPDL == ToolCommonData.ePrintLang.PCL)
                    {
                        ToolImageBitmapPCL.generateJob(
                            binWriter,
                            _subsetPaperSizes[_indxPaperSizePCL],
                            _subsetPaperTypes[_indxPaperTypePCL],
                            _subsetOrientations[_indxOrientationPCL],
                            _destPosX,
                            _destPosY,
                            _destScalePercentX,
                            _destScalePercentY,
                            _indxRasterResolutionPCL);
                    }
                    else    // if (_crntPDL == (Int32)ToolCommonData.ePrintLang.PCLXL)
                    {
                        ToolImageBitmapPCLXL.generateJob(
                            binWriter,
                            _subsetPaperSizes[_indxPaperSizePCLXL],
                            _subsetPaperTypes[_indxPaperTypePCLXL],
                            _subsetOrientations[_indxOrientationPCLXL],
                            _destPosX,
                            _destPosY,
                            _destScalePercentX,
                            _destScalePercentY);
                    }
                }

                if (result == 0)
                {
                    TargetCore.requestStreamWrite(false);
                }
            }

            if (bitmapOpen)
            {
                ToolImageBitmapCore.bitmapClose();
            }
        }