コード例 #1
0
ファイル: Mainfrm.cpp プロジェクト: Kalamatee/RayStorm
/*************
 * DESCRIPTION:	load window placement set window
 * INPUT:			system
 * OUTPUT:			-
 *************/
void CMainFrame::InitialShowWindow(UINT nCmdShow)
{
	WINDOWPLACEMENT wp;
	CSize sizeSplitter;
	CRect rect;
	
	((CCamView*)m_wndSplitterH.GetPane(0, 0))->bLockOnSizeRedraw = FALSE;

	if (!ReadWindowPlacement(&wp, &sizeSplitter))
	{
		GetClientRect(rect);
		sizeSplitter.cx = rect.right - 100;
		sizeSplitter.cy = rect.bottom - 130;
	}
	else
	{
		SetWindowPlacement(&wp);
		GetClientRect(rect);
	}

	wp.showCmd = nCmdShow;

	m_wndSplitterH.SetColumnInfo(0, sizeSplitter.cx, 0);
	m_wndSplitterV.SetRowInfo(0, sizeSplitter.cy, 0);
	// do the recalc now, otherwise the Splitter-windows would "forget" it
	m_wndSplitterV.RecalcLayout();
	m_wndSplitterH.RecalcLayout();

	sizeOld.cx = rect.Width();
	sizeOld.cy = rect.Height();

	ShowWindow(wp.showCmd);
}
コード例 #2
0
ファイル: Options.cpp プロジェクト: stievie/bibedt
/**
 * \brief Load options and settings from Registry.
 */
void COptions::Load()
{
    m_Backup = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("Backup"), 1);
    m_AutoCompleteValues = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("AutoCompleteValues"), 1);
    m_OpenLastFile = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("OpenLastFile"), 0);
    m_GridLines = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("GridLines"), 0);
    m_ReplaceSpecialChar = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("ReplaceSpecialChar"), 1);
    m_ScrollToSelected = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("ScrollToSelected"), 1);
    m_DisableSave = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("DisableSave"), 0);

    // Files
    m_ConfigDir = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("ConfigDir"), GetAppPath());
    UpdateFiles();
    ((CBibedtApp*)AfxGetApp())->m_Language.SetCurLang(AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("Language"), _T("")));
    // Fonts
    m_FontProp = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("Font.Prop"), _T("Times New Roman"));
    m_FontMono = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("Font.Mono"), _T("Courier New"));
    m_FontSans = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("Font.Sans"), _T("MS Sans Serif"));

    m_TranslateASCII = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("TranslateASCII"), 1);
    m_SortCaseSensitive = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("CaseSensSort"), 0);
    m_SortOnSave = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("SortOnSave"), 0);
    m_LineLength = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("LineLength"), MAX_LINE);
    m_CiteFormat = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("CiteFormat"), _T("\\cite{%s}"));
    m_ShowCiteDlg = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("ShowCiteDlg"), 1);
    m_DOIURL = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("DOIURL"), DEF_DOI_URL);
    if (!m_DOIURL.IsEmpty()) {
        if (m_DOIURL.Left(7).CompareNoCase(_T("http://")) != 0)
            m_DOIURL = _T("http://") + m_DOIURL;
        if (m_DOIURL.Right(1).Compare(_T("/")) != 0)
            m_DOIURL += _T("/");
    } else
        m_DOIURL = DEF_DOI_URL;
    m_EditorClassName = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("EditorClass"), _T(""));
    m_EditorParentClass = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("EditorParentClass"), _T(""));

    // Print
    m_MarginLeft = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("MarginLeft"), MARGIN_LEFT);
    m_MarginTop = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("MarginTop"), MARGIN_TOP);
    m_MarginRight = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("MarginRight"), MARGIN_RIGHT);
    m_MarginBottom = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("MarginBottom"), MARGIN_BOTTOM);
    m_PrintUnits = (enum Units)AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("PrintUnits"), 0);

    // Columns
    m_ColCount = AfxGetApp()->GetProfileInt(SETTINGS_KEY, _T("ColCount"), 3);

    // Quicksearch
    m_QuickSearchFields = AfxGetApp()->GetProfileString(SETTINGS_KEY, _T("QuickSearchFields"), _T("author;title;"));

    // Window placement
    ReadWindowPlacement(_T(""),	&m_WindowPlacement);
}
コード例 #3
0
ファイル: mainfrm.cpp プロジェクト: deepmatrix/blaxxun-cc3d
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
      return -1;

#if 0
   
   m_saveWindowSize = AfxGetApp()-> GetProfileInt("GLView","saveWindowSize",1);

   if (m_saveWindowSize) {
      WINDOWPLACEMENT wp;
	   if (ReadWindowPlacement(&wp)) {

         SetWindowPlacement(&wp);
      }  
    
   }
#endif



  	EnableDocking(CBRS_ALIGN_ANY); // 4.0


	if (!m_wndToolBar.Create(this,CBRS_TOP|CBRS_TOOLTIPS|CBRS_FLYBY|WS_VISIBLE) ||
		!m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
		!m_wndToolBar.SetButtons(buttons,
		  sizeof(buttons)/sizeof(UINT)))
	{
		TRACE("Failed to create toolbar\n");
		return -1;		// fail to create
	}

   if (!CreateUrlBar()) {
	   TRACE("Failed to create url \n");
		return -1;		// fail to create

   }


	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE("Failed to create status bar\n");
		return -1;		// fail to create
	}
   // new 4.0
   UINT nID, nStyle;
	int cxWidth;

	m_wndStatusBar.GetPaneInfo( 0, nID, nStyle, cxWidth);
	m_wndStatusBar.SetPaneInfo( 0, nID, SBPS_STRETCH|SBPS_NORMAL, cxWidth);
   //
	// New VC 2.0
	// TODO: Delete these three lines if you don't want the toolbar to
	//  be dockable
	//m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
	//EnableDocking(CBRS_ALIGN_ANY);
	//DockControlBar(&m_wndToolBar);

	// TODO: Remove this if you don't want tool tips
	//m_wndToolBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
	//	CBRS_TOOLTIPS | CBRS_FLYBY);
	return 0;
}
コード例 #4
0
ファイル: VAALOG.cpp プロジェクト: zephyrer/activelog
// CALApp initialization
BOOL CALApp::InitInstance()
{
    // this call will popup onother instance if is running
    if (g_SingleInstanceObj.IsAnotherInstanceRunning())
    {
        return FALSE;
    }

    // Register and exit if it fails
    if (!g_SingleInstanceObj.RegisterInstance())
    {
        TRACE("Class Registration Failed\n");
        return FALSE;
    }

    // InitCommonControlsEx() is required on Windows XP if an application
    // manifest specifies use of ComCtl32.dll version 6 or later to enable
    // visual styles.  Otherwise, any window creation will fail.
    INITCOMMONCONTROLSEX InitCtrls;
    InitCtrls.dwSize = sizeof(InitCtrls);
    // Set this to include all the common control classes you want to use
    // in your application.
    InitCtrls.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&InitCtrls);

    CWinApp::InitInstance();

    // Initialize OLE libraries
    if (!AfxOleInit())
    {
        AfxMessageBox(IDP_OLE_INIT_FAILED);
        return FALSE;
    }
    AfxEnableControlContainer();

    // Standard initialization
    // If you are not using these features and wish to reduce the size
    // of your final executable, you should remove from the following
    // the specific initialization routines you do not need
    // Change the registry key under which our settings are stored
    // TODO: You should modify this string to be something appropriate
    // such as the name of your company or organization
    SetRegistryKey(_T("ActiveLog"));

    // DO WE HAVE THIS ???
    //LoadStdProfileSettings(4);  // Load standard INI file options (including MRU)
    //If nMaxMRU is 0, no MRU list will be maintained.
    LoadStdProfileSettings(0);

    WINDOWPLACEMENT wp;
    if (ReadWindowPlacement(&wp))
    {
        if (wp.flags & WPF_RESTORETOMAXIMIZED)
            m_nCmdShow = SW_SHOWMAXIMIZED;
    }

    // Register the application's document templates.  Document templates
    //  serve as the connection between documents, frame windows and views
    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
        IDR_MAINFRAME,
        RUNTIME_CLASS(CALDoc),
        RUNTIME_CLASS(CMainFrame),       // main SDI frame window
        RUNTIME_CLASS(CLeftView));
    if (!pDocTemplate)
        return FALSE;
    AddDocTemplate(pDocTemplate);

    // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);

    // http://support.microsoft.com/kb/q129095/
    // info about reg type and names

    // App was launched with /Embedding or /Automation switch.
    // Run app as automation server.
    if (cmdInfo.m_bRunEmbedded || cmdInfo.m_bRunAutomated)
    {
        // Register all OLE server factories as running.  This enables the
        //  OLE libraries to create objects from other applications
        COleTemplateServer::RegisterAll();

        // WORKAROUND - TO INITIALIZE DOC-VIEW
        // Don't show the main window
        //return TRUE;
    }
    // App was launched with /Unregserver or /Unregister switch.  Unregister
    // typelibrary.  Other unregistration occurs in ProcessShellCommand().
    else if (cmdInfo.m_nShellCommand == CCommandLineInfo::AppUnregister)
    {
        //FALSE results in unregistering all COM objects implemented as
        //CCmdTarget derived classes.
        COleObjectFactory::UpdateRegistryAll(FALSE);
        AfxOleUnregisterTypeLib(_tlid, _wVerMajor, _wVerMinor);
    }
    // App was launched standalone or with other switches (e.g. /Register
    // or /Regserver).  Update registry entries, including typelibrary.
    else
    {
        COleObjectFactory::UpdateRegistryAll();
        // Register all OLE server factories as running.  This enables the
        //  OLE libraries to create objects from other applications
        COleTemplateServer::RegisterAll();
        AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid);
    }

    // warning C6214: Cast between semantically different integer types: HRESULT to a Boolean type
    // move this to setup application ???

    // v.0.09.02 - fix for Vista
    // do not exit application, this job has been moved to installation
    RegisterSafeScripting();

    // Dispatch commands specified on the command line.  Will return FALSE if
    // app was launched with /RegServer, /Register, /Unregserver or /Unregister.
    if (!ProcessShellCommand(cmdInfo))
        return FALSE;

    // The one and only window has been initialized, so show and update it
    m_pMainWnd->ShowWindow(SW_SHOW);
    m_pMainWnd->UpdateWindow();
    // call DragAcceptFiles only if there's a suffix
    //  In an SDI app, this should occur after ProcessShellCommand
    return TRUE;
}