void SelectionSetToolmenu::onEntryActivated()
{
	// Create new selection set if possible
	std::string name = _entry->get_entry()->get_text();

	if (name.empty()) return;

	// don't create empty sets
	if (GlobalSelectionSystem().countSelected() == 0)
	{
		ui::IDialogPtr dialog = GlobalDialogManager().createMessageBox(
			_("Cannot create selection set"),
			_("Cannot create a selection set, there is nothing selected in the current scene."),
			ui::IDialog::MESSAGE_CONFIRM);

		dialog->run();
		return;
	}

	ISelectionSetPtr set = GlobalSelectionSetManager().createSelectionSet(name);

	assert(set != NULL);

	set->assignFromCurrentScene();

	// Clear the entry again
	_entry->get_entry()->set_text("");
}
Ejemplo n.º 2
0
void SelectionSetToolmenu::onSelectionChanged(GtkComboBox* comboBox, 
											  SelectionSetToolmenu* self)
{
	GtkTreeIter iter;

	if (gtk_combo_box_get_active_iter(comboBox, &iter))
	{
		std::string name = gtkutil::ComboBox::getActiveText(comboBox);

		if (name.empty()) return;

		ISelectionSetPtr set = GlobalSelectionSetManager().findSelectionSet(name);

		if (set == NULL) return;

		// The user can choose to DESELECT the set nodes when holding down shift
		if ((GlobalEventManager().getModifierState() & GDK_SHIFT_MASK) != 0)
		{
			set->deselect();
		}
		else
		{
			set->select();
		}

		GtkWidget* childEntry = gtk_bin_get_child(GTK_BIN(self->_entry));
		gtk_entry_set_text(GTK_ENTRY(childEntry), "");
	}
}
Ejemplo n.º 3
0
		void visit(const ISelectionSetPtr& set)
		{
			_hasItems = true;

			GtkTreeIter iter;
			gtk_list_store_append(_store, &iter);
			gtk_list_store_set(_store, &iter, 
							   0, set->getName().c_str(),
							   -1);
		}
void SelectionSetToolmenu::onSelectionChanged()
{
	std::string name = _entry->get_active_text();

	if (name.empty()) return;

	ISelectionSetPtr set = GlobalSelectionSetManager().findSelectionSet(name);

	if (set == NULL) return;

	// The user can choose to DESELECT the set nodes when holding down shift
	if ((GlobalEventManager().getModifierState() & GDK_SHIFT_MASK) != 0)
	{
		set->deselect();
	}
	else
	{
		set->select();
	}

	_entry->get_entry()->set_text("");
}
Ejemplo n.º 5
0
void SelectionSetToolmenu::onEntryActivated(GtkEntry* entry,
											SelectionSetToolmenu* self)
{
	// Create new selection set if possible
	std::string name = gtk_entry_get_text(entry);

	if (name.empty()) return;

	// don't create empty sets
	if (GlobalSelectionSystem().countSelected() == 0)
	{
		gtkutil::errorDialog(_("Cannot create selection set, there is nothing selected in the current scene."));
		return;
	}

	ISelectionSetPtr set = GlobalSelectionSetManager().createSelectionSet(name);

	set->assignFromCurrentScene();

	// Clear the entry again
	gtk_entry_set_text(GTK_ENTRY(entry), "");
}