home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ool_main.zip / ool / source / winproc.c < prev    next >
Text File  |  1998-03-15  |  53KB  |  1,227 lines

  1. #define  INCL_ERRORS
  2. #define  INCL_DOS
  3. #define  INCL_WIN
  4. #define  INCL_GPIBITMAPS
  5.  
  6. #include <os2.h>
  7. #include "oolglib.h"
  8. #include "oolgltk.h"
  9. #include "oolgres.rh"
  10.  
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <string.h>
  14. #include <time.h>
  15.  
  16. /******************************************************************************/
  17. USHORT GetLanguageBase () {
  18.    COUNTRYINFO  countryInfo;
  19.    COUNTRYCODE  countryCode = {0};
  20.    ULONG        infoLen = 0;
  21.  
  22.    DosQueryCtryInfo (sizeof (countryInfo), &countryCode, 
  23.       &countryInfo, &infoLen);
  24.    switch (countryInfo.country) {
  25.    case 49:
  26.       return IDR_GERMAN_BASE;
  27.    default:
  28.       return IDR_ENGLISH_BASE;
  29.    }
  30. }
  31.  
  32. /******************************************************************************/
  33. MRESULT XGLibDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  34.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  35.    switch (msg) {
  36.    case WM_COMMAND:
  37.       if (NULL != param) 
  38.          WinSendMsg (param->hwndDialog, msg, mp1, mp2);
  39.       break;
  40.    }
  41.    return WinDefDlgProc (hwnd, msg, mp1, mp2);
  42. }
  43.  
  44. /******************************************************************************/
  45. MRESULT FilterSetupWinProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  46.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  47.    HWND hwndPage;
  48.  
  49.    switch (msg) {
  50.    case WM_INITDLG:
  51.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  52.       break;
  53.    case WM_COMMAND:
  54.       hwndPage = (HWND) WinSendDlgItemMsg (hwnd, IDC_NOTEBOOK, BKM_QUERYPAGEWINDOWHWND, 
  55.          MPFROMLONG (param->pageID [0]), 0L);
  56.       WinSendMsg (hwndPage, WM_USER | msg, mp1, mp2);
  57.  
  58.       if (0 != param->pageID [1]) {
  59.          hwndPage = (HWND) WinSendDlgItemMsg (hwnd, IDC_NOTEBOOK, BKM_QUERYPAGEWINDOWHWND, 
  60.             MPFROMLONG (param->pageID [1]), 0L);
  61.          WinSendMsg (hwndPage, WM_USER | msg, mp1, mp2);
  62.       }
  63.  
  64.       break;
  65.    }
  66.    return WinDefDlgProc (hwnd, msg, mp1, mp2);
  67. }
  68.  
  69. /******************************************************************************/
  70. LONG GetMaxColorCount (UCHAR cBitCount, UCHAR cPalette, UCHAR cDithering) {
  71.    switch (cBitCount) {
  72.    case BFP_BPP_MONOCHROME:   return 2;
  73.    case BFP_BPP_EGA:          return BFP_PALETTE_4BIT_8_COLORS == cPalette ? 8 : 16;
  74.    case BFP_BPP_VGA:          return (BFP_DITHERING_OPTIMIZED | 
  75.                                  BFP_DITHERING_MEDIANCUT) & cDithering ? 256 :
  76.                                  BFP_PALETTE_8BIT_666 == cPalette ? 6*6*6 : 
  77.                                  BFP_PALETTE_8BIT_784 == cPalette ? 7*8*4 : 256;
  78.    case BFP_BPP_HIGHCOLOR:    return BFP_PALETTE_16BIT_555 == cPalette ? 32*32*32 : 32*64*32;
  79.    case BFP_BPP_TRUECOLOR:    return 256 * 256 * 256;  
  80.    case BFP_BPP_DIRECTCOLOR:  return 256 * 256 * 256;
  81.    }
  82. }
  83.  
  84. /******************************************************************************/
  85. UCHAR GetBitCount (UCHAR bppID) {
  86.    switch (bppID) {
  87.    case 0: return BFP_BPP_MONOCHROME;
  88.    case 1: return BFP_BPP_EGA;
  89.    case 2: return BFP_BPP_VGA;
  90.    case 3: return BFP_BPP_HIGHCOLOR;
  91.    case 4: return BFP_BPP_TRUECOLOR;  
  92.    case 5: return BFP_BPP_DIRECTCOLOR;
  93.    }
  94. }
  95.  
  96. /******************************************************************************/
  97. void SetSpinButton (HWND hwnd, USHORT resID, LONG curr, LONG min, LONG max) {
  98.    WinSendDlgItemMsg (hwnd, resID, SPBM_SETLIMITS, 
  99.       MPFROMLONG (max), MPFROMLONG (min));
  100.    WinSendDlgItemMsg (hwnd, resID, SPBM_SETCURRENTVALUE, MPFROMLONG (curr), 0);
  101. }
  102.  
  103. /******************************************************************************/
  104. void SelectColor (XBitmapFilterPageParameter* param, HWND hwndDlg) {
  105.    UCHAR  cBitCount     = GetBitCount (param->bppID);
  106.    USHORT paletteItem   = param->paletteID [param->bppID];
  107.    USHORT ditheringItem = param->ditheringID [param->bppID];
  108.    LONG   colorValue    = param->entryCount [param->bppID];
  109.  
  110.    ULONG  paletteMask   = GetPaletteMask (param->fImport ? -1 : 
  111.       param->fltParam->cFilterID, cBitCount, ditheringItem);
  112.    ULONG ditheringMask  = GetDitheringMask (param->fImport ? -1 : 
  113.       param->fltParam->cFilterID, cBitCount);
  114.  
  115.    char  entryName [64];
  116.    char  entryCount = 0;
  117.    LONG  colorCount;
  118.    int   n;
  119.  
  120.    HWND hwndCtrl = WinWindowFromID (hwndDlg, IDC_PALETTE);
  121.    WinSendMsg (hwndCtrl, LM_DELETEALL, 0, 0);
  122.    for (n = 0; n < BFP_PALETTE_COUNT; n++) if ((2 << n) & paletteMask) {
  123.       WinLoadString (param->fltParam->hab, param->hmod, 
  124.          param->profile->languageBase + IDR_PALETTE_GREYSCALE + n, 64, entryName);
  125.       WinSendMsg (hwndCtrl, LM_INSERTITEM, MPFROMLONG (LIT_END), MPFROMP (entryName));
  126.       WinSendMsg (hwndCtrl, LM_SETITEMHANDLE, MPFROMLONG (entryCount), MPFROMLONG (2 << n));
  127.       if ((2 << n) == paletteItem)
  128.          WinSendMsg (hwndCtrl, LM_SELECTITEM, MPFROMSHORT (entryCount), MPFROMSHORT (TRUE));
  129.       entryCount++;
  130.    }
  131.    if (0 == (paletteMask & paletteItem))
  132.       WinSendMsg (hwndCtrl, LM_SELECTITEM, MPFROMSHORT (0), MPFROMSHORT (TRUE));
  133.  
  134.    for (n = 0; n < 6; n++) {
  135.       WinEnableControl (hwndDlg, IDC_DITHERING_NEAREST + n, (1 << n) & ditheringMask);
  136.       if ((1 << n) == ditheringItem)
  137.       WinCheckButton (hwndDlg, IDC_DITHERING_NEAREST + n, TRUE);
  138.    }
  139.  
  140.    SetSpinButton (hwndDlg, IDC_PALETTE_ENTRIES, colorValue, 
  141.       2, GetMaxColorCount (cBitCount, paletteItem, ditheringItem));
  142.  
  143.    for (n = IDC_PRECISION_CAPTION; n <= IDC_PRECISION_BYTES; n++)
  144.       WinEnableControl (hwndDlg, n, BFP_DITHERING_OPTIMIZED == ditheringItem);
  145. }
  146.  
  147. /******************************************************************************/
  148. void SetChangeFlag (HWND hwnd, BOOL change, UCHAR bpps) {
  149.    change = TRUE;
  150.    WinEnableControl (hwnd, IDC_BPP, change);
  151.    WinEnableControl (hwnd, IDC_BPP_MONOCHROME,  change && (bpps & BFF_PROCESS_1BPP));
  152.    WinEnableControl (hwnd, IDC_BPP_EGA,         change && (bpps & BFF_PROCESS_4BPP));
  153.    WinEnableControl (hwnd, IDC_BPP_VGA,         change && (bpps & BFF_PROCESS_8BPP));
  154.    WinEnableControl (hwnd, IDC_BPP_HIGHCOLOR,   change && (bpps & BFF_PROCESS_16BPP));
  155.    WinEnableControl (hwnd, IDC_BPP_TRUECOLOR,   change && (bpps & BFF_PROCESS_24BPP));
  156.    WinEnableControl (hwnd, IDC_BPP_DIRECTCOLOR, change && (bpps & BFF_PROCESS_32BPP));
  157. }
  158.  
  159. /******************************************************************************/
  160. MRESULT ColorSetupWinProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  161.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  162.    HWND           hwndCtrl;
  163.    MRESULT        rc;
  164.  
  165.    switch (msg) {
  166.    case WM_INITDLG:
  167.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  168.       param = (XBitmapFilterPageParameter*) mp2;
  169.  
  170. /* Getting color palette */
  171.       param->paletteID [0] = BFP_PALETTE_1BIT_2_COLORS;
  172.       param->paletteID [1] = BFP_PALETTE_4BIT_16_COLORS;
  173.       param->paletteID [2] = BFP_PALETTE_8BIT_666;
  174.       param->paletteID [3] = BFP_PALETTE_16BIT_555;
  175.       param->paletteID [4] = BFP_PALETTE_TRUECOLORS;
  176.       param->paletteID [5] = BFP_PALETTE_TRUECOLORS;
  177.  
  178. /* Getting color palette */
  179.       param->ditheringID [0] = /*BFP_DITHERING_ERRORDIFFUSION;*/
  180.       param->ditheringID [1] = /*BFP_DITHERING_ERRORDIFFUSION;*/
  181.       param->ditheringID [2] = /*BFP_DITHERING_OPTIMIZED;*/
  182.       param->ditheringID [3] = /*BFP_DITHERING_ERRORDIFFUSION;*/
  183.       param->ditheringID [4] = /*BFP_DITHERING_NONE;*/
  184.       param->ditheringID [5] = BFP_DITHERING_NONE;
  185.       param->entryCount [0] = GetMaxColorCount (BFP_BPP_MONOCHROME,  param->paletteID [0], param->ditheringID [0]);
  186.       param->entryCount [1] = GetMaxColorCount (BFP_BPP_EGA,         param->paletteID [1], param->ditheringID [1]);
  187.       param->entryCount [2] = GetMaxColorCount (BFP_BPP_VGA,         param->paletteID [2], param->ditheringID [2]);
  188.       param->entryCount [3] = GetMaxColorCount (BFP_BPP_HIGHCOLOR,   param->paletteID [3], param->ditheringID [3]);
  189.       param->entryCount [4] = GetMaxColorCount (BFP_BPP_TRUECOLOR,   param->paletteID [4], param->ditheringID [4]);
  190.       param->entryCount [5] = GetMaxColorCount (BFP_BPP_DIRECTCOLOR, param->paletteID [5], param->ditheringID [5]);
  191.  
  192. /* Getting color depth */
  193.       if (BFP_BPP_DONT_TOUCH == param->fltParam->cBitCount)
  194.          param->fltParam->cBitCount = AdjustColorBits 
  195.             (8, param->profile->writingModes [param->fltParam->cFilterID]);
  196.  
  197.       if (param->fltParam->cBitCount > 24) param->bppID = 5;
  198.       else if (param->fltParam->cBitCount > 16) param->bppID = 4;
  199.       else if (param->fltParam->cBitCount >  8) param->bppID = 3;
  200.       else if (param->fltParam->cBitCount >  4) param->bppID = 2;
  201.       else if (param->fltParam->cBitCount >  2) param->bppID = 1;
  202.       else param->bppID = 0;
  203.  
  204.       if (BFP_PALETTE_DEFAULT != param->fltParam->cPalette)
  205.          param->paletteID [param->bppID] = param->fltParam->cPalette;
  206.       param->ditheringID [param->bppID] = param->fltParam->cDithering;
  207.  
  208.       param->modifyColors = BFP_BPP_DONT_TOUCH != param->fltParam->cBitCount;
  209.       WinCheckButton (hwnd, IDC_BPP_CHANGE, param->modifyColors);
  210.       SetChangeFlag (hwnd, param->modifyColors, param->fImport ?
  211.          BFF_PROCESS_ALL : param->profile->writingModes 
  212.          [param->fltParam->cFilterID]);
  213.  
  214.       WinCheckButton (hwnd, IDC_BPP_MONOCHROME + param->bppID, TRUE);
  215.       SelectColor (param, hwnd);
  216.  
  217.       SetSpinButton (hwnd, IDC_PRECISION_RED,   8, 0, 8);
  218.       SetSpinButton (hwnd, IDC_PRECISION_GREEN, 8, 0, 8);
  219.       SetSpinButton (hwnd, IDC_PRECISION_BLUE,  8, 0, 8);
  220.       break;
  221.    case WM_CONTROL:
  222.       hwndCtrl = (HWND) mp2;
  223.       switch (SHORT1FROMMP (mp1)) {
  224. /*      case IDC_BPP_CHANGE:*/
  225. /*         param->modifyColors = WinQueryButtonCheckstate (hwnd, IDC_BPP_CHANGE);*/
  226. /*         SetChangeFlag (hwnd, param->modifyColors, param->bppMask);*/
  227. /*         break;*/
  228.       case IDC_PALETTE:
  229.          param->paletteID [param->bppID] = SHORT1FROMMR 
  230.             (WinSendMsg (hwndCtrl, LM_QUERYITEMHANDLE, MPFROMSHORT (SHORT1FROMMR 
  231.             (WinSendMsg (hwndCtrl, LM_QUERYSELECTION, 0, 0))), 0));
  232.          break;
  233.       case IDC_BPP_MONOCHROME:
  234.          param->bppID = 0;
  235.          SelectColor (param, hwnd);
  236.          break;
  237.       case IDC_BPP_EGA:
  238.          param->bppID = 1;
  239.          SelectColor (param, hwnd);
  240.          break;
  241.       case IDC_BPP_VGA:
  242.          param->bppID = 2;
  243.          SelectColor (param, hwnd);
  244.          break;
  245.       case IDC_BPP_HIGHCOLOR:
  246.          param->bppID = 3;
  247.          SelectColor (param, hwnd);
  248.          break;
  249.       case IDC_BPP_TRUECOLOR:
  250.          param->bppID = 4;
  251.          SelectColor (param, hwnd);
  252.          break;
  253.       case IDC_BPP_DIRECTCOLOR:
  254.          param->bppID = 5;
  255.          SelectColor (param, hwnd);
  256.          break;
  257.       case IDC_DITHERING_NEAREST:
  258.          param->ditheringID [param->bppID] = BFP_DITHERING_NONE;
  259.          SelectColor (param, hwnd);
  260.          break;
  261.       case IDC_DITHERING_ERRORDIFFUSION:
  262.          param->ditheringID [param->bppID] = BFP_DITHERING_ERRORDIFFUSION;
  263.          SelectColor (param, hwnd);
  264.          break;
  265.       case IDC_DITHERING_SMALL_HALFTONE:
  266.          param->ditheringID [param->bppID] = BFP_DITHERING_SMALL_HALFTONE;
  267.          SelectColor (param, hwnd);
  268.          break;
  269.       case IDC_DITHERING_LARGE_HALFTONE:
  270.          param->ditheringID [param->bppID] = BFP_DITHERING_LARGE_HALFTONE;
  271.          SelectColor (param, hwnd);
  272.          break;
  273.       case IDC_DITHERING_OPTIMIZED:
  274.          param->ditheringID [param->bppID] = BFP_DITHERING_OPTIMIZED;
  275.          SelectColor (param, hwnd);
  276.          break;
  277.       case IDC_DITHERING_MEDIANCUT:
  278.          param->ditheringID [param->bppID] = BFP_DITHERING_MEDIANCUT;
  279.          SelectColor (param, hwnd);
  280.          break;
  281.       case IDC_PALETTE_ENTRIES:
  282.          if ((BFP_DITHERING_OPTIMIZED | BFP_DITHERING_MEDIANCUT) & 
  283.             param->ditheringID [param->bppID]) {
  284.             rc = WinDefDlgProc (hwnd, msg, mp1, mp2);
  285.             WinSendMsg (hwndCtrl, SPBM_QUERYVALUE, MPFROMP (param->entryCount + param->bppID), 0);
  286.             return rc;
  287.          }
  288.          break;
  289.       }
  290.  
  291.       WinEnableControl (hwnd, IDC_PALETTE, 
  292.          !((BFP_DITHERING_OPTIMIZED | BFP_DITHERING_MEDIANCUT) & 
  293.          param->ditheringID [param->bppID]) &&
  294.          SHORT1FROMMR (WinSendDlgItemMsg (hwnd, IDC_PALETTE, LM_QUERYITEMCOUNT, 0, 0)) > 1);
  295.       WinEnableControl (hwnd, IDC_PALETTE_ENTRIES, 
  296.          (BFP_DITHERING_OPTIMIZED | BFP_DITHERING_MEDIANCUT) & 
  297.          param->ditheringID [param->bppID]);
  298.  
  299.       if ((BFP_DITHERING_OPTIMIZED | BFP_DITHERING_MEDIANCUT) & 
  300.          param->ditheringID [param->bppID])
  301.          SetSpinButton (hwnd, IDC_PALETTE_ENTRIES, param->entryCount [param->bppID], 2,
  302.             GetMaxColorCount (GetBitCount (param->bppID), param->paletteID [param->bppID], param->ditheringID [param->bppID]));
  303.        else
  304.          SetSpinButton (hwnd, IDC_PALETTE_ENTRIES,
  305.             GetMaxColorCount (GetBitCount (param->bppID), param->paletteID [param->bppID], param->ditheringID [param->bppID]), 2,
  306.             GetMaxColorCount (GetBitCount (param->bppID), param->paletteID [param->bppID], param->ditheringID [param->bppID]));
  307.       break;
  308.    case WM_USER | WM_COMMAND:
  309.       if (DID_OK == SHORT1FROMMP (mp1)) 
  310.          if WinQueryButtonCheckstate (hwnd, IDC_BPP_CHANGE) {
  311.             param->fltParam->cBitCount  = GetBitCount (param->bppID);
  312.             param->fltParam->cPalette   = param->paletteID   [param->bppID];
  313.             param->fltParam->cDithering = param->ditheringID [param->bppID];
  314.             if (BFP_DITHERING_OPTIMIZED == param->ditheringID [param->bppID]) {
  315.                LONG tmpVal;
  316.                param->fltParam->cClrEntries = param->entryCount  [param->bppID];
  317.                WinSendDlgItemMsg (hwnd, IDC_PRECISION_RED, SPBM_QUERYVALUE, MPFROMP (&tmpVal), 0);
  318.                param->fltParam->cRedBits    = 0xff00 >> tmpVal;
  319.                WinSendDlgItemMsg (hwnd, IDC_PRECISION_GREEN, SPBM_QUERYVALUE, MPFROMP (&tmpVal), 0);
  320.                param->fltParam->cGreenBits  = 0xff00 >> tmpVal;
  321.                WinSendDlgItemMsg (hwnd, IDC_PRECISION_RED, SPBM_QUERYVALUE, MPFROMP (&tmpVal), 0);
  322.                param->fltParam->cBlueBits   = 0xff00 >> tmpVal;
  323.             }
  324.             if (BFP_DITHERING_MEDIANCUT == param->ditheringID [param->bppID])
  325.                param->fltParam->cClrEntries  = param->entryCount  [param->bppID];
  326.          } else {
  327.             param->fltParam->cBitCount  = BFP_BPP_DONT_TOUCH;
  328.             param->fltParam->cPalette   = BFP_PALETTE_DEFAULT;
  329.             param->fltParam->cDithering = BFP_DITHERING_NONE;
  330.          }
  331.       break;
  332.    }
  333.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  334. }
  335.  
  336. /******************************************************************************/
  337. MRESULT BitmapImportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  338.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  339.    XBitmapImportFilter* fltParam = NULL != param ? (XBitmapImportFilter*) param->fltParam : NULL;
  340.    int n;
  341.  
  342.    switch (msg) {
  343.    case WM_PAINT:
  344.       for (n = IDC_BITMAP_PALETTE; n <= IDC_BITMAP_INVERSE_BITMAP; n++)
  345.          WinEnableControl (hwnd, n, BFP_BPP_MONOCHROME == GetBitCount (param->bppID));
  346.       break;
  347.    case WM_INITDLG:
  348.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  349.       param = (XBitmapFilterPageParameter*) mp2;
  350.       fltParam = (XBitmapImportFilter*) param->fltParam;
  351.  
  352.       SetSpinButton (hwnd, IDC_BITMAP_INDEX, fltParam->uIndex, 0, 65535);
  353.       WinCheckButton (hwnd, IDC_BITMAP_INVERSE_NOTHING + 
  354.          fltParam->cInversionMode, TRUE);
  355.       break;
  356.    case WM_USER | WM_COMMAND:
  357.       if (DID_OK == SHORT1FROMMP (mp1)) {
  358. /* Bitmapindex abfragen */
  359.          WinSendDlgItemMsg (hwnd, IDC_BITMAP_INDEX, SPBM_QUERYVALUE, 
  360.             MPFROMP (&fltParam->uIndex), 0);
  361.  
  362. /* ggf. Palettentransformation abfragen */
  363.          if (BFP_BPP_MONOCHROME == GetBitCount (param->bppID))
  364.             for (n = IDC_BITMAP_INVERSE_NOTHING; n <= IDC_BITMAP_INVERSE_BITMAP; n++)
  365.                if (WinQueryButtonCheckstate (hwnd, n))
  366.                   fltParam->cInversionMode = n - IDC_BITMAP_INVERSE_NOTHING;
  367.       }
  368.       break;
  369.    }
  370.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  371. }
  372.  
  373. /******************************************************************************/
  374. MRESULT BitmapExportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  375.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  376.    XBitmapExportFilter* fltParam = NULL != param ? (XBitmapExportFilter*) param->fltParam : NULL;
  377.    int n;
  378.  
  379.    switch (msg) {
  380.    case WM_PAINT:
  381.       for (n = IDC_BITMAP_PALETTE; n <= IDC_BITMAP_FORCE_LIGHTFG; n++)
  382.          WinEnableControl (hwnd, n, BFP_BPP_MONOCHROME == GetBitCount (param->bppID));
  383.       break;
  384.    case WM_INITDLG:
  385.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  386.       param = (XBitmapFilterPageParameter*) mp2;
  387.       fltParam = (XBitmapExportFilter*) param->fltParam;
  388.  
  389.       switch (fltParam->cVersion) {
  390.       case BFP_BITMAP_OS2_11: 
  391.          WinCheckButton (hwnd, IDC_BITMAP_OS2_11, TRUE); break;
  392.       case BFP_BITMAP_OS2_20: 
  393.          WinCheckButton (hwnd, IDC_BITMAP_OS2_20, TRUE); break;
  394.       }
  395.  
  396.       WinCheckButton (hwnd, IDC_BITMAP_INVERSE_NOTHING + 
  397.          fltParam->cInversionMode, TRUE);
  398.  
  399.       break;
  400.    case WM_USER | WM_COMMAND:
  401.       if (DID_OK == SHORT1FROMMP (mp1)) {
  402.       /* Bitmapversion abfragen */
  403.          if (TRUE == WinQueryButtonCheckstate (hwnd, IDC_BITMAP_OS2_11))
  404.             fltParam->cVersion = BFP_BITMAP_OS2_11;
  405.          else if (TRUE == WinQueryButtonCheckstate (hwnd, IDC_BITMAP_OS2_20))
  406.             fltParam->cVersion = BFP_BITMAP_OS2_20;
  407.  
  408.       /* ggf. Palettentransformation abfragen */
  409.          if (BFP_BPP_MONOCHROME == GetBitCount (param->bppID))
  410.             for (n = IDC_BITMAP_INVERSE_NOTHING; n <= IDC_BITMAP_FORCE_LIGHTFG; n++)
  411.                if (TRUE == WinQueryButtonCheckstate (hwnd, n))
  412.                   fltParam->cInversionMode =
  413.                      n - IDC_BITMAP_INVERSE_NOTHING;
  414.       }
  415.       break;
  416.    }
  417.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  418. }
  419.  
  420. /******************************************************************************/
  421. MRESULT GEMExportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  422.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  423.    XGEMExportFilter* fltParam = NULL != param ? (XGEMExportFilter*) param->fltParam : NULL;
  424.  
  425.    switch (msg) {
  426.    case WM_INITDLG:
  427.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  428.       param = (XBitmapFilterPageParameter*) mp2;
  429.       fltParam = (XGEMExportFilter*) param->fltParam;
  430.  
  431.       WinCheckButton (hwnd, IDC_GEM_GREYSCALE, fltParam->fGreyscaled);
  432.       WinCheckButton (hwnd, IDC_GEM_XIMG, fltParam->fWritePalette);
  433.       SetSpinButton (hwnd, IDC_GEM_PIXEL_WIDTH, fltParam->uPixelWidth, 0, 255);
  434.       SetSpinButton (hwnd, IDC_GEM_PIXEL_HEIGHT, fltParam->uPixelHeight, 0, 255);
  435.       break;
  436.    case WM_USER | WM_COMMAND:
  437.       if (DID_OK == SHORT1FROMMP (mp1)) {
  438.          fltParam->fGreyscaled = 
  439.             WinQueryButtonCheckstate (hwnd, IDC_GEM_GREYSCALE);
  440.          fltParam->fWritePalette = 
  441.             WinQueryButtonCheckstate (hwnd, IDC_GEM_XIMG);
  442.  
  443.          WinSendDlgItemMsg (hwnd, IDC_GEM_PIXEL_WIDTH, SPBM_QUERYVALUE, 
  444.             MPFROMP (&fltParam->uPixelWidth), 0);
  445.          WinSendDlgItemMsg (hwnd, IDC_GEM_PIXEL_HEIGHT, SPBM_QUERYVALUE, 
  446.             MPFROMP (&fltParam->uPixelHeight), 0);
  447.       }
  448.       break;
  449.    }
  450.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  451. }
  452.  
  453. /******************************************************************************/
  454. MRESULT GIFImportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  455.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  456.    XGIFImportFilter* fltParam = NULL != param ? (XGIFImportFilter*) param->fltParam : NULL;
  457.  
  458.    switch (msg) {
  459.    case WM_INITDLG:
  460.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  461.       param = (XBitmapFilterPageParameter*) mp2;
  462.       fltParam = (XGIFImportFilter*) param->fltParam;
  463.  
  464.       WinCheckButton (hwnd, IDC_GIF_IGNORE_ERRORS, fltParam->fIgnoreErrors);
  465.       SetSpinButton (hwnd, IDC_GIF_INDEX, fltParam->uIndex, 0, 65535);
  466.       break;
  467.    case WM_USER | WM_COMMAND:
  468.       if (DID_OK == SHORT1FROMMP (mp1)) {
  469.          fltParam->fIgnoreErrors = 
  470.             WinQueryButtonCheckstate (hwnd, IDC_GIF_IGNORE_ERRORS);
  471.          WinSendDlgItemMsg (hwnd, IDC_GIF_INDEX, SPBM_QUERYVALUE, 
  472.             MPFROMP (&fltParam->uIndex), 0);
  473.       }
  474.       break;
  475.    }
  476.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  477. }
  478.  
  479. /******************************************************************************/
  480. MRESULT GIFExportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  481.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  482.    XGIFExportFilter* fltParam = NULL != param ? (XGIFExportFilter*) param->fltParam : NULL;
  483.  
  484.    switch (msg) {
  485.    case WM_PAINT:
  486.       if (NULL != param) {
  487.          LONG tColor;
  488.          UCHAR max = (1 << GetBitCount (param->bppID)) - 1;
  489.  
  490.          WinSendDlgItemMsg (hwnd, IDC_GIF_TRANSINDEX, SPBM_QUERYVALUE, MPFROMP (&tColor), 0);
  491.          if (tColor > max) max = 0;
  492.          SetSpinButton (hwnd, IDC_GIF_TRANSINDEX, tColor, 0, max);
  493.          WinSendDlgItemMsg (hwnd, IDC_GIF_BKGNDINDEX, SPBM_QUERYVALUE, MPFROMP (&tColor), 0);
  494.          if (tColor > max) max = 0;
  495.          SetSpinButton (hwnd, IDC_GIF_BKGNDINDEX, tColor, 0, max);
  496.       }
  497.       break;
  498.    case WM_INITDLG:
  499.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  500.       param = (XBitmapFilterPageParameter*) mp2;
  501.       fltParam = (XGIFExportFilter*) param->fltParam;
  502.  
  503.       WinCheckButton (hwnd, IDC_GIF_INTERLACED, fltParam->fInterlaced);
  504.  
  505.       WinCheckButton (hwnd, IDC_GIF_TRANS_CAPTION, 
  506.          BFP_GIF_TRANSCOLOR_NONE != fltParam->cTransColor);
  507.       SetSpinButton (hwnd, IDC_GIF_TRANSINDEX, fltParam->cTransColor >= 0 ?
  508.          fltParam->cTransColor : 0, 0, (1 << GetBitCount (param->bppID)) - 1);
  509.       WinCheckButton (hwnd, IDC_GIF_TRANSAUTO, 
  510.          BFP_GIF_TRANSCOLOR_NONE != fltParam->cTransColor ?
  511.          BFP_GIF_TRANSCOLOR_EDGE == fltParam->cTransColor : TRUE);
  512.  
  513.       SetSpinButton (hwnd, IDC_GIF_BKGNDINDEX, fltParam->cBackColor, 0, 
  514.          (1 << GetBitCount (param->bppID)) - 1);
  515.       SetSpinButton (hwnd, IDC_GIF_POS_X, fltParam->ulPosX, 0, 65535);
  516.       SetSpinButton (hwnd, IDC_GIF_POS_Y, fltParam->ulPosY, 0, 65535);
  517.       SetSpinButton (hwnd, IDC_GIF_SCREEN_WIDTH, fltParam->ulScreenWidth, 0, 65535);
  518.       SetSpinButton (hwnd, IDC_GIF_SCREEN_HEIGHT, fltParam->ulScreenHeight, 0, 65535);
  519.       break;
  520.    case WM_CONTROL:
  521.       WinEnableControl (hwnd, IDC_GIF_TRANSINDEX, 
  522.          WinQueryButtonCheckstate (hwnd, IDC_GIF_TRANS_CAPTION) &&
  523.          !WinQueryButtonCheckstate (hwnd, IDC_GIF_TRANSAUTO));
  524.       WinEnableControl (hwnd, IDC_GIF_TRANSAUTO, 
  525.          WinQueryButtonCheckstate (hwnd, IDC_GIF_TRANS_CAPTION));
  526.       break;
  527.    case WM_USER | WM_COMMAND: 
  528.       if (DID_OK == SHORT1FROMMP (mp1)) {
  529. /* Interlaced GIF? */
  530.          fltParam->fInterlaced = 
  531.             WinQueryButtonCheckstate (hwnd, IDC_GIF_INTERLACED);
  532. /* TransColor */
  533.          if (WinQueryButtonCheckstate (hwnd, IDC_GIF_TRANS_CAPTION))
  534.             fltParam->cTransColor = BFP_GIF_TRANSCOLOR_NONE;
  535.          else if (WinQueryButtonCheckstate (hwnd, IDC_GIF_TRANSAUTO))
  536.             fltParam->cTransColor = BFP_GIF_TRANSCOLOR_EDGE;
  537.          else
  538.             WinSendDlgItemMsg (hwnd, IDC_GIF_TRANSINDEX, SPBM_QUERYVALUE, 
  539.                MPFROMP (&fltParam->cTransColor), 0);
  540. /* Backgroundcolor */
  541.          WinSendDlgItemMsg (hwnd, IDC_GIF_BKGNDINDEX, SPBM_QUERYVALUE, 
  542.             MPFROMP (&fltParam->cBackColor), 0);
  543. /* Position */
  544.          WinSendDlgItemMsg (hwnd, IDC_GIF_POS_X, SPBM_QUERYVALUE, 
  545.             MPFROMP (&fltParam->ulPosX), 0);
  546.          WinSendDlgItemMsg (hwnd, IDC_GIF_POS_Y, SPBM_QUERYVALUE, 
  547.             MPFROMP (&fltParam->ulPosY), 0);
  548. /* Screensize */
  549.          WinSendDlgItemMsg (hwnd, IDC_GIF_SCREEN_WIDTH, SPBM_QUERYVALUE, 
  550.             MPFROMP (&fltParam->ulScreenWidth), 0);
  551.          WinSendDlgItemMsg (hwnd, IDC_GIF_SCREEN_HEIGHT, SPBM_QUERYVALUE, 
  552.             MPFROMP (&fltParam->ulScreenHeight), 0);
  553.       }
  554.       break;
  555.    }
  556.  
  557.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  558. }
  559.  
  560. /******************************************************************************/
  561. MRESULT GreymapImportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  562.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  563.    XGreymapImportFilter* fltParam = NULL != param ? (XGreymapImportFilter*) param->fltParam : NULL;
  564.    int n;
  565.  
  566.    switch (msg) {
  567.    case WM_INITDLG:
  568.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  569.       param = (XBitmapFilterPageParameter*) mp2;
  570.       fltParam = (XGreymapImportFilter*) param->fltParam;
  571.  
  572.       for (n = 0; n < 4; n++) 
  573.          if ("krgb" [n] == fltParam->cShadingType) 
  574.             WinCheckButton (hwnd, IDC_GREYMAP_GREY + n, TRUE);
  575.       break;
  576.    case WM_USER | WM_COMMAND: 
  577.       if (DID_OK == SHORT1FROMMP (mp1))
  578.          for (n = 0; n < 4; n++) 
  579.             if (WinQueryButtonCheckstate (hwnd, IDC_GREYMAP_GREY + n))
  580.                fltParam->cShadingType = "krgb" [n];
  581.       break;
  582.    }
  583.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  584. }
  585.  
  586. /******************************************************************************/
  587. MRESULT IAXImportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  588.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  589.    XIAXImportFilter* fltParam = NULL != param ? (XIAXImportFilter*) param->fltParam : NULL;
  590.    int n;
  591.  
  592.    switch (msg) {
  593.    case WM_INITDLG:
  594.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  595.       param = (XBitmapFilterPageParameter*) mp2;
  596.       fltParam = (XIAXImportFilter*) param->fltParam;
  597.  
  598.       SetSpinButton (hwnd, IDC_IAX_WIDTH, fltParam->ulWidth, 0, 65535);
  599.       for (n = 0; n < 4; n++) 
  600.          if ("krgb" [n] == fltParam->cShadingType) 
  601.             WinCheckButton (hwnd, IDC_IAX_GREY + n, TRUE);
  602.       break;
  603.    case WM_USER | WM_COMMAND: 
  604.       if (DID_OK == SHORT1FROMMP (mp1)) {
  605.          WinSendDlgItemMsg (hwnd, IDC_IAX_WIDTH, SPBM_QUERYVALUE, 
  606.             MPFROMP (&fltParam->ulWidth), 0);
  607.  
  608.          for (n = 0; n < 4; n++) 
  609.             if (WinQueryButtonCheckstate (hwnd, IDC_IAX_GREY + n))
  610.                fltParam->cShadingType = "krgb" [n];
  611.       }
  612.       break;
  613.    }
  614.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  615. }
  616.  
  617. /******************************************************************************/
  618. MRESULT ILBMExportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  619.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  620.    XILBMExportFilter* fltParam = NULL != param ? (XILBMExportFilter*) param->fltParam : NULL;
  621.  
  622.    switch (msg) {
  623.    case WM_PAINT:
  624.       if (NULL != param) {
  625.          LONG tColor;
  626.          UCHAR max = (1 << GetBitCount (param->bppID)) - 1;
  627.  
  628.          WinSendDlgItemMsg (hwnd, IDC_ILBM_TRANSINDEX, SPBM_QUERYVALUE, MPFROMP (&tColor), 0);
  629.          if (tColor > max) max = 0;
  630.          SetSpinButton (hwnd, IDC_ILBM_TRANSINDEX, tColor, 0, max);
  631.       }
  632.       break;
  633.    case WM_INITDLG:
  634.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  635.       param = (XBitmapFilterPageParameter*) mp2;
  636.       fltParam = (XILBMExportFilter*) param->fltParam;
  637.  
  638.       WinCheckButton (hwnd, IDC_ILBM_HAM6, fltParam->fHAM6);
  639.  
  640.       WinCheckButton (hwnd, IDC_ILBM_TRANS_CAPTION, 
  641.          BFP_ILBM_TRANSCOLOR_NONE != fltParam->cTransColor);
  642.       SetSpinButton (hwnd, IDC_ILBM_TRANSINDEX, fltParam->cTransColor >= 0 ?
  643.          fltParam->cTransColor : 0, 0, (1 << GetBitCount (param->bppID)) - 1);
  644.       WinCheckButton (hwnd, IDC_ILBM_TRANSAUTO, 
  645.          BFP_ILBM_TRANSCOLOR_NONE != fltParam->cTransColor ?
  646.          BFP_ILBM_TRANSCOLOR_EDGE == fltParam->cTransColor : TRUE);
  647.  
  648.       SetSpinButton (hwnd, IDC_ILBM_POS_X, fltParam->ulPosX, 0, 65535);
  649.       SetSpinButton (hwnd, IDC_ILBM_POS_Y, fltParam->ulPosY, 0, 65535);
  650.       SetSpinButton (hwnd, IDC_ILBM_SCREEN_WIDTH, fltParam->ulScreenWidth, 0, 65535);
  651.       SetSpinButton (hwnd, IDC_ILBM_SCREEN_HEIGHT, fltParam->ulScreenHeight, 0, 65535);
  652.       SetSpinButton (hwnd, IDC_ILBM_ASPECT_X, fltParam->uXAspect, 1, 65535);
  653.       SetSpinButton (hwnd, IDC_ILBM_ASPECT_Y, fltParam->uYAspect, 1, 65535);
  654.       break;
  655.    case WM_CONTROL:
  656.       WinEnableControl (hwnd, IDC_ILBM_TRANSINDEX, 
  657.          WinQueryButtonCheckstate (hwnd, IDC_ILBM_TRANS_CAPTION) &&
  658.          !WinQueryButtonCheckstate (hwnd, IDC_ILBM_TRANSAUTO) &&
  659.          GetBitCount (param->bppID) <= 8);
  660.  
  661.       WinEnableControl (hwnd, IDC_ILBM_TRANSAUTO, 
  662.          WinQueryButtonCheckstate (hwnd, IDC_ILBM_TRANS_CAPTION));
  663.       break;
  664.    case WM_USER | WM_COMMAND: 
  665.       if (DID_OK == SHORT1FROMMP (mp1)) {
  666. /* HAM6? */
  667.          fltParam->fHAM6 = 
  668.             WinQueryButtonCheckstate (hwnd, IDC_ILBM_HAM6);
  669. /* TransColor */
  670.          if (WinQueryButtonCheckstate (hwnd, IDC_ILBM_TRANS_CAPTION))
  671.             fltParam->cTransColor = BFP_ILBM_TRANSCOLOR_NONE;
  672.          else if (WinQueryButtonCheckstate (hwnd, IDC_ILBM_TRANSAUTO))
  673.             fltParam->cTransColor = BFP_ILBM_TRANSCOLOR_EDGE;
  674.          else
  675.             WinSendDlgItemMsg (hwnd, IDC_ILBM_TRANSINDEX, SPBM_QUERYVALUE, 
  676.                MPFROMP (&fltParam->cTransColor), 0);
  677. /* Position */
  678.          WinSendDlgItemMsg (hwnd, IDC_ILBM_POS_X, SPBM_QUERYVALUE, 
  679.             MPFROMP (&fltParam->ulPosX), 0);
  680.          WinSendDlgItemMsg (hwnd, IDC_ILBM_POS_Y, SPBM_QUERYVALUE, 
  681.             MPFROMP (&fltParam->ulPosY), 0);
  682. /* Screensize */
  683.          WinSendDlgItemMsg (hwnd, IDC_ILBM_SCREEN_WIDTH, SPBM_QUERYVALUE, 
  684.             MPFROMP (&fltParam->ulScreenWidth), 0);
  685.          WinSendDlgItemMsg (hwnd, IDC_ILBM_SCREEN_HEIGHT, SPBM_QUERYVALUE, 
  686.             MPFROMP (&fltParam->ulScreenHeight), 0);
  687. /* Aspect */
  688.          WinSendDlgItemMsg (hwnd, IDC_ILBM_ASPECT_X, SPBM_QUERYVALUE, 
  689.             MPFROMP (&fltParam->uXAspect), 0);
  690.          WinSendDlgItemMsg (hwnd, IDC_ILBM_ASPECT_Y, SPBM_QUERYVALUE, 
  691.             MPFROMP (&fltParam->uYAspect), 0);
  692.       }
  693.       break;
  694.    }
  695.  
  696.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  697. }
  698.  
  699. /******************************************************************************/
  700. MRESULT JPEGExportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  701.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  702.    XJPEGExportFilter* fltParam = NULL != param ? (XJPEGExportFilter*) param->fltParam : NULL;
  703.    char* scale [] = {"0", "25", "50", "75", "100"};
  704.    char  s [4];
  705.    int   n;
  706.  
  707.    switch (msg) {
  708.    case WM_INITDLG:
  709.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  710.       param = (XBitmapFilterPageParameter*) mp2;
  711.       fltParam = (XJPEGExportFilter*) param->fltParam;
  712.  
  713.       WinSendDlgItemMsg (hwnd, IDC_JPEG_QUALITY, 
  714.          SLM_SETTICKSIZE, MPFROM2SHORT (SMA_SETALLTICKS, 2), 0);
  715.       for (n = 0; n < 100; n+= 10) {
  716.          WinSendDlgItemMsg (hwnd, IDC_JPEG_QUALITY, 
  717.             SLM_SETTICKSIZE, MPFROM2SHORT (n, 4), 0);
  718.          WinSendDlgItemMsg (hwnd, IDC_JPEG_QUALITY, 
  719.             SLM_SETTICKSIZE, MPFROM2SHORT (n + 5, 7), 0);
  720.       }
  721.  
  722.       for (n = 0; n < 5; n++)
  723.          WinSendDlgItemMsg (hwnd, IDC_JPEG_QUALITY, 
  724.             SLM_SETSCALETEXT, MPFROMSHORT (n * 25), 
  725.             MPFROMP (scale [n]));
  726.  
  727.       WinSendDlgItemMsg (hwnd, IDC_JPEG_QUALITY, 
  728.          SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), 
  729.          MPFROMCHAR (fltParam->cQuality));
  730.  
  731.       WinCheckButton (hwnd, IDC_JPEG_PROGRESSIVE, fltParam->fProgressive);
  732.    
  733.       break;
  734.    case WM_CONTROL:
  735.       switch (SHORT1FROMMP (mp1)) {
  736.       case IDC_JPEG_QUALITY:
  737.          WinDefWindowProc (hwnd, msg, mp1, mp2);
  738.          sprintf (s, "%lu", (ULONG) WinSendDlgItemMsg (hwnd, 
  739.             IDC_JPEG_QUALITY, SLM_QUERYSLIDERINFO, 
  740.             MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), 0));
  741.          WinSetDlgItemText (hwnd, IDC_JPEG_QUALITY_VALUE, s);
  742.          break;
  743.       }
  744.       break;
  745.    case WM_USER | WM_COMMAND: 
  746.       if (DID_OK == SHORT1FROMMP (mp1)) {
  747.          fltParam->fProgressive = 
  748.             WinQueryButtonCheckstate (hwnd, IDC_JPEG_PROGRESSIVE);
  749.          fltParam->cQuality = (UCHAR) (ULONG) WinSendDlgItemMsg (hwnd, 
  750.             IDC_JPEG_QUALITY, SLM_QUERYSLIDERINFO, 
  751.             MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_INCREMENTVALUE), 0);
  752.       }
  753.       break;
  754.    }
  755.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  756. }
  757.  
  758. /******************************************************************************/
  759. MRESULT KIPSImportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {    
  760.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  761.    XKIPSImportFilter* fltParam = NULL != param ? (XKIPSImportFilter*) param->fltParam : NULL;
  762.  
  763.    switch (msg) {
  764.    case WM_INITDLG:
  765.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  766.       param = (XBitmapFilterPageParameter*) mp2;
  767.       fltParam = (XKIPSImportFilter*) param->fltParam;
  768.  
  769.       WinCheckButton (hwnd, IDC_KIPS_PAL + 
  770.          fltParam->cPaletteFileExtension, TRUE);
  771.       break;
  772.    case WM_USER | WM_COMMAND: 
  773.       if (DID_OK == SHORT1FROMMP (mp1))
  774.          if (WinQueryButtonCheckstate (hwnd, IDC_KIPS_PAL))
  775.             fltParam->cPaletteFileExtension = BFP_KIPS_PAL_EXTENSION;
  776.          else
  777.             fltParam->cPaletteFileExtension = BFP_KIPS_KPL_EXTENSION;
  778.       break;
  779.    }
  780.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  781. }
  782.  
  783. /******************************************************************************/
  784. MRESULT KIPSExportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {    
  785.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  786.    XKIPSExportFilter* fltParam = NULL != param ? (XKIPSExportFilter*) param->fltParam : NULL;
  787.  
  788.    switch (msg) {
  789.    case WM_INITDLG:
  790.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  791.       param = (XBitmapFilterPageParameter*) mp2;
  792.       fltParam = (XKIPSExportFilter*) param->fltParam;
  793.  
  794.       WinCheckButton (hwnd, IDC_KIPS_PAL + 
  795.          fltParam->cPaletteFileExtension, TRUE);
  796.       break;
  797.    case WM_USER | WM_COMMAND: 
  798.       if (DID_OK == SHORT1FROMMP (mp1))
  799.          if (WinQueryButtonCheckstate (hwnd, IDC_KIPS_PAL))
  800.             fltParam->cPaletteFileExtension = BFP_KIPS_PAL_EXTENSION;
  801.          else
  802.             fltParam->cPaletteFileExtension = BFP_KIPS_KPL_EXTENSION;
  803.       break;
  804.    }
  805.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  806. }
  807.  
  808. /******************************************************************************/
  809. MRESULT PCXImportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  810.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  811.    XPCXImportFilter* fltParam = NULL != param ? (XPCXImportFilter*) param->fltParam : NULL;
  812.  
  813.    switch (msg) {
  814.    case WM_INITDLG:
  815.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  816.       param = (XBitmapFilterPageParameter*) mp2;
  817.       fltParam = (XPCXImportFilter*) param->fltParam;
  818.  
  819.       WinCheckButton (hwnd, IDC_PCX_FIXLINES, fltParam->fFixLines);
  820.       break;
  821.    case WM_USER | WM_COMMAND: 
  822.       if (DID_OK == SHORT1FROMMP (mp1))
  823.          fltParam->fFixLines = 
  824.             WinQueryButtonCheckstate (hwnd, IDC_PCX_FIXLINES);
  825.       break;
  826.    }
  827.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  828. }
  829.  
  830. /******************************************************************************/
  831. MRESULT PSegImportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  832.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  833.    XPSegImportFilter* fltParam = NULL != param ? (XPSegImportFilter*) param->fltParam : NULL;
  834.  
  835.    switch (msg) {
  836.    case WM_INITDLG:
  837.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  838.       param = (XBitmapFilterPageParameter*) mp2;
  839.       fltParam = (XPSegImportFilter*) param->fltParam;
  840.  
  841.       WinCheckButton (hwnd, IDC_PSEG_FIXRECORDS, fltParam->fFixRecords);
  842.       break;
  843.    case WM_USER | WM_COMMAND: 
  844.       if (DID_OK == SHORT1FROMMP (mp1))
  845.          fltParam->fFixRecords = 
  846.             WinQueryButtonCheckstate (hwnd, IDC_PSEG_FIXRECORDS);
  847.       break;
  848.    }
  849.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  850. }
  851.  
  852. /******************************************************************************/
  853. MRESULT PSegExportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  854.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  855.    XPSegExportFilter* fltParam = NULL != param ? (XPSegExportFilter*) param->fltParam : NULL;
  856.  
  857.    switch (msg) {
  858.    case WM_INITDLG:
  859.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  860.       param = (XBitmapFilterPageParameter*) mp2;
  861.       fltParam = (XPSegExportFilter*) param->fltParam;
  862.  
  863.       WinCheckButton (hwnd, IDC_PSEG_DOUBLE, fltParam->fDoubleSized);
  864.       break;
  865.    case WM_USER | WM_COMMAND: 
  866.       if (DID_OK == SHORT1FROMMP (mp1))
  867.          fltParam->fDoubleSized = 
  868.             WinQueryButtonCheckstate (hwnd, IDC_PSEG_DOUBLE);
  869.       break;
  870.    }
  871.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  872. }
  873.  
  874. /******************************************************************************/
  875. MRESULT SpriteImportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  876.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  877.    XSpriteImportFilter* fltParam = NULL != param ? (XSpriteImportFilter*) param->fltParam : NULL;
  878.  
  879.    switch (msg) {
  880.    case WM_INITDLG:
  881.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  882.       param = (XBitmapFilterPageParameter*) mp2;
  883.       fltParam = (XSpriteImportFilter*) param->fltParam;
  884.  
  885.       SetSpinButton (hwnd, IDC_SPRITE_INDEX, fltParam->uIndex, 0, 65535);
  886.       break;
  887.    case WM_USER | WM_COMMAND:
  888.       if (DID_OK == SHORT1FROMMP (mp1))
  889.          WinSendDlgItemMsg (hwnd, IDC_SPRITE_INDEX, SPBM_QUERYVALUE, 
  890.             MPFROMP (&fltParam->uIndex), 0);
  891.       break;
  892.    }
  893.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  894. }
  895.  
  896. /******************************************************************************/
  897. MRESULT TargaExportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {   
  898.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  899.    XTargaExportFilter* fltParam = NULL != param ? (XTargaExportFilter*) param->fltParam : NULL;
  900.  
  901.    switch (msg) {
  902.    case WM_INITDLG:
  903.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  904.       param = (XBitmapFilterPageParameter*) mp2;
  905.       fltParam = (XTargaExportFilter*) param->fltParam;
  906.  
  907.       WinCheckButton (hwnd, IDC_TARGA_YDOWN + 
  908.          fltParam->cDirection, TRUE);
  909.       break;
  910.    case WM_USER | WM_COMMAND: 
  911.       if (DID_OK == SHORT1FROMMP (mp1))
  912.          if (WinQueryButtonCheckstate (hwnd, IDC_TARGA_YDOWN))
  913.             fltParam->cDirection = BFP_TARGA_START_AT_BOTTOM;
  914.          else
  915.             fltParam->cDirection = BFP_TARGA_START_AT_TOP;
  916.       break;
  917.    }
  918.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  919. }
  920.  
  921. /******************************************************************************/
  922. MRESULT TIFFImportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  923.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  924.    XTIFFImportFilter* fltParam = NULL != param ? (XTIFFImportFilter*) param->fltParam : NULL;
  925.  
  926.    switch (msg) {
  927.    case WM_INITDLG:
  928.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  929.       param = (XBitmapFilterPageParameter*) mp2;
  930.       fltParam = (XTIFFImportFilter*) param->fltParam;
  931.  
  932.       SetSpinButton (hwnd, IDC_TIFF_INDEX, fltParam->uIndex, 0, 65535);
  933.       break;
  934.    case WM_USER | WM_COMMAND:
  935.       if (DID_OK == SHORT1FROMMP (mp1))
  936.          WinSendDlgItemMsg (hwnd, IDC_TIFF_INDEX, SPBM_QUERYVALUE, 
  937.             MPFROMP (&fltParam->uIndex), 0);
  938.       break;
  939.    }
  940.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  941. }
  942.  
  943. /******************************************************************************/
  944. MRESULT TIFFExportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  945.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  946.    XTIFFExportFilter* fltParam = NULL != param ? (XTIFFExportFilter*) param->fltParam : NULL;
  947.    static char* tagValue [BFP_TIFF_TAGCOUNT];
  948.    static int   tagID;
  949.    char tagName [64];
  950.  
  951.    switch (msg) {
  952.    case WM_PAINT:
  953.       WinEnableControl (hwnd, 
  954.          IDC_TIFF_MONOPAL, BFP_BPP_MONOCHROME == GetBitCount (param->bppID));
  955.       break;
  956.    case WM_INITDLG:
  957.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  958.       param = (XBitmapFilterPageParameter*) mp2;
  959.       fltParam = (XTIFFExportFilter*) param->fltParam;
  960.  
  961.       WinCheckButton (hwnd, IDC_TIFF_LZW, fltParam->fLZW);
  962.       WinCheckButton (hwnd, IDC_TIFF_MONOPAL, fltParam->fMonoPal);
  963.  
  964.       for (tagID = 0; tagID < BFP_TIFF_TAGCOUNT; tagID++)  {
  965.          WinLoadString (fltParam->hab, param->hmod, 
  966.             param->profile->languageBase + IDR_ARTIST + tagID, 64, tagName);
  967.          WinSendDlgItemMsg (hwnd, IDC_TIFF_TAG, LM_INSERTITEM, 
  968.             MPFROMLONG (LIT_END), MPFROMP (tagName));
  969.          if (NULL != fltParam->pszTagValue [tagID])
  970.             tagValue [tagID] = strdup ((char*) fltParam->pszTagValue [tagID]);
  971.          else
  972.             tagValue [tagID] = strdup ("");
  973.       }
  974.        WinSendDlgItemMsg (hwnd, IDC_TIFF_TAG, LM_SELECTITEM, 
  975.          MPFROMSHORT (tagID = 0), MPFROMSHORT (TRUE));
  976.       WinSetDlgItemText (hwnd, IDC_TIFF_TAG_TEXT, tagValue [tagID]);
  977.  
  978. /*      if (NULL == fltParam->pszTagValue [BFP_TIFF_MAKE]) {
  979.          time_t t;
  980.          free (tagValue [BFP_TIFF_MAKE]);
  981.          time (&t);
  982.          tagValue [BFP_TIFF_MAKE] = strdup (ctime (&t));
  983.       } */
  984.       if (NULL == fltParam->pszTagValue [BFP_TIFF_DOCNAME]) {
  985.          time_t t;
  986.          free (tagValue [BFP_TIFF_DOCNAME]);
  987.          tagValue [BFP_TIFF_DOCNAME] = strdup (param->filename);
  988.       }
  989.  
  990.       WinCheckButton (hwnd, IDC_TIFF_REPLACE, TRUE);
  991.       break;
  992.    case WM_CONTROL:
  993.       switch (SHORT1FROMMP (mp1)) {
  994.       case IDC_TIFF_REPLACE:
  995.          WinEnableControl (hwnd, IDC_TIFF_REPLACEMENT, 
  996.             WinQueryButtonCheckstate (hwnd, IDC_TIFF_REPLACE));
  997.          break;
  998.       case IDC_TIFF_TAG:
  999.          if (LN_SELECT == SHORT2FROMMP (mp1)) {
  1000.             ULONG l;
  1001.  
  1002.             free (tagValue [tagID]);
  1003.             l = WinQueryDlgItemTextLength (hwnd, IDC_TIFF_TAG_TEXT) + 1;
  1004.             tagValue [tagID] = malloc (l);
  1005.             WinQueryDlgItemText (hwnd, IDC_TIFF_TAG_TEXT, l, tagValue [tagID]);
  1006.                
  1007.             WinDefWindowProc (hwnd, msg, mp1, mp2);
  1008.             tagID = SHORT1FROMMR (WinSendDlgItemMsg (hwnd, IDC_TIFF_TAG,
  1009.                LM_QUERYSELECTION, 0, 0));
  1010.             WinSetDlgItemText (hwnd, IDC_TIFF_TAG_TEXT, tagValue [tagID]);
  1011.          }
  1012.          break;
  1013.       }
  1014.    case WM_USER | WM_COMMAND:
  1015.       if (DID_OK == SHORT1FROMMP (mp1)) {
  1016.          BOOL fReplace = WinQueryButtonCheckstate (hwnd, IDC_TIFF_REPLACE);
  1017.          char rValue [2];
  1018.          WinQueryDlgItemText (hwnd, IDC_TIFF_REPLACEMENT, 2, rValue);
  1019.  
  1020.          fltParam->fLZW = WinQueryButtonCheckstate (hwnd, IDC_TIFF_LZW);
  1021.          if (BFP_BPP_MONOCHROME == GetBitCount (param->bppID))
  1022.             fltParam->fMonoPal = WinQueryButtonCheckstate (hwnd, IDC_TIFF_MONOPAL);
  1023.          for (tagID = 0; tagID < BFP_TIFF_TAGCOUNT; tagID++)
  1024.             if (strlen (tagValue [tagID])) {
  1025.                char* s;
  1026.                if (fReplace) for (s = tagValue [tagID]; *s; s++)
  1027.                   if (' ' == *s) *s = *rValue;
  1028.                fltParam->pszTagValue [tagID] = tagValue [tagID];
  1029.             } else {
  1030.                free (tagValue [tagID]);
  1031.                fltParam->pszTagValue [tagID] = NULL;
  1032.             }
  1033.       }
  1034.       break;
  1035.    }
  1036.  
  1037.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  1038. }
  1039.  
  1040. /******************************************************************************/
  1041. MRESULT YUV12CExportWndProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
  1042.    XBitmapFilterPageParameter* param = (XBitmapFilterPageParameter*) WinQueryWindowPtr (hwnd, 0);
  1043.    XYUV12CExportFilter* fltParam = NULL != param ? (XYUV12CExportFilter*) param->fltParam : NULL;
  1044.  
  1045.    switch (msg) {
  1046.    case WM_INITDLG:
  1047.       WinSetWindowPtr (hwnd, 0, (PVOID*) mp2);
  1048.       param = (XBitmapFilterPageParameter*) mp2;
  1049.       fltParam = (XYUV12CExportFilter*) param->fltParam;
  1050.  
  1051.       SetSpinButton (hwnd, IDC_YUV12C_POSITION_X, fltParam->ulPosX, 0, 65535);
  1052.       SetSpinButton (hwnd, IDC_YUV12C_POSITION_Y, fltParam->ulPosY, 0, 65535);
  1053.       break;
  1054.    case WM_USER | WM_COMMAND:
  1055.       if (DID_OK == SHORT1FROMMP (mp1)) {
  1056.          WinSendDlgItemMsg (hwnd, IDC_YUV12C_POSITION_X, SPBM_QUERYVALUE, 
  1057.             MPFROMP (&fltParam->ulPosX), 0);
  1058.          WinSendDlgItemMsg (hwnd, IDC_YUV12C_POSITION_Y, SPBM_QUERYVALUE, 
  1059.             MPFROMP (&fltParam->ulPosY), 0);
  1060.       }
  1061.       break;
  1062.    }
  1063.    return XGLibDlgProc (hwnd, msg, mp1, mp2);
  1064. }
  1065.  
  1066. PFNWP GetImportWinProc (UCHAR cFilterID) {
  1067.    switch (cFilterID) {
  1068.    case BFT_Bitmap:   return BitmapImportWndProc;
  1069. /* case BFT_GEM:      return GEMImportWndProc;     */
  1070.    case BFT_GIF:      return GIFImportWndProc;
  1071.    case BFT_Greymap:  return GreymapImportWndProc;
  1072.    case BFT_IAX:      return IAXImportWndProc;
  1073. /* case BFT_ILBM:     return ILBMImportWndProc;    */
  1074. /* case BFT_JPEG:     return JPEGImportWndProc;    */
  1075.    case BFT_KIPS:     return KIPSImportWndProc;    
  1076.    case BFT_PCX:      return PCXImportWndProc;
  1077. /* case BFT_Pixmap:   return PixmapImportWndProc;  */
  1078. /* case BFT_Portrait: return PortraitImportWndProc;*/
  1079.    case BFT_PSeg:     return PSegImportWndProc;
  1080.    case BFT_Sprite:   return SpriteImportWndProc;
  1081. /*   case BFT_Targa:    return TargaImportWndProc; */
  1082.    case BFT_TIFF:     return TIFFImportWndProc;
  1083. /* case BFT_XBitmap:  return XBitmapImportWndProc; */
  1084. /* case BFT_YUV12C:   return YUV12CImportWndProc;  */
  1085.    default:           return NULL;
  1086.    }
  1087. }
  1088.  
  1089. PFNWP GetExportWinProc (UCHAR cFilterID) {
  1090.    switch (cFilterID) {
  1091.    case BFT_Bitmap:   return BitmapExportWndProc;
  1092.    case BFT_GEM:      return GEMExportWndProc;
  1093.    case BFT_GIF:      return GIFExportWndProc;
  1094. /*   case BFT_Greymap:  return GreymapExportWndProc; */
  1095. /*   case BFT_IAX:      return IAXExportWndProc; */
  1096.    case BFT_ILBM:     return ILBMExportWndProc;
  1097.    case BFT_JPEG:     return JPEGExportWndProc;
  1098.    case BFT_KIPS:     return KIPSExportWndProc;
  1099. /* case BFT_PCX:      return PCXExportWndProc;     */
  1100. /* case BFT_Pixmap:   return PixmapExportWndProc;  */
  1101. /* case BFT_Portrait: return PortraitExportWndProc;*/
  1102.    case BFT_PSeg:     return PSegExportWndProc;
  1103. /* case BFT_Sprite:   return SpriteExportWndProc;  */
  1104.    case BFT_Targa:    return TargaExportWndProc;   
  1105.    case BFT_TIFF:     return TIFFExportWndProc;
  1106. /* case BFT_XBitmap:  return XBitmapExportWndProc; */
  1107.    case BFT_YUV12C:   return YUV12CExportWndProc;
  1108.    default:           return NULL;
  1109.    }
  1110. }
  1111.  
  1112. ULONG AddBitmapFilterPage (USHORT resID, PFNWP WinProc, XBitmapFilterPageParameter* param, int num) {
  1113.    HWND  hwndPage;
  1114.    UCHAR title [512];
  1115.  
  1116.    if (NULLHANDLE == (hwndPage = WinLoadDlg (param->hwndNoteBook, 
  1117.       param->hwndNoteBook, WinProc, param->hmod, resID, param))) {
  1118.       WinDestroyWindow (param->hwndDialog);
  1119.       returnUL (BFE_OS2 | WinGetLastError (param->fltParam->hab));
  1120.    }
  1121.  
  1122.    if (0 == (param->pageID [num] = LONGFROMMR (WinSendMsg (param->hwndNoteBook, 
  1123.          BKM_INSERTPAGE, MPFROMLONG (0), 
  1124.          MPFROM2SHORT (BKA_MAJOR | BKA_STATUSTEXTON, BKA_LAST))))) {
  1125.       WinDestroyWindow (param->hwndDialog);
  1126.       returnUL (BFE_OS2 | WinGetLastError (param->fltParam->hab));
  1127.    }
  1128.  
  1129.    if (FALSE == WinSendMsg (param->hwndNoteBook, BKM_SETPAGEWINDOWHWND, 
  1130.       MPFROMLONG (param->pageID [num]), MPFROMHWND (hwndPage)))  {
  1131.       WinDestroyWindow (param->hwndDialog);
  1132.       returnUL (BFE_OS2 | WinGetLastError (param->fltParam->hab));
  1133.    }
  1134.  
  1135.    if (0 == WinLoadString (param->fltParam->hab, param->hmod, resID, 512, title)) {
  1136.       WinDestroyWindow (param->hwndDialog);
  1137.       returnUL (BFE_OS2 | WinGetLastError (param->fltParam->hab));
  1138.    }
  1139.    WinSendMsg (param->hwndNoteBook, BKM_SETTABTEXT, MPFROMLONG (param->pageID [num]), MPFROMP (title));
  1140.  
  1141.    return BFE_OK;
  1142. }
  1143.  
  1144. /******************************************************************************/
  1145. MRESULT BitmapFilterDialog (HWND owner, XBitmapFilterPageParameter* pageParams, 
  1146.    USHORT fltResID, PFNWP proc) {
  1147.    XBitmapFilter* param = pageParams->fltParam; /* für returnMR */ 
  1148.    ULONG  rc;
  1149.    UCHAR  buffer [512];
  1150.    ULONG  osMajor, osMinor;
  1151.    USHORT resID;
  1152.    SWP    swp;
  1153.  
  1154.    DosQuerySysInfo (QSV_VERSION_MAJOR, QSV_VERSION_MAJOR, &osMajor, sizeof (osMajor));
  1155.    DosQuerySysInfo (QSV_VERSION_MINOR, QSV_VERSION_MINOR, &osMinor, sizeof (osMinor));
  1156.    resID = pageParams->profile->languageBase + 
  1157.       ((osMajor > 20 || (osMajor == 20 && osMinor >= 40)) ?
  1158.        IDR_FILTER_PARAMETERS_WARP4 : IDR_FILTER_PARAMETERS);
  1159.  
  1160.    if (NO_ERROR != (rc = DosLoadModule (buffer, 512, (PSZ) "OOLRES", &pageParams->hmod)))
  1161.       returnMR (BFE_OS2 | rc);
  1162. printf("%i", resID);
  1163.    if (NULLHANDLE == (pageParams->hwndDialog = WinLoadDlg (HWND_DESKTOP, owner, 
  1164.       FilterSetupWinProc, pageParams->hmod, resID, pageParams)))
  1165.       returnMR (BFE_OS2 | WinGetLastError (param->hab));
  1166.    strncpy (buffer, pageParams->filename, 511);
  1167.    WinQueryWindowText (pageParams->hwndDialog, 512 - strlen (buffer), buffer + strlen (buffer));
  1168.    WinSetWindowText (pageParams->hwndDialog, buffer);
  1169.  
  1170.    pageParams->hwndNoteBook = WinWindowFromID (pageParams->hwndDialog, IDC_NOTEBOOK);
  1171.  
  1172.    WinSendMsg (pageParams->hwndNoteBook, BKM_SETNOTEBOOKCOLORS, 
  1173.       MPFROMLONG (WinQuerySysColor (HWND_DESKTOP, SYSCLR_DIALOGBACKGROUND, 0)),
  1174.       MPFROMLONG (BKA_BACKGROUNDPAGECOLOR));
  1175.  
  1176.    if (BFE_OK != (rc = AddBitmapFilterPage (pageParams->profile->languageBase + 
  1177.       IDR_COLOR_CONV_PAGE, ColorSetupWinProc, pageParams, 0)))
  1178.       return (MRESULT) rc;
  1179.    if (NULL != proc) {
  1180.       if (BFE_OK != (rc = AddBitmapFilterPage (fltResID, proc, pageParams, 1)))
  1181.          return (MRESULT) rc;
  1182.    } else
  1183.       pageParams->pageID [1] = 0;
  1184.  
  1185. /* Richtige Breite für Warp3-Tabs... */
  1186.    if (pageParams->profile->languageBase + IDR_FILTER_PARAMETERS == resID) {
  1187.       int    tabCX, tabCY;
  1188.       HPS    hpsNB;
  1189.       POINTL textBox [4];
  1190.    
  1191.       hpsNB = WinGetPS (pageParams->hwndNoteBook);
  1192.       WinLoadString (pageParams->fltParam->hab, pageParams->hmod,
  1193.          pageParams->profile->languageBase + IDR_COLOR_CONV_PAGE, 512, buffer);
  1194.       GpiQueryTextBox (hpsNB, strlen (buffer), buffer, 4, textBox);
  1195.       tabCX = textBox [2].x - textBox [0].x + 1;
  1196.       tabCY = textBox [0].y - textBox [1].y + 11;
  1197.       if (NULL != proc) {
  1198.          WinLoadString (pageParams->fltParam->hab, pageParams->hmod,
  1199.             fltResID, 512, buffer);
  1200.          GpiQueryTextBox (hpsNB, strlen (buffer), buffer, 4, textBox);
  1201.          if (tabCX < (textBox [2].x - textBox [0].x + 1))
  1202.             tabCX = textBox [2].x - textBox [0].x + 1;
  1203.       }
  1204.       WinReleasePS (hpsNB);
  1205.       WinSendMsg (pageParams->hwndNoteBook, BKM_SETDIMENSIONS, 
  1206.          MPFROM2SHORT (tabCX, tabCY), (MPARAM) BKA_MAJORTAB);
  1207.  
  1208.       WinQueryWindowPos (pageParams->hwndDialog, &swp);
  1209.       WinSetWindowPos (pageParams->hwndDialog, NULLHANDLE, 0, 0,
  1210.          swp.cx + tabCX, swp.cy, SWP_SIZE);
  1211.       WinQueryWindowPos (pageParams->hwndNoteBook, &swp);
  1212.       WinSetWindowPos (pageParams->hwndNoteBook, NULLHANDLE, 0, 0,
  1213.          swp.cx + tabCX, swp.cy, SWP_SIZE);
  1214.    }
  1215.    WinQueryWindowPos (pageParams->hwndDialog, &swp);
  1216.    WinSetWindowPos (pageParams->hwndDialog, NULLHANDLE,
  1217.       (WinQuerySysValue (HWND_DESKTOP, SV_CXSCREEN) - swp.cx) >> 1,
  1218.       (WinQuerySysValue (HWND_DESKTOP, SV_CYSCREEN) - swp.cy) >> 1,
  1219.       0, 0, SWP_MOVE);
  1220.  
  1221.    param->command = WinProcessDlg (pageParams->hwndDialog);
  1222.    WinDestroyWindow (pageParams->hwndDialog);
  1223.  
  1224.    DosFreeModule (pageParams->hmod);
  1225.    return (MRESULT) BFE_OK;
  1226. }
  1227.