LRESULT CALLBACK CContainer::TabBackingProc(HWND hTabCtrl,
UINT msg,WPARAM wParam,LPARAM lParam)
{
	switch(msg)
	{
		case WM_INITMENU:
			SendMessage(m_hContainer,WM_INITMENU,wParam,lParam);
			break;

		case WM_MEASUREITEM:
			{
				MEASUREITEMSTRUCT	*pMeasureItem = NULL;

				pMeasureItem = (MEASUREITEMSTRUCT *)lParam;

				pMeasureItem->itemWidth = 20;
				pMeasureItem->itemHeight = 10;

			}
			break;

		case WM_LBUTTONDBLCLK:
			{
				HRESULT hr;

				hr = BrowseFolder(m_DefaultTabDirectory,SBSP_ABSOLUTE,TRUE,TRUE,FALSE);

				if(FAILED(hr))
					BrowseFolder(m_DefaultTabDirectoryStatic,SBSP_ABSOLUTE,TRUE,TRUE,FALSE);
			}
			break;

		case WM_COMMAND:
			switch(LOWORD(wParam))
			{
				case TABTOOLBAR_CLOSE:
					OnCloseTab();
					break;
			}
			break;

		case WM_NOTIFY:
			switch(((LPNMHDR)lParam)->code)
			{
				case TCN_SELCHANGE:
					OnTabSelectionChange();
					break;

				case TTN_GETDISPINFO:
					OnTabCtrlGetDispInfo(lParam);
					break;
			}
			break;
	}

	return DefSubclassProc(hTabCtrl,msg,wParam,lParam);
}
Ejemplo n.º 2
0
/******************************************************************************
Handles browse button click
******************************************************************************/
void PBDlg::OnOutputBrowse()
{
	CString folder, title;
	title = "Select Output Path";
	folder = BrowseFolder(title);
	if(!folder.IsEmpty())
		PBDlg::SetDlgItemText(IDC_OUTPUT_FOLDER, folder);
}
Ejemplo n.º 3
0
/******************************************************************************
Handles browse button click
******************************************************************************/
void PBDlg::OnCurrentDirectoryBrowse()
{
	CString folder, title;
	title = "Select Current Directory Path";
	folder = BrowseFolder(title);
	if(!folder.IsEmpty())
		PBDlg::SetDlgItemText(IDC_CURRENT_DIRECTORY, folder);
}
Ejemplo n.º 4
0
/******************************************************************************
Handles browse button click
******************************************************************************/
void PBDlg::OnInstallerDirectoryBrowse()
{
	CString folder, title;
	title = "Select Installer Directory Path";
	folder = BrowseFolder(title);
	if(!folder.IsEmpty())
		PBDlg::SetDlgItemText(IDC_INSTALLER_DIRECTORY, folder);
}
Ejemplo n.º 5
0
void CBrowser::SetCallback(IBrowserCallback* pCallback)
{
	mpCallback = pCallback;

	// Do the initial browsing
	mItemRoot.sPathName = std::string("");
	BrowseFolder(&mItemRoot);
}
Ejemplo n.º 6
0
/******************************************************************************
Handles browse button click
******************************************************************************/
void PBDlg::OnUpdaterDirectoryBrowse()
{
	CString folder, title;
	title = "Select Updater Directory Path";
	folder = BrowseFolder(title);
	if(!folder.IsEmpty())
		PBDlg::SetDlgItemText(IDC_UPDATER_DIRECTORY, folder);
}
Ejemplo n.º 7
0
/******************************************************************************
Handles browse button click
******************************************************************************/
void PBDlg::OnOldDirectoryBrowse()
{
	CString folder, title;
	title = "Select Old Directory Path";
	folder = BrowseFolder(title);
	if(!folder.IsEmpty())
		PBDlg::SetDlgItemText(IDC_OLD_DIRECTORY, folder);
}
/* Browses to the specified path. The path may
have any environment variables expanded (if
necessary). */
HRESULT CContainer::ExpandAndBrowsePath(TCHAR *szPath,BOOL bOpenInNewTab,BOOL bSwitchToNewTab)
{
	TCHAR szExpandedPath[MAX_PATH];

	MyExpandEnvironmentStrings(szPath,
		szExpandedPath,SIZEOF_ARRAY(szExpandedPath));

	return BrowseFolder(szExpandedPath,SBSP_ABSOLUTE,bOpenInNewTab,bSwitchToNewTab,FALSE);
}
Ejemplo n.º 9
0
HRESULT CShellBrowser::BrowseFolder(const TCHAR *szPath,UINT wFlags)
{
	LPITEMIDLIST pidlDirectory = NULL;
	HRESULT hr = GetIdlFromParsingName(szPath,&pidlDirectory);

	if(SUCCEEDED(hr))
	{
		hr = BrowseFolder(pidlDirectory,wFlags);

		CoTaskMemFree(pidlDirectory);
	}

	return hr;
}
Ejemplo n.º 10
0
void CContainer::BookmarkToolbarOpenItem(int iItem,BOOL bOpenInNewTab)
{
	Bookmark_t	Bookmark;
	TBBUTTON	tbButton;

	if(iItem != -1)
	{
		SendMessage(m_hBookmarksToolbar,TB_GETBUTTON,iItem,(LPARAM)&tbButton);

		m_Bookmark.RetrieveBookmark((void *)tbButton.dwData,&Bookmark);

		/* If the toolbar item is a bookmark, simply navigate
		to its directory. If it's a folder, open a menu with
		its sub-items on. */
		if(Bookmark.Type == BOOKMARK_TYPE_BOOKMARK)
		{
			if(bOpenInNewTab)
				BrowseFolder(Bookmark.szLocation,SBSP_ABSOLUTE,TRUE,TRUE,FALSE);
			else
				BrowseFolder(Bookmark.szLocation,SBSP_ABSOLUTE);
		}
	}
}
Ejemplo n.º 11
0
void Explorerplusplus::OnTreeViewHolderWindowTimer(void)
{
	LPITEMIDLIST	pidlDirectory = NULL;
	LPITEMIDLIST	pidlCurrentDirectory = NULL;

	pidlDirectory = m_pMyTreeView->BuildPath(g_NewSelectionItem);

	pidlCurrentDirectory = m_pActiveShellBrowser->QueryCurrentDirectoryIdl();

	if(!m_bSelectingTreeViewDirectory && !m_bTreeViewRightClick &&
		!CompareIdls(pidlDirectory,pidlCurrentDirectory))
	{
		BrowseFolder(pidlDirectory,SBSP_SAMEBROWSER);

		if(m_bTVAutoExpandSelected)
		{
			TreeView_Expand(m_hTreeView,g_NewSelectionItem,TVE_EXPAND);
		}
	}

	CoTaskMemFree(pidlDirectory);

	KillTimer(m_hHolder,0);
}
Ejemplo n.º 12
0
LRESULT CALLBACK Explorerplusplus::TreeViewSubclass(HWND hwnd,UINT uMsg,
WPARAM wParam,LPARAM lParam)
{
	switch(uMsg)
	{
	case WM_SETFOCUS:
		HandleToolbarItemStates();
		break;

	case WM_MBUTTONDOWN:
		{
			TVHITTESTINFO tvhi;

			tvhi.pt.x = LOWORD(lParam);
			tvhi.pt.y = HIWORD(lParam);

			TreeView_HitTest(m_hTreeView,&tvhi);

			if(tvhi.flags != LVHT_NOWHERE && tvhi.hItem != NULL)
			{
				m_hTVMButtonItem = tvhi.hItem;
			}
			else
			{
				m_hTVMButtonItem = NULL;
			}
		}
		break;

	case WM_MBUTTONUP:
		{
			TVHITTESTINFO tvhi;
			LPITEMIDLIST pidl = NULL;

			tvhi.pt.x = LOWORD(lParam);
			tvhi.pt.y = HIWORD(lParam);

			TreeView_HitTest(m_hTreeView,&tvhi);

			if(tvhi.flags != LVHT_NOWHERE && tvhi.hItem != NULL)
			{
				/* Only open an item if it was the one
				on which the middle mouse button was
				initially clicked on. */
				if(tvhi.hItem == m_hTVMButtonItem)
				{
					pidl = m_pMyTreeView->BuildPath(tvhi.hItem);
					BrowseFolder(pidl,SBSP_ABSOLUTE,TRUE,FALSE,FALSE);

					CoTaskMemFree(pidl);
				}
			}
		}
		break;

	case WM_MOUSEWHEEL:
		if(OnMouseWheel(MOUSEWHEEL_SOURCE_TREEVIEW,wParam,lParam))
		{
			return 0;
		}
		break;
	}

	return DefSubclassProc(hwnd,uMsg,wParam,lParam);
}
Ejemplo n.º 13
0
BOOL Explorerplusplus::OnTreeViewItemExpanding(LPARAM lParam)
{
	NMTREEVIEW *pnmtv;
	TVITEM *tvItem;
	HTREEITEM *pItem;
	NMHDR *nmhdr;

	nmhdr = (NMHDR *)lParam;

	pnmtv = (LPNMTREEVIEW)lParam;

	tvItem = &pnmtv->itemNew;

	pItem = &tvItem->hItem;

	if(TreeView_GetParent(nmhdr->hwndFrom,*pItem) == NULL)
	{
		return FALSE;
	}

	if(pnmtv->action == TVE_EXPAND)
	{
		LPITEMIDLIST pidl	= NULL;

		pidl = m_pMyTreeView->BuildPath(tvItem->hItem);
		m_pMyTreeView->AddDirectory(tvItem->hItem,pidl);

		CoTaskMemFree(pidl);
	}
	else
	{
		HTREEITEM hSelection = TreeView_GetSelection(m_hTreeView);

		if(hSelection != NULL)
		{
			/* We may collapse multiple levels (not just the parent folder), so we need 
			to search up the tree for the parent item. */
			HTREEITEM hItem = hSelection;

			do 
			{
				hItem = TreeView_GetParent(m_hTreeView,hItem);
			} while (hItem != tvItem->hItem && hItem != NULL);

			if(hItem == tvItem->hItem)
			{
				LPITEMIDLIST pidl	= NULL;

				pidl = m_pMyTreeView->BuildPath(tvItem->hItem);
				BrowseFolder(pidl,SBSP_SAMEBROWSER);

				CoTaskMemFree(pidl);
			}
		}

		m_pMyTreeView->EraseItems(tvItem->hItem);

		SendMessage(nmhdr->hwndFrom,TVM_EXPAND,
		(WPARAM)TVE_COLLAPSE|TVE_COLLAPSERESET,
		(LPARAM)tvItem->hItem);
	}

	return FALSE;
}
Ejemplo n.º 14
0
tbool CBrowser::OnMouse(EMouseMsg MouseMsg, const SPos& Pos)
{
	SRect RectThis(GetRect());

	if (MouseMsg == LeftButtonDown) {
		// Left button down
		if (RectThis.Inside(Pos)) {
			// Click was inside control
			SItem* pItem = GetItem(Pos);
			if (pItem == NULL) {
				// No item clicked
				return true;
			}

			if (pItem->bFolder) {
				// Item is a folder
				if (pItem->bFolderIsOpen) {
					// Folder is open, close it
					pItem->bFolderIsOpen = false;
				}
				else {
					// Folder is closed, open it
					pItem->bFolderIsOpen = true;
				}

				BrowseFolder(pItem);

				Redraw();

				return true;
			}
			else {
				// Not folder
				mpItemSelected = pItem;

				std::string s(mpItemSelected->sPathName.substr(1));
				tint32 pData[2];
				pData[0] = 0;
				pData[1] = (tint32)(s.c_str());
				NotifyGeneric((void*)pData);
				NotifyGeneric((void*)(s.c_str()));

				return true;
			}
		}
	}

	if (MouseMsg == LeftButtonDblClk) {
		// Left button down
		if (RectThis.Inside(Pos)) {
			// Click was inside control
			SItem* pItem = GetItem(Pos);
			if (pItem == NULL) {
				// No item clicked
				return true;
			}

			if (pItem->bFolder == false) {
				// Not folder
				mpItemSelected = pItem;

				std::string s(mpItemSelected->sPathName.substr(1));
				tint32 pData[2];
				pData[0] = 1;
				pData[1] = (tint32)(s.c_str());
				NotifyGeneric((void*)pData);

				return true;
			}
		}
	}

	return false;
}
Ejemplo n.º 15
0
void MainWindow::MainWindow::OnShowWriteableDir(wxCommandEvent& /*unused*/)
{
	BrowseFolder(TowxString(SlPaths::GetDataDir()));
}
Ejemplo n.º 16
0
//-------------------------------------------------------------------------
INT_PTR CALLBACK ResetPermissionDialog::MainDialogProc(
    HWND hWnd,
    UINT message,
    WPARAM wParam,
    LPARAM lParam)
{
    switch (message)
    {
        case WM_INITDIALOG:
        {
            hDlg = hWnd;

            // Set the initial states/configuration
            bRecurse = true;
            bResetPerm = true;
            bRmHidSys = false;
            bTakeOwn = false;
            bDontFollowLinks = true;

            UpdateCheckboxes(false);

            HICON hIcon = LoadIcon(
                hInstance,
                MAKEINTRESOURCE(IDI_SMALL));

            SendMessage(
                hDlg,
                WM_SETICON,
                ICON_BIG,
                (LPARAM)hIcon);

            LPCTSTR Arg = GetArg(1);

    #ifdef _DEBUG
            if (Arg == NULL)
                Arg = _TEXT("C:\\Temp\\perm");

			// Enable editing for the folder text editbox in debug mode
            SendDlgItemMessage(hDlg, IDTXT_FOLDER, EM_SETREADONLY, FALSE, 0);
    #endif

            if (Arg != NULL)
            {
                SetFolderText(Arg);
                UpdateCommandText();
            }

            return TRUE;
        }

        case WM_MENUCOMMAND:
            break;

        case WM_COMMAND:
        {
            UINT wmId = LOWORD(wParam);
            UINT wmEvent = HIWORD(wParam);
    #ifdef _DEBUG
            TCHAR b[1024];
            _sntprintf_s(
                b,
                _countof(b),
                _TEXT("WM_COMMAND: wmParam=%08X lParam=%08X | ID=%04X Event=%04X\n"),
                wParam,
                lParam,
                wmId,
                wmEvent);
            OutputDebugString(b);
			
			// Reflect the folder text changes when the control is editable
            if (wmId == IDTXT_FOLDER && wmEvent == EN_CHANGE)
                UpdateCommandText();
    #endif
            switch (wmId)
            {
                //
                // Handle checkboxes
                //
                case IDCHK_RECURSE:
                case IDCHK_DONTFOLLOWLINKS:
                case IDCHK_TAKEOWN:
                case IDCHK_RESETPERM:
                case IDCHK_RM_HS:
                {
                    // Reforumulate the command text on each option change
                    if (wmEvent == BN_CLICKED)
                    {
                        UpdateCommandText();
                        return TRUE;
                    }
                    break;
                }

                //
                // Handle context menu
                //
                case IDM_ADDTOEXPLORERFOLDERCONTEXTMENU:
                case IDM_REMOVEFROMEXPLORERFOLDERCONTEXTMENU:
                    AddToExplorerContextMenu(wmId == IDM_ADDTOEXPLORERFOLDERCONTEXTMENU);
                    break;

                case IDM_BACKUPPERMSCONTEXTMENU:
                case IDM_RESTOREPERMSCONTEXTMENU:
                    BackRestorePermissions(wmId == IDM_BACKUPPERMSCONTEXTMENU);
                    break;

                //
                // About box
                //
                case IDBTN_ABOUT:
                {
                    DialogBox(
                        hInstance,
                        MAKEINTRESOURCE(IDD_ABOUTBOX),
                        hDlg,
                        AboutDlgProc);

                    return TRUE;
                }

                //
                // Choose folder
                //
                case IDBTN_CHOOSE_FOLDER:
                {
                    stringT Folder;
                    if (BrowseFolder(hDlg, STR_SELECT_FOLDER, Folder))
                    {
                        SetFolderText(Folder.c_str());
                        UpdateCommandText();
                    }
                    return TRUE;
                }

                //
                // Trigger the "Advanced" menu
                //
                case IDBTN_ADVANCED:
                {
                    ShowPopupMenu(IDR_ADVANCED_MENU, IDBTN_ADVANCED);
                    return TRUE;
                }

                //
                // GO button
                //
                case IDOK:
                {
                    // Validate the input folder and execute the command
                    ExecuteWindowCommand(true);
                    return TRUE;
                }

                // HELP button
                case IDBTN_HELP:
                {
                    ShellExecute(
                        hDlg,
                        _TEXT("open"),
                        STR_HELP_URL,
                        nullptr,
                        nullptr,
                        SW_SHOW);

                    return TRUE;
                }
            } // switch(wmId)
            break;
        } // case WM_COMMAND

        // Close dialog
        case WM_CLOSE:
            EndDialog(hDlg, IDOK);
            return TRUE;
    }
    return FALSE;
}
Ejemplo n.º 17
0
    //-------------------------------------------------------------------------
    static INT_PTR CALLBACK MainDialogProc(
        HWND hWnd,
        UINT message,
        WPARAM wParam,
        LPARAM lParam)
    {
        switch (message)
        {
            case WM_INITDIALOG:
            {
                ResetPermissionDialog::hDlg = hWnd;

                SendDlgItemMessage(
                    hDlg,
                    IDCHK_RESETPERM,
                    BM_SETCHECK,
                    BST_CHECKED,
                    0);

                SendDlgItemMessage(
                    hDlg,
                    IDCHK_DONTFOLLOWLINKS,
                    BM_SETCHECK,
                    BST_CHECKED,
                    0);

                SendDlgItemMessage(
                    hDlg,
                    IDCHK_RECURSE,
                    BM_SETCHECK,
                    BST_CHECKED,
                    0);

                HICON t = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SMALL));
                SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)t);

                LPCTSTR Arg = GetArgs();

                if (Arg != NULL)
                    SetFolderText(Arg);
    #ifdef _DEBUG
                //else
                //    SetFolderText(_TEXT("C:\\Temp\\perm"));
    #endif
                if (Arg != NULL)
                    UpdateCommandText();
                return (INT_PTR)TRUE;
            }

            case WM_MENUCOMMAND:
                break;
            case WM_COMMAND:
            {
    #ifdef _DEBUG
                TCHAR b[1024];
                _sntprintf_s(b, _countof(b), _TEXT("WM_COMMAND: wmParam=%08X lParam=%08X\n"), wParam, lParam);
                OutputDebugString(b);
    #endif
                UINT wmId = LOWORD(wParam);
                UINT wmEvent = HIWORD(wParam);

                switch (wmId)
                {
                    case IDCHK_RECURSE:
                    case IDCHK_DONTFOLLOWLINKS:
                    case IDCHK_TAKEOWN:
                    case IDCHK_RESETPERM:
                    case IDCHK_RM_HS:
                    {
                        if (wmEvent == BN_CLICKED)
                        {
                            UpdateCommandText();
                            return TRUE;
                        }
                        break;
                    }
                    case IDM_ADDTOEXPLORERFOLDERRIGHT:
                    case IDM_REMOVEFROMEXPLORERFOLDERCONTEXTMENU:
                    {
                        AddToExplorerContextMenu(wmId == IDM_ADDTOEXPLORERFOLDERRIGHT);
                        break;
                    }
                    case IDBTN_ABOUT:
                    {
                        DialogBox(
                            hInstance,
                            MAKEINTRESOURCE(IDD_ABOUTBOX),
                            hDlg,
                            AboutDlgProc);

                        return TRUE;
                    }
                    case IDBTN_CHOOSE_FOLDER:
                    {
                        stringT out;
                        if (BrowseFolder(hDlg, STR_SELECT_FOLDER, out))
                        {
                            SetFolderText(out.c_str());
                            UpdateCommandText();
                        }
                        return TRUE;
                    }
                    case IDBTN_MORE_ACTIONS:
                    {
                        ShowMoreActionsMenu();
                        return TRUE;
                    }
                    case IDOK:
                    {
                        ExecuteCommand();
                        return TRUE;
                    }
                }
                break;
            }
            // Close dialog
            case WM_CLOSE:
            {
                EndDialog(hDlg, 0);
                return TRUE;
            }
        }
        return FALSE;
    }
Ejemplo n.º 18
0
BOOL CALLBACK Proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch(msg) {
	case WM_INITDIALOG: {
		Rect wr;
		SystemParametersInfo(SPI_GETWORKAREA, 0, wr, 0);
		Rect dr;
		GetWindowRect(hwnd, dr);
		Point p = wr.CenterPos(dr.Size());
		SetWindowPos(hwnd, 0, p.x, p.y, dr.Width(), dr.Height(),
		             SWP_SHOWWINDOW|SWP_NOOWNERZORDER|SWP_NOZORDER);
		SetWindowText(GetDlgItem(hwnd, 101), "C:\\upp");
		SendDlgItemMessage(hwnd, 101, EM_SETSEL, (WPARAM) 0, (LPARAM) -1);
		SetWindowText(hwnd, GetExeTitle());
 		break;
	}
	case WM_COMMAND:
		switch(LOWORD(wParam)) {
		case IDOK: {
			char h[2048];
			GetWindowText(GetDlgItem(hwnd, 101), h, 2048);
			String exe = AppendFileName(h, "theide.exe");
			if(FileExists(exe)) {
				MessageBox(::GetActiveWindow(),
				           "Please uninstall previous version before installing the new one.",
			               "Ultimate++", MB_ICONSTOP | MB_OK | MB_APPLMODAL);
				WinExec(exe + " -uninstall", SW_SHOWNORMAL);
				break;
			}

			ProgressMeter pi;
			pi.SetText("Installing files");
			HRSRC hrsrc = FindResource(NULL, LPCTSTR(1112), RT_RCDATA);
			if(!hrsrc) Error();
			outdir = h;
			LZMAExtract((const char *)LockResource(LoadResource(NULL, hrsrc)), SizeofResource(NULL, hrsrc),
			            h, pi);
			if (BST_CHECKED == SendDlgItemMessage(hwnd, 10 /*IDC_ASSOC*/, BM_GETCHECK, 0, 0)) {
				SetWinRegString(exe, "", "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\theide.exe\\");
				SetWinRegString(h, "Path", "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\theide.exe\\");
				SetWinRegString("TheIDE.upp", "", ".upp\\", HKEY_CLASSES_ROOT);
				SetWinRegString("open", "", "TheIDE.upp\\shell\\", HKEY_CLASSES_ROOT);
				SetWinRegString("\"" + exe + "\" \"%1\"", "", "TheIDE.upp\\shell\\open\\command\\", HKEY_CLASSES_ROOT);
			}
			pi.Destroy();
			FileMove(AppendFileName(h, IsWow64() ? "theide64.exe" : "theide32.exe"), exe);
			EndDialog(hwnd, 0);
			WinExec(exe, SW_SHOWNORMAL);
			break;
		}
		case 999: {
		    BOOL retVal;
			char Folder[256] = "C:\\";
			char FolderName[17] = "Select Directory";
			if(BrowseFolder( 0, Folder, FolderName)) {
				strcat(Folder, "\\upp");
				SetWindowText(GetDlgItem(hwnd, 101), Folder);
			}
			break;
		}
		case IDCANCEL:
			EndDialog(hwnd, 0);
			break;
		}
	}
	return 0;
}