Ignore:
Timestamp:
Apr 17, 2002, 10:11:38 PM (23 years ago)
Author:
umoeller
Message:

Patches from Martin and Paul, plus regexp support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/dialog.c

    r153 r155  
    4646#define INCL_WINWINDOWMGR
    4747#define INCL_WINFRAMEMGR
     48#define INCL_WINPOINTERS
     49#define INCL_WININPUT
    4850#define INCL_WINDIALOGS
    49 #define INCL_WININPUT
    5051#define INCL_WINSTATICS
    5152#define INCL_WINBUTTONS
     
    123124    LONG        lcidLast;
    124125    FONTMETRICS fmLast;
     126
     127    LONG        cxBorder,
     128                cyBorder;           // cached now V0.9.19 (2002-04-17) [umoeller]
    125129
    126130} DLGPRIVATE, *PDLGPRIVATE;
     
    409413                else if (!(pControlDef->flStyle & BS_USERBUTTON))
    410414                {
    411                     pszlAuto->cx += (2 * WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER) + 15);
    412                     pszlAuto->cy += (2 * WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER) + 15);
     415                    pszlAuto->cx += (2 * pDlgData->cxBorder + 15);
     416                    pszlAuto->cy += (2 * pDlgData->cyBorder + 15);
    413417                }
    414418            }
     
    477481                              PDLGPRIVATE pDlgData)
    478482{
    479     APIRET arc = NO_ERROR;
    480 
     483    APIRET      arc = NO_ERROR;
     484    PCONTROLDEF pControlDef = NULL;
    481485    ULONG       ulExtraCX = 0,
    482486                ulExtraCY = 0;
     487
    483488    if (pColumnDef->fIsNestedTable)
    484489    {
     
    519524    {
    520525        // no nested table, but control:
    521         PCONTROLDEF pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition;
    522526        SIZEL       szlAuto;
     527
     528        pControlDef = (PCONTROLDEF)pColumnDef->pvDefinition;
    523529
    524530        // do auto-size calculations only on the first loop
     
    576582        } // end if (ProcessMode == PROCESS_1_CALC_SIZES)
    577583
    578 
    579584        ulExtraCX
    580585        = ulExtraCY
     
    586591    pColumnDef->cpColumn.cy =   pColumnDef->cpControl.cy
    587592                               + ulExtraCY;
     593
     594    if (    (pControlDef)
     595         && ((ULONG)pControlDef->pcszClass == 0xffff0002L)
     596       )
     597    {
     598        // hack the stupid drop-down combobox where the
     599        // size of the drop-down is the full size of the
     600        // control: when creating the control, we _do_
     601        // specify the full size, but for the column,
     602        // we must rather use a single line with
     603        // the current font
     604        // V0.9.19 (2002-04-17) [umoeller]
     605        if (pControlDef->flStyle & (CBS_DROPDOWN | CBS_DROPDOWNLIST))
     606        {
     607            LONG cyMargin = 3 * pDlgData->cyBorder;
     608
     609            SetDlgFont(pControlDef, pDlgData);
     610
     611            pColumnDef->cpColumn.cy
     612                =   pDlgData->fmLast.lMaxBaselineExt
     613                  + pDlgData->fmLast.lExternalLeading
     614                  + 2 * cyMargin
     615                  + ulExtraCY;
     616        }
     617    }
    588618
    589619    return (arc);
     
    802832
    803833            case 0xffff0002L:   // combobox
    804                 // hack the stupid drop-down combobox which doesn't
    805                 // expand otherwise (the size of the drop-down is
    806                 // the full size of the control... duh)
     834            {
    807835                if (flStyle & (CBS_DROPDOWN | CBS_DROPDOWNLIST))
    808836                {
    809                     y -= 100;
    810                     cy += 100;
     837                    // in ColumnCalcSizes, we have set pColumnDef->cpColumn.cy
     838                    // to the height of a single line to get the position
     839                    // calculations right...
     840                    // present cy is pColumnDef->cpControl.cy,
     841                    // the user-specified size of the expanded combo
     842                    // present y is the bottom of the combo's entry field
     843                    ULONG cyDelta = pColumnDef->cpControl.cy - pColumnDef->cpColumn.cy;
     844                    _Pmpf((__FUNCTION__ ": combo cpColumn.cy = %d, cpControl.cy = %d",
     845                            pColumnDef->cpColumn.cy,
     846                            pColumnDef->cpControl.cy));
     847                    _Pmpf(("   cyDelta = %d", cyDelta));
     848                    y -= cyDelta + 3 * pDlgData->cyBorder + pControlDef->ulSpacing;
     849                    // cy += cyDelta;
    811850                }
     851            }
    812852            break;
    813853
     
    819859                if (flStyle & ES_MARGIN)
    820860                {
    821                     LONG cxMargin = 3 * WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER);
    822                     LONG cyMargin = 3 * WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER);
     861                    LONG cxMargin = 3 * pDlgData->cxBorder;
     862                    LONG cyMargin = 3 * pDlgData->cyBorder;
    823863
    824864                    x += cxMargin;
     
    877917                                NULL,
    878918                                NULL);
     919                winhSetPresColor(hwndDebug, PP_FOREGROUNDCOLOR, RGBCOL_DARKGREEN);
     920
     921                /*
     922                // and another one for the control size
     923                hwndDebug =
     924                   WinCreateWindow(pDlgData->hwndDlg,   // parent
     925                                WC_STATIC,
     926                                "",
     927                                WS_VISIBLE | SS_FGNDFRAME,
     928                                pColumnDef->cpControl.x + pDlgData->ptlTotalOfs.x,
     929                                pColumnDef->cpControl.y + pDlgData->ptlTotalOfs.y,
     930                                pColumnDef->cpControl.cx,
     931                                pColumnDef->cpControl.cy,
     932                                pDlgData->hwndDlg,   // owner
     933                                HWND_BOTTOM,
     934                                -1,
     935                                NULL,
     936                                NULL);
    879937                winhSetPresColor(hwndDebug, PP_FOREGROUNDCOLOR, RGBCOL_RED);
     938                */
    880939            }
    881940#endif
     
    14721531
    14731532    pDlgData->pcszControlsFont = pcszControlsFont;
     1533
     1534    // cache these now too V0.9.19 (2002-04-17) [umoeller]
     1535    pDlgData->cxBorder = WinQuerySysValue(HWND_DESKTOP, SV_CXBORDER);
     1536    pDlgData->cyBorder = WinQuerySysValue(HWND_DESKTOP, SV_CYBORDER);
    14741537
    14751538    *ppDlgData = pDlgData;
     
    17991862 *      A regular standard dialog would use something like
    18001863 *
    1801  +          FCF_TITLEBAR | FCF_SYSMENU | FCF_DLGBORDER | FCF_NOBYTEALIGN
     1864 +          FCF_TITLEBAR | FCF_SYSMENU | FCF_DLGBORDER | FCF_NOBYTEALIGN | FCF_CLOSEBUTTON
    18021865 *
    18031866 *      for flCreateFlags. To make the dlg sizeable, specify
    18041867 *      FCF_SIZEBORDER instead of FCF_DLGBORDER.
     1868 *
     1869 *      dialog.h defines FCF_FIXED_DLG and FCF_SIZEABLE_DLG
     1870 *      to make this more handy.
    18051871 *
    18061872 *      <B>Usage:</B>
Note: See TracChangeset for help on using the changeset viewer.