Exemplo n.º 1
0
void PatchInspector::populateWindow()
{
	SetSizer(new wxBoxSizer(wxVERTICAL));
	GetSizer()->Add(loadNamedPanel(this, "PatchInspectorMainPanel"), 1, wxEXPAND);

	makeLabelBold(this, "PatchInspectorVertexLabel");
	makeLabelBold(this, "PatchInspectorCoordLabel");
	makeLabelBold(this, "PatchInspectorTessLabel");

	_rowCombo = findNamedObject<wxChoice>(this, "PatchInspectorControlRow");
	_colCombo = findNamedObject<wxChoice>(this, "PatchInspectorControlColumn");

	// Create the controls table
	wxPanel* coordPanel = findNamedObject<wxPanel>(this, "PatchInspectorCoordPanel");
	wxFlexGridSizer* table = new wxFlexGridSizer(5, 5, 6, 16);
	table->AddGrowableCol(1);

	coordPanel->GetSizer()->Add(table, 1, wxEXPAND);

    _coords["x"] = createCoordRow("X:", coordPanel, table);
    _coords["y"] = createCoordRow("Y:", coordPanel, table);
    _coords["z"] = createCoordRow("Z:", coordPanel, table);
    _coords["s"] = createCoordRow("S:", coordPanel, table);
    _coords["t"] = createCoordRow("T:", coordPanel, table);

    // Connect the step values to the according registry values
	registry::bindWidget(_coords["x"].stepEntry, RKEY_X_STEP);
    registry::bindWidget(_coords["y"].stepEntry, RKEY_Y_STEP);
    registry::bindWidget(_coords["z"].stepEntry, RKEY_Z_STEP);
    registry::bindWidget(_coords["s"].stepEntry, RKEY_S_STEP);
    registry::bindWidget(_coords["t"].stepEntry, RKEY_T_STEP);

    // Connect all the arrow buttons
    for (CoordMap::iterator i = _coords.begin(); i != _coords.end(); ++i)
	{
    	CoordRow& row = i->second;

    	// Pass a CoordRow ref to the callback, that's all it will need to update
		row.smaller->Bind(wxEVT_BUTTON, boost::bind(&PatchInspector::onClickSmaller, this, row));
		row.larger->Bind(wxEVT_BUTTON, boost::bind(&PatchInspector::onClickLarger, this, row));
    }

	// Tesselation checkbox
	findNamedObject<wxCheckBox>(this, "PatchInspectorFixedSubdivisions")->Connect(
		wxEVT_CHECKBOX, wxCommandEventHandler(PatchInspector::onFixedTessChange), NULL, this);

	// Tesselation values
	findNamedObject<wxSpinCtrl>(this, "PatchInspectorSubdivisionsX")->Connect(
		wxEVT_SPINCTRL, wxSpinEventHandler(PatchInspector::onTessChange), NULL, this);
	findNamedObject<wxSpinCtrl>(this, "PatchInspectorSubdivisionsY")->Connect(
		wxEVT_SPINCTRL, wxSpinEventHandler(PatchInspector::onTessChange), NULL, this);
}
Exemplo n.º 2
0
PatchCreateDialog::PatchCreateDialog() :
	Dialog(_(WINDOW_TITLE))
{
	_dialog->GetSizer()->Add(loadNamedPanel(_dialog, "PatchCreatePanel"), 1, wxEXPAND | wxALL, 12);

    // Create the title label (bold font)
	makeLabelBold(_dialog, "PatchCreateTopLabel");

	wxChoice* comboWidth = findNamedObject<wxChoice>(_dialog, "PatchCreateWidthChoice");
	wxChoice* comboHeight = findNamedObject<wxChoice>(_dialog, "PatchCreateHeightChoice");

	// Fill the values into the combo boxes
	for (int i = MIN_PATCH_DIM; i <= MAX_PATCH_DIM; i += INCR_PATCH_DIM)
	{
		comboWidth->Append(string::to_string(i));
		comboHeight->Append(string::to_string(i));
	}

	// Activate the first item in the combo boxes
	comboWidth->Select(0);
	comboHeight->Select(0);

	// Create the "remove brushes" label
	wxCheckBox* removeCheckBox = findNamedObject<wxCheckBox>(_dialog, "PatchCreateRemoveSelectedBrush");
	removeCheckBox->SetValue(DEFAULT_REMOVE_BRUSHES);
}
Exemplo n.º 3
0
void CommandEditor::populateWindow()
{
	loadNamedPanel(this, "ConvCmdEditorMainPanel");

	makeLabelBold(this, "ConvCmdEditorActorLabel");
	makeLabelBold(this, "ConvCmdEditorCommandLabel");
	makeLabelBold(this, "ConvCmdEditorCmdArgLabel");
	makeLabelBold(this, "ConvCmdEditorPropertiesLabel");

	wxChoice* cmdDropDown = findNamedObject<wxChoice>(this, "ConvCmdEditorCommandChoice");
	cmdDropDown->Connect(wxEVT_CHOICE, wxCommandEventHandler(CommandEditor::onCommandTypeChange), NULL, this);

	// Wire up button events
	findNamedObject<wxButton>(this, "ConvCmdEditorCancelButton")->Connect(
		wxEVT_BUTTON, wxCommandEventHandler(CommandEditor::onCancel), NULL, this);
	findNamedObject<wxButton>(this, "ConvCmdEditorOkButton")->Connect(
		wxEVT_BUTTON, wxCommandEventHandler(CommandEditor::onSave), NULL, this);
}
Exemplo n.º 4
0
// Private constructor sets up dialog
LightInspector::LightInspector()
: wxutil::TransientWindow(_(LIGHTINSPECTOR_TITLE), GlobalMainFrame().getWxTopLevelWindow(), true),
  _isProjected(false),
  _texSelector(NULL),
  _updateActive(false)
{
    loadNamedPanel(this, "LightInspectorMainPanel");

    setupLightShapeOptions();
    setupOptionsPanel();
    setupTextureWidgets();

    makeLabelBold(this, "LightInspectorVolumeLabel");
    makeLabelBold(this, "LightInspectorColourLabel");
    makeLabelBold(this, "LightInspectorOptionsLabel");
    makeLabelBold(this, "LightInspectorTextureLabel");

    InitialiseWindowPosition(600, 360, RKEY_WINDOW_STATE);
}
void MissionInfoEditDialog::populateWindow()
{
	SetSizer(new wxBoxSizer(wxVERTICAL));

	wxPanel* panel = loadNamedPanel(this, "MissionInfoEditDialogMainPanel");
	GetSizer()->Add(panel, 1, wxEXPAND);

	// Replace the list control with our own TreeView
	wxWindow* existing = findNamedObject<wxWindow>(this, "MissionInfoEditDialogMissionTitleList");

	wxutil::TreeView* treeview = wxutil::TreeView::CreateWithModel(existing->GetParent(), _missionTitleStore, wxDV_SINGLE);

	treeview->SetName("MissionInfoEditDialogMissionTitleList");
	treeview->SetMinSize(wxSize(-1, 150));

	// Display name column with icon
	treeview->AppendTextColumn(_("#"), _missionTitleColumns.number.getColumnIndex(),
		wxDATAVIEW_CELL_INERT, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT);

	treeview->AppendTextColumn(_("Title"), _missionTitleColumns.title.getColumnIndex(),
		wxDATAVIEW_CELL_EDITABLE, wxCOL_WIDTH_AUTOSIZE, wxALIGN_NOT);

	treeview->Connect(wxEVT_DATAVIEW_ITEM_EDITING_DONE,
		wxDataViewEventHandler(MissionInfoEditDialog::onTitleEdited), nullptr, this);
	treeview->Connect(wxEVT_DATAVIEW_ITEM_CONTEXT_MENU,
		wxDataViewEventHandler(MissionInfoEditDialog::onTitleContextMenu), nullptr, this);

	existing->GetContainingSizer()->Replace(existing, treeview);
	existing->Destroy();

	// Add the preview widget
	wxPanel* previewPanel = findNamedObject<wxPanel>(this, "MissionInfoEditDialogPreviewPanel");
	_guiView = new DarkmodTxtGuiView(previewPanel);
	previewPanel->GetSizer()->Add(_guiView, 1, wxEXPAND);

	makeLabelBold(this, "MissionInfoLabel");

	wxButton* saveButton = findNamedObject<wxButton>(this, "MissionInfoEditDialogSaveButton");
	wxButton* cancelButton = findNamedObject<wxButton>(this, "MissionInfoEditDialogCancelButton");

	saveButton->Bind(wxEVT_BUTTON, sigc::mem_fun(this, &MissionInfoEditDialog::onSave));
	cancelButton->Bind(wxEVT_BUTTON, sigc::mem_fun(this, &MissionInfoEditDialog::onCancel));
	
	// Popup Menu
	_missionTitlesContextMenu.reset(new wxutil::PopupMenu);

	_missionTitlesContextMenu->addItem(
		new wxutil::StockIconTextMenuItem(_("Add Title"), wxART_PLUS),
		std::bind(&MissionInfoEditDialog::onAddTitle, this)
	);

	_missionTitlesContextMenu->addItem(
		new wxutil::StockIconTextMenuItem(_("Delete Title"), wxART_MINUS),
		std::bind(&MissionInfoEditDialog::onDeleteTitle, this),
		std::bind(&MissionInfoEditDialog::testDeleteTitle, this)
	);

	// Wire up the text entry boxes to update the preview
	setupNamedEntryBox("MissionInfoEditDialogTitleEntry");
	setupNamedEntryBox("MissionInfoEditDialogAuthorEntry");
	setupNamedEntryBox("MissionInfoEditDialogDescriptionEntry");
	setupNamedEntryBox("MissionInfoEditDialogVersionEntry");

	// Setup the event for the readme.txt button
	wxButton* editReadmeButton = findNamedObject<wxButton>(this, "MissionInfoEditDialogEditReadmeButton");
	editReadmeButton->Bind(wxEVT_BUTTON, sigc::mem_fun(this, &MissionInfoEditDialog::onEditReadme));

	Layout();
	Fit();
	CenterOnScreen();
}