// Construct the dialog LightTextureChooser::LightTextureChooser() : gtkutil::BlockingTransientWindow(_("Choose texture"), GlobalMainFrame().getTopLevelWindow()), _selector(Gtk::manage(new ShaderSelector(this, getPrefixList(), true))) // true >> render a light texture { // Set the default size of the window Gdk::Rectangle rect; if (GlobalGroupDialog().getDialogWindow()->is_visible()) { rect = gtkutil::MultiMonitor::getMonitorForWindow(GlobalGroupDialog().getDialogWindow()); } else { rect = gtkutil::MultiMonitor::getMonitorForWindow(GlobalMainFrame().getTopLevelWindow()); } set_default_size(static_cast<int>(rect.get_width()*0.6f), static_cast<int>(rect.get_height()*0.6f)); // Construct main VBox, and pack in ShaderSelector and buttons panel Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 6)); vbx->pack_start(*_selector, true, true, 0); vbx->pack_start(createButtons(), false, false, 0); add(*vbx); }
void RegularLayout::deactivate() { // Show the camera toggle option again GlobalUIManager().getMenuManager().setVisibility("main/view/cameraview", true); GlobalUIManager().getMenuManager().setVisibility("main/view/textureBrowser", true); // Remove all previously stored pane information GlobalRegistry().deleteXPath(RKEY_REGULAR_ROOT + "//pane"); // Save pane info saveStateToPath(RKEY_REGULAR_ROOT); // Delete all active views GlobalXYWndManager().destroyViews(); // Delete the CamWnd _camWnd = CamWndPtr(); // Hide the group dialog GlobalGroupDialog().hideDialogWindow(); GlobalTextureBrowser().destroyWindow(); // Destroy the widget, so it gets removed from the main container gtk_widget_destroy(GTK_WIDGET(_regular.horizPane)); }
void RegularLayout::deactivate() { // Show the camera toggle option again GlobalUIManager().getMenuManager().setVisibility("main/view/cameraview", true); GlobalUIManager().getMenuManager().setVisibility("main/view/textureBrowser", true); // Remove all previously stored pane information GlobalRegistry().deleteXPath(RKEY_REGULAR_ROOT + "//pane"); // Save pane info saveStateToPath(RKEY_REGULAR_ROOT); // Disconnect before destroying stuff _regular.posHPane.disconnect(); _regular.posTexCamPane.disconnect(); // Delete all active views GlobalXYWndManager().destroyViews(); // Delete the CamWnd _camWnd = CamWndPtr(); // Hide the group dialog GlobalGroupDialog().hideDialogWindow(); GlobalTextureBrowser().destroyWindow(); wxFrame* topLevelParent = GlobalMainFrame().getWxTopLevelWindow(); topLevelParent->RemoveChild(_regular.horizPane); _regular.horizPane->Destroy(); _regular.horizPane = NULL; _regular.texCamPane = NULL; }
void SplitPaneLayout::deconstructLayout() { if (GlobalRegistry().keyExists(RKEY_SPLITPANE_TEMP_ROOT)) { // We're maximised, restore the size first restorePanePositions(); } // Save camera position saveCameraPositionToRegistry(); // Remove all previously saved pane information GlobalRegistry().deleteXPath(RKEY_SPLITPANE_ROOT + "//pane"); // Save the pane info saveStateToPath(RKEY_SPLITPANE_ROOT); _splitPane.posHPane.disconnect(); _splitPane.posVPane1.disconnect(); _splitPane.posVPane2.disconnect(); // Reset quadrant information clearQuadrantInfo(); // Delete all active views GlobalXYWndManager().destroyViews(); // Delete the CamWnd _camWnd = CamWndPtr(); // Hide the group dialog GlobalGroupDialog().hideDialogWindow(); // Remove the texture browser from the groupdialog GlobalGroupDialog().removePage("textures"); // Destroy the widgets, so it gets removed from the main container wxFrame* topLevelParent = GlobalMainFrame().getWxTopLevelWindow(); topLevelParent->RemoveChild(_splitPane.horizPane); _splitPane.horizPane->Destroy(); _splitPane.clear(); }
void ScriptingSystem::initialise() { // The finalize_interpreter() function is not available in older versions #ifdef DR_PYBIND_HAS_EMBED_H py::initialize_interpreter(); #else Py_Initialize(); #endif { try { // Import the darkradiant module py::module::import(PythonModule::NAME()); // Construct the console writer interface PythonConsoleWriterClass consoleWriter(PythonModule::GetModule(), "PythonConsoleWriter"); consoleWriter.def(py::init<bool, std::string&>()); consoleWriter.def("write", &PythonConsoleWriter::write); // Redirect stdio output to our local ConsoleWriter instances py::module::import("sys").attr("stderr") = &_errorWriter; py::module::import("sys").attr("stdout") = &_outputWriter; // String vector is used in multiple places py::bind_vector< std::vector<std::string> >(PythonModule::GetModule(), "StringVector"); } catch (const py::error_already_set& ex) { rError() << ex.what() << std::endl; } } _initialised = true; // Start the init script executeScriptFile("init.py"); // Search script folder for commands reloadScripts(); // Add the scripting widget to the groupdialog IGroupDialog::PagePtr page(new IGroupDialog::Page); page->name = "ScriptWindow"; page->windowLabel = _("Script"); page->page = new ScriptWindow(GlobalMainFrame().getWxTopLevelWindow()); page->tabIcon = "icon_script.png"; page->tabLabel = _("Script"); page->position = IGroupDialog::Page::Position::Console - 10; // insert before console GlobalGroupDialog().addPage(page); }
void SplitPaneLayout::deconstructLayout() { if (GlobalRegistry().keyExists(RKEY_SPLITPANE_TEMP_ROOT)) { // We're maximised, restore the size first restorePanePositions(); } // Save camera position saveCameraPositionToRegistry(); // Remove all previously saved pane information GlobalRegistry().deleteXPath(RKEY_SPLITPANE_ROOT + "//pane"); // Save the pane info saveStateToPath(RKEY_SPLITPANE_ROOT); // Reset quadrant information clearQuadrantInfo(); // Delete all active views GlobalXYWndManager().destroyViews(); // Delete the CamWnd _camWnd = CamWndPtr(); // Hide the group dialog GlobalGroupDialog().hideDialogWindow(); // Remove the texture browser from the groupdialog GlobalGroupDialog().removePage("textures"); GlobalTextureBrowser().destroyWindow(); // Destroy the widgets, so it gets removed from the main container _splitPane = SplitPaneView(); }
void Console::toggle(const cmd::ArgumentList& args) { GlobalGroupDialog().togglePage("console"); }
void RegularLayout::activate() { GtkWindow* parent = GlobalMainFrame().getTopLevelWindow(); // Create a new camera window and parent it _camWnd = GlobalCamera().createCamWnd(); // greebo: The mainframe window acts as parent for the camwindow _camWnd->setContainer(parent); // Pack in the camera window GtkWidget* camWindow = gtkutil::FramedWidget(_camWnd->getWidget()); // Allocate a new OrthoView and set its ViewType to XY XYWndPtr xyWnd = GlobalXYWnd().createEmbeddedOrthoView(); xyWnd->setViewType(XY); // Create a framed window out of the view's internal widget GtkWidget* xyView = gtkutil::FramedWidget(xyWnd->getWidget()); // Create the texture window GtkWidget* texWindow = gtkutil::FramedWidget( GlobalTextureBrowser().constructWindow(parent) ); // Now pack those widgets into the paned widgets gtkutil::Paned texCamPane(gtkutil::Paned::Vertical); // First, pack the texwindow and the camera texCamPane.setFirstChild(camWindow, true); // allow shrinking texCamPane.setSecondChild(texWindow, true); // allow shrinking _regular.texCamPane = texCamPane.getWidget(); // Depending on the viewstyle, pack the xy left or right gtkutil::Paned horizPane(gtkutil::Paned::Horizontal); if (_regularLeft) { horizPane.setFirstChild(_regular.texCamPane, true); // allow shrinking horizPane.setSecondChild(xyView, true); // allow shrinking } else { // This is "regular", put the xyview to the left horizPane.setFirstChild(xyView, true); // allow shrinking horizPane.setSecondChild(_regular.texCamPane, true); // allow shrinking } _regular.horizPane = horizPane.getWidget(); // Retrieve the main container of the main window GtkWidget* mainContainer = GlobalMainFrame().getMainContainer(); gtk_container_add(GTK_CONTAINER(mainContainer), GTK_WIDGET(_regular.horizPane)); // Set some default values for the width and height gtk_paned_set_position(GTK_PANED(_regular.horizPane), 500); gtk_paned_set_position(GTK_PANED(_regular.texCamPane), 350); // Connect the pane position trackers _regular.posHPane.connect(_regular.horizPane); _regular.posTexCamPane.connect(_regular.texCamPane); // Now attempt to load the paned positions from the registry restoreStateFromPath(RKEY_REGULAR_ROOT); 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(); GlobalGroupDialog().hideDialogWindow(); gtk_widget_show_all(mainContainer); // Hide the camera toggle option for non-floating views GlobalUIManager().getMenuManager().setVisibility("main/view/cameraview", false); // Hide the console/texture browser toggles for non-floating/non-split views GlobalUIManager().getMenuManager().setVisibility("main/view/textureBrowser", false); }
void ScriptWindow::toggle(const cmd::ArgumentList& args) { GlobalGroupDialog().togglePage("Script"); }
void SplitPaneLayout::constructLayout() { _splitPane = SplitPaneView(); _cameraPosition = getCameraPositionFromRegistry(); const Glib::RefPtr<Gtk::Window>& parent = GlobalMainFrame().getTopLevelWindow(); // Create a new camera window and parent it _camWnd = GlobalCamera().createCamWnd(); // greebo: The mainframe window acts as parent for the camwindow _camWnd->setContainer(parent); _camera = Gtk::manage(new gtkutil::FramedWidget(*_camWnd->getWidget())); // Allocate paned widgets _splitPane.horizPane.reset(new Gtk::HPaned); _splitPane.vertPane1 = Gtk::manage(new Gtk::VPaned); _splitPane.vertPane2 = Gtk::manage(new Gtk::VPaned); // Arrange the widgets into the paned views _splitPane.horizPane->pack1(*_splitPane.vertPane1, true, true); _splitPane.horizPane->pack2(*_splitPane.vertPane2, true, true); // Retrieve the main container of the main window Gtk::Container* mainContainer = GlobalMainFrame().getMainContainer(); mainContainer->add(*_splitPane.horizPane); _splitPane.horizPane->set_position(200); _splitPane.vertPane1->set_position(200); _splitPane.vertPane2->set_position(400); _splitPane.posHPane.connect(_splitPane.horizPane.get()); _splitPane.posVPane1.connect(_splitPane.vertPane1); _splitPane.posVPane2.connect(_splitPane.vertPane2); // Attempt to restore this layout's state, this will also construct the orthoviews restoreStateFromPath(RKEY_SPLITPANE_ROOT); // Distribute widgets among quadrants distributeWidgets(); { Gtk::Frame* textureBrowser = Gtk::manage(new gtkutil::FramedWidget( *GlobalTextureBrowser().constructWindow(parent) )); // Add the Media Browser page GlobalGroupDialog().addPage( "textures", // name "Textures", // tab title "icon_texture.png", // tab icon *textureBrowser, // page widget _("Texture Browser") ); } 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(); GlobalGroupDialog().hideDialogWindow(); mainContainer->show_all(); }
void MediaBrowser::toggle(const cmd::ArgumentList& args) { GlobalGroupDialog().togglePage("mediabrowser"); }
void SplitPaneLayout::constructLayout() { _splitPane.clear(); wxFrame* topLevelParent = GlobalMainFrame().getWxTopLevelWindow(); // Main splitter _splitPane.horizPane = new wxSplitterWindow(topLevelParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE | wxSP_3D | wxWANTS_CHARS, "SplitPaneHorizPane"); GlobalMainFrame().getWxMainContainer()->Add(_splitPane.horizPane, 1, wxEXPAND); // Two sub-splitters _splitPane.vertPane1 = new wxSplitterWindow(_splitPane.horizPane, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE | wxSP_3D | wxWANTS_CHARS, "SplitPaneVertPane1"); _splitPane.vertPane2 = new wxSplitterWindow(_splitPane.horizPane, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE | wxSP_3D | wxWANTS_CHARS, "SplitPaneVertPane2"); _splitPane.vertPane1->SetMinimumPaneSize(1); // disallow unsplitting _splitPane.vertPane2->SetMinimumPaneSize(1); // disallow unsplitting _splitPane.horizPane->SplitVertically(_splitPane.vertPane1, _splitPane.vertPane2); _splitPane.posHPane.connect(_splitPane.horizPane); _splitPane.posVPane1.connect(_splitPane.vertPane1); _splitPane.posVPane2.connect(_splitPane.vertPane2); // Create the views and place them into the splitters createViews(); // Attempt to restore this layout's state, this will also construct the orthoviews restoreStateFromPath(RKEY_SPLITPANE_ROOT); // Add a new texture browser to the group dialog pages wxWindow* textureBrowser = new TextureBrowser(topLevelParent); // 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"); GlobalGroupDialog().addPage(page); } 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(); GlobalGroupDialog().hideDialogWindow(); topLevelParent->Layout(); }
void RegularLayout::activate() { wxFrame* topLevelParent = GlobalMainFrame().getWxTopLevelWindow(); // Main splitter _regular.horizPane = new wxSplitterWindow(topLevelParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE | wxSP_3D | wxWANTS_CHARS, "RegularHorizPane"); _regular.horizPane->SetSashGravity(0.5); _regular.horizPane->SetSashPosition(500); _regular.horizPane->SetMinimumPaneSize(1); // disallow unsplitting GlobalMainFrame().getWxMainContainer()->Add(_regular.horizPane, 1, wxEXPAND); // Allocate a new OrthoView and set its ViewType to XY XYWndPtr xywnd = GlobalXYWnd().createEmbeddedOrthoView(XY, _regular.horizPane); // Texture/Camera Pane _regular.texCamPane = new wxSplitterWindow(_regular.horizPane, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE | wxSP_3D | wxWANTS_CHARS, "RegularTexCamPane"); _regular.texCamPane->SetSashGravity(0.5); _regular.texCamPane->SetSashPosition(350); _regular.texCamPane->SetMinimumPaneSize(1); // disallow unsplitting // Create a new camera window and parent it _camWnd = GlobalCamera().createCamWnd(_regular.texCamPane); // Texture Window wxWindow* texBrowser = GlobalTextureBrowser().constructWindow(_regular.texCamPane); _regular.texCamPane->SplitHorizontally(_camWnd->getMainWidget(), texBrowser); if (_regularLeft) { _regular.horizPane->SplitVertically(_regular.texCamPane, xywnd->getGLWidget()); } else { // This is "regular", put the xyview to the left _regular.horizPane->SplitVertically(xywnd->getGLWidget(), _regular.texCamPane); } // Connect the pane position trackers _regular.posHPane.connect(_regular.horizPane); _regular.posTexCamPane.connect(_regular.texCamPane); // Now attempt to load the paned positions from the registry restoreStateFromPath(RKEY_REGULAR_ROOT); 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(); GlobalGroupDialog().hideDialogWindow(); topLevelParent->Layout(); // Hide the camera toggle option for non-floating views GlobalUIManager().getMenuManager().setVisibility("main/view/cameraview", false); // Hide the console/texture browser toggles for non-floating/non-split views GlobalUIManager().getMenuManager().setVisibility("main/view/textureBrowser", false); }