Skip to content

Commit

Permalink
Revert "Re #4282. Improved window handling by project explorer"
Browse files Browse the repository at this point in the history
This reverts commit c70caee.
  • Loading branch information
mantid-roman committed Jan 20, 2012
1 parent ec2faa4 commit 301f0b8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 44 deletions.
49 changes: 18 additions & 31 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ void ApplicationWindow::init(bool factorySettings)
connect(d_workspace, SIGNAL(subWindowActivated(QMdiSubWindow *)),
this, SLOT(windowActivated(QMdiSubWindow*)));
connect(lv, SIGNAL(doubleClicked(Q3ListViewItem *)),
this, SLOT(activateWindow(Q3ListViewItem *)));
this, SLOT(maximizeWindow(Q3ListViewItem *)));
connect(lv, SIGNAL(doubleClicked(Q3ListViewItem *)),
this, SLOT(folderItemDoubleClicked(Q3ListViewItem *)));
connect(lv, SIGNAL(contextMenuRequested(Q3ListViewItem *, const QPoint &, int)),
Expand Down Expand Up @@ -8429,7 +8429,6 @@ void ApplicationWindow::hideWindow(MdiSubWindow* w)
{
hiddenWindows->append(w);
w->setHidden();
activateNewWindow();
emit modified();
}

Expand Down Expand Up @@ -8501,23 +8500,27 @@ bool ApplicationWindow::existsWindow(MdiSubWindow* w) const
*/
MdiSubWindow* ApplicationWindow::getActiveWindow() const
{
//m_active_window_mutex.lock();
if (!existsWindow(d_active_window))
{
d_active_window = NULL;
}
return d_active_window;
//m_active_window_mutex.unlock();
}

/**
* Sets internal pointer to a new active sub-window.
*/
void ApplicationWindow::setActiveWindow(MdiSubWindow* w)
{
//m_active_window_mutex.lock();
d_active_window = w;
if (!existsWindow(d_active_window))
{
d_active_window = NULL;
}
//m_active_window_mutex.unlock();
}


Expand Down Expand Up @@ -8546,7 +8549,7 @@ void ApplicationWindow::activateWindow(MdiSubWindow *w, bool activateOuterWindow
if(getActiveWindow() == w )
{
// this can happen
if (w->status() == MdiSubWindow::Minimized || w->status() == MdiSubWindow::Hidden)
if (w->status() == MdiSubWindow::Minimized)
{
w->setNormal();
}
Expand Down Expand Up @@ -8590,7 +8593,8 @@ void ApplicationWindow::activateWindow(MdiSubWindow *w, bool activateOuterWindow
{
if (activateOuterWindow)
{
w->setNormal();
fw->showNormal();
fw->activateWindow();
}
}
else
Expand All @@ -8603,17 +8607,6 @@ void ApplicationWindow::activateWindow(MdiSubWindow *w, bool activateOuterWindow
emit modified();
}

void ApplicationWindow::activateWindow(Q3ListViewItem * lbi)
{
if (!lbi)
lbi = lv->currentItem();

if (!lbi || lbi->rtti() == FolderListItem::RTTI)
return;

activateWindow(dynamic_cast<WindowListItem*>(lbi)->window());
}

void ApplicationWindow::maximizeWindow(Q3ListViewItem * lbi)
{
if (!lbi)
Expand Down Expand Up @@ -15172,19 +15165,19 @@ void ApplicationWindow::showAllFolderWindows()
switch (w->status())
{
case MdiSubWindow::Hidden:
w->setNormal();
w->showNormal();
break;

case MdiSubWindow::Normal:
w->setNormal();
w->showNormal();
break;

case MdiSubWindow::Minimized:
w->setMinimized();
w->showMinimized();
break;

case MdiSubWindow::Maximized:
w->setMaximized();
w->showMaximized();
break;
}
}
Expand All @@ -15205,19 +15198,19 @@ void ApplicationWindow::showAllFolderWindows()
switch (w->status())
{
case MdiSubWindow::Hidden:
w->setNormal();
w->showNormal();
break;

case MdiSubWindow::Normal:
w->setNormal();
w->showNormal();
break;

case MdiSubWindow::Minimized:
w->setMinimized();
w->showMinimized();
break;

case MdiSubWindow::Maximized:
w->setMaximized();
w->showMaximized();
break;
}
}
Expand Down Expand Up @@ -17730,10 +17723,7 @@ void ApplicationWindow::activateNewWindow()
if (w->widget() != static_cast<QWidget*>(current))
{
MdiSubWindow* sw = dynamic_cast<MdiSubWindow*>(w->widget());
if (sw &&
sw->status() != MdiSubWindow::Minimized &&
sw->status() != MdiSubWindow::Hidden &&
folder->hasWindow(sw))
if (sw && sw->status() != MdiSubWindow::Minimized && folder->hasWindow(sw))
{
newone = sw;
break;
Expand All @@ -17749,10 +17739,7 @@ void ApplicationWindow::activateNewWindow()
MdiSubWindow* sw = w->mdiSubWindow();
if (sw != current)
{
if (sw &&
sw->status() != MdiSubWindow::Minimized &&
sw->status() != MdiSubWindow::Hidden &&
folder->hasWindow(sw))
if (sw && sw->status() != MdiSubWindow::Minimized && folder->hasWindow(sw))
{
newone = sw;
break;
Expand Down
3 changes: 2 additions & 1 deletion Code/Mantid/MantidPlot/src/ApplicationWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Description : QtiPlot's main window
#include <QLocale>
#include <QSet>
#include <QSettings>
#include <QMutex>

#include "Table.h"
#include "ScriptingEnv.h"
Expand Down Expand Up @@ -517,7 +518,6 @@ public slots:
bool setWindowName(MdiSubWindow *w, const QString &text);

void maximizeWindow(Q3ListViewItem * lbi = 0);
void activateWindow(Q3ListViewItem * lbi);
void maximizeWindow(MdiSubWindow *w);
void minimizeWindow(MdiSubWindow *w = 0);
//! Changes the geometry of the active MDI window
Expand Down Expand Up @@ -1462,6 +1462,7 @@ public slots:
QList<FloatingWindow*> m_floatingWindows;
// To block activating new window when a floating window is in process of resetting flags
bool blockWindowActivation;
mutable QMutex m_active_window_mutex;

#ifdef SHARED_MENUBAR
QMenuBar* m_sharedMenuBar; ///< Pointer to the shared menubar
Expand Down
28 changes: 16 additions & 12 deletions Code/Mantid/MantidPlot/src/MdiSubWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,27 @@ void MdiSubWindow::resizeEvent( QResizeEvent* e )
*/
void MdiSubWindow::show()
{
setNormal();
QWidget* pw = getWrapperWindow();
if (!pw)
{
MdiSubWindowParent_t::show();
return;
}
pw->show();
}

/**
* Override the QWidget's hide() slot to hide the wrapper window instead.
*/
void MdiSubWindow::hide()
{
setHidden();
QWidget* pw = getWrapperWindow();
if (!pw)
{
MdiSubWindowParent_t::hide();
return;
}
pw->hide();
}

/**
Expand Down Expand Up @@ -256,16 +268,8 @@ void MdiSubWindow::setStatus(Status s)

void MdiSubWindow::setHidden()
{
QWidget* pw = getWrapperWindow();
if (!pw)
{
MdiSubWindowParent_t::hide();
}
else
{
pw->hide();
}
setStatus(Hidden);
setStatus(Hidden);
hide();
}

void MdiSubWindow::setNormal()
Expand Down

0 comments on commit 301f0b8

Please sign in to comment.