* @brief Application::activateView * Activates a view of the given type of the active document. * If a view of this type doesn't exist and \a create is true * a new view of this type will be created. * @param type * @param create */
| 1530 | * @param create |
| 1531 | */ |
| 1532 | void Application::activateView(const Base::Type& type, bool create) |
| 1533 | { |
| 1534 | Document* doc = activeDocument(); |
| 1535 | if (doc) { |
| 1536 | MDIView* mdiView = doc->getActiveView(); |
| 1537 | if (mdiView && mdiView->isDerivedFrom(type)) { |
| 1538 | return; |
| 1539 | } |
| 1540 | std::list<MDIView*> mdiViews = doc->getMDIViewsOfType(type); |
| 1541 | if (!mdiViews.empty()) { |
| 1542 | doc->setActiveWindow(mdiViews.back()); |
| 1543 | } |
| 1544 | else if (create) { |
| 1545 | doc->createView(type); |
| 1546 | } |
| 1547 | } |
| 1548 | } |
| 1549 | |
| 1550 | /// Getter for the active view |
| 1551 | Gui::Document* Application::activeDocument() const |