// 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 insertCurveControlPoints(const cmd::ArgumentList& args) { if (GlobalSelectionSystem().Mode() != SelectionSystem::eComponent || GlobalSelectionSystem().ComponentMode() != SelectionSystem::eVertex) { gtkutil::errorDialog( _("Can't insert curve points - must be in vertex editing mode."), GlobalMainFrame().getTopLevelWindow() ); return; } const SelectionInfo& info = GlobalSelectionSystem().getSelectionInfo(); if (info.entityCount > 0) { UndoableCommand command("curveInsertControlPoints"); // The functor object CurveControlPointInserter inserter; // Traverse the selection applying the functor GlobalSelectionSystem().foreachSelected( SelectedCurveVisitor(inserter) ); } else { gtkutil::errorDialog( _("Can't insert curve points - no entities with curves selected."), GlobalMainFrame().getTopLevelWindow() ); } }
void createDecalsForSelectedFaces(const cmd::ArgumentList& args) { // Sanity check if (g_SelectedFaceInstances.empty()) { gtkutil::errorDialog(_("No faces selected."), GlobalMainFrame().getTopLevelWindow()); return; } // Create a scoped undocmd object UndoableCommand cmd("createDecalsForSelectedFaces"); // greebo: For each face, create a patch with fixed tesselation DecalPatchCreator creator; g_SelectedFaceInstances.foreach(creator); // Issue the command creator.createDecals(); // Check how many faces were not suitable int unsuitableWindings = creator.getNumUnsuitableWindings(); if (unsuitableWindings > 0) { gtkutil::errorDialog( (boost::format(_("%d faces were not suitable (had more than 4 vertices).")) % unsuitableWindings).str(), GlobalMainFrame().getTopLevelWindow() ); } }
std::string EntityChooser::ChooseEntity(const std::string& preSelectedEntity) { gtkutil::Dialog dlg(_("Select Entity"), GlobalMainFrame().getTopLevelWindow()); Gdk::Rectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(GlobalMainFrame().getTopLevelWindow()); dlg.set_default_size(static_cast<int>(rect.get_width()/2), static_cast<int>(2*rect.get_height()/3)); // Instantiate a new chooser class EntityChooserPtr chooser(new EntityChooser); chooser->setSelectedEntity(preSelectedEntity); // add this to the dialog window IDialog::Handle handle = dlg.addElement(chooser); if (dlg.run() == IDialog::RESULT_OK) { return dlg.getElementValue(handle); } else { // Cancelled return ""; } }
void Doom3ShaderSystem::refreshShadersCmd(const cmd::ArgumentList& args) { // Disable screen updates for the scope of this function IScopedScreenUpdateBlockerPtr blocker = GlobalMainFrame().getScopedScreenUpdateBlocker(_("Processing..."), _("Loading Shaders")); // Reload the Shadersystem, this will also trigger an // OpenGLRenderSystem unrealise/realise sequence as the rendersystem // is attached to this class as Observer refresh(); GlobalMainFrame().updateAllWindows(); }
void Map::updateTitle() { std::string title = gtkutil::IConv::localeToUTF8(_mapName); if (m_modified) { title += " *"; } if (GlobalMainFrame().getTopLevelWindow()) { GlobalMainFrame().getTopLevelWindow()->set_title(title); } }
void EClassTree::populateWindow() { // Create the overall vbox _dialogVBox = gtk_vbox_new(FALSE, 12); gtk_container_add(GTK_CONTAINER(getWindow()), _dialogVBox); GtkWidget* paned = gtk_hpaned_new(); gtk_box_pack_start(GTK_BOX(_dialogVBox), paned, TRUE, TRUE, 0); // Pack tree view gtk_paned_add1(GTK_PANED(paned), createEClassTreeView()); // Pack spawnarg treeview gtk_paned_add2(GTK_PANED(paned), GTK_WIDGET(createPropertyTreeView())); // Pack in dialog buttons gtk_box_pack_start(GTK_BOX(_dialogVBox), createButtons(), FALSE, FALSE, 0); // Set the default size of the window GtkWindow* mainWindow = GlobalMainFrame().getTopLevelWindow(); GdkRectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(mainWindow); gtk_window_set_default_size( GTK_WINDOW(getWindow()), gint(rect.width * 0.8f), gint(rect.height * 0.8f) ); gtk_paned_set_position(GTK_PANED(paned), static_cast<gint>(rect.width * 0.25f)); }
// This takes care of relading the entityDefs and refreshing the scenegraph void EClassManager::reloadDefsCmd(const cmd::ArgumentList& args) { // Disable screen updates for the scope of this function IScopedScreenUpdateBlockerPtr blocker = GlobalMainFrame().getScopedScreenUpdateBlocker(_("Processing..."), _("Reloading Defs")); GlobalEntityClassManager().reloadDefs(); }
void makeVisportal(const cmd::ArgumentList& args) { BrushPtrVector brushes = getSelectedBrushes(); if (brushes.size() <= 0) { gtkutil::errorDialog(_("No brushes selected."), GlobalMainFrame().getTopLevelWindow()); return; } // Create a scoped undocmd object UndoableCommand cmd("brushMakeVisportal"); for (std::size_t i = 0; i < brushes.size(); i++) { Brush& brush = brushes[i]->getBrush(); // don't allow empty brushes if (brush.getNumFaces() == 0) continue; // Set all faces to nodraw first brush.setShader(GlobalRegistry().get(RKEY_NODRAW_SHADER)); // Find the largest face (in terms of area) LargestFaceFinder finder; brush.forEachFace(finder); finder.getLargestFace().setShader(GlobalRegistry().get(RKEY_VISPORTAL_SHADER)); } }
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; }
MapImporter::MapImporter(const scene::INodePtr& root, std::istream& inputStream) : _root(root), _dialogEventLimiter(registry::getValue<int>(RKEY_MAP_LOAD_STATUS_INTERLEAVE)), _entityCount(0), _primitiveCount(0), _inputStream(inputStream), _fileSize(0) { // Get the file size, for handling the progress dialog _inputStream.seekg(0, std::ios::end); _fileSize = static_cast<std::size_t>(_inputStream.tellg()); // Move the pointer back to the beginning of the file _inputStream.seekg(0, std::ios::beg); bool showProgressDialog = !registry::getValue<bool>(RKEY_MAP_SUPPRESS_LOAD_STATUS_DIALOG); if (showProgressDialog) { _dialog = gtkutil::ModalProgressDialogPtr( new gtkutil::ModalProgressDialog( GlobalMainFrame().getTopLevelWindow(), _("Loading map") ) ); // Initialise the text _dlgEntityText = (boost::format(_("Loading entity %d")) % _entityCount).str(); } }
// Add a new conversations entity button void ConversationDialog::onAddEntity() { // Obtain the entity class object IEntityClassPtr eclass = GlobalEntityClassManager().findClass(CONVERSATION_ENTITY_CLASS); if (eclass) { // Construct a Node of this entity type IEntityNodePtr node(GlobalEntityCreator().createEntity(eclass)); // Create a random offset node->getEntity().setKeyValue( "origin", RandomOrigin::generate(128) ); // Insert the node into the scene graph assert(GlobalSceneGraph().root()); GlobalSceneGraph().root()->addChildNode(node); // Refresh the widgets populateWidgets(); } else { // conversation entityclass was not found gtkutil::MessageBox::ShowError( (boost::format(_("Unable to create conversation Entity: class '%s' not found.")) % CONVERSATION_ENTITY_CLASS).str(), GlobalMainFrame().getTopLevelWindow() ); } }
// Main constructor ModalProgressDialog::ModalProgressDialog(const Glib::RefPtr<Gtk::Window>& parent, const std::string& title) : gtkutil::TransientWindow(title, GlobalMainFrame().getTopLevelWindow()), _label(Gtk::manage(new Gtk::Label)), _progressBar(Gtk::manage(new Gtk::ProgressBar)), _aborted(false) { // Window properties set_modal(true); set_position(Gtk::WIN_POS_CENTER_ON_PARENT); set_default_size(360, 80); set_border_width(12); // Create a vbox Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 12)); // Pack a progress bar into the window vbx->pack_start(*_progressBar, false, false, 0); // Pack the label into the window vbx->pack_start(*_label, true, false, 0); add(*vbx); // Pack a right-aligned cancel button at the bottom Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL)); cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &ModalProgressDialog::_onCancel)); vbx->pack_end(*Gtk::manage(new gtkutil::RightAlignment(*cancelButton)), false, false, 0); // Connect the realize signal to remove the window decorations signal_realize().connect(sigc::mem_fun(*this, &ModalProgressDialog::_onRealize)); // Show the window show_all(); handleEvents(); }
StimResponseEditor::StimResponseEditor() : gtkutil::BlockingTransientWindow(_(WINDOW_TITLE), GlobalMainFrame().getTopLevelWindow()), _entity(NULL), _stimEditor(Gtk::manage(new StimEditor(_stimTypes))), _responseEditor(Gtk::manage(new ResponseEditor(getRefPtr(), _stimTypes))), _customStimEditor(Gtk::manage(new CustomStimEditor(_stimTypes))) { // Set the default border width in accordance to the HIG set_border_width(12); set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); signal_key_press_event().connect(sigc::mem_fun(*this, &StimResponseEditor::onWindowKeyPress), false); // Create the widgets populateWindow(); // Connect the window position tracker _windowPosition.loadFromPath(RKEY_WINDOW_STATE); _windowPosition.connect(this); _windowPosition.applyPosition(); // Show the dialog, this enters the gtk main loop show(); }
void PatchInspector::emitTesselation() { UndoableCommand setFixedTessCmd("patchSetFixedTesselation"); wxSpinCtrl* fixedSubdivX = findNamedObject<wxSpinCtrl>(this, "PatchInspectorSubdivisionsX"); wxSpinCtrl* fixedSubdivY = findNamedObject<wxSpinCtrl>(this, "PatchInspectorSubdivisionsY"); Subdivisions tess( fixedSubdivX->GetValue(), fixedSubdivY->GetValue() ); bool fixed = findNamedObject<wxCheckBox>(this, "PatchInspectorFixedSubdivisions")->GetValue(); // Save the setting into the selected patch(es) GlobalSelectionSystem().foreachPatch([&] (Patch& patch) { patch.setFixedSubdivisions(fixed, tess); }); fixedSubdivX->Enable(fixed); fixedSubdivY->Enable(fixed); findNamedObject<wxStaticText>(this, "PatchInspectorSubdivisionsXLabel")->Enable(fixed); findNamedObject<wxStaticText>(this, "PatchInspectorSubdivisionsYLabel")->Enable(fixed); GlobalMainFrame().updateAllWindows(); }
void PatchInspector::emitCoords() { PatchNodePtr patch = _patch.lock(); if (patch == NULL) return; // Save the coords into the patch UndoableCommand emitCoordsCmd("patchAdjustControlVertex"); patch->getPatchInternal().undoSave(); int row = _rowCombo->GetSelection(); int col = _colCombo->GetSelection(); // Retrieve the controlvertex PatchControl& ctrl = patch->getPatchInternal().ctrlAt(row, col); ctrl.vertex[0] = string::convert<float>(_coords["x"].value->GetValue()); ctrl.vertex[1] = string::convert<float>(_coords["y"].value->GetValue()); ctrl.vertex[2] = string::convert<float>(_coords["z"].value->GetValue()); ctrl.texcoord[0] = string::convert<float>(_coords["s"].value->GetValue()); ctrl.texcoord[1] = string::convert<float>(_coords["t"].value->GetValue()); patch->getPatchInternal().controlPointsChanged(); GlobalMainFrame().updateAllWindows(); }
void EntitySettings::keyChanged() { refreshFromRegistry(); // Redraw the scene GlobalMainFrame().updateAllWindows(); }
// Create GTK widgets ParticlesChooser::ParticlesChooser() : _widget(gtk_window_new(GTK_WINDOW_TOPLEVEL)), _particlesList(gtk_list_store_new(1, G_TYPE_STRING)), _selectedParticle("") { // Set up main window gtk_window_set_transient_for(GTK_WINDOW(_widget), GlobalMainFrame().getTopLevelWindow()); gtk_window_set_modal(GTK_WINDOW(_widget), TRUE); gtk_window_set_title(GTK_WINDOW(_widget), _("Choose particles")); gtk_window_set_position(GTK_WINDOW(_widget), GTK_WIN_POS_CENTER_ON_PARENT); g_signal_connect(G_OBJECT(_widget), "delete-event", G_CALLBACK(_onDestroy), this); // Set the default size of the window GdkScreen* scr = gtk_window_get_screen(GTK_WINDOW(_widget)); gint w = gdk_screen_get_width(scr); gint h = gdk_screen_get_height(scr); gtk_window_set_default_size(GTK_WINDOW(_widget), w / 3, h / 2); // Main dialog vbox GtkWidget* vbx = gtk_vbox_new(FALSE, 12); gtk_box_pack_start(GTK_BOX(vbx), createTreeView(), TRUE, TRUE, 0); gtk_box_pack_end(GTK_BOX(vbx), createButtons(), FALSE, FALSE, 0); // Add main vbox to dialog gtk_container_set_border_width(GTK_CONTAINER(_widget), 12); gtk_container_add(GTK_CONTAINER(_widget), vbx); }
BulgePatchDialog::BulgePatchDialog() : gtkutil::Dialog(_(WINDOW_TITLE), GlobalMainFrame().getTopLevelWindow()) { _noiseHandle = addEntryBox(_(LABEL_NOISE)); setElementValue(_noiseHandle, string::to_string(NOISE)); }
void MapExporter::enableProgressDialog() { _dialog = gtkutil::ModalProgressDialogPtr( new gtkutil::ModalProgressDialog( GlobalMainFrame().getTopLevelWindow(), _("Writing map") ) ); }
MD5AnimationViewer::MD5AnimationViewer() : gtkutil::BlockingTransientWindow(_("MD5 Animation Viewer"), GlobalMainFrame().getTopLevelWindow()), _modelList(Gtk::TreeStore::create(_modelColumns)), _modelPopulator(_modelList), _animList(Gtk::ListStore::create(_animColumns)), _preview(new AnimationPreview) { // Set the default border width in accordance to the HIG set_border_width(12); set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); // Set the default size of the window const Glib::RefPtr<Gtk::Window>& mainWindow = GlobalMainFrame().getTopLevelWindow(); Gdk::Rectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(mainWindow); int height = static_cast<int>(rect.get_height() * 0.6f); set_default_size( static_cast<int>(rect.get_width() * 0.8f), height ); // Set the default size of the window _preview->setSize(rect.get_width() * 0.2f, height); // Main dialog vbox Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 12)); // Create a horizontal box to pack the treeview on the left and the preview on the right Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 6)); hbox->pack_start(createListPane(), true, true, 0); Gtk::VBox* previewBox = Gtk::manage(new Gtk::VBox(false, 0)); previewBox->pack_start(*_preview, true, true, 0); hbox->pack_start(*previewBox, true, true, 0); vbox->pack_start(*hbox, true, true, 0); vbox->pack_end(createButtons(), false, false, 0); // Add main vbox to dialog add(*vbox); // Populate with model names populateModelList(); }
void Clipper::splitBrushes(const Vector3& p0, const Vector3& p1, const Vector3& p2, EBrushSplit split) { Vector3 planePoints[3] = {p0, p1, p2}; brush::algorithm::splitBrushesByPlane(planePoints, split); GlobalMainFrame().updateAllWindows(); }
// Create GTK stuff in c-tor OverlayDialog::OverlayDialog() : PersistentTransientWindow(_(DIALOG_TITLE), GlobalMainFrame().getTopLevelWindow(), true), _callbackActive(false) { set_border_width(12); // Set default size Gdk::Rectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(GlobalMainFrame().getTopLevelWindow()); set_default_size(static_cast<int>(rect.get_width()/3), -1); // Pack in widgets Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 12)); vbox->pack_start(createWidgets(), true, true, 0); vbox->pack_end(createButtons(), false, false, 0); add(*vbox); }
// Constructor creates widgets ObjectivesEditor::ObjectivesEditor() : gtkutil::BlockingTransientWindow( _(DIALOG_TITLE), GlobalMainFrame().getTopLevelWindow() ), gtkutil::GladeWidgetHolder("ObjectivesEditor.glade"), _objectiveEntityList(Gtk::ListStore::create(_objEntityColumns)), _objectiveList(Gtk::ListStore::create(_objectiveColumns)) { // Window properties set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); set_position(Gtk::WIN_POS_CENTER_ON_PARENT); // Add vbox to dialog add(*gladeWidget<Gtk::Widget>("mainVbox")); g_assert(get_child() != NULL); // Setup signals and tree views setupEntitiesPanel(); setupObjectivesPanel(); // Buttons not associated with a treeview panel Gtk::Button* logicButton = gladeWidget<Gtk::Button>( "editSuccessLogicButton" ); logicButton->signal_clicked().connect( sigc::mem_fun(*this, &ObjectivesEditor::_onEditLogic) ); Gtk::Button* conditionsButton = gladeWidget<Gtk::Button>( "editObjectiveConditionsButton" ); conditionsButton->signal_clicked().connect( sigc::mem_fun(*this, &ObjectivesEditor::_onEditObjConditions) ); gladeWidget<Gtk::Button>("cancelButton")->signal_clicked().connect( sigc::mem_fun(*this, &ObjectivesEditor::_onCancel) ); gladeWidget<Gtk::Button>("okButton")->signal_clicked().connect( sigc::mem_fun(*this, &ObjectivesEditor::_onOK) ); // Connect the window position tracker _windowPosition.loadFromPath(RKEY_WINDOW_STATE); _windowPosition.connect(this); _windowPosition.applyPosition(); _objectiveEClasses.clear(); xml::NodeList nodes = GlobalRegistry().findXPath(RKEY_OBJECTIVE_ENTS); for (xml::NodeList::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { _objectiveEClasses.push_back(i->getAttributeValue("name")); } }
// Add a new objectives entity button void ObjectivesEditor::_onAddEntity() { if (_objectiveEClasses.empty()) { // Objective entityclass(es) not defined gtkutil::MessageBox::ShowError( _("Unable to create Objective Entity: classes not defined in registry."), GlobalMainFrame().getTopLevelWindow() ); return; } const std::string& objEClass = _objectiveEClasses.front(); // Obtain the entity class object IEntityClassPtr eclass = GlobalEntityClassManager().findClass(objEClass); if (eclass) { // Construct a Node of this entity type IEntityNodePtr node(GlobalEntityCreator().createEntity(eclass)); // Create a random offset node->getEntity().setKeyValue("origin", RandomOrigin::generate(128)); // Insert the node into the scene graph assert(GlobalSceneGraph().root()); GlobalSceneGraph().root()->addChildNode(node); // Refresh the widgets populateWidgets(); } else { // Objective entityclass was not found gtkutil::MessageBox::ShowError( (boost::format(_("Unable to create Objective Entity: class '%s' not found.")) % objEClass).str(), GlobalMainFrame().getTopLevelWindow() ); } }
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); }
ParticlesChooser::ParticlesChooser() : gtkutil::BlockingTransientWindow(_("Choose particles"), GlobalMainFrame().getTopLevelWindow()), _particlesList(Gtk::ListStore::create(COLUMNS())), _selectedParticle(""), _preview(new gtkutil::ParticlePreview) { set_border_width(12); // Set the default size of the window const Glib::RefPtr<Gtk::Window>& mainWindow = GlobalMainFrame().getTopLevelWindow(); Gdk::Rectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(mainWindow); int height = static_cast<int>(rect.get_height() * 0.6f); set_default_size( static_cast<int>(rect.get_width() * 0.4f), height ); // Set the default size of the window _preview->setSize(rect.get_width() * 0.2f, height); // Main dialog vbox Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 12)); // Create a horizontal box to pack the treeview on the left and the preview on the right Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox(false, 6)); hbox->pack_start(createTreeView(), true, true, 0); Gtk::VBox* previewBox = Gtk::manage(new Gtk::VBox(false, 0)); previewBox->pack_start(*_preview, true, true, 0); hbox->pack_start(*previewBox, true, true, 0); vbox->pack_start(*hbox, true, true, 0); vbox->pack_end(createButtons(), false, false, 0); // Add main vbox to dialog add(*vbox); }
FindAndReplaceShader::FindAndReplaceShader() : gtkutil::BlockingTransientWindow(_(FINDDLG_WINDOW_TITLE), GlobalMainFrame().getTopLevelWindow()) { set_default_size(FINDDLG_DEFAULT_SIZE_X, FINDDLG_DEFAULT_SIZE_Y); set_border_width(12); set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); // Create all the widgets populateWindow(); // Propagate shortcuts to the main window GlobalEventManager().connectDialogWindow(this); }
// Constructor SoundChooser::SoundChooser() : BlockingTransientWindow(_("Choose sound"), GlobalMainFrame().getTopLevelWindow()), _treeStore(Gtk::TreeStore::create(_columns)), _treeView(NULL), _preview(Gtk::manage(new SoundShaderPreview)) { set_border_width(12); set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG); // Set the default size of the window Gdk::Rectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(GlobalMainFrame().getTopLevelWindow()); set_default_size(rect.get_width() / 2, rect.get_height() / 2); // Main vbox Gtk::VBox* vbx = Gtk::manage(new Gtk::VBox(false, 12)); vbx->pack_start(createTreeView(), true, true, 0); vbx->pack_start(*_preview, false, false, 0); vbx->pack_start(createButtons(), false, false, 0); add(*vbx); }
void stitchTextures(const cmd::ArgumentList& args) { // Get all the selected patches PatchPtrVector patchList = selection::algorithm::getSelectedPatches(); if (patchList.size() == 2) { UndoableCommand undo("patchStitchTexture"); // Fetch the instances from the selectionsystem const scene::INodePtr& targetNode = GlobalSelectionSystem().ultimateSelected(); const scene::INodePtr& sourceNode = GlobalSelectionSystem().penultimateSelected(); // Cast the instances onto a patch Patch* source = Node_getPatch(sourceNode); Patch* target = Node_getPatch(targetNode); if (source != NULL && target != NULL) { // Stitch the texture leaving the source patch intact target->stitchTextureFrom(*source); } else { gtkutil::MessageBox::ShowError(_("Cannot stitch textures. \nCould not cast nodes to patches."), GlobalMainFrame().getTopLevelWindow()); } SceneChangeNotify(); // Update the Texture Tools ui::SurfaceInspector::update(); } else { gtkutil::MessageBox::ShowError(_("Cannot stitch patch textures. \nExactly 2 patches must be selected."), GlobalMainFrame().getTopLevelWindow()); } }