Пример #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();
}
Пример #2
0
CommandEditor::CommandEditor(wxWindow* parent, conversation::ConversationCommand& command, const conversation::Conversation& conv) :
	DialogBase(_(WINDOW_TITLE), parent),
	_conversation(conv),
	_command(command), // copy the conversation command to a local object
	_targetCommand(command)
{
	// Create all widgets
	populateWindow();

	// Fill the actor dropdown
	for (conversation::Conversation::ActorMap::const_iterator i = _conversation.actors.begin();
		 i != _conversation.actors.end(); ++i)
	{
		std::string actorStr = (boost::format(_("Actor %d (%s)")) % i->first % i->second).str();

		// Store the actor ID into a client data object and pass it along
		findNamedObject<wxChoice>(this, "ConvCmdEditorActorChoice")->Append(actorStr, 
			new wxStringClientData(string::to_string(i->first)));
	}

	// Let the command library fill the command dropdown
	conversation::ConversationCommandLibrary::Instance().populateChoice(
		findNamedObject<wxChoice>(this, "ConvCmdEditorCommandChoice"));

	// Fill the values
	updateWidgets();
}
MissionInfoEditDialog::MissionInfoEditDialog(wxWindow* parent) :
	DialogBase(_(WINDOW_TITLE), parent),
	_missionTitleStore(new wxutil::TreeModel(_missionTitleColumns, true)),
	_updateInProgress(false)
{
	populateWindow();

	try
	{
		_darkmodTxt = map::DarkmodTxt::LoadForCurrentMod();
	}
	catch (map::DarkmodTxt::ParseException& ex)
	{
		rError() << "Failed to parse darkmod.txt: " << ex.what() << std::endl;

		wxutil::Messagebox::ShowError(
			fmt::format(_("Failed to parse darkmod.txt:\n{0}"), ex.what()), this);

		// Reset the file to defaults
		_darkmodTxt = std::make_shared<map::DarkmodTxt>();
	}

	_guiView->setGui(GlobalGuiManager().getGui("guis/mainmenu.gui"));
	_guiView->setMissionInfoFile(_darkmodTxt);

	updateValuesFromDarkmodTxt();
}
Пример #4
0
FilterEditor::FilterEditor(Filter& filter, GtkWindow* parent, bool viewOnly) :
	BlockingTransientWindow(viewOnly ? _(WINDOW_TITLE_VIEW) : _(WINDOW_TITLE_EDIT), parent),
	_originalFilter(filter),
	_filter(_originalFilter), // copy-construct
	_ruleStore(gtk_list_store_new(NUM_COLS, G_TYPE_INT,	// index
												G_TYPE_INT, // type
												G_TYPE_STRING, // type string
												G_TYPE_STRING, // regex match
												G_TYPE_STRING)),  // show/hide
	_selectedRule(-1),
	_result(NUM_RESULTS),
	_updateActive(false),
	_viewOnly(viewOnly)
{
	gtk_window_set_default_size(GTK_WINDOW(getWindow()), DEFAULT_SIZE_X, DEFAULT_SIZE_Y);
	gtk_container_set_border_width(GTK_CONTAINER(getWindow()), 12);
	gtk_window_set_type_hint(GTK_WINDOW(getWindow()), GDK_WINDOW_TYPE_HINT_DIALOG);

	// Create the widgets
	populateWindow();

	// Update the widget contents
	update();

	// Show and block
	show();
}
Пример #5
0
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();
}
Пример #6
0
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);
}
Пример #7
0
QuerySidesDialog::QuerySidesDialog(int numSidesMin, int numSidesMax) :
	BlockingTransientWindow(_(WINDOW_TITLE), GlobalMainFrame().getTopLevelWindow()),
	_entry(NULL),
	_result(NUM_RESULTS),
	_numSides(-1),
	_numSidesMin(numSidesMin),
	_numSidesMax(numSidesMax)
{
	gtk_container_set_border_width(GTK_CONTAINER(getWindow()), 12);
	gtk_window_set_type_hint(GTK_WINDOW(getWindow()), GDK_WINDOW_TYPE_HINT_DIALOG);
	
	// Create all the widgets
	populateWindow();
}
Пример #8
0
FindAndReplaceShader::FindAndReplaceShader() :
	gtkutil::BlockingTransientWindow(_(FINDDLG_WINDOW_TITLE), GlobalRadiant().getMainWindow())
{
	gtk_window_set_default_size(GTK_WINDOW(getWindow()), FINDDLG_DEFAULT_SIZE_X, FINDDLG_DEFAULT_SIZE_Y);
	gtk_container_set_border_width(GTK_CONTAINER(getWindow()), 12);
	gtk_window_set_type_hint(GTK_WINDOW(getWindow()), GDK_WINDOW_TYPE_HINT_DIALOG);

	// Create all the widgets
	populateWindow();

	// Propagate shortcuts to the main window
	GlobalEventManager().connectDialogWindow(GTK_WINDOW(getWindow()));

	// Show the window and its children
	show();
}
Пример #9
0
MapInfoDialog::MapInfoDialog() :
	BlockingTransientWindow(_(MAPINFO_WINDOW_TITLE), GlobalMainFrame().getTopLevelWindow())
{
	gtk_window_set_default_size(GTK_WINDOW(getWindow()), MAPINFO_DEFAULT_SIZE_X, MAPINFO_DEFAULT_SIZE_Y);
	gtk_container_set_border_width(GTK_CONTAINER(getWindow()), 12);
	gtk_window_set_type_hint(GTK_WINDOW(getWindow()), GDK_WINDOW_TYPE_HINT_DIALOG);
	
	// Create all the widgets
	populateWindow();
	
	// Propagate shortcuts to the main window
	GlobalEventManager().connectDialogWindow(GTK_WINDOW(getWindow()));
	
	// Show the window and its children, enter the main loop
	show();
}
Пример #10
0
StimResponseEditor::StimResponseEditor() :
	DialogBase(_(WINDOW_TITLE)),
	_notebook(new wxNotebook(this, wxID_ANY)),
	_entity(NULL),
	_stimEditor(new StimEditor(_notebook, _stimTypes)),
	_responseEditor(new ResponseEditor(_notebook, _stimTypes)),
	_customStimEditor(new CustomStimEditor(_notebook, _stimTypes))
{
	// Create the widgets
	populateWindow();

	// Connect the window position tracker
	_windowPosition.loadFromPath(RKEY_WINDOW_STATE);

	_windowPosition.connect(this);
	_windowPosition.applyPosition();
}
Пример #11
0
	TextureOverviewDialog::TextureOverviewDialog () :
			gtkutil::PersistentTransientWindow(_("Texture overview"), GlobalRadiant().getMainWindow()), _store(
					gtk_list_store_new(TEXTUREOVERVIEW_SIZE, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT))
	{
		gtk_window_set_default_size(GTK_WINDOW(getWindow()), DLG_DEFAULT_SIZE_X, DLG_DEFAULT_SIZE_Y);
		gtk_container_set_border_width(GTK_CONTAINER(getWindow()), 12);
		gtk_window_set_type_hint(GTK_WINDOW(getWindow()), GDK_WINDOW_TYPE_HINT_DIALOG);

		// Create all the widgets
		populateWindow();

		// Propagate shortcuts to the main window
		GlobalEventManager().connectDialogWindow(GTK_WINDOW(getWindow()));

		// Show the window and its children
		show();
	}
Пример #12
0
PatchInspector::PatchInspector() : 
	TransientWindow(_(WINDOW_TITLE), GlobalMainFrame().getWxTopLevelWindow(), true),
	_rowCombo(NULL),
	_colCombo(NULL),
	_selectionInfo(GlobalSelectionSystem().getSelectionInfo()),
	_patchRows(0),
	_patchCols(0),
	_updateActive(false),
	_updateNeeded(false)
{
	Connect(wxEVT_IDLE, wxIdleEventHandler(PatchInspector::onIdle), NULL, this);

	// Create all the widgets and pack them into the window
	populateWindow();

	// Update the widget status
	rescanSelection();

	InitialiseWindowPosition(410, 480, RKEY_WINDOW_STATE);
}
Пример #13
0
EntityList::EntityList() : 
	gtkutil::PersistentTransientWindow(_(WINDOW_TITLE), GlobalMainFrame().getTopLevelWindow(), true),
	_callbackActive(false)
{
	// Set the default border width in accordance to the HIG
	gtk_container_set_border_width(GTK_CONTAINER(getWindow()), 12);
	gtk_window_set_type_hint(GTK_WINDOW(getWindow()), GDK_WINDOW_TYPE_HINT_DIALOG);
	
	// Create all the widgets and pack them into the window
	populateWindow();
	
	// Register this dialog to the EventManager, so that shortcuts can propagate to the main window
	GlobalEventManager().connectDialogWindow(GTK_WINDOW(getWindow()));
	
	// Connect the window position tracker
	_windowPosition.loadFromPath(RKEY_WINDOW_STATE);
	
	_windowPosition.connect(GTK_WINDOW(getWindow()));
	_windowPosition.applyPosition();
}
DifficultyDialog::DifficultyDialog() :
	gtkutil::BlockingTransientWindow(_(WINDOW_TITLE), GlobalMainFrame().getTopLevelWindow())
{
	// Load the settings
	_settingsManager.loadSettings();

	// Set the default border width in accordance to the HIG
	set_border_width(12);
	set_type_hint(Gdk::WINDOW_TYPE_HINT_DIALOG);
	set_modal(true);

	signal_key_press_event().connect(sigc::mem_fun(*this, &DifficultyDialog::onWindowKeyPress), false);

	// Create the widgets
	populateWindow();

	// Connect the window position tracker
	_windowPosition.loadFromPath(RKEY_WINDOW_STATE);

	_windowPosition.connect(this);
	_windowPosition.applyPosition();
}
Пример #15
0
DifficultyEditor::DifficultyEditor(const std::string& label,
								   const difficulty::DifficultySettingsPtr& settings) :
	_settings(settings),
	_updateActive(false)
{
	// The tab label items (icon + label)
	_labelHBox = Gtk::manage(new Gtk::HBox(false, 3));
	_label = Gtk::manage(new Gtk::Label(label));

	_labelHBox->pack_start(
		*Gtk::manage(new Gtk::Image(GlobalUIManager().getLocalPixbufWithMask(DIFF_ICON))),
    	false, false, 3
    );
	_labelHBox->pack_start(*_label, false, false, 3);

	// The actual editor pane
	_editor = Gtk::manage(new Gtk::VBox(false, 12));

	_settings->updateTreeModel();

	populateWindow();
	updateEditorWidgets();
}
Пример #16
0
EClassTree::EClassTree() :
	gtkutil::BlockingTransientWindow(_(ECLASSTREE_TITLE), GlobalMainFrame().getTopLevelWindow())
{
	// Set the default border width in accordance to the HIG
	gtk_container_set_border_width(GTK_CONTAINER(getWindow()), 12);
	gtk_window_set_type_hint(GTK_WINDOW(getWindow()), GDK_WINDOW_TYPE_HINT_DIALOG);
		
	// Create a new tree store for the entityclasses
	_eclassStore = gtk_tree_store_new(
		N_COLUMNS, 
		G_TYPE_STRING,		// name
		GDK_TYPE_PIXBUF		// icon
	);
	
	// Construct an eclass visitor and traverse the entity classes
	EClassTreeBuilder builder(_eclassStore);
	
	// Construct the window's widgets
	populateWindow();
	
	// Enter main loop
	show();
}
Пример #17
0
ErrorCheckDialog::ErrorCheckDialog () :
	gtkutil::BlockingTransientWindow(_("Error checking"), GlobalRadiant().getMainWindow())
{
	gtk_window_set_default_size(GTK_WINDOW(getWindow()), CHECKDLG_DEFAULT_SIZE_X, CHECKDLG_DEFAULT_SIZE_Y);
	gtk_container_set_border_width(GTK_CONTAINER(getWindow()), 12);
	gtk_window_set_type_hint(GTK_WINDOW(getWindow()), GDK_WINDOW_TYPE_HINT_DIALOG);

	// Create all the widgets
	populateWindow();

	// Propagate shortcuts to the main window
	GlobalEventManager().connectDialogWindow(GTK_WINDOW(getWindow()));

	try {
		const std::string mapName = GlobalMap().getName();
		CompilerObserver observer(_listStore);
		GlobalMapCompiler().performCheck(mapName, observer);
		// Show the window and its children
		show();
	} catch (MapCompileException& e) {
		hide();
		gtkutil::errorDialog(e.what());
	}
}
Пример #18
0
TransformDialog::TransformDialog() : gtkutil::PersistentTransientWindow(WINDOW_TITLE, MainFrame_getWindow(), true)
{
    // Set the default border width in accordance to the HIG
    gtk_container_set_border_width(GTK_CONTAINER(getWindow()), 12);
    gtk_window_set_type_hint(GTK_WINDOW(getWindow()), GDK_WINDOW_TYPE_HINT_DIALOG);

    // Create all the widgets and pack them into the window
    populateWindow();

    // Register this dialog to the EventManager, so that shortcuts can propagate to the main window
    GlobalEventManager().connectDialogWindow(GTK_WINDOW(getWindow()));

    // Register self to the SelSystem to get notified upon selection changes.
    GlobalSelectionSystem().addObserver(this);

    // Update the widget sensitivity
    update();

    // Connect the window position tracker
    _windowPosition.loadFromPath(RKEY_WINDOW_STATE);

    _windowPosition.connect(GTK_WINDOW(getWindow()));
    _windowPosition.applyPosition();
}
ConversationDialog::ConversationDialog() :
	gtkutil::BlockingTransientWindow(_(WINDOW_TITLE), GlobalMainFrame().getTopLevelWindow()),
	_convEntityList(Gtk::ListStore::create(_convEntityColumns)),
	_entityView(NULL),
	_convList(Gtk::ListStore::create(_convColumns))
{
	// 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, &ConversationDialog::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();
}
Пример #20
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();
}