コード例 #1
0
        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";
            }
        }
コード例 #2
0
ファイル: MainView.xaml.cs プロジェクト: wfflzt/dnGrep
        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;
        }
コード例 #3
0
ファイル: MainView.xaml.cs プロジェクト: wfflzt/dnGrep
 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));
     }
 }
コード例 #4
0
ファイル: MainView.xaml.cs プロジェクト: wfflzt/dnGrep
 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);
     }
 }
コード例 #5
0
ファイル: MainView.xaml.cs プロジェクト: wfflzt/dnGrep
 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);
     }
 }
コード例 #6
0
ファイル: MainView.xaml.cs プロジェクト: wfflzt/dnGrep
 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);
     }
 }
コード例 #7
0
        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";
            }
        }
コード例 #8
0
        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";
            }
        }
コード例 #9
0
ファイル: MainView.xaml.cs プロジェクト: wfflzt/dnGrep
        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);
            }
        }