Ejemplo n.º 1
0
TabView*
TabContainerView::RemoveTab(int32 index)
{
	TabLayoutItem* item
		= dynamic_cast<TabLayoutItem*>(GroupLayout()->RemoveItem(index));

	if (!item)
		return NULL;

	BRect dirty(Bounds());
	dirty.left = item->Frame().left;
	TabView* removedTab = item->Parent();
	removedTab->SetContainerView(NULL);

	if (removedTab == fLastMouseEventTab)
		fLastMouseEventTab = NULL;

	// Update tabs after or before the removed tab.
	bool hasFrames = fController != NULL && fController->HasFrames();
	item = dynamic_cast<TabLayoutItem*>(GroupLayout()->ItemAt(index));
	if (item) {
		// This tab is behind the removed tab.
		TabView* tab = item->Parent();
		tab->Update(index == 0 && hasFrames,
			index == GroupLayout()->CountItems() - 2 && hasFrames,
			tab == fSelectedTab);
		if (removedTab == fSelectedTab) {
			fSelectedTab = NULL;
			SelectTab(tab);
		} else if (fController && tab == fSelectedTab)
			fController->TabSelected(index);
	} else {
		// The removed tab was the last tab.
		item = dynamic_cast<TabLayoutItem*>(GroupLayout()->ItemAt(index - 1));
		if (item) {
			TabView* tab = item->Parent();
			tab->Update(index == 0 && hasFrames,
				index == GroupLayout()->CountItems() - 2 && hasFrames,
				tab == fSelectedTab);
			if (removedTab == fSelectedTab) {
				fSelectedTab = NULL;
				SelectTab(tab);
			}
		}
	}

	Invalidate(dirty);
	_ValidateTabVisibility();

	return removedTab;
}
Ejemplo n.º 2
0
void MultiTabs::PrevTab()
{
  if (tabs.empty())
    return;

  if (current_tab == 0) {
#if CIRCULAR_TABS
    SelectTab(tabs.size()-1);
#endif
    return;
  }

  SelectTab(current_tab-1);
}
Ejemplo n.º 3
0
void MultiTabs::NextTab()
{
  if (tabs.empty())
    return;

  if (current_tab+1 == tabs.size()) {
#if CIRCULAR_TABS
    SelectTab(0);
#endif
    return;
  }

  SelectTab(current_tab+1);
}
Ejemplo n.º 4
0
void DockingCont::doClose()
{
	int	iItemOff	= 0;
	int	iItemCnt	= ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);

	for (int iItem = 0; iItem < iItemCnt; ++iItem)
	{
		TCITEM		tcItem		= {0};

		// get item data
		SelectTab(iItemOff);
		tcItem.mask	= TCIF_PARAM;
		::SendMessage(_hContTab, TCM_GETITEM, iItemOff, (LPARAM)&tcItem);
		if (!tcItem.lParam)
			continue;

		// notify child windows
		if (NotifyParent(DMM_CLOSE) == 0)
		{
			// delete tab
			hideToolbar((tTbData*)tcItem.lParam);
		}
		else
		{
			++iItemOff;
		}
	}

	if (iItemOff == 0)
	{
		// hide dialog first
		this->doDialog(false);
		::SendMessage(_hParent, WM_SIZE, 0, 0);
	}
}
Ejemplo n.º 5
0
void
TabContainerView::AddTab(TabView* tab, int32 index)
{
	tab->SetContainerView(this);

	if (index == -1)
		index = GroupLayout()->CountItems() - 1;

	bool hasFrames = fController != NULL && fController->HasFrames();
	bool isFirst = index == 0 && hasFrames;
	bool isLast = index == GroupLayout()->CountItems() - 1 && hasFrames;
	bool isFront = fSelectedTab == NULL;
	tab->Update(isFirst, isLast, isFront);

	GroupLayout()->AddItem(index, tab->LayoutItem());

	if (isFront)
		SelectTab(tab);
	if (isLast) {
		TabLayoutItem* item
			= dynamic_cast<TabLayoutItem*>(GroupLayout()->ItemAt(index - 1));
		if (item)
			item->Parent()->SetIsLast(false);
	}

	SetFirstVisibleTabIndex(MaxFirstVisibleTabIndex());
	_ValidateTabVisibility();
}
Ejemplo n.º 6
0
CRegViewWnd::CRegViewWnd(HWND parentWnd, CVirtualMachine& virtualMachine, CMIPS* ctx)
{
	auto windowRect = Framework::Win32::CRect(0, 0, 320, 240);

	Create(NULL, Framework::Win32::CDefaultWndClass::GetName(), _T("Registers"), WND_STYLE, windowRect, parentWnd, NULL);
	SetClassPtr();

	m_tabs = Framework::Win32::CTab(m_hWnd, windowRect, TCS_BOTTOM);
	m_tabs.InsertTab(_T("General"));
	m_tabs.InsertTab(_T("SCU"));
	m_tabs.InsertTab(_T("FPU"));
	m_tabs.InsertTab(_T("VU"));

	m_regView[0] = new CRegViewGeneral(m_hWnd, windowRect, virtualMachine, ctx);
	m_regView[1] = new CRegViewSCU(m_hWnd, windowRect, virtualMachine, ctx);
	m_regView[2] = new CRegViewFPU(m_hWnd, windowRect, virtualMachine, ctx);
	m_regView[3] = new CRegViewVU(m_hWnd, windowRect, virtualMachine, ctx);

	for(unsigned int i = 0; i < MAXTABS; i++)
	{
		m_regView[i]->Enable(false);
		m_regView[i]->Show(SW_HIDE);
	}

	SelectTab(0);

	RefreshLayout();
}
Ejemplo n.º 7
0
void DockingCont::doClose(void)
{
	INT	iItemOff	= 0;
	INT	iItemCnt	= ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);

	for (INT iItem = 0; iItem < iItemCnt; iItem++)
	{
		TCITEM		tcItem		= {0};

		/* get item data */
		SelectTab(iItemOff);
		tcItem.mask	= TCIF_PARAM;
		::SendMessage(_hContTab, TCM_GETITEM, iItemOff, (LPARAM)&tcItem);

		/* notify child windows */
		if (NotifyParent(DMM_CLOSE) == 0)
		{
			/* delete tab */
			hideToolbar((tTbData*)tcItem.lParam);
		}
		else
		{
			iItemOff++;
		}
	}

	if (iItemOff == 0)
	{
		/* hide dialog first */
		this->doDialog(false);
		::SendMessage(_hParent, WM_SIZE, 0, 0);
	}
}
Ejemplo n.º 8
0
void CMainWindow::InsertDocument(DocumentPtr&& documentWindow)
{
	int currentSelection = m_tabs.GetSelection();
	if(currentSelection != -1)
	{
		UnselectTab(currentSelection);
	}
	uint32 documentId = m_nextDocumentId;
	std::string documentName = "New Document";
	auto document = dynamic_cast<IDocument*>(documentWindow.get());
	if(document)
	{
		documentName = document->GetName();
	}
	m_documents.insert(std::make_pair(documentId, std::move(documentWindow)));
	unsigned int tabIndex = m_tabs.InsertTab(string_cast<std::tstring>(documentName).c_str());
	m_tabs.SetTabData(tabIndex, documentId);
	m_tabs.SetSelection(tabIndex);
	if(document)
	{
		document->StateChanged.connect([this] () { OnDocumentStateChanged(); });
	}
	SelectTab(tabIndex);
	m_nextDocumentId++;
}
Ejemplo n.º 9
0
BOOL CXTabCtrl::SelectNextTab(BOOL bForward)
{
	int iSum = bForward ? 1 : -1;

	int iCurSel = GetCurSel();
	int iCurSelSave(iCurSel);

	do
	{
		iCurSel += iSum;

		if (iCurSel < 0 || iCurSel == GetItemCount())
			return FALSE;

		if (IsTabEnabled(iCurSel))
		{
			if (iCurSel < GetItemCount())
			{
				SelectTab(iCurSel);

				return TRUE;
			}

			return FALSE;
		}

	}
	while (iCurSel != iCurSelSave);
	
	return FALSE;
}
Ejemplo n.º 10
0
void
TabManager::SelectTab(const BView* containedView)
{
	int32 tabIndex = TabForView(containedView);
	if (tabIndex >= 0)
		SelectTab(tabIndex);
}
Ejemplo n.º 11
0
void DockingCont::viewToolbar(tTbData *pTbData)
{
	TCITEM		tcItem		= {0};
	int			iItemCnt	= ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);

	if (iItemCnt > 0)
	{
		UINT	iItem	= getActiveTb();

		tcItem.mask		= TCIF_PARAM;
		::SendMessage(_hContTab, TCM_GETITEM, iItem, (LPARAM)&tcItem);
		if (!tcItem.lParam)
			return;
		
		// hide active dialog
		::ShowWindow(((tTbData*)tcItem.lParam)->hClient, SW_HIDE);
	}

	// create new tab if it not exists
	int iTabPos = SearchPosInTab(pTbData);
	tcItem.mask			= TCIF_PARAM;
	tcItem.lParam		= (LPARAM)pTbData;

	if (iTabPos == -1)
	{
		// set only params and text even if icon available
		::SendMessage(_hContTab, TCM_INSERTITEM, iItemCnt, (LPARAM)&tcItem);
		SelectTab(iItemCnt);
	}
	// if exists select it and update data
	else
	{
		::SendMessage(_hContTab, TCM_SETITEM, iTabPos, (LPARAM)&tcItem);
		SelectTab(iTabPos);
	}

	// show dialog and notify parent to update dialog view
	if (isVisible() == false)
	{
		this->doDialog();
		::SendMessage(_hParent, WM_SIZE, 0, 0);
	}

	// set position of client
	onSize();
}
Ejemplo n.º 12
0
void DockingCont::setActiveTb(int iItem)
{
	//if ((iItem != -1) && (iItem < ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0)))
	if (iItem < ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0))
	{
		SelectTab(iItem);
	}
}
Ejemplo n.º 13
0
void MultiTabs::AddNewTab(const std::string& id, const std::string& title, Widget * w)
{
  Tab tab(id, title, w);
  tabs.push_back(tab);
  w->SetContainer(this);

  SelectTab(0);
}
Ejemplo n.º 14
0
void
TabContainerView::SelectTab(int32 index)
{
	TabView* tab = NULL;
	TabLayoutItem* item = dynamic_cast<TabLayoutItem*>(
		GroupLayout()->ItemAt(index));
	if (item)
		tab = item->Parent();

	SelectTab(tab);
}
Ejemplo n.º 15
0
void GxTabContainer::SelectTab(GxTab* tab)
{
	for(int i=0; i<myTabs.Size(); ++i)
	{
		if(myTabs[i] == tab)
		{
			SelectTab(i);
			return;
		}
	}
}
Ejemplo n.º 16
0
int DockingCont::hideToolbar(tTbData *pTbData, BOOL hideClient)
{
	int		iItem	= SearchPosInTab(pTbData);

	// delete item
	if (TRUE == ::SendMessage(_hContTab, TCM_DELETEITEM, iItem, 0))
	{
		UINT	iItemCnt = ::SendMessage(_hContTab, TCM_GETITEMCOUNT, 0, 0);

		if (iItemCnt != 0)
		{
			TCITEM		tcItem = {0};

			tcItem.mask	= TCIF_PARAM;

			if ((unsigned int)iItem == iItemCnt)
			{
				iItem--;
			}

			// activate new selected item and view plugin dialog
			_prevItem = iItem;
			SelectTab(iItem);

			// hide tabs if only one element
			if (iItemCnt == 1)
			{
				::ShowWindow(_hContTab, SW_HIDE);
			}
		}
		else 
		{
			// hide dialog
			this->doDialog(false);

			// send message to docking manager for resize
			if (!_isFloating)
			{
				::SendMessage(_hParent, WM_SIZE, 0, 0);
			}
		}

		// keep sure, that client is hide!!!
		if (hideClient == TRUE)
		{
			::ShowWindow(pTbData->hClient, SW_HIDE);
		}
	}
	onSize();

	return iItem;
}
Ejemplo n.º 17
0
void CTabBarClass::Switch(BOOL abForward, BOOL abAltStyle/*=FALSE*/)
{
	int nNewSel = GetNextTab(abForward, abAltStyle);

	if (nNewSel != -1)
	{
		// mh_Tabbar может быть и создан, Но отключен пользователем!
		if (gpSet->isTabLazy && mp_Rebar->IsTabbarCreated() && gpSet->isTabs)
		{
			mb_InKeySwitching = true;
			// Пока Ctrl не отпущен - только подсвечиваем таб, а не переключаем реально
			SelectTab(nNewSel);
		}
		else
		{
			mb_InKeySwitching = gpSet->isTabRecent;
			// Пока Ctrl не отпущен - подсвечиваем таб
			if (gpSet->isTabRecent)
				SelectTab(nNewSel);
			mp_Rebar->FarSendChangeTab(nNewSel);
		}
	}
}
Ejemplo n.º 18
0
void cHousingWarehouseDlg::Linking()
{
	//m_BtDecorationMode  = (cButton*)GetWindowForID(HOUSING_WH_DECOMODE_BTN);
	//m_BtDecoPoint		= (cButton*)GetWindowForID(HOUSING_WH_DECOPOINT_BTN);
	m_BtLeftScroll		= (cButton*)GetWindowForID(HOUSING_WH_LEFT_BTN);
	m_BtRightScroll		= (cButton*)GetWindowForID(HOUSING_WH_RIGHT_BTN);
	m_BtUpScroll		= (cButton*)GetWindowForID(HOUSING_WH_UP_BTN);
	m_BtDownScroll		= (cButton*)GetWindowForID(HOUSING_WH_DOWN_BTN);
	m_pStatic_Basic		= (cStatic*) GetWindowForID( HOUSING_WH_STATIC_TABBTN_BASIC_TEXTPOS ) ;
	m_pStatic_Push		= (cStatic*) GetWindowForID( HOUSING_WH_STATIC_TABBTN_PUSH_TEXTPOS ) ;

	//090714 pdy 탭버튼 기능 수정
	//최초에 한번 셀렉트탭을 해주자 이유는 탭버튼의 텍스트 위치때문이다
	SelectTab(m_bSelTabNum);
}
Ejemplo n.º 19
0
long CRegViewWnd::OnNotify(WPARAM param, NMHDR* hdr)
{
	if(CWindow::IsNotifySource(&m_tabs, hdr))
	{
		switch(hdr->code)
		{
		case TCN_SELCHANGING:
			UnselectTab(m_tabs.GetSelection());
			break;
		case TCN_SELCHANGE:
			SelectTab(m_tabs.GetSelection());
			break;
		}
	}
	return FALSE;
}
Ejemplo n.º 20
0
void CMainWindow::InsertDocument(DocumentPtr&& documentWindow)
{
	int currentSelection = m_tabs.GetSelection();
	if(currentSelection != -1)
	{
		UnselectTab(currentSelection);
	}
	std::string documentName = "New Document";
	if(auto document = dynamic_cast<IDocument*>(documentWindow.get()))
	{
		documentName = document->GetName();
	}
	m_documents.insert(std::make_pair(m_nextDocumentId, std::move(documentWindow)));
	unsigned int tabIndex = m_tabs.InsertTab(string_cast<std::tstring>(documentName).c_str());
	m_tabs.SetTabData(tabIndex, m_nextDocumentId);
	m_tabs.SetSelection(tabIndex);
	SelectTab(tabIndex);
	m_nextDocumentId++;
}
Ejemplo n.º 21
0
long CMainWindow::OnNotify(WPARAM param, NMHDR* hdr)
{
	if(CWindow::IsNotifySource(&m_tabs, hdr))
	{
		switch(hdr->code)
		{
		case NM_RCLICK:
			OnTabRightClick();
			break;
		case TCN_SELCHANGING:
			UnselectTab(m_tabs.GetSelection());
			break;
		case TCN_SELCHANGE:
			SelectTab(m_tabs.GetSelection());
			break;
		}
	}
	return FALSE;
}
Ejemplo n.º 22
0
void CFilterDlg::OnOk(UINT /*uNotifyCode*/, int nID, CWindow /*wndCtl*/)
{
	m_name = Win32::GetDlgItemText(*this, IDC_NAME);
	CFilterPage* pPage = nullptr;
	try
	{
		pPage = &m_messagePage;
		m_filter.messageFilters = m_messagePage.GetFilters();
		pPage = &m_processPage;
		m_filter.processFilters = m_processPage.GetFilters();
	}
	catch (std::regex_error& ex)
	{
		SelectTab(pPage == &m_processPage);
		MessageBox(WStr(L"Regular expression syntax error: " + GetRegexErrorDescription(ex.code())), LoadString(IDR_APPNAME).c_str(), MB_ICONERROR | MB_OK);
		pPage->ShowError();
		return;
	}
	EndDialog(nID);
}
Ejemplo n.º 23
0
void CMainWindow::CloseTab(int tabIndex)
{
	if(m_tabs.GetSelection() == tabIndex)
	{
		UnselectTab(tabIndex);
	}
	uint32 documentId = m_tabs.GetTabData(tabIndex);
	auto documentIterator = m_documents.find(documentId);
	assert(documentIterator != std::end(m_documents));
	if(documentIterator != std::end(m_documents))
	{
		documentIterator->second->Destroy();
		m_documents.erase(documentIterator);
	}
	m_tabs.DeleteTab(tabIndex);
	if(m_tabs.GetItemCount() > 0)
	{
		m_tabs.SetSelection(0);
		SelectTab(0);
	}
}
Ejemplo n.º 24
0
BOOL CXTabCtrl::SelectTabByName(LPCTSTR lpszTabCaption)
{
	TCHAR szName[64];
	TCITEM item;
	
	memset(&item, 0, sizeof(item));

	item.mask       = TCIF_TEXT;
	item.cchTextMax = sizeof(szName);
	item.pszText    = szName;

	for (int i=0; i < GetItemCount(); i++)
	{
		GetItem(i, &item);

		if (lstrcmp(lpszTabCaption, item.pszText) == 0)
			return SelectTab(i);
	}

	return FALSE;
}
Ejemplo n.º 25
0
void CRTabsCtrl::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// find which tab was clicked on, show that window and hide the rest
// the old way of finding tab...
	// lets assume for now that each tab is 80 pixels wide;
//	int tab=point.x/80;
// the new way!
	GetParent()->SendMessage(WM_PLAYSOUND,FIL_SFX_OFFICE_PAPER1,NULL);//DAW 06Apr99

	POSITION rectpos=m_rectList.GetHeadPosition();
	POSITION tabpos=m_tabList.GetHeadPosition();
	int x;
	CRect rect;
	int tab;
	for (x=0;x<m_rectList.GetCount();x++)
	{
		rect = m_rectList.GetNext(rectpos);
		tab = m_tabList.GetNext(tabpos);
		if (rect.PtInRect(point)) break;
	}
	SelectTab(tab);
	COleControl::OnLButtonDown(nFlags, point);
}
Ejemplo n.º 26
0
Widget* MultiTabs::ClickUp(const Point2i &mousePosition, uint button)
{
  if (tabs.size() != 1) {

    Rectanglei rect_header(position.x, position.y,
                           size.x, prev_tab_bt->GetSizeY());

    if (rect_header.Contains(mousePosition)) {
      if (button == SDL_BUTTON_WHEELDOWN) {
        PrevTab();

      } else if (button == SDL_BUTTON_WHEELUP) {
        NextTab();

      } else {
        // Either Left, Middle or Right buttons.
        if (prev_tab_bt->Contains(mousePosition)) {
          PrevTab();
        } else if (next_tab_bt->Contains(mousePosition)) {
          NextTab();
        } else if (nb_visible_tabs > 1) {
          uint clicked_tab = (mousePosition.x - prev_tab_bt->GetPositionX()
                              - prev_tab_bt->GetSizeX() - 5)
                           / tab_header_width + first_tab;
          SelectTab(clicked_tab);
        }
      }

      return this;
    }
  }

  if (!tabs.empty())
    return tabs[current_tab].box->ClickUp(mousePosition, button);

  return NULL;
}
Ejemplo n.º 27
0
void CTabBarClass::Update(BOOL abPosted/*=FALSE*/)
{
	#ifdef _DEBUG
	if (this != gpConEmu->mp_TabBar)
	{
		_ASSERTE(this == gpConEmu->mp_TabBar);
	}
	#endif

	MCHKHEAP
	/*if (!_active)
	{
	    return;
	}*/ // Теперь - ВСЕГДА! т.к. сами управляем мультиконсолью

	if (mb_DisableRedraw)
	{
		_ASSERTE(FALSE && "mb_DisableRedraw?"); // Надо?
		return;
	}

	if (!isMainThread())
	{
		RequestPostUpdate();
		return;
	}

	gpConEmu->mp_Status->UpdateStatusBar();

	mb_PostUpdateCalled = FALSE;

	#ifdef _DEBUG
	_ASSERTE(mn_InUpdate >= 0);
	if (mn_InUpdate > 0)
	{
		_ASSERTE(mn_InUpdate == 0);
	}
	#endif

	mn_InUpdate ++;

	MCHKHEAP
	int V, I, tabIdx = 0, nCurTab = -1;
	BOOL bShowFarWindows = gpSet->bShowFarWindows;

	// Выполняться должно только в основной нити, так что CriticalSection не нужна

	#ifdef _DEBUG
	if (this != gpConEmu->mp_TabBar)
	{
		_ASSERTE(this == gpConEmu->mp_TabBar);
	}
	#endif

	TODO("Обработка gpSet->bHideInactiveConsoleTabs для новых табов");
	MCHKHEAP


	// Check if we need to AutoSHOW or AutoHIDE tab bar
	if (!IsTabsActive() && gpSet->isTabs)
	{
		int nTabs = CountActiveTabs(2);
		if (nTabs > 1)
		{
			Activate();
		}
	}
	else if (IsTabsActive() && gpSet->isTabs==2)
	{
		int nTabs = CountActiveTabs(2);
		if (nTabs <= 1)
		{
			Deactivate();
		}
	}


	// Validation?
	#ifdef _DEBUG
	if (this != gpConEmu->mp_TabBar)
	{
		_ASSERTE(this == gpConEmu->mp_TabBar);
	}
	#endif



	MCHKHEAP
	HANDLE hUpdate = m_Tabs.UpdateBegin();
	_ASSERTE(hUpdate!=NULL);

	bool bStackChanged = false;

	/* ********************* */
	/*          Go           */
	/* ********************* */
	{
		MMap<CVConGroup*,CVirtualConsole*> Groups; Groups.Init(MAX_CONSOLE_COUNT, true);

		for (V = 0; V < MAX_CONSOLE_COUNT; V++)
		{
			//if (!(pVCon = gpConEmu->GetVCon(V))) continue;
			CVConGuard guard;
			if (!CVConGroup::GetVCon(V, &guard))
				continue;
			CVirtualConsole* pVCon = guard.VCon();

			BOOL lbActive = pVCon->isActive(false);

			if (gpSet->bHideInactiveConsoleTabs && !lbActive)
				continue;

			if (gpSet->isOneTabPerGroup)
			{
				CVConGroup *pGr;
				CVConGuard VGrActive;
				if (CVConGroup::isGroup(pVCon, &pGr, &VGrActive))
				{
					CVirtualConsole* pGrVCon;

					if (Groups.Get(pGr, &pGrVCon))
						continue; // эта группа уже есть

					pGrVCon = VGrActive.VCon();
					Groups.Set(pGr, pGrVCon);

					// И показывать таб нужно от "активной" консоли, а не от первой в группе
					if (pVCon != pGrVCon)
					{
						guard = pGrVCon;
						pVCon = pGrVCon;
					}

					if (!lbActive)
					{
						lbActive = pVCon->isActive(true);
					}

					// Показывать редакторы из всех групп?
					if (gpSet->bShowFarWindows)
					{
						MArray<CVConGuard*> Panes;
						int nPanes = pGr->GetGroupPanes(&Panes);

						// Только если в группе более одного таба - тогда нужно дополниетльная логика населения...
						if (nPanes > 1)
						{
							// Первым табом - показать текущую панель, либо МОДАЛЬНЫЙ редактор/вьювер
							// Редакторы из "far /e ..." здесь НЕ добавлять!
							if (!pVCon->RCon()->isFarPanelAllowed()
								|| !UpdateAddTab(hUpdate, tabIdx, nCurTab, bStackChanged, pVCon, uat_PanelsOrModalsOnly))
							{
								// Если есть - добавить ОДНУ панель, чтобы табы сплита не прыгали туда-сюда
								for (int K = 0; K < nPanes; K++)
								{
									if (Panes[K]->VCon()->RCon()->isFarPanelAllowed())
									{
										if (UpdateAddTab(hUpdate, tabIdx, nCurTab, bStackChanged,
												Panes[K]->VCon(), uat_PanelsOnly) > 0)
											break;
									}
								}
							}

							// Потом - все оставшиеся редакторы/вьюверы (в том числе и "far /e ...")
							for (int K = 0; K < nPanes; K++)
							{
								UpdateAddTab(hUpdate, tabIdx, nCurTab, bStackChanged,
									Panes[K]->VCon(), uat_NonModals|uat_NonPanels);
							}

							// Release
							CVConGroup::FreePanesArray(Panes);

							// Already processed, next VCon
							continue;
						}
					}
				}
			}

			UpdateAddTab(hUpdate, tabIdx, nCurTab, bStackChanged, pVCon, uat_AnyTab);
		}

		Groups.Release();
	}

	MCHKHEAP

	// Must be at least one tab ("ConEmu -Detached" for example)
	if (tabIdx == 0)
	{
		m_Tabs.UpdateAppend(hUpdate, mp_DummyTab, FALSE);

		// Физически (WinAPI) добавляет закладку, или меняет (при необходимости) заголовок существующей
		mp_Rebar->AddTabInt(gpConEmu->GetDefaultTabLabel(), tabIdx, gpConEmu->mb_IsUacAdmin, -1);

		nCurTab = tabIdx;
		tabIdx++;
	}

	m_Tabs.UpdateEnd(hUpdate, 0);

	// Проверим стек последних выбранных
	if (CheckStack())
		bStackChanged = true;

	#ifdef PRINT_RECENT_STACK
	PrintRecentStack();
	#endif

	#ifdef _DEBUG
	static int nPrevVisible, nPrevStacked;
	{
		wchar_t szDbg[100];
		int nNewVisible = m_Tabs.GetCount();
		int nNewStacked = m_TabStack.size();
		_wsprintf(szDbg, SKIPLEN(countof(szDbg)) L"*** Tab list updated. Visible:%u, Stacked:%u, StackChanged:%s\n",
			nNewVisible, nNewStacked, bStackChanged ? L"Yes" : L"No");
		DEBUGSTRCOUNT(szDbg);
		nPrevVisible = nNewVisible;
		nPrevStacked = nNewStacked;
	}
	#endif

	// удалить лишние закладки (визуально)
	int nCurCount = GetItemCount();

	#ifdef _DEBUG
	wchar_t szDbg[128];
	_wsprintf(szDbg, SKIPLEN(countof(szDbg)) L"CTabBarClass::Update.  ItemCount=%i, PrevItemCount=%i\n", tabIdx, nCurCount);
	DEBUGSTRTABS(szDbg);
	#endif

	if (mp_Rebar->IsTabbarCreated())
	{
		for (I = tabIdx; I < nCurCount; I++)
		{
			#ifdef _DEBUG
			_wsprintf(szDbg, SKIPLEN(countof(szDbg)) L"   Deleting tab=%i\n", I+1);
			DEBUGSTRTABS(szDbg);
			#endif

			DeleteItem(tabIdx);
		}
	}

	MCHKHEAP

	if (mb_InKeySwitching)
	{
		if (mn_CurSelTab >= nCurCount)  // Если выбранный таб вылез за границы
			mb_InKeySwitching = false;
	}

	if (!mb_InKeySwitching && nCurTab != -1)
	{
		SelectTab(nCurTab);
	}

	UpdateToolConsoles();

	//if (gpSet->isTabsInCaption)
	//{
	//	SendMessage(ghWnd, WM_NCPAINT, 0, 0);
	//}

	mn_InUpdate --;

	if (mb_PostUpdateRequested)
	{
		mb_PostUpdateCalled = FALSE;
		mb_PostUpdateRequested = FALSE;
		RequestPostUpdate();
	}

	MCHKHEAP
	return; // Just for clearness
}
Ejemplo n.º 28
0
LRESULT CFilterDlg::OnTabSelChange(NMHDR* /*pnmh*/)
{
	SelectTab(m_tabCtrl.GetCurSel());
	return 0;
}
Ejemplo n.º 29
0
void WgTablist::_onEvent( const WgEventPtr& _pEvent, WgEventHandler * pHandler )
{
	WgWidget::_onEvent(_pEvent,pHandler);

	switch( _pEvent->Type() )
	{
		case WG_EVENT_TICK:
		{
			WgTickEventPtr pEvent = WgTickEvent::Cast(_pEvent);

			m_alertModeCnt -= pEvent->Millisec();
			if( m_alertModeCnt <= 0 )
			{
				m_bAlertOn = !m_bAlertOn;
				m_alertModeCnt = m_alertRate;		// This is right, we want it to stay in the new mode at least one frame.

				// Check if we have to render something...

				WgTab * pTab = m_tabs.First();
				while( pTab )
				{
					if( pTab->m_bAlert && pTab->m_bVisible )
					{
						_requestRender();			// Somewhat stupid to render all tabs though...
						break;
					}
					pTab = pTab->Next();
				}
			}
			break;
		}

		case WG_EVENT_MOUSE_PRESS:
		{
			WgMouseButtonEventPtr pEvent = WgMouseButtonEvent::Cast(_pEvent);

			WgCoord pos = pEvent->PointerPos();

			WgTab * pTab = _pos2Tab( pos.x, pos.y );
			if( pTab && pTab != m_pTabSelected )
			{
				if( pEvent->Button() == WG_BUTTON_LEFT )
					SelectTab(pTab->m_id);

				pHandler->QueueEvent( new WgItemMousePressEvent(this, pTab->m_id, WgObjectPtr(), pEvent->Button()) );
			}
		}
		break;

		case WG_EVENT_MOUSE_ENTER:
		case WG_EVENT_MOUSE_MOVE:
		{
			WgCoord pos = _pEvent->PointerPos();

			WgTab * pTab = _pos2Tab( pos.x, pos.y );
			if( pTab != m_pTabMarked )
			{
				m_pTabMarked = pTab;
				_requestRender();
			}
		}
		break;

		case WG_EVENT_MOUSE_LEAVE:
			if( m_pTabMarked )
			{
				m_pTabMarked = 0;
				_requestRender();
			}
		break;

        default:
            break;
	}

	// Swallow event depending on rules.

	if( _pEvent->IsMouseButtonEvent() && WgMouseButtonEvent::Cast(_pEvent)->Button() == WG_BUTTON_LEFT )
		pHandler->SwallowEvent(_pEvent);
}
Ejemplo n.º 30
0
//----------------------------------------------------------
//    Process function of tab
//
LRESULT DockingCont::runProcTab(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
	static	ToolTip	toolTip;

	switch (Message)
	{
		case WM_LBUTTONDOWN:
		{
			_beginDrag	= TRUE;
			return TRUE;
		}
		case WM_LBUTTONUP:
		{
			int				iItem	= 0;
			TCHITTESTINFO	info	= {0};

			// get selected sub item
			info.pt.x = LOWORD(lParam);
			info.pt.y = HIWORD(lParam);
			iItem = ::SendMessage(hwnd, TCM_HITTEST, 0, (LPARAM)&info);

			SelectTab(iItem);
			_beginDrag = FALSE;
			return TRUE;
		}
		case WM_LBUTTONDBLCLK:
		{
			NotifyParent((_isFloating == true)?DMM_DOCK:DMM_FLOAT);
			return TRUE;
		}
		case WM_MBUTTONUP:
		{
			int				iItem	= 0;
			TCITEM			tcItem	= {0};
			TCHITTESTINFO	info	= {0};

			// get selected sub item
			info.pt.x = LOWORD(lParam);
			info.pt.y = HIWORD(lParam);
			iItem = ::SendMessage(hwnd, TCM_HITTEST, 0, (LPARAM)&info);

			SelectTab(iItem);

			// get data and hide toolbar
			tcItem.mask		= TCIF_PARAM;
			::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem);

			if (!tcItem.lParam)
				return FALSE;

			// notify child windows
			if (NotifyParent(DMM_CLOSE) == 0)
			{
				hideToolbar((tTbData*)tcItem.lParam);
			}
			return TRUE;
		}

		case WM_MOUSEMOVE:
		{
			int				iItem	= 0;
			TCHITTESTINFO	info	= {0};

			// get selected sub item
			info.pt.x = LOWORD(lParam);
			info.pt.y = HIWORD(lParam);
			iItem = ::SendMessage(hwnd, TCM_HITTEST, 0, (LPARAM)&info);

			if ((_beginDrag == TRUE) && (wParam == MK_LBUTTON))
			{
				SelectTab(iItem);

				// send moving message to parent window
				_dragFromTab = TRUE;
				NotifyParent(DMM_MOVE);
				_beginDrag = FALSE;
			}
            else
            {
				int	iItemSel = ::SendMessage(hwnd, TCM_GETCURSEL, 0, 0);

				if ((_bTabTTHover == FALSE) && (iItem != iItemSel))
				{
					TRACKMOUSEEVENT tme;
					tme.cbSize = sizeof(tme);
					tme.hwndTrack = hwnd;
					tme.dwFlags = TME_LEAVE | TME_HOVER;
					tme.dwHoverTime = 1000;
					_bTabTTHover = _TrackMouseEvent(&tme);
				}
				else
				{
					if (iItem == iItemSel)
					{
						toolTip.destroy();
						_bTabTTHover = FALSE;
					}
					else if (iItem != _iLastHovered)
					{
						TCITEM	tcItem	= {0};
						RECT	rc		= {0};

						// destroy old tooltip
						toolTip.destroy();

						// recalc mouse position
						::ClientToScreen(hwnd, &info.pt);

						// get text of toolbar
						tcItem.mask		= TCIF_PARAM;
						::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem);
						if (!tcItem.lParam)
							return FALSE;

						toolTip.init(_hInst, hwnd);
						toolTip.Show(rc, ((tTbData*)tcItem.lParam)->pszName, info.pt.x, info.pt.y + 20);
					}
				}

				// save last hovered item
				_iLastHovered = iItem;

				_beginDrag = FALSE;
			}
			return TRUE;
		}

		case WM_MOUSEHOVER:
		{
			int				iItem	= 0;
			TCITEM			tcItem	= {0};
			RECT			rc		= {0};
			TCHITTESTINFO	info	= {0};

			// get selected sub item
			info.pt.x = LOWORD(lParam);
			info.pt.y = HIWORD(lParam);
			iItem = ::SendMessage(hwnd, TCM_HITTEST, 0, (LPARAM)&info);

			// recalc mouse position
			::ClientToScreen(hwnd, &info.pt);

			// get text of toolbar
			tcItem.mask		= TCIF_PARAM;
			::SendMessage(hwnd, TCM_GETITEM, iItem, (LPARAM)&tcItem);
			if (!tcItem.lParam)
				return FALSE;

			toolTip.init(_hInst, hwnd);
			toolTip.Show(rc, ((tTbData*)tcItem.lParam)->pszName, info.pt.x, info.pt.y + 20);
			return TRUE;
		}

		case WM_MOUSELEAVE:
		{
			toolTip.destroy();
			_bTabTTHover = FALSE;
			return TRUE;
		}

		case WM_NOTIFY:
		{
			LPNMHDR	lpnmhdr = (LPNMHDR)lParam;

			if ((lpnmhdr->hwndFrom == _hContTab) && (lpnmhdr->code == TCN_GETOBJECT))
			{
				int				iItem	= 0;
				TCHITTESTINFO	info	= {0};

				// get selected sub item
				info.pt.x = LOWORD(lParam);
				info.pt.y = HIWORD(lParam);
				iItem = ::SendMessage(hwnd, TCM_HITTEST, 0, (LPARAM)&info);

				SelectTab(iItem);
			}
			break;
		}
		default:
			break;
	}

	return ::CallWindowProc(_hDefaultTabProc, hwnd, Message, wParam, lParam);
}