diff --git a/radiant/CMakeLists.txt b/radiant/CMakeLists.txt index 7cf5b00f4b..f06d56ccac 100644 --- a/radiant/CMakeLists.txt +++ b/radiant/CMakeLists.txt @@ -93,7 +93,6 @@ add_executable(darkradiant ui/LongRunningOperationHandler.cpp ui/mainframe/AuiLayout.cpp ui/mainframe/EmbeddedLayout.cpp - ui/mainframe/FloatingLayout.cpp ui/mainframe/MainFrame.cpp ui/mainframe/MainFrameLayoutManager.cpp ui/mainframe/RegularLayout.cpp diff --git a/radiant/ui/mainframe/FloatingLayout.cpp b/radiant/ui/mainframe/FloatingLayout.cpp deleted file mode 100644 index 4e37dc458f..0000000000 --- a/radiant/ui/mainframe/FloatingLayout.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#include "FloatingLayout.h" - -#include "i18n.h" -#include "itextstream.h" -#include "ieventmanager.h" -#include "igroupdialog.h" -#include "ientityinspector.h" - -#include "registry/registry.h" - -#include "camera/CameraWndManager.h" -#include "ui/texturebrowser/TextureBrowser.h" -#include "xyview/GlobalXYWnd.h" - -namespace ui -{ - -namespace -{ - const std::string RKEY_CAMERA_ROOT = "user/ui/camera"; - const std::string RKEY_CAMERA_WINDOW_STATE = RKEY_CAMERA_ROOT + "/window"; - const std::string RKEY_FLOATING_ROOT = "user/ui/mainFrame/floating"; - const std::string RKEY_GROUPDIALOG_VISIBLE = RKEY_FLOATING_ROOT + "/groupDialogVisible"; -} - -std::string FloatingLayout::getName() -{ - return FLOATING_LAYOUT_NAME; -} - -void FloatingLayout::activate() -{ - wxFrame* topLevelWindow = GlobalMainFrame().getWxTopLevelWindow(); - - _floatingCamWnd = GlobalCamera().createFloatingWindow(); - - // Connect up the toggle camera event - IEventPtr ev = GlobalEventManager().findEvent("ToggleCamera"); - - if (!ev->empty()) - { - ev->connectTopLevelWindow(_floatingCamWnd.get()); - ev->updateWidgets(); - } - else - { - rError() << "Could not connect ToggleCamera event" << std::endl; - } - - // Add a new texture browser to the group dialog pages - wxWindow* textureBrowser = new TextureBrowser(topLevelWindow); - - // Texture Page - { - IGroupDialog::PagePtr page(new IGroupDialog::Page); - - page->name = "textures"; - page->windowLabel = _("Texture Browser"); - page->page = textureBrowser; - page->tabIcon = "icon_texture.png"; - page->tabLabel = _("Textures"); - page->position = IGroupDialog::Page::Position::TextureBrowser; - - GlobalGroupDialog().addPage(page); - } - - if (registry::getValue(RKEY_GROUPDIALOG_VISIBLE)) - { - GlobalGroupDialog().showDialogWindow(); - } - - // greebo: Now that the dialog is shown, tell the Entity Inspector to reload - // the position info from the Registry once again. - GlobalEntityInspector().restoreSettings(); - - // Restore any floating XYViews that were active before - // This will create a default view if no saved info is found - GlobalXYWnd().restoreState(); - - // Show the camera and restore its position. Curiously enough, - // calling Show() earlier would not restore its position correctly - // but move the camera off a dozen pixels or so - _floatingCamWnd->Show(); -} - -void FloatingLayout::deactivate() -{ - // Save the current XYViews to the registry - GlobalXYWnd().saveState(); - - // Delete all active views - GlobalXYWndManager().destroyViews(); - - // Save groupdialog state - /*registry::setValue(RKEY_GROUPDIALOG_VISIBLE, - GlobalGroupDialog().getWxDialogWindow()->IsShownOnScreen());*/ - - // Hide the group dialog - GlobalGroupDialog().hideDialogWindow(); - - // Remove the texture browser from the groupdialog - GlobalGroupDialog().removePage("textures"); - - // Destroy the camera window - if (_floatingCamWnd != NULL) - { - if (_floatingCamWnd->IsFullScreen()) - { - _floatingCamWnd->ShowFullScreen(false); - } - - IEventPtr ev = GlobalEventManager().findEvent("ToggleCamera"); - - if (!ev->empty()) - { - ev->disconnectTopLevelWindow(_floatingCamWnd.get()); - } - else - { - rError() << "Could not disconnect ToggleCamera event" << std::endl; - } - - // Release the object - _floatingCamWnd.reset(); - } -} - -void FloatingLayout::toggleFullscreenCameraView() -{ - _floatingCamWnd->ShowFullScreen(!_floatingCamWnd->IsFullScreen()); -} - -void FloatingLayout::restoreStateFromRegistry() -{ - // nothing yet -} - -// The creation function, needed by the mainframe layout manager -FloatingLayoutPtr FloatingLayout::CreateInstance() -{ - return std::make_shared(); -} - -} // namespace ui diff --git a/radiant/ui/mainframe/FloatingLayout.h b/radiant/ui/mainframe/FloatingLayout.h deleted file mode 100644 index 8c7b634673..0000000000 --- a/radiant/ui/mainframe/FloatingLayout.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include "icommandsystem.h" -#include "imainframelayout.h" - -namespace ui -{ - -class FloatingCamWnd; -typedef std::shared_ptr FloatingCamWndPtr; - -#define FLOATING_LAYOUT_NAME "Floating" - -class FloatingLayout; -typedef std::shared_ptr FloatingLayoutPtr; - -/** - * \brief - * Original GIMP-style layout with multiple floating windows - * - * This layout is the most flexible, as it allows windows to be positioned and - * resized arbitrarily, but it is also more cumbersome to set up because the - * default window positions are not likely to be desirable. - */ -class FloatingLayout: public IMainFrameLayout -{ - // The floating camera window - FloatingCamWndPtr _floatingCamWnd; - -public: - // IMainFrameLayout implementation - std::string getName() override; - void activate() override; - void deactivate() override; - void toggleFullscreenCameraView() override; - void restoreStateFromRegistry() override; - - // The creation function, needed by the mainframe layout manager - static FloatingLayoutPtr CreateInstance(); -}; - -} // namespace ui diff --git a/radiant/ui/mainframe/MainFrameLayoutManager.cpp b/radiant/ui/mainframe/MainFrameLayoutManager.cpp index ef4493f1bd..826ffd10d9 100644 --- a/radiant/ui/mainframe/MainFrameLayoutManager.cpp +++ b/radiant/ui/mainframe/MainFrameLayoutManager.cpp @@ -9,7 +9,6 @@ #include "module/StaticModule.h" #include "AuiLayout.h" -#include "FloatingLayout.h" #include "SplitPaneLayout.h" #include "RegularLayout.h" #include "EmbeddedLayout.h" @@ -34,11 +33,9 @@ IMainFrameLayoutPtr MainFrameLayoutManager::getLayout(const std::string& name) { void MainFrameLayoutManager::registerLayout( const std::string& name, const CreateMainFrameLayoutFunc& func) { - std::pair result = _layouts.insert( - LayoutMap::value_type(name, func) - ); + auto result = _layouts.insert({name, func}); - // Check if the insertion was successful + // Check if the insertion was successful if (!result.second) { rError() << "MainFrameLayoutManager: Layout " << name << " already registered." << std::endl; @@ -85,7 +82,6 @@ void MainFrameLayoutManager::initialiseModule(const IApplicationContext& ctx) // Register the default layouts registerLayout(EMBEDDED_LAYOUT_NAME, EmbeddedLayout::CreateInstance); registerLayout(AUI_LAYOUT_NAME, AuiLayout::CreateInstance); - registerLayout(FLOATING_LAYOUT_NAME, FloatingLayout::CreateInstance); registerLayout(SPLITPANE_LAYOUT_NAME, SplitPaneLayout::CreateInstance); registerLayout(REGULAR_LAYOUT_NAME, RegularLayout::CreateRegularInstance); registerLayout(REGULAR_LEFT_LAYOUT_NAME, RegularLayout::CreateRegularLeftInstance);