//------------------------------------------------------------------------------ void CGUIWgtScrollPanel::UpdateScrollbars(void) { if( IsOpen()==false) { if( m_pScrollbarVert && m_pScrollbarVert->IsOpen() ) { m_pScrollbarVert->Close(); } if( m_pScrollbarHorz && m_pScrollbarHorz->IsOpen() ) { m_pScrollbarHorz->Close(); } return; } //update Get client area size CGUIRect aScrollClientRect = GetRect(); CGUIWidget* pWidget = GetChild(); while( pWidget ) { aScrollClientRect += pWidget->GetRect(); pWidget = pWidget->GetNextSibling(); } if( m_aScrollClientRect != aScrollClientRect ) { m_aScrollClientRect = aScrollClientRect; // SetRectDirty(); } const CGUISize& rClientClipSize = GetClientClipRect().GetSize(); const CGUISize& rPageSize = GetClientRect().GetSize(); uint32 nVertRange = static_cast<uint32>(rPageSize.m_fHeight>rClientClipSize.GetHeight() ? rPageSize.m_fHeight-rClientClipSize.GetHeight() : 0); uint32 nHorzRange = static_cast<uint32>(rPageSize.m_fWidth>rClientClipSize.GetWidth() ? rPageSize.m_fWidth-rClientClipSize.GetWidth() : 0); // for vertical scrollbar if( m_pScrollbarVert ) { if( m_bForceVertScrollShow ) { if( m_pScrollbarVert->IsOpen()==false ) { m_pScrollbarVert->Open(); //SetRectDirty(); } } else { if( nVertRange > 0 && m_pScrollbarVert->IsOpen()==false) { m_pScrollbarVert->Open(); //SetRectDirty(); } else if( nVertRange == 0 && m_pScrollbarVert->IsOpen() ) { m_pScrollbarVert->Close(); //SetRectDirty(); } } nVertRange = static_cast<uint32>( GetClientRect().GetHeight()>GetClientClipRect().GetHeight() ? GetClientRect().GetHeight()-GetClientClipRect().GetHeight() : 0); m_pScrollbarVert->SetRange(nVertRange); m_pScrollbarVert->SetPageSize(static_cast<uint32>(GetClientClipRect().GetHeight())); } // for horizontal scrollbar if( m_pScrollbarHorz ) { if( m_bForceHorzScrollShow ) { if( m_pScrollbarHorz->IsOpen()==false ) { m_pScrollbarHorz->Open(); //SetRectDirty(); } } else { if( nHorzRange > 0 && m_pScrollbarHorz->IsOpen()==false ) { m_pScrollbarHorz->Open(); //SetRectDirty(); } else if( nHorzRange == 0 && m_pScrollbarHorz->IsOpen() ) { m_pScrollbarHorz->Close(); //SetRectDirty(); } } nHorzRange = static_cast<uint32>( GetClientRect().GetWidth()>GetClientClipRect().GetWidth() ? GetClientRect().GetWidth()-GetClientClipRect().GetWidth() : 0 ); m_pScrollbarHorz->SetRange(nHorzRange); m_pScrollbarHorz->SetPageSize(static_cast<uint32>(GetClientClipRect().GetWidth())); } }
Viewport* GetViewport() { return Viewport::Cast(GetChild(0)); }
void wxsContainer::AddChildrenCode() { switch ( GetLanguage() ) { case wxsCPP: { wxsCoderContext* Context = GetCoderContext(); if ( !Context ) return; // Update parent in context and clear flRoot flag wxString PreviousParent = Context->m_WindowParent; Context->m_WindowParent = Codef(Context,_T("%O")); for ( int i=0; i<GetChildCount(); i++ ) { wxsItem* Child = GetChild(i); Child->BuildCode(Context); if ( Child->GetType() == wxsTSizer ) { // TODO: Is this right place to set-up sizer ? Codef(_T("%ASetSizer(%o);\n"),i); } } if ( IsRootItem() ) { // Adding all tools before calling Fit and SetSizeHints() wxsItemResData* Data = GetResourceData(); if ( Data ) { for ( int i=0; i<Data->GetToolsCount(); i++ ) { Data->GetTool(i)->BuildCode(Context); } } } for ( int i=0; i<GetChildCount(); i++ ) { wxsItem* Child = GetChild(i); if ( Child->GetType() == wxsTSizer ) { if ( GetBaseProps()->m_Size.IsDefault ) { wxString ChildAccessPrefix = Child->GetAccessPrefix(GetLanguage()); Codef(_T("%sFit(%O);\n"),ChildAccessPrefix.wx_str()); Codef(_T("%sSetSizeHints(%O);\n"),ChildAccessPrefix.wx_str()); } else { wxString ChildVarName = Child->GetVarName(); Codef(_T("SetSizer(%s);\n"), ChildVarName.wx_str()); Codef(_T("Layout();\n")); } } } Context->m_WindowParent = PreviousParent; return; } case wxsUnknownLanguage: default: { wxsCodeMarks::Unknown(_T("wxsContainer::AddChildrenCode"),GetLanguage()); } } }
XMLElement XMLElement::GetChild(const String& name) const { return GetChild(name.CString()); }
ColorValue* GetColor() { return ColorValue::Cast(GetChild(1)); }
void MythUIProgressBar::CalculatePosition(void) { MythUIType *progressType = GetChild("progressimage"); if (!progressType) { LOG(VB_GENERAL, LOG_ERR, "Progress image doesn't exist"); return; } progressType->SetVisible(false); int total = m_total-m_start; int current = m_current-m_start; float percentage = 0.0; if (total <= 0 || current <= 0 || current > total) return; percentage = (float)current / (float)total; progressType->SetVisible(true); QRect fillArea = progressType->GetArea(); int height = fillArea.height(); int width = fillArea.width(); int x = fillArea.x(); int y = fillArea.y(); switch (m_effect) { case EffectReveal : if (m_layout == LayoutHorizontal) { width = (int)((float)fillArea.width() * percentage); } else { height = (int)((float)fillArea.height() * percentage); } break; case EffectSlide : if (m_layout == LayoutHorizontal) { int newwidth = (int)((float)fillArea.width() * percentage); x = width - newwidth; width = newwidth; } else { int newheight = (int)((float)fillArea.height() * percentage); y = height - newheight; height = newheight; } break; case EffectAnimate : // Not implemented yet break; } MythUIImage *progressImage = dynamic_cast<MythUIImage *>(progressType); MythUIShape *progressShape = dynamic_cast<MythUIShape *>(progressType); if (width <= 0) width = 1; if (height <= 0) height = 1; if (progressImage) progressImage->SetCropRect(x,y,width,height); else if (progressShape) progressShape->SetCropRect(x,y,width,height); SetRedraw(); }
inline SearchTreeNode* SearchTreeNode::GetChild(BasicSearchTree* tree,wxChar ch) { nSearchTreeNode child = GetChild(ch); return tree->GetNode(child,true); }
void MythUIEditBar::Display(void) { QRect keeparea = QRect(); QRect cutarea = QRect(); MythUIType *position = GetChild("position"); MythUIType *keep = GetChild("keep"); MythUIType *cut = GetChild("cut"); MythUIType *cuttoleft = GetChild("cuttoleft"); MythUIType *cuttoright = GetChild("cuttoright"); MythUIType *keeptoleft = GetChild("keeptoleft"); MythUIType *keeptoright = GetChild("keeptoright"); if (position) position->SetVisible(false); if (keep) { keep->SetVisible(false); keeparea = keep->GetArea(); } if (cut) { cut->SetVisible(false); cutarea = cut->GetArea(); } if (cuttoleft) cuttoleft->SetVisible(false); if (cuttoright) cuttoright->SetVisible(false); if (keeptoleft) keeptoleft->SetVisible(false); if (keeptoright) keeptoright->SetVisible(false); if (position && keeparea.isValid()) { int offset = position->GetArea().width() / 2; int newx = (int)(((float)keeparea.width() * m_position) + 0.5f); int newy = position->GetArea().top(); position->SetPosition(newx - offset, newy); position->SetVisible(true); } ClearImages(); if (!m_regions.size()) { if (keep) keep->SetVisible(true); return; } MythUIShape *barshape = dynamic_cast<MythUIShape*>(cut); MythUIImage *barimage = dynamic_cast<MythUIImage*>(cut); MythUIShape *leftshape = dynamic_cast<MythUIShape*>(cuttoleft); MythUIImage *leftimage = dynamic_cast<MythUIImage*>(cuttoleft); MythUIShape *rightshape = dynamic_cast<MythUIShape*>(cuttoright); MythUIImage *rightimage = dynamic_cast<MythUIImage*>(cuttoright); QListIterator<QPair<float,float> > regions(m_regions); while (regions.hasNext() && cutarea.isValid()) { QPair<float,float> region = regions.next(); int left = (int)((region.first * cutarea.width()) + 0.5f); int right = (int)((region.second * cutarea.width()) + 0.5f); if (left >= right) right = left + 1; if (cut) { AddBar(barshape, barimage, QRect(left, cutarea.top(), right - left, cutarea.height())); } if (cuttoleft && (region.second < 1.0f)) AddMark(leftshape, leftimage, right, true); if (cuttoright && (region.first > 0.0f)) AddMark(rightshape, rightimage, left, false); } CalcInverseRegions(); barshape = dynamic_cast<MythUIShape*>(keep); barimage = dynamic_cast<MythUIImage*>(keep); leftshape = dynamic_cast<MythUIShape*>(keeptoleft); leftimage = dynamic_cast<MythUIImage*>(keeptoleft); rightshape = dynamic_cast<MythUIShape*>(keeptoright); rightimage = dynamic_cast<MythUIImage*>(keeptoright); QListIterator<QPair<float,float> > regions2(m_invregions); while (regions2.hasNext() && keeparea.isValid()) { QPair<float,float> region = regions2.next(); int left = (int)((region.first * keeparea.width()) + 0.5f); int right = (int)((region.second * keeparea.width()) + 0.5f); if (left >= right) right = left + 1; if (keep) { AddBar(barshape, barimage, QRect(left, keeparea.top(), right - left, keeparea.height())); } if (keeptoleft && (region.second < 1.0f)) AddMark(leftshape, leftimage, right, true); if (keeptoright && (region.first > 0.0f)) AddMark(rightshape, rightimage, left, false); } if (position) position->MoveToTop(); }
// Return: false if deleted bool CItem::StartRefresh() { ASSERT(GetType() != IT_FREESPACE); ASSERT(GetType() != IT_UNKNOWN); m_ticksWorked = 0; // Special case IT_MYCOMPUTER if (GetType() == IT_MYCOMPUTER) { ZeroMemory(&m_lastChange, sizeof(m_lastChange)); for (int i=0; i < GetChildrenCount(); i++) GetChild(i)->StartRefresh(); return true; } ASSERT(GetType() == IT_FILE || GetType() == IT_DRIVE || GetType() == IT_DIRECTORY || GetType() == IT_FILESFOLDER); bool wasExpanded = IsVisible() && IsExpanded(); int oldScrollPosition = 0; if (IsVisible()) oldScrollPosition = GetScrollPosition(); UncacheImage(); // Upward clear data UpdateLastChange(); UpwardSetUndone(); UpwardAddReadJobs(-GetReadJobs()); ASSERT(GetReadJobs() == 0); if (GetType() == IT_FILE) GetParent()->UpwardAddFiles(-1); else UpwardAddFiles(-GetFilesCount()); ASSERT(GetFilesCount() == 0); if (GetType() == IT_DIRECTORY || GetType() == IT_DRIVE) UpwardAddSubdirs(-GetSubdirsCount()); ASSERT(GetSubdirsCount() == 0); UpwardAddSize(-GetSize()); ASSERT(GetSize() == 0); RemoveAllChildren(); UpwardRecalcLastChange(); // Special case IT_FILESFOLDER if (GetType() == IT_FILESFOLDER) { CFileFindWDS finder; BOOL b = finder.FindFile(GetFindPattern()); while (b) { b = finder.FindNextFile(); if (finder.IsDirectory()) continue; FILEINFO fi; fi.name = finder.GetFileName(); fi.attributes = finder.GetAttributes(); // Retrieve file size fi.length = finder.GetCompressedLength(); finder.GetLastWriteTime(&fi.lastWriteTime); AddFile(fi); UpwardAddFiles(1); } SetDone(); if (wasExpanded) GetTreeListControl()->ExpandItem(this); return true; } ASSERT(GetType() == IT_FILE || GetType() == IT_DRIVE || GetType() == IT_DIRECTORY); // The item may have been deleted. bool deleted = false; if (GetType() == IT_DRIVE) deleted = !DriveExists(GetPath()); else if (GetType() == IT_FILE) deleted = !FileExists(GetPath()); else if (GetType() == IT_DIRECTORY) deleted = !FolderExists(GetPath()); if (deleted) { if (GetParent() == NULL) { GetDocument()->UnlinkRoot(); } else { GetParent()->UpwardRecalcLastChange(); GetParent()->RemoveChild(GetParent()->FindChildIndex(this)); // --> delete this } return false; } // Case IT_FILE if (GetType() == IT_FILE) { CFileFindWDS finder; BOOL b = finder.FindFile(GetPath()); if (b) { finder.FindNextFile(); if (!finder.IsDirectory()) { FILEINFO fi; fi.name = finder.GetFileName(); fi.attributes = finder.GetAttributes(); // Retrieve file size fi.length = finder.GetCompressedLength(); finder.GetLastWriteTime(&fi.lastWriteTime); SetLastChange(fi.lastWriteTime); UpwardAddSize(fi.length); UpwardUpdateLastChange(GetLastChange()); GetParent()->UpwardAddFiles(1); } } SetDone(); return true; } ASSERT(GetType() == IT_DRIVE || GetType() == IT_DIRECTORY); if (GetType() == IT_DIRECTORY && !IsRootItem() && GetApp()->IsMountPoint(GetPath()) && !GetOptions()->IsFollowMountPoints()) return true; if (GetType() == IT_DIRECTORY && !IsRootItem() && GetApp()->IsJunctionPoint(GetPath()) && !GetOptions()->IsFollowJunctionPoints()) return true; // Initiate re-read SetReadJobDone(false); // Re-create <free space> and <unknown> if (GetType() == IT_DRIVE) { if (GetDocument()->OptionShowFreeSpace()) CreateFreeSpaceItem(); if (GetDocument()->OptionShowUnknown()) CreateUnknownItem(); } DoSomeWork(0); if (wasExpanded) GetTreeListControl()->ExpandItem(this); if (IsVisible()) SetScrollPosition(oldScrollPosition); return true; }
void Button::ClearImage() { if( GetChild() ) { Remove( GetChild() ); } }
/** * \copydoc MythUIType::Finalize() */ void MythUIEditBar::Finalize(void) { MythUIType *position = GetChild("position"); if (position) position->MoveToTop(); }
const Image::Ptr Button::GetImage() const { return std::static_pointer_cast<Image>( GetChild() ); }
wxObject* wxsDialog::OnBuildPreview(wxWindow* Parent,long Flags) { wxWindow* NewItem = 0; wxDialog* Dlg = 0; // In case of frame and dialog when in "Exact" mode, we do not create // new object, but use Parent and call Create for it. if ( Flags & pfExact ) { Dlg = wxDynamicCast(Parent,wxDialog); if ( Dlg ) { Dlg->Create(0,GetId(),Title,wxDefaultPosition,wxDefaultSize,Style()); Dlg->SetClientSize(Size(wxTheApp->GetTopWindow())); Dlg->Move(Pos(wxTheApp->GetTopWindow())); } NewItem = Dlg; SetupWindow(NewItem,Flags); AddChildrenPreview(NewItem,Flags); if ( Centered ) { Dlg->Centre(); } } else { NewItem = new wxsGridPanel(Parent,GetId(),wxPoint(0,0),Size(Parent),0); NewItem->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); SetupWindow(NewItem,Flags); AddChildrenPreview(NewItem,Flags); // wxPanel tends to behave very strange when it has children and no sizer, // we have to manually resize it's content if ( !GetChildCount() || GetChild(0)->GetType()!=wxsTSizer ) { wxSize NewSize = Size(Parent); if ( !NewSize.IsFullySpecified() ) { NewSize.SetDefaults(wxSize(400,450)); NewItem->SetSize(NewSize); #if wxCHECK_VERSION(2,8,0) NewItem->SetInitialSize(NewSize); #else NewItem->SetBestFittingSize(NewSize); #endif if ( GetChildCount() == 1 ) { // If there's only one child it's size gets dialog's size wxWindow* ChildPreview = wxDynamicCast(GetChild(0)->GetLastPreview(),wxWindow); if ( ChildPreview ) { ChildPreview->SetSize(0,0,NewItem->GetClientSize().GetWidth(),NewItem->GetClientSize().GetHeight()); } } } else { NewItem->SetSize(NewSize); #if wxCHECK_VERSION(2,8,0) NewItem->SetInitialSize(NewSize); #else NewItem->SetBestFittingSize(NewSize); #endif } } } return NewItem; }
Node* Node::GetChild(const String& name, bool recursive) const { return GetChild(StringHash(name), recursive); }
void wxsMenuItem::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: switch ( m_Type ) { case Normal: { if ( GetChildCount() ) { // Creating new wxMenu if ( IsPointer() ) { Codef(_T("%C();\n")); } for ( int i=0; i<GetChildCount(); i++ ) { GetChild(i)->BuildCode(GetCoderContext()); } // Many parameters are passed in wxMenu::Append, so we call this function // here, not in wxMenu Codef(_T("%MAppend(%I, %t, %O, %t)%s;\n"), m_Label.wx_str(), m_Help.wx_str(), m_Enabled?_T(""):_T("->Enable(false)")); break; } } // Fall through /* case Normal: */ case Radio: case Check: { wxString Text = m_Label; if ( !m_Accelerator.IsEmpty() ) { Text.Append(_T('\t')); Text.Append(m_Accelerator); } const wxChar* ItemType; switch ( m_Type ) { case Normal: ItemType = _T("wxITEM_NORMAL"); break; case Radio: ItemType = _T("wxITEM_RADIO"); break; default: ItemType = _T("wxITEM_CHECK"); break; } Codef(_T("%C(%E, %I, %t, %t, %s);\n"), Text.wx_str(), m_Help.wx_str(), ItemType); if ( !m_Bitmap.IsEmpty() ) { Codef(_T("%ASetBitmap(%i);\n"), &m_Bitmap, _T("wxART_OTHER")); } Codef(_T("%MAppend(%O);\n")); if ( !m_Enabled ) { Codef(_T("%AEnable(false);\n")); } if ( m_Checked && (m_Type==Check) ) { Codef(_T("%ACheck(true);\n")); } break; } case Separator: { Codef(_T("%MAppendSeparator();\n")); break; } case Break: { Codef(_T("%MBreak();\n")); break; } } BuildSetupWindowCode(); break; case wxsUnknownLanguage: // fall-through default: wxsCodeMarks::Unknown(_T("wxsMenuItem::OnBuildCreatingCode"),GetLanguage()); } }
void CItem::DoSomeWork(DWORD ticks) { if (IsDone()) return; StartPacman(true); DriveVisualUpdateDuringWork(); DWORD start = GetTickCount(); if (GetType() == IT_DRIVE || GetType() == IT_DIRECTORY) { if (!IsReadJobDone()) { LONGLONG dirCount = 0; LONGLONG fileCount = 0; CList<FILEINFO, FILEINFO> files; CFileFindWDS finder; BOOL b = finder.FindFile(GetFindPattern()); while (b) { DriveVisualUpdateDuringWork(); b = finder.FindNextFile(); if (finder.IsDots()) continue; if (finder.IsDirectory()) { dirCount++; AddDirectory(finder); } else { fileCount++; FILEINFO fi; fi.name = finder.GetFileName(); fi.attributes = finder.GetAttributes(); // Retrieve file size fi.length = finder.GetCompressedLength(); finder.GetLastWriteTime(&fi.lastWriteTime); // (We don't use GetLastWriteTime(CTime&) here, because, if the file has // an invalid timestamp, that function would ASSERT and throw an Exception.) files.AddTail(fi); } } CItem *filesFolder = 0; if (dirCount > 0 && fileCount > 1) { filesFolder = new CItem(IT_FILESFOLDER, LoadString(IDS_FILES_ITEM)); filesFolder->SetReadJobDone(); AddChild(filesFolder); } else if (fileCount > 0) { filesFolder = this; } for (POSITION pos=files.GetHeadPosition(); pos != NULL; files.GetNext(pos)) { const FILEINFO& fi = files.GetAt(pos); filesFolder->AddFile(fi); } if (filesFolder != NULL) { filesFolder->UpwardAddFiles(fileCount); if (dirCount > 0 && fileCount > 1) filesFolder->SetDone(); } UpwardAddSubdirs(dirCount); SetReadJobDone(); AddTicksWorked(GetTickCount() - start); } if (GetType() == IT_DRIVE) UpdateFreeSpaceItem(); if (GetTickCount() - start > ticks) { StartPacman(false); return; } } if (GetType() == IT_DRIVE || GetType() == IT_DIRECTORY || GetType() == IT_MYCOMPUTER) { ASSERT(IsReadJobDone()); if (IsDone()) { StartPacman(false); return; } if (GetChildrenCount() == 0) { SetDone(); StartPacman(false); return; } DWORD startChildren = GetTickCount(); while (GetTickCount() - start < ticks) { DWORD minticks = UINT_MAX; CItem *minchild = NULL; for (int i=0; i < GetChildrenCount(); i++) { CItem *child = GetChild(i); if (child->IsDone()) continue; if (child->GetTicksWorked() < minticks) { minticks = child->GetTicksWorked(); minchild = child; } } if (minchild == NULL) { SetDone(); break; } DWORD tickssofar = GetTickCount() - start; if (ticks > tickssofar) minchild->DoSomeWork(ticks - tickssofar); } AddTicksWorked(GetTickCount() - startChildren); } else { SetDone(); } StartPacman(false); }
void CHudChatFilterPanel::SetVisible(bool state) { if ( state == true ) { for (int i = 0; i < GetChildCount(); i++) { CHudChatFilterCheckButton *pButton = dynamic_cast < CHudChatFilterCheckButton * > ( GetChild(i) ); if ( pButton ) { if ( cl_chatfilters.GetInt() & pButton->GetFilterFlag() ) { pButton->SetSelected( true ); } else { pButton->SetSelected( false ); } } } } BaseClass::SetVisible( state ); }
void MythUITextEdit::SetInitialStates() { if (m_initialized) return; m_initialized = true; m_Text = dynamic_cast<MythUIText *>(GetChild("text")); m_cursorImage = dynamic_cast<MythUIImage *>(GetChild("cursor")); m_backgroundState = dynamic_cast<MythUIStateType *>(GetChild("background")); if (!m_Text) LOG(VB_GENERAL, LOG_ERR, LOC + "Missing text element."); if (!m_cursorImage) LOG(VB_GENERAL, LOG_ERR, LOC + "Missing cursor element."); if (!m_backgroundState) LOG(VB_GENERAL, LOG_WARNING, LOC + "Missing background element."); if (!m_Text || !m_cursorImage) { m_Text = NULL; m_cursorImage = NULL; m_backgroundState = NULL; return; } if (m_backgroundState && !m_backgroundState->DisplayState("active")) LOG(VB_GENERAL, LOG_ERR, LOC + "active state doesn't exist"); QFontMetrics fm(m_Text->GetFontProperties()->face()); int height = fm.height(); if (height > 0) { MythRect imageArea = m_cursorImage->GetArea(); int width = int(((float)height / (float)imageArea.height()) * (float)imageArea.width()); if (width <= 0) width = 1; m_cursorImage->ForceSize(QSize(width, height)); } MythRect textrect = m_Text->GetArea(); if (textrect.isNull()) textrect = MythRect(5, 5, m_Area.width() - 10, m_Area.height() - 10); textrect.setWidth(textrect.width() - m_cursorImage->GetArea().width()); if (textrect.isValid()) m_Text->SetArea(textrect); m_Text->SetCutDown(false); m_cursorImage->SetPosition(textrect.x(), textrect.y()); }
/*---------------------------------------------------------------------- | AP4_MoovAtom::AP4_MoovAtom +---------------------------------------------------------------------*/ AP4_MoovAtom::AP4_MoovAtom(AP4_Size size, AP4_ByteStream& stream, AP4_AtomFactory& atom_factory) : AP4_ContainerAtom(AP4_ATOM_TYPE_MOOV, size, false, stream, atom_factory), m_TimeScale(0) { if(AP4_ContainerAtom* cmov = dynamic_cast<AP4_ContainerAtom*>(GetChild(AP4_ATOM_TYPE_CMOV))) { AP4_DcomAtom* dcom = dynamic_cast<AP4_DcomAtom*>(cmov->GetChild(AP4_ATOM_TYPE_DCOM)); AP4_CmvdAtom* cmvd = dynamic_cast<AP4_CmvdAtom*>(cmov->GetChild(AP4_ATOM_TYPE_CMVD)); if(dcom && dcom->GetCompressorSubType() == AP4_ATOM_TYPE('z','l','i','b') && cmvd) { const AP4_DataBuffer& data = cmvd->GetDataBuffer(); z_stream d_stream; d_stream.zalloc = (alloc_func)0; d_stream.zfree = (free_func)0; d_stream.opaque = (voidpf)0; int res; if(Z_OK == (res = inflateInit(&d_stream))) { d_stream.next_in = (Bytef*)data.GetData(); d_stream.avail_in = data.GetDataSize(); unsigned char* dst = NULL; int n = 0; do { dst = (unsigned char*)realloc(dst, ++n*1000); d_stream.next_out = &dst[(n-1)*1000]; d_stream.avail_out = 1000; if(Z_OK != (res = inflate(&d_stream, Z_NO_FLUSH)) && Z_STREAM_END != res) { free(dst); dst = NULL; break; } } while(0 == d_stream.avail_out && 0 != d_stream.avail_in && Z_STREAM_END != res); inflateEnd(&d_stream); if(dst) { AP4_ByteStream* s = new AP4_MemoryByteStream(dst, d_stream.total_out); ReadChildren(atom_factory, *s, d_stream.total_out); s->Release(); free(dst); } if(AP4_MoovAtom* moov = dynamic_cast<AP4_MoovAtom*>(GetChild(AP4_ATOM_TYPE_MOOV))) { AP4_List<AP4_Atom> Children; for(AP4_List<AP4_Atom>::Item* item = moov->GetChildren().FirstItem(); item; item = item->GetNext()) { Children.Add(item->GetData()); } for(AP4_List<AP4_Atom>::Item* item = Children.FirstItem(); item; item = item->GetNext()) { AP4_Atom* atom = item->GetData(); atom->Detach(); atom->SetParent(this); m_Children.Add(atom); } moov->Detach(); delete moov; } } } } // collect all trak atoms m_Children.Apply(AP4_TrakAtomCollector(&m_TrakAtoms)); }
//======================================================== // Name : GetChildValue // Desc : Find child with name and return child's value // Param : // Return : NULL return if no child. //-------------------------------------------------------- // Coder Date Desc // bro 2002-10-29 //======================================================== LPCTSTR _tagXMLNode::GetChildValue( LPCTSTR name ) { LPXNode node = GetChild( name ); return (node != NULL)? (LPCTSTR)node->value : NULL; }
void ZMLivePlayer::setMonitorLayout(int layout, bool restore) { QStringList monList = gCoreContext->GetSetting("ZoneMinderLiveCameras", "").split(","); m_monitorLayout = layout; if (m_players) { stopPlayers(); delete m_players; } m_players = new vector<Player *>; m_monitorCount = 1; if (layout == 1) m_monitorCount = 1; else if (layout == 2) m_monitorCount = 2; else if (layout == 3) m_monitorCount = 4; else if (layout == 4) m_monitorCount = 6; else if (layout == 5) m_monitorCount = 8; hideAll(); uint monitorNo = 1; for (int x = 1; x <= m_monitorCount; x++) { Monitor *monitor = NULL; if (restore) { if (x <= (int) monList.size()) { QString s = monList.at(x - 1); int monID = s.toInt(); // try to find a monitor that matches the monID vector<Monitor*>::iterator i = m_monitors->begin(); for (; i != m_monitors->end(); ++i) { if ((*i)->id == monID) { monitor = *i; break; } } } } if (!monitor) monitor = m_monitors->at(monitorNo - 1); MythUIImage *frameImage = dynamic_cast<MythUIImage *> (GetChild(QString("frame%1-%2").arg(layout).arg(x))); MythUIText *cameraText = dynamic_cast<MythUIText *> (GetChild(QString("name%1-%2").arg(layout).arg(x))); MythUIText *statusText = dynamic_cast<MythUIText *> (GetChild(QString("status%1-%2").arg(layout).arg(x))); Player *p = new Player(); p->setMonitor(monitor); p->setWidgets(frameImage, statusText, cameraText); p->updateCamera(); m_players->push_back(p); monitorNo++; if (monitorNo > m_monitors->size()) monitorNo = 1; } updateFrame(); }
HM::String _tagXMLNode::GetChildText( LPCTSTR name, LPDISP_OPT opt /*= &optDefault*/ ) { LPXNode node = GetChild( name ); return (node != NULL)? node->GetText(opt) : _T(""); }
bool GeneralSetupWizard::Create() { bool foundtheme = false; // Load the theme for this screen foundtheme = LoadWindowFromXML("config-ui.xml", "generalwizard", this); if (!foundtheme) return false; m_submitButton = dynamic_cast<MythUIButton *> (GetChild("submit")); m_viewButton = dynamic_cast<MythUIButton *> (GetChild("view")); m_deleteButton = dynamic_cast<MythUIButton *> (GetChild("delete")); m_nextButton = dynamic_cast<MythUIButton *> (GetChild("next")); m_cancelButton = dynamic_cast<MythUIButton *> (GetChild("cancel")); m_profileLocation = dynamic_cast<MythUIText *> (GetChild("profiletext")); m_adminPassword = dynamic_cast<MythUIText *> (GetChild("profilepassword")); if (!m_submitButton || !m_viewButton || !m_deleteButton || !m_nextButton || !m_cancelButton) { LOG(VB_GENERAL, LOG_ERR, "Theme is missing critical theme elements."); return false; } m_submitButton->SetHelpText( tr("Anonymously submit a profile of your hardware. " "This helps the developers to determine where " "to focus their efforts.") ); m_viewButton->SetHelpText( tr("Visit your online hardware profile. (This requires " "that you have the MythBrowser plugin installed)") ); m_deleteButton->SetHelpText( tr("Delete your online hardware profile.") ); m_nextButton->SetHelpText( tr("Save these changes and move on to the " "next configuration step.") ); m_cancelButton->SetHelpText( tr("Exit this wizard, save no changes.") ); connect(m_submitButton, SIGNAL(Clicked()), this, SLOT(slotSubmit())); connect(m_viewButton, SIGNAL(Clicked()), this, SLOT(slotView())); connect(m_deleteButton, SIGNAL(Clicked()), this, SLOT(slotDelete())); connect(m_nextButton, SIGNAL(Clicked()), this, SLOT(slotNext())); connect(m_cancelButton, SIGNAL(Clicked()), this, SLOT(Close())); BuildFocusList(); loadData(); #ifndef __linux__ #ifndef CONFIG_BINDINGS_PYTHON // The hardware profiler only works on linux. // Make the widgets invisible on other platforms. m_submitButton->Hide(); m_viewButton->Hide(); m_deleteButton->Hide(); if (m_profileLocation) m_profileLocation->Hide(); if (m_adminPassword) m_adminPassword->Hide(); #endif #endif return true; }
LPXAttr _tagXMLNode::GetChildAttr( LPCTSTR name, LPCTSTR attrname ) { LPXNode node = GetChild(name); return node ? node->GetAttr(attrname) : NULL; }
Number* GetTime() { return Number::Cast(GetChild(0)); }
wxObject* wxsGridBagSizer::OnBuildPreview(wxWindow* Parent,long Flags) { wxWindow* NewParent = Parent; if ( !(Flags & pfExact) ) { NewParent = new wxsSizerPreview(Parent); } wxGridBagSizer* Sizer = OnBuildSizerPreview(NewParent); int Count = GetChildCount(); for ( int i=0; i<Count; i++ ) { wxsItem* Child = GetChild(i); wxsGridBagSizerExtra* Extra = (wxsGridBagSizerExtra*)GetChildExtra(i); // Reset span in case of wrong values if (Extra->colspan < 1) Extra->colspan = 1; if (Extra->rowspan < 1) Extra->rowspan = 1; // How many rows / cols ? int nbRows = 0; int nbCols = 0; for (int j = 0 ; j < Count ; j++) { wxsGridBagSizerExtra* ExtraRows = (wxsGridBagSizerExtra*)GetChildExtra(j); if (nbRows < ExtraRows->row + ExtraRows->rowspan) nbRows = ExtraRows->row + ExtraRows->rowspan; if (nbCols < ExtraRows->col + ExtraRows->colspan) nbCols = ExtraRows->col + ExtraRows->colspan; } // Set the position in the sizer in case of wrong values if (Extra->col < 0 && Extra->row < 0) { Extra->col = 0; Extra->row = nbRows; } if (Extra->col < 0) Extra->col = nbCols; if (Extra->row < 0) Extra->row = nbRows; // We pass either Parent passed to current BuildPreview function // or pointer to additional parent currently created wxObject* ChildPreview = Child->BuildPreview(NewParent,Flags); if ( !ChildPreview ) continue; wxSizer* ChildAsSizer = wxDynamicCast(ChildPreview,wxSizer); wxWindow* ChildAsWindow = wxDynamicCast(ChildPreview,wxWindow); wxGBSizerItem* ChildAsItem = wxDynamicCast(ChildPreview,wxGBSizerItem); if ( ChildAsSizer ) { Sizer->Add(ChildAsSizer, wxGBPosition(Extra->row, Extra->col), wxGBSpan(Extra->rowspan, Extra->colspan), wxsSizerFlagsProperty::GetWxFlags(Extra->Flags), Extra->Border.GetPixels(Parent)); } else if ( ChildAsWindow ) { Sizer->Add(ChildAsWindow, wxGBPosition(Extra->row, Extra->col), wxGBSpan(Extra->rowspan, Extra->colspan), wxsSizerFlagsProperty::GetWxFlags(Extra->Flags), Extra->Border.GetPixels(Parent)); } else if ( ChildAsItem ) { ChildAsItem->SetProportion(Extra->Proportion); ChildAsItem->SetFlag(wxsSizerFlagsProperty::GetWxFlags(Extra->Flags)); ChildAsItem->SetBorder(Extra->Border.GetPixels(Parent)); ChildAsItem->SetSpan(wxGBSpan(Extra->rowspan, Extra->colspan)); ChildAsItem->SetPos(wxGBPosition(Extra->row, Extra->col)); Sizer->Add(ChildAsItem); } } if ( !(Flags & pfExact) ) { NewParent->SetSizer(Sizer); if ( !GetChildCount() ) { // Setting custom size for childless sizer to prevent // zero-size items #if wxCHECK_VERSION(2,8,0) NewParent->SetInitialSize(wxSize(20,20)); #else NewParent->SetBestFittingSize(wxSize(20,20)); #endif NewParent->SetSizeHints(20,20); NewParent->SetSize(wxSize(20,20)); } else { Sizer->Fit(NewParent); Sizer->SetSizeHints(NewParent); } return NewParent; } return Sizer; }
bool AudioSetupWizard::Create() { bool foundtheme = false; // Load the theme for this screen foundtheme = LoadWindowFromXML("config-ui.xml", "audiowizard", this); if (!foundtheme) return false; m_audioDeviceButtonList = dynamic_cast<MythUIButtonList *> (GetChild("audiodevices")); m_speakerNumberButtonList = dynamic_cast<MythUIButtonList *> (GetChild("speakers")); m_dtsCheck = dynamic_cast<MythUICheckBox *> (GetChild("dtscheck")); m_ac3Check = dynamic_cast<MythUICheckBox *> (GetChild("ac3check")); m_eac3Check = dynamic_cast<MythUICheckBox *> (GetChild("eac3check")); m_truehdCheck = dynamic_cast<MythUICheckBox *> (GetChild("truehdcheck")); m_dtshdCheck = dynamic_cast<MythUICheckBox *> (GetChild("dtshdcheck")); m_testSpeakerButton = dynamic_cast<MythUIButton *> (GetChild("testspeakers")); m_nextButton = dynamic_cast<MythUIButton *> (GetChild("next")); m_prevButton = dynamic_cast<MythUIButton *> (GetChild("previous")); if (!m_audioDeviceButtonList || !m_speakerNumberButtonList || !m_dtsCheck || !m_ac3Check || !m_eac3Check || !m_truehdCheck || !m_dtshdCheck || !m_testSpeakerButton || !m_nextButton || !m_prevButton) { LOG(VB_GENERAL, LOG_ERR, "Theme is missing critical theme elements."); return false; } // Pre-set the widgets to their database values // Buttonlists are set in load() int dtsSetting = gCoreContext->GetNumSetting("DTSPassThru", 0); if (dtsSetting == 1) m_dtsCheck->SetCheckState(MythUIStateType::Full); int ac3Setting = gCoreContext->GetNumSetting("AC3PassThru", 0); if (ac3Setting == 1) m_ac3Check->SetCheckState(MythUIStateType::Full); int eac3Setting = gCoreContext->GetNumSetting("EAC3PassThru", 0); if (eac3Setting == 1) m_eac3Check->SetCheckState(MythUIStateType::Full); int truehdSetting = gCoreContext->GetNumSetting("TrueHDPassThru", 0); if (truehdSetting == 1) m_truehdCheck->SetCheckState(MythUIStateType::Full); int dtshdSetting = gCoreContext->GetNumSetting("DTSHDPassThru", 0); if (dtshdSetting == 1) m_dtshdCheck->SetCheckState(MythUIStateType::Full); // Help Text // Buttonlists m_audioDeviceButtonList->SetHelpText( tr("Select from one of the " "audio devices detected on your system. When " "satisfied, you can test audio before moving " "on. If you fail to configure audio, video " "playback may fail as well.") ); m_speakerNumberButtonList->SetHelpText( tr("Select the number of speakers you " "have.") ); // Checkboxes m_dtsCheck->SetHelpText( tr("Select this checkbox if your receiver " "is capable of playing DTS.") ); m_ac3Check->SetHelpText( tr("Select this checkbox if your receiver " "is capable of playing AC-3 (Dolby Digital).") ); m_eac3Check->SetHelpText( tr("Select this checkbox if your receiver " "is capable of playing E-AC-3 (Dolby Digital Plus).") ); m_truehdCheck->SetHelpText( tr("Select this checkbox if your receiver " "is capable of playing TrueHD.") ); m_dtshdCheck->SetHelpText( tr("Select this checkbox if your receiver " "is capable of playing DTS-HD.") ); // Buttons m_testSpeakerButton->SetHelpText( tr("Test your audio settings by playing " "noise through each speaker.") ); m_nextButton->SetHelpText( tr("Save these changes and move on to the next " "configuration step.") ); m_prevButton->SetHelpText( tr("Return to the previous configuration step.") ); // I hate to SetText but it's the only way to make it reliably bi-modal m_testSpeakerButton->SetText(tr("Test Speakers")); connect(m_testSpeakerButton, SIGNAL(Clicked()), this, SLOT(toggleSpeakers())); connect(m_nextButton, SIGNAL(Clicked()), this, SLOT(slotNext())); connect(m_prevButton, SIGNAL(Clicked()), this, SLOT(slotPrevious())); QString message = tr("Discovering audio devices..."); LoadInBackground(message); BuildFocusList(); return true; }
void ZMLivePlayer::setMonitorLayout(int layout, bool restore) { QStringList monList; if (m_alarmMonitor != -1) monList.append(QString::number(m_alarmMonitor)); else monList = gCoreContext->GetSetting("ZoneMinderLiveCameras", "").split(","); m_monitorLayout = layout; if (m_players) { stopPlayers(); delete m_players; } m_players = new vector<Player *>; m_monitorCount = 1; if (layout == 1) m_monitorCount = 1; else if (layout == 2) m_monitorCount = 2; else if (layout == 3) m_monitorCount = 4; else if (layout == 4) m_monitorCount = 6; else if (layout == 5) m_monitorCount = 8; hideAll(); int monitorNo = 1; for (int x = 1; x <= m_monitorCount; x++) { Monitor *monitor = nullptr; if (restore) { if (x <= (int) monList.size()) { QString s = monList.at(x - 1); int monID = s.toInt(); // try to find a monitor that matches the monID monitor = ZMClient::get()->getMonitorByID(monID); } } if (!monitor) monitor = ZMClient::get()->getMonitorAt(monitorNo - 1); MythUIImage *frameImage = dynamic_cast<MythUIImage *> (GetChild(QString("frame%1-%2").arg(layout).arg(x))); MythUIText *cameraText = dynamic_cast<MythUIText *> (GetChild(QString("name%1-%2").arg(layout).arg(x))); MythUIText *statusText = dynamic_cast<MythUIText *> (GetChild(QString("status%1-%2").arg(layout).arg(x))); Player *p = new Player(); p->setMonitor(monitor); p->setWidgets(frameImage, statusText, cameraText); p->updateCamera(); m_players->push_back(p); monitorNo++; if (monitorNo > ZMClient::get()->getMonitorCount()) monitorNo = 1; } updateFrame(); }
void wxsContainer::AddChildrenPreview(wxWindow* This,long Flags) { for ( int i=0; i<GetChildCount(); i++ ) { wxsItem* Child = GetChild(i); wxObject* ChildPreviewAsObject = Child->BuildPreview(This,Flags); if ( Child->GetType() == wxsTSizer ) { wxSizer* ChildPreviewAsSizer = wxDynamicCast(ChildPreviewAsObject,wxSizer); if ( ChildPreviewAsSizer ) { This->SetSizer(ChildPreviewAsSizer); } } } if ( IsRootItem() ) { // Adding all tools before calling Fit and SetSizeHints() wxsItemResData* Data = GetResourceData(); if ( Data ) { for ( int i=0; i<Data->GetToolsCount(); i++ ) { Data->GetTool(i)->BuildPreview(This,Flags); } } } for ( int i=0; i<GetChildCount(); i++ ) { wxsItem* Child = GetChild(i); if ( Child->GetType() == wxsTSizer ) { wxObject* ChildPreviewAsObject = Child->GetLastPreview(); wxSizer* ChildPreviewAsSizer = wxDynamicCast(ChildPreviewAsObject,wxSizer); wxWindow* ChildPreviewAsWindow = wxDynamicCast(ChildPreviewAsObject,wxWindow); if ( ChildPreviewAsSizer ) { // Child preview was created directly as sizer, we use it to // call Fit() and SetSizeHints() directly if ( GetBaseProps()->m_Size.IsDefault ) { ChildPreviewAsSizer->Fit(This); } ChildPreviewAsSizer->SetSizeHints(This); } else if ( ChildPreviewAsWindow ) { // Preview of sizer is given actually as some kind of panel which paints // some extra data of sizer. So we have to create out own sizer to call // Fit and SetSizeHints wxSizer* IndirectSizer = new wxBoxSizer(wxHORIZONTAL); IndirectSizer->Add(ChildPreviewAsWindow,1,wxEXPAND,0); This->SetSizer(IndirectSizer); if ( GetBaseProps()->m_Size.IsDefault ) { IndirectSizer->Fit(This); } IndirectSizer->SetSizeHints(This); } } } }
int32_t Pid() const override { if (GPUChild* child = GetChild()) { return (int32_t)child->OtherPid(); } return 0; }