// ------------------------------ // protected // ------------------------------ // --- tool strip --- protected internal override void UpdateToolStrip() { if (_SuppressToolStripUpdate) { return; } if (_toolStripForm == null || _toolStripForm.IsDisposed) { return; } // todo: /// Enabledの設定 var canCut = EditorCanvas.CanCut(); var canCopy = EditorCanvas.CanCopy(); var canPaste = EditorCanvas.CanPaste(); var canUndo = EditorCanvas.CanUndo(); var canRedo = EditorCanvas.CanRedo(); var canModFontName = EditorCanvas.CanModifyFontName(); var canModFontSize = EditorCanvas.CanModifyFontSize(); var canModFontStyle = EditorCanvas.CanModifyFontStyle(); var canModifyHAlign = EditorCanvas.CanModifyHorizontalAlignment(); var canModifyVAlign = EditorCanvas.CanModifyVerticalAlignment(); var canModifyListKind = EditorCanvas.CanModifyListKind(); _toolStripForm._importantToolStripButton.Enabled = true; _toolStripForm._unimportantToolStripButton.Enabled = true; _toolStripForm._memoMarkToolStripSplitButton.Enabled = true; _toolStripForm._cutToolStripButton.Enabled = canCut; _toolStripForm._copyToolStripButton.Enabled = canCopy; _toolStripForm._pasteToolStripButton.Enabled = canPaste; _toolStripForm._undoToolStripButton.Enabled = canUndo; _toolStripForm._redoToolStripButton.Enabled = canRedo; _toolStripForm._searchInMemoToolStripButton.Enabled = true; _toolStripForm._fontNameToolStripComboBox.Enabled = canModFontName; _toolStripForm._fontSizeToolStripComboBox.Enabled = canModFontSize; _toolStripForm._fontBoldToolStripButton.Enabled = canModFontStyle; _toolStripForm._fontItalicToolStripButton.Enabled = canModFontStyle; _toolStripForm._fontUnderlineToolStripButton.Enabled = canModFontStyle; _toolStripForm._fontStrikeoutToolStripButton.Enabled = canModFontStyle; SetTextColorButtonToolStripItemEnabled(_toolStripForm._textColorButtonToolStripItem, EditorCanvas.CanModifyTextColor()); _toolStripForm._leftHorizontalAlignmentToolStripButton.Enabled = canModifyHAlign; _toolStripForm._centerHorizontalAlignmentToolStripButton.Enabled = canModifyHAlign; _toolStripForm._rightHorizontalAlignmentToolStripButton.Enabled = canModifyHAlign; _toolStripForm._verticalAlignToolStripDropDownButton.Enabled = canModifyVAlign; _toolStripForm._orderedListToolStripButton.Enabled = canModifyListKind; _toolStripForm._unorderedListToolStripButton.Enabled = canModifyListKind; _toolStripForm._specialListToolStripButton.Enabled = canModifyListKind; _toolStripForm._selectSpecialListToolStripDropDownButton.Enabled = canModifyListKind; _toolStripForm._selectToolToolStripButton.Enabled = true; _toolStripForm._handToolToolStripButton.Enabled = true; _toolStripForm._adjustSpaceToolToolStripButton.Enabled = true; _toolStripForm._addFreehandToolStripDropDownButton.Enabled = true; _toolStripForm._addFigureToolStripDropDownButton.Enabled = true; _toolStripForm._addImageToolStripButton.Enabled = true; _toolStripForm._addFileToolStripDropDownButton.Enabled = true; _toolStripForm._addTableToolStripButton.Enabled = true; _toolStripForm._setNodeStyleToolStripDropDownButton.Enabled = !EditorCanvas.FocusManager.IsEditorFocused && EditorCanvas.SelectionManager.SelectedEditors.Any(e => e.Model is MemoShape); //EditorCanvas.SelectionManager.SelectedEditors.Any(e => e.Model is MemoShape || e.Model is MemoTableCell); _toolStripForm._setLineStyleToolStripDropDownButton.Enabled = !EditorCanvas.FocusManager.IsEditorFocused && EditorCanvas.SelectionManager.SelectedEditors.Any(e => e.Model is MemoEdge); SetShapeColorButtonToolStripItemEnabled( _toolStripForm._shapeColorButtonToolStripItem, !EditorCanvas.FocusManager.IsEditorFocused && EditorCanvas.SelectionManager.SelectedEditors.Any( e => e.Model is MemoShape || e.Model is MemoTableCell ) ); /// check var memo = _EditorCanvas.EditorContent as Memo; _toolStripForm._importantToolStripButton.Checked = memo.Importance == MemoImportanceKind.High; _toolStripForm._unimportantToolStripButton.Checked = memo.Importance == MemoImportanceKind.Low; _toolStripForm._selectToolToolStripButton.Checked = EditorCanvas.Tool is SelectTool; _toolStripForm._handToolToolStripButton.Checked = EditorCanvas.Tool is HandTool; _toolStripForm._adjustSpaceToolToolStripButton.Checked = EditorCanvas.Tool is AdjustSpaceTool; /// Text,Checkedの設定 if (EditorCanvas.FocusManager.IsEditorFocused) { /// フォーカスあり var focus = EditorCanvas.FocusManager.Focus as StyledTextFocus; var font = focus.GetNextInputFont(); SetFontComboBoxTextWithoutEventHandling( canModFontName? font.Name: "", canModFontSize? font.Size.ToString(): "" ); _toolStripForm._fontBoldToolStripButton.Checked = canModFontStyle? font.IsBold: false; _toolStripForm._fontItalicToolStripButton.Checked = canModFontStyle? font.IsItalic: false; _toolStripForm._fontUnderlineToolStripButton.Checked = canModFontStyle ? font.IsUnderline : false; _toolStripForm._fontStrikeoutToolStripButton.Checked = canModFontStyle? font.IsStrikeout: false; var model = EditorCanvas.FocusManager.FocusedEditor.Model; if (model is MemoText || model is MemoShape || model is MemoTableCell) { /// MemoTextとMemoShapeとMemoTableCellだけ有効にしておく var para = focus.GetBlockAtCaretIndex() as Paragraph; if (para != null) { EnableParagraphKindComboBox(); var paraKind = focus.GetParagraphKind(); var paraKindText = paraKind == null ? "" : GetStringFromParagraphKind(paraKind.Value); SetParagraphKindComboBoxTextWithoutEventHandling(paraKindText); _toolStripForm._unorderedListToolStripButton.Enabled = true; _toolStripForm._orderedListToolStripButton.Enabled = true; _toolStripForm._specialListToolStripButton.Enabled = true; _toolStripForm._selectSpecialListToolStripDropDownButton.Enabled = true; _toolStripForm._indentToolStripButton.Enabled = para.ListLevel < 10; _toolStripForm._outdentToolStripButton.Enabled = para.ListLevel > 0; _toolStripForm._unorderedListToolStripButton.Checked = para.ListKind == ListKind.Unordered; _toolStripForm._orderedListToolStripButton.Checked = para.ListKind == ListKind.Ordered; _toolStripForm._specialListToolStripButton.Checked = para.ListKind == ListKind.CheckBox || para.ListKind == ListKind.TriStateCheckBox || para.ListKind == ListKind.Star || para.ListKind == ListKind.LeftArrow || para.ListKind == ListKind.RightArrow; _toolStripForm._addCommentToolStripButton.Enabled = model is MemoText; } else { DisableParagraphPropUI(); _toolStripForm._addCommentToolStripButton.Enabled = false; } } else { DisableParagraphPropUI(); _toolStripForm._addCommentToolStripButton.Enabled = false; } } else { /// フォーカスなし SetFontComboBoxTextWithoutEventHandling("", ""); _toolStripForm._fontBoldToolStripButton.Checked = false; _toolStripForm._fontItalicToolStripButton.Checked = false; _toolStripForm._fontUnderlineToolStripButton.Checked = false; _toolStripForm._fontStrikeoutToolStripButton.Checked = false; _toolStripForm._unorderedListToolStripButton.Checked = false; _toolStripForm._orderedListToolStripButton.Checked = false; _toolStripForm._specialListToolStripButton.Checked = false; DisableParagraphPropUI(); _toolStripForm._addCommentToolStripButton.Enabled = false; } }