BOOL PopupWindow( HWND hParent, ITEMID idControl, ITEMID idDlg, DLGPROC lpDlgControl) /***********************************************************************/ { HWND hControl, hPopup; RECT Rect; hControl = GetDlgItem(hParent, idControl); if (!hControl) return(FALSE); GetWindowRect(hControl, &Rect); if (!LBUTTON) return(FALSE); hPopup = (HWND)AstralDlg( YES, hInstAstral, hParent, idDlg, lpDlgControl ); if (!hPopup) return(FALSE); SetWindowPos(hPopup, NULL, Rect.right, Rect.top, 0, 0, SWP_NOSIZE|SWP_NOZORDER); SetWindowPos(hPopup, NULL, Rect.right, Rect.top, 0, 0, SWP_NOSIZE|SWP_NOMOVE|SWP_SHOWWINDOW|SWP_NOZORDER); UpdateWindow(hPopup); while (LBUTTON) ; AstralDlgEnd( hPopup, TRUE ); return(TRUE); }
LOCAL void ShieldFloat_OnClose(HWND hDlg) /************************************************************************/ { TurnOffShieldPreview(); QuickProbeEnd( hDlg, -1, -1 ); ColorMask.On = !ColorMask.IfHidden; AstralDlgEnd( hDlg, FALSE ); UpdateStatusBar( NO, NO, NO, YES ); if ( Tool.hRibbon ) SendMessage( Tool.hRibbon, WM_SHIELDCHANGE, 0, 0L ); // SaveToolPreferences( IDC_SHIELD ); }
VOID back_to_windows( int flag ) { /* Don't go back to windows if we never left! */ if (flag) { /* We're coming back from the picture window */ #ifndef WIN32 PicwinOff((LPSTR)palette1,0,NULL,NULL,NULL); /* restore windows disp */ #endif ReleaseCapture( ); AstralDlgHide( IDD_GRAB ); /* Force a windows redisplay */ ShowCursor( TRUE ); AstralDlgEnd( AstralDlgGet( IDD_GRAB ), TRUE ); } }
LOCAL void About_OnCommand( HWND hDlg, int id, HWND hControl, UINT codeNotify ) /************************************************************************/ { switch (id) { case IDC_ABOUTAPP: PopupWindow(hDlg, id, id, DlgDriversProc); break; case IDC_MGX: case IDC_PICTPUB: case IDC_PHOTOMAGIC: case IDC_DESIGNER: case IDC_CHARISMA: case IDC_DRAWPLUS: case IDC_ORGCHART: case IDC_ABCFLOWCHART: case IDC_SNAPGRAFX: case IDC_CLIPART: case IDC_TECHSUPT: case IDC_PHOTOCREDITS: if ( bTrack ) KillTimer( hDlg, bTrack ); bTrack = NO; EnableWindow(hDlg, FALSE); AstralDlg( NO, PictPubApp.GetResourceHandle(), hDlg, id, DlgWarningProc ); EnableWindow(hDlg, TRUE); bScroll = NO; SetTimer( hDlg, bTrack = TRUE, 2, NULL ); break; case IDOK: case IDCANCEL: if ( bTrack ) KillTimer( hDlg, bTrack ); bTrack = NO; AstralDlgEnd( hDlg, FALSE ); break; default: break; } }
BOOL WINPROC EXPORT DlgTextProc( /***********************************************************************/ HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { int i; WORD wKey; HFONT hFont; STRING szString; switch (msg) { case WM_INITDIALOG: RibbonInit( hDlg ); ColorInit( hDlg ); GetFonts( hDlg ); CheckRadioButton( hDlg, IDC_TEXT_T1, IDC_TEXT_T10, Text.nFont+IDC_TEXT_T1 ); Text.Size = 48; InitSlide( hDlg, IDC_TEXT_SIZE, Text.Size, 24, 200 ); Text.Angle = 0; InitSlide( hDlg, IDC_TEXT_ANGLE, 0, -2, 2 ); ControlEnable(hDlg, IDC_TEXT_ANGLE, TextCanRotate(hDlg, Text.nFont)); for ( i=0; i<max(10,Text.nFont); i++ ) { hFont = CreateFont( /* Height */ 45, /* Width */ 0, /* Escapement */ 0, /* Orientation */ 0, /* Weight */ FW_NORMAL, /* Italic */ FALSE, /* UnderLine */ FALSE, /* StrikeOut */ FALSE, /* CharSet */ Text.lpFontList[i].fdCharSet, /* Output Precis */ OUT_CHARACTER_PRECIS, /* Clip Precis */ CLIP_DEFAULT_PRECIS, /* Quality */ PROOF_QUALITY, /* PitchAndFamily */ Text.lpFontList[i].fdPitchAndFamily, /* Face */ Text.lpFontList[i].fdFaceName ); if ( hFont ) SendDlgItemMessage( hDlg, IDC_TEXT_T1+i, WM_SETFONT, (WPARAM)hFont, 0L ); } if ( lpImage ) { bTextBegun = TextBegin( lpImage->hWnd, 10/*x*/, 40/*y*/ ); Tool.bActive = YES; SetFocus( lpImage->hWnd ); } else bTextBegun = NO; // fall thru case WM_CONTROLENABLE: case WM_DOCACTIVATED: break; case WM_DESTROY: if ( bTextBegun ) { if ( lpImage ) { TextEnd( lpImage->hWnd, NO/*fCancel*/ ); Tool.bActive = NO; AstralUpdateWindow( lpImage->hWnd ); } bTextBegun = NO; } for ( i=0; i<max(10,Text.nFont); i++ ) { if ( hFont = (HFONT)SendDlgItemMessage( hDlg, IDC_TEXT_T1+i, WM_GETFONT, (WPARAM)0, 0L ) ) DeleteObject( hFont ); } if ( Text.lpFontList ) { FreeUp((LPTR)Text.lpFontList); Text.lpFontList = NULL; } break; case WM_CHAR: if ( !lpImage || !bTextBegun ) return( FALSE ); TextSetFocus(); wKey = (WORD)lParam; TextKeystroke( lpImage->hWnd, wKey ); if ( wKey == VK_RETURN ) { TextAnchor( lpImage->hWnd ); RandomizeActiveColor(); break; } szString[0] = '_'; szString[1] = wKey; szString[2] = '\0'; Lowercase( szString ); SoundStartResource( szString, NO/*bLoop*/, NULL/*hInstance*/ ); break; case WM_KEYDOWN: if ( !lpImage || !bTextBegun ) return( FALSE ); wKey = lParam; switch (wKey) { case VK_UP: TextRMove( lpImage->hWnd, 0, -1 ); break; case VK_DOWN: TextRMove( lpImage->hWnd, 0, 1); break; case VK_LEFT: TextRMove( lpImage->hWnd, -1, 0); break; case VK_RIGHT: TextRMove( lpImage->hWnd, 1, 0); break; default: break; } break; case WM_SETCURSOR: return( SetupCursor( wParam, lParam, IDD_TEXT ) ); case WM_ERASEBKGND: break; // handle ERASEBKGND and do nothing; PAINT covers everything case WM_PAINT: LayoutPaint( hDlg ); break; case WM_CLOSE: AstralDlgEnd( hDlg, FALSE ); break; case WM_MEASUREITEM: case WM_DRAWITEM: return( OwnerDraw( hDlg, msg, lParam, NO ) ); case WM_CTLCOLOR: // We don't get this message // Print( "%u", HIWORD(lParam) ); // if ( HIWORD(lParam) == CTLCOLOR_BTN ) // { // SetTextColor( (HDC)wParam, RGB(0,0,255) ); // Blue text... // SetBkColor( (HDC)wParam, RGB(255,255,255) ); // on a white background // return( GetStockObject(WHITE_BRUSH) ); // } return( (BOOL)SetControlColors( (HDC)wParam, hDlg, (HWND)LOWORD(lParam), HIWORD(lParam) ) ); case WM_COMMAND: switch (wParam) { case IDC_ACTIVECOLOR: case IDC_COLORS_TEXT: ColorCommand( hDlg, wParam, lParam ); TextSetFocus(); if (bTextBegun) TextFontChanged(lpImage->hWnd); break; case IDC_TEXT_T1: case IDC_TEXT_T2: case IDC_TEXT_T3: case IDC_TEXT_T4: case IDC_TEXT_T5: case IDC_TEXT_T6: case IDC_TEXT_T7: case IDC_TEXT_T8: case IDC_TEXT_T9: case IDC_TEXT_T10: CheckRadioButton( hDlg, IDC_TEXT_T1, IDC_TEXT_T10, wParam ); Text.nFont = wParam - IDC_TEXT_T1; ControlEnable(hDlg, IDC_TEXT_ANGLE, TextCanRotate(hDlg, Text.nFont)); TextSetFocus(); if (bTextBegun) TextFontChanged(lpImage->hWnd); break; case IDC_TEXT_SIZE: Text.Size = HandleSlide( hDlg, (ITEMID)wParam, (UINT)lParam, NULL ); Text.Size = bound( Text.Size, 16, 216 ); if ( !LBUTTON ) TextSetFocus(); if (bTextBegun) TextFontChanged(lpImage->hWnd); break; case IDC_TEXT_ANGLE: i = HandleSlide( hDlg, (ITEMID)wParam, (UINT)lParam, NULL ); // -2 to 2 Text.Angle = (i * 45); if ( Text.Angle < 0 ) Text.Angle += 360; i = (Text.Angle + 22) / 45; // down to 0-8 if ( i > 4 ) i = bound( i - 8, -2, 0 ); else i = bound( i, 0, 2 ); SetSlide( hDlg, wParam, i ); if ( !LBUTTON ) TextSetFocus(); if (bTextBegun) TextFontChanged(lpImage->hWnd); break; default: return( FALSE ); } default: return( FALSE ); } return( TRUE ); }
LOCAL void Pos_OnCommand(HWND hDlg, int id, HWND hControl, UINT codeNotify) /************************************************************************/ { int idUnits; BOOL Bool; LFIXED fx, fy; LPIMAGE lpImage; int res; switch (id) { case IDC_PREF_UNITS: if ( !(idUnits = HandleCombo( hDlg, id, codeNotify )) ) break; fx = GetDlgItemSpinFixed( hDlg, IDC_POS_X, &Bool, YES); fy = GetDlgItemSpinFixed( hDlg, IDC_POS_Y, &Bool, YES); Control.Units = idUnits; SetUnitInfo((UNIT_TYPE)(Control.Units-IDC_PREF_UNITINCHES), Control.UnitRes, Control.Points); InitSpin( hDlg, fx, fy,3); break; case IDC_POS_X: if (codeNotify == EN_KILLFOCUS) { fx = GetDlgItemSpinFixed( hDlg, IDC_POS_X, &Bool, YES); InitSpin( hDlg, fx, 0,1); } else { if ( GetFocus() != GetDlgItem( hDlg, id ) ) break; if ( codeNotify != EN_CHANGE ) break; GetDlgItemSpinFixed( hDlg, IDC_POS_X, &Bool, YES ); } break; case IDC_POS_Y: if (codeNotify == EN_KILLFOCUS) { fy = GetDlgItemSpinFixed( hDlg, IDC_POS_Y, &Bool, YES); InitSpin( hDlg, 0, fy,2); } else { if ( GetFocus() != GetDlgItem( hDlg, id ) ) break; if ( codeNotify != EN_CHANGE ) break; GetDlgItemSpinFixed( hDlg, IDC_POS_Y, &Bool, YES ); } break; case IDOK: if(lpImage = GetActiveImage()) { fx = GetDlgItemSpinFixed( hDlg, IDC_POS_X, &Bool, YES ); fy = GetDlgItemSpinFixed( hDlg, IDC_POS_Y, &Bool, YES ); ImgGetInfoEx(lpImage, NULL, NULL, NULL, NULL, &res); Control.Units = Edit.SaveUnits; // get pixels lpPosParms->iBaseRes = res; lpPosParms->XOffset = FMUL(res,fx); lpPosParms->YOffset = FMUL(res,fy); AstralDlgEnd( hDlg, TRUE ); } break; case IDCANCEL: Control.Units = Edit.SaveUnits; AstralDlgEnd( hDlg, FALSE ); break; default: break; } }
LOCAL void Align_OnCommand(HWND hDlg, int id, HWND hControl, UINT codeNotify) /************************************************************************/ { LPRECT pRect; LPALIGNOBJECTS_PARMS lpAlignParms; int nType; LPOBJECT lpObject; LPIMAGE lpImage; lpAlignParms = ( LPALIGNOBJECTS_PARMS )SendDlgItemMessage( hDlg, IDC_ALIGN_COMBO, CB_GETITEMDATA, PARMS_INDEX, 0 ); switch (id) { case IDC_ALIGN_RIGHT: if (lpAlignParms->bPreview) DoReset(hDlg, lpAlignParms); lpAlignParms->HorzAlign = HA_RIGHT; AlignIcons( hDlg, lpAlignParms ); break; case IDC_ALIGN_CENTER: if (lpAlignParms->bPreview) DoReset(hDlg, lpAlignParms); lpAlignParms->HorzAlign = HA_CENTER; AlignIcons( hDlg, lpAlignParms ); break; case IDC_ALIGN_LEFT: if (lpAlignParms->bPreview) DoReset(hDlg, lpAlignParms); lpAlignParms->HorzAlign = HA_LEFT; AlignIcons( hDlg, lpAlignParms ); break; case IDC_ALIGN_HSPACE: if (lpAlignParms->bPreview) DoReset(hDlg, lpAlignParms); lpAlignParms->HorzAlign = HA_EQUAL; AlignIcons( hDlg, lpAlignParms ); break; case IDC_ALIGN_UP: if (lpAlignParms->bPreview) DoReset(hDlg, lpAlignParms); lpAlignParms->VertAlign = VA_TOP; AlignIcons( hDlg, lpAlignParms ); break; case IDC_ALIGN_MID: if (lpAlignParms->bPreview) DoReset(hDlg, lpAlignParms); lpAlignParms->VertAlign = VA_MID; AlignIcons( hDlg, lpAlignParms ); break; case IDC_ALIGN_DOWN: if (lpAlignParms->bPreview) DoReset(hDlg, lpAlignParms); lpAlignParms->VertAlign = VA_BOTTOM; AlignIcons( hDlg, lpAlignParms ); break; case IDC_ALIGN_VSPACE: if (lpAlignParms->bPreview) DoReset(hDlg, lpAlignParms); lpAlignParms->VertAlign = VA_EQUAL; AlignIcons( hDlg, lpAlignParms ); break; case IDC_PREVIEW: nType = ( int )SendDlgItemMessage( hDlg, IDC_ALIGN_COMBO, CB_GETCURSEL, 0, 0 ); if( nType == 0 ) lpAlignParms->RectAlign = RA_IMAGE; else if( nType == 1 ) lpAlignParms->RectAlign = RA_OBJECT; else lpAlignParms->RectAlign = RA_MASK; lpAlignParms->bPreview = TRUE; AlignObjects( GetActiveImage(), lpAlignParms ); EnableWindow( GetDlgItem( hDlg, IDC_PREVIEW ), FALSE ); break; case IDOK: ALIGNOBJECTS_PARMS AlignParms; if( lpAlignParms->bPreview ) { AlignParms = *lpAlignParms; lpAlignParms->HorzAlign = HA_NONE; lpAlignParms->VertAlign = VA_NONE; pRect = lpAlignParms->lpRect; if( !( lpImage = GetActiveImage() ) ) break; if( !( lpObject = ImgGetBase( lpImage ) ) ) break; while ( lpObject = ImgGetSelObject( lpImage, lpObject) ) lpObject->rObject = *pRect++; AlignObjects( GetActiveImage(), lpAlignParms ); *lpAlignParms = AlignParms; } nType = ( int )SendDlgItemMessage( hDlg, IDC_ALIGN_COMBO, CB_GETCURSEL, 0, 0 ); if( nType == 0 ) lpAlignParms->RectAlign = RA_IMAGE; else if( nType == 1 ) lpAlignParms->RectAlign = RA_OBJECT; else lpAlignParms->RectAlign = RA_MASK; lpAlignParms->bPreview = FALSE; AstralDlgEnd( hDlg, TRUE ); break; case IDC_RESET: DoReset(hDlg, lpAlignParms); break; case IDCANCEL: DoReset(hDlg, lpAlignParms); AstralDlgEnd( hDlg, FALSE ); break; default: break; } }
void Dialog_OnClose(HWND hDlg) /************************************************************************/ { AstralDlgEnd( hDlg, FALSE ); }
LOCAL void FullScreenView_OnKeyDown(HWND hDlg, UINT vk, BOOL fDown, int cRepeat, UINT flags) /***********************************************************************/ { AstralDlgEnd( hDlg, FALSE ); }
BOOL PlayMacro(LPCMDLIST lpCmdList, LPTSTR lpFileName, int nRepeat, BOOL fSequenceAll, LPLIST lpMacroList, HWND hParent, int PhotoCDResOverride, LPTSTR lpMacroName) /***********************************************************************/ { LPIMAGE lpImage; LPCMDLIST lpNewList; int nActivates, iCount; ITEMID idCommand; STRING szString, szAppName; BOOL fError; BOOL fSequence, fCmdSequence, fCopyPackets; LIST MacroList; LPCMDPKT lpCmdPkt, lpNextPkt; MACROSETUP Setup; COMMAND_TYPE CommandType; HWND hDlg = NULL; lpAbortProc = NULL; if (!hParent) hParent = PictPubApp.Get_hWndAstral(); // see if we need to copy our packets fCopyPackets = nRepeat > 1; if (!lpMacroList) { // read in the entire macro file for faster processing if (!ReadMacro(lpFileName, &MacroList)) return(FALSE); lpMacroList = &MacroList; } // count the number of activates in the macro file // because it affects sequencing nActivates = CountType(lpMacroList, CT_ACTIVATE); // turn of macro play mode and tell the world MacroMode = MM_PLAY; if ( AstralStrEx( IDS_APPNAME, szAppName, sizeof(szAppName) ) ) { if ( AstralStrEx( IDS_MACROPLAY, szString, sizeof(szString) ) ) { lstrcat( szAppName, szString ); SetWindowText( PictPubApp.Get_hWndAstral(), szAppName ); } } // reset untitled number so that if a macro is played it // can deal with untitled images the same Control.UntitledNo = 0; // If no command list passed in to work on (Macro Batch Mode) // then get command list for active image if (!lpCmdList) { if (lpImage = GetActiveImage()) lpCmdList = lpImage->lpCmdList; else lpCmdList = NULL; } // See if the macro contains any low res loads and // if so ask to user if he'd like to convert them // to hi res loads and if so do the convert if (FindCommand(lpMacroList, IDS_CMD_LOWRESLOAD)) if (AstralAffirm(IDS_CONVERTLOWRES)) if (!ConvertLowResLoad(lpMacroList)) { DestroyPacketList(lpMacroList); return(FALSE); } // disable all mouse and keyboard input during macro play EnableWindow(hParent, FALSE); // if not in a threading environment and caller wants us // to display a progress dialog, then set it up and do it if (!Control.UseThreading) { iCount = ListGetCount(lpMacroList) - nActivates; iCount *= nRepeat; Setup.iTotal = iCount; Setup.idDialog = IDD_MACRO_STATUS; Setup.lpFileName = NULL; hDlg = AstralDlgParam( YES, PictPubApp.GetResourceHandle(), hParent, IDD_MACRO_STATUS, DlgMacroStatusProc, (LPARAM)(LPVOID)&Setup ); if (hDlg) { if (lpMacroName) { STRING szString; GetWindowText(hDlg, szString, sizeof(szString)); lstrcat(szString, _T(" - ")); lstrcat(szString, lpMacroName); SetWindowText(hDlg, szString); } UpdateWindow(hDlg); } } // Repeat macro nRepeat number of times fError = FALSE; while (--nRepeat >= 0 && !fError) { if (lpAbortProc && (*lpAbortProc)()) break; // back to beginning of macro file lpNextPkt = (LPCMDPKT)ListGetHead(lpMacroList); // initialize sequencing fSequence = fSequenceAll; while (!fError && lpNextPkt) { if (lpAbortProc && (*lpAbortProc)()) { fError = TRUE; break; } // get the packet to work on if (fCopyPackets) { lpCmdPkt = CopyPacket(lpNextPkt); if (!lpCmdPkt) { fError = TRUE; break; } } else { ListUnlink(lpMacroList, lpNextPkt); lpCmdPkt = lpNextPkt; } // get command id and parms for this command idCommand = lpCmdPkt->idCommand; // Find out whether this command requires sequencing // set it here, so command can change it if needed before // we actually set fSequence fCmdSequence = GetCommandSequence(idCommand); CommandType = GetCommandType(idCommand); // Handle the different types of commands switch (CommandType) { case CT_LOAD: // create new command list for load lpNewList = CreateCommandList(); if (lpNewList) { ListAddTail(&lpNewList->PacketList, lpCmdPkt); // if we already have a command list containing commands, // kick off the execution of those commands before we // switch to the new command list if (lpCmdList && !ListIsEmpty(&lpCmdList->PacketList)) { PlaybackCommands(lpCmdList); // if some command in the command list affects // sequencing force the whole command list to // be processed if (fSequence) { FlushCommands(lpCmdList); fSequence = fSequenceAll; } } // setup new command list for us to work with lpCmdList = lpNewList; lpCmdList->PhotoCDResOverride = PhotoCDResOverride; // If there are any activates in this macro make sure a // command that creates an image processes immediately if (nActivates) { PlaybackCommands(lpCmdList); FlushCommands(lpCmdList); fSequence = fSequenceAll; fCmdSequence = NO; // already sequenced } } break; case CT_COPY: // Make sure we have a command list to work with if (!lpCmdList) { Message(IDS_NOIMAGETOWORKON); fError = TRUE; break; } // Just add this command to the command list ListAddTail(&lpCmdList->PacketList, lpCmdPkt); // If there are any activates in this macro make sure a // command that creates an image processes immediately if (nActivates) { PlaybackCommands(lpCmdList); FlushCommands(lpCmdList); fSequence = fSequenceAll; fCmdSequence = NO; // already sequenced } break; case CT_SAVE: case CT_EDIT: case CT_MASK: case CT_MODE: case CT_EDITUNDO: case CT_MASKUNDO: case CT_EDITOBJ: case CT_CLOSE: // Make sure we have a command list to work with if (!lpCmdList) { Message(IDS_NOIMAGETOWORKON); fError = TRUE; break; } if (CommandType == CT_SAVE) { PlaybackCommands(lpCmdList); if (!lpCmdList->ThreadData.lpImage) { Message(IDS_NOIMAGETOWORKON); fError = TRUE; break; } } // Just add this command to the command list ListAddTail(&lpCmdList->PacketList, lpCmdPkt); if (CommandType != CT_CLOSE) break; case CT_ACTIVATE: // Program or commands that affect window activation // are processed here switch (idCommand) { case IDS_CMD_CLOSE: case IDS_CMD_ACTIVATEWINDOW: { // if we already have a command list containing commands, // kick of the execution of those commands before we // switch to the new command list if (lpCmdList && !ListIsEmpty(&lpCmdList->PacketList)) { PlaybackCommands(lpCmdList); // if some command in the command list affects // sequencing force the whole command list to // be processed if (fSequence) { FlushCommands(lpCmdList); fSequence = fSequenceAll; } } // if this was a close command, then wack the command list pointer if (idCommand == IDS_CMD_CLOSE) lpCmdList = NULL; else { // now process the activate and get a new command list lpNewList = ProgActivateWindow( (LPACTIVATEWINDOW_PARMS)lpCmdPkt->lpParms); // setup the new command list if we got one if (lpNewList) lpCmdList = lpNewList; else { CommandError(idCommand); fError = TRUE; } // activate don't go through command processing // so we have to free it up here FreeUpPacket(lpCmdPkt); } } break; default: break; } break; default: break; } // if command just handled requires sequencing // set sequencing flag if (fCmdSequence) fSequence = YES; if (fCopyPackets) // get next command packet in macro list lpNextPkt = (LPCMDPKT)ListGetNext(lpNextPkt); else // head of list will be next one if we're not copying lpNextPkt = (LPCMDPKT)ListGetHead(lpMacroList); } } // get rid of macro list DestroyPacketList(lpMacroList); // if we already have a command list containing commands, // kick off the execution of those commands if (lpCmdList && !ListIsEmpty(&lpCmdList->PacketList)) { PlaybackCommands(lpCmdList); if (fSequenceAll) FlushCommands(lpCmdList); } // turn off the macro mode EnableWindow(hParent, TRUE); if ( AstralStrEx( IDS_APPNAME, szAppName, sizeof(szAppName) ) ) SetWindowText( PictPubApp.Get_hWndAstral(), szAppName ); // if we have a progress dialog, nuke it if (hDlg) AstralDlgEnd(hDlg, TRUE); // if we are display the macro status for another modal dialog // make sure the main app stuff is still disabled if (hParent != PictPubApp.Get_hWndAstral()) { EnableOverlappedWindow( PictPubApp.Get_hWndAstral(), FALSE ); EnableWindow(PictPubApp.Get_hWndAstral(), FALSE); } MacroMode = MM_NONE; return(TRUE); }
LOCAL void Convert_OnCommand(HWND hDlg, int id, HWND hControl, UINT codeNotify) /************************************************************************/ { BOOL Bool; switch (id) { case IDC_MINITYPES: // case IDC_MINI256: // case IDC_MINI16: // case IDC_MINI8: // case IDC_MINICUSTOM: if ( !(id = HandleCombo( hDlg, id, codeNotify )) ) break; Convert.MiniType = id; if (Convert.MiniType == IDC_MINI256) Convert.ConvertColors = 256; else if (Convert.MiniType == IDC_MINI16) Convert.ConvertColors = 16; else if (Convert.MiniType == IDC_MINI8) Convert.ConvertColors = 8; Convert_Enable(hDlg); break; case IDC_DITHERTYPES: // case IDC_DITHERPATTERN: // case IDC_DITHERSCATTERED: // case IDC_DITHERNONE: if ( !(id = HandleCombo( hDlg, id, codeNotify )) ) break; if ( id == IDC_DITHERPATTERN ) { Convert.fDither = YES; Convert.fScatter = NO; Convert.ConvertDitherType = DT_PATTERN; } else if ( id == IDC_DITHERSCATTERED ) { Convert.fDither = NO; Convert.fScatter = YES; Convert.ConvertDitherType = DT_SCATTER; } else { Convert.fDither = NO; Convert.fScatter = NO; Convert.ConvertDitherType = DT_NONE; } break; case IDC_PALETTETYPES: // case IDC_PALETTEOPTIMIZED: // case IDC_PALETTESTANDARD: // case IDC_PALETTECUSTOM: if ( !(id = HandleCombo( hDlg, id, codeNotify )) ) break; if (id == IDC_PALETTEOPTIMIZED) Convert.ConvertType = CT_OPTIMIZED; else if (id == IDC_PALETTESTANDARD) Convert.ConvertType = CT_STANDARD; else Convert.ConvertType = CT_CUSTOM; Convert.fOptimize = ( id == IDC_PALETTEOPTIMIZED ); Convert_Enable(hDlg); break; case IDC_PALETTECOLORS: if ( GetFocus() != GetDlgItem( hDlg, id ) ) break; if ( codeNotify != EN_CHANGE ) break; Convert.ConvertColors = GetDlgItemSpin( hDlg, id, &Bool, NO ); break; case IDC_EXTNAMES: GetExtName( hDlg, IDC_EXTNAMES, IDC_FILENAME, Convert.ConvertPalette, IDN_PALETTE, codeNotify ); break; case IDC_EXTMANAGE: PopupMenu( hDlg, id, IDC_FILENAME ); break; case IDC_ADDEXT: case IDC_DELETEEXT: case IDC_RENAMEEXT: ExtNameManager( hDlg, IDC_EXTNAMES, IDC_FILENAME, Convert.ConvertPalette, IDN_PALETTE, id, NO ); break; case IDOK: // make sure we can open a colormap if (Convert.ConvertType == CT_CUSTOM) { FNAME szFileName; LPCOLORMAP lpColorMap; if ( !LookupExtFile( Convert.ConvertPalette, szFileName, IDN_PALETTE ) ) break; if (!(lpColorMap = Palette_ReadColorMap(szFileName))) break; FrameDestroyColorMap(lpColorMap); } AstralDlgEnd( hDlg, TRUE ); break; case IDCANCEL: AstralDlgEnd( hDlg, FALSE ); break; default: break; } }
BOOL WINPROC EXPORT DlgRegisterProc(HWND hWnd,UINT wMsg,WPARAM wParam,LPARAM lParam) /****************************************************************************/ { BOOL bHandled = TRUE; FNAME szCode; FNAME szKey; FNAME szTemp; BYTE bChecksum = 0; bool bGoodCode; int len; LICENSEINFO AppLicenseInfo; switch (wMsg) { case WM_COMMAND: #ifdef WIN32 switch (LOWORD(wParam)) #else switch (wParam) #endif { case IDOK: szCode[0] = 0; GetDlgItemText(hWnd, IDC_REG_KEY, szKey, sizeof(szKey)); GetDlgItemText(hWnd, IDC_REG_CODE, szCode, sizeof(szCode)); MGXGenerateLicenseKey(szCode, 0, 0, 0, szTemp); bGoodCode = (lstrcmpi(szTemp, szKey) == 0); if (!bGoodCode) { LoadString (hInstAstral,IDS_REG_CODE_MSG,szKey,sizeof(szKey)); LoadString (hInstAstral,IDS_REG_CODE_TITLE,szCode,sizeof(szCode)); MessageBox(hWnd, szKey, szCode, MB_OK | MB_ICONEXCLAMATION); } else { WriteProfileString(lpCodeSection[iType], lpCodeEntry[iType], szCode); WriteProfileString(lpKeySection[iType], lpKeyEntry[iType], szKey); AstralDlgEnd(hWnd, YES); } break; case IDCANCEL: AstralDlgEnd(hWnd, NO); break; default: bHandled = FALSE; } // switch (wParam) break; case WM_CTLCOLOR: return ( (BOOL)SetControlColors ( (HDC)wParam, hWnd, (HWND)LOWORD(lParam), HIWORD(lParam) )); case WM_INITDIALOG: SET_CLASS_HBRBACKGROUND(hWnd, ( HBRUSH )GetStockObject(LTGRAY_BRUSH)); CenterPopup (hWnd); len = GetProfileString(lpCodeSection[iType], lpCodeEntry[iType], "", szCode, sizeof(szCode)); if (!len) { CreateNewLicense(&AppLicenseInfo); LicenseToString(&AppLicenseInfo, szCode); WriteProfileString(lpCodeSection[iType], lpCodeEntry[iType], szCode); } SetDlgItemText(hWnd, IDC_REG_CODE, szCode); break; case WM_DESTROY: break; default: bHandled = FALSE; } // switch (wMsg) return bHandled; }
BOOL WINPROC EXPORT DlgOpenProc( /************************************************************************/ HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { BOOL Bool; ITEMID id; WORD wMsg, wIndex; int i, ii, l, fp, hi, lo; FNAME szDriveNDir, szFileName, szExtension; HMENU hMenu; STRING szString; char cChar; BOOL bModifySaveName; static BOOL bDisableCancel; switch (msg) { case WM_INITDIALOG: SET_CLASS_HBRBACKGROUND(hDlg, ( HBRUSH )GetStockObject(LTGRAY_BRUSH)); CenterPopup( hDlg ); if ( !DlgDirList(hDlg, szFileSpec, IDC_FLIST, IDC_FPATH, wFileAttr) ) { lstrcpy( szFileSpec, lstrchr( szFileSpec, '*' ) ); DlgDirList(hDlg, szFileSpec, IDC_FLIST, IDC_FPATH, wFileAttr); } SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName, fSaving); CheckComboItem( hDlg, IDC_FILETYPES, IDC_ART, IDC_BMP, IDC_ART + (idFileType-IDN_ART) ); SendDlgItemMessage(hDlg, IDC_FNAME, EM_LIMITTEXT, MAX_FNAME_LEN-1, 0L); LoadComboWithDrives( hDlg, IDC_DRIVES ); LoadComboWithDirectories( hDlg, IDC_DIRS, NO ); CheckDlgButton( hDlg, IDC_SAVEPATH, Save.OKtoSavePath ); CheckDlgButton( hDlg, IDC_SAVECOMPRESS, Save.Compressed ); for (i = IDC_ART; bImageOpen && i <= IDC_BMP; ++i) { ii = i-IDC_ART; if (lstrlen(Readers[ii].szDLL)) { lstrcpy(szString, Control.ProgHome); lstrcat(szString, Readers[ii].szDLL); if (!FileExists(szString)) { if ( GetPrivateProfileString( "Micrografx", "Libraries", "", szString, sizeof(STRING), "MGX.INI" ) > 2 ) FixPath( szString ); lstrcat(szString, Readers[ii].szDLL); if (!FileExists(szString)) { ControlEnable( hDlg, i, NO); continue; } } } if (fSaving) ControlEnable( hDlg, i, lpImage && Readers[ii].bSave[FrameDepth(ImgGetBaseEditFrame(lpImage))] ); else ControlEnable( hDlg, i, Readers[ii].bOpen ); } if ( bImageOpen && lpImage ) { idDataType = lpImage->DataType; for (i = IDC_SAVECT; i <= IDC_SAVE24BITCOLOR; ++i) ControlEnable( hDlg, i, Readers[idFileType-IDN_ART].bTypes[i-IDC_SAVECT]); CheckComboItem( hDlg, IDC_DATATYPES, IDC_SAVECT, IDC_SAVE24BITCOLOR, idDataType ); ControlEnable( hDlg, IDC_SAVECOMPRESS, Readers[idFileType-IDN_ART].bCompressed ); } SetFocus( GetDlgItem( hDlg, IDC_FNAME ) ); SendDlgItemMessage(hDlg, IDC_FNAME, EM_SETSEL, NULL, MAKELONG(0, 0x7fff)); bNavigated = NO; bDisableCancel = NO; return( FALSE ); case WM_PALETTECHANGED: break; case WM_MENUSELECT: lo = LOWORD(lParam); hi = HIWORD(lParam); if (hi == 0) break; if (lo == -1) break; if (lo & MF_SYSMENU) break; if (lo & MF_POPUP) { hMenu = (HMENU)wParam; while (GetSubMenu(hMenu, 0)) hMenu = GetSubMenu(hMenu, 0); id = GetMenuItemID(hMenu, 0); if (id <= 0) break; wParam = id - 1; } HintLine( wParam ); break; case WM_SETCURSOR: return( SetupCursor( wParam, lParam, idOpen ) ); case WM_CLOSE: AstralDlgEnd( hDlg, FALSE|2 ); break; case WM_MEASUREITEM: case WM_DRAWITEM: id = ((LPDRAWITEMSTRUCT)lParam)->CtlID; Bool = ( id == IDC_DRIVES || id == IDC_DIRS ); return( OwnerDraw( hDlg, msg, lParam, Bool ) ); // break; case WM_CTLCOLOR: return( (BOOL)SetControlColors( (HDC)wParam, hDlg, (HWND)LOWORD(lParam), HIWORD(lParam) ) ); case WM_COMMAND: if (wParam != IDCANCEL) bDisableCancel = NO; switch(wParam) { case IDC_FILETYPES: // case IDC_ART: // case IDC_TIFF: // case IDC_BMP: if ( !(wParam = HandleCombo( hDlg, wParam, lParam )) ) break; idFileType = IDN_ART + (wParam-IDC_ART); if (bNavigated) { LookupExtension( idFileType, szFileSpec ); } else GetFileLocation( idFileType, szFileSpec ); for (i = IDC_SAVECT; i <= IDC_SAVE24BITCOLOR; ++i) ControlEnable( hDlg, i, Readers[idFileType-IDN_ART].bTypes[i-IDC_SAVECT]); ControlEnable( hDlg, IDC_SAVECOMPRESS, Readers[idFileType-IDN_ART].bCompressed ); SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName, NO ); SendMessage( hDlg, WM_COMMAND, IDOK, 0L ); break; case IDC_DATATYPES: // case IDC_SAVECT: // case IDC_SAVELA: // case IDC_SAVESP: // scatterprint // case IDC_SAVE8BITCOLOR: // case IDC_SAVE24BITCOLOR: if ( !(wParam = HandleCombo( hDlg, wParam, lParam )) ) break; idDataType = wParam; break; case IDC_SAVEPATH: Save.OKtoSavePath = (BOOL)SendDlgItemMessage (hDlg, IDC_SAVEPATH, BM_GETCHECK, 0, 0L); // Save.OKtoSavePath = !Save.OKtoSavePath; // CheckDlgButton( hDlg, IDC_SAVEPATH, Save.OKtoSavePath ); break; case IDC_SAVECOMPRESS: Save.Compressed = (BOOL)SendDlgItemMessage (hDlg, IDC_SAVECOMPRESS, BM_GETCHECK, 0, 0L); // Save.Compressed = !Save.Compressed; // CheckDlgButton( hDlg, IDC_SAVECOMPRESS, Save.Compressed ); break; case IDC_DRIVES: wMsg = HIWORD(lParam); if ( wMsg != CBN_SELCHANGE ) break; wIndex = SendDlgItemMessage( hDlg, wParam, CB_GETCURSEL, 0, 0L); SendDlgItemMessage( hDlg, wParam, CB_GETLBTEXT, wIndex, (long)(LPSTR)szDriveNDir ); id = ExtractStringID( szDriveNDir ); if (CHDRIVE( *szDriveNDir - 'a' )) { LoadComboWithDrives(hDlg, IDC_DRIVES); break; } if (!CURRENTDIR(szString, sizeof(szString))) { GetDlgItemText(hDlg, IDC_FPATH, szString, sizeof(szString)); CHDRIVE(*szString - 'a'); LoadComboWithDrives(hDlg, IDC_DRIVES); } //12/15 SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName, NO); DlgDirList( hDlg, szFileSpec, IDC_FLIST, IDC_FPATH, wFileAttr ); LoadComboWithDirectories( hDlg, IDC_DIRS, YES ); SetDlgItemText( hDlg, IDC_DISKSPACE, DriveSize( *szDriveNDir - 'a', szString ) ); SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName, fSaving ); bNavigated = YES; break; case IDC_DIRS: wMsg = HIWORD(lParam); if ( wMsg == LBN_DBLCLK ) { SendMessage(hDlg, WM_COMMAND, IDOK, 1L); break; } if ( wMsg != LBN_SELCHANGE ) break; wIndex = SendDlgItemMessage( hDlg, wParam, LB_GETCURSEL, 0, 0L); // Figure out how to build the path name based on the selection SendDlgItemMessage( hDlg, wParam, LB_GETTEXT, wIndex, (long)(LPSTR)szDriveNDir ); id = ExtractStringID( szDriveNDir ); if ( id == IDC_PATHICON_OPEN ) i = 0; // Must start building the path from the root else if ( id == IDC_PATHICON_ACTIVE ) i = 9999; // Don't build any path - we're there else i = wIndex; // OK to build a relative path szFileName[0] = '\0'; for ( ; i<=wIndex; i++ ) { SendDlgItemMessage( hDlg, wParam, LB_GETTEXT, i, (long)(LPSTR)szDriveNDir ); id = ExtractStringID( szDriveNDir ); if ( id == IDC_PATHICON_CLOSED && i != wIndex ) continue; lstrcat( szFileName, SkipSpaces(szDriveNDir) ); if ( id != IDC_PATHICON_ROOT ) lstrcat( szFileName, "\\" ); } lstrcat( szFileName, szFileSpec ); SetFileName(hDlg, IDC_FNAME, szFileName, szSaveName, NO ); bNavigated = YES; break; case IDC_FLIST: wMsg = HIWORD(lParam); if ( wMsg == LBN_DBLCLK ) { SendMessage(hDlg, WM_COMMAND, IDOK, 1L); break; } if ( wMsg != LBN_SELCHANGE ) break; /* If a directory is selected... */ if (DlgDirSelectEx(hDlg, szFileName, sizeof(szFileName), wParam)) lstrcat(szFileName, szFileSpec); // 1-2-92 - TMR - always use SetFileName for all FNAME sets // SetDlgItemText(hDlg, IDC_FNAME, szFileName); SetFileName(hDlg, IDC_FNAME, szFileName, szSaveName, NO ); SendDlgItemMessage(hDlg, IDC_FNAME, EM_SETSEL, NULL, MAKELONG(0, 0x7fff)); // SendDlgItemMessage(hDlg, IDC_FNAME, CB_SETEDITSEL, // NULL, MAKELONG(0, 0x7fff)); break; case IDC_FNAME: /* If the name is changed, disable OK if its length goes 0 */ if (HIWORD(lParam) != EN_CHANGE) // if (HIWORD(lParam) != CBN_EDITCHANGE) break; ControlEnable( hDlg, IDOK, (BOOL)SendDlgItemMessage( hDlg, wParam, WM_GETTEXTLENGTH, 0, 0L)); // 1-2-92 - TMR - make sure Edit Box has focus to make sure // that szSaveName only gets overwritten from user input // 1-3-92 - TMR - move this after ControlEnable if (GetFocus() != GetDlgItem(hDlg, IDC_FNAME)) break; if (fSaving) { GetDlgItemText(hDlg, IDC_FNAME, szSaveName, MAX_FNAME_LEN); fUntitled = NO; } break; case IDC_FPATH: wMsg = HIWORD(lParam); if ( wMsg == BN_DOUBLECLICKED ) { SendMessage(hDlg, WM_COMMAND, IDOK, 1L); break; } if ( wMsg != BN_CLICKED ) break; GetDlgItemText(hDlg, wParam, szFileName, sizeof(szFileName)); if ( !szFileName[0] ) break; FixPath( szFileName ); lstrcat( szFileName, szFileSpec ); SetFileName(hDlg, IDC_FNAME, szFileName, szSaveName, NO ); bNavigated = YES; break; case IDOK: GetDlgItemText(hDlg, IDC_FNAME, szFileName,sizeof(szFileName)); bModifySaveName = fSaving && StringsEqual(szFileName, szSaveName); /* Strip off the drive and directory to make */ /* a DlgDirlist() call to switch over to them */ /* Loop backwards over the file name */ l = lstrlen(szFileName); while( --l >= 0 ) { cChar = szFileName[l]; /* If we find a wildcard, the next DlgDirList() takes */ /* care of drive and directory switching; so get out */ if ( cChar == '?' || cChar == '*' ) break; /* If we find a drive or directory, handle it and get out */ if ( cChar == '\\' || cChar == ':' ) { lstrcpy(szDriveNDir, szFileName); l++; szDriveNDir[l] = '\0'; lstrcat(szDriveNDir, szFileSpec); // 1-3-92 - TMR - Handle directory change error if (DlgDirList(hDlg, szDriveNDir, IDC_FLIST, IDC_FPATH, wFileAttr)) lstrcpy( szFileName, &szFileName[l] ); else { szDriveNDir[l] = '\0'; Message(IDS_EDIRECTORYCHANGE, Lowercase(szDriveNDir)); szFileName[0] = '\0'; } break; } } // 1-3-92 - TMR add extension if none present /* Check to see if the file has an extension... */ if ( !lstrchr( szFileName, '.' ) ) // if no extension... if ( LookupExtension( idFileType, szExtension ) ) { if (lstrlen(szFileName)) lstrcat( szFileName, extension(szExtension) ); else lstrcat( szFileName, szExtension); } if (bModifySaveName) lstrcpy(szSaveName, szFileName); /* Try to display a new list box */ if ( !szFileName[0] ) lstrcat(szFileName, szFileSpec); if (DlgDirList(hDlg, szFileName, IDC_FLIST, IDC_FPATH, wFileAttr)) { /* A wildcard was found and a new list displayed */ lstrcpy(szFileSpec, szFileName); SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName, fSaving ); LoadComboWithDrives( hDlg, IDC_DRIVES ); LoadComboWithDirectories( hDlg, IDC_DIRS, YES ); break; } // If there is still a path or wildcards in the name, the // file specification must be invalid if (lstrchr(szFileName, '\\') || lstrchr(szFileName, ':') || lstrchr(szFileName, '?') || lstrchr(szFileName, '*')) { lstrcpy(szString, szFileName); stripfile(szString); Message(IDS_EDIRECTORYCHANGE, Lowercase(szString)); lstrcpy(szFileSpec, filename(szFileName)); lstrcpy(szFileName, szFileSpec); // is this needed? SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName, fSaving ); break; } /* No wildcards, and the drive and dir have been changed */ LoadComboWithDrives( hDlg, IDC_DRIVES ); LoadComboWithDirectories( hDlg, IDC_DIRS, YES ); /* Check to see if the file has 8 characters or less... */ if ( fSaving ) RemoveWhiteSpace( szFileName ); FixFileName( szFileName ); /* Check to see if the file has an extension... */ if ( !lstrchr( szFileName, '.' ) ) // if no extension... if ( LookupExtension( idFileType, szExtension ) ) lstrcat( szFileName, extension(szExtension) ); // Build the fully qualified path name GetDlgItemText( hDlg, IDC_FPATH, szString, sizeof(szString) ); FixPath( szString ); lstrcat( szString, szFileName ); /* Check to see if the file exists... */ if ( (fp = _lopen( szString, OF_READ ) ) < 0 ) { /* The file does not exist */ if ( !fSaving ) { Message(IDS_EOPEN, Lowercase(szString)); break; } } else { _lclose( fp ); if ( fSaving ) { if ( !AstralAffirm( IDS_OVERWRITEIMAGE, Lowercase(szString) ) ) break; } } lstrcpy( szFileSpec, szString ); AstralDlgEnd(hDlg, TRUE|2); break; case IDC_CANCEL: case IDCANCEL: if ( bDisableCancel && !LOWORD(lParam) ) break; GetDlgItemText(hDlg, IDC_FPATH, szFileSpec,sizeof(szFileSpec)); AstralDlgEnd(hDlg, FALSE|2); break; default: return( FALSE ); } break; default: return( FALSE ); } return( TRUE ); }
BOOL WINPROC EXPORT DlgRoomWhoAreYou (HWND hWnd,UINT wMsg,WPARAM wParam,LPARAM lParam) { STRING szTmp; WORD wKey; int iTmp; BOOL bHandled = TRUE; int iPtSize = 30; if (wMsg == WM_INITDIALOG) { #ifdef _MAC RECT rEdit; #endif DefRoomProc (hWnd, wMsg, wParam, lParam); if (LoadString (hInstAstral, IDS_FONT_NORMAL, szTmp, sizeof(szTmp))) { hDlgFont = (HFONT)NULL; hDlgFont = CreateFont (-iPtSize, // Height 0, // Width 0, // Escapement 0, // Orientation 0, // Weight 0, // Italic 0, // Underline 0, // Strikeout 0, // Charset 0, // OutputPrecision 0, // ClipPrecision 0, // Quality 0, // PitchAndFamily (PSTR)szTmp); // Typeface Name if (hDlgFont != NULL) { SendDlgItemMessage (hWnd, IDC_WHO_BUTTON1, WM_SETFONT, (WPARAM)hDlgFont, 0L); SendDlgItemMessage (hWnd, IDC_WHO_BUTTON2, WM_SETFONT, (WPARAM)hDlgFont, 0L); SendDlgItemMessage (hWnd, IDC_WHO_BUTTON3, WM_SETFONT, (WPARAM)hDlgFont, 0L); SendDlgItemMessage (hWnd, IDC_WHO_BUTTON4, WM_SETFONT, (WPARAM)hDlgFont, 0L); SendDlgItemMessage (hWnd, IDC_WHO_NEWBUTTON, WM_SETFONT, (WPARAM)hDlgFont, 0L); SendDlgItemMessage (hWnd, IDC_WHO_EDIT, WM_SETFONT, (WPARAM)hDlgFont, 0L); } } #ifdef _MAC // Make sure the edit control is exactly the same size as the radio button. // Without this hack, it is smaller on the mac. if (LoadString (hInstAstral, IDS_IM_NEW, szTmp, sizeof(szTmp))) SetDlgItemText (hWnd, IDC_WHO_EDIT, szTmp); GetClientRect(GetDlgItem(hWnd, IDC_WHO_NEWBUTTON), &rEdit); SetWindowPos( GetDlgItem(hWnd, IDC_WHO_EDIT), NULL, 0, 0, RectWidth(&rEdit), RectHeight(&rEdit), SWP_NOMOVE | SWP_NOZORDER); #endif // initially hide the edit control ShowWindow (GetDlgItem(hWnd, IDC_WHO_EDIT), SW_HIDE); if (LoadString (hInstAstral, IDS_IM_NEW, szTmp, sizeof(szTmp))) SetDlgItemText (hWnd, IDC_WHO_NEWBUTTON, szTmp); DoInit (hWnd); ShowWindow (GetDlgItem(hWnd, IDOK), SW_HIDE); fButtonHidden = FALSE; bHandled = TRUE; } else if (wMsg == WM_CLOSE) { AstralDlgEnd (hWnd,TRUE|2); bHandled = TRUE; } else if (wMsg == WM_COMMAND) { switch (wParam) { // Go To Room hotspot case HS_WHO: if (CheckUsername (hWnd)) { DeleteObject (hDlgFont); GoRoom (hInstAstral, RM_ARTROOM, FALSE); } bHandled = TRUE; break; // I'm New button case IDC_WHO_NEWBUTTON: #ifndef _MAC // This problem doesn't exist on the mac if (! fNoUsers) // hack for Windows focus problem #endif { CheckRadioButton (hWnd, IDC_WHO_BUTTON1, IDC_WHO_NEWBUTTON, IDC_WHO_NEWBUTTON); ShowWindow (GetDlgItem(hWnd, IDC_WHO_NEWBUTTON), SW_HIDE); ShowWindow (GetDlgItem(hWnd, IDC_WHO_EDIT), SW_SHOW); if (LoadString (hInstAstral, IDS_YOUR_NAME, szTmp, sizeof(szTmp))) SetDlgItemText (hWnd, IDC_WHO_EDIT, szTmp); SetFocus (GetDlgItem (hWnd, IDC_WHO_EDIT)); SendDlgItemMessage (hWnd, IDC_WHO_EDIT, EM_SETSEL, 0, MAKELONG(0, -1) ); } iButtonIndex = 4; fNoUsers = FALSE; bHandled = TRUE; fButtonHidden = TRUE; break; // Scroll names down case HS_WHO_UPARROW: if (iUserCount > 4) { iTmp = iUserIndex; if (iUserIndex > 0) { iUserIndex--; ShowWindow (GetDlgItem(hWnd, HS_WHO_DNARROW), SW_SHOW); if (iUserIndex == 0) ShowWindow (GetDlgItem(hWnd, HS_WHO_UPARROW), SW_HIDE); } else ShowWindow (GetDlgItem(hWnd, HS_WHO_UPARROW), SW_HIDE); if (iUserIndex != iTmp) UpdateButtons (hWnd, iUserIndex, iUserCount); } bHandled = TRUE; break; // Scroll names up case HS_WHO_DNARROW: if (iUserCount > 4) { iTmp = iUserIndex; if (iUserIndex < (iUserCount - 4)) { iUserIndex++; ShowWindow (GetDlgItem(hWnd, HS_WHO_UPARROW), SW_SHOW); if (iUserIndex +4 >= iUserCount) ShowWindow (GetDlgItem(hWnd, HS_WHO_DNARROW), SW_HIDE); } else ShowWindow (GetDlgItem(hWnd, HS_WHO_DNARROW), SW_HIDE); if (iUserIndex != iTmp) UpdateButtons (hWnd, iUserIndex, iUserCount); } bHandled = TRUE; break; case IDC_WHO_BUTTON1: HandleButton (hWnd, 0); bHandled = TRUE; // if they click twice on same control - validate and continue if ((iButtonIndex == 0) && (CheckUsername (hWnd))) { DeleteObject (hDlgFont); GoRoom (hInstAstral, RM_ARTROOM, FALSE); } iButtonIndex = 0; break; case IDC_WHO_BUTTON2: HandleButton (hWnd, 1); bHandled = TRUE; if ((iButtonIndex == 1) && (CheckUsername (hWnd))) { DeleteObject (hDlgFont); GoRoom (hInstAstral, RM_ARTROOM, FALSE); } iButtonIndex = 1; break; case IDC_WHO_BUTTON3: HandleButton (hWnd, 2); bHandled = TRUE; if ((iButtonIndex == 2) && (CheckUsername (hWnd))) { DeleteObject (hDlgFont); GoRoom (hInstAstral, RM_ARTROOM, FALSE); } iButtonIndex = 2; break; case IDC_WHO_BUTTON4: HandleButton (hWnd, 3); bHandled = TRUE; if ((iButtonIndex == 3) && (CheckUsername (hWnd))) { DeleteObject (hDlgFont); GoRoom (hInstAstral, RM_ARTROOM, FALSE); } iButtonIndex = 3; break; case IDC_WHO_DELNAME: if (Control.CurrentUser[0] != 0) { if (! (GetNumberIniEntries() )) { if (GetUserNameByDir (Control.CurrentUser, szTmp)) { DeleteUserName (szTmp); lstrcpy (szTmp, Control.WorkPath); lstrcat (szTmp, Control.CurrentUser); #ifdef WIN32 RemoveDirectory (szTmp); #else _rmDir (szTmp); #endif clr ((LPTR)Control.CurrentUser, sizeof(Control.CurrentUser)); DoInit (hWnd); } } } bHandled = TRUE; break; case IDOK: bHandled = TRUE; if (CheckUsername (hWnd)) { DeleteObject (hDlgFont); GoRoom (hInstAstral, RM_ARTROOM, FALSE); } break; default: bHandled = FALSE; break; } } else if (wMsg == WM_CHAR) { wKey = (WORD)lParam; if (wKey == VK_DELETE) { GetUserNameString (iUserIndex, szTmp); } } else bHandled = FALSE; if (! bHandled) bHandled = DefRoomProc (hWnd, wMsg, wParam, lParam); return bHandled; }
BOOL WINPROC EXPORT DlgFloppyProc (HWND hWnd, WORD msg, WORD wParam, LONG lParam) /************************************************************************/ { int iNum; WORD wSel; DWORD dwResult; FNAME szFileName; STRING szExt; STRING szPref; STRING szTitle; STRING szText; char szNum[8]; switch (msg) { case WM_INITDIALOG: SET_CLASS_HBRBACKGROUND(hWnd, ( HBRUSH )GetStockObject(LTGRAY_BRUSH)); CenterPopup (hWnd); if (bSaving) { LoadString (hInstAstral, IDS_SAVEFLOPPY, szPref, sizeof(szPref)); SetWindowText (hWnd, szPref); ShowWindow (GetDlgItem(hWnd, IDC_CHOOSEFILE), SW_HIDE); } else { LoadString (hInstAstral, IDS_LOADFLOPPY, szPref, sizeof(szPref)); SetWindowText (hWnd, szPref); EnableWindow (GetDlgItem (hWnd, IDOK), FALSE); } LoadString (hInstAstral, IDS_SELFLOPPY, szPref, sizeof(szPref)); SetDlgItemText (hWnd, IDC_FLOPPY_TEXT, szPref); clr ((LPTR)szFloppies, sizeof(szFloppies)); if ( (GetFloppyDrives (szFloppies)) <= 1) { // if only one floppy, hide second button ShowWindow (GetDlgItem(hWnd, IDC_FLOPPY2), SW_HIDE); } else { SetDlgItemText (hWnd, IDC_FLOPPY2, &szFloppies[3]); } SetDlgItemText (hWnd, IDC_FLOPPY1, szFloppies); iStartDrive = CURRENTDRIVE; break; case WM_CTLCOLOR: return( (BOOL)SetControlColors( (HDC)wParam, hWnd, (HWND)LOWORD(lParam), HIWORD(lParam) ) ); case WM_COMMAND: switch (wParam) { case IDC_FLOPPY1: case IDC_FLOPPY2: iFloppyIndex = wParam - IDC_FLOPPY1; if (iFloppyIndex) iFloppyIndex += 2; // format the search spec. lstrcpy (szFileSpec, &szFloppies[iFloppyIndex]); lstrcat (szFileSpec, "\\"); LoadString (hInstAstral, IDS_GALLERY_PREFIX, szPref, sizeof(szPref)); lstrcat (szFileSpec, szPref); LoadString (hInstAstral, IDN_ART, szExt, sizeof(szExt)); lstrcat (szFileSpec, szExt); if (bSaving) { if (! FloppySpace (iFloppyIndex)) { LoadString (hInstAstral, IDS_SAVEFLOPPY, szTitle, sizeof(szTitle)); LoadString (hInstAstral, IDS_ENOTSPACE, szText, sizeof(szText)); MessageBox (hWnd, szText, szTitle, MB_OK | MB_ICONEXCLAMATION); break; } if (! DlgDirList (hWnd, szFileSpec, IDC_CHOOSEFILE, 0, DDL_READWRITE)) { // no files found iNum = 1; } else { // find last picture number used in listbox iNum = FindLastNumber (hWnd); iNum++; } // format a pathname/filename and save the picture wsprintf (szNum, "%d", iNum); lstrcpy (szFileSpec, &szFloppies[iFloppyIndex]); lstrcat (szFileSpec, "\\"); lstrcat (szFileSpec, szPref); lstrcat (szFileSpec, szNum); LoadString (hInstAstral, IDS_GALLERY_EXT, szExt, sizeof(szExt)); lstrcat (szFileSpec, szExt); CHDRIVE (iStartDrive); AstralDlgEnd (hWnd, NO|2); } else { DlgDirList (hWnd, szFileSpec, IDC_CHOOSEFILE, 0, DDL_READWRITE); dwResult = SendDlgItemMessage (hWnd, IDC_CHOOSEFILE, LB_GETCOUNT, 0, 0L); if (dwResult == (DWORD)0) { LoadString (hInstAstral, IDS_LOADFLOPPY, szTitle, sizeof(szTitle)); LoadString (hInstAstral, IDS_NOPICTURES, szText, sizeof(szText)); MessageBox (hWnd, szText, szTitle, MB_OK | MB_ICONEXCLAMATION); break; } else if (dwResult == (DWORD)1) { clr ((LPTR)szFileName, sizeof(FNAME)); SendDlgItemMessage (hWnd, IDC_CHOOSEFILE, LB_GETTEXT, (WPARAM)0, (LPARAM)((LPSTR)szFileName)); if (szFileName[0] != 0) { lstrcpy (szFileSpec, &szFloppies[iFloppyIndex]); lstrcat (szFileSpec, "\\"); lstrcat (szFileSpec, szFileName); } else clr ((LPTR)szFileSpec, sizeof(STRING)); CHDRIVE (iStartDrive); AstralDlgEnd (hWnd, NO|2); } } break; case IDOK: if ((dwResult = SendDlgItemMessage (hWnd, IDC_CHOOSEFILE, LB_GETCURSEL, 0, 0L)) != LB_ERR) { wSel = (WPARAM)dwResult; clr ((LPTR)szFileName, sizeof(FNAME)); SendDlgItemMessage (hWnd, IDC_CHOOSEFILE, LB_GETTEXT, (WPARAM)wSel, (LPARAM)((LPSTR)szFileName)); if (szFileName[0] != 0) { lstrcpy (szFileSpec, &szFloppies[iFloppyIndex]); lstrcat (szFileSpec, "\\"); lstrcat (szFileSpec, szFileName); CHDRIVE (iStartDrive); AstralDlgEnd (hWnd, NO|2); } else clr ((LPTR)szFileSpec, sizeof(STRING)); } break; case IDCANCEL: clr ((LPTR)szFileSpec, sizeof(STRING)); CHDRIVE (iStartDrive); AstralDlgEnd (hWnd, NO|2); break; case IDC_CHOOSEFILE: if ( HIWORD(lParam) == LBN_DBLCLK ) SendMessage (hWnd, WM_COMMAND, IDOK, 1L); else if ((SendDlgItemMessage (hWnd, IDC_CHOOSEFILE, LB_GETCURSEL, 0, 0L)) != LB_ERR) { EnableWindow (GetDlgItem (hWnd, IDOK), TRUE); } break; default: return (FALSE); } break; default: return (FALSE); break; } return (TRUE); }
BOOL CExpandImageDlg::OnCommand(WPARAM wParam, LPARAM lParam) { int id = LOWORD(wParam); //ID of control WORD codeNotify = HIWORD(wParam); //Control notification code HWND hControl = (HWND) lParam; //Handle of control LPIMAGE lpImage; FRMTYPEINFO TypeInfo; long Color; switch (id) { case IDC_EXPANDLEFT: case IDC_EXPANDRIGHT: case IDC_EXPANDTOP: case IDC_EXPANDBOTTOM: case IDC_HEIGHT: case IDC_WIDTH: case IDC_PREF_UNITS: DoExpandControls(id, codeNotify); break; case IDC_FILLINCOLOR: if (codeNotify != 1) break; lpImage = GetImage(); if (lpImage) ImgGetTypeInfo(lpImage, &TypeInfo); else FrameSetTypeInfo(&TypeInfo, FDT_RGBCOLOR, NULL); if (TypeInfo.DataType == FDT_LINEART) { if(m_FillColor.gray == 255) m_FillColor.gray = 0; else m_FillColor.gray = 255; SetColorInfo(&m_FillColor, &m_FillColor, CS_GRAY); } else if (TypeInfo.DataType == FDT_GRAYSCALE || TypeInfo.DataType == FDT_PALETTECOLOR) { if (!PalettePicker(&m_FillColor, NULL, TypeInfo.ColorMap)) break; } else if (!ColorPicker(&m_FillColor, NULL)) break; CopyRGB( &m_FillColor.rgb, &Color ); SetWindowLong(::GetDlgItem(GetSafeHwnd(),IDC_FILLINCOLOR), GWL_ACTIVE, Color ); AstralControlRepaint(GetSafeHwnd(), IDC_FILLINCOLOR); break; case IDOK: if ( (FMUL( m_Resolution, m_Width ) > MAX_IMAGE_WIDTH) || (FMUL( m_Resolution, m_Height) > MAX_IMAGE_HEIGHT)) { Message( IDS_ETOOWIDE ); break; } SetUnitResolution( 0 ); Control.Units = m_SaveUnits; SetUnitInfo((UNIT_TYPE)(Control.Units-IDC_PREF_UNITINCHES), Control.UnitRes, Control.Points); AstralDlgEnd( GetSafeHwnd(), TRUE ); break; default: break; } return CPPViewModalDlg::OnCommand(wParam, lParam); }
BOOL WINPROC EXPORT DlgGalleryProc( /***********************************************************************/ HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { FNAME szTitleSave; BOOL bUntitledSave; switch (msg) { case WM_INITDIALOG: SetControlFont (hDlg, IDC_GALLERY_T1); SetControlFont (hDlg, IDC_GALLERY_T2); SetControlFont (hDlg, IDC_GALLERY_T3); SetControlFont (hDlg, IDC_GALLERY_T4); RibbonInit( hDlg ); // fall thru... case WM_CONTROLENABLE: case WM_DOCACTIVATED: break; case WM_SETCURSOR: return( SetupCursor( wParam, lParam, IDD_FILL ) ); case WM_ERASEBKGND: break; // handle ERASEBKGND and do nothing; PAINT covers everything case WM_PAINT: LayoutPaint( hDlg ); break; case WM_CLOSE: AstralDlgEnd( hDlg, NO|2); break; case WM_MEASUREITEM: case WM_DRAWITEM: return( OwnerDraw( hDlg, msg, lParam, NO ) ); case WM_CTLCOLOR: return( (BOOL)SetControlColors( (HDC)wParam, hDlg, (HWND)LOWORD(lParam), HIWORD(lParam) ) ); case WM_COMMAND: switch (wParam) { case IDC_GALLERY_T1: // Save to Disk SendMessage( hWndAstral, WM_COMMAND, IDM_SAVESPECIAL, 0L ); break; case IDC_GALLERY_T2: // Print SendMessage( hWndAstral, WM_COMMAND, IDM_PRINT, 0L ); break; case IDC_GALLERY_T3: // To Floppy bSaving = TRUE; AstralDlg (NO|2, hInstAstral, hDlg, IDD_SAVEFLOPPY, (DLGPROC)DlgFloppyProc); if (szFileSpec[0] != 0) { bUntitledSave = lpImage->fUntitled; lpImage->fUntitled = FALSE; lstrcpy (szTitleSave, lpImage->CurFile); lstrcpy (lpImage->CurFile, szFileSpec); SendMessage (hWndAstral, WM_COMMAND, IDM_SAVESPECIAL, 0L); lstrcpy (lpImage->CurFile, szTitleSave); lpImage->fUntitled = bUntitledSave; } break; case IDC_GALLERY_T4: // From Floppy bSaving = FALSE; AstralDlg (NO|2, hInstAstral, hDlg, IDD_LOADFLOPPY, (DLGPROC)DlgFloppyProc); if (szFileSpec[0] != 0) { AstralImageLoad (IDN_ART, szFileSpec, MAYBE, NO); } break; default: return( FALSE ); } default: return( FALSE ); } return( TRUE ); }
LOCAL void FullScreenView_OnCommand(HWND hDlg, int id, HWND hControl, UINT codeNotify) /************************************************************************/ { AstralDlgEnd( hDlg, FALSE ); }
BOOL WINPROC EXPORT DlgLinesProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) /***********************************************************************/ { STRING szOptions; LPFRAME lpFrame; switch (msg) { case WM_INITDIALOG: SetControlFont (hDlg, IDC_LINES_CATEGORY); RibbonInit( hDlg ); ColorInit( hDlg ); iTotalCategories = GetExtNameCount( IDN_CUSTOM ); hOptions = OptionLoadLibrary( hDlg, IDC_LINES_CATEGORY, 11/*iCount*/, IDN_CUSTOM, iCategory, iTotalCategories ); OptionGetString( hOptions, 0, szOptions ); SetWindowText( GetDlgItem( hDlg, IDC_LINES_CATEGORY ), szOptions ); CheckRadioButton( hDlg, IDC_LINES_T1, IDC_LINES_T10, iTool+IDC_LINES_T1 ); // Fall thru... case WM_CONTROLENABLE: case WM_DOCACTIVATED: Retouch.hBrush = CreateSimpleBrush( Retouch.hBrush ); SetSimpleBrushStrokeMethod( Retouch.hBrush, SM_SIMPLE_DDA ); SetSimpleBrushSpacing( Retouch.hBrush, 100 ); OptionGetString( hOptions, iTool+1, szOptions ); lpFrame = TiffResource2Frame( hOptions, (LPSTR)MAKEINTRESOURCE(iTool+1) ); SetSimpleBrushSource( Retouch.hBrush, lpFrame, szOptions ); break; case WM_SETCURSOR: return( SetupCursor( wParam, lParam, Tool.idRibbon ) ); case WM_ERASEBKGND: break; // handle ERASEBKGND and do nothing; PAINT covers everything case WM_PAINT: LayoutPaint( hDlg ); break; case WM_DESTROY: if ( hOptions != hInstAstral ) FreeLibrary( hOptions ); return( FALSE ); case WM_CLOSE: AstralDlgEnd( hDlg, FALSE ); break; case WM_CTLCOLOR: return( (BOOL)SetControlColors( (HDC)wParam, hDlg, (HWND)LOWORD(lParam), HIWORD(lParam) ) ); case WM_COMMAND: switch (wParam) { case IDC_ACTIVECOLOR: case IDC_COLORS_LINES: ColorCommand( hDlg, wParam, lParam ); break; case IDC_LINES_CATEGORY: if ( hOptions != hInstAstral ) FreeLibrary( hOptions ); iCategory++; hOptions = OptionLoadLibrary( hDlg, IDC_LINES_CATEGORY, 11/*iCount*/, IDN_CUSTOM, iCategory, iTotalCategories ); OptionGetString( hOptions, 0, szOptions ); SetWindowText( GetDlgItem( hDlg, IDC_LINES_CATEGORY ), szOptions ); OptionGetString( hOptions, iTool+1, szOptions ); lpFrame = TiffResource2Frame( hOptions, (LPSTR)MAKEINTRESOURCE(iTool+1) ); SetSimpleBrushSource( Retouch.hBrush, lpFrame, szOptions ); break; case IDC_LINES_T1: case IDC_LINES_T2: case IDC_LINES_T3: case IDC_LINES_T4: case IDC_LINES_T5: case IDC_LINES_T6: case IDC_LINES_T7: case IDC_LINES_T8: case IDC_LINES_T9: case IDC_LINES_T10: CheckRadioButton( hDlg, IDC_LINES_T1, IDC_LINES_T10, wParam ); iTool = wParam - IDC_LINES_T1; OptionGetString( hOptions, iTool+1, szOptions ); lpFrame = TiffResource2Frame( hOptions, (LPSTR)MAKEINTRESOURCE(iTool+1) ); SetSimpleBrushSource( Retouch.hBrush, lpFrame, szOptions ); break; default: return( FALSE ); } break; default: return( FALSE ); } return( TRUE ); }