Merge pull request #581 from shun-iwasawa/turtletooth-maximize

Maximize Pane where mouse is shortcut by turtletooth (modified)
This commit is contained in:
turtletooth 2016-07-12 14:05:10 -06:00 committed by GitHub
commit 9e7a9d2cd4
5 changed files with 35 additions and 4 deletions

View file

@ -433,6 +433,8 @@ centralWidget->setLayout(centralWidgetLayout);*/
setCommandHandler(MI_PickStyleLines, this, &MainWindow::togglePickStyleLines);
setCommandHandler(MI_About, this, &MainWindow::onAbout);
setCommandHandler(MI_MaximizePanel, this, &MainWindow::maximizePanel);
setCommandHandler(MI_FullScreenWindow, this, &MainWindow::fullScreenWindow);
}
//-----------------------------------------------------------------------------
@ -1094,6 +1096,21 @@ void MainWindow::resetRoomsLayout() {
QObject::tr("The rooms will be reset the next time you run Toonz."));
}
void MainWindow::maximizePanel() {
DockLayout *currDockLayout = getCurrentRoom()->dockLayout();
QPoint p = mapFromGlobal(QCursor::pos());
QWidget *currWidget = currDockLayout->containerOf(p);
DockWidget *currW = dynamic_cast<DockWidget *>(currWidget);
if (currW) currW->maximizeDock();
}
void MainWindow::fullScreenWindow() {
if (isFullScreen())
setWindowState(Qt::WindowMaximized);
else
setWindowState(Qt::WindowFullScreen);
}
//-----------------------------------------------------------------------------
void MainWindow::onCurrentRoomChanged(int newRoomIndex) {
@ -1881,12 +1898,15 @@ void MainWindow::defineActions() {
createMenuWindowsAction(MI_ResetRoomLayout, tr("&Reset to Default Rooms"),
"");
createMenuWindowsAction(MI_MaximizePanel, tr("Toggle Maximize Panel"), "`");
createMenuWindowsAction(MI_FullScreenWindow,
tr("Toggle Main Window's Full Screen Mode"),
"Ctrl+`");
createMenuWindowsAction(MI_About, tr("&About OpenToonz..."), "");
createRightClickMenuAction(MI_BlendColors, tr("&Blend colors"), "");
createToggle(MI_OnionSkin, tr("Onion Skin"), "", false,
createToggle(MI_OnionSkin, tr("Onion Skin Toggle"), "//", false,
RightClickMenuCommandType);
createToggle(MI_ZeroThick, tr("Zero Thick Lines"), "Shift+/", false,
RightClickMenuCommandType);

View file

@ -69,7 +69,6 @@ class MainWindow final : public QMainWindow {
bool m_saveSettingsOnQuit;
int m_oldRoomIndex;
QString m_currentRoomsChoice;
UpdateChecker *m_updateChecker;
TopBar *m_topBar;
@ -100,6 +99,8 @@ public:
void onLoadScene();
void onLoadSubScene();
void resetRoomsLayout();
void maximizePanel();
void fullScreenWindow();
void autofillToggle();
void onUpgradeTabPro();
void onAbout();

View file

@ -220,7 +220,8 @@
#define MI_OpenXshView "MI_OpenXshView"
#define MI_OpenCleanupSettings "MI_OpenCleanupSettings"
#define MI_ResetRoomLayout "MI_ResetRoomLayout"
#define MI_MaximizePanel "MI_MaximizePanel"
#define MI_FullScreenWindow "MI_FullScreenWindow"
#define MI_OnionSkin "MI_OnionSkin"
#define MI_ZeroThick "MI_ZeroThick"

View file

@ -168,6 +168,8 @@ class DVAPI DockWidget : public QWidget {
// privates
friend class DockPlaceholder; // As above.
// friend Region; //Regions need access to m_saveIndex field.
public:
void maximizeDock();
protected:
// Private attributes for dragging purposes

View file

@ -385,6 +385,13 @@ void DockWidget::mouseDoubleClickEvent(QMouseEvent *me) {
//-------------------------------------
void DockWidget::maximizeDock() {
if (!m_floating) {
parentLayout()->setMaximized(this, !m_maximized);
}
}
//-------------------------------------
//! Switch in selected dock placeholder's hierarchy.
void DockWidget::wheelEvent(QWheelEvent *we) {
if (m_dragging) {