コード例 #1
1
ファイル: CpDialog.cpp プロジェクト: jimmccurdy/ArchiveGit
BOOL CCpDialog::OnInitDialog()
{
	CString strAppRootFolder = GetHomeFolder() + String(GetFolderId());

	CString strContentRootFolder;
	CRegKey regkey;
	if (regkey.Open(HKEY_CURRENT_USER, REGKEY_APP) == ERROR_SUCCESS)
	{
		ULONG nLen = 255;
		char* pszValue = new char[nLen+1];

		*pszValue = 0;
		nLen = 256;
		if (regkey.QueryStringValue(REGVAL_CONTENT_FOLDER, pszValue, &nLen) == ERROR_SUCCESS)
		{
			pszValue[nLen] = 0;
			strContentRootFolder = CString(pszValue);
		}

		delete [] pszValue;
	}

	if (strContentRootFolder.IsEmpty())
		strContentRootFolder = GetHomeFolder() + String(IDS_CONTENT_FOLDER);

	DWORD dwCount = CheckForUiUpdates(strAppRootFolder);
	CheckForNewContent(strContentRootFolder, strAppRootFolder, (dwCount > 0)/*bForceCreate*/);

	// Update the variables.xsl and linelist.xml files
	SaveAppVariablesFile(strContentRootFolder, strAppRootFolder);
	SaveContentVariablesFile(strContentRootFolder, strAppRootFolder);

	CString strCaption;
	strCaption.LoadString(GetTitleId());
	SetWindowText(strCaption);

	// Initialize the url prior to calling CDHtmlDialog::OnInitDialog()
	if (m_strCurrentUrl.IsEmpty())
		m_strCurrentUrl = "about:blank";

	CDHtmlDialog::OnInitDialog();

	// This magically makes the scroll bars appear and dis-allows text selection
	DWORD dwFlags = DOCHOSTUIFLAG_NO3DBORDER | DOCHOSTUIFLAG_THEME | DOCHOSTUIFLAG_DIALOG; // DOCHOSTUIFLAG_NO3DOUTERBORDER;
	SetHostFlags(dwFlags);

	// Add "About..." menu item to system menu.
	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(false);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icons for this dialog
	SetIcon(m_hIcon, true);		// Set big icon
	SetIcon(m_hIcon, false);	// Set small icon

	// Set the window size and position
	CRect rect;
	rect.SetRect(0, 0, 800, 600);
	if (0) // Restore the saved window size and position
	{
		DWORD dwSize = sizeof(rect);
		regkey.QueryBinaryValue(REGVAL_LOCATION, &rect, &dwSize);

		//j Someday, clip the rect to the display
		SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER | SWP_NOACTIVATE);
	}
	else
	{
		SetWindowPos(NULL, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER | SWP_NOACTIVATE);
		CenterWindow();
	}

	CString strHomePage = strAppRootFolder + String(IDS_HOME_PAGE);
	if (FileExists(strHomePage))
		Navigate(strHomePage);

	ShowWindow(SW_NORMAL);

	DragAcceptFiles(false);

	return true;  // return TRUE  unless you set the focus to a control
}
コード例 #2
0
ファイル: CpDialog.cpp プロジェクト: jimmccurdy/ArchiveGit
HRESULT CCpDialog::WindowOpen(IHTMLElement* pElement, int l, int t, int w, int h, LPCSTR pstrName)
{
	if (!pElement)
		return E_FAIL;

	CComBSTR bstrURL;
	pElement->get_className(&bstrURL);
	CString strURL(bstrURL);
	int iProtocol = strURL.Find(':');
	if (iProtocol < 0 || iProtocol > 5)
	{
		CString strAppRootFolder = GetHomeFolder() + String(GetFolderId());
		strURL = strAppRootFolder + strURL;
	}

	// Get the desired window size and location
	if (l < 0) l = (::GetSystemMetrics(SM_CXSCREEN) - w) / 2;
	if (l < 0) l = 0;
	if (t < 0) t = (::GetSystemMetrics(SM_CYSCREEN) - h) / 2;
	if (t < 0) t = 0;

	RECT Rect = {l, t, l+w, t+h};
	CWorkspaceDialog* pWorkspace = CWorkspaceDialog::CreateModeless(GetDesktopWindow()/*pParent*/, strURL, &Rect, pstrName);
	if (pWorkspace)
		m_WorkspaceArray.Add(pWorkspace);
	
	return S_OK;
}
コード例 #3
0
wxString ConfigManager::LocateDataFile(const wxString& filename, int search_dirs)
{
    wxPathList searchPaths;

    // user dirs have precedence
    if (search_dirs & sdPluginsUser)
        searchPaths.Add(GetPluginsFolder(false));
    if (search_dirs & sdScriptsUser)
        searchPaths.Add(GetScriptsFolder(false));
    if (search_dirs & sdDataUser)
        searchPaths.Add(GetDataFolder(false));

    // then we have global dirs
    if (search_dirs & sdPluginsGlobal)
        searchPaths.Add(GetPluginsFolder(true));
    if (search_dirs & sdScriptsGlobal)
        searchPaths.Add(GetScriptsFolder(true));
    if (search_dirs & sdDataGlobal)
        searchPaths.Add(GetDataFolder(true));

    // rest of the dirs
    if (search_dirs & sdCurrent)
        searchPaths.Add(::wxGetCwd());
    if (search_dirs & sdConfig)
        searchPaths.Add(GetConfigFolder());
    if (search_dirs & sdHome)
        searchPaths.Add(GetHomeFolder());
    if (search_dirs & sdBase)
        searchPaths.Add(GetExecutableFolder());
    if (search_dirs & sdTemp)
        searchPaths.Add(GetTempFolder());

    // PATH env. var
    if (search_dirs & sdPath)
        searchPaths.AddEnvList(_T("PATH"));

    return searchPaths.FindValidPath(filename);
}
コード例 #4
0
CHTString GetSettingsDir()
{
   return GetHomeFolder() + "/.hypertype";
}