Example #1
0
void TabView::ResizeView(WORD wID)
{
	if( multisplitClass::defaultFocusPane && multisplitClass::defaultFocusPane->window )
	{
		MutexLock viewMapLock(m_viewsMutex);

		if( m_views.size() > 1 )
		{
			switch( wID )
			{
			case ID_DEC_HORIZ_SIZE:
				multisplitClass::defaultFocusPane->resize(CMultiSplitPane::VERTICAL, -ConsoleView::GetCharWidth());
				break;

			case ID_INC_HORIZ_SIZE:
				multisplitClass::defaultFocusPane->resize(CMultiSplitPane::VERTICAL, ConsoleView::GetCharWidth());
				break;

			case ID_DEC_VERT_SIZE:
				multisplitClass::defaultFocusPane->resize(CMultiSplitPane::HORIZONTAL, -ConsoleView::GetCharHeight());
				break;

			case ID_INC_VERT_SIZE:
				multisplitClass::defaultFocusPane->resize(CMultiSplitPane::HORIZONTAL, ConsoleView::GetCharHeight());
				break;
			}

			CRect clientRect(0, 0, 0, 0);
			AdjustRectAndResize(ADJUSTSIZE_WINDOW, clientRect, WMSZ_BOTTOM);
		}
	}
}
Example #2
0
void TabView::Split(CMultiSplitPane::SPLITTYPE splitType)
{
	std::wstring strCurrentDirectory(L"");

	std::shared_ptr<ConsoleView> activeConsoleView = GetActiveConsole(_T(__FUNCTION__));

	if( g_settingsHandler->GetBehaviorSettings2().cloneSettings.bUseCurrentDirectory )
	{
		strCurrentDirectory = activeConsoleView->GetConsoleHandler().GetCurrentDirectory();
	}

	if( multisplitClass::defaultFocusPane && multisplitClass::defaultFocusPane->window )
	{
		ConsoleViewCreate consoleViewCreate;
		consoleViewCreate.type = ConsoleViewCreate::CREATE;
		consoleViewCreate.u.userCredentials = nullptr;

		HWND hwndConsoleView = CreateNewConsole(&consoleViewCreate, strCurrentDirectory, wstring(L""), activeConsoleView->GetBasePriority());
		if( hwndConsoleView )
		{
			multisplitClass::SetDefaultFocusPane(multisplitClass::defaultFocusPane->split(
				hwndConsoleView,
				splitType));

			CRect clientRect(0, 0, 0, 0);
			AdjustRectAndResize(ADJUSTSIZE_WINDOW, clientRect, WMSZ_BOTTOM);
		}
	}
}
Example #3
0
bool TabView::CloseView(HWND hwnd, bool boolDetach, bool& boolTabClosed)
{
	boolTabClosed = false;

	if( hwnd == 0 )
	{
		if( multisplitClass::defaultFocusPane )
			hwnd = multisplitClass::defaultFocusPane->window;
	}

	if( hwnd )
	{
		MutexLock viewMapLock(m_viewsMutex);
		ConsoleViewMap::iterator iter = m_views.find(hwnd);
		if( iter != m_views.end() )
		{
			if( boolDetach )
				iter->second->GetConsoleHandler().Detach();

			iter->second->DestroyWindow();
			m_views.erase(iter);

#ifdef _DEBUG
			ATLTRACE(L"%p-TabView::CloseView tree\n",
				::GetCurrentThreadId());
			multisplitClass::tree.dump(0, 0);
			ATLTRACE(L"%p-TabView::CloseView defaultFocusPane\n",
				::GetCurrentThreadId());
			if( multisplitClass::defaultFocusPane )
				multisplitClass::defaultFocusPane->dump(0, multisplitClass::defaultFocusPane->parent);
#endif

			if( multisplitClass::defaultFocusPane )
				multisplitClass::SetDefaultFocusPane(multisplitClass::defaultFocusPane->remove());

			if( m_views.empty() )
				boolTabClosed = true;
			else
			{
				CRect clientRect(0, 0, 0, 0);
				AdjustRectAndResize(ADJUSTSIZE_WINDOW, clientRect, WMSZ_BOTTOM);
			}

			return true;
		}
	}

	return false;
}
Example #4
0
bool TabView::CloseView(HWND hwnd, bool boolDetach, bool& boolTabClosed)
{
    boolTabClosed = false;

    if( hwnd == 0 )
    {
        if( multisplitClass::defaultFocusPane )
            hwnd = multisplitClass::defaultFocusPane->window;
    }

    if( hwnd )
    {
        MutexLock viewMapLock(m_viewsMutex);
        ConsoleViewMap::iterator iter = m_views.find(hwnd);
        if( iter != m_views.end() )
        {
            if( boolDetach )
                iter->second->GetConsoleHandler().Detach();

            iter->second->DestroyWindow();
            m_views.erase(iter);

            multisplitClass::Remove();

            if( m_views.empty() )
                boolTabClosed = true;
            else
            {
                CRect clientRect(0, 0, 0, 0);
                AdjustRectAndResize(ADJUSTSIZE_WINDOW, clientRect, WMSZ_BOTTOM);
            }

            return true;
        }
    }

    return false;
}
Example #5
0
void TabView::OnSplitBarMove(HWND /*hwndPane0*/, HWND /*hwndPane1*/, bool /*boolEnd*/)
{
  CRect clientRect(0, 0, 0, 0);
  AdjustRectAndResize(ADJUSTSIZE_WINDOW, clientRect, WMSZ_BOTTOM);
}