void ResizableWindow::parentSizeChanged() { if (isFullScreen() && getParentComponent() != nullptr) setBounds (getParentComponent()->getLocalBounds()); }
//============================================================================== String ResizableWindow::getWindowStateAsString() { updateLastPosIfShowing(); return (isFullScreen() && ! isKioskMode() ? "fs " : "") + lastNonFullScreenPos.toString(); }
const BorderSize DocumentWindow::getBorderThickness() { return BorderSize ((isFullScreen() || isUsingNativeTitleBar()) ? 0 : (resizableBorder != 0 ? 4 : 1)); }
void ResizableWindow::updateLastPosIfNotFullScreen() { if (! (isFullScreen() || isMinimised() || isKioskMode())) lastNonFullScreenPos = getBounds(); }
void DocumentWindow::maximiseButtonPressed() { setFullScreen (! isFullScreen()); }
void VideoWidget::mouseDoubleClickEvent(QMouseEvent *event) { setFullScreen(!isFullScreen()); event->accept(); }
void Ui::AspectRatioResizebleWnd::_applyFrameAspectRatio(float was_ar) { if (_use_aspect && _aspect_ratio > 0.001f && _self_resize_effect && !isFullScreen()) { const QRect rc = rect(); const QPoint p = mapToGlobal(rc.topLeft()); QRect end_rc; if (was_ar > 0.001f && fabs((1.0f / _aspect_ratio) - was_ar) < 0.0001f) { end_rc = QRect(p.x(), p.y(), rc.height(), rc.width()); } else { end_rc = QRect(p.x(), p.y(), rc.width(), rc.width() / _aspect_ratio); } const QSize minimum_size = minimumSize(); if (end_rc.width() < minimum_size.width()) { const int w = minimum_size.width(); const int h = w / _aspect_ratio; end_rc.setRight(end_rc.left() + w); end_rc.setBottom(end_rc.top() + h); } if (end_rc.height() < minimum_size.height()) { const int h = minimum_size.height(); const int w = h * _aspect_ratio; end_rc.setRight(end_rc.left() + w); end_rc.setBottom(end_rc.top() + h); } QDesktopWidget dw; const auto screen_rect = dw.availableGeometry(dw.primaryScreen()); if (end_rc.right() > screen_rect.right()) { const int w = end_rc.width(); end_rc.setRight(screen_rect.right()); end_rc.setLeft(end_rc.right() - w); } if (end_rc.bottom() > screen_rect.bottom()) { const int h = end_rc.height(); end_rc.setBottom(screen_rect.bottom()); end_rc.setTop(end_rc.bottom() - h); } if (screen_rect.width() < end_rc.width()) { end_rc.setLeft(screen_rect.left()); end_rc.setRight(screen_rect.right()); const int h = end_rc.width() / _aspect_ratio; end_rc.setTop(end_rc.bottom() - h); } if (screen_rect.height() < end_rc.height()) { end_rc.setTop(screen_rect.top()); end_rc.setBottom(screen_rect.bottom()); const int w = end_rc.height() * _aspect_ratio; end_rc.setLeft(end_rc.right() - w); } if (_first_time_use_aspect_ratio) { { const int best_w = 0.6f * screen_rect.width(); if (end_rc.width() > best_w) { const int best_h = best_w / _aspect_ratio; end_rc.setLeft((screen_rect.x() + screen_rect.width() - best_w) / 2); end_rc.setRight(end_rc.left() + best_w); end_rc.setTop((screen_rect.y() + screen_rect.height() - best_h) / 2); end_rc.setBottom(end_rc.top() + best_h); } } {/* NEED TO EXECUTE 2 TIMES, BECAUSE CALC FOR BEST W NOT MEANS USING BEST H*/ const int best_h = 0.8f * screen_rect.height(); if (end_rc.height() > best_h) { const int best_w = best_h * _aspect_ratio; end_rc.setLeft((screen_rect.x() + screen_rect.width() - best_w) / 2); end_rc.setRight(end_rc.left() + best_w); end_rc.setTop((screen_rect.y() + screen_rect.height() - best_h) / 2); end_rc.setBottom(end_rc.top() + best_h); } } _first_time_use_aspect_ratio = false; } _self_resize_effect->geometryTo(end_rc, 500); } }
bool Ui::AspectRatioResizebleWnd::isInFullscreen() const { return isFullScreen(); }
NATRON_NAMESPACE_ENTER void Gui::setupUi() { onProjectNameChanged(QString(), false); setMouseTracking(true); installEventFilter(this); assert( !isFullScreen() ); //Gui::loadStyleSheet(); ///Restores position, size of the main window as well as whether it was fullscreen or not. _imp->restoreGuiGeometry(); _imp->_undoStacksGroup = new QUndoGroup; createMenuActions(); /*CENTRAL AREA*/ //====================== _imp->_centralWidget = new QWidget(this); setCentralWidget(_imp->_centralWidget); _imp->_mainLayout = new QHBoxLayout(_imp->_centralWidget); _imp->_mainLayout->setContentsMargins(0, 0, 0, 0); _imp->_centralWidget->setLayout(_imp->_mainLayout); _imp->_leftRightSplitter = new Splitter(Qt::Horizontal, this, _imp->_centralWidget); _imp->_leftRightSplitter->setChildrenCollapsible(false); _imp->_leftRightSplitter->setObjectName( QString::fromUtf8(kMainSplitterObjectName) ); getApp()->registerSplitter(_imp->_leftRightSplitter); _imp->_leftRightSplitter->setOrientation(Qt::Horizontal); _imp->_leftRightSplitter->setContentsMargins(0, 0, 0, 0); _imp->_toolBox = new AutoHideToolBar(this, _imp->_leftRightSplitter); _imp->_toolBox->setToolButtonStyle(Qt::ToolButtonIconOnly); _imp->_toolBox->setOrientation(Qt::Vertical); _imp->_toolBox->setMaximumWidth( TO_DPIX(NATRON_TOOL_BUTTON_SIZE) ); if (_imp->leftToolBarDisplayedOnHoverOnly) { _imp->refreshLeftToolBarVisibility( mapFromGlobal( QCursor::pos() ) ); } _imp->_leftRightSplitter->addWidget(_imp->_toolBox); _imp->_mainLayout->addWidget(_imp->_leftRightSplitter); _imp->createNodeGraphGui(); _imp->createAnimationModuleGui(); _imp->createScriptEditorGui(); _imp->createProgressPanelGui(); ///Must be absolutely called once _nodeGraphArea has been initialized. _imp->createPropertiesBinGui(); ProjectPtr project = getApp()->getProject(); _imp->_projectGui = new ProjectGui(this); _imp->_projectGui->create(project, _imp->_layoutPropertiesBin, this); _imp->_errorLog = new LogWindow(0); _imp->_errorLog->hide(); createDefaultLayoutInternal(false); initProjectGuiKnobs(); setVisibleProjectSettingsPanel(); _imp->_aboutWindow = new AboutWindow(this, this); _imp->_aboutWindow->hide(); //the same action also clears the ofx plugins caches, they are not the same cache but are used to the same end QObject::connect( project.get(), SIGNAL(projectNameChanged(QString,bool)), this, SLOT(onProjectNameChanged(QString,bool)) ); TimeLinePtr timeline = project->getTimeLine(); QObject::connect( timeline.get(), SIGNAL(frameChanged(SequenceTime,int)), this, SLOT(onTimelineTimeChanged(SequenceTime,int)) ); QObject::connect( timeline.get(), SIGNAL(frameAboutToChange()), this, SLOT(onTimelineTimeAboutToChange()) ); /*Searches recursively for all child objects of the given object, and connects matching signals from them to slots of object that follow the following form: void on_<object name>_<signal name>(<signal parameters>); Let's assume our object has a child object of type QPushButton with the object name button1. The slot to catch the button's clicked() signal would be: void on_button1_clicked(); If object itself has a properly set object name, its own signals are also connected to its respective slots. */ QMetaObject::connectSlotsByName(this); { #ifdef DEBUG boost_adaptbx::floating_point::exception_trapping trap(0); #endif appPTR->setOFXHostHandle( getApp()->getOfxHostOSHandle() ); } } // setupUi