/// <summary> /// Handles the event lauched when the "edit label" option is clicked /// in the formula node's contextual menu. /// </summary> /// <param name="sender"> /// A <see cref="System.Object"/> /// </param> /// <param name="a"> /// A <see cref="EventArgs"/> /// </param> private void OnEditLabeItemActivate(object sender, EventArgs a) { Dialogs.SymbolLabelEditorDialog dialog = new Dialogs.SymbolLabelEditorDialog(MainRecognizerWindow.Window, selectedNode); if (dialog.Show() == ResponseType.Ok) { bool changeLabel = true; if (selectedNode.ChildCount > 0) { ResponseType res = ConfirmDialog.Show(MainRecognizerWindow.Window, "Este nodo tiene hijos, y se estableces " + "una etiqueta se eliminarán, ¿quieres" + " continuar?"); if (res == ResponseType.Yes) { // We remove the nodes. while (selectedNode.ChildCount > 0) { selectedNode.RemoveChild((TreeNode)(selectedNode[0])); } } else { changeLabel = false; } } if (changeLabel) { // We remove all the symbols, then add the new one. selectedNode.Symbols.Clear(); selectedNode.Symbols.Add(new MathSymbol(dialog.Label)); selectedNode.SetLabels(); } } dialog.Destroy(); }
/// <summary> /// Handles the event lauched when the "edit label" option is clicked /// in the formula node's contextual menu. /// </summary> /// <param name="sender"> /// A <see cref="System.Object"/> /// </param> /// <param name="a"> /// A <see cref="EventArgs"/> /// </param> private void OnEditLabeItemActivate(object sender, EventArgs a) { Dialogs.SymbolLabelEditorDialog dialog = new Dialogs.SymbolLabelEditorDialog(MainRecognizerWindow.Window, selectedNode); if(dialog.Show() == ResponseType.Ok) { bool changeLabel = true; if(selectedNode.ChildCount > 0) { ResponseType res = ConfirmDialog.Show(MainRecognizerWindow.Window, "Este nodo tiene hijos, y se estableces " + "una etiqueta se eliminarán, ¿quieres" +" continuar?"); if(res == ResponseType.Yes) { // We remove the nodes. while(selectedNode.ChildCount > 0) { selectedNode.RemoveChild((TreeNode)(selectedNode[0])); } } else { changeLabel = false; } } if(changeLabel) { // We remove all the symbols, then add the new one. selectedNode.Symbols.Clear(); selectedNode.Symbols.Add(new MathSymbol(dialog.Label)); selectedNode.SetLabels(); } } dialog.Destroy(); }
private void OnOCRControllerProcessFinished(object sender, EventArgs args) { Application.Invoke(delegate(object resender, EventArgs a) { unassistedGlobalProgressBar.Fraction = 0.33; unassistedTaskNameLabel.Text = "Secuenciación"; List<Token> startTokens = new List<Token>(); foreach (SegmentedNode node in ocrController.Result) { if(node.Symbols.Count != 1) { SymbolLabelEditorDialog dialog = new SymbolLabelEditorDialog(this.MainRecognizerWindow.Window, node); ResponseType res = dialog.Show(); string label = dialog.Label; dialog.Destroy(); if(res == ResponseType.Ok) { node.Symbols.Clear(); node.Symbols.Add(new MathSymbol(label)); node.SetLabels(); } else { OkDialog.Show(this.MainRecognizerWindow.Window, MessageType.Error, "La fase de reconocimiento y segementado de imágenes falló."); unassistedControlHBB.Sensitive = true; return; } } startTokens.Add(new Token(node.Label, node.MathTextBitmap.Position.X, node.MathTextBitmap.Position.Y, node.MathTextBitmap.FloatImage)); } tokenizingFinished = false; tokenizingController.SetLexicalRules(Config.RecognizerConfig.Instance.LexicalRules); tokenizingController.SetInitialData(startTokens, null); tokenizingController.Next(ControllerStepMode.UntilEnd); }); }