private void copyGameMasterNode_Click(object sender, EventArgs e) { if (mSelectedNode != null) { CloneDialogCallback callback = new CloneDialogCallback(this, mSelectedNode); InputDialog dialog = new InputDialog("Clone " + mSelectedNode.Name, "Type name of new node", mSelectedNode.Name, "Clone!"); dialog.SetCallback(callback); dialog.ShowDialog(); } }
private void editLocStringToolStripMenuItem_Click(object sender, EventArgs e) { if (mI18nLocKey == null) { return; } EditLocStringCallback callback = new EditLocStringCallback(mI18nLocKey); string translated = ModuleDataManager.GetInstance().LocalizeString(mI18nLocKey); InputDialog dialog = new InputDialog("Edit Loc String", "Edit Loc Text For: " + mI18nLocKey, translated, "Edit"); dialog.SetCallback(callback); dialog.ShowDialog(); }
/// <summary> /// Whenever the user clicked on an indicator. /// Used instead of IndicatorClick because the opening dialog is eating the /// Release event, so the control thinks there's text to be selected. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void textBox_IndicatorRelease(object sender, IndicatorReleaseEventArgs e) { if (!ModifierKeys.HasFlag(Keys.Control)) { return; } int indicator = this.getIndicatorAt(e.Position); if (indicator == kI18nIndicator) { var locKey = this.getLocKey(e.Position); if (locKey != null) { this.mI18nLocKey = locKey; EditLocStringCallback callback = new EditLocStringCallback(this.mI18nLocKey); string translated = ModuleDataManager.GetInstance().LocalizeString(this.mI18nLocKey); InputDialog dialog = new InputDialog("Edit i18n Text", $"Edit English text for:\n{mI18nLocKey}", translated, "Save"); dialog.SetCallback(callback); dialog.ShowDialog(); } } else if (indicator == kFileIndicator) { var text = this.getIndicatorText(this.mFileIndicator, e.Position); ModuleFile module; if (!this.tryGetModuleFile(text, out module) || module == null) { return; } var selectable = mOwner as IFileDataSelectable; // TODO: instead of using an interface, try to have some function in // the main view that allows switching to the manifest view + displaying a modulefile/filedata if (selectable != null) { selectable.SetSelectedFileData(module.FileData); } else { // No one is listening. Just open the file in the default OS viewer. System.Diagnostics.Process.Start(module.ResolvedPath); } } }
private void filterListViewButton_Click(object sender, EventArgs e) { ListView listView = null; foreach (Control control in entityBrowserTabControl.SelectedTab.Controls) { if (control.Name.Contains("ListView")) { listView = control as ListView; break; } } if (listView != null) { InputDialog dialog = new InputDialog("Filter By", "(Separate search terms with a comma) Filter items containing text:", "", "Filter"); InputDialog.IDialogCallback callback = new FilterItemsCallback(this, listView); dialog.SetCallback(callback); dialog.Show(); } }
private void selectJsonFileDialog_FileOk(object sender, CancelEventArgs e) { string filePath = selectJsonFileDialog.FileName; if (filePath == null) { return; } filePath = JsonHelper.NormalizeSystemPath(filePath); NewAliasParameters parameters = selectJsonFileDialog.Tag as NewAliasParameters; Module selectedMod = parameters.SelectedMod; string manifestEntryType = parameters.ManifestEntryType; if (!filePath.Contains(selectedMod.Path)) { MessageBox.Show("The file must be under the directory " + selectedMod.Path); return; } mLastModuleLocations[selectedMod.Name] = filePath; string shortPath = filePath.Replace(selectedMod.Path + "/", ""); string[] pathSplit = shortPath.Split('/'); string samplePath = string.Empty; for (int i = 1; i < (pathSplit.Length - 1); ++i) { if (string.IsNullOrEmpty(samplePath)) { samplePath = pathSplit[i]; } else { samplePath = samplePath + ':' + pathSplit[i]; } } if (pathSplit.Length > 2) { // Make the file path not contain the .json part if it doesn't have to string fileName = pathSplit[pathSplit.Length - 1]; string extension = System.IO.Path.GetExtension(fileName); if (extension == ".json") { string folder = pathSplit[pathSplit.Length - 2]; if (folder.Equals(System.IO.Path.GetFileNameWithoutExtension(fileName))) { shortPath = shortPath.Replace("/" + fileName, ""); } } else if (extension == ".lua") { string nameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(fileName); if (nameWithoutExtension.EndsWith("_action")) { nameWithoutExtension = nameWithoutExtension.Substring(0, nameWithoutExtension.Length - 7); samplePath = samplePath + ':' + nameWithoutExtension; } } } NewAliasCallback callback = new NewAliasCallback(this, selectedMod, shortPath, manifestEntryType); InputDialog dialog = new InputDialog("Add New Alias", "Type the name of the alias for " + filePath, samplePath, "Add!"); dialog.SetCallback(callback); dialog.ShowDialog(); }