Annotation of pmsdk/samples/linefrac/lfdlg.c, revision 1.1.1.1

1.1       root        1: /************************************************************************
                      2: *
                      3: *   lfdlg.c -- Window procedures for dialog boxes used in LineFractal.
                      4: *
                      5: *   Created by Microsoft Corporation, 1989
                      6: *
                      7: ************************************************************************/
                      8: 
                      9: #define INCL_WIN
                     10: #define INCL_GPI
                     11: #include <os2.h>
                     12: 
                     13: #include <mt\stdio.h>
                     14: #include <mt\stdlib.h>
                     15: #include <mt\math.h>
                     16: 
                     17: #define INCL_GLOBALS
                     18: #define INCL_THREADS
                     19: #include "linefrac.h"
                     20: 
                     21: #define INCL_LFDLG
                     22: #define INCL_LFUTIL
                     23: #include "lffuncs.h"
                     24: 
                     25: 
                     26: 
                     27: 
                     28: /************************************************************************
                     29: *
                     30: *   Global Variables
                     31: *
                     32: *   global     Global data block.
                     33: *
                     34: ************************************************************************/
                     35: 
                     36: extern GLOBALDATA global;
                     37: 
                     38: 
                     39: 
                     40: 
                     41: /************************************************************************
                     42: *
                     43: *   AboutDlg
                     44: *
                     45: *   Process messages for the About box.
                     46: *
                     47: ************************************************************************/
                     48: 
                     49: ULONG CALLBACK
                     50: AboutDlg(hwnd, usMsg, mp1, mp2)
                     51: HWND   hwnd;
                     52: USHORT usMsg;
                     53: MPARAM mp1;
                     54: MPARAM mp2;
                     55: {
                     56:     switch (usMsg)
                     57:     {
                     58:     case WM_COMMAND:                   /* the user has pressed a button */
                     59:        switch (SHORT1FROMMP(mp1))      /* which button? */
                     60:        {
                     61:        case IDD_OK:
                     62:        case IDD_CANCEL:
                     63:            WinDismissDlg(hwnd, TRUE);
                     64:            break;
                     65: 
                     66:        default:
                     67:            return FALSE;
                     68:        }
                     69:        break;
                     70: 
                     71:     default:
                     72:        return (ULONG) WinDefDlgProc(hwnd, usMsg, mp1, mp2);
                     73:     }
                     74:     return FALSE;
                     75: }
                     76: 
                     77: 
                     78: 
                     79: 
                     80: /************************************************************************
                     81: *
                     82: *   TimerDelayDlg
                     83: *
                     84: *   Process messages for the dialog box used to set the timer delay
                     85: *   values for automatically restarting a drawing.
                     86: *
                     87: ************************************************************************/
                     88: 
                     89: ULONG CALLBACK
                     90: TimerDelayDlg(hwnd, usMsg, mp1, mp2)
                     91: HWND   hwnd;
                     92: USHORT usMsg;
                     93: MPARAM mp1;
                     94: MPARAM mp2;
                     95: {
                     96:     BOOL fRet = FALSE;
                     97: 
                     98:     switch (usMsg)
                     99:     {
                    100:     case WM_INITDLG:
                    101:        MySetWindowUShort(hwnd, IDD_MINDELAY, global.usMinTimerDelay);
                    102:        MySetWindowUShort(hwnd, IDD_MAXDELAY, global.usMaxTimerDelay);
                    103:        return FALSE;
                    104: 
                    105:     case WM_COMMAND:
                    106:        switch (SHORT1FROMMP(mp1))
                    107:         {
                    108:        case IDD_OK:
                    109:            MyGetWindowUShort(hwnd, IDD_MINDELAY, &global.usMinTimerDelay);
                    110:            MyGetWindowUShort(hwnd, IDD_MAXDELAY, &global.usMaxTimerDelay);
                    111: 
                    112:            fRet = TRUE;
                    113: 
                    114:            /* fall through to some common code */
                    115: 
                    116:        case IDD_CANCEL:
                    117:            WinDismissDlg(hwnd, fRet);
                    118:             break;
                    119: 
                    120:         default:
                    121:            return FALSE;
                    122:         }
                    123:         break;
                    124: 
                    125:     default:
                    126:        return (ULONG) WinDefDlgProc(hwnd, usMsg, mp1, mp2);
                    127:     }
                    128:     return FALSE;
                    129: }
                    130: 
                    131: 
                    132: 
                    133: 
                    134: /************************************************************************
                    135: *
                    136: *   BitmapParamsDlg
                    137: *
                    138: *   Process messages for the bitmap parameters dialog box.
                    139: *
                    140: ************************************************************************/
                    141: 
                    142: ULONG CALLBACK
                    143: BitmapParamsDlg( hwnd, usMsg, mp1, mp2 )
                    144: HWND   hwnd;
                    145: USHORT usMsg;
                    146: MPARAM mp1;
                    147: MPARAM mp2;
                    148: {
                    149:     BOOL fRet = FALSE;
                    150: 
                    151:     switch (usMsg)
                    152:     {
                    153:     case WM_INITDLG:
                    154: 
                    155:        MySetWindowUShort(hwnd, IDD_BMCX,     global.bm.cx);
                    156:        MySetWindowUShort(hwnd, IDD_BMCY,     global.bm.cy);
                    157:        MySetWindowUShort(hwnd, IDD_BMPLANES, global.bm.cPlanes);
                    158:        MySetWindowUShort(hwnd, IDD_BMBPP,    global.bm.cBitCount);
                    159: 
                    160:        return FALSE;
                    161: 
                    162:     case WM_COMMAND:
                    163:        switch (SHORT1FROMMP(mp1))
                    164:         {
                    165:        case IDD_OK:
                    166: 
                    167:            MyGetWindowUShort(hwnd, IDD_BMCX,     &global.bm.cx);
                    168:            MyGetWindowUShort(hwnd, IDD_BMCY,     &global.bm.cy);
                    169:            MyGetWindowUShort(hwnd, IDD_BMPLANES, &global.bm.cPlanes);
                    170:            MyGetWindowUShort(hwnd, IDD_BMBPP,    &global.bm.cBitCount);
                    171: 
                    172:            fRet = TRUE;
                    173: 
                    174:            /* fall through to some common code */
                    175: 
                    176:        case IDD_CANCEL:
                    177:            WinDismissDlg(hwnd, fRet);
                    178:             break;
                    179: 
                    180:         default:
                    181:            return FALSE;
                    182:         }
                    183:         break;
                    184: 
                    185:     default:
                    186:        return (ULONG) WinDefDlgProc(hwnd, usMsg, mp1, mp2);
                    187:     }
                    188:     return FALSE;
                    189: }
                    190: 
                    191: 
                    192: 
                    193: 
                    194: /************************************************************************
                    195: *
                    196: *   SwitchDelayDlg
                    197: *
                    198: *   Process messages for the dialog box used to set the switch
                    199: *   delay value for automatically switching between threads.
                    200: *
                    201: ************************************************************************/
                    202: 
                    203: ULONG CALLBACK
                    204: SwitchDelayDlg(hwnd, usMsg, mp1, mp2)
                    205: HWND   hwnd;
                    206: USHORT usMsg;
                    207: MPARAM mp1;
                    208: MPARAM mp2;
                    209: {
                    210:     BOOL fRet = FALSE;
                    211: 
                    212:     switch (usMsg)
                    213:     {
                    214:     case WM_INITDLG:
                    215:        MySetWindowUShort(hwnd, IDD_SWITCHDELAY, global.usSwitchDelay);
                    216:        return FALSE;
                    217: 
                    218:     case WM_COMMAND:
                    219:        switch (SHORT1FROMMP(mp1))
                    220:         {
                    221:        case IDD_OK:
                    222:            MyGetWindowUShort(hwnd, IDD_SWITCHDELAY, &global.usSwitchDelay);
                    223: 
                    224:            fRet = TRUE;
                    225: 
                    226:            /* fall through to some common code */
                    227: 
                    228:        case IDD_CANCEL:
                    229:            WinDismissDlg(hwnd, fRet);
                    230:             break;
                    231: 
                    232:         default:
                    233:            return FALSE;
                    234:         }
                    235:         break;
                    236: 
                    237:     default:
                    238:        return (ULONG) WinDefDlgProc(hwnd, usMsg, mp1, mp2);
                    239:     }
                    240:     return FALSE;
                    241: }
                    242: 
                    243: 
                    244: 
                    245: 
                    246: /************************************************************************
                    247: *
                    248: *   LineAttrsDlg
                    249: *
                    250: *   Process messages for the line attributes dialog box.
                    251: *
                    252: ************************************************************************/
                    253: 
                    254: #define SETLINEATTR(H, I, J)                                             \
                    255:        MySetWindow##I(hwnd, J, global.lb.H)
                    256: 
                    257: #define GETLINEATTR(H, I, J, K, L)                                       \
                    258:        {                                                                 \
                    259:            J temp;                                                       \
                    260:            MyGetWindow##I(hwnd, K, &temp);                               \
                    261:            if (temp != global.lb.H)                                      \
                    262:            {                                                             \
                    263:                global.lb.H = temp;                                       \
                    264:                global.flLineAttrs |= L;                                  \
                    265:            }                                                             \
                    266:        }
                    267: 
                    268: ULONG CALLBACK
                    269: LineAttrsDlg( hwnd, usMsg, mp1, mp2 )
                    270: HWND   hwnd;
                    271: USHORT usMsg;
                    272: MPARAM mp1;
                    273: MPARAM mp2;
                    274: {
                    275:     BOOL fRet = FALSE;
                    276: 
                    277:     switch (usMsg)
                    278:     {
                    279:     case WM_INITDLG:
                    280: 
                    281:        if (!global.fUpdateAttrs || !(global.flLineAttrs & LFA_LINEALL))
                    282:            global.lb = global.pThrTop->lb;
                    283: 
                    284:        SETLINEATTR(lColor,     Long,   IDD_LINECOLOR);
                    285:        SETLINEATTR(usMixMode,  UShort, IDD_LINEMIX);
                    286:        SETLINEATTR(fxWidth,    Long,   IDD_LINEWIDTH);
                    287:        SETLINEATTR(lGeomWidth, Long,   IDD_LINEGEOMWIDTH);
                    288:        SETLINEATTR(usType,     UShort, IDD_LINETYPE);
                    289:        SETLINEATTR(usEnd,      UShort, IDD_LINEEND);
                    290:        SETLINEATTR(usJoin,     UShort, IDD_LINEJOIN);
                    291: 
                    292:        return FALSE;
                    293: 
                    294:     case WM_COMMAND:
                    295:        switch (SHORT1FROMMP(mp1))
                    296:         {
                    297:        case IDD_OK:
                    298: 
                    299:            GETLINEATTR(lColor,     Long,   LONG,   IDD_LINECOLOR,     LFA_LINECOLOR);
                    300:            GETLINEATTR(usMixMode,  UShort, USHORT, IDD_LINEMIX,       LFA_LINEMIX);
                    301:            GETLINEATTR(fxWidth,    Long,   LONG,   IDD_LINEWIDTH,     LFA_LINEWIDTH);
                    302:            GETLINEATTR(lGeomWidth, Long,   LONG,   IDD_LINEGEOMWIDTH, LFA_LINEGEOMWIDTH);
                    303:            GETLINEATTR(usType,     UShort, USHORT, IDD_LINETYPE,      LFA_LINETYPE);
                    304:            GETLINEATTR(usEnd,      UShort, USHORT, IDD_LINEEND,       LFA_LINEEND);
                    305:            GETLINEATTR(usJoin,     UShort, USHORT, IDD_LINEJOIN,      LFA_LINEJOIN);
                    306: 
                    307:            if (global.flLineAttrs & LFA_LINEALL)
                    308:            {
                    309:                global.pThrTop->fUpdateAttrs = TRUE;
                    310:                global.fUpdateAttrs = TRUE;
                    311:            }
                    312: 
                    313:            fRet = TRUE;
                    314: 
                    315:            /* fall through to some common code */
                    316: 
                    317:        case IDD_CANCEL:
                    318:            WinDismissDlg(hwnd, fRet);
                    319:             break;
                    320: 
                    321:         default:
                    322:            return FALSE;
                    323:         }
                    324:         break;
                    325: 
                    326:     default:
                    327:        return (ULONG) WinDefDlgProc(hwnd, usMsg, mp1, mp2);
                    328:     }
                    329:     return FALSE;
                    330: }
                    331: #undef SETLINEATTR
                    332: #undef GETLINEATTR
                    333: 
                    334: 
                    335: 
                    336: 
                    337: /************************************************************************
                    338: *
                    339: *   MarkerAttrsDlg
                    340: *
                    341: *   Process messages for the marker attributes dialog box.
                    342: *
                    343: ************************************************************************/
                    344: 
                    345: #define SETMARKATTR(H, I, J)                                             \
                    346:        MySetWindow##I(hwnd, J, global.mb.H)
                    347: 
                    348: #define GETMARKATTR(H, I, J, K, L)                                       \
                    349:        {                                                                 \
                    350:            J temp;                                                       \
                    351:            MyGetWindow##I(hwnd, K, &temp);                               \
                    352:            if (temp != global.mb.H)                                      \
                    353:            {                                                             \
                    354:                global.mb.H = temp;                                       \
                    355:                global.flMarkerAttrs |= L;                                \
                    356:            }                                                             \
                    357:        }
                    358: 
                    359: ULONG CALLBACK
                    360: MarkerAttrsDlg( hwnd, usMsg, mp1, mp2 )
                    361: HWND   hwnd;
                    362: USHORT usMsg;
                    363: MPARAM mp1;
                    364: MPARAM mp2;
                    365: {
                    366:     BOOL fRet = FALSE;
                    367: 
                    368:     switch (usMsg)
                    369:     {
                    370:     case WM_INITDLG:
                    371: 
                    372:        if (!global.fUpdateAttrs || !(global.flMarkerAttrs & LFA_MARKALL))
                    373:            global.mb = global.pThrTop->mb;
                    374: 
                    375:        SETMARKATTR(lColor,        Long,   IDD_MARKCOLOR);
                    376:        SETMARKATTR(lBackColor,    Long,   IDD_MARKBACKCOLOR);
                    377:        SETMARKATTR(usMixMode,     UShort, IDD_MARKMIX);
                    378:        SETMARKATTR(usBackMixMode, UShort, IDD_MARKBACKMIX);
                    379:        SETMARKATTR(usSet,         UShort, IDD_MARKSET);
                    380:        SETMARKATTR(usSymbol,      UShort, IDD_MARKSYMBOL);
                    381:        SETMARKATTR(sizfxCell.cx,  Long,   IDD_MARKCELLWIDTH);
                    382:        SETMARKATTR(sizfxCell.cy,  Long,   IDD_MARKCELLHEIGHT);
                    383: 
                    384:        return FALSE;
                    385: 
                    386:     case WM_COMMAND:
                    387:        switch (SHORT1FROMMP(mp1))
                    388:         {
                    389:        case IDD_OK:
                    390: 
                    391:            GETMARKATTR(lColor,        Long,   LONG,   IDD_MARKCOLOR,     LFA_MARKCOLOR);
                    392:            GETMARKATTR(lBackColor,    Long,   LONG,   IDD_MARKBACKCOLOR,  LFA_MARKBACKCOLOR);
                    393:            GETMARKATTR(usMixMode,     UShort, USHORT, IDD_MARKMIX,       LFA_MARKMIX);
                    394:            GETMARKATTR(usBackMixMode, UShort, USHORT, IDD_MARKBACKMIX,   LFA_MARKBACKMIX);
                    395:            GETMARKATTR(usSet,         UShort, USHORT, IDD_MARKSET,       LFA_MARKSET);
                    396:            GETMARKATTR(usSymbol,      UShort, USHORT, IDD_MARKSYMBOL,    LFA_MARKSYMBOL);
                    397:            GETMARKATTR(sizfxCell.cx,  Long,   LONG,   IDD_MARKCELLWIDTH,  LFA_MARKCELLWIDTH);
                    398:            GETMARKATTR(sizfxCell.cy,  Long,   LONG,   IDD_MARKCELLHEIGHT, LFA_MARKCELLHEIGHT);
                    399: 
                    400:            if (global.flMarkerAttrs & LFA_MARKALL)
                    401:            {
                    402:                global.pThrTop->fUpdateAttrs = TRUE;
                    403:                global.fUpdateAttrs = TRUE;
                    404:            }
                    405: 
                    406:            fRet = TRUE;
                    407: 
                    408:            /* fall through to some common code */
                    409: 
                    410:        case IDD_CANCEL:
                    411:            WinDismissDlg(hwnd, fRet);
                    412:             break;
                    413: 
                    414:         default:
                    415:            return FALSE;
                    416:         }
                    417:         break;
                    418: 
                    419:     default:
                    420:        return (ULONG) WinDefDlgProc(hwnd, usMsg, mp1, mp2);
                    421:     }
                    422:     return FALSE;
                    423: }
                    424: #undef SETMARKATTR
                    425: #undef GETMARKATTR
                    426: 
                    427: 
                    428: 
                    429: 
                    430: /************************************************************************
                    431: *
                    432: *   AreaAttrsDlg
                    433: *
                    434: *   Process messages for the area attributes dialog box.
                    435: *
                    436: ************************************************************************/
                    437: 
                    438: #define SETAREAATTR(H, I, J)                                             \
                    439:        MySetWindow##I(hwnd, J, global.ab.H)
                    440: 
                    441: #define GETAREAATTR(H, I, J, K, L)                                       \
                    442:        {                                                                 \
                    443:            J temp;                                                       \
                    444:            MyGetWindow##I(hwnd, K, &temp);                               \
                    445:            if (temp != global.ab.H)                                      \
                    446:            {                                                             \
                    447:                global.ab.H = temp;                                       \
                    448:                global.flAreaAttrs |= L;                                  \
                    449:            }                                                             \
                    450:        }
                    451: 
                    452: ULONG CALLBACK
                    453: AreaAttrsDlg( hwnd, usMsg, mp1, mp2 )
                    454: HWND   hwnd;
                    455: USHORT usMsg;
                    456: MPARAM mp1;
                    457: MPARAM mp2;
                    458: {
                    459:     BOOL fRet = FALSE;
                    460: 
                    461:     switch (usMsg)
                    462:     {
                    463:     case WM_INITDLG:
                    464: 
                    465:        if (!global.fUpdateAttrs || !(global.flAreaAttrs & LFA_AREAALL))
                    466:            global.ab = global.pThrTop->ab;
                    467: 
                    468:        SETAREAATTR(lColor,        Long,   IDD_AREACOLOR);
                    469:        SETAREAATTR(lBackColor,    Long,   IDD_AREABACKCOLOR);
                    470:        SETAREAATTR(usMixMode,     UShort, IDD_AREAMIX);
                    471:        SETAREAATTR(usBackMixMode, UShort, IDD_AREABACKMIX);
                    472:        SETAREAATTR(usSet,         UShort, IDD_AREASET);
                    473:        SETAREAATTR(usSymbol,      UShort, IDD_AREASYMBOL);
                    474:        SETAREAATTR(ptlRefPoint.x, Long,   IDD_AREAREFX);
                    475:        SETAREAATTR(ptlRefPoint.y, Long,   IDD_AREAREFY);
                    476: 
                    477:        return FALSE;
                    478: 
                    479:     case WM_COMMAND:
                    480:        switch (SHORT1FROMMP(mp1))
                    481:         {
                    482:        case IDD_OK:
                    483: 
                    484:            GETAREAATTR(lColor,        Long,   LONG,   IDD_AREACOLOR,    LFA_AREACOLOR);
                    485:            GETAREAATTR(lBackColor,    Long,   LONG,   IDD_AREABACKCOLOR, LFA_AREABACKCOLOR);
                    486:            GETAREAATTR(usMixMode,     UShort, USHORT, IDD_AREAMIX,      LFA_AREAMIX);
                    487:            GETAREAATTR(usBackMixMode, UShort, USHORT, IDD_AREABACKMIX,  LFA_AREABACKMIX);
                    488:            GETAREAATTR(usSet,         UShort, USHORT, IDD_AREASET,      LFA_AREASET);
                    489:            GETAREAATTR(usSymbol,      UShort, USHORT, IDD_AREASYMBOL,   LFA_AREASYMBOL);
                    490:            GETAREAATTR(ptlRefPoint.x, Long,   LONG,   IDD_AREAREFX,     LFA_AREAREFX);
                    491:            GETAREAATTR(ptlRefPoint.y, Long,   LONG,   IDD_AREAREFY,     LFA_AREAREFY);
                    492: 
                    493:            if (global.flAreaAttrs & LFA_AREAALL)
                    494:            {
                    495:                global.pThrTop->fUpdateAttrs = TRUE;
                    496:                global.fUpdateAttrs = TRUE;
                    497:            }
                    498: 
                    499:            fRet = TRUE;
                    500: 
                    501:            /* fall through to some common code */
                    502: 
                    503:        case IDD_CANCEL:
                    504:            WinDismissDlg(hwnd, fRet);
                    505:             break;
                    506: 
                    507:         default:
                    508:            return FALSE;
                    509:         }
                    510:         break;
                    511: 
                    512:     default:
                    513:        return (ULONG) WinDefDlgProc(hwnd, usMsg, mp1, mp2);
                    514:     }
                    515:     return FALSE;
                    516: }
                    517: #undef SETAREAATTR
                    518: #undef GETAREAATTR
                    519: 
                    520: 
                    521: 
                    522: 
                    523: /************************************************************************
                    524: *
                    525: *   ImageAttrsDlg
                    526: *
                    527: *   Process messages for the image attributes dialog box.
                    528: *
                    529: ************************************************************************/
                    530: 
                    531: #define SETIMAGEATTR(H, I, J)                                            \
                    532:        MySetWindow##I(hwnd, J, global.ib.H)
                    533: 
                    534: #define GETIMAGEATTR(H, I, J, K, L)                                      \
                    535:        {                                                                 \
                    536:            J temp;                                                       \
                    537:            MyGetWindow##I(hwnd, K, &temp);                               \
                    538:            if (temp != global.ib.H)                                      \
                    539:            {                                                             \
                    540:                global.ib.H = temp;                                       \
                    541:                global.flImageAttrs |= L;                                 \
                    542:            }                                                             \
                    543:        }
                    544: 
                    545: ULONG CALLBACK
                    546: ImageAttrsDlg( hwnd, usMsg, mp1, mp2 )
                    547: HWND   hwnd;
                    548: USHORT usMsg;
                    549: MPARAM mp1;
                    550: MPARAM mp2;
                    551: {
                    552:     BOOL fRet = FALSE;
                    553: 
                    554:     switch (usMsg)
                    555:     {
                    556:     case WM_INITDLG:
                    557: 
                    558:        if (!global.fUpdateAttrs || !(global.flImageAttrs & LFA_IMAGEALL))
                    559:            global.ib = global.pThrTop->ib;
                    560: 
                    561:        SETIMAGEATTR(lColor,        Long,   IDD_IMAGECOLOR);
                    562:        SETIMAGEATTR(lBackColor,    Long,   IDD_IMAGEBACKCOLOR);
                    563:        SETIMAGEATTR(usMixMode,     UShort, IDD_IMAGEMIX);
                    564:        SETIMAGEATTR(usBackMixMode, UShort, IDD_IMAGEBACKMIX);
                    565: 
                    566:        return FALSE;
                    567: 
                    568:     case WM_COMMAND:
                    569:        switch (SHORT1FROMMP(mp1))
                    570:         {
                    571:        case IDD_OK:
                    572: 
                    573:            GETIMAGEATTR(lColor,        Long,   LONG,   IDD_IMAGECOLOR,    LFA_IMAGECOLOR);
                    574:            GETIMAGEATTR(lBackColor,    Long,   LONG,   IDD_IMAGEBACKCOLOR, LFA_IMAGEBACKCOLOR);
                    575:            GETIMAGEATTR(usMixMode,     UShort, USHORT, IDD_IMAGEMIX,      LFA_IMAGEMIX);
                    576:            GETIMAGEATTR(usBackMixMode, UShort, USHORT, IDD_IMAGEBACKMIX,   LFA_IMAGEBACKMIX);
                    577: 
                    578:            if (global.flImageAttrs & LFA_IMAGEALL)
                    579:            {
                    580:                global.pThrTop->fUpdateAttrs = TRUE;
                    581:                global.fUpdateAttrs = TRUE;
                    582:            }
                    583: 
                    584:            fRet = TRUE;
                    585: 
                    586:            /* fall through to some common code */
                    587: 
                    588:        case IDD_CANCEL:
                    589:            WinDismissDlg(hwnd, fRet);
                    590:             break;
                    591: 
                    592:         default:
                    593:            return FALSE;
                    594:         }
                    595:         break;
                    596: 
                    597:     default:
                    598:        return (ULONG) WinDefDlgProc(hwnd, usMsg, mp1, mp2);
                    599:     }
                    600:     return FALSE;
                    601: }
                    602: #undef SETIMAGEATTR
                    603: #undef GETIMAGEATTR
                    604: 
                    605: 
                    606: 
                    607: 
                    608: /************************************************************************
                    609: *
                    610: *   MiscAttrsDlg
                    611: *
                    612: *   Process messages for the fractal attributes dialog box.
                    613: *
                    614: ************************************************************************/
                    615: 
                    616: #define SETMISCATTR(H, I, J)                                             \
                    617:        MySetWindow##I(hwnd, J, global.H)
                    618: 
                    619: #define GETMISCATTR(H, I, J, K, L)                                       \
                    620:        {                                                                 \
                    621:            J temp;                                                       \
                    622:            MyGetWindow##I(hwnd, K, &temp);                               \
                    623:            if (temp != global.H)                                         \
                    624:            {                                                             \
                    625:                global.H = temp;                                          \
                    626:                global.flMiscAttrs |= L;                                  \
                    627:            }                                                             \
                    628:        }
                    629: 
                    630: ULONG CALLBACK
                    631: MiscAttrsDlg( hwnd, usMsg, mp1, mp2 )
                    632: HWND   hwnd;
                    633: USHORT usMsg;
                    634: MPARAM mp1;
                    635: MPARAM mp2;
                    636: {
                    637:     BOOL fRet = FALSE;
                    638: 
                    639:     switch (usMsg)
                    640:     {
                    641:     case WM_INITDLG:
                    642: 
                    643:        if (!global.fUpdateAttrs || !(global.flMiscAttrs &
                    644:                (LFA_RECURSION|LFA_CPTMAX|LFA_POLYGONSIDES|LFA_ROTATION)))
                    645:        {
                    646:            global.usRecursion    = global.pThrTop->usRecursion;
                    647:            global.cptMax         = global.pThrTop->cptMax;
                    648:            global.usPolygonSides = global.pThrTop->usPolygonSides;
                    649:            global.dblRotation    = global.pThrTop->dblRotation;
                    650:        }
                    651: 
                    652:        SETMISCATTR(usRecursion,    UShort, IDD_RECURSION);
                    653:        SETMISCATTR(cptMax,         UShort, IDD_CPTMAX);
                    654:        SETMISCATTR(usPolygonSides, UShort, IDD_NUMSIDES);
                    655:        SETMISCATTR(dblRotation,    Double, IDD_ROTATION);
                    656: 
                    657:        return FALSE;
                    658: 
                    659:     case WM_COMMAND:
                    660:        switch (SHORT1FROMMP(mp1))
                    661:         {
                    662:        case IDD_OK:
                    663: 
                    664:            GETMISCATTR(usRecursion,    UShort, USHORT, IDD_RECURSION, LFA_RECURSION);
                    665:            GETMISCATTR(cptMax,         UShort, USHORT, IDD_CPTMAX,    LFA_CPTMAX);
                    666:            GETMISCATTR(usPolygonSides, UShort, USHORT, IDD_NUMSIDES,  LFA_POLYGONSIDES);
                    667:            GETMISCATTR(dblRotation,    Double, double, IDD_ROTATION,  LFA_ROTATION);
                    668: 
                    669:            if (global.flMiscAttrs & LFA_POLYGONSIDES)
                    670:                if (global.usPolygonSides == 0)
                    671:                    global.usPolygonSides = 2;
                    672: 
                    673:            if (global.flMiscAttrs & LFA_CPTMAX)
                    674:            {
                    675:                if (global.cptMax == 0)
                    676:                    global.cptMax = 1;
                    677:                else if (global.cptMax > MAX_POINT_COUNT)
                    678:                    global.cptMax = MAX_POINT_COUNT;
                    679:            }
                    680: 
                    681:            if (global.flMiscAttrs & (LFA_RECURSION|LFA_CPTMAX|
                    682:                LFA_POLYGONSIDES|LFA_ROTATION))
                    683:            {
                    684:                global.pThrTop->fUpdateAttrs = TRUE;
                    685:                global.fUpdateAttrs = TRUE;
                    686:            }
                    687: 
                    688:            fRet = TRUE;
                    689: 
                    690:            /* fall through to some common code */
                    691: 
                    692:        case IDD_CANCEL:
                    693:            WinDismissDlg(hwnd, fRet);
                    694:             break;
                    695: 
                    696:         default:
                    697:            return FALSE;
                    698:         }
                    699:         break;
                    700: 
                    701:     default:
                    702:        return (ULONG) WinDefDlgProc(hwnd, usMsg, mp1, mp2);
                    703:     }
                    704:     return FALSE;
                    705: }
                    706: #undef SETMISCATTR
                    707: #undef GETMISCATTR
                    708: 
                    709: 
                    710: 
                    711: 
                    712: /************************************************************************
                    713: *
                    714: *   DimensionsDlg
                    715: *
                    716: *   Process messages for the fractal dimensions dialog box.
                    717: *
                    718: ************************************************************************/
                    719: 
                    720: #define SETDIMENSIONS(H, I, J)                                           \
                    721:        MySetWindow##I(hwnd, J, global.H)
                    722: 
                    723: #define GETDIMENSIONS(H, I, J, K, L)                                     \
                    724:        {                                                                 \
                    725:            J temp;                                                       \
                    726:            MyGetWindow##I(hwnd, K, &temp);                               \
                    727:            if (temp != global.H)                                         \
                    728:            {                                                             \
                    729:                global.H = temp;                                          \
                    730:                global.flMiscAttrs |= L;                                  \
                    731:            }                                                             \
                    732:        }
                    733: 
                    734: ULONG CALLBACK
                    735: DimensionsDlg( hwnd, usMsg, mp1, mp2 )
                    736: HWND   hwnd;
                    737: USHORT usMsg;
                    738: MPARAM mp1;
                    739: MPARAM mp2;
                    740: {
                    741:     BOOL fRet = FALSE;
                    742: 
                    743:     switch (usMsg)
                    744:     {
                    745:     case WM_INITDLG:
                    746: 
                    747:        if (!global.fUpdateAttrs || !(global.flMiscAttrs &
                    748:            (LFA_XOFF|LFA_YOFF|LFA_XSCALE|LFA_YSCALE)))
                    749:        {
                    750:            global.dblXOff   = global.pThrTop->dblXOff;
                    751:            global.dblYOff   = global.pThrTop->dblYOff;
                    752:            global.dblXScale = global.pThrTop->dblXScale;
                    753:            global.dblYScale = global.pThrTop->dblYScale;
                    754:        }
                    755: 
                    756:        SETDIMENSIONS(dblXOff,   Double, IDD_XOFF);
                    757:        SETDIMENSIONS(dblYOff,   Double, IDD_YOFF);
                    758:        SETDIMENSIONS(dblXScale, Double, IDD_XSCALE);
                    759:        SETDIMENSIONS(dblYScale, Double, IDD_YSCALE);
                    760: 
                    761:        return FALSE;
                    762: 
                    763:     case WM_COMMAND:
                    764:        switch (SHORT1FROMMP(mp1))
                    765:         {
                    766:        case IDD_OK:
                    767: 
                    768:            GETDIMENSIONS(dblXOff,   Double, double, IDD_XOFF,  LFA_XOFF);
                    769:            GETDIMENSIONS(dblYOff,   Double, double, IDD_YOFF,  LFA_YOFF);
                    770:            GETDIMENSIONS(dblXScale, Double, double, IDD_XSCALE, LFA_XSCALE);
                    771:            GETDIMENSIONS(dblYScale, Double, double, IDD_YSCALE, LFA_YSCALE);
                    772: 
                    773:            if (global.flMiscAttrs & (LFA_XOFF|LFA_YOFF|LFA_XSCALE|LFA_YSCALE))
                    774:            {
                    775:                global.pThrTop->fUpdateAttrs = TRUE;
                    776:                global.fUpdateAttrs = TRUE;
                    777:            }
                    778: 
                    779:            fRet = TRUE;
                    780: 
                    781:            /* fall through to some common code */
                    782: 
                    783:        case IDD_CANCEL:
                    784:            WinDismissDlg(hwnd, fRet);
                    785:             break;
                    786: 
                    787:         default:
                    788:            return FALSE;
                    789:         }
                    790:         break;
                    791: 
                    792:     default:
                    793:        return (ULONG) WinDefDlgProc(hwnd, usMsg, mp1, mp2);
                    794:     }
                    795:     return FALSE;
                    796: }
                    797: #undef SETDIMENSIONS
                    798: #undef GETDIMENSIONS
                    799: 
                    800: 
                    801: 
                    802: 
                    803: /************************************************************************
                    804: *
                    805: *   PtrPreferencesDlg
                    806: *
                    807: *   Process messages for the mouse pointer preferences dialog box.
                    808: *
                    809: ************************************************************************/
                    810: 
                    811: #define SETPTRPREF(H, I, J)                                \
                    812:        MySetWindow##I(hwnd, J, global.H)
                    813: 
                    814: #define GETPTRPREF(H, I, J)                                \
                    815:        MyGetWindow##I(hwnd, J, &global.H)
                    816: 
                    817: ULONG CALLBACK
                    818: PtrPreferencesDlg( hwnd, usMsg, mp1, mp2 )
                    819: HWND   hwnd;
                    820: USHORT usMsg;
                    821: MPARAM mp1;
                    822: MPARAM mp2;
                    823: {
                    824:     BOOL fRet = FALSE;
                    825: 
                    826:     switch (usMsg)
                    827:     {
                    828:     case WM_INITDLG:
                    829: 
                    830:        SETPTRPREF(usPtrThreshold, UShort, IDD_PTRTHRESHOLD);
                    831:        WinSendDlgItemMsg(hwnd, global.usUserPtr+IDD_USERPTR0,
                    832:                          BM_SETCHECK, (MPARAM)TRUE, 0L);
                    833:        return FALSE;
                    834: 
                    835:     case WM_COMMAND:
                    836:        switch (SHORT1FROMMP(mp1))
                    837:         {
                    838:        case IDD_OK:
                    839: 
                    840:            GETPTRPREF(usPtrThreshold, UShort, IDD_PTRTHRESHOLD);
                    841:            global.usUserPtr = (USHORT) WinSendDlgItemMsg(hwnd, IDD_USERPTR0,
                    842:                                                 BM_QUERYCHECKINDEX, 0L, 0L);
                    843: 
                    844:            if (global.usPtrThreshold < 0)
                    845:                global.usPtrThreshold = 0;
                    846: 
                    847:            if (!global.fAnimatePtr)
                    848:                global.usCurPtr = global.usUserPtr;
                    849: 
                    850:            fRet = TRUE;
                    851: 
                    852:            /* fall through to some common code */
                    853: 
                    854:        case IDD_CANCEL:
                    855:            WinDismissDlg(hwnd, fRet);
                    856:             break;
                    857: 
                    858:         default:
                    859:            return FALSE;
                    860:         }
                    861:         break;
                    862: 
                    863:     default:
                    864:        return (ULONG) WinDefDlgProc(hwnd, usMsg, mp1, mp2);
                    865:     }
                    866:     return FALSE;
                    867: }
                    868: #undef SETPTRPREF
                    869: #undef GETPTRPREF

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.