////////////////////////////////////////////////////////////////////////////// // CDemoApp initialization BOOL CDemoApp::InitInstance() { // <dave> dump memory leaks #ifdef _DEBUG _CrtDumpMemoryLeaks(); _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif #if _MSC_VER <= 1200 // Standard initialization #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif #endif LoadStdProfileSettings(9); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate( IDR_DEMOTYPE, RUNTIME_CLASS(CDemoDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CDemoView)); demoTemplate = pDocTemplate; AddDocTemplate(pDocTemplate); // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; m_pMainWnd = pMainFrame; // This code replaces the MFC created menus with // the Ownerdrawn versions pDocTemplate->m_hMenuShared=pMainFrame->NewMenu(); pMainFrame->m_hMenuDefault=pMainFrame->NewDefaultMenu(); // This simulates a window being opened if you don't have // a default window displayed at startup pMainFrame->OnUpdateFrameMenu(pMainFrame->m_hMenuDefault); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; // Alter behaviour to not open window immediately cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; #ifdef VATI_EXTENSIONS // init m_text by a temporary CxImage CxImage *ima = new CxImage; ima->InitTextInfo( &m_text ); delete ima; //recall last used font data for Text tool _stprintf( m_text.lfont.lfFaceName, GetProfileString ( _T("TextTool"), _T("lfFaceName"), _T("Times New Roman")) ); m_text.lfont.lfCharSet = (BYTE)GetProfileInt ( _T("TextTool"), _T("lfCharSet"), EASTEUROPE_CHARSET ) ; m_text.lfont.lfWeight = GetProfileInt ( _T("TextTool"), _T("lfWeight"), 0 ); m_text.lfont.lfItalic = (BYTE)GetProfileInt ( _T("TextTool"), _T("lfItalic"), 0 ); m_text.lfont.lfUnderline = (BYTE)GetProfileInt ( _T("TextTool"), _T("lfUnderline"), 0 ); m_text.fcolor = GetProfileInt ( _T("TextTool"), _T("fcolor"), RGB( 255,255,160 )); m_text.bcolor = GetProfileInt ( _T("TextTool"), _T("bcolor"), RGB( 0, 80,160 )); m_text.opaque = (BYTE)GetProfileInt ( _T("TextTool"), _T("opaque"), 1); m_text.b_opacity = (float)(GetProfileInt( _T("TextTool"), _T("opacity"), 0 ))/(float)100.; m_text.b_round = (BYTE)GetProfileInt ( _T("TextTool"), _T("roundradius"), 25 ); m_text.smooth = (BYTE)GetProfileInt ( _T("TextTool"), _T("antialias"), 1 ); m_optJpegQuality = GetProfileInt(_T("Options"),_T("JpegQualityI"),90) + 0.001f * GetProfileInt(_T("Options"),_T("JpegQualityF"),0); m_optJpegOptions = GetProfileInt(_T("Options"),_T("JpegOptions"),0); m_optRawOptions = GetProfileInt(_T("Options"),_T("RawOptions"),0); nDocType = GetProfileInt(_T("General"),_T("DocType"),0); BCMenu::SetMenuDrawMode(GetProfileInt(_T("General"),_T("MenuStyle"),1)); m_FloodColor.rgbBlue = 255; m_FloodColor.rgbGreen = 255; m_FloodColor.rgbRed = 255; m_FloodColor.rgbReserved = 0; m_FloodTolerance = 0; m_FloodOpacity = 255; m_FloodSelect = 0; int i; for(i=0;i<25;i++) m_Filters.Kernel5x5[i]=1; for(i=0;i<9;i++) m_Filters.Kernel3x3[i]=1; m_Filters.kSize = 3; m_Filters.kBias = 0; m_Filters.kDivisor = 9; m_Filters.RotateAngle = 12.345f; m_Filters.RotateMethod = 1; m_Filters.RotateOverflow = 0; m_Filters.RotateKeepsize = 1; m_Filters.ResampleSizemode = 1; m_Filters.ResampleFactor = 2; m_Filters.ResampleW = 100; m_Filters.ResampleH = 100; m_Filters.ResampleKeepRatio = 1; m_Filters.ResampleMethod = 2; m_Filters.SkewPivotX = 0; m_Filters.SkewPivotY = 0; m_Filters.SkewX = 5.5f; m_Filters.SkewY = -5.0f; m_Filters.SkewInterp = 1; m_Filters.DitherMethod = 0; m_Filters.ThreshLevel = 128; m_Filters.ThreshPreserveColors = 0; m_Filters.ColorMode = 0; m_Filters.ColorHSL.rgbBlue = 50; m_Filters.ColorHSL.rgbGreen = 12; m_Filters.ColorHSL.rgbRed = 50; m_Filters.ColorHSL.rgbReserved = 0; m_Filters.ColorBlue = -50; m_Filters.ColorGreen = 0; m_Filters.ColorRed = 50; m_Filters.ColorSolarLevel = 128; m_Filters.ColorSolarLink = 1; m_Filters.GammaLevel = 1.23f; m_Filters.GammaR = 0.9f; m_Filters.GammaG = 1.1f; m_Filters.GammaB = 1.2f; m_Filters.GammaLink = 0; m_Filters.IncBppBPP = 24; m_Filters.DecBppBPP = 4; m_Filters.DecBppPalMethod = 1; m_Filters.DecBppErrDiff = 0; m_Filters.DecBppLimitColors = 0; m_Filters.DecBppMaxColors = 256; m_Filters.CanvasMode = 0; m_Filters.CanvasW = 800; m_Filters.CanvasH = 600; m_Filters.CanvasLeft = 20; m_Filters.CanvasRight = 20; m_Filters.CanvasTop = 10; m_Filters.CanvasBottom = 10; m_Filters.CanvasCenterH = 1; m_Filters.CanvasCenterV = 1; m_Filters.CanvasKeepRatio = 0; m_Filters.CanvasUseImageBkg = 0; m_Filters.CanvasBkg = RGB(255,255,255); m_Filters.ShadowX = -5; m_Filters.ShadowY = 5; m_Filters.ShadowR = 7; m_Filters.ShadowColor = RGB(0,0,0); m_Filters.ShadowBkg = RGB(255,255,255); m_Filters.ShadowIntensity = 128; m_Filters.ShadowRelative = 0; // recall if main window was maximized on last exit if ( GetProfileInt ( _T("Screen"), _T("maximized"), 0 )) m_nCmdShow|=SW_MAXIMIZE; #endif; // The main window has been initialized, so show and update it. pMainFrame -> ShowWindow ( m_nCmdShow ) ; pMainFrame->UpdateWindow(); // Enable drag/drop open m_pMainWnd->DragAcceptFiles(); // Register our Clipboard format name m_CF = ::RegisterClipboardFormat(_T("CF_CXIMAGE")); // Enable open from command line if (*m_lpCmdLine != 0) OpenDocumentFile(m_lpCmdLine); return TRUE; }
////////////////////////////////////////////////////////////////////////////// // CDemoApp initialization BOOL CDemoApp::InitInstance() { // <dave> dump memory leaks #ifdef _DEBUG _CrtDumpMemoryLeaks(); _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); #endif // Standard initialization #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif LoadStdProfileSettings(9); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views. CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate( IDR_DEMOTYPE, RUNTIME_CLASS(CDemoDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CDemoView)); demoTemplate = pDocTemplate; AddDocTemplate(pDocTemplate); // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; m_pMainWnd = pMainFrame; // This code replaces the MFC created menus with // the Ownerdrawn versions pDocTemplate->m_hMenuShared=pMainFrame->NewMenu(); pMainFrame->m_hMenuDefault=pMainFrame->NewDefaultMenu(); // This simulates a window being opened if you don't have // a default window displayed at startup pMainFrame->OnUpdateFrameMenu(pMainFrame->m_hMenuDefault); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; // Alter behaviour to not open window immediately cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo)) return FALSE; #ifdef VATI_EXTENSIONS // init m_text by a temporary CxImage CxImage *ima = new CxImage; ima->InitTextInfo( &m_text ); delete ima; //recall last used font data for Text tool sprintf( m_text.lfont.lfFaceName, GetProfileString ( "TextTool", "lfFaceName", "Arial") ); m_text.lfont.lfCharSet = GetProfileInt ( "TextTool", "lfCharSet", EASTEUROPE_CHARSET ) ; m_text.lfont.lfWeight = GetProfileInt ( "TextTool", "lfWeight", 0 ); m_text.lfont.lfItalic = GetProfileInt ( "TextTool", "lfItalic", 0 ); m_text.lfont.lfUnderline = GetProfileInt ( "TextTool", "lfUnderline", 0 ); m_text.fcolor = GetProfileInt ( "TextTool", "fcolor", RGB( 255,255,160 )); m_text.bcolor = GetProfileInt ( "TextTool", "bcolor", RGB( 32, 96, 0 )); m_text.opaque = GetProfileInt ( "TextTool", "opaque", 1); m_text.b_opacity = (float)(GetProfileInt( "TextTool", "opacity", 0 ))/(float)100.; m_text.b_round = GetProfileInt ( "TextTool", "roundradius", 25 ); m_optJpegQuality = GetProfileInt("Options","JpegQuality",90); // recall if main window was maximized on last exit if ( GetProfileInt ( "Screen", "maximized", 0 )) m_nCmdShow|=SW_MAXIMIZE; #endif; // The main window has been initialized, so show and update it. pMainFrame -> ShowWindow ( m_nCmdShow ) ; pMainFrame->UpdateWindow(); // Enable drag/drop open m_pMainWnd->DragAcceptFiles(); // Enable open from command line if (*m_lpCmdLine != 0) OpenDocumentFile(m_lpCmdLine); return TRUE; }