int GalleryProc( /************************************************************************/ HWND hWindow, LPARAM lParam, UINT msg) { return( ToyProc( hWindow, lParam, msg ) ); }
int TextProc( /************************************************************************/ HWND hWindow, LPARAM lParam, UINT msg) { int x, y; BOOL fCancel = NO; WORD wKey; STRING szString; static BOOL bTrackObject; static int xMove, yMove; if ( bTrackObject ) { ToyProc( hWindow, lParam, msg ); bTrackObject = Tool.bActive; Tool.bActive = YES; return( TRUE ); } x = LOWORD( lParam ); y = HIWORD( lParam ); switch (msg) { case WM_CREATE: // The first mouse down message Tool.bActive = YES; break; // Never get sent since Tool.bActive is already set in the dialog case WM_LBUTTONDOWN: // Call the sticker mover tool first to see if he wants to take over Tool.bActive = NO; ToyProc( hWindow, lParam, WM_CREATE ); if ( bTrackObject = Tool.bActive ) { ToyProc( hWindow, lParam, msg ); break; } if ( bTextBegun ) Tool.bActive = YES; xMove = x; yMove = y; // TextMove(hWindow, x, y); break; case WM_LBUTTONUP: break; case WM_SETCURSOR: return( SetToolCursor( hWindow, ID_MOVE_OBJECT, ID_PLAY_OBJECT ) ); case WM_MOUSEMOVE: // sent when ToolActive is on if ( Tool.bActive && Window.fLButtonDown ) TextOffset(hWindow, x - xMove, y - yMove); xMove = x; yMove = y; break; case WM_KILLFOCUS: break; case WM_SETFOCUS: // TextDisplayCaret( hWindow, NULL ); break; case WM_CHAR: wKey = (WORD)lParam; TextKeystroke(hWindow, wKey); if ( wKey == VK_RETURN ) { TextAnchor( hWindow ); RandomizeActiveColor(); break; } szString[0] = '_'; szString[1] = wKey; szString[2] = '\0'; Lowercase( szString ); SoundStartResource( szString, NO/*bLoop*/, NULL/*hInstance*/ ); break; case WM_KEYDOWN: wKey = lParam; switch (wKey) { case VK_UP: TextRMove(hWindow, 0, -1); break; case VK_DOWN: TextRMove(hWindow, 0, 1); break; case VK_LEFT: TextRMove(hWindow, -1, 0); break; case VK_RIGHT: TextRMove(hWindow, 1, 0); break; default: break; } break; case WM_DESTROY: // The cancel and DeactivateTool() message fCancel = (lParam == 1L); if ( fCancel ) { // an "escape" cancel TextKeystroke( hWindow, VK_ESCAPE ); } else { // a deactivate TextKeystroke( hWindow, VK_RETURN ); TextAnchor( hWindow ); RandomizeActiveColor(); HideCaret( hWindow ); DestroyCaret(); AstralUpdateWindow( hWindow ); } break; case WM_LBUTTONDBLCLK: break; } return(TRUE); }