private static void EditUnderCursor(State state, UmlWindow umlWindow) { var id = state.Canvas.GetOccupants(state.TheCurser.Pos); if (!id.HasValue) { return; } var elem = state.Model.Objects.Single(x => x.Id == id); if (elem is IHasTextProperty property) { var text = property.Text; var input = new MultilineInputForm(umlWindow, "Edit..", "Text:", text, state.TheCurser.Pos) { OnCancel = () => { }, OnSubmit = newtext => { umlWindow.HandleCommands(Lst(new SetText(id.Value, newtext))); } }; input.Focus(); } else { new Popup(umlWindow, "Only works on labels and boxes"); } }
private static void CreateUmlUser(State state, UmlWindow umlWindow) { var input = new MultilineInputForm(umlWindow, "Text for user (optional)", "Text:", "", state.TheCurser.Pos) { OnCancel = () => { }, OnSubmit = text => { umlWindow.HandleCommands(Lst(new CreateUmlUser(state.TheCurser.Pos, text))); } }; input.Focus(); }
private static void CreateText(State state, UmlWindow umlWindow) { var input = new MultilineInputForm(umlWindow, "Create a label", "Text:", "", state.TheCurser.Pos) { OnCancel = () => { }, OnSubmit = text => { umlWindow.HandleCommands(Lst(new CreateLabel(state.TheCurser.Pos, text))); } }; input.Focus(); }