Skip to content

Commit b74e62b

Browse files
committed
resolved conflicts
2 parents 2b87634 + 71226ac commit b74e62b

28 files changed

+1052
-438
lines changed

RetailCoder.VBE/Inspections/Abstract/IInspectionResult.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ public interface IInspectionResult : IComparable<IInspectionResult>, IComparable
1111
QualifiedSelection QualifiedSelection { get; }
1212
IInspection Inspection { get; }
1313
object[] ToArray();
14+
string ToClipboardString();
1415
}
1516
}

RetailCoder.VBE/Inspections/Abstract/InspectionResultBase.cs

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Collections.Generic;
2+
using System.IO;
23
using System.Linq;
34
using Antlr4.Runtime;
45
using Rubberduck.Inspections.Resources;
@@ -87,18 +88,33 @@ public virtual int CompareTo(IInspectionResult other)
8788
return Inspection.CompareTo(other.Inspection);
8889
}
8990

90-
//public override string ToString()
91-
//{
92-
// var module = QualifiedSelection.QualifiedName;
93-
// return string.Format(
94-
// InspectionsUI.QualifiedSelectionInspection,
95-
// Inspection.Severity,
96-
// Description,
97-
// "(" + module.ProjectDisplayName + ")",
98-
// module.ProjectName,
99-
// module.ComponentName,
100-
// QualifiedSelection.Selection.StartLine);
101-
//}
91+
/// <summary>
92+
/// WARNING: This property can have side effects. It can change the ActiveVBProject if the result has a null Declaration,
93+
/// which causes a flicker in the VBE. This should only be called if it is *absolutely* necessary.
94+
/// </summary>
95+
public string ToClipboardString()
96+
{
97+
var module = QualifiedSelection.QualifiedName;
98+
var documentName = _target != null ? _target.ProjectDisplayName : string.Empty;
99+
if (string.IsNullOrEmpty(documentName))
100+
{
101+
var component = module.Component;
102+
documentName = component != null ? component.ParentProject.ProjectDisplayName : string.Empty;
103+
}
104+
if (string.IsNullOrEmpty(documentName))
105+
{
106+
documentName = Path.GetFileName(module.ProjectPath);
107+
}
108+
109+
return string.Format(
110+
InspectionsUI.QualifiedSelectionInspection,
111+
Inspection.Severity,
112+
Description,
113+
"(" + documentName + ")",
114+
module.ProjectName,
115+
module.ComponentName,
116+
QualifiedSelection.Selection.StartLine);
117+
}
102118

103119
public virtual NavigateCodeEventArgs GetNavigationArgs()
104120
{

RetailCoder.VBE/Inspections/ProcedureNotUsedInspection.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
6060
handlers.AddRange(forms.SelectMany(form => State.FindFormEventHandlers(form)));
6161
}
6262

63-
//handlers.AddRange(builtInHandlers);
64-
6563
var interfaceMembers = State.DeclarationFinder.FindAllInterfaceMembers().ToList();
6664
var implementingMembers = State.DeclarationFinder.FindAllInterfaceImplementingMembers().ToList();
6765

@@ -78,7 +76,10 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
7876
private static readonly DeclarationType[] ProcedureTypes =
7977
{
8078
DeclarationType.Procedure,
81-
DeclarationType.Function
79+
DeclarationType.Function,
80+
DeclarationType.LibraryProcedure,
81+
DeclarationType.LibraryFunction,
82+
DeclarationType.Event
8283
};
8384

8485
private bool IsIgnoredDeclaration(Declaration declaration, IEnumerable<Declaration> interfaceMembers, IEnumerable<Declaration> interfaceImplementingMembers , IEnumerable<Declaration> handlers, IEnumerable<Declaration> classes, IEnumerable<Declaration> modules)

RetailCoder.VBE/Rubberduck.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@
232232
<Reference Include="extensibility, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
233233
<EmbedInteropTypes>True</EmbedInteropTypes>
234234
</Reference>
235+
<Reference Include="ICSharpCode.AvalonEdit">
236+
<HintPath>..\packages\AvalonEdit.5.0.3\lib\Net40\ICSharpCode.AvalonEdit.dll</HintPath>
237+
</Reference>
235238
<Reference Include="Infralution.Localization.Wpf">
236239
<HintPath>..\libs\Infralution.Localization.Wpf.dll</HintPath>
237240
</Reference>
@@ -504,6 +507,7 @@
504507
<Compile Include="UI\Command\MenuItems\RegexAssistantCommand.cs" />
505508
<Compile Include="UI\Command\MenuItems\RegexAssistantCommandMenuItem.cs" />
506509
<Compile Include="UI\Command\MenuItems\ParentMenus\ToolsParentMenu.cs" />
510+
<Compile Include="UI\Controls\BindableTextEditor.cs" />
507511
<Compile Include="UI\Controls\LinkButton.xaml.cs">
508512
<DependentUpon>LinkButton.xaml</DependentUpon>
509513
</Compile>
@@ -1155,6 +1159,7 @@
11551159
<SubType>Designer</SubType>
11561160
</None>
11571161
<None Include="packages.config" />
1162+
<EmbeddedResource Include="UI\Controls\vba.xshd" />
11581163
</ItemGroup>
11591164
<ItemGroup>
11601165
<Resource Include="Resources\minus-circle.png" />

RetailCoder.VBE/UI/About/AboutDialog.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,19 @@ private AboutControlViewModel ViewModel
2121
AboutControl.DataContext = _viewModel;
2222
}
2323
}
24+
25+
private void AboutDialog_Load(object sender, System.EventArgs e)
26+
{
27+
28+
}
29+
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
30+
{
31+
if (keyData == Keys.Escape)
32+
{
33+
this.Close();
34+
return true;
35+
}
36+
return base.ProcessCmdKey(ref msg, keyData);
37+
}
2438
}
2539
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
using System;
2+
using System.ComponentModel;
3+
using System.Reflection;
4+
using System.Windows;
5+
using System.Windows.Media;
6+
using System.Xml;
7+
using ICSharpCode.AvalonEdit;
8+
using ICSharpCode.AvalonEdit.Highlighting;
9+
using ICSharpCode.AvalonEdit.Highlighting.Xshd;
10+
11+
namespace Rubberduck.UI.Controls
12+
{
13+
//see http://stackoverflow.com/a/20823917/4088852
14+
public class BindableTextEditor : TextEditor, INotifyPropertyChanged
15+
{
16+
public BindableTextEditor()
17+
{
18+
WordWrap = false;
19+
20+
var highlighter = LoadHighlighter("Rubberduck.UI.Controls.vba.xshd");
21+
SyntaxHighlighting = highlighter;
22+
23+
//Style hyperlinks so they look like comments. Note - this needs to move if used for user code.
24+
TextArea.TextView.LinkTextUnderline = false;
25+
TextArea.TextView.LinkTextForegroundBrush = new SolidColorBrush(Colors.Green);
26+
Options.RequireControlModifierForHyperlinkClick = false;
27+
Options.EnableHyperlinks = true;
28+
Options.EnableEmailHyperlinks = true;
29+
}
30+
31+
public new string Text
32+
{
33+
get { return base.Text; }
34+
set { base.Text = value; }
35+
}
36+
37+
public static readonly DependencyProperty TextProperty =
38+
DependencyProperty.Register("Text", typeof(string), typeof(BindableTextEditor), new PropertyMetadata((obj, args) =>
39+
{
40+
var target = (BindableTextEditor)obj;
41+
target.Text = (string)args.NewValue;
42+
}));
43+
44+
protected override void OnTextChanged(EventArgs e)
45+
{
46+
RaisePropertyChanged("Text");
47+
base.OnTextChanged(e);
48+
}
49+
50+
public void RaisePropertyChanged(string property)
51+
{
52+
if (PropertyChanged != null)
53+
{
54+
PropertyChanged(this, new PropertyChangedEventArgs(property));
55+
}
56+
}
57+
58+
public event PropertyChangedEventHandler PropertyChanged;
59+
60+
private static IHighlightingDefinition LoadHighlighter(string resource)
61+
{
62+
var assembly = Assembly.GetExecutingAssembly();
63+
using (var stream = assembly.GetManifestResourceStream(resource))
64+
{
65+
if (stream == null)
66+
{
67+
return null;
68+
}
69+
using (var reader = new XmlTextReader(stream))
70+
{
71+
return HighlightingLoader.Load(reader, HighlightingManager.Instance);
72+
}
73+
}
74+
}
75+
}
76+
}

0 commit comments

Comments
 (0)