Ignore:
Timestamp:
Jan 29, 2003, 7:41:39 PM (23 years ago)
Author:
umoeller
Message:

New build system, multimedia, other misc fixes.

File:
1 edited

Legend:

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

    r242 r243  
    1515#define INCL_WINSTDCNR
    1616#define INCL_WINSTDFILE
     17#define INCL_WINTIMER
    1718
    1819#include <os2.h>
     
    2930#include "helpers\cnrh.h"
    3031#include "helpers\comctl.h"
     32#include "helpers\nls.h"
    3133#include "helpers\standards.h"
     34#include "helpers\stringh.h"
    3235#include "helpers\winh.h"
    3336#include "helpers\gpih.h"
     
    106109} GROUPRECORD, *PGROUPRECORD;
    107110
     111PFNWP G_pfnwpFrameOrig;
     112
     113#define RECORD_COUNT        20000
     114
     115PGROUPRECORD G_paRecs[RECORD_COUNT];
     116
     117CHAR    G_szText[] = "Longer test string with increasing length";
     118
     119/*
     120 *@@ fnwpSubclFrame:
     121 *
     122 */
     123
     124MRESULT EXPENTRY fnwpSubclFrame(HWND hwndFrame, ULONG msg, MPARAM mp1, MPARAM mp2)
     125{
     126    MRESULT mrc = 0;
     127
     128    switch (msg)
     129    {
     130        case WM_COMMAND:
     131            if (SHORT1FROMMP(mp1) == 1000)
     132                ShowFileDlg(hwndFrame);
     133        break;
     134
     135        case WM_CONTROL:
     136            if (SHORT1FROMMP(mp1) == FID_CLIENT)
     137            {
     138                switch (SHORT2FROMMP(mp1))
     139                {
     140                    case CN_VIEWPORTCHANGED:
     141                    {
     142                        PCNRVIEWPORT pcvp = (PCNRVIEWPORT)mp2;
     143
     144                        CHAR szTemp[100],
     145                             szNLS1[20],
     146                             szNLS2[20],
     147                             szNLS3[20],
     148                             szNLS4[20],
     149                             szNLS5[20],
     150                             szNLS6[20];
     151                        sprintf(szTemp,
     152                                "Win: (%s/%s), WArea: (%s/%s), scrl: (%s/%s)",
     153                                nlsThousandsULong(szNLS1,
     154                                                  pcvp->szlWin.cx,
     155                                                  '.'),
     156                                nlsThousandsULong(szNLS2,
     157                                                  pcvp->szlWin.cy,
     158                                                  '.'),
     159                                nlsThousandsULong(szNLS3,
     160                                                  pcvp->szlWorkarea.cx,
     161                                                  '.'),
     162                                nlsThousandsULong(szNLS4,
     163                                                  pcvp->szlWorkarea.cy,
     164                                                  '.'),
     165                                nlsThousandsULong(szNLS5,
     166                                                  pcvp->ptlScroll.x,
     167                                                  '.'),
     168                                nlsThousandsULong(szNLS6,
     169                                                  pcvp->ptlScroll.y,
     170                                                  '.'));
     171                        WinSetWindowText(WinWindowFromID(hwndFrame, FID_STATUSBAR),
     172                                         szTemp);
     173                    }
     174                    break;
     175
     176                    case CN_ENTER:
     177                    {
     178                        CHAR sz[100];
     179                        PCSZ pcsz;
     180                        PNOTIFYRECORDENTER pnre = (PNOTIFYRECORDENTER)mp2;
     181                        if (!pnre->pRecord)
     182                            pcsz = "Whitespace";
     183                        else
     184                        {
     185                            sprintf(sz, "group %d", ((PGROUPRECORD)pnre->pRecord)->gid);
     186                            pcsz = sz;
     187                        }
     188                        winhDebugBox(hwndFrame,
     189                                     "Enter pressed",
     190                                     pcsz);
     191                    }
     192                    break;
     193                }
     194            }
     195        break;
     196
     197        case WM_TIMER:
     198            if ((ULONG)mp1 == 1)
     199            {
     200                static ul = 0,
     201                       ul2 = 1;
     202
     203                HWND    hwndCnr = WinWindowFromID(hwndFrame, FID_CLIENT);
     204
     205                PGROUPRECORD precThis = G_paRecs[ul];
     206
     207                ULONG ulTimeNow;
     208                DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,
     209                                &ulTimeNow,
     210                                sizeof(ulTimeNow));
     211
     212                strhncpy0(precThis->szGroupName,
     213                          G_szText,
     214                          ul2++);
     215
     216                WinSendMsg(hwndCnr,
     217                           CM_INVALIDATERECORD,
     218                           (MPARAM)&precThis,
     219                           MPFROM2SHORT(1, CMA_ERASE | CMA_TEXTCHANGED));
     220
     221                if (++ul >= RECORD_COUNT)
     222                    ul = 0;
     223                if (ul2 > strlen(G_szText))
     224                    ul2 = 1;
     225            }
     226            else
     227                mrc = G_pfnwpFrameOrig(hwndFrame, msg, mp1, mp2);
     228        break;
     229
     230        default:
     231            mrc = G_pfnwpFrameOrig(hwndFrame, msg, mp1, mp2);
     232        break;
     233
     234    }
     235
     236    return mrc;
     237}
     238
    108239/*
    109240 *@@ main:
     
    203334                  | FCF_SHELLPOSITION
    204335                  | FCF_TASKLIST,
    205             0, // XFCF_TOOLBAR | XFCF_FORCETBOWNER | XFCF_STATUSBAR,
     336            XFCF_TOOLBAR | XFCF_FORCETBOWNER | XFCF_STATUSBAR,
    206337            WS_VISIBLE,                         // ulFrameStyle
    207338            "Test File Dialog",                 // pcszFrameTitle
    208339            0,                                  // ulResourcesID
    209 #if 1
     340#ifdef __USE_PM_CNR__
     341            WC_CONTAINER,
     342#else
    210343            WC_CCTL_CNR,
    211 #else
    212             WC_CONTAINER,
    213344#endif
    214             WS_VISIBLE,                         // flStyleClient
     345            WS_VISIBLE | CCS_EXTENDSEL,       // flStyleClient
    215346            0,                                  // ulID
    216347            NULL,
     
    262393    WinSendMsg(hwndFrame, WM_UPDATEFRAME, MPNULL, MPNULL);
    263394
     395    if (G_pfnwpFrameOrig = WinSubclassWindow(hwndFrame, fnwpSubclFrame))
    264396    {
    265397        XFIELDINFO  xfi[4];
     
    270402        // set up cnr details view
    271403        xfi[i].ulFieldOffset = FIELDOFFSET(GROUPRECORD, gid);
    272         xfi[i].pszColumnTitle = "Group ID";     // @@todo localize
     404        xfi[i].pszColumnTitle = "gid";
    273405        xfi[i].ulDataType = CFA_ULONG;
    274406        xfi[i++].ulOrientation = CFA_RIGHT;
     
    297429        } END_CNRINFO(hwndClient);
    298430
    299         #define RECORD_COUNT        200
    300 
    301431        if (preccFirst = (PGROUPRECORD)cnrhAllocRecords(hwndClient,
    302432                                                        sizeof(GROUPRECORD),
    303433                                                        RECORD_COUNT))
    304434        {
    305             PGROUPRECORD preccThis = preccFirst;
     435            PGROUPRECORD preccThis = preccFirst,
     436                         preccEmph;
    306437            ULONG   ul = 0;
    307438            while (preccThis)
    308439            {
     440                G_paRecs[ul] = preccThis;
     441
     442                if (ul & 1)
     443                    preccThis->recc.flRecordAttr |= CRA_FILTERED;
     444
     445                if (ul == 4)
     446                    preccEmph = preccThis;
     447
    309448                preccThis->gid = ul++;
    310449                sprintf(preccThis->szGroupName, "group %d", preccThis->gid);
     
    323462                              CRA_RECORDREADONLY,
    324463                              RECORD_COUNT);
     464
     465            WinSendMsg(hwndClient,
     466                       CM_SETRECORDEMPHASIS,
     467                       (MPARAM)preccEmph,
     468                       MPFROM2SHORT(TRUE, CRA_SELECTED));
    325469        }
    326470    }
    327471
     472    WinStartTimer(hab, hwndFrame, 1, 100);
     473
    328474    while (WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0))
    329     {
    330         BOOL fDispatch = TRUE;
    331 
    332         if (qmsg.hwnd == hwndFrame)
    333         {
    334             switch (qmsg.msg)
    335             {
    336                 case WM_COMMAND:
    337                     if (SHORT1FROMMP(qmsg.mp1) == 1000)
    338                     {
    339                         ShowFileDlg(hwndFrame);
    340                         fDispatch = FALSE;
    341                     }
    342                 break;
    343             }
    344         }
    345 
    346         if (fDispatch)
    347             WinDispatchMsg(hab, &qmsg);
    348     }
     475        WinDispatchMsg(hab, &qmsg);
    349476
    350477    WinDestroyMsgQueue(hmq);
Note: See TracChangeset for help on using the changeset viewer.