| 2057 | } |
| 2058 | |
| 2059 | void TextureViewer::ViewTexture(ResourceId ID, CompType typeCast, bool focus) |
| 2060 | { |
| 2061 | if(QThread::currentThread() != QCoreApplication::instance()->thread()) |
| 2062 | { |
| 2063 | GUIInvoke::call(this, [this, ID, typeCast, focus] { this->ViewTexture(ID, typeCast, focus); }); |
| 2064 | return; |
| 2065 | } |
| 2066 | |
| 2067 | if(typeCast != CompType::Typeless) |
| 2068 | m_TextureSettings[ID].typeCast = typeCast; |
| 2069 | |
| 2070 | if(m_LockedTabs.contains(ID)) |
| 2071 | { |
| 2072 | if(focus) |
| 2073 | ToolWindowManager::raiseToolWindow(this); |
| 2074 | |
| 2075 | QWidget *w = m_LockedTabs[ID]; |
| 2076 | ToolWindowManagerArea *textureTabs = ui->dockarea->areaOf(ui->renderContainer); |
| 2077 | |
| 2078 | int idx = textureTabs->indexOf(w); |
| 2079 | |
| 2080 | if(idx >= 0) |
| 2081 | textureTabs->setCurrentIndex(idx); |
| 2082 | |
| 2083 | INVOKE_MEMFN(RT_UpdateAndDisplay); |
| 2084 | return; |
| 2085 | } |
| 2086 | |
| 2087 | TextureDescription *tex = m_Ctx.GetTexture(ID); |
| 2088 | if(tex) |
| 2089 | { |
| 2090 | QWidget *lockedContainer = new QWidget(this); |
| 2091 | lockedContainer->setWindowTitle(m_Ctx.GetResourceName(ID)); |
| 2092 | lockedContainer->setProperty("id", QVariant::fromValue(ID)); |
| 2093 | |
| 2094 | ToolWindowManagerArea *textureTabs = ui->dockarea->areaOf(ui->renderContainer); |
| 2095 | |
| 2096 | ToolWindowManager::AreaReference ref(ToolWindowManager::AddTo, textureTabs); |
| 2097 | |
| 2098 | ui->dockarea->addToolWindow(lockedContainer, ref); |
| 2099 | ui->dockarea->setToolWindowProperties( |
| 2100 | lockedContainer, |
| 2101 | ToolWindowManager::DisallowUserDocking | ToolWindowManager::AlwaysDisplayFullTabs); |
| 2102 | |
| 2103 | lockedContainer->setLayout(ui->renderLayout); |
| 2104 | |
| 2105 | int idx = textureTabs->indexOf(lockedContainer); |
| 2106 | |
| 2107 | if(idx >= 0) |
| 2108 | textureTabs->setTabIcon(idx, Icons::page_go()); |
| 2109 | else |
| 2110 | qCritical() << "Couldn't get tab index of new tab to set icon"; |
| 2111 | |
| 2112 | // newPanel.DockHandler.TabPageContextMenuStrip = tabContextMenu; |
| 2113 | |
| 2114 | if(focus) |
| 2115 | ToolWindowManager::raiseToolWindow(this); |
| 2116 |
nothing calls this directly
no test coverage detected