Skip to content

Commit

Permalink
Revert "Started refactoring menu handlers into commands: AboutCommand…
Browse files Browse the repository at this point in the history
… works"

This reverts commit 3bd0a8b.
  • Loading branch information
retailcoder committed Aug 5, 2015
1 parent b70b5a8 commit c7e589c
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 269 deletions.
58 changes: 45 additions & 13 deletions RetailCoder.VBE/App.cs
Original file line number Diff line number Diff line change
@@ -1,47 +1,56 @@
using System;
using System.Drawing;
using System.Globalization;
using System.Windows.Forms;
using Rubberduck.Inspections;
using Rubberduck.Parsing;
using Rubberduck.Parsing.VBA;
using Rubberduck.Settings;
using Rubberduck.UI;
using Rubberduck.UI.CodeInspections;
using Rubberduck.UI.ParserErrors;

namespace Rubberduck
{
public class App : IDisposable
{
private readonly IMessageBox _messageBox;
private readonly IRubberduckMenuFactory _rubberduckMenuFactory;
private readonly IParserErrorsPresenterFactory _parserErrorsPresenterFactory;
private readonly IRubberduckParserFactory _parserFactory;
private readonly IInspectorFactory _inspectorFactory;
private IParserErrorsPresenter _parserErrorsPresenter;
private readonly IGeneralConfigService _configService;
//private readonly IMenu _integratedUserInterface;
private readonly IRubberduckMenuFactory _menuFactory;

private IRubberduckParser _parser;
private IMenu _menu;

private Configuration _config;
private IMenu _menu;
private readonly IMenu _formContextMenu;
private readonly IToolbar _codeInspectionsToolbar;

private bool _displayToolbar;
private Point _toolbarLocation = new Point(-1, -1);

public App(IMessageBox messageBox,
//IMenu integratedUserInterface,
IRubberduckMenuFactory menuFactory,
IRubberduckMenuFactory rubberduckMenuFactory,
IParserErrorsPresenterFactory parserErrorsPresenterFactory,
IRubberduckParserFactory parserFactory,
IInspectorFactory inspectorFactory,
IGeneralConfigService configService)
IGeneralConfigService configService,
[FormContextMenu] IMenu formContextMenu,
[CodeInspectionsToolbar] IToolbar codeInspectionsToolbar)
{
_messageBox = messageBox;
//_integratedUserInterface = integratedUserInterface;
_menuFactory = menuFactory;
_rubberduckMenuFactory = rubberduckMenuFactory;
_parserErrorsPresenterFactory = parserErrorsPresenterFactory;
_parserFactory = parserFactory;
_inspectorFactory = inspectorFactory;
_configService = configService;

_configService.SettingsChanged += _configService_SettingsChanged;

_formContextMenu = formContextMenu;
_codeInspectionsToolbar = codeInspectionsToolbar;
}

public void Startup()
Expand Down Expand Up @@ -83,13 +92,22 @@ private void Setup()
_parser = _parserFactory.Create();
_parser.ParseStarted += _parser_ParseStarted;
_parser.ParserError += _parser_ParserError;
_parserErrorsPresenter = _parserErrorsPresenterFactory.Create();

_inspectorFactory.Create();

_menu = _menuFactory.Create();
_parserErrorsPresenter = _parserErrorsPresenterFactory.Create();

_menu = _rubberduckMenuFactory.Create();
_menu.Initialize();
//_integratedUserInterface.Initialize();

_formContextMenu.Initialize();
_codeInspectionsToolbar.Initialize();

if (_toolbarLocation.X != -1 && _toolbarLocation.Y != -1)
{
_codeInspectionsToolbar.Location = _toolbarLocation;
}
_codeInspectionsToolbar.Visible = _displayToolbar;
}

private void _parser_ParseStarted(object sender, ParseStartedEventArgs e)
Expand Down Expand Up @@ -117,13 +135,27 @@ protected virtual void Dispose(bool disposing)

private void CleanUp()
{
//_integratedUserInterface.TearDown();
var menu = _menu as IDisposable;
if (menu != null)
{
menu.Dispose();
}

var formContextMenu = _formContextMenu as IDisposable;
if (formContextMenu != null)
{
formContextMenu.Dispose();
}

_displayToolbar = _codeInspectionsToolbar.Visible;
_toolbarLocation = _codeInspectionsToolbar.Location;

var codeInspectionsToolbar = _codeInspectionsToolbar as IDisposable;
if (codeInspectionsToolbar != null)
{
codeInspectionsToolbar.Dispose();
}

if (_parser != null)
{
_parser.ParseStarted -= _parser_ParseStarted;
Expand Down
5 changes: 0 additions & 5 deletions RetailCoder.VBE/Rubberduck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,6 @@
<Compile Include="Refactorings\ReorderParameters\ReorderParametersPresenterFactory.cs" />
<Compile Include="Refactorings\ReorderParameters\ReorderParametersRefactoring.cs" />
<Compile Include="Root\RubberduckModule.cs" />
<Compile Include="UI\Commands\AboutCommand.cs" />
<Compile Include="UI\Commands\IRubberduckMenuCommand.cs" />
<Compile Include="Settings\DisplayLanguageSetting.cs" />
<Compile Include="Settings\SourceControlConfiguration.cs" />
<Compile Include="Settings\SourceControlConfigurationService.cs" />
Expand Down Expand Up @@ -304,11 +302,8 @@
<Compile Include="Inspections\IdentifierNotUsedInspectionResult.cs" />
<Compile Include="Inspections\VariableNotAssignedInspection.cs" />
<Compile Include="Inspections\IdentifierNotAssignedInspectionResult.cs" />
<Compile Include="UI\Commands\RubberduckCommandBase.cs" />
<Compile Include="UI\Commands\ToolbarState.cs" />
<Compile Include="UI\FolderBrowser.cs" />
<Compile Include="UI\IMessageBox.cs" />
<Compile Include="UI\Commands\RubberduckMenuCommand.cs" />
<Compile Include="UI\ParserErrors\ParseErrorListItem.cs" />
<Compile Include="UI\RubberduckUI.de.Designer.cs">
<AutoGen>True</AutoGen>
Expand Down
13 changes: 4 additions & 9 deletions RetailCoder.VBE/UI/CodeExplorer/CodeExplorerMenu.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System;
using Microsoft.Office.Core;
using Microsoft.Office.Core;
using Microsoft.Vbe.Interop;
using CommandBarButtonClickEvent = Microsoft.Office.Core._CommandBarButtonEvents_ClickEventHandler;

namespace Rubberduck.UI.CodeExplorer
{
public class CodeExplorerMenu : Menu, IDisposable
public class CodeExplorerMenu : Menu
{
private CommandBarButton _codeExplorerButton;
private readonly CodeExplorerWindow _window;
Expand All @@ -29,7 +28,7 @@ private void OnCodeExplorerButtonClick(CommandBarButton button, ref bool cancelD
}

bool _disposed;
private void Dispose(bool disposing)
protected override void Dispose(bool disposing)
{
if (_disposed && !disposing)
{
Expand All @@ -44,11 +43,7 @@ private void Dispose(bool disposing)
_codeExplorerButton.Click -= OnCodeExplorerButtonClick;

_disposed = true;
}

public void Dispose()
{
Dispose(true);
base.Dispose(disposing);
}
}
}
42 changes: 0 additions & 42 deletions RetailCoder.VBE/UI/Commands/AboutCommand.cs

This file was deleted.

33 changes: 0 additions & 33 deletions RetailCoder.VBE/UI/Commands/IRubberduckMenuCommand.cs

This file was deleted.

40 changes: 0 additions & 40 deletions RetailCoder.VBE/UI/Commands/RubberduckCommandBase.cs

This file was deleted.

99 changes: 0 additions & 99 deletions RetailCoder.VBE/UI/Commands/RubberduckMenuCommand.cs

This file was deleted.

0 comments on commit c7e589c

Please sign in to comment.