Example #1
0
EffectEditor::EffectEditor(wxWindow* parent,
						   StimResponse& response,
						   const unsigned int effectIndex,
						   StimTypes& stimTypes,
						   ui::ResponseEditor& editor) :
	DialogBase(_(WINDOW_TITLE), parent),
	_argTable(NULL),
	_response(response),
	_effectIndex(effectIndex),
	_backup(_response.getResponseEffect(_effectIndex)),
	_editor(editor),
	_stimTypes(stimTypes)
{
	SetSizer(new wxBoxSizer(wxVERTICAL));

	// Create the widgets
	populateWindow();

	// Search the scenegraph for entities
	populateEntityListStore();

	// Initialise the widgets with the current data
	ResponseEffect& effect = _response.getResponseEffect(_effectIndex);

	// Setup the selectionfinder to search for the name string
	wxutil::ChoiceHelper::SelectItemByStoredString(_effectTypeCombo, effect.getName());

	_stateToggle->SetValue(effect.isActive());

	// Parse the argument types from the effect and create the widgets
	createArgumentWidgets(effect);

	Layout();
	Fit();
}
Example #2
0
EffectEditor::EffectEditor(const Glib::RefPtr<Gtk::Window>& parent,
						   StimResponse& response,
						   const unsigned int effectIndex,
						   StimTypes& stimTypes,
						   ui::ResponseEditor& editor) :
	gtkutil::BlockingTransientWindow(_(WINDOW_TITLE), parent),
	_argTable(NULL),
	_effectStore(Gtk::ListStore::create(_effectColumns)),
	_entityStore(Gtk::ListStore::create(_entityColumns)),
	_response(response),
	_effectIndex(effectIndex),
	_backup(_response.getResponseEffect(_effectIndex)),
	_editor(editor),
	_stimTypes(stimTypes)
{
	set_border_width(12);
	set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);

	// Retrieve the map from the ResponseEffectTypes object
	ResponseEffectTypeMap& effectTypes =
		ResponseEffectTypes::Instance().getMap();

	// Now populate the list store with all the possible effect types
	for (ResponseEffectTypeMap::iterator i = effectTypes.begin();
		  i != effectTypes.end(); ++i)
	{
		Gtk::TreeModel::Row row = *_effectStore->append();

		row[_effectColumns.name] = i->first;
		row[_effectColumns.caption] = i->second->getAttribute("editor_caption").getValue();
	}

	// Create the widgets
	populateWindow();

	// Search the scenegraph for entities
	populateEntityListStore();

	// Initialise the widgets with the current data
	ResponseEffect& effect = _response.getResponseEffect(_effectIndex);

	// Setup the selectionfinder to search for the name string
	gtkutil::TreeModel::SelectionFinder finder(effect.getName(), _effectColumns.name.index());

	_effectStore->foreach_iter(
		sigc::mem_fun(finder, &gtkutil::TreeModel::SelectionFinder::forEach));

	// Set the active row of the combo box to the current response effect type
	_effectTypeCombo->set_active(finder.getIter());

	_stateToggle->set_active(effect.isActive());

	// Create the alignment container that hold the (exchangable) widget table
	_argAlignment = Gtk::manage(new Gtk::Alignment(0.0f, 0.5f, 1.0f, 1.0f));
	_argAlignment->set_padding(0, 0, 18, 0);

	_dialogVBox->pack_start(*_argAlignment, false, false, 3);

	// Parse the argument types from the effect and create the widgets
	createArgumentWidgets(effect);

	// Connect the signal to get notified of further changes
	_effectTypeCombo->signal_changed().connect(sigc::mem_fun(*this, &EffectEditor::onEffectTypeChange));

	show();
}