Skip to content

Commit

Permalink
Re #4282. A correction to folders behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
mantid-roman committed Jan 12, 2012
1 parent 2279a0f commit 27406e7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Code/Mantid/MantidPlot/src/ApplicationWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17635,6 +17635,7 @@ void ApplicationWindow::activateNewWindow()
{
MdiSubWindow* current = getActiveWindow();
MdiSubWindow* newone = NULL;
Folder* folder = currentFolder();

// try the docked windows first
QList<QMdiSubWindow*> wl = d_workspace->subWindowList();
Expand All @@ -17643,7 +17644,7 @@ void ApplicationWindow::activateNewWindow()
if (w->widget() != static_cast<QWidget*>(current))
{
MdiSubWindow* sw = dynamic_cast<MdiSubWindow*>(w->widget());
if (sw && sw->status() != MdiSubWindow::Minimized)
if (sw && sw->status() != MdiSubWindow::Minimized && folder->hasWindow(sw))
{
newone = sw;
break;
Expand All @@ -17659,7 +17660,7 @@ void ApplicationWindow::activateNewWindow()
MdiSubWindow* sw = w->mdiSubWindow();
if (sw != current)
{
if (sw && sw->status() != MdiSubWindow::Minimized)
if (sw && sw->status() != MdiSubWindow::Minimized && folder->hasWindow(sw))
{
newone = sw;
break;
Expand Down
2 changes: 1 addition & 1 deletion Code/Mantid/MantidPlot/src/ApplicationWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ public slots:
//! \name Folders
//@{
//! Returns a pointer to the current folder in the project
Folder* currentFolder(){return current_folder;};
Folder* currentFolder(){return current_folder;}
//! Adds a new folder to the project
void addFolder();
Folder* addFolder(QString name, Folder* parent = NULL);
Expand Down
9 changes: 9 additions & 0 deletions Code/Mantid/MantidPlot/src/Folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,15 @@ void Folder::removeWindow( MdiSubWindow *w )
lstWindows.removeAt(index);
}

/**
* Returns true if this folder contains a sub-window.
* @param w :: A sub-window to check.
*/
bool Folder::hasWindow(MdiSubWindow *w) const
{
return lstWindows.contains(w);
}

QString Folder::sizeToString()
{
size_t size = 0;
Expand Down
3 changes: 2 additions & 1 deletion Code/Mantid/MantidPlot/src/Folder.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ class Folder : public QObject

QList<MdiSubWindow *> windowsList(){return lstWindows;};

void addWindow( MdiSubWindow *w );
void addWindow( MdiSubWindow *w );
void removeWindow( MdiSubWindow *w );
bool hasWindow(MdiSubWindow *w) const;

//! The list of subfolder names, including first generation children only
QStringList subfolders();
Expand Down

0 comments on commit 27406e7

Please sign in to comment.