public FormattedGrepLine(GrepLine line, FormattedGrepResult parent, int initialColumnWidth, bool breakSection) { Parent = parent; GrepLine = line; Parent.PropertyChanged += Parent_PropertyChanged; LineNumberColumnWidth = initialColumnWidth; IsSectionBreak = breakSection; WrapText = Parent.WrapText; int lineSize = GrepSettings.Instance.Get <int>(GrepSettings.Key.HexResultByteLength); LineNumberAlignment = TranslationSource.Instance.CurrentCulture.TextInfo.IsRightToLeft ? TextAlignment.Left : TextAlignment.Right; FormattedLineNumber = line.LineNumber == -1 ? string.Empty : line.IsHexFile ? string.Format("{0:X8}", (line.LineNumber - 1) * lineSize) : line.LineNumber.ToString(); //string fullText = lineSummary; if (line.IsContext) { Style = "Context"; } if (line.LineNumber == -1 && string.IsNullOrEmpty(line.LineText)) { Style = "Empty"; } }
private void treeDragStarted(UIElement uiElt) { _isMouseDown = false; Mouse.Capture(uiElt); DataObject data = new DataObject(); if (tvSearchResult.SelectedItem is FormattedGrepLine) { FormattedGrepLine selectedNode = (FormattedGrepLine)tvSearchResult.SelectedItem; data.SetData(DataFormats.Text, selectedNode.GrepLine.LineText); } else if (tvSearchResult.SelectedItem is FormattedGrepResult) { FormattedGrepResult result = (FormattedGrepResult)tvSearchResult.SelectedItem; StringCollection files = new StringCollection(); files.Add(result.GrepResult.FileNameReal); data.SetFileDropList(files); } DragDropEffects supportedEffects = DragDropEffects.Move | DragDropEffects.Copy; // Perform DragDrop DragDropEffects effects = System.Windows.DragDrop.DoDragDrop(_draggedElt, data, supportedEffects); // Clean up Mouse.Capture(null); _draggedElt = null; }
private void btnCopyNameToClipboard_Click(object sender, RoutedEventArgs e) { if (tvSearchResult.SelectedItem is FormattedGrepLine) { FormattedGrepLine selectedNode = (FormattedGrepLine)tvSearchResult.SelectedItem; Clipboard.SetText(System.IO.Path.GetFileName(selectedNode.Parent.GrepResult.FileNameDisplayed)); } else if (tvSearchResult.SelectedItem is FormattedGrepResult) { FormattedGrepResult result = (FormattedGrepResult)tvSearchResult.SelectedItem; Clipboard.SetText(System.IO.Path.GetFileName(result.GrepResult.FileNameDisplayed)); } }
private void copyToClipboard() { if (tvSearchResult.SelectedItem is FormattedGrepLine) { FormattedGrepLine selectedNode = (FormattedGrepLine)tvSearchResult.SelectedItem; Clipboard.SetText(selectedNode.GrepLine.LineText); } else if (tvSearchResult.SelectedItem is FormattedGrepResult) { FormattedGrepResult result = (FormattedGrepResult)tvSearchResult.SelectedItem; Clipboard.SetText(result.GrepResult.FileNameDisplayed); } }
private void btnExclude_Click(object sender, RoutedEventArgs e) { if (tvSearchResult.SelectedItem is FormattedGrepLine) { FormattedGrepLine selectedNode = (FormattedGrepLine)tvSearchResult.SelectedItem; inputData.SearchResults.Remove(selectedNode.Parent); } else if (tvSearchResult.SelectedItem is FormattedGrepResult) { FormattedGrepResult selectedNode = (FormattedGrepResult)tvSearchResult.SelectedItem; inputData.SearchResults.Remove(selectedNode); } }
private void btnOpenContainingFolder_Click(object sender, RoutedEventArgs e) { if (tvSearchResult.SelectedItem is FormattedGrepLine) { FormattedGrepLine selectedNode = (FormattedGrepLine)tvSearchResult.SelectedItem; //ShellIntegration.OpenFolder(selectedNode.Parent.GrepResult.FileNameReal); Utils.OpenContainingFolder(selectedNode.Parent.GrepResult.FileNameReal, selectedNode.GrepLine.LineNumber); } else if (tvSearchResult.SelectedItem is FormattedGrepResult) { FormattedGrepResult selectedNode = (FormattedGrepResult)tvSearchResult.SelectedItem; //ShellIntegration.OpenFolder(selectedNode.GrepResult.FileNameReal); Utils.OpenContainingFolder(selectedNode.GrepResult.FileNameReal, -1); } }
public FormattedGrepLine(GrepSearchResult.GrepLine line, FormattedGrepResult parent, int initialColumnWidth) { Parent = parent; grepLine = line; Parent.PropertyChanged += new PropertyChangedEventHandler(Parent_PropertyChanged); LineNumberColumnWidth = initialColumnWidth; formattedLineNumber = (line.LineNumber == -1 ? "" : line.LineNumber.ToString()); //string fullText = lineSummary; if (line.IsContext) { style = "Context"; } if (line.LineNumber == -1 && line.LineText == "") { style = "Empty"; } }
public FormattedGrepLine(GrepLine line, FormattedGrepResult parent, int initialColumnWidth, bool breakSection) { Parent = parent; GrepLine = line; Parent.PropertyChanged += new PropertyChangedEventHandler(Parent_PropertyChanged); LineNumberColumnWidth = initialColumnWidth; IsSectionBreak = breakSection; FormattedLineNumber = (line.LineNumber == -1 ? "" : line.LineNumber.ToString()); //string fullText = lineSummary; if (line.IsContext) { Style = "Context"; } if (line.LineNumber == -1 && line.LineText == "") { Style = "Empty"; } }
private void btnShowFileProperties_Click(object sender, RoutedEventArgs e) { string fileName = ""; if (tvSearchResult.SelectedItem is FormattedGrepLine) { FormattedGrepLine selectedNode = (FormattedGrepLine)tvSearchResult.SelectedItem; fileName = selectedNode.Parent.GrepResult.FileNameReal; } else if (tvSearchResult.SelectedItem is FormattedGrepResult) { FormattedGrepResult selectedNode = (FormattedGrepResult)tvSearchResult.SelectedItem; fileName = selectedNode.GrepResult.FileNameReal; } if (fileName != "" && File.Exists(fileName)) { ShellIntegration.ShowFileProperties(fileName); } }