Annotation of mstools/samples/sdktools/aniedit/anidefs.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Common includes
        !             3:  *
        !             4:  */
        !             5: #include "anicur.h"
        !             6: #include "anidlgs.h"
        !             7: #include "animsg.h"
        !             8: 
        !             9: /*
        !            10:  * Constants
        !            11:  *
        !            12:  */
        !            13: #define CMS_WAIT_FOR_PROCESS    (60 * 1000) // one minute
        !            14: 
        !            15: #define AIM_PROCESSTERM         (WM_USER + 0x0FFF)
        !            16: #define AIM_SETCHILDAPP         (AIM_PROCESSTERM + 1)
        !            17: 
        !            18: #define CCH_TITLE    80
        !            19: #define CCH_CREATOR  80
        !            20: #define CCH_JIF      10         /* Numbers are small even in German! */
        !            21: 
        !            22: #define TITL_ERROR  (DWORD)(-1)
        !            23: #define szPREVIEW   TEXT("AniEditPreviewClass")
        !            24: #define szBNTBAR    TEXT("AniEditBtnBarClass")
        !            25: 
        !            26: 
        !            27: #define PM_NEWCURSOR            (WM_USER + 0x4a50)
        !            28: #define PM_PAUSEANIMATION       (PM_NEWCURSOR + 1)
        !            29: #define PM_UNPAUSEANIMATION     (PM_NEWCURSOR + 2)
        !            30: #define PM_SETSTEP              (PM_NEWCURSOR + 3)
        !            31: 
        !            32: #define ID_PREVIEWTIMER         (0x0050)
        !            33: 
        !            34: #define MULTISEL        1       /* listbox is mutliple selction */
        !            35: 
        !            36: /*
        !            37:  * Structure defintions
        !            38:  *
        !            39:  */
        !            40: typedef struct _FRAME *PFRAME;
        !            41: 
        !            42: typedef struct _FRAME {
        !            43:     int         cRef;           /* refrence count */
        !            44:     int         iFrame;
        !            45:     PFRAME      pfrmNext;
        !            46:     DWORD       dwCheckSum;     /* checksum of the icon data.  Used to
        !            47:                                  * compare new imported icons against existing
        !            48:                                  * ones to see if we can sequence them.
        !            49:                                  */
        !            50:     HICON       hcur;           /* icon representation of raw data below */
        !            51:     WORD        xHotSpot;
        !            52:     WORD        yHotSpot;
        !            53:     RTAG        rtag;           /* icon chunk as it appears in file */
        !            54:     BYTE        abIcon[1];
        !            55: } FRAME;
        !            56: 
        !            57: 
        !            58: typedef struct _STEP *PSTEP;
        !            59: 
        !            60: typedef struct _STEP {
        !            61:     JIF     jif;
        !            62:     PFRAME  pfrmFrame;
        !            63: } STEP;
        !            64: 
        !            65: typedef struct _THDDATA {
        !            66:     HWND    hwndCaller;
        !            67:     HWND    hwndMonitor;
        !            68:     HANDLE  hprocMonitor;
        !            69: } THDDATA, *PTHDDATA;
        !            70: 
        !            71: typedef struct _ANICUR {
        !            72:     ANIHEADER anih;
        !            73:     BOOL      fDirty;
        !            74:     CHAR      azTitle[CCH_TITLE];
        !            75:     CHAR      azCreator[CCH_CREATOR];
        !            76:     TCHAR     szFile[MAX_PATH];
        !            77: } ANICUR;
        !            78: 
        !            79: 
        !            80: typedef struct _CLPBRDDAT *PCLPBRDDAT;
        !            81: 
        !            82: typedef struct _CLPBRDDAT {
        !            83:     PCLPBRDDAT pcbdNext;
        !            84:     STEP    stp;
        !            85: } CLPBRDDAT;
        !            86: 
        !            87: //
        !            88: // Structure that contains data used within a preview window.  This
        !            89: // data is unique for each preview window, and is used to optimize
        !            90: // the painting.
        !            91: //
        !            92: typedef struct
        !            93: {
        !            94:     HDC hdcMem;
        !            95:     HBITMAP hbmMem;
        !            96:     HBITMAP hbmOld;
        !            97:     HICON   hcur;
        !            98:     DWORD   iFrame;
        !            99:     WORD    xHot;
        !           100:     WORD    yHot;
        !           101: } PREVIEWDATA, *PPREVIEWDATA;
        !           102: 
        !           103: typedef struct {
        !           104:     int id;
        !           105:     int idSys;
        !           106: } RADIOCOLOR;
        !           107: 
        !           108: /*
        !           109:  * Header of the resource file in the new format
        !           110:  */
        !           111: #pragma pack(2)
        !           112: typedef struct tagNEWHEADER {
        !           113:     WORD reserved;
        !           114:     WORD rt;
        !           115:     WORD cResources;
        !           116: } NEWHEADER, *LPNEWHEADER;
        !           117: 
        !           118: typedef struct tagICONDIR {
        !           119:     BYTE Width;            /* 16, 32, 64 */
        !           120:     BYTE Height;           /* 16, 32, 64 */
        !           121:     BYTE ColorCount;       /* 2, 8, 16 */
        !           122:     BYTE reserved;
        !           123: } ICONDIR;
        !           124: 
        !           125: typedef struct tagCURSORDIR {
        !           126:     WORD Width;
        !           127:     WORD Height;
        !           128: } CURSORDIR;
        !           129: 
        !           130: typedef struct tagRESDIR {
        !           131:     union {
        !           132:         ICONDIR Icon;
        !           133:         CURSORDIR Cursor;
        !           134:     } ResInfo;
        !           135: 
        !           136:     WORD Planes;
        !           137:     WORD BitCount;
        !           138:     DWORD BytesInRes;
        !           139:     WORD idIcon;
        !           140: } RESDIR;
        !           141: typedef RESDIR *LPRESDIR;
        !           142: 
        !           143: typedef struct _ICONFILERESDIR {    // ird
        !           144:     BYTE bWidth;
        !           145:     BYTE bHeight;
        !           146:     BYTE bColorCount;
        !           147:     BYTE bReserved;
        !           148:     WORD xHotspot;
        !           149:     WORD yHotspot;
        !           150:     DWORD dwDIBSize;
        !           151:     DWORD dwDIBOffset;
        !           152: } ICONFILERESDIR;
        !           153: 
        !           154: typedef struct tagCURSORRESOURCE {
        !           155:     WORD xHotspot;
        !           156:     WORD yHotspot;
        !           157:     BITMAPINFOHEADER bih;
        !           158: } CURSORRESOURCE, *PCURSORRESOURCE;
        !           159: #pragma pack()
        !           160: 
        !           161: 
        !           162: /*
        !           163:  * Globals
        !           164:  *
        !           165:  */
        !           166: extern HANDLE hInst;
        !           167: extern HWND ghwndMain;
        !           168: extern HWND ghwndLB;
        !           169: extern int gcyCursor, gcxCursor;
        !           170: extern HBRUSH ghbrHighlight, ghbrWindow, ghbrPrevBackgnd;
        !           171: extern COLORREF gcrHighlightText;
        !           172: extern ANICUR ganiAcon;
        !           173: extern TCHAR gszTempFile[];
        !           174: extern BOOL gfEditFrame;
        !           175: extern TCHAR gszWindowTitle[];
        !           176: extern TCHAR gszDots[];
        !           177: extern PFRAME   gpfrmFrames;
        !           178: extern PCLPBRDDAT gpbdClipBoard;
        !           179: extern TCHAR gszCursorEditor[MAX_PATH];
        !           180: extern int giradColor;
        !           181: RADIOCOLOR garadColor[];
        !           182: 
        !           183: /*
        !           184:  * String table pointers
        !           185:  */
        !           186: extern LPTSTR gpszAniFilter;
        !           187: extern LPTSTR gpszImagEdit;
        !           188: extern LPTSTR gpszCUR;
        !           189: extern LPTSTR gpszANI;
        !           190: extern LPTSTR gpszUnknownError;
        !           191: extern LPTSTR gpszCurFilter;
        !           192: extern LPTSTR gpszUntitled;
        !           193: extern LPTSTR gpszImport;
        !           194: 
        !           195: /*
        !           196:  * Macros
        !           197:  *
        !           198:  */
        !           199: #if 0
        !           200: #   include <stdio.h>
        !           201: #   define DPRINT(p)   if(1){ printf p; fflush(stdout); } else
        !           202: #else
        !           203: #   define DPRINT(p)
        !           204: #endif
        !           205: 
        !           206: 
        !           207: #define WRITEME(hwnd)       \
        !           208:             MessageBox(hwnd, "This function is not yet implemented",    \
        !           209:             NULL, MB_OK | MB_ICONSTOP)
        !           210: 
        !           211: #define FALLTHRU(label)
        !           212: 
        !           213: #define COUNTOF(sz)     (sizeof(sz) / sizeof((sz)[0]))
        !           214: 
        !           215: #define FreeMem(pv)     LocalFree((HLOCAL)pv)
        !           216: 
        !           217: #define IsValidPS(ps)   (((ps) != (PSTEP)LB_ERR) && ((ps) != NULL))
        !           218: 
        !           219: 
        !           220: #define PADUP(cb)       (((cb) + 1) & ~1)
        !           221: #define RET_CLOSE_IF_ERR( func, hf )  \
        !           222:         if( !func ) {CloseHandle(hf); return FALSE;} else
        !           223: 
        !           224: #define GetStep(hwnd, iSel) (PSTEP)SendDlgItemMessage(hwnd, \
        !           225:         DLG_MAIN_FRAMELIST, LB_GETITEMDATA, iSel, 0)
        !           226: 
        !           227: #define GetStepCount(hwnd) SendDlgItemMessage(hwnd, \
        !           228:         DLG_MAIN_FRAMELIST, LB_GETCOUNT, 0, 0)
        !           229: 
        !           230: #define GetSelStepCount(hwnd) SendDlgItemMessage(hwnd, \
        !           231:         DLG_MAIN_FRAMELIST, LB_GETSELCOUNT, 0, 0)
        !           232: 
        !           233: #define ResumePreview(hwnd, id) \
        !           234:     SendDlgItemMessage(hwnd, id, PM_UNPAUSEANIMATION, 0, 0)
        !           235: 
        !           236: #define PausePreview(hwnd, id) \
        !           237:     SendDlgItemMessage(hwnd, id, PM_PAUSEANIMATION, 0, 0)
        !           238: 
        !           239: #define SetPreviewStep(hwnd, id, iStep) \
        !           240:     SendDlgItemMessage(hwnd, id, PM_SETSTEP, iStep, 0)
        !           241: 
        !           242: #define PreviewCursor(hwnd, id) \
        !           243:     SendDlgItemMessage(hwnd, id, PM_NEWCURSOR, 0, 0)
        !           244: 
        !           245: #define FmtFree( psz ) if((psz) != gszDots) LocalFree(psz); else
        !           246: 
        !           247: #define UpdateStepSel( hWnd )                                    \
        !           248:     SendMessage(hWnd, WM_COMMAND, MAKEWPARAM( DLG_MAIN_FRAMELIST, \
        !           249:             LBN_SELCHANGE), (LPARAM)(GetDlgItem(hWnd,             \
        !           250:             DLG_MAIN_FRAMELIST)))
        !           251: 
        !           252: #define SetStepSel(hWnd, iMin, iMax)    (               \
        !           253:     SendDlgItemMessage(hWnd, DLG_MAIN_FRAMELIST,        \
        !           254:             LB_SELITEMRANGE, TRUE, MAKELPARAM((iMin), (iMax))), \
        !           255:     UpdateStepSel(hWnd)                                 \
        !           256: )
        !           257: 
        !           258: 
        !           259: /*
        !           260:  * Function Prototypes
        !           261:  *
        !           262:  */
        !           263: 
        !           264: /*
        !           265:  * In aniedit.c
        !           266:  */
        !           267: BOOL InitApplication(HANDLE);
        !           268: BOOL InitInstance(HANDLE, int);
        !           269: INT  APIENTRY GetHeightFromPoints( int pts);
        !           270: BOOL APIENTRY MainWndProc(HWND hWnd, UINT message, UINT wParam, LONG lParam);
        !           271: void DrawCursorListItem( DRAWITEMSTRUCT *pdis );
        !           272: int FmtMessageBox( HWND hwnd, DWORD dwTitleID, LPTSTR pszTitleStr,
        !           273:     UINT fuStyle, BOOL fSound, DWORD dwTextID, ... );
        !           274: LPTSTR FmtSprintf( DWORD id, ... );
        !           275: PVOID AllocMem( DWORD cb );
        !           276: LRESULT CALLBACK PreviewWndProc( HWND hwnd, UINT msg, WPARAM wParam,
        !           277:         LPARAM lParam );
        !           278: VOID NextFrame( HWND hwnd, BOOL fRun );
        !           279: VOID SetWindowFileTitle(HWND hWnd, LPTSTR szFileTitle);
        !           280: void AniAddFontModule(HINSTANCE hInst);
        !           281: VOID ReadRegistry( VOID );
        !           282: VOID WriteRegistry( VOID );
        !           283: LRESULT CALLBACK BtnBarWndProc( HWND hwnd, UINT msg, WPARAM wParam,
        !           284:         LPARAM lParam);
        !           285: 
        !           286: 
        !           287: /*
        !           288:  * In anicmd.c
        !           289:  */
        !           290: BOOL DoCommand( HWND hWnd, UINT wParam, LONG lParam );
        !           291: VOID ExitCommand(HWND hWnd);
        !           292: BOOL CheckDirty(HWND hWnd);
        !           293: void NewAniCursor( HWND hwnd );
        !           294: BOOL ExecProgram( HWND hwndCaller, LPTSTR pszCmdLine );
        !           295: BOOL GetCurrentSel( HWND hwnd, int id, int *paiSel, int ciSel, int *pcSel );
        !           296: VOID SetCurrentSel( HWND hwnd, int id, BOOL fExtend, int iSel);
        !           297: VOID EditFrame(HWND hWnd, BOOL fEditFrame);
        !           298: PSTEP NewStep( void );
        !           299: VOID DestroyStep( PSTEP ps );
        !           300: VOID CopyStep( PSTEP psDst, PSTEP psSrc );
        !           301: VOID LinkStepFrame(PSTEP ps, PFRAME pf );
        !           302: VOID DestroyFrame( PFRAME pf );
        !           303: PCLPBRDDAT NewClpBrdDat( void );
        !           304: VOID DestroyClpBrdDat(PCLPBRDDAT pcbd);
        !           305: int __cdecl RevCompInts(const void *elm1, const void *elm2);
        !           306: BOOL APIENTRY About(HWND, UINT, UINT, LONG);
        !           307: BOOL APIENTRY OptionsProc( HWND hDlg, UINT message, UINT wParam, LONG lParam);
        !           308: void ClearStepSel( HWND hWnd );
        !           309: 
        !           310: 
        !           311: 
        !           312: /*
        !           313:  * In anifile.c
        !           314:  */
        !           315: BOOL CreateFrameFromCursorFile(HWND hwnd,  LPTSTR pszFile, BOOL fEdit);
        !           316: HANDLE PromptAndOpenFile( HWND hwnd, DWORD  cchFileTitle, LPTSTR pszFileTitle,
        !           317:     DWORD cchFileName, LPTSTR pszFileName, LPTSTR pszFilter);
        !           318: BOOL PromptForFile( HWND hwnd, DWORD  cchFileTitle, LPTSTR pszFileTitle,
        !           319:     DWORD  cchFileName, LPTSTR pszFile, LPTSTR pszFilter, LPTSTR pszDlgTitle,
        !           320:     BOOL fSave );
        !           321: BOOL ReadAniFile( HWND hwnd, HANDLE hf );
        !           322: PFRAME ReadIconFromFile(HWND hwnd, HANDLE hf, DWORD ckSize);
        !           323: BOOL ReadTag( HANDLE hf, PRTAG ptag);
        !           324: BOOL ReadChunk( HANDLE hf, PRTAG ptag, PVOID pv);
        !           325: BOOL ReadChunkN( HANDLE hf, PRTAG ptag, PVOID pv, DWORD cbMax);
        !           326: BOOL SkipChunk( HANDLE hf, PRTAG ptag);
        !           327: DWORD CalcCheckSum( PBYTE pb, DWORD cb );
        !           328: HICON ConvertDataToIcon( PFRAME pf, WORD *pxHotSave, WORD *pyHotSave );
        !           329: BOOL GetTempCursorFileName( LPTSTR pszName );
        !           330: BOOL SaveAniFile( HWND hwnd, HANDLE hf );
        !           331: BOOL WriteTag(HANDLE hf, PRTAG prtag);
        !           332: BOOL WriteType(HANDLE hf, FOURCC ckID );
        !           333: BOOL WriteTagData(HANDLE hf, PRTAG prtag, VOID *pvData );
        !           334: VOID SaveFile(HWND hwnd, BOOL fPrompt);

unix.superglobalmegacorp.com

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