Changeset 17


Ignore:
Timestamp:
Dec 16, 2000, 10:09:53 PM (25 years ago)
Author:
umoeller
Message:

Miscellanous updates.

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/helpers/animate.h

    r14 r17  
    3737                         ULONG ulAnimationTime);
    3838
    39     VOID anmPowerOff(HPS hps, ULONG ulSteps);
     39    VOID anmPowerOff(HPS hps,
     40                     ULONG ulMaxTime1,
     41                     ULONG ulMaxTime2,
     42                     ULONG ulMaxTime3,
     43                     ULONG ulWaitEnd);
    4044
    4145#endif
  • trunk/include/helpers/cnrh.h

    r15 r17  
    482482                              PRECORDCORE precc);
    483483
     484    BOOL cnrhIsChildOf(HWND hwndCnr,
     485                       PRECORDCORE precTest,
     486                       PRECORDCORE precParent);
     487
    484488    typedef ULONG EXPENTRY FNCBRECC(HWND, PRECORDCORE, ULONG, ULONG);
    485489    typedef FNCBRECC *PFNCBRECC;
  • trunk/include/helpers/dosh.h

    r15 r17  
    178178    /* ******************************************************************
    179179     *
    180      *   File helpers
    181      *
    182      ********************************************************************/
    183 
    184     PSZ doshGetExtension(const char *pcszFilename);
    185 
    186     BOOL doshIsFileOnFAT(const char* pcszFileName);
    187 
    188     APIRET doshIsValidFileName(const char* pcszFile,
    189                                BOOL fFullyQualified);
    190 
    191     BOOL doshMakeRealName(PSZ pszTarget, PSZ pszSource, CHAR cReplace, BOOL fIsFAT);
    192 
    193     ULONG doshQueryFileSize(HFILE hFile);
    194 
    195     ULONG doshQueryPathSize(PSZ pszFile);
    196 
    197     APIRET doshQueryPathAttr(const char* pcszFile,
    198                              PULONG pulAttr);
    199 
    200     APIRET doshSetPathAttr(const char* pcszFile,
    201                            ULONG ulAttr);
    202 
    203     APIRET doshReadTextFile(PSZ pszFile,
    204                             PSZ* ppszContent);
    205 
    206     PSZ doshCreateBackupFileName(const char* pszExisting);
    207 
    208     APIRET doshWriteTextFile(const char* pszFile,
    209                              const char* pszContent,
    210                              PULONG pulWritten,
    211                              PSZ pszBackup);
    212 
    213     HFILE doshOpenLogFile(const char* pcszFilename);
    214 
    215     APIRET doshWriteToLogFile(HFILE hfLog, const char* pcsz);
    216 
    217     /* ******************************************************************
    218      *
    219      *   Directory helpers
    220      *
    221      ********************************************************************/
    222 
    223     BOOL doshQueryDirExist(PSZ pszDir);
    224 
    225     APIRET doshCreatePath(PSZ pszPath,
    226                           BOOL fHidden);
    227 
    228     APIRET doshQueryCurrentDir(PSZ pszBuf);
    229 
    230     APIRET doshSetCurrentDir(const char *pcszDir);
    231 
    232     #define DOSHDELDIR_RECURSE      0x0001
    233     #define DOSHDELDIR_DELETEFILES  0x0002
    234 
    235     APIRET doshDeleteDir(const char *pcszDir,
    236                          ULONG flFlags,
    237                          PULONG pulDirs,
    238                          PULONG pulFiles);
     180     *   Module handling helpers
     181     *
     182     ********************************************************************/
     183
     184    /*
     185     *@@ RESOLVEFUNCTION:
     186     *      one of these structures each define
     187     *      a single function import to doshResolveImports.
     188     *
     189     *@@added V0.9.3 (2000-04-25) [umoeller]
     190     */
     191
     192    typedef struct _RESOLVEFUNCTION
     193    {
     194        const char  *pcszFunctionName;
     195        PFN         *ppFuncAddress;
     196    } RESOLVEFUNCTION, *PRESOLVEFUNCTION;
     197
     198    APIRET doshResolveImports(PSZ pszModuleName,
     199                              HMODULE *phmod,
     200                              PRESOLVEFUNCTION paResolves,
     201                              ULONG cResolves);
    239202
    240203    /* ******************************************************************
     
    304267    /* ******************************************************************
    305268     *
     269     *   File helpers
     270     *
     271     ********************************************************************/
     272
     273    PSZ doshGetExtension(const char *pcszFilename);
     274
     275    BOOL doshIsFileOnFAT(const char* pcszFileName);
     276
     277    APIRET doshIsValidFileName(const char* pcszFile,
     278                               BOOL fFullyQualified);
     279
     280    BOOL doshMakeRealName(PSZ pszTarget, PSZ pszSource, CHAR cReplace, BOOL fIsFAT);
     281
     282    ULONG doshQueryFileSize(HFILE hFile);
     283
     284    ULONG doshQueryPathSize(PSZ pszFile);
     285
     286    APIRET doshQueryPathAttr(const char* pcszFile,
     287                             PULONG pulAttr);
     288
     289    APIRET doshSetPathAttr(const char* pcszFile,
     290                           ULONG ulAttr);
     291
     292    APIRET doshReadTextFile(PSZ pszFile,
     293                            PSZ* ppszContent);
     294
     295    PSZ doshCreateBackupFileName(const char* pszExisting);
     296
     297    APIRET doshWriteTextFile(const char* pszFile,
     298                             const char* pszContent,
     299                             PULONG pulWritten,
     300                             PSZ pszBackup);
     301
     302    HFILE doshOpenLogFile(const char* pcszFilename);
     303
     304    APIRET doshWriteToLogFile(HFILE hfLog, const char* pcsz);
     305
     306    /* ******************************************************************
     307     *
     308     *   Directory helpers
     309     *
     310     ********************************************************************/
     311
     312    BOOL doshQueryDirExist(PSZ pszDir);
     313
     314    APIRET doshCreatePath(PSZ pszPath,
     315                          BOOL fHidden);
     316
     317    APIRET doshQueryCurrentDir(PSZ pszBuf);
     318
     319    APIRET doshSetCurrentDir(const char *pcszDir);
     320
     321    #define DOSHDELDIR_RECURSE      0x0001
     322    #define DOSHDELDIR_DELETEFILES  0x0002
     323
     324    APIRET doshDeleteDir(const char *pcszDir,
     325                         ULONG flFlags,
     326                         PULONG pulDirs,
     327                         PULONG pulFiles);
     328
     329    /* ******************************************************************
     330     *
    306331     *   Process helpers
    307332     *
     
    356381
    357382    APIRET doshFreeEnvironment(PDOSENVIRONMENT pEnv);
    358 
    359     /* ******************************************************************
    360      *
    361      *   Module handling helpers
    362      *
    363      ********************************************************************/
    364 
    365     /*
    366      *@@ RESOLVEFUNCTION:
    367      *      one of these structures each define
    368      *      a single function import to doshResolveImports.
    369      *
    370      *@@added V0.9.3 (2000-04-25) [umoeller]
    371      */
    372 
    373     typedef struct _RESOLVEFUNCTION
    374     {
    375         const char  *pcszFunctionName;
    376         PFN         *ppFuncAddress;
    377     } RESOLVEFUNCTION, *PRESOLVEFUNCTION;
    378 
    379     APIRET doshResolveImports(PSZ pszModuleName,
    380                               HMODULE *phmod,
    381                               PRESOLVEFUNCTION paResolves,
    382                               ULONG cResolves);
    383383
    384384    /********************************************************************
  • trunk/include/helpers/linklist.h

    r14 r17  
    159159    typedef LSTITEMFROMINDEX *PLSTITEMFROMINDEX;
    160160
     161    unsigned long lstIndexFromItem(PLINKLIST pList, void *pItemData);
     162    typedef unsigned long LSTINDEXFROMITEM(PLINKLIST pList, void *pItemData);
     163    typedef LSTINDEXFROMITEM *PLSTINDEXFROMITEM;
     164
    161165    #ifdef __XWPMEMDEBUG__ // setup.h, helpers\memdebug.c
    162166        PLISTNODE XWPENTRY lstAppendItemDebug(PLINKLIST pList,
  • trunk/src/helpers/animate.c

    r15 r17  
    4444#define INCL_DOSERRORS
    4545
     46#define INCL_WINWINDOWMGR
    4647#define INCL_WINPOINTERS
    4748#define INCL_WINSYS
     
    5556#include <string.h>
    5657
    57 #include "setup.h"                      // code generation and debugging options
    58 
    59 #include "helpers\animate.h"
    60 
    61 #include "helpers\winh.h"
    62 #include "helpers\gpih.h"
     58// #include "setup.h"                      // code generation and debugging options
     59
     60// #include "helpers\animate.h"
     61
     62// #include "helpers\winh.h"
     63// #include "helpers\gpih.h"
    6364
    6465/*
     
    165166}
    166167
    167 #define LAST_WIDTH 2
    168 #define LAST_STEPS 50
    169 #define WAIT_TIME  10
     168#define LAST_LINE_WIDTH 2
    170169
    171170/* ******************************************************************
     
    179178 *      displays an animation that looks like a
    180179 *      monitor being turned off; hps must have
    181  *      been acquired using WinGetScreenPS,
    182  *      ulSteps should be around 40-50.
     180 *      been acquired using WinGetScreenPS.
    183181 *
    184182 *@@changed V0.9.7 (2000-12-08) [umoeller]: got rid of dtGetULongTime
    185183 */
    186184
    187 VOID anmPowerOff(HPS hps, ULONG ulSteps)
     185VOID anmPowerOff(HPS hps,
     186                 ULONG ulMaxTime1, //  = 500,
     187                 ULONG ulMaxTime2, //  = 800,
     188                 ULONG ulMaxTime3, //  = 200,
     189                 ULONG ulWaitEnd)  //  = 300
    188190{
    189     RECTL       rclScreen, rclNow, rclLast, rclDraw;
    190     ULONG       ul = ulSteps;
    191     ULONG       ulPhase = 1;
     191    RECTL       rclScreen,
     192                rclNow,
     193                rclLast,
     194                rclDraw;
     195    ULONG       ulPhase = 1,
     196                ulCXLastLine;
     197
     198    ULONG       ulStartTime = 0,
     199                ulTimeNow = 0;
    192200
    193201    WinQueryWindowRect(HWND_DESKTOP, &rclScreen);
     202    ulCXLastLine = rclScreen.xRight / 3;
    194203
    195204    WinShowPointer(HWND_DESKTOP, FALSE);
     
    200209    // "phases", signified by the ulPhase variable. While
    201210    // ulPhase != 99, we stay in a do-while loop.
    202     ul = 0;
    203211    ulPhase = 1;
    204212
    205213    do
    206214    {
    207         ULONG ulFromTime, ulTime2;
     215        // get current time
    208216        DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,
    209                         &ulFromTime,
    210                         sizeof(ulFromTime));
     217                        &ulTimeNow,
     218                        sizeof(ulTimeNow));
     219
     220        // get start time
     221        if (ulStartTime == 0)
     222            // this is reset when we enter a new phase
     223            ulStartTime = ulTimeNow;
    211224
    212225        if (ulPhase == 1)
     
    218231            // the center is black too. Sort of like this:
    219232
    220             //          ***************************
    221             //          *       black             *
    222             //          *                         *
    223             //          *      .............      *
    224             //          *      . rclNow:   .      *
    225             //          *  ->  . untouched .  <-  *
    226             //          *      .............      *
    227             //          *            ^            *
    228             //          *            !            *
    229             //          ***************************
     233            //          ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
     234            //          º       black             º
     235            //          º                         º
     236            //          º      ÚÄÄÄÄÄÄÄÄÄÄÄ¿      º
     237            //          º      ³ rclNow:   ³      º
     238            //          º  ->  ³ untouched ³  <-  º
     239            //          º      ÀÄÄÄÄÄÄÄÄÄÄÄÙ      º
     240            //          º            ^            º
     241            //          º            |            º
     242            //          ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ
     243
     244            // This part lasts exactly (ulMaxTime1) milliseconds.
    230245
    231246            // rclNow contains the rectangle _around_ which
    232247            // the black rectangles are to be drawn. With
    233248            // every iteration, rclNow is reduced in size.
    234             rclNow.xLeft = ((rclScreen.yTop / 2) * ul / ulSteps );
     249            ULONG ulMaxX = (rclScreen.xRight - ulCXLastLine) / 2,
     250                  ulMaxY = rclScreen.yTop / 2 - LAST_LINE_WIDTH;
     251            ULONG ulTimePassed = (ulTimeNow - ulStartTime);
     252            if (ulTimePassed >= ulMaxTime1)
     253            {
     254                // time has elapsed:
     255                ulTimePassed = ulMaxTime1;
     256                // enter next phase on next loop
     257                ulPhase++;
     258                // reget start time
     259                ulStartTime = 0;
     260            }
     261            rclNow.xLeft = ulMaxX * ulTimePassed / ulMaxTime1;
     262            rclNow.yBottom = ulMaxY * ulTimePassed / ulMaxTime1;
     263            rclNow.xRight = (rclScreen.xRight) - rclNow.xLeft;
     264            rclNow.yTop = (rclScreen.yTop) - rclNow.yBottom;
     265
     266            /* rclNow.xLeft = ((rclScreen.yTop / 2) * ul / ulSteps );
    235267            rclNow.xRight = (rclScreen.xRight) - rclNow.xLeft;
    236268            rclNow.yBottom = ((rclScreen.yTop / 2) * ul / ulSteps );
    237             rclNow.yTop = (rclScreen.yTop) - rclNow.yBottom;
    238 
    239             if (rclNow.yBottom > (rclNow.yTop - LAST_WIDTH) )
     269            rclNow.yTop = (rclScreen.yTop) - rclNow.yBottom; */
     270
     271            /* if (rclNow.yBottom > (rclNow.yTop - LAST_WIDTH) )
    240272            {
    241273                rclNow.yBottom = (rclScreen.yTop / 2) - LAST_WIDTH;
    242274                rclNow.yTop = (rclScreen.yTop / 2) + LAST_WIDTH;
    243             }
     275            } */
    244276
    245277            // draw black rectangle on top of rclNow
     
    275307
    276308            // done with "shrinking"?
    277             if ( rclNow.xRight < ((rclScreen.xRight / 2) + LAST_WIDTH) )
     309            /* if ( rclNow.xRight < ((rclScreen.xRight / 2) + LAST_WIDTH) )
     310            {
    278311                ulPhase = 2; // exit
     312                // reget start time
     313                ulStartTime = 0;
     314            } */
     315
     316            if (ulPhase == 2)
     317            {
     318                // this was the last step in this phase:
     319                memcpy(&rclLast, &rclScreen, sizeof(RECTL));
     320            }
    279321        }
    280322        else if (ulPhase == 2)
    281323        {
    282324            // Phase 2: draw a horizontal white line about
    283             // where the last rclNow was. This is only
    284             // executed once.
    285 
    286             //          ***************************
    287             //          *       black             *
    288             //          *                         *
    289             //          *                         *
    290             //          *        -----------      *
    291             //          *                         *
    292             //          *                         *
    293             //          *                         *
    294             //          ***************************
    295 
    296             rclDraw.xLeft = (rclScreen.xRight / 2) - LAST_WIDTH;
    297             rclDraw.xRight = (rclScreen.xRight / 2) + LAST_WIDTH;
    298             rclDraw.yBottom = (rclScreen.yTop * 1 / 4);
    299             rclDraw.yTop = (rclScreen.yTop * 3 / 4);
    300             WinFillRect(hps, &rclDraw, CLR_WHITE);
    301 
    302             ulPhase = 3;
    303             ul = 0;
    304 
     325            // where the last rclNow was. and shrink it
     326            // towards the middle. This ends with a white
     327            // dot in the middle of the screen.
     328
     329            //          ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
     330            //          º       black             º
     331            //          º                         º
     332            //          º                         º
     333            //          º  -->   ÄwhiteÄÄÄÄ   <-- º
     334            //          º                         º
     335            //          º                         º
     336            //          º                         º
     337            //          ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ
     338
     339            // This part lasts exactly (ulMaxTime2) milliseconds.
     340
     341            // start is same as max in step 1
     342            ULONG ulStartX = (rclScreen.xRight - ulCXLastLine) / 2,
     343                  ulY      = rclScreen.yTop / 2 - LAST_LINE_WIDTH;
     344            ULONG ulMaxX = (rclScreen.xRight) / 2 - LAST_LINE_WIDTH;      // center
     345            ULONG ulTimePassed = (ulTimeNow - ulStartTime);
     346            if (ulTimePassed >= ulMaxTime2)
     347            {
     348                // time has elapsed:
     349                ulTimePassed = ulMaxTime2;
     350                // enter next phase on next loop
     351                ulPhase++;
     352                // reget start time
     353                ulStartTime = 0;
     354            }
     355
     356            rclNow.xLeft =  ulStartX
     357                          + ( (ulMaxX - ulStartX) * ulTimePassed / ulMaxTime2 );
     358            rclNow.yBottom = ulY;
     359            rclNow.xRight = (rclScreen.xRight) - rclNow.xLeft;
     360            rclNow.yTop = (rclScreen.yTop) - rclNow.yBottom;
     361
     362            // draw black rectangle left of rclNow
     363            rclDraw.xLeft = rclLast.xLeft;
     364            rclDraw.xRight = rclNow.xLeft;
     365            rclDraw.yBottom = rclLast.yBottom;
     366            rclDraw.yTop = rclLast.yTop;
     367            WinFillRect(hps, &rclDraw, CLR_BLACK);
     368
     369            // draw black rectangle right of rclNow
     370            rclDraw.xLeft = rclNow.xRight;
     371            rclDraw.xRight = rclLast.xRight;
     372            rclDraw.yBottom = rclLast.yBottom;
     373            rclDraw.yTop = rclLast.yTop;
     374            WinFillRect(hps, &rclDraw, CLR_BLACK);
     375
     376            // WinFillRect(hps, &rclNow, CLR_WHITE);
     377
     378            // remember rclNow for next iteration
     379            memcpy(&rclLast, &rclNow, sizeof(RECTL));
     380
     381            if (ulPhase == 3)
     382            {
     383                // this was the last step in this phase:
     384                // keep the dot visible for a while
     385                DosSleep(ulMaxTime3);
     386
     387                // draw a white line for phase 3
     388                rclLast.xLeft = ulMaxX;
     389                rclLast.yBottom = rclScreen.yTop / 4;
     390                rclLast.xRight = rclScreen.xRight - rclLast.xLeft;
     391                rclLast.yTop = rclScreen.yTop - rclLast.yBottom;
     392
     393                WinFillRect(hps, &rclLast, CLR_WHITE);
     394            }
    305395        }
    306396        else if (ulPhase == 3)
     
    308398            // Phase 3: make the white line shorter with
    309399            // every iteration by drawing black rectangles
    310             // above it. These are drawn closer to the
    311             // center with each iteration.
    312 
    313             //          ***************************
    314             //          *       black             *
    315             //          *                         *
    316             //          *                         *
    317             //          *       ->  ----  <-      *
    318             //          *                         *
    319             //          *                         *
    320             //          *                         *
    321             //          ***************************
    322 
    323             rclDraw.xLeft = (rclScreen.xRight / 2) - LAST_WIDTH;
    324             rclDraw.xRight = (rclScreen.xRight / 2) + LAST_WIDTH;
     400            // above and below it. These are drawn closer
     401            // to the center with each iteration.
     402
     403            //          ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
     404            //          º                         º
     405            //          º                         º
     406            //          º            |            º
     407            //          º            |            º
     408            //          º            |            º
     409            //          º                         º
     410            //          º                         º
     411            //          ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍŒ
     412
     413            // This part lasts exactly ulMaxTime3 milliseconds.
     414            ULONG ulX = (rclScreen.xRight) / 2 - LAST_LINE_WIDTH,      // center
     415                  ulStartY = rclScreen.yTop / 4;
     416            ULONG ulMaxY = (rclScreen.yTop) / 2 - LAST_LINE_WIDTH;      // center
     417            ULONG ulTimePassed = (ulTimeNow - ulStartTime);
     418            if (ulTimePassed >= ulMaxTime3)
     419            {
     420                // time has elapsed:
     421                ulTimePassed = ulMaxTime3;
     422                // stop
     423                ulPhase = 99;
     424            }
     425
     426            rclNow.xLeft =  ulX;
     427            rclNow.yBottom = ulStartY
     428                          + ( (ulMaxY - ulStartY) * ulTimePassed / ulMaxTime3 );
     429            rclNow.xRight = (rclScreen.xRight) - rclNow.xLeft;
     430            rclNow.yTop = (rclScreen.yTop) - rclNow.yBottom;
     431
     432            // draw black rectangle on top of rclNow
     433            rclDraw.xLeft = rclLast.xLeft;
     434            rclDraw.xRight = rclLast.xRight;
     435            rclDraw.yBottom = rclNow.yTop;
     436            rclDraw.yTop = rclLast.yTop;
     437            WinFillRect(hps, &rclDraw, CLR_BLACK);
     438
     439            // draw black rectangle at the bottom of rclNow
     440            rclDraw.xLeft = rclLast.xLeft;
     441            rclDraw.xRight = rclLast.xRight;
     442            rclDraw.yBottom = rclLast.yBottom;
     443            rclDraw.yTop = rclNow.yBottom;
     444            WinFillRect(hps, &rclDraw, CLR_BLACK);
     445
     446            // remember rclNow for next iteration
     447            memcpy(&rclLast, &rclNow, sizeof(RECTL));
     448
     449            /* rclDraw.xLeft = (rclScreen.xRight / 2) - LAST_LINE_WIDTH;
     450            rclDraw.xRight = (rclScreen.xRight / 2) + LAST_LINE_WIDTH;
    325451            rclDraw.yTop = (rclScreen.yTop * 3 / 4);
    326452            rclDraw.yBottom = (rclScreen.yTop * 3 / 4) - ((rclScreen.yTop * 1 / 4) * ul / LAST_STEPS);
    327             if (rclDraw.yBottom < ((rclScreen.yTop / 2) + LAST_WIDTH))
    328                 rclDraw.yBottom = ((rclScreen.yTop / 2) + LAST_WIDTH);
    329             WinFillRect(hps, &rclDraw, CLR_BLACK);
    330 
    331             rclDraw.xLeft = (rclScreen.xRight / 2) - LAST_WIDTH;
    332             rclDraw.xRight = (rclScreen.xRight / 2) + LAST_WIDTH;
     453            if (rclDraw.yBottom < ((rclScreen.yTop / 2) + LAST_LINE_WIDTH))
     454                rclDraw.yBottom = ((rclScreen.yTop / 2) + LAST_LINE_WIDTH);
     455            WinFillRect(hps, &rclDraw, CLR_BLACK);
     456
     457            rclDraw.xLeft = (rclScreen.xRight / 2) - LAST_LINE_WIDTH;
     458            rclDraw.xRight = (rclScreen.xRight / 2) + LAST_LINE_WIDTH;
    333459            rclDraw.yBottom = (rclScreen.yTop * 1 / 4);
    334460            rclDraw.yTop = (rclScreen.yTop * 1 / 4) + ((rclScreen.yTop * 1 / 4) * ul / LAST_STEPS);
    335             if (rclDraw.yTop > ((rclScreen.yTop / 2) - LAST_WIDTH))
    336                 rclDraw.yBottom = ((rclScreen.yTop / 2) - LAST_WIDTH);
     461            if (rclDraw.yTop > ((rclScreen.yTop / 2) - LAST_LINE_WIDTH))
     462                rclDraw.yBottom = ((rclScreen.yTop / 2) - LAST_LINE_WIDTH);
    337463
    338464            WinFillRect(hps, &rclDraw, CLR_BLACK);
    339465
    340466            ul++;
    341             if (ul > LAST_STEPS)
    342                 ulPhase = 99;
     467            if (ul > LAST_STEPS) */
     468            //     ulPhase = 99;
    343469        }
    344470
    345         ul++;
    346 
    347         DosSleep(WAIT_TIME);
    348 
    349         /* do
    350         {
    351             DosSleep(0);
    352             DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,
    353                             &ulTime2,
    354                             sizeof(ulTime2));
    355         }  while (ulTime2 < ulFromTime + WAIT_TIME); */
    356471    } while (ulPhase != 99);
    357472
    358473    // sleep a while
    359     DosSleep(500);
     474    DosSleep(ulWaitEnd / 2);
    360475    WinFillRect(hps, &rclScreen, CLR_BLACK);
    361     DosSleep(500);
     476    DosSleep(ulWaitEnd / 2);
    362477
    363478    WinShowPointer(HWND_DESKTOP, TRUE);
     
    365480
    366481
    367 
     482// testcase
     483
     484/* int main(int argc, char* argp)
     485{
     486    HENUM henum;
     487    HWND hwndTop;
     488    HAB hab = WinInitialize(0);
     489    HMQ hmq = WinCreateMsgQueue(hab, 0);
     490    HPS hps = WinGetScreenPS(HWND_DESKTOP);
     491
     492    anmPowerOff(hps);
     493
     494    henum = WinBeginEnumWindows(HWND_DESKTOP);
     495    while ((hwndTop = WinGetNextWindow(henum)))
     496        if (WinIsWindowShowing(hwndTop))
     497            WinInvalidateRect(hwndTop, NULL, TRUE);
     498    WinEndEnumWindows(henum);
     499
     500    WinShowPointer(HWND_DESKTOP, TRUE);
     501
     502    WinDestroyMsgQueue(hmq);
     503    WinTerminate(hab);
     504
     505    return (0);
     506} */
  • trunk/src/helpers/cnrh.c

    r15 r17  
    13761376
    13771377/*
     1378 *@@ cnrhIsChildOf:
     1379 *      returns TRUE only if precTest is a child record
     1380 *      of precParent in a tree view.
     1381 *
     1382 *@@added V0.9.7 (2000-12-13) [umoeller]
     1383 */
     1384
     1385BOOL cnrhIsChildOf(HWND hwndCnr,
     1386                   PRECORDCORE precTest,        // in: recc to test
     1387                   PRECORDCORE precParent)      // in: parent to test
     1388{
     1389    BOOL brc = FALSE;
     1390    if ((precTest) && (precParent))
     1391    {
     1392        PRECORDCORE precParentThis = precTest;
     1393
     1394        while (precParentThis)
     1395        {
     1396            // first call: get parent of precTest;
     1397            // subsequent calls: climb up
     1398            precParentThis = WinSendMsg(hwndCnr,
     1399                                        CM_QUERYRECORD,
     1400                                        precParentThis,
     1401                                        MPFROM2SHORT(CMA_PARENT,
     1402                                                     CMA_ITEMORDER));
     1403            if (precParentThis == (PRECORDCORE)-1)
     1404                break;
     1405            else
     1406                if (precParentThis == precParent)
     1407                {
     1408                    brc = TRUE;
     1409                    break;
     1410                }
     1411        }
     1412    }
     1413
     1414    return (brc);
     1415}
     1416
     1417/*
    13781418 *@@ cnrhForAllRecords:
    13791419 *      this monster function calls pfnwpCallback
     
    16631703 *
    16641704 *          Note: You must intercept CN_DROPNOTIFY in your window proc
    1665  *          to clean up resources later.
     1705 *          to clean up resources later. For this, call:
     1706 *
     1707 +              DrgDeleteDraginfoStrHandles(pdrgInfo);
     1708 +              DrgFreeDraginfo(pdrgInfo);
    16661709 *
    16671710 *      2)  However, if (usNotifyCode == CN_INITDRAG), we will start
     
    16691712 *          will _not_ return until the object has been dropped or d'n'd
    16701713 *          has been cancelled. PM establishes another message loop
    1671  *          internally for this.
     1714 *          internally for this. In this case, this function managed
     1715 *          cleanup automatically.
    16721716 *
    16731717 *      This function supports one single record core only. The following
  • trunk/src/helpers/dosh.c

    r15 r17  
    15301530
    15311531    return (arcReturn);
     1532}
     1533
     1534/*
     1535 *@@category: Helpers\Control program helpers\Module handling
     1536 */
     1537
     1538/* ******************************************************************
     1539 *
     1540 *   Module handling helpers
     1541 *
     1542 ********************************************************************/
     1543
     1544/*
     1545 *@@ doshResolveImports:
     1546 *      this function loads the module called pszModuleName
     1547 *      and resolves imports dynamically using DosQueryProcAddress.
     1548 *
     1549 *      To specify the functions to be imported, a RESOLVEFUNCTION
     1550 *      array is used. In each of the array items, specify the
     1551 *      name of the function and a pointer to a function pointer
     1552 *      where to store the resolved address.
     1553 *
     1554 *@@added V0.9.3 (2000-04-29) [umoeller]
     1555 */
     1556
     1557APIRET doshResolveImports(PSZ pszModuleName,    // in: DLL to load
     1558                          HMODULE *phmod,       // out: module handle
     1559                          PRESOLVEFUNCTION paResolves, // in/out: function resolves
     1560                          ULONG cResolves)      // in: array item count (not array size!)
     1561{
     1562    CHAR    szName[CCHMAXPATH];
     1563    APIRET arc = DosLoadModule(szName,
     1564                               sizeof(szName),
     1565                               pszModuleName,
     1566                               phmod);
     1567    if (arc == NO_ERROR)
     1568    {
     1569        ULONG  ul;
     1570        for (ul = 0;
     1571             ul < cResolves;
     1572             ul++)
     1573        {
     1574            arc = DosQueryProcAddr(*phmod,
     1575                                   0,               // ordinal, ignored
     1576                                   (PSZ)paResolves[ul].pcszFunctionName,
     1577                                   paResolves[ul].ppFuncAddress);
     1578
     1579            /* _Pmpf(("Resolved %s to 0x%lX, rc: %d",
     1580                    paResolves[ul].pcszFunctionName,
     1581                    *paResolves[ul].ppFuncAddress,
     1582                    arc)); */
     1583            if (arc != NO_ERROR)
     1584                break;
     1585        }
     1586    }
     1587
     1588    return (arc);
    15321589}
    15331590
  • trunk/src/helpers/dosh2.c

    r14 r17  
    714714            free(pEnv->papszVars);
    715715            pEnv->cVars = 0;
    716         }
    717     }
    718 
    719     return (arc);
    720 }
    721 
    722 /*
    723  *@@category: Helpers\Control program helpers\Module handling
    724  */
    725 
    726 /* ******************************************************************
    727  *
    728  *   Module handling helpers
    729  *
    730  ********************************************************************/
    731 
    732 /*
    733  *@@ doshResolveImports:
    734  *      this function loads the module called pszModuleName
    735  *      and resolves imports dynamically using DosQueryProcAddress.
    736  *
    737  *      To specify the functions to be imported, a RESOLVEFUNCTION
    738  *      array is used. In each of the array items, specify the
    739  *      name of the function and a pointer to a function pointer
    740  *      where to store the resolved address.
    741  *
    742  *@@added V0.9.3 (2000-04-29) [umoeller]
    743  */
    744 
    745 APIRET doshResolveImports(PSZ pszModuleName,    // in: DLL to load
    746                           HMODULE *phmod,       // out: module handle
    747                           PRESOLVEFUNCTION paResolves, // in/out: function resolves
    748                           ULONG cResolves)      // in: array item count (not array size!)
    749 {
    750     CHAR    szName[CCHMAXPATH];
    751     APIRET arc = DosLoadModule(szName,
    752                                sizeof(szName),
    753                                pszModuleName,
    754                                phmod);
    755     if (arc == NO_ERROR)
    756     {
    757         ULONG  ul;
    758         for (ul = 0;
    759              ul < cResolves;
    760              ul++)
    761         {
    762             arc = DosQueryProcAddr(*phmod,
    763                                    0,               // ordinal, ignored
    764                                    (PSZ)paResolves[ul].pcszFunctionName,
    765                                    paResolves[ul].ppFuncAddress);
    766 
    767             /* _Pmpf(("Resolved %s to 0x%lX, rc: %d",
    768                     paResolves[ul].pcszFunctionName,
    769                     *paResolves[ul].ppFuncAddress,
    770                     arc)); */
    771             if (arc != NO_ERROR)
    772                 break;
    773716        }
    774717    }
  • trunk/src/helpers/linklist.c

    r14 r17  
    353353 *      The item data can be queried from the node
    354354 *      as follows:
     355 *
    355356 +          PLINKLIST pll = lstCreate();
    356357 +          ...  // add items here
     
    359360 *
    360361 *      You can iterate over the whole list like this:
     362 *
    361363 +          PLISTNODE pNode = lstQueryFirstNode(pll);
    362364 +          while (pNode)
     
    425427 */
    426428
    427 PLISTNODE lstNodeFromItem(PLINKLIST pList, void* pItemData)
     429PLISTNODE lstNodeFromItem(PLINKLIST pList,
     430                          void* pItemData)
    428431{
    429432    PLISTNODE pNode = 0,
     
    465468 */
    466469
    467 void* lstItemFromIndex(PLINKLIST pList, unsigned long ulIndex)
     470void* lstItemFromIndex(PLINKLIST pList,
     471                       unsigned long ulIndex)
    468472{
    469473    PLISTNODE pNode = lstNodeFromIndex(pList, ulIndex);
     
    472476    else
    473477        return (0);
     478}
     479
     480/*
     481 *@@ lstIndexFromItem:
     482 *      returns the index of the list node with
     483 *      the specified item pointer. The first
     484 *      node returns 0, the second 1, and so on.
     485 *
     486 *      Returns -1 if not found.
     487 *
     488 *      In the worst case, this function traverses
     489 *      the whole list.
     490 *
     491 *@@added V0.9.7 (2000-12-13) [umoeller]
     492 */
     493
     494unsigned long lstIndexFromItem(PLINKLIST pList, void *pItemData)
     495{
     496    ULONG ulrc = -1,
     497          ulIndex = 0;
     498    PLISTNODE pNode = lstQueryFirstNode(pList);
     499    while (pNode)
     500    {
     501        if (pNode->pItemData == pItemData)
     502        {
     503            ulrc = ulIndex;
     504            break;
     505        }
     506
     507        pNode = pNode->pNext;
     508        ulIndex++;
     509    }
     510
     511    return (ulrc);
    474512}
    475513
  • trunk/src/helpers/timer.c

    r15 r17  
    7373#define INCL_DOSMISC
    7474#define INCL_DOSERRORS
     75
     76#define INCL_WINMESSAGEMGR
    7577#include <os2.h>
    7678
     
    151153    }
    152154    else
    153         brc = (DosRequestMutexSem(G_hmtxTimers, SEM_INDEFINITE_WAIT)
     155        brc = (WinRequestMutexSem(G_hmtxTimers, SEM_INDEFINITE_WAIT)
    154156                    == NO_ERROR);
    155157    return (brc);
     
    164166{
    165167    DosReleaseMutexSem(G_hmtxTimers);
    166 }
    167 
    168 /*
    169  *@@ tmrOnKill:
    170  *      on-kill proc for exception handlers.
    171  *
    172  *@@added V0.9.7 (2000-12-09) [umoeller]
    173  */
    174 
    175 VOID APIENTRY tmrOnKill(PEXCEPTIONREGISTRATIONRECORD2 pRegRec2)
    176 {
    177     DosBeep(500, 500);
    178     UnlockTimers();
    179168}
    180169
     
    217206        ULONG ulNesting = 0;
    218207
     208        ULONG ulTimeNow;
     209
    219210        DosSleep(ulInterval);
    220211
     
    225216        ulInterval = 100;
    226217
     218        DosEnterMustComplete(&ulNesting);
     219
    227220        TRY_LOUD(excpt1)
    228221        {
    229             DosEnterMustComplete(&ulNesting);
    230 
    231222            fLocked = LockTimers();
    232223            if (fLocked)
     
    244235                    // we have timers:
    245236                    BOOL      fFoundInvalid = FALSE;
     237
     238                    // get current time
     239                    DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,
     240                                    &ulTimeNow, sizeof(ulTimeNow));
     241
    246242                    while (pTimerNode)
    247243                    {
    248244                        PXTIMER pTimer = (PXTIMER)pTimerNode->pItemData;
    249                         ULONG ulTimeNow;
    250                         DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT,
    251                                         &ulTimeNow, sizeof(ulTimeNow));
    252245
    253246                        if (pTimer->ulNextFire < ulTimeNow)
  • trunk/src/helpers/winh.c

    r15 r17  
    32513251 *      If this is passed as HWND_DESKTOP, the
    32523252 *      whole screen is repainted.
     3253 *
     3254 *@@changed V0.9.7 (2000-12-13) [umoeller]: hwndParent was never respected, fixed
    32533255 */
    32543256
     
    32563258{
    32573259    HWND    hwndTop;
    3258     HENUM   henum = WinBeginEnumWindows(HWND_DESKTOP);
     3260    HENUM   henum = WinBeginEnumWindows(hwndParent);
    32593261    while ((hwndTop = WinGetNextWindow(henum)))
    32603262        if (WinIsWindowShowing(hwndTop))
Note: See TracChangeset for help on using the changeset viewer.