// --- cMenuSearchMain --------------------------------------------------------- cMenuSearchMain::cMenuSearchMain(void) :cOsdMenu("", GetTab(1), GetTab(2), GetTab(3), GetTab(4), GetTab(5)) { #if VDRVERSNUM >= 10728 SetMenuCategory(mcSchedule); #endif helpKeys = -1; otherChannel = 0; toggleKeys = 0; shiftTime = 0; InWhatsOnMenu = false; InFavoritesMenu = false; cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel()); schedules = cSchedules::Schedules(schedulesLock); if (channel) { cMenuWhatsOnSearch::SetCurrentChannel(channel->Number()); if (EPGSearchConfig.StartMenu == 0 || forceMenu != 0) PrepareSchedule(channel); SetHelpKeys(); cMenuWhatsOnSearch::currentShowMode = showNow; // timeb tnow; //ftime(&tnow); //isyslog("duration epgs sched: %d", tnow.millitm - gl_time.millitm + ((tnow.millitm - gl_time.millitm<0)?1000:0)); } if ((EPGSearchConfig.StartMenu == 1 || forceMenu == 1) && forceMenu != 2) { InWhatsOnMenu = true; AddSubMenu(new cMenuWhatsOnSearch(schedules, cDevice::CurrentChannel())); } if (forceMenu == 3) ShowSummary(); }
void MapTabbook::OnNotebookPageChanged(wxAuiNotebookEvent& evt) { gui.UpdateMinimap(); int32_t oldSelection = evt.GetOldSelection(); int32_t newSelection = evt.GetSelection(); MapTab* oldMapTab; if(oldSelection != -1) { oldMapTab = dynamic_cast<MapTab*>(GetTab(oldSelection)); } else { oldMapTab = nullptr; } MapTab* newMapTab; if(newSelection != -1) { newMapTab = dynamic_cast<MapTab*>(GetTab(newSelection)); } else { newMapTab = nullptr; } // std::cout << oldSelection << " " << newSelection; if(!newMapTab) { gui.RefreshPalettes(nullptr); } else if(!oldMapTab || !oldMapTab->HasSameReference(newMapTab)) { gui.RefreshPalettes(newMapTab->GetMap()); gui.UpdateMenus(); } }
////////////////// /// Invalidate a tab: invaldate its rect // void CFolderTabCtrl::InvalidateTab(int iTab, BOOL bErase) { CRect rc = GetTab(iTab)->GetRect(); int xOrigin = m_cxButtons - GetTab(m_iFirstTab)->GetRect().left; rc += CPoint(xOrigin,0); InvalidateRect(rc, bErase); }
////////////////// // Paint function // void CFolderTabCtrl::OnPaint() { CPaintDC dc(this); // device context for painting int xOrigin = m_cxButtons - GetTab(m_iFirstTab)->GetRect().left; dc.SetViewportOrg(xOrigin,0); CRect rc; GetClientRect(&rc); CFolderTab* pCurTab = NULL; // draw all the normal (non-selected) tabs int n = GetItemCount(); for (int i=0; i<n; i++) { CFolderTab* pTab = GetTab(i); ASSERT(pTab); if (i==m_iCurItem) { pCurTab = pTab; } else { pTab->Draw(dc, m_fontNormal, FALSE); } } // draw selected tab last so it will be "on top" of the others if (pCurTab) pCurTab->Draw(dc, m_fontSelected, TRUE); // draw border: line along the top edge, excluding seleted tab CRect rcCurTab(0,0,0,0); if (pCurTab) rcCurTab = pCurTab->GetRect(); rc.right -= xOrigin; CPen blackPen(PS_SOLID, 1, RGB(0,0,0)); // black CPen* pOldPen = dc.SelectObject(&blackPen); dc.MoveTo(rcCurTab.right, rcCurTab.top); dc.LineTo(rc.right, rc.top); if (m_dwFtabStyle & FTS_FULLBORDER) { dc.MoveTo(rc.right-1, rc.top); dc.LineTo(rc.right-1, rc.bottom-1); dc.LineTo(rc.left, rc.bottom-1); dc.LineTo(rc.left, rc.top); } else { dc.MoveTo(rc.left, rc.top); } dc.LineTo(rcCurTab.TopLeft()); dc.SelectObject(pOldPen); }
int CGraphicTabControl::TotalTabWidth(void) const { int w = 0; for( int i = 0; i < GetTabCount(); i++ ) { w += GetTab( i ).m_nWidth; } return w; }
wxString IACTropicalSystem::GetCharacteristic(size_t index) const { static const wxChar *(tab[]) = {wxEmptyString, _("diffuse"), _("sharply defines"), _("quasistationary"), _("existance certain"), _("existance uncertain"), _("formation expected"), _("position certain"), _("position uncertain"), _("movement doubtful")}; return (GetTab(tab, index)); }
void tcOptionsView::OnMouseMove(wxMouseEvent& event) { if (!sliderDragActive) return; if (buttonDownTab != GetTab()) { sliderDragActive = false; // cancel slider drag return; } wxPoint pos = event.GetPosition(); int dx = pos.x - buttonDownPoint.x; std::vector<tcOptions::OptionInfo>& optionList = mpOptions->maOptionInfo; int optionIdx = buttonInfo[sliderIdx].optionIdx; float sliderVal = optionList[optionIdx].floatVal; float sliderMin = optionList[optionIdx].floatMin; float sliderMax = optionList[optionIdx].floatMax; sliderDragValue = sliderVal + dx*(sliderMax-sliderMin)/sliderBarWidth; sliderDragValue = std::max(sliderDragValue, sliderMin); sliderDragValue = std::min(sliderDragValue, sliderMax); }
/** * @return true if button down on slider thumb, false otherwise */ bool tcOptionsView::OnLButtonDownSlider(const wxPoint& pos) { bool foundSlider = false; for (size_t k=0; (k<buttonInfo.size())&&(!foundSlider); k++) { if (buttonInfo[k].isSlider) { if (buttonInfo[k].thumbRect.ContainsPoint(float(pos.x), float(mnHeight-pos.y))) { foundSlider = true; sliderIdx = k; } } } if (!foundSlider) return false; std::vector<tcOptions::OptionInfo>& optionList = mpOptions->maOptionInfo; // initialize sliderDragValue here since mouse may not move initially int optionIdx = buttonInfo[sliderIdx].optionIdx; float sliderVal = optionList[optionIdx].floatVal; sliderDragValue = sliderVal; sliderDragActive = true; buttonDownPoint = pos; buttonDownTab = GetTab(); return true; }
////////////////// // Find which tab is under mouse, -1 if none // int CFolderTabCtrl::HitTest(CPoint pt) { CRect rc; GetClientRect(&rc); rc.left += m_cxButtons; if (rc.PtInRect(pt)) { int xOrigin = m_cxButtons - GetTab(m_iFirstTab)->GetRect().left; pt.x -= xOrigin; int n = GetItemCount(); for (int i=0; i<n; i++) { if (GetTab(i)->HitTest(pt)) return i; } } return -1; }
void GxTabs::Draw() { GxDraw* draw = GxDraw::Get(); GxStyle& style = *GxStyle::Get(); bool lock = IsLockedWidget(); // Draw frame GxRecti r(myRect.x, myRect.y, myRect.w, tabH); style.Bar(r); // Draw tabs r = GetRect(); for(int i=0; i<myTabs.Size(); ++i) { GxTab* tab = GetTab(i); GxRecti tr = myGetTabRect(i); if(i == myHoverTab || tab->IsSelected()) style.Tab(tr, i == myHoverTab && !lock, tab->IsSelected()); style.Label(tr, GX_TA_CENTER, GX_TA_MIDDLE, tab->GetText(), lock); } if(mySelectedTab) mySelectedTab->GetLayout().Draw(); }
void MapTabbook::OnNotebookPageClose(wxAuiNotebookEvent& evt) { EditorTab* editorTab = GetTab(evt.GetInt()); MapTab* mapTab = dynamic_cast<MapTab*>(editorTab); if(mapTab && mapTab->IsUniqueReference() && mapTab->GetMap()) { if(mapTab->GetEditor()->IsLive()) { if(mapTab->GetMap()->hasChanged()) { SetFocusedTab(evt.GetInt()); if(gui.root->DoQuerySave(false)) { gui.RefreshPalettes(nullptr, false); gui.UpdateMenus(); } else { evt.Veto(); } } else { gui.RefreshPalettes(nullptr, false); gui.UpdateMenus(); } } return; } LiveLogTab* lt = dynamic_cast<LiveLogTab*>(editorTab); if(lt && lt->IsConnected()) { evt.Veto(); } }
////////////////// // Set folder tab text // void CFolderTabCtrl::SetItemText(int iItem, LPCTSTR lpText) { CFolderTab* pft = GetTab(iItem); if (pft) { pft->SetText(lpText); } }
void MapTabbook::OnSwitchEditorMode(EditorMode mode) { for(int32_t i = 0; i < GetTabCount(); ++i) { EditorTab* editorTab = GetTab(i); if(editorTab) { editorTab->OnSwitchEditorMode(mode); } } }
BOOL Panel::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { // Let the active tab process the command first Tabs tab = GetActiveTab(); if (tab != No_Tab) { if (GetTab(tab)->OnCmdMsg(nID,nCode,pExtra,pHandlerInfo)) return TRUE; } return CWnd::OnCmdMsg(nID,nCode,pExtra,pHandlerInfo); }
wxString IACTropicalSystem::GetType(size_t index) const { static const wxChar *(tab[]) = {_("Intertropical convergence zone"), _("Shear line"), _("Line or Zone of convergence"), _("Axis of doldrum belt"), _("Through in westerlies"), _("Through in easterlies"), _("LOW area"), _("Surge line"), _("Divergence zone"), _("Tropical cyclone")}; return (GetTab(tab, index)); }
void TmForm::LoadTexToCurrTab(Obd *Det) { Tab *t=GetTab(GetLastTab(1)); if(t) { // найдена последняя таба ((ClassConnector *)(((TechTab *)t)->module))->Load_sel(Det); t->tab->Show(); } else { AddTexTab(RightPC, Det); } // поиск последней табы с технологией и обращение к ней если нет табы то создать новую }
////////////////// // Determine enabled state of scroll buttons // void CFolderTabCtrl::UpdateButtons() { if (m_wndButton[0].m_hWnd && !m_lsTabs.IsEmpty()) { // enable prev button iff more tabs to left. m_wndButton[0].EnableWindow(m_iFirstTab>0); // enable next button iff more tabs to right CRect rc; GetClientRect(&rc); int xOrigin = m_cxButtons - GetTab(m_iFirstTab)->GetRect().left; CRect rcLast = ((CFolderTab*)m_lsTabs.GetTail())->GetRect(); m_wndButton[1].EnableWindow(xOrigin + rcLast.right>rc.right); } }
void TmForm::LoadexViewToCurrTab(Obd *Det) { Tab *t=GetTab(GetLastTab(2)); if(t) { // найдена последняя таба // ((ClassConnector*)(((TechViewTab*)t)->module))->Load(det); t->tab->Show(); t->tab->Caption="просмотр текущая вкладка"; } else { AddTexViewTab(RightPC, Det); } }
int EPropList::Size() { int nSize = 0; int nNumTabs = m_vTabGroups.size(); if( nNumTabs > 0 ) { ASSERT( m_nCurrentTab < nNumTabs ); nSize = GetTab(m_nCurrentTab)->Size(); } return nSize; }
EProperty* EPropList::AddProperty( EProperty* pProperty ) { if( m_vTabGroups.size() == 0 ) { AddTab("Default"); m_bHasUserTabs = false; } pProperty->m_nIndent = m_nIndent; pProperty->m_pParentHost = (m_vParentStack.size()>0) ? m_vParentStack.top() : NULL; GetTab(m_nCurrentTab)->AddProperty(pProperty); return pProperty; }
wxString IACTropicalSystem::GetIntensity(void) const { static const wxChar *(tab[]) = {wxT("-"), _("weak, decreasing"), _("weak, no change"), _("weak, increasing"), _("moderate, decreasing"), _("moderate, no change"), _("moderate, increasing"), _("strong, decreasing"), _("strong, no change"), _("strong, increasing")}; if (m_int > 0) { return (GetTab(tab, m_int)); } else { return wxEmptyString; } }
void TmForm::SetLastTab(TTabSheet *tab) { Tab *t=GetTab(tab); if(t&&Tabs.size()) { for(vector < Tab * > ::iterator i=Tabs.begin(); i<Tabs.end(); i++) { if((*i)->TrueClassName()==t->TrueClassName()) { if((*i)!=t) { (*i)->last_tab=false; } } } t->last_tab=true; } }
////////////////// // Recalculate layout based on having added or removed a tab. // void CFolderTabCtrl::RecomputeLayout() { CClientDC dc(this); CFont* pOldFont = dc.SelectObject(&m_fontNormal); int x = 0; int n = GetItemCount(); CFolderTab* pTab; for (int i=0; i<n; i++) { pTab = GetTab(i); if (pTab) x += pTab->ComputeRgn(dc, x) - CXOFFSET; } dc.SelectObject(pOldFont); m_cxDesired = m_cxButtons; if (pTab) { CRect rc = pTab->GetRect(); m_cxDesired += rc.right; } }
void TmForm::CloseTab(TTabSheet *tab) { if(tab==InfoTab) { tab->Hide(); tab->PageControl=0; } else { Tab *t=GetTab(tab); if(t&&Tabs.size()&&t->CanClose()) { for(vector < Tab * > ::iterator i=Tabs.begin(); i<Tabs.end(); i++) { if((*i)==t) { Tabs.erase(i); } } delete t; } } }
wxString IACSystem::GetMovement(void) const { static const wxChar *(tab[]) = { wxT("-"), _("stationary"), _("little change"), _("stopping"), _("retarding"), _("curving to left"), _("recurving"), _("accelerating"), _("curving to right"), _("expected to recurve")}; wxString t; if (m_movement < 10) { // valid movement t = _("Movement: ") + GetTab(tab, m_movement); if (m_movement != 1) // not stationary, add dir and speed { wxString hlp; hlp.Printf(wxT(", %u\u00B0 "), m_direction); t.Append(hlp); if (m_speed >= 99) { t.Append(_("with unknown speed")); } else { hlp.Printf(_("with %uknots"), m_speed); t.Append(hlp); } } } return t; }
void BuyoutManager::UpdateTabItems(const Bucket &tab, bool force) { std::string hash = tab.location().GetGeneralHash(); bool set = ExistsTab(hash); Buyout buyout; if (set) buyout = GetTab(hash); // Set buyouts on items with the "set_by" flag set to the tab for (auto &item : tab.items()) { if (set) { Buyout b; b.currency = buyout.currency; b.type = buyout.type; b.value = buyout.value; if (!Exists(*item)) { // It's new! b.last_update = QDateTime::currentDateTime(); } else if (!IsItemManuallySet(*item)) { Buyout curr = Get(*item); if (!Equal(buyout, curr)) { b.last_update = buyout.last_update; } else { continue; } } else if (!force){ continue; } Set(*item, b, QString::fromStdString(hash)); } else if (!set && Exists(*item) && (!IsItemManuallySet(*item) || force)) { Delete(*item); } } Save(); }
//==== Constructor ====// WireScreen::WireScreen( ScreenMgr* mgr ) : GeomScreen( mgr, 300, 525, "Wireframe" ) { RemoveTab( GetTab( m_SubSurfTab_ind ) ); Fl_Group* wire_tab = AddTab( "WireFrame" ); Fl_Group* wire_group = AddSubGroup( wire_tab, 5 ); m_WireLayout.SetGroupAndScreen( wire_group, this ); m_WireLayout.AddDividerBox( "Wireframe Characteristics" ); m_TypeChoice.AddItem( "Lifting" ); m_TypeChoice.AddItem( "Non-Lifting" ); m_WireLayout.AddChoice( m_TypeChoice, "Type" ); m_WireLayout.AddYGap(); m_WireLayout.AddDividerBox( "Normal Vector" ); m_WireLayout.AddButton( m_InvertButton, "Invert" ); m_WireLayout.AddYGap(); m_WireLayout.AddDividerBox( "Swap Point Ordering" ); m_WireLayout.AddButton( m_SwapIJButton, "Swap I/J" ); m_WireLayout.AddYGap(); m_WireLayout.AddDividerBox( "Reverse" ); m_WireLayout.AddButton( m_RevIButton, "Reverse I" ); m_WireLayout.AddButton( m_RevJButton, "Reverse J" ); m_WireLayout.AddYGap(); m_WireLayout.AddDividerBox( "Patch" ); m_IStartPatchTypeChoice.AddItem( "None" ); m_IStartPatchTypeChoice.AddItem( "Point" ); m_IStartPatchTypeChoice.AddItem( "Line" ); m_IStartPatchTypeChoice.AddItem( "Copy Opposite" ); m_IStartPatchTypeChoice.AddItem( "Halfway Opposite" ); m_WireLayout.AddChoice( m_IStartPatchTypeChoice, "I Start" ); m_IEndPatchTypeChoice.AddItem( "None" ); m_IEndPatchTypeChoice.AddItem( "Point" ); m_IEndPatchTypeChoice.AddItem( "Line" ); m_IEndPatchTypeChoice.AddItem( "Copy Opposite" ); m_IEndPatchTypeChoice.AddItem( "Halfway Opposite" ); m_WireLayout.AddChoice( m_IEndPatchTypeChoice, "I End" ); m_JStartPatchTypeChoice.AddItem( "None" ); m_JStartPatchTypeChoice.AddItem( "Point" ); m_JStartPatchTypeChoice.AddItem( "Line" ); m_JStartPatchTypeChoice.AddItem( "Copy Opposite" ); m_JStartPatchTypeChoice.AddItem( "Halfway Opposite" ); m_WireLayout.AddChoice( m_JStartPatchTypeChoice, "J Start" ); m_JEndPatchTypeChoice.AddItem( "None" ); m_JEndPatchTypeChoice.AddItem( "Point" ); m_JEndPatchTypeChoice.AddItem( "Line" ); m_JEndPatchTypeChoice.AddItem( "Copy Opposite" ); m_JEndPatchTypeChoice.AddItem( "Halfway Opposite" ); m_WireLayout.AddChoice( m_JEndPatchTypeChoice, "J End" ); m_WireLayout.AddYGap(); m_WireLayout.AddDividerBox( "Start/End Skip" ); m_WireLayout.AddIndexSelector( m_ISkipStartIndexSelector, "I Start Skip" ); m_WireLayout.AddIndexSelector( m_ISkipEndIndexSelector, "I End Skip" ); m_WireLayout.AddIndexSelector( m_JSkipStartIndexSelector, "J Start Skip" ); m_WireLayout.AddIndexSelector( m_JSkipEndIndexSelector, "J End Skip" ); m_WireLayout.AddYGap(); m_WireLayout.AddDividerBox( "Stride" ); m_WireLayout.AddIndexSelector( m_IStrideIndexSelector, "I Stride" ); m_WireLayout.AddIndexSelector( m_JStrideIndexSelector, "J Stride" ); }
void tcOptionsView::UpdateButtonInfo() { std::string activeTab(GetTab()); if (activeTab == lastTab) return; // no update required lastTab = activeTab; std::vector<tcOptions::OptionInfo>& optionList = mpOptions->maOptionInfo; buttonInfo.clear(); int ypos = mnYStart; for (size_t i=0; i<optionList.size(); i++) { int xpos = mnXStart; if (optionList[i].group == activeTab.c_str()) { if (optionList[i].associatedFloat == 0) { for (size_t j=0; j<optionList[i].mzCaption.size(); j++) { tsButtonInfo info; info.optionIdx = i; info.valueIdx = j; info.isSlider = false; wxString& sText = optionList[i].mzCaption[j]; wxSize rstring; MeasureText(defaultFont.get(), fontSize, sText.c_str(), rstring); info.textX = xpos; info.textY = ypos; xpos += (int)(rstring.GetWidth()) + 5; info.buttonX = xpos; info.buttonY = ypos-mnButtonHeight/2; buttonInfo.push_back(info); xpos += 3*mnButtonWidth; } } else // slider for float value adjustment { tsButtonInfo info; info.optionIdx = i; info.valueIdx = 0; info.isSlider = true; wxString& sText = optionList[i].mzCaption[0]; wxSize rstring; MeasureText(defaultFont.get(), fontSize, sText.c_str(), rstring); info.textX = xpos; info.textY = ypos; xpos += (int)(rstring.GetWidth()) + 5; info.buttonX = xpos; info.buttonY = ypos; buttonInfo.push_back(info); } ypos -= 5*(mnButtonHeight >> 1); // 2.5x } } }
void tcOptionsView::Draw() { static unsigned int drawCount = 0; std::string activeTab = GetTab(); StartDraw(); wxASSERT(mpOptions); UpdateButtonInfo(); std::vector<tcOptions::OptionInfo>& optionList = mpOptions->maOptionInfo; for(size_t k=0; k<buttonInfo.size(); k++) { if (!buttonInfo[k].isSlider) { int optionIdx = buttonInfo[k].optionIdx; int valueIdx = buttonInfo[k].valueIdx; tcString sText = optionList[optionIdx].mzCaption[valueIdx]; float x = (float)buttonInfo[k].textX; float y = (float)buttonInfo[k].textY; DrawText(sText.c_str(), x, y, defaultFont.get(), Vec4(0.86f, 0.86f, 1.0f, 1.0f), fontSize, LEFT_CENTER); if (optionList[optionIdx].mnValue == valueIdx) { DrawButton(buttonInfo[k].buttonX, buttonInfo[k].buttonY, 1); } else { DrawButton(buttonInfo[k].buttonX, buttonInfo[k].buttonY, 0); } } else { int optionIdx = buttonInfo[k].optionIdx; tcString sText = optionList[optionIdx].mzCaption[0]; bool thisSliderActive = sliderDragActive && (sliderIdx == k); float sliderVal = thisSliderActive ? sliderDragValue : optionList[optionIdx].floatVal; float sliderMin = optionList[optionIdx].floatMin; float sliderMax = optionList[optionIdx].floatMax; float sliderFraction = (sliderVal - sliderMin) / (sliderMax - sliderMin); float xText = (float)buttonInfo[k].textX; float yText = (float)buttonInfo[k].textY; float xBar = (float)buttonInfo[k].buttonX; float yBar = (float)buttonInfo[k].buttonY; DrawText(sText.c_str(), xText, yText, defaultFont.get(), Vec4(0.86f, 0.86f, 1.0f, 1.0f), fontSize, LEFT_CENTER); float xThumb = xBar + sliderFraction*sliderBarWidth; tcRect thumbRect(xThumb-2.0f, xThumb+2.0f, yBar-8.0f, yBar+8.0f); buttonInfo[k].thumbRect = thumbRect; // draw slider here DrawSlider(xBar, yBar, thumbRect, sliderVal, thisSliderActive); } } FinishDraw(); }
//--------------------------------------------------------------------------- wxWindow* wxTabbedWindow::GetActiveTab() { // FIMXE:: this is lame return GetTab( mActiveTab ); }