/// <summary> /// Executes the collapse all folds command (which folds all text foldings but the first). /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void FoldsExpandAll(object sender, ExecutedRoutedEventArgs e) { EdiTextEditor edi = sender as EdiTextEditor; if (edi == null) { return; } edi.ExpandAllTextFoldings(); }
/// <summary> /// The dependency property for has changed. /// Change the <seealso cref="SolidColorBrush"/> to be used for highlighting the current editor line /// in the particular <seealso cref="EdiTextEditor"/> control. /// </summary> /// <param name="d"></param> /// <param name="e"></param> private static void OnCurrentLineBackgroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (d is EdiTextEditor && e != null) { EdiTextEditor view = d as EdiTextEditor; if (e.NewValue is SolidColorBrush) { SolidColorBrush newValue = e.NewValue as SolidColorBrush; view.AdjustCurrentLineBackground(newValue); } } }
/// <summary> /// Determines whether a folding command can be executed or not and sets correspondind /// <paramref name="e"/>.CanExecute property value. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void PrintDocumentCanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = false; e.Handled = true; EdiTextEditor edi = sender as EdiTextEditor; if (edi == null) { return; } e.CanExecute = true; }
/// <summary> /// Executes the collapse all folds command (which folds all text foldings but the first). /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void PrintDocument(object sender, ExecutedRoutedEventArgs e) { EdiTextEditor edi = sender as EdiTextEditor; if (edi == null) { return; } string filename = null; try { if (e != null) { if (e.Parameter != null) { filename = e.Parameter as string; if (filename != null) { int MaxLen = 52; // Work with elipses if string is too long if (filename.Length > (MaxLen + 8)) { filename = filename.Substring(0, 5) + "..." + filename.Substring((filename.Length - MaxLen), MaxLen); } } } } } catch { } edi.PrintPreviewDocument(filename); }
/// <summary> /// Determines whether a folding command can be executed or not and sets correspondind /// <paramref name="e"/>.CanExecute property value. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void FoldsColapseExpandCanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = false; e.Handled = true; EdiTextEditor edi = sender as EdiTextEditor; if (edi == null) { return; } if (edi.mFoldingManager == null) { return; } if (edi.mFoldingManager.AllFoldings == null) { return; } e.CanExecute = true; }