Changeset 155 for trunk/src


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

Patches from Martin and Paul, plus regexp support.

Location:
trunk/src/helpers
Files:
1 added
6 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>
  • trunk/src/helpers/encodings.c

    r154 r155  
    4444
    4545#pragma hdrstop
     46
     47/*
     48 *@@category: Helpers\National Language Support\Encodings
     49 *      See encodings.c.
     50 */
    4651
    4752/*
  • trunk/src/helpers/helpers_pre.in

    r137 r155  
    4343$(OUTPUTDIR)\linklist.obj \
    4444$(OUTPUTDIR)\math.obj \
     45$(OUTPUTDIR)\regexp.obj \
    4546$(OUTPUTDIR)\tree.obj \
    4647$(OUTPUTDIR)\xml.obj \
  • trunk/src/helpers/nls.c

    r147 r155  
    6666
    6767/*
    68  *@@category: Helpers\C helpers\National Language Support
    69  *      See stringh.c and xstring.c.
     68 *@@category: Helpers\National Language Support
     69 *      See nls.c.
    7070 */
    7171
  • trunk/src/helpers/prfh.c

    r153 r155  
    8989 *
    9090 *@@changed V0.9.12 (2001-05-12) [umoeller]: changed prototypes to return APIRET now
     91 *@@changed V0.9.19 (2002-04-11) [pr]: Fixed app. with no keys
    9192 */
    9293
     
    100101
    101102    // get size of keys list for pszApp
    102     if (    (!PrfQueryProfileSize(hIni, (PSZ)pcszApp, NULL, &ulSizeOfKeysList))
    103          || (ulSizeOfKeysList == 0)
    104        )
     103    if (!PrfQueryProfileSize(hIni, (PSZ)pcszApp, NULL, &ulSizeOfKeysList))
    105104        arc = PRFERR_KEYSLIST;
    106105    else
    107106    {
    108         pKeys = (PSZ)malloc(ulSizeOfKeysList);
    109         if (!pKeys)
     107        if (ulSizeOfKeysList == 0)
     108            ulSizeOfKeysList = 1;    // V0.9.19 (2002-04-11) [pr]
     109
     110        if (!(pKeys = (PSZ)malloc(ulSizeOfKeysList)))
    110111            arc = ERROR_NOT_ENOUGH_MEMORY;
    111112        else
     113        {
     114            *pKeys = 0;
    112115            if (!PrfQueryProfileData(hIni, (PSZ)pcszApp, NULL, pKeys, &ulSizeOfKeysList))
    113116                arc = PRFERR_KEYSLIST;
     117        }
    114118    }
    115119
  • trunk/src/helpers/winh.c

    r154 r155  
    25632563
    25642564/*
     2565 *@@ winhPlaceBesides:
     2566 *      attempts to place hwnd somewhere besides
     2567 *      hwndRelative.
     2568 *
     2569 *      fl is presently ignored, but should be
     2570 *      PLF_SMART for future extensions.
     2571 *
     2572 *      Works only if hwnd is a desktop child.
     2573 *
     2574 *@@added V0.9.19 (2002-04-17) [umoeller]
     2575 */
     2576
     2577BOOL winhPlaceBesides(HWND hwnd,
     2578                      HWND hwndRelative,
     2579                      ULONG fl)
     2580{
     2581    BOOL brc = FALSE;
     2582
     2583    SWP     swpRel,
     2584            swpThis;
     2585    LONG    xNew, yNew;
     2586
     2587    if (    (WinQueryWindowPos(hwndRelative, &swpRel))
     2588         && (WinQueryWindowPos(hwnd, &swpThis))
     2589       )
     2590    {
     2591        HWND    hwndRelParent,
     2592                hwndThisParent;
     2593        POINTL  ptlRel = {swpRel.x, swpRel.y};
     2594        if (    (hwndRelParent = WinQueryWindow(hwndRelative, QW_PARENT))
     2595             && (hwndThisParent = WinQueryWindow(hwnd, QW_PARENT))
     2596             && (hwndRelParent != hwndThisParent)
     2597           )
     2598        {
     2599            WinMapWindowPoints(hwndRelParent,
     2600                               hwndThisParent,
     2601                               &ptlRel,
     2602                               1);
     2603        }
     2604
     2605        // place right first
     2606        xNew = ptlRel.x + swpRel.cx;
     2607        // center vertically
     2608        yNew = ptlRel.y  + ((swpRel.cy - swpThis.cy) / 2);
     2609
     2610        if (xNew + swpThis.cy > WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))
     2611        {
     2612            // place left then
     2613            xNew = ptlRel.x - swpThis.cx;
     2614
     2615            if (xNew < 0)
     2616            {
     2617                // center then
     2618                winhCenterWindow(hwnd);
     2619                brc = TRUE;
     2620            }
     2621        }
     2622
     2623        if (!brc)
     2624            brc = WinSetWindowPos(hwnd,
     2625                                  0,
     2626                                  xNew,
     2627                                  yNew,
     2628                                  0,
     2629                                  0,
     2630                                  SWP_MOVE);
     2631    }
     2632
     2633    return brc;
     2634}
     2635
     2636/*
    25652637 *@@ winhFindWindowBelow:
    25662638 *      finds the window with the same parent
Note: See TracChangeset for help on using the changeset viewer.