|  | 
| 1 | 1 | using System; | 
| 2 |  | -using System.Collections.Generic; | 
| 3 | 2 | using System.Drawing; | 
| 4 | 3 | using System.Globalization; | 
| 5 | 4 | using System.Windows.Forms; | 
|  | 
| 12 | 11 | using Rubberduck.UI.CodeInspections; | 
| 13 | 12 | using Rubberduck.UI.ParserErrors; | 
| 14 | 13 | using Rubberduck.VBEditor; | 
|  | 14 | +using Rubberduck.VBEditor.VBEInterfaces.RubberduckCodePane; | 
| 15 | 15 | 
 | 
| 16 | 16 | namespace Rubberduck | 
| 17 | 17 | { | 
| 18 | 18 |     public class App : IDisposable | 
| 19 | 19 |     { | 
| 20 | 20 |         private readonly VBE _vbe; | 
| 21 | 21 |         private readonly AddIn _addIn; | 
| 22 |  | -        private IList<IInspection> _inspections; | 
| 23 | 22 |         private Inspector _inspector; | 
| 24 | 23 |         private ParserErrorsPresenter _parserErrorsPresenter; | 
| 25 | 24 |         private readonly IGeneralConfigService _configService = new ConfigurationLoader(); | 
| 26 | 25 |         private readonly ActiveCodePaneEditor _editor; | 
|  | 26 | +        private readonly IRubberduckCodePaneFactory _factory; | 
| 27 | 27 |         private IRubberduckParser _parser; | 
| 28 | 28 | 
 | 
| 29 | 29 |         private Configuration _config; | 
| 30 | 30 |         private RubberduckMenu _menu; | 
| 31 | 31 |         private FormContextMenu _formContextMenu; | 
| 32 | 32 |         private CodeInspectionsToolbar _codeInspectionsToolbar; | 
| 33 |  | -        private bool displayToolbar = false; | 
| 34 |  | -        private Point toolbarCoords = new Point(-1, -1); | 
|  | 33 | +        private bool _displayToolbar = false; | 
|  | 34 | +        private Point _toolbarCoords = new Point(-1, -1); | 
| 35 | 35 | 
 | 
| 36 | 36 |         public App(VBE vbe, AddIn addIn) | 
| 37 | 37 |         { | 
| 38 | 38 |             _vbe = vbe; | 
| 39 | 39 |             _addIn = addIn; | 
|  | 40 | +            _factory = new RubberduckCodePaneFactory(); | 
| 40 | 41 | 
 | 
| 41 | 42 |             _parserErrorsPresenter = new ParserErrorsPresenter(vbe, addIn); | 
| 42 | 43 |             _configService.SettingsChanged += _configService_SettingsChanged; | 
| 43 | 44 | 
 | 
| 44 |  | -            _editor = new ActiveCodePaneEditor(vbe); | 
|  | 45 | +            _editor = new ActiveCodePaneEditor(vbe, _factory); | 
| 45 | 46 | 
 | 
| 46 | 47 |             LoadConfig(); | 
| 47 | 48 | 
 | 
| @@ -78,28 +79,28 @@ private void LoadConfig() | 
| 78 | 79 | 
 | 
| 79 | 80 |         private void Setup() | 
| 80 | 81 |         { | 
| 81 |  | -            _parser = new RubberduckParser(); | 
|  | 82 | +            _parser = new RubberduckParser(_factory); | 
| 82 | 83 |             _parser.ParseStarted += _parser_ParseStarted; | 
| 83 | 84 |             _parser.ParserError += _parser_ParserError; | 
| 84 | 85 | 
 | 
| 85 | 86 |             _inspector = new Inspector(_parser, _configService); | 
| 86 | 87 | 
 | 
| 87 | 88 |             _parserErrorsPresenter = new ParserErrorsPresenter(_vbe, _addIn); | 
| 88 | 89 | 
 | 
| 89 |  | -            _menu = new RubberduckMenu(_vbe, _addIn, _configService, _parser, _editor, _inspector); | 
|  | 90 | +            _menu = new RubberduckMenu(_vbe, _addIn, _configService, _parser, _editor, _inspector, _factory); | 
| 90 | 91 |             _menu.Initialize(); | 
| 91 | 92 | 
 | 
| 92 |  | -            _formContextMenu = new FormContextMenu(_vbe, _parser); | 
|  | 93 | +            _formContextMenu = new FormContextMenu(_vbe, _parser, _factory); | 
| 93 | 94 |             _formContextMenu.Initialize(); | 
| 94 | 95 | 
 | 
| 95 | 96 |             _codeInspectionsToolbar = new CodeInspectionsToolbar(_vbe, _inspector); | 
| 96 | 97 |             _codeInspectionsToolbar.Initialize(); | 
| 97 | 98 | 
 | 
| 98 |  | -            if (toolbarCoords.X != -1 && toolbarCoords.Y != -1) | 
|  | 99 | +            if (_toolbarCoords.X != -1 && _toolbarCoords.Y != -1) | 
| 99 | 100 |             { | 
| 100 |  | -                _codeInspectionsToolbar.ToolbarCoords = toolbarCoords; | 
|  | 101 | +                _codeInspectionsToolbar.ToolbarCoords = _toolbarCoords; | 
| 101 | 102 |             } | 
| 102 |  | -            _codeInspectionsToolbar.ToolbarVisible = displayToolbar; | 
|  | 103 | +            _codeInspectionsToolbar.ToolbarVisible = _displayToolbar; | 
| 103 | 104 |         } | 
| 104 | 105 | 
 | 
| 105 | 106 |         private void _parser_ParseStarted(object sender, ParseStartedEventArgs e) | 
| @@ -139,8 +140,8 @@ private void CleanUp() | 
| 139 | 140 | 
 | 
| 140 | 141 |             if (_codeInspectionsToolbar != null) | 
| 141 | 142 |             { | 
| 142 |  | -                displayToolbar = _codeInspectionsToolbar.ToolbarVisible; | 
| 143 |  | -                toolbarCoords = _codeInspectionsToolbar.ToolbarCoords; | 
|  | 143 | +                _displayToolbar = _codeInspectionsToolbar.ToolbarVisible; | 
|  | 144 | +                _toolbarCoords = _codeInspectionsToolbar.ToolbarCoords; | 
| 144 | 145 |                 _codeInspectionsToolbar.Dispose(); | 
| 145 | 146 |             } | 
| 146 | 147 | 
 | 
|  | 
0 commit comments