diff --git a/RetailCoder.VBE/App.cs b/RetailCoder.VBE/App.cs index 4ab03cd999..353c5516df 100644 --- a/RetailCoder.VBE/App.cs +++ b/RetailCoder.VBE/App.cs @@ -3,23 +3,15 @@ using Infralution.Localization.Wpf; using NLog; using Rubberduck.Common; -using Rubberduck.Parsing; -using Rubberduck.Parsing.Symbols; -using Rubberduck.Parsing.VBA; using Rubberduck.Settings; using Rubberduck.UI; using Rubberduck.UI.Command.MenuItems; using System; using System.Globalization; -using System.Linq; using System.Windows.Forms; using Rubberduck.UI.Command; using Rubberduck.UI.Command.MenuItems.CommandBars; -using Rubberduck.VBEditor.Events; -using Rubberduck.VBEditor.SafeComWrappers; using Rubberduck.VBEditor.SafeComWrappers.Abstract; -using Rubberduck.VBEditor.SafeComWrappers.MSForms; -using Rubberduck.VBEditor.SafeComWrappers.Office.Core.Abstract; using Rubberduck.VersionCheck; using Application = System.Windows.Forms.Application; @@ -27,9 +19,7 @@ namespace Rubberduck { public sealed class App : IDisposable { - private readonly IVBE _vbe; private readonly IMessageBox _messageBox; - private readonly IParseCoordinator _parser; private readonly AutoSave.AutoSave _autoSave; private readonly IGeneralConfigService _configService; private readonly IAppMenu _appMenus; @@ -44,7 +34,6 @@ public sealed class App : IDisposable public App(IVBE vbe, IMessageBox messageBox, - IParseCoordinator parser, IGeneralConfigService configService, IAppMenu appMenus, RubberduckCommandBar stateBar, @@ -52,163 +41,20 @@ public App(IVBE vbe, IVersionCheck version, CommandBase checkVersionCommand) { - _vbe = vbe; _messageBox = messageBox; - _parser = parser; _configService = configService; - _autoSave = new AutoSave.AutoSave(_vbe, _configService); + _autoSave = new AutoSave.AutoSave(vbe, _configService); _appMenus = appMenus; _stateBar = stateBar; _hooks = hooks; _version = version; _checkVersionCommand = checkVersionCommand; - VBENativeServices.SelectionChanged += _vbe_SelectionChanged; - VBENativeServices.WindowFocusChange += _vbe_FocusChanged; - _configService.SettingsChanged += _configService_SettingsChanged; - _parser.State.StateChanged += Parser_StateChanged; - _parser.State.StatusMessageUpdate += State_StatusMessageUpdate; - + UiDispatcher.Initialize(); } - //TODO - This should be able to move to the appropriate handling classes now. - #region Statusbar - - private void State_StatusMessageUpdate(object sender, RubberduckStatusMessageEventArgs e) - { - var message = e.Message; - if (message == ParserState.LoadingReference.ToString()) - { - // note: ugly hack to enable Rubberduck.Parsing assembly to do this - message = RubberduckUI.ParserState_LoadingReference; - } - - _stateBar.SetStatusLabelCaption(message, _parser.State.ModuleExceptions.Count); - } - - private void _vbe_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - RefreshSelection(e.CodePane); - } - - private void _vbe_FocusChanged(object sender, WindowChangedEventArgs e) - { - if (e.EventType == FocusType.GotFocus) - { - switch (e.Window.Type) - { - case WindowKind.Designer: - //Designer or control on designer form selected. - RefreshSelection(e.Window); - break; - case WindowKind.CodeWindow: - //Caret changed in a code pane. - RefreshSelection(e.CodePane); - break; - } - } - else if (e.EventType == FocusType.ChildFocus) - { - //Treeview selection changed in project window. - RefreshSelection(); - } - } - - private ParserState _lastStatus; - private Declaration _lastSelectedDeclaration; - private void RefreshSelection(ICodePane pane) - { - if (pane == null || pane.IsWrappingNullReference) - { - return; - } - - var selectedDeclaration = _parser.State.FindSelectedDeclaration(pane); - var caption = _stateBar.GetContextSelectionCaption(_vbe.ActiveCodePane, selectedDeclaration); - UpdateStatusbarAndCommandState(caption, selectedDeclaration); - } - - private void RefreshSelection(IWindow window) - { - if (window == null || window.IsWrappingNullReference || window.Type != WindowKind.Designer) - { - return; - } - - var component = _vbe.SelectedVBComponent; - var caption = GetComponentControlsCaption(component); - //TODO: Need to find the selected declaration for the Form\Control. - UpdateStatusbarAndCommandState(caption, null); - } - - private void RefreshSelection() - { - var caption = string.Empty; - var component = _vbe.SelectedVBComponent; - if (component == null || component.IsWrappingNullReference) - { - //The user might have selected the project node in Project Explorer - //If they've chosen a folder, we'll return the project anyway - caption = !_vbe.ActiveVBProject.IsWrappingNullReference - ? _vbe.ActiveVBProject.Name - : null; - } - else - { - caption = component.Type == ComponentType.UserForm && component.HasOpenDesigner - ? GetComponentControlsCaption(component) - : string.Format("{0}.{1} ({2})", component.ParentProject.Name, component.Name, component.Type); - } - //TODO: Need to find the selected declaration for the selected treeview item. - UpdateStatusbarAndCommandState(caption, null); - } - - private void UpdateStatusbarAndCommandState(string caption, Declaration selectedDeclaration) - { - var refCount = selectedDeclaration == null ? 0 : selectedDeclaration.References.Count(); - _stateBar.SetContextSelectionCaption(caption, refCount); - - var currentStatus = _parser.State.Status; - if (ShouldEvaluateCanExecute(selectedDeclaration, currentStatus)) - { - _appMenus.EvaluateCanExecute(_parser.State); - _stateBar.EvaluateCanExecute(_parser.State); - } - - _lastStatus = currentStatus; - _lastSelectedDeclaration = selectedDeclaration; - } - - private string GetComponentControlsCaption(IVBComponent component) - { - switch (component.SelectedControls.Count) - { - case 0: - //TODO get the real designer for VB6 - return String.Format("{0}.{1} ({2})", component.ParentProject.Name, component.Name, "MSForms.UserForm"); - break; - case 1: - //TODO return the libraryName.className of the control - IControl control = component.SelectedControls.First(); - return String.Format("{0}.{1}.{2} ({3})", component.ParentProject.Name, component.Name, control.Name, control.TypeName()); - break; - default: - return String.Format("{0}.{1} ({2})", component.ParentProject.Name, component.Name, RubberduckUI.ContextMultipleControlsSelection); - break; - } - } - - private bool ShouldEvaluateCanExecute(Declaration selectedDeclaration, ParserState currentStatus) - { - return _lastStatus != currentStatus || - (selectedDeclaration != null && !selectedDeclaration.Equals(_lastSelectedDeclaration)) || - (selectedDeclaration == null && _lastSelectedDeclaration != null); - } - - #endregion - private void _configService_SettingsChanged(object sender, ConfigurationChangedEventArgs e) { _config = _configService.LoadConfiguration(); @@ -254,8 +100,7 @@ public void Startup() _stateBar.Initialize(); _hooks.HookHotkeys(); // need to hook hotkeys before we localize menus, to correctly display ShortcutTexts _appMenus.Localize(); - _stateBar.SetStatusLabelCaption(ParserState.Pending); - _stateBar.EvaluateCanExecute(_parser.State); + UpdateLoggingLevel(); if (_config.UserSettings.GeneralSettings.CheckVersion) @@ -276,14 +121,6 @@ public void Shutdown() } } - private void Parser_StateChanged(object sender, EventArgs e) - { - Logger.Debug("App handles StateChanged ({0}), evaluating menu states...", _parser.State.Status); - _appMenus.EvaluateCanExecute(_parser.State); - _stateBar.EvaluateCanExecute(_parser.State); - _stateBar.SetStatusLabelCaption(_parser.State.Status, _parser.State.ModuleExceptions.Count); - } - private void LoadConfig() { _config = _configService.LoadConfiguration(); @@ -354,15 +191,6 @@ public void Dispose() return; } - if (_parser != null && _parser.State != null) - { - _parser.State.StateChanged -= Parser_StateChanged; - _parser.State.StatusMessageUpdate -= State_StatusMessageUpdate; - } - - VBENativeServices.SelectionChanged += _vbe_SelectionChanged; - VBENativeServices.WindowFocusChange += _vbe_FocusChanged; - if (_configService != null) { _configService.SettingsChanged -= _configService_SettingsChanged; diff --git a/RetailCoder.VBE/AppMenu.cs b/RetailCoder.VBE/AppMenu.cs index 2b4891db72..3d14ab20b7 100644 --- a/RetailCoder.VBE/AppMenu.cs +++ b/RetailCoder.VBE/AppMenu.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; +using Rubberduck.Parsing; using Rubberduck.Parsing.VBA; +using Rubberduck.UI; using Rubberduck.UI.Command.MenuItems; using Rubberduck.UI.Command.MenuItems.ParentMenus; @@ -10,10 +12,17 @@ namespace Rubberduck public class AppMenu : IAppMenu, IDisposable { private readonly IReadOnlyList _menus; + private readonly IParseCoordinator _parser; + private readonly ISelectionChangeService _selectionService; - public AppMenu(IEnumerable menus) + public AppMenu(IEnumerable menus, IParseCoordinator parser, ISelectionChangeService selectionService) { _menus = menus.ToList(); + _parser = parser; + _selectionService = selectionService; + + _parser.State.StateChanged += OnParserStateChanged; + _selectionService.SelectedDeclarationChanged += OnSelectedDeclarationChange; } public void Initialize() @@ -24,6 +33,16 @@ public void Initialize() } } + public void OnSelectedDeclarationChange(object sender, DeclarationChangedEventArgs e) + { + EvaluateCanExecute(_parser.State); + } + + private void OnParserStateChanged(object sender, EventArgs e) + { + EvaluateCanExecute(_parser.State); + } + public void EvaluateCanExecute(RubberduckParserState state) { foreach (var menu in _menus) @@ -42,6 +61,9 @@ public void Localize() public void Dispose() { + _parser.State.StateChanged -= OnParserStateChanged; + _selectionService.SelectedDeclarationChanged -= OnSelectedDeclarationChange; + // note: doing this wrecks the teardown process. counter-intuitive? sure. but hey it works. //foreach (var menu in _menus.Where(menu => menu.Item != null)) //{ diff --git a/RetailCoder.VBE/Ducky.ico b/RetailCoder.VBE/Ducky.ico index 236f4c74c3..3c1251f05b 100644 Binary files a/RetailCoder.VBE/Ducky.ico and b/RetailCoder.VBE/Ducky.ico differ diff --git a/RetailCoder.VBE/NLog.dll.nlog b/RetailCoder.VBE/NLog.dll.nlog index 75d4c62d25..fc4754b4ed 100644 --- a/RetailCoder.VBE/NLog.dll.nlog +++ b/RetailCoder.VBE/NLog.dll.nlog @@ -16,12 +16,6 @@ deleteOldFileOnStartup="true" keepFileOpen="false" encoding="UTF-8"/> - - - diff --git a/RetailCoder.VBE/Refactorings/EncapsulateField/EncapsulateFieldPresenter.cs b/RetailCoder.VBE/Refactorings/EncapsulateField/EncapsulateFieldPresenter.cs index 9b77def338..c3691e3ff5 100644 --- a/RetailCoder.VBE/Refactorings/EncapsulateField/EncapsulateFieldPresenter.cs +++ b/RetailCoder.VBE/Refactorings/EncapsulateField/EncapsulateFieldPresenter.cs @@ -1,7 +1,9 @@ using System.Linq; using System.Windows.Forms; using Antlr4.Runtime; +using Rubberduck.Parsing; using Rubberduck.Parsing.Grammar; +using Rubberduck.Parsing.Symbols; namespace Rubberduck.Refactorings.EncapsulateField { @@ -21,22 +23,6 @@ public EncapsulateFieldPresenter(IEncapsulateFieldDialog view, EncapsulateFieldM _model = model; } - private static readonly string[] PrimitiveTypes = - { - Tokens.Boolean, - Tokens.Byte, - Tokens.Date, - Tokens.Decimal, - Tokens.Double, - Tokens.Long, - Tokens.LongLong, - Tokens.LongPtr, - Tokens.Integer, - Tokens.Single, - Tokens.String, - Tokens.StrPtr - }; - public EncapsulateFieldModel Show() { if (_model.TargetDeclaration == null) { return null; } @@ -44,19 +30,13 @@ public EncapsulateFieldModel Show() _view.TargetDeclaration = _model.TargetDeclaration; _view.NewPropertyName = _model.TargetDeclaration.IdentifierName; + var isVariant = _model.TargetDeclaration.AsTypeName.Equals(Tokens.Variant); + var isValueType = !isVariant && (SymbolList.ValueTypes.Contains(_model.TargetDeclaration.AsTypeName) || + _model.TargetDeclaration.DeclarationType == DeclarationType.Enumeration); + if (_model.TargetDeclaration.References.Any(r => r.IsAssignment)) { - if (PrimitiveTypes.Contains(_model.TargetDeclaration.AsTypeName)) - { - _view.MustImplementLetSetterType = true; - _view.CanImplementSetSetterType = false; - } - else if (_model.TargetDeclaration.AsTypeName != Tokens.Variant) - { - _view.MustImplementSetSetterType = true; - _view.CanImplementLetSetterType = false; - } - else + if (isVariant) { RuleContext node = _model.TargetDeclaration.References.First(r => r.IsAssignment).Context; while (!(node is VBAParser.LetStmtContext) && !(node is VBAParser.SetStmtContext)) @@ -66,25 +46,36 @@ public EncapsulateFieldModel Show() if (node is VBAParser.LetStmtContext) { - _view.MustImplementLetSetterType = true; - _view.CanImplementSetSetterType = false; + _view.CanImplementLetSetterType = true; } else { - _view.MustImplementSetSetterType = true; - _view.CanImplementLetSetterType = false; - } + _view.CanImplementSetSetterType = true; + } + } + else if (isValueType) + { + _view.CanImplementLetSetterType = true; + } + else + { + _view.CanImplementSetSetterType = true; } } else { - if (PrimitiveTypes.Contains(_model.TargetDeclaration.AsTypeName)) + if (isValueType) + { + _view.CanImplementLetSetterType = true; + } + else if (!isVariant) { - _view.CanImplementSetSetterType = false; + _view.CanImplementSetSetterType = true; } - else if (_model.TargetDeclaration.AsTypeName != Tokens.Variant) + else { - _view.CanImplementLetSetterType = false; + _view.CanImplementLetSetterType = true; + _view.CanImplementSetSetterType = true; } } @@ -94,9 +85,9 @@ public EncapsulateFieldModel Show() } _model.PropertyName = _view.NewPropertyName; - _model.ImplementLetSetterType = _view.MustImplementLetSetterType; - _model.ImplementSetSetterType = _view.MustImplementSetSetterType; - _model.CanImplementLet = _view.CanImplementLetSetterType; + _model.ImplementLetSetterType = _view.CanImplementLetSetterType; + _model.ImplementSetSetterType = _view.CanImplementSetSetterType; + _model.CanImplementLet = !_view.MustImplementSetSetterType; _model.ParameterName = _view.ParameterName; return _model; diff --git a/RetailCoder.VBE/Refactorings/EncapsulateField/EncapsulateFieldRefactoring.cs b/RetailCoder.VBE/Refactorings/EncapsulateField/EncapsulateFieldRefactoring.cs index 57d974d40f..65530617c0 100644 --- a/RetailCoder.VBE/Refactorings/EncapsulateField/EncapsulateFieldRefactoring.cs +++ b/RetailCoder.VBE/Refactorings/EncapsulateField/EncapsulateFieldRefactoring.cs @@ -79,7 +79,7 @@ private void AddProperty() var module = _model.TargetDeclaration.QualifiedName.QualifiedModuleName.Component.CodeModule; SetFieldToPrivate(module); - module.InsertLines(module.CountOfDeclarationLines + 1, GetPropertyText()); + module.InsertLines(module.CountOfDeclarationLines + 1, Environment.NewLine + GetPropertyText()); } private void UpdateReferences() @@ -207,30 +207,17 @@ private string RemoveExtraComma(string str, int numParams, int indexRemoved) private string GetPropertyText() { - var getterText = string.Join(Environment.NewLine, - string.Format(Environment.NewLine + "Public Property Get {0}() As {1}", _model.PropertyName, - _model.TargetDeclaration.AsTypeName), - string.Format(" {0}{1} = {2}", !_model.CanImplementLet || _model.ImplementSetSetterType ? "Set " : string.Empty, _model.PropertyName, _model.TargetDeclaration.IdentifierName), - "End Property" + Environment.NewLine); - - var letterText = string.Join(Environment.NewLine, - string.Format(Environment.NewLine + "Public Property Let {0}(ByVal {1} As {2})", - _model.PropertyName, _model.ParameterName, _model.TargetDeclaration.AsTypeName), - string.Format(" {0} = {1}", _model.TargetDeclaration.IdentifierName, _model.ParameterName), - "End Property" + Environment.NewLine); - - var setterText = string.Join(Environment.NewLine, - string.Format(Environment.NewLine + "Public Property Set {0}(ByVal {1} As {2})", - _model.PropertyName, _model.ParameterName, _model.TargetDeclaration.AsTypeName), - string.Format(" Set {0} = {1}", _model.TargetDeclaration.IdentifierName, _model.ParameterName), - "End Property" + Environment.NewLine); - - var propertyText = string.Join(string.Empty, - getterText, - (_model.ImplementLetSetterType ? letterText : string.Empty), - (_model.ImplementSetSetterType ? setterText : string.Empty)).TrimEnd() + Environment.NewLine; - - var propertyTextLines = propertyText.Split(new[] {Environment.NewLine}, StringSplitOptions.None); + var generator = new PropertyGenerator + { + PropertyName = _model.PropertyName, + AsTypeName = _model.TargetDeclaration.AsTypeName, + BackingField = _model.TargetDeclaration.IdentifierName, + ParameterName = _model.ParameterName, + GenerateSetter = _model.ImplementSetSetterType, + GenerateLetter = _model.ImplementLetSetterType + }; + + var propertyTextLines = generator.AllPropertyCode.Split(new[] { Environment.NewLine }, StringSplitOptions.None); return string.Join(Environment.NewLine, _indenter.Indent(propertyTextLines, true)); } } diff --git a/RetailCoder.VBE/Refactorings/EncapsulateField/IEncapsulateFieldDialog.cs b/RetailCoder.VBE/Refactorings/EncapsulateField/IEncapsulateFieldDialog.cs index d9c989ee7c..4a140b2069 100644 --- a/RetailCoder.VBE/Refactorings/EncapsulateField/IEncapsulateFieldDialog.cs +++ b/RetailCoder.VBE/Refactorings/EncapsulateField/IEncapsulateFieldDialog.cs @@ -10,9 +10,10 @@ public interface IEncapsulateFieldDialog :IDialogView string NewPropertyName { get; set; } bool CanImplementLetSetterType { get; set; } bool CanImplementSetSetterType { get; set; } - - bool MustImplementLetSetterType { get; set; } - bool MustImplementSetSetterType { get; set; } + bool LetSetterSelected { get; } + bool SetSetterSelected { get; } + bool MustImplementLetSetterType { get; } + bool MustImplementSetSetterType { get; } string ParameterName { get; set; } } diff --git a/RetailCoder.VBE/Refactorings/EncapsulateField/PropertyGenerator.cs b/RetailCoder.VBE/Refactorings/EncapsulateField/PropertyGenerator.cs new file mode 100644 index 0000000000..1d46764e10 --- /dev/null +++ b/RetailCoder.VBE/Refactorings/EncapsulateField/PropertyGenerator.cs @@ -0,0 +1,81 @@ +using System; + +namespace Rubberduck.Refactorings.EncapsulateField +{ + public class PropertyGenerator + { + public string PropertyName { get; set; } + public string BackingField { get; set; } + public string AsTypeName { get; set; } + public string ParameterName { get; set; } + public bool GenerateLetter { get; set; } + public bool GenerateSetter { get; set; } + + public string AllPropertyCode + { + get + { + return GetterCode + + (GenerateLetter ? LetterCode : string.Empty) + + (GenerateSetter ? SetterCode : string.Empty); + } + } + + public string GetterCode + { + get + { + if (GenerateSetter && GenerateLetter) + { + return string.Join(Environment.NewLine, + string.Format("Public Property Get {0}() As {1}", PropertyName, AsTypeName), + string.Format(" If IsObject({0}) Then", BackingField), + string.Format(" Set {0} = {1}", PropertyName, BackingField), + " Else", + string.Format(" {0} = {1}", PropertyName, BackingField), + " End If", + "End Property", + Environment.NewLine); + } + + return string.Join(Environment.NewLine, + string.Format("Public Property Get {0}() As {1}", PropertyName, AsTypeName), + string.Format(" {0}{1} = {2}", GenerateSetter ? "Set " : string.Empty, PropertyName, BackingField), + "End Property", + Environment.NewLine); + } + } + + public string SetterCode + { + get + { + if (!GenerateSetter) + { + return string.Empty; + } + return string.Join(Environment.NewLine, + string.Format("Public Property Set {0}(ByVal {1} As {2})", PropertyName, ParameterName, AsTypeName), + string.Format(" Set {0} = {1}", BackingField, ParameterName), + "End Property", + Environment.NewLine); + } + } + + public string LetterCode + { + get + { + if (!GenerateLetter) + { + return string.Empty; + } + return string.Join(Environment.NewLine, + string.Format("Public Property Let {0}(ByVal {1} As {2})", PropertyName, ParameterName, AsTypeName), + string.Format(" {0} = {1}", BackingField, ParameterName), + "End Property", + Environment.NewLine); + } + } + } +} diff --git a/RetailCoder.VBE/Root/RubberduckModule.cs b/RetailCoder.VBE/Root/RubberduckModule.cs index 1436aba97e..46d78d5f94 100644 --- a/RetailCoder.VBE/Root/RubberduckModule.cs +++ b/RetailCoder.VBE/Root/RubberduckModule.cs @@ -63,11 +63,12 @@ public override void Load() Bind().ToConstant(_addin); Bind().ToSelf().InSingletonScope(); Bind().ToSelf().InSingletonScope(); + Bind().To().InSingletonScope(); Bind().To(); //Bind().ToSelf().InSingletonScope(); Bind().ToSelf().InSingletonScope(); Bind().To().InSingletonScope(); - + Bind().To().WhenInjectedExactlyInto(); BindCodeInspectionTypes(); @@ -175,6 +176,7 @@ private void ApplyDefaultInterfacesConvention(IEnumerable assemblies) // inspections & factories have their own binding rules .Where(type => type.Namespace != null && !type.Namespace.StartsWith("Rubberduck.VBEditor.SafeComWrappers") + && !type.Name.Equals("SelectionChangeService") && !type.Name.EndsWith("Factory") && !type.Name.EndsWith("ConfigProvider") && !type.GetInterfaces().Contains(typeof(IInspection))) .BindDefaultInterface() .Configure(binding => binding.InCallScope())); // TransientScope wouldn't dispose disposables diff --git a/RetailCoder.VBE/Rubberduck.csproj b/RetailCoder.VBE/Rubberduck.csproj index 2959822a3a..dcef2a33bc 100644 --- a/RetailCoder.VBE/Rubberduck.csproj +++ b/RetailCoder.VBE/Rubberduck.csproj @@ -413,6 +413,7 @@ + @@ -467,7 +468,9 @@ + + diff --git a/RetailCoder.VBE/UI/About/AboutDialog.resx b/RetailCoder.VBE/UI/About/AboutDialog.resx index d3a1a2980d..0a0a5023e2 100644 --- a/RetailCoder.VBE/UI/About/AboutDialog.resx +++ b/RetailCoder.VBE/UI/About/AboutDialog.resx @@ -120,23 +120,26 @@ - AAABAAEAEA4AAAEAIADgAwAAFgAAACgAAAAQAAAAHAAAAAEAIAAAAAAAuAMAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAB4AAABxAAEBtQEYGOMCLCz3AzEx/AIhIewABwfFAAAAiQAAADYAAAABAAAAAAAA - AAAAAAAAAAAAAQAAAJIDODj5CJqa/wzh4f8O/f3/Dv///w7///8O////De/v/wq0tP8ES0v/AAAAewAA - AAAAAAAAAAAAAAAAAEcFWlr/Dv///w7///8O////Dv///w7///8O////Dv///w7///8O////Dvv7/wMw - MPkAAAAgAAAAAAAAAAAAAQGpC8zM/w7///8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8JoKD/AAAAfAAAAAAAAAAAARMT4g78/P8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////DNzc/wAAALAAAAAAAAAAAAImJvcO////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w3o6P8AAAC8AAAAAAAAAAACHh7vDv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w7///8LxMT/AAAAngAAAAAAAAAAAAQExg3o6P8O////Dv///wmnp/8GZ2f/B3l5/wZ1 - df8Kr6//Dv///w7///8O////Bmxs/wAAAFIAAAAAAAAAAAAAAGwHgoL/Dv///wq+vv8BDAzTAAAAOQAA - AE8BDQ3yDNLS/w7///8O////Dv///wZlZf8AABS4AAAPgQAAAA0AAAAIAQwM1AVjY/8ABwfEAAAAGAAA - AAAAAABNBnJy/w7///8O////Dv///w7///8N5ub/AAM+/wAA4P8AAC62AAAAAAAAACAAAABLAAAAAgAA - AAAAAAAAAAAAaAiUlP8O////Dv///wvKyv8Lvr7/Dvv7/wEQMf8AAP//AACF/wAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAADkFV1f/Dv///w7///8HdHT/Blxc/wvMzP8AAAXWAAAoogAAF58AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAEBrwiQkP8O+/v/Dv///wzY2P8CLCz1AAAAMQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACHARkZ4wIpKfQABga8AAAANgAAAAAAAAAAAAAAAMAH - AAAABwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAQAAACMAAAA/AAAAP4DAAD+BwAA + AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAEAAAAAAAAABwAAAAgAAAAGAAAABwAAAAgAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAABAwNEAAAA/zpkZP8uXmP/LGBl/y9hY/80ZGP/OWlo/0t2dP8AAAD/AAAAxwEC + AogAAAAAAAAAAAAAAAAAAQGTCicr/zTk+f9U3v//RtX//0rV//9P3f//Ve3//y/p//855/v/Qv3//1T/ + //8MLS/+AAAA0QAAAAAAAQGRBBMW/zXn/f846v//SNz9/0jL/v8xvv//OMv//0DU//8/3v3/L+j//zTo + //8r4/z/Svr//0mAf/4BAgKIISko/ynQ5v8x6P//Men//y7Z7v9ApLn/LrH4/y+y9f84vfT/K57K/y/l + +v8x5///L+j//0v2//+M////AAAAihIsLf8w7f//MOr//zXq//8x6f//JK6+/yeIp/8gZoL/LYyq/ynF + 2f8w5/7/MOj//zTq//9K9P//g////wAAAJUAAADSROX//1LK//9E5f//OO7//zLr//8w4ff/L+X7/y/j + +v8x6P//N+z//zHo//8s5v//gv3//7j///4AAACcAAAAlD+Cof87c4z/RGNj/zRdY/8xoK7+LfX//xrm + //8c2v//IeD//zDx//9G+P//Vvr//9z///8kKir/AAAAAAAAAFYAAABtAAAAGgAAAAgAAAALAAAA2yTb + +v8Y0f//HNr//xzf//8z+///Yv///2y8vP4qMjL/BAUFMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3Cac + r/8t0/7/Icn//x7Y//8o+P7/Sv///wAAAP8AAACgAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEwwh + I/873P//JMj//xS8//8Wyv//Gpi2/wIADv8LCgC5AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + ACUqYWT/Mtb//xy6//8Gt/7/Htr//xlhbP8fRvX/O1Hs/jlCctsAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAaSGpo/0vZ//4Zs///n+z//wAAAP9FVFz/E0Gh/z1G//9AS2j/AAAAAwAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAABAAAAKiS8/7MOr3//pLc/v/v////Pmxs/zBBPcIAAAD/ISEv/wAAAAQAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAABNAAAAtqXk8shM0v//Ppac/wAAAP8AAAA2AAAAAAAAAAcAAAABAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAACfAAAAlAAAAIAAAAA3AAAAAQAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAOADAACAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAD4AwAA8AcAAPAPAADwBwAA8AcAAPAH + AAD4PwAA/H8AAA== \ No newline at end of file diff --git a/RetailCoder.VBE/UI/Command/MenuItems/CommandBars/AppCommandBarBase.cs b/RetailCoder.VBE/UI/Command/MenuItems/CommandBars/AppCommandBarBase.cs index ee8c06900b..63637e594e 100644 --- a/RetailCoder.VBE/UI/Command/MenuItems/CommandBars/AppCommandBarBase.cs +++ b/RetailCoder.VBE/UI/Command/MenuItems/CommandBars/AppCommandBarBase.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; @@ -50,7 +49,7 @@ public void Localize() } } - public void Initialize() + public virtual void Initialize() { if (Parent == null) { diff --git a/RetailCoder.VBE/UI/Command/MenuItems/CommandBars/IContextFormatter.cs b/RetailCoder.VBE/UI/Command/MenuItems/CommandBars/IContextFormatter.cs index 3972a20637..ddb54628d3 100644 --- a/RetailCoder.VBE/UI/Command/MenuItems/CommandBars/IContextFormatter.cs +++ b/RetailCoder.VBE/UI/Command/MenuItems/CommandBars/IContextFormatter.cs @@ -1,4 +1,3 @@ -using System.Linq; using Rubberduck.Parsing; using Rubberduck.Parsing.Symbols; using Rubberduck.VBEditor.SafeComWrappers.Abstract; @@ -8,9 +7,13 @@ namespace Rubberduck.UI.Command.MenuItems.CommandBars public interface IContextFormatter { /// - /// Determines the formatting of the contextual selection caption. + /// Determines the formatting of the contextual selection caption when a codepane is active. /// string Format(ICodePane activeCodePane, Declaration declaration); + /// + /// Determines the formatting of the contextual selection caption when a codepane is not active. + /// + string Format(Declaration declaration, bool multipleControls); } public class ContextFormatter : IContextFormatter @@ -30,12 +33,17 @@ public string Format(ICodePane activeCodePane, Declaration declaration) var selection = qualifiedSelection.Value; var codePaneSelectionText = selection.Selection.ToString(); - var contextSelectionText = Format(declaration); + var contextSelectionText = FormatDeclaration(declaration); return string.Format("{0} | {1}", codePaneSelectionText, contextSelectionText); } - private string Format(Declaration declaration) + public string Format(Declaration declaration, bool multipleControls) + { + return declaration == null ? string.Empty : FormatDeclaration(declaration, multipleControls); + } + + private string FormatDeclaration(Declaration declaration, bool multipleControls = false) { var formattedDeclaration = string.Empty; var moduleName = declaration.QualifiedName.QualifiedModuleName; @@ -44,11 +52,14 @@ private string Format(Declaration declaration) : declaration.AsTypeName; var declarationType = RubberduckUI.ResourceManager.GetString("DeclarationType_" + declaration.DeclarationType, Settings.Settings.Culture); - typeName = "(" + declarationType + (string.IsNullOrEmpty(typeName) ? string.Empty : ":" + typeName) + ")"; + typeName = multipleControls + ? RubberduckUI.ContextMultipleControlsSelection + : "(" + declarationType + (string.IsNullOrEmpty(typeName) ? string.Empty : ":" + typeName) + ")"; if (declaration.DeclarationType.HasFlag(DeclarationType.Project) || declaration.DeclarationType == DeclarationType.BracketedExpression) { - formattedDeclaration = System.IO.Path.GetFileName(declaration.QualifiedName.QualifiedModuleName.ProjectPath) + ";" + declaration.IdentifierName + " (" + declarationType + ")"; + var filename = System.IO.Path.GetFileName(declaration.QualifiedName.QualifiedModuleName.ProjectPath); + formattedDeclaration = string.Format("{0}{1}{2} ({3})", filename, string.IsNullOrEmpty(filename) ? string.Empty : ";", declaration.IdentifierName, declarationType); } else if (declaration.DeclarationType.HasFlag(DeclarationType.Module)) { diff --git a/RetailCoder.VBE/UI/Command/MenuItems/CommandBars/RubberduckCommandBar.cs b/RetailCoder.VBE/UI/Command/MenuItems/CommandBars/RubberduckCommandBar.cs index f0c2715b84..79fb96ec8d 100644 --- a/RetailCoder.VBE/UI/Command/MenuItems/CommandBars/RubberduckCommandBar.cs +++ b/RetailCoder.VBE/UI/Command/MenuItems/CommandBars/RubberduckCommandBar.cs @@ -1,8 +1,9 @@ using System; using System.Collections.Generic; +using System.Linq; +using Rubberduck.Parsing; using Rubberduck.Parsing.Symbols; using Rubberduck.Parsing.VBA; -using Rubberduck.VBEditor.SafeComWrappers.Abstract; using Rubberduck.VBEditor.SafeComWrappers.Office.Core; namespace Rubberduck.UI.Command.MenuItems.CommandBars @@ -10,11 +11,82 @@ namespace Rubberduck.UI.Command.MenuItems.CommandBars public class RubberduckCommandBar : AppCommandBarBase, IDisposable { private readonly IContextFormatter _formatter; + private readonly IParseCoordinator _parser; + private readonly ISelectionChangeService _selectionService; - public RubberduckCommandBar(IEnumerable items, IContextFormatter formatter) + public RubberduckCommandBar(IParseCoordinator parser, IEnumerable items, IContextFormatter formatter, ISelectionChangeService selectionService) : base("Rubberduck", CommandBarPosition.Top, items) { + _parser = parser; _formatter = formatter; + _selectionService = selectionService; + + _parser.State.StateChanged += OnParserStateChanged; + _parser.State.StatusMessageUpdate += OnParserStatusMessageUpdate; + _selectionService.SelectionChanged += OnSelectionChange; + } + + //This class is instantiated early enough that the initial control state isn't ready to be set up. So... override Initialize + //and have the state set via the Initialize call. + public override void Initialize() + { + base.Initialize(); + SetStatusLabelCaption(ParserState.Pending); + EvaluateCanExecute(_parser.State); + } + + private Declaration _lastDeclaration; + private ParserState _lastStatus = ParserState.None; + private void EvaluateCanExecute(RubberduckParserState state, Declaration selected) + { + var currentStatus = _parser.State.Status; + if (_lastStatus == currentStatus && + (selected == null || selected.Equals(_lastDeclaration)) && + (selected != null || _lastDeclaration == null)) + { + return; + } + + _lastStatus = currentStatus; + _lastDeclaration = selected; + base.EvaluateCanExecute(state); + } + + public void OnSelectionChange(object sender, DeclarationChangedEventArgs e) + { + var caption = e.ActivePane != null + ? _formatter.Format(e.ActivePane, e.Declaration) + : _formatter.Format(e.Declaration, e.MultipleControlsSelected); + + if (string.IsNullOrEmpty(caption) && e.VBComponent != null) + { + //Fallback caption for selections in the Project window. + caption = string.Format("{0}.{1} ({2})", e.VBComponent.ParentProject.Name, e.VBComponent.Name, e.VBComponent.Type); + } + + var refCount = e.Declaration == null ? 0 : e.Declaration.References.Count(); + SetContextSelectionCaption(caption, refCount); + EvaluateCanExecute(_parser.State, e.Declaration); + } + + + private void OnParserStatusMessageUpdate(object sender, RubberduckStatusMessageEventArgs e) + { + var message = e.Message; + if (message == ParserState.LoadingReference.ToString()) + { + // note: ugly hack to enable Rubberduck.Parsing assembly to do this + message = RubberduckUI.ParserState_LoadingReference; + } + + SetStatusLabelCaption(message, _parser.State.ModuleExceptions.Count); + } + + private void OnParserStateChanged(object sender, EventArgs e) + { + _lastStatus = _parser.State.Status; + EvaluateCanExecute(_parser.State); + SetStatusLabelCaption(_parser.State.Status, _parser.State.ModuleExceptions.Count); } public void SetStatusLabelCaption(ParserState state, int? errorCount = null) @@ -43,11 +115,6 @@ public void SetStatusLabelCaption(string caption, int? errorCount = null) Localize(); } - public string GetContextSelectionCaption(ICodePane activeCodePane, Declaration declaration) - { - return _formatter.Format(activeCodePane, declaration); - } - public void SetContextSelectionCaption(string caption, int contextReferenceCount) { var contextLabel = FindChildByTag(typeof(ContextSelectionLabelMenuItem).FullName) as ContextSelectionLabelMenuItem; @@ -66,6 +133,10 @@ public void SetContextSelectionCaption(string caption, int contextReferenceCount public void Dispose() { + _selectionService.SelectionChanged -= OnSelectionChange; + _parser.State.StateChanged -= OnParserStateChanged; + _parser.State.StatusMessageUpdate -= OnParserStatusMessageUpdate; + //note: doing this wrecks the teardown process. counter-intuitive? sure. but hey it works. //RemoveChildren(); //Item.Delete(); diff --git a/RetailCoder.VBE/UI/DockableWindowHost.cs b/RetailCoder.VBE/UI/DockableWindowHost.cs index d7239a710f..e0a8e06ec3 100644 --- a/RetailCoder.VBE/UI/DockableWindowHost.cs +++ b/RetailCoder.VBE/UI/DockableWindowHost.cs @@ -147,7 +147,6 @@ protected override void DefWndProc(ref Message m) if (m.Msg == (int) WM.DESTROY) { _thisHandle.Free(); - return; } base.DefWndProc(ref m); } diff --git a/RetailCoder.VBE/UI/EnvironmentProvider.cs b/RetailCoder.VBE/UI/EnvironmentProvider.cs new file mode 100644 index 0000000000..4593eb387e --- /dev/null +++ b/RetailCoder.VBE/UI/EnvironmentProvider.cs @@ -0,0 +1,22 @@ +using System; + +namespace Rubberduck.UI +{ + public interface IEnvironmentProvider + { + string GetFolderPath(Environment.SpecialFolder folder); + // ReSharper disable once InconsistentNaming + OperatingSystem OSVersion { get; } + } + + //Wrapper to enable unit testing of folder dialogs. + public class EnvironmentProvider : IEnvironmentProvider + { + public string GetFolderPath(Environment.SpecialFolder folder) + { + return Environment.GetFolderPath(folder); + } + + public OperatingSystem OSVersion { get { return Environment.OSVersion; } } + } +} diff --git a/RetailCoder.VBE/UI/FileBrowserDialogFactory.cs b/RetailCoder.VBE/UI/FileBrowserDialogFactory.cs index 582235f907..5356d96741 100644 --- a/RetailCoder.VBE/UI/FileBrowserDialogFactory.cs +++ b/RetailCoder.VBE/UI/FileBrowserDialogFactory.cs @@ -1,6 +1,4 @@ -using System; - -namespace Rubberduck.UI +namespace Rubberduck.UI { public interface IFolderBrowserFactory { @@ -9,32 +7,46 @@ public interface IFolderBrowserFactory IFolderBrowser CreateFolderBrowser(string description, bool showNewFolderButton); IFolderBrowser CreateFolderBrowser(string description, bool showNewFolderButton, - Environment.SpecialFolder rootFolder); + string rootFolder); } public class DialogFactory : IFolderBrowserFactory { - private static readonly bool OldSchool = Environment.OSVersion.Version.Major < 6; + private readonly IEnvironmentProvider _environment; + private readonly bool _oldSchool; + + public DialogFactory(IEnvironmentProvider environment) + { + _environment = environment; + try + { + _oldSchool = _environment.OSVersion.Version.Major < 6; + } + catch + { + // ignored - fall back to "safe" dialog version. + } + } public IFolderBrowser CreateFolderBrowser(string description) { - return !OldSchool - ? new ModernFolderBrowser(description) as IFolderBrowser - : new FolderBrowser(description); + return !_oldSchool + ? new ModernFolderBrowser(_environment, description) as IFolderBrowser + : new FolderBrowser(_environment, description); } public IFolderBrowser CreateFolderBrowser(string description, bool showNewFolderButton) { - return !OldSchool - ? new ModernFolderBrowser(description, showNewFolderButton) as IFolderBrowser - : new FolderBrowser(description, showNewFolderButton); + return !_oldSchool + ? new ModernFolderBrowser(_environment, description, showNewFolderButton) as IFolderBrowser + : new FolderBrowser(_environment, description, showNewFolderButton); } - public IFolderBrowser CreateFolderBrowser(string description, bool showNewFolderButton, Environment.SpecialFolder rootFolder) + public IFolderBrowser CreateFolderBrowser(string description, bool showNewFolderButton, string rootFolder) { - return !OldSchool - ? new ModernFolderBrowser(description, showNewFolderButton, rootFolder) as IFolderBrowser - : new FolderBrowser(description, showNewFolderButton, rootFolder); + return !_oldSchool + ? new ModernFolderBrowser(_environment, description, showNewFolderButton, rootFolder) as IFolderBrowser + : new FolderBrowser(_environment, description, showNewFolderButton, rootFolder); } } } diff --git a/RetailCoder.VBE/UI/FindSymbol/FindSymbolDialog.resx b/RetailCoder.VBE/UI/FindSymbol/FindSymbolDialog.resx index adccbf543f..0a0a5023e2 100644 --- a/RetailCoder.VBE/UI/FindSymbol/FindSymbolDialog.resx +++ b/RetailCoder.VBE/UI/FindSymbol/FindSymbolDialog.resx @@ -120,23 +120,26 @@ - AAABAAEAEA4AAAEAIADgAwAAFgAAACgAAAAQAAAAHAAAAAEAIAAAAAAAuAMAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAB4AAABxAAEBtQEYGOMCLCz3AzEx/AIhIewABwfFAAAAiQAAADYAAAABAAAAAAAA - AAAAAAAAAAAAAQAAAJIDODj5CJqa/wzh4f8O/f3/Dv///w7///8O////De/v/wq0tP8ES0v/AAAAewAA - AAAAAAAAAAAAAAAAAEcFWlr/Dv///w7///8O////Dv///w7///8O////Dv///w7///8O////Dvv7/wMw - MPkAAAAgAAAAAAAAAAAAAQGpC8zM/w7///8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8JoKD/AAAAfAAAAAAAAAAAARMT4g78/P8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////DNzc/wAAALAAAAAAAAAAAAImJvcO////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w3o6P8AAAC8AAAAAAAAAAACHh7vDv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w7///8LxMT/AAAAngAAAAAAAAAAAAQExg3o6P8O////Dv///wmnp/8GZ2f/B3l5/wZ1 - df8Kr6//Dv///w7///8O////Bmxs/wAAAFIAAAAAAAAAAAAAAGwHgoL/Dv///wq+vv8BDAzTAAAAOQAA - AE8BDQ3yDNLS/w7///8O////Dv///wZlZf8AABS4AAAPgQAAAA0AAAAIAQwM1AVjY/8ABwfEAAAAGAAA - AAAAAABNBnJy/w7///8O////Dv///w7///8N5ub/AAM+/wAA4P8AAC62AAAAAAAAACAAAABLAAAAAgAA - AAAAAAAAAAAAaAiUlP8O////Dv///wvKyv8Lvr7/Dvv7/wEQMf8AAP//AACF/wAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAADkFV1f/Dv///w7///8HdHT/Blxc/wvMzP8AAAXWAAAoogAAF58AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAEBrwiQkP8O+/v/Dv///wzY2P8CLCz1AAAAMQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACHARkZ4wIpKfQABga8AAAANgAAAAAAAAAAAAAAAMAH - AAAABwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAQAAACMAAAA/AAAAP4DAAD+BwAA + AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAEAAAAAAAAABwAAAAgAAAAGAAAABwAAAAgAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAABAwNEAAAA/zpkZP8uXmP/LGBl/y9hY/80ZGP/OWlo/0t2dP8AAAD/AAAAxwEC + AogAAAAAAAAAAAAAAAAAAQGTCicr/zTk+f9U3v//RtX//0rV//9P3f//Ve3//y/p//855/v/Qv3//1T/ + //8MLS/+AAAA0QAAAAAAAQGRBBMW/zXn/f846v//SNz9/0jL/v8xvv//OMv//0DU//8/3v3/L+j//zTo + //8r4/z/Svr//0mAf/4BAgKIISko/ynQ5v8x6P//Men//y7Z7v9ApLn/LrH4/y+y9f84vfT/K57K/y/l + +v8x5///L+j//0v2//+M////AAAAihIsLf8w7f//MOr//zXq//8x6f//JK6+/yeIp/8gZoL/LYyq/ynF + 2f8w5/7/MOj//zTq//9K9P//g////wAAAJUAAADSROX//1LK//9E5f//OO7//zLr//8w4ff/L+X7/y/j + +v8x6P//N+z//zHo//8s5v//gv3//7j///4AAACcAAAAlD+Cof87c4z/RGNj/zRdY/8xoK7+LfX//xrm + //8c2v//IeD//zDx//9G+P//Vvr//9z///8kKir/AAAAAAAAAFYAAABtAAAAGgAAAAgAAAALAAAA2yTb + +v8Y0f//HNr//xzf//8z+///Yv///2y8vP4qMjL/BAUFMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3Cac + r/8t0/7/Icn//x7Y//8o+P7/Sv///wAAAP8AAACgAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEwwh + I/873P//JMj//xS8//8Wyv//Gpi2/wIADv8LCgC5AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + ACUqYWT/Mtb//xy6//8Gt/7/Htr//xlhbP8fRvX/O1Hs/jlCctsAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAaSGpo/0vZ//4Zs///n+z//wAAAP9FVFz/E0Gh/z1G//9AS2j/AAAAAwAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAABAAAAKiS8/7MOr3//pLc/v/v////Pmxs/zBBPcIAAAD/ISEv/wAAAAQAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAABNAAAAtqXk8shM0v//Ppac/wAAAP8AAAA2AAAAAAAAAAcAAAABAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAACfAAAAlAAAAIAAAAA3AAAAAQAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAOADAACAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAD4AwAA8AcAAPAPAADwBwAA8AcAAPAH + AAD4PwAA/H8AAA== - + \ No newline at end of file diff --git a/RetailCoder.VBE/UI/FolderBrowser.cs b/RetailCoder.VBE/UI/FolderBrowser.cs index 7984fcc7dc..118217b5cc 100644 --- a/RetailCoder.VBE/UI/FolderBrowser.cs +++ b/RetailCoder.VBE/UI/FolderBrowser.cs @@ -7,7 +7,7 @@ public interface IFolderBrowser : IDisposable { string Description { get; set; } bool ShowNewFolderButton { get; set; } - Environment.SpecialFolder RootFolder { get; set; } + string RootFolder { get; set; } string SelectedPath { get; set; } DialogResult ShowDialog(); } @@ -15,23 +15,25 @@ public interface IFolderBrowser : IDisposable public class FolderBrowser : IFolderBrowser { private readonly FolderBrowserDialog _dialog; + private readonly IEnvironmentProvider _environment; - public FolderBrowser(string description, bool showNewFolderButton, Environment.SpecialFolder rootFolder) + public FolderBrowser(IEnvironmentProvider environment, string description, bool showNewFolderButton, string rootFolder) { + _environment = environment; _dialog = new FolderBrowserDialog { Description = description, - RootFolder = rootFolder, + SelectedPath = rootFolder, ShowNewFolderButton = showNewFolderButton }; } - public FolderBrowser(string description, bool showNewFolderButton) - :this(description, showNewFolderButton, Environment.SpecialFolder.MyComputer) + public FolderBrowser(IEnvironmentProvider environment, string description, bool showNewFolderButton) + : this(environment, description, showNewFolderButton, environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) { } - public FolderBrowser(string description) - : this(description, true) + public FolderBrowser(IEnvironmentProvider environment, string description) + : this(environment, description, true) { } public string Description @@ -46,10 +48,10 @@ public bool ShowNewFolderButton set { _dialog.ShowNewFolderButton = value; } } - public Environment.SpecialFolder RootFolder + public string RootFolder { - get { return _dialog.RootFolder; } - set { _dialog.RootFolder = value; } + get { return _dialog.SelectedPath; } + set { _dialog.SelectedPath = value; } } public string SelectedPath diff --git a/RetailCoder.VBE/UI/ModernFolderBrowser.cs b/RetailCoder.VBE/UI/ModernFolderBrowser.cs index 754ee09d59..1eb19780a1 100644 --- a/RetailCoder.VBE/UI/ModernFolderBrowser.cs +++ b/RetailCoder.VBE/UI/ModernFolderBrowser.cs @@ -29,21 +29,22 @@ public class ModernFolderBrowser : IFolderBrowser private static readonly ConstructorInfo VistaDialogEventsCtor = VistaDialogEvents.GetConstructors().SingleOrDefault(); private static readonly MethodInfo IFileDialogAdvise = IFileDialog.GetMethod("Advise", DefaultBindingFlags); private static readonly MethodInfo IFileDialogUnadvise = IFileDialog.GetMethod("Unadvise", DefaultBindingFlags); - // ReSharper restore InconsistentNaming private readonly System.Windows.Forms.OpenFileDialog _dialog; private readonly object _newDialog; + private readonly IEnvironmentProvider _environment; - // ReSharper disable once UnusedParameter.Local - public ModernFolderBrowser(string description, bool showNewFolderButton, Environment.SpecialFolder rootFolder) + // ReSharper disable once UnusedParameter.Local - new folder button suppression isn't supported in this dialog. + public ModernFolderBrowser(IEnvironmentProvider environment, string description, bool showNewFolderButton, string rootFolder) { + _environment = environment; _root = rootFolder; _dialog = new System.Windows.Forms.OpenFileDialog { Title = description, - InitialDirectory = Environment.GetFolderPath(_root), - // ReSharper disable once LocalizableElement + InitialDirectory = _root, + // ReSharper disable once LocalizableElement - This is an API keyword. Filter = "Folders|\n", AddExtension = false, CheckFileExists = false, @@ -56,11 +57,11 @@ public ModernFolderBrowser(string description, bool showNewFolderButton, Environ IFileDialogSetOptions.Invoke(_newDialog, new object[] { options }); } - public ModernFolderBrowser(string description, bool showNewFolderButton) - : this(description, showNewFolderButton, Environment.SpecialFolder.MyDocuments) + public ModernFolderBrowser(IEnvironmentProvider environment, string description, bool showNewFolderButton) + : this(environment, description, showNewFolderButton, environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) { } - public ModernFolderBrowser(string description) : this(description, true) { } + public ModernFolderBrowser(IEnvironmentProvider environment, string description) : this(environment, description, true) { } public string Description { @@ -68,6 +69,7 @@ public string Description set { _dialog.Title = value; } } + //Does nothing - new folder button suppression isn't supported in this dialog. public bool ShowNewFolderButton { get { return true; } @@ -75,14 +77,14 @@ public bool ShowNewFolderButton set { } } - private Environment.SpecialFolder _root; - public Environment.SpecialFolder RootFolder + private string _root; + public string RootFolder { get { return _root; } set { _root = value; - _dialog.InitialDirectory = Environment.GetFolderPath(_root); + _dialog.InitialDirectory = _root; } } diff --git a/RetailCoder.VBE/UI/Refactorings/AssignedByValParameterQuickFixDialog.Designer.cs b/RetailCoder.VBE/UI/Refactorings/AssignedByValParameterQuickFixDialog.Designer.cs index 9d6687461d..e5cb2af33b 100644 --- a/RetailCoder.VBE/UI/Refactorings/AssignedByValParameterQuickFixDialog.Designer.cs +++ b/RetailCoder.VBE/UI/Refactorings/AssignedByValParameterQuickFixDialog.Designer.cs @@ -53,31 +53,28 @@ private void InitializeComponent() this.panel1.Controls.Add(this.InstructionsLabel); this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(773, 99); + this.panel1.Size = new System.Drawing.Size(515, 64); this.panel1.TabIndex = 14; // // TitleLabel // this.TitleLabel.AutoSize = true; this.TitleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.TitleLabel.Location = new System.Drawing.Point(18, 14); - this.TitleLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.TitleLabel.Location = new System.Drawing.Point(12, 9); this.TitleLabel.Name = "TitleLabel"; - this.TitleLabel.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.TitleLabel.Size = new System.Drawing.Size(273, 26); + this.TitleLabel.Padding = new System.Windows.Forms.Padding(2, 1, 2, 1); + this.TitleLabel.Size = new System.Drawing.Size(195, 17); this.TitleLabel.TabIndex = 4; this.TitleLabel.Text = "Specify Local Variable Name"; // // InstructionsLabel // this.InstructionsLabel.AutoSize = true; - this.InstructionsLabel.Location = new System.Drawing.Point(14, 46); - this.InstructionsLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.InstructionsLabel.Location = new System.Drawing.Point(9, 30); this.InstructionsLabel.Name = "InstructionsLabel"; - this.InstructionsLabel.Padding = new System.Windows.Forms.Padding(6); - this.InstructionsLabel.Size = new System.Drawing.Size(255, 32); + this.InstructionsLabel.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.InstructionsLabel.Size = new System.Drawing.Size(174, 21); this.InstructionsLabel.TabIndex = 5; this.InstructionsLabel.Text = "Please specify new name for \'{0}\'."; // @@ -86,10 +83,9 @@ private void InitializeComponent() this.panel2.BackColor = System.Drawing.SystemColors.ControlDark; this.panel2.Controls.Add(this.flowLayoutPanel2); this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panel2.Location = new System.Drawing.Point(0, 243); - this.panel2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.panel2.Location = new System.Drawing.Point(0, 158); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(773, 65); + this.panel2.Size = new System.Drawing.Size(515, 42); this.panel2.TabIndex = 16; // // flowLayoutPanel2 @@ -100,20 +96,18 @@ private void InitializeComponent() this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; this.flowLayoutPanel2.Location = new System.Drawing.Point(0, -1); - this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(12, 12, 0, 12); - this.flowLayoutPanel2.Size = new System.Drawing.Size(773, 66); + this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(8, 8, 0, 8); + this.flowLayoutPanel2.Size = new System.Drawing.Size(515, 43); this.flowLayoutPanel2.TabIndex = 2; // // CancelDialogButton // this.CancelDialogButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.CancelDialogButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.CancelDialogButton.Location = new System.Drawing.Point(645, 17); - this.CancelDialogButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.CancelDialogButton.Location = new System.Drawing.Point(429, 11); this.CancelDialogButton.Name = "CancelDialogButton"; - this.CancelDialogButton.Size = new System.Drawing.Size(112, 35); + this.CancelDialogButton.Size = new System.Drawing.Size(75, 23); this.CancelDialogButton.TabIndex = 2; this.CancelDialogButton.Text = "Cancel"; this.CancelDialogButton.UseVisualStyleBackColor = false; @@ -122,10 +116,9 @@ private void InitializeComponent() // this.OkButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.OkButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.OkButton.Location = new System.Drawing.Point(525, 17); - this.OkButton.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.OkButton.Location = new System.Drawing.Point(348, 11); this.OkButton.Name = "OkButton"; - this.OkButton.Size = new System.Drawing.Size(112, 35); + this.OkButton.Size = new System.Drawing.Size(75, 23); this.OkButton.TabIndex = 1; this.OkButton.Text = "Ok"; this.OkButton.UseVisualStyleBackColor = false; @@ -133,8 +126,7 @@ private void InitializeComponent() // InvalidNameValidationIcon // this.InvalidNameValidationIcon.Image = global::Rubberduck.Properties.Resources.cross_circle; - this.InvalidNameValidationIcon.Location = new System.Drawing.Point(739, 108); - this.InvalidNameValidationIcon.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.InvalidNameValidationIcon.Location = new System.Drawing.Point(493, 70); this.InvalidNameValidationIcon.Name = "InvalidNameValidationIcon"; this.InvalidNameValidationIcon.Size = new System.Drawing.Size(16, 16); this.InvalidNameValidationIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -143,10 +135,9 @@ private void InitializeComponent() // // NewNameBox // - this.NewNameBox.Location = new System.Drawing.Point(86, 121); - this.NewNameBox.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5); + this.NewNameBox.Location = new System.Drawing.Point(57, 79); this.NewNameBox.Name = "NewNameBox"; - this.NewNameBox.Size = new System.Drawing.Size(666, 26); + this.NewNameBox.Size = new System.Drawing.Size(445, 20); this.NewNameBox.TabIndex = 15; this.NewNameBox.WordWrap = false; this.NewNameBox.TextChanged += new System.EventHandler(this.NewNameBox_TextChanged); @@ -154,26 +145,26 @@ private void InitializeComponent() // NameLabel // this.NameLabel.AutoSize = true; - this.NameLabel.Location = new System.Drawing.Point(14, 126); - this.NameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.NameLabel.Location = new System.Drawing.Point(9, 82); this.NameLabel.Name = "NameLabel"; - this.NameLabel.Size = new System.Drawing.Size(55, 20); + this.NameLabel.Size = new System.Drawing.Size(38, 13); this.NameLabel.TabIndex = 17; this.NameLabel.Text = "Name:"; // // FeedbackLabel // - this.FeedbackLabel.Location = new System.Drawing.Point(86, 160); + this.FeedbackLabel.Location = new System.Drawing.Point(57, 104); + this.FeedbackLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.FeedbackLabel.Name = "FeedbackLabel"; - this.FeedbackLabel.Size = new System.Drawing.Size(666, 61); + this.FeedbackLabel.Size = new System.Drawing.Size(444, 40); this.FeedbackLabel.TabIndex = 19; this.FeedbackLabel.Text = "THis has text"; // // AssignedByValParameterQuickFixDialog // - this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(773, 308); + this.ClientSize = new System.Drawing.Size(515, 200); this.Controls.Add(this.FeedbackLabel); this.Controls.Add(this.panel1); this.Controls.Add(this.panel2); @@ -182,6 +173,7 @@ private void InitializeComponent() this.Controls.Add(this.NameLabel); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "AssignedByValParameterQuickFixDialog"; diff --git a/RetailCoder.VBE/UI/Refactorings/AssignedByValParameterQuickFixDialog.resx b/RetailCoder.VBE/UI/Refactorings/AssignedByValParameterQuickFixDialog.resx index d3a1a2980d..0a0a5023e2 100644 --- a/RetailCoder.VBE/UI/Refactorings/AssignedByValParameterQuickFixDialog.resx +++ b/RetailCoder.VBE/UI/Refactorings/AssignedByValParameterQuickFixDialog.resx @@ -120,23 +120,26 @@ - AAABAAEAEA4AAAEAIADgAwAAFgAAACgAAAAQAAAAHAAAAAEAIAAAAAAAuAMAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAB4AAABxAAEBtQEYGOMCLCz3AzEx/AIhIewABwfFAAAAiQAAADYAAAABAAAAAAAA - AAAAAAAAAAAAAQAAAJIDODj5CJqa/wzh4f8O/f3/Dv///w7///8O////De/v/wq0tP8ES0v/AAAAewAA - AAAAAAAAAAAAAAAAAEcFWlr/Dv///w7///8O////Dv///w7///8O////Dv///w7///8O////Dvv7/wMw - MPkAAAAgAAAAAAAAAAAAAQGpC8zM/w7///8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8JoKD/AAAAfAAAAAAAAAAAARMT4g78/P8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////DNzc/wAAALAAAAAAAAAAAAImJvcO////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w3o6P8AAAC8AAAAAAAAAAACHh7vDv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w7///8LxMT/AAAAngAAAAAAAAAAAAQExg3o6P8O////Dv///wmnp/8GZ2f/B3l5/wZ1 - df8Kr6//Dv///w7///8O////Bmxs/wAAAFIAAAAAAAAAAAAAAGwHgoL/Dv///wq+vv8BDAzTAAAAOQAA - AE8BDQ3yDNLS/w7///8O////Dv///wZlZf8AABS4AAAPgQAAAA0AAAAIAQwM1AVjY/8ABwfEAAAAGAAA - AAAAAABNBnJy/w7///8O////Dv///w7///8N5ub/AAM+/wAA4P8AAC62AAAAAAAAACAAAABLAAAAAgAA - AAAAAAAAAAAAaAiUlP8O////Dv///wvKyv8Lvr7/Dvv7/wEQMf8AAP//AACF/wAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAADkFV1f/Dv///w7///8HdHT/Blxc/wvMzP8AAAXWAAAoogAAF58AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAEBrwiQkP8O+/v/Dv///wzY2P8CLCz1AAAAMQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACHARkZ4wIpKfQABga8AAAANgAAAAAAAAAAAAAAAMAH - AAAABwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAQAAACMAAAA/AAAAP4DAAD+BwAA + AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAEAAAAAAAAABwAAAAgAAAAGAAAABwAAAAgAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAABAwNEAAAA/zpkZP8uXmP/LGBl/y9hY/80ZGP/OWlo/0t2dP8AAAD/AAAAxwEC + AogAAAAAAAAAAAAAAAAAAQGTCicr/zTk+f9U3v//RtX//0rV//9P3f//Ve3//y/p//855/v/Qv3//1T/ + //8MLS/+AAAA0QAAAAAAAQGRBBMW/zXn/f846v//SNz9/0jL/v8xvv//OMv//0DU//8/3v3/L+j//zTo + //8r4/z/Svr//0mAf/4BAgKIISko/ynQ5v8x6P//Men//y7Z7v9ApLn/LrH4/y+y9f84vfT/K57K/y/l + +v8x5///L+j//0v2//+M////AAAAihIsLf8w7f//MOr//zXq//8x6f//JK6+/yeIp/8gZoL/LYyq/ynF + 2f8w5/7/MOj//zTq//9K9P//g////wAAAJUAAADSROX//1LK//9E5f//OO7//zLr//8w4ff/L+X7/y/j + +v8x6P//N+z//zHo//8s5v//gv3//7j///4AAACcAAAAlD+Cof87c4z/RGNj/zRdY/8xoK7+LfX//xrm + //8c2v//IeD//zDx//9G+P//Vvr//9z///8kKir/AAAAAAAAAFYAAABtAAAAGgAAAAgAAAALAAAA2yTb + +v8Y0f//HNr//xzf//8z+///Yv///2y8vP4qMjL/BAUFMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3Cac + r/8t0/7/Icn//x7Y//8o+P7/Sv///wAAAP8AAACgAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEwwh + I/873P//JMj//xS8//8Wyv//Gpi2/wIADv8LCgC5AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + ACUqYWT/Mtb//xy6//8Gt/7/Htr//xlhbP8fRvX/O1Hs/jlCctsAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAaSGpo/0vZ//4Zs///n+z//wAAAP9FVFz/E0Gh/z1G//9AS2j/AAAAAwAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAABAAAAKiS8/7MOr3//pLc/v/v////Pmxs/zBBPcIAAAD/ISEv/wAAAAQAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAABNAAAAtqXk8shM0v//Ppac/wAAAP8AAAA2AAAAAAAAAAcAAAABAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAACfAAAAlAAAAIAAAAA3AAAAAQAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAOADAACAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAD4AwAA8AcAAPAPAADwBwAA8AcAAPAH + AAD4PwAA/H8AAA== \ No newline at end of file diff --git a/RetailCoder.VBE/UI/Refactorings/EncapsulateFieldDialog.Designer.cs b/RetailCoder.VBE/UI/Refactorings/EncapsulateFieldDialog.Designer.cs index 1026be03e9..7945409468 100644 --- a/RetailCoder.VBE/UI/Refactorings/EncapsulateFieldDialog.Designer.cs +++ b/RetailCoder.VBE/UI/Refactorings/EncapsulateFieldDialog.Designer.cs @@ -60,37 +60,35 @@ private void InitializeComponent() this.DescriptionPanel.Controls.Add(this.InstructionsLabel); this.DescriptionPanel.Dock = System.Windows.Forms.DockStyle.Top; this.DescriptionPanel.Location = new System.Drawing.Point(0, 0); - this.DescriptionPanel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.DescriptionPanel.Name = "DescriptionPanel"; - this.DescriptionPanel.Size = new System.Drawing.Size(667, 84); + this.DescriptionPanel.Size = new System.Drawing.Size(500, 68); this.DescriptionPanel.TabIndex = 14; // // TitleLabel // this.TitleLabel.AutoSize = true; this.TitleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.TitleLabel.Location = new System.Drawing.Point(20, 11); - this.TitleLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.TitleLabel.Location = new System.Drawing.Point(15, 9); this.TitleLabel.Name = "TitleLabel"; - this.TitleLabel.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.TitleLabel.Size = new System.Drawing.Size(147, 22); + this.TitleLabel.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.TitleLabel.Size = new System.Drawing.Size(126, 19); this.TitleLabel.TabIndex = 2; this.TitleLabel.Text = "Encapsulate Field"; // // InstructionsLabel // - this.InstructionsLabel.Location = new System.Drawing.Point(20, 30); + this.InstructionsLabel.Location = new System.Drawing.Point(15, 24); + this.InstructionsLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.InstructionsLabel.Name = "InstructionsLabel"; - this.InstructionsLabel.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.InstructionsLabel.Size = new System.Drawing.Size(549, 34); + this.InstructionsLabel.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); + this.InstructionsLabel.Size = new System.Drawing.Size(412, 28); this.InstructionsLabel.TabIndex = 3; this.InstructionsLabel.Text = "Please specify property name, parameter accessibility, and setter type."; // // InvalidPropertyNameIcon // this.InvalidPropertyNameIcon.Image = global::Rubberduck.Properties.Resources.cross_circle; - this.InvalidPropertyNameIcon.Location = new System.Drawing.Point(473, 102); - this.InvalidPropertyNameIcon.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.InvalidPropertyNameIcon.Location = new System.Drawing.Point(355, 83); this.InvalidPropertyNameIcon.Name = "InvalidPropertyNameIcon"; this.InvalidPropertyNameIcon.Size = new System.Drawing.Size(16, 16); this.InvalidPropertyNameIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -101,13 +99,12 @@ private void InitializeComponent() // this.PreviewBox.BackColor = System.Drawing.Color.White; this.PreviewBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.PreviewBox.Location = new System.Drawing.Point(21, 222); - this.PreviewBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.PreviewBox.Location = new System.Drawing.Point(16, 180); this.PreviewBox.Multiline = true; this.PreviewBox.Name = "PreviewBox"; this.PreviewBox.ReadOnly = true; this.PreviewBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.PreviewBox.Size = new System.Drawing.Size(621, 217); + this.PreviewBox.Size = new System.Drawing.Size(467, 177); this.PreviewBox.TabIndex = 23; this.PreviewBox.TabStop = false; this.PreviewBox.WordWrap = false; @@ -115,28 +112,25 @@ private void InitializeComponent() // PreviewLabel // this.PreviewLabel.AutoSize = true; - this.PreviewLabel.Location = new System.Drawing.Point(20, 199); - this.PreviewLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.PreviewLabel.Location = new System.Drawing.Point(15, 162); this.PreviewLabel.Name = "PreviewLabel"; - this.PreviewLabel.Size = new System.Drawing.Size(61, 17); + this.PreviewLabel.Size = new System.Drawing.Size(48, 13); this.PreviewLabel.TabIndex = 22; this.PreviewLabel.Text = "Preview:"; // // PropertyNameTextBox // - this.PropertyNameTextBox.Location = new System.Drawing.Point(23, 113); - this.PropertyNameTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.PropertyNameTextBox.Location = new System.Drawing.Point(17, 92); this.PropertyNameTextBox.Name = "PropertyNameTextBox"; - this.PropertyNameTextBox.Size = new System.Drawing.Size(457, 22); + this.PropertyNameTextBox.Size = new System.Drawing.Size(344, 20); this.PropertyNameTextBox.TabIndex = 0; // // PropertyNameLabel // this.PropertyNameLabel.AutoSize = true; - this.PropertyNameLabel.Location = new System.Drawing.Point(19, 92); - this.PropertyNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.PropertyNameLabel.Location = new System.Drawing.Point(14, 75); this.PropertyNameLabel.Name = "PropertyNameLabel"; - this.PropertyNameLabel.Size = new System.Drawing.Size(107, 17); + this.PropertyNameLabel.Size = new System.Drawing.Size(80, 13); this.PropertyNameLabel.TabIndex = 15; this.PropertyNameLabel.Text = "&Property Name:"; // @@ -147,21 +141,19 @@ private void InitializeComponent() this.flowLayoutPanel2.Controls.Add(this.OkButton); this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 445); - this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 362); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(11, 10, 0, 10); - this.flowLayoutPanel2.Size = new System.Drawing.Size(667, 53); + this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(8, 8, 0, 8); + this.flowLayoutPanel2.Size = new System.Drawing.Size(500, 43); this.flowLayoutPanel2.TabIndex = 27; // // CancelDialogButton // this.CancelDialogButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.CancelDialogButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.CancelDialogButton.Location = new System.Drawing.Point(552, 14); - this.CancelDialogButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.CancelDialogButton.Location = new System.Drawing.Point(414, 11); this.CancelDialogButton.Name = "CancelDialogButton"; - this.CancelDialogButton.Size = new System.Drawing.Size(100, 28); + this.CancelDialogButton.Size = new System.Drawing.Size(75, 23); this.CancelDialogButton.TabIndex = 5; this.CancelDialogButton.Text = "&Cancel"; this.CancelDialogButton.UseVisualStyleBackColor = false; @@ -170,10 +162,9 @@ private void InitializeComponent() // this.OkButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.OkButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.OkButton.Location = new System.Drawing.Point(444, 14); - this.OkButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.OkButton.Location = new System.Drawing.Point(333, 11); this.OkButton.Name = "OkButton"; - this.OkButton.Size = new System.Drawing.Size(100, 28); + this.OkButton.Size = new System.Drawing.Size(75, 23); this.OkButton.TabIndex = 4; this.OkButton.Text = "&Ok"; this.OkButton.UseVisualStyleBackColor = false; @@ -181,8 +172,7 @@ private void InitializeComponent() // InvalidVariableNameIcon // this.InvalidVariableNameIcon.Image = global::Rubberduck.Properties.Resources.cross_circle; - this.InvalidVariableNameIcon.Location = new System.Drawing.Point(473, 156); - this.InvalidVariableNameIcon.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.InvalidVariableNameIcon.Location = new System.Drawing.Point(355, 127); this.InvalidVariableNameIcon.Name = "InvalidVariableNameIcon"; this.InvalidVariableNameIcon.Size = new System.Drawing.Size(16, 16); this.InvalidVariableNameIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -192,20 +182,18 @@ private void InitializeComponent() // // ParameterNameTextBox // - this.ParameterNameTextBox.Location = new System.Drawing.Point(23, 166); - this.ParameterNameTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.ParameterNameTextBox.Location = new System.Drawing.Point(17, 135); this.ParameterNameTextBox.Name = "ParameterNameTextBox"; - this.ParameterNameTextBox.Size = new System.Drawing.Size(457, 22); + this.ParameterNameTextBox.Size = new System.Drawing.Size(344, 20); this.ParameterNameTextBox.TabIndex = 1; this.ParameterNameTextBox.Text = "value"; // // VariableNameLabel // this.VariableNameLabel.AutoSize = true; - this.VariableNameLabel.Location = new System.Drawing.Point(19, 143); - this.VariableNameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.VariableNameLabel.Location = new System.Drawing.Point(14, 116); this.VariableNameLabel.Name = "VariableNameLabel"; - this.VariableNameLabel.Size = new System.Drawing.Size(119, 17); + this.VariableNameLabel.Size = new System.Drawing.Size(89, 13); this.VariableNameLabel.TabIndex = 28; this.VariableNameLabel.Text = "Parameter &Name:"; // @@ -213,11 +201,11 @@ private void InitializeComponent() // this.SetterTypeGroupBox.Controls.Add(this.SetSetterTypeCheckBox); this.SetterTypeGroupBox.Controls.Add(this.LetSetterTypeCheckBox); - this.SetterTypeGroupBox.Location = new System.Drawing.Point(501, 103); - this.SetterTypeGroupBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.SetterTypeGroupBox.Location = new System.Drawing.Point(376, 84); + this.SetterTypeGroupBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.SetterTypeGroupBox.Name = "SetterTypeGroupBox"; - this.SetterTypeGroupBox.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.SetterTypeGroupBox.Size = new System.Drawing.Size(141, 86); + this.SetterTypeGroupBox.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.SetterTypeGroupBox.Size = new System.Drawing.Size(106, 70); this.SetterTypeGroupBox.TabIndex = 2; this.SetterTypeGroupBox.TabStop = false; this.SetterTypeGroupBox.Text = "Assignment:"; @@ -225,10 +213,10 @@ private void InitializeComponent() // SetSetterTypeCheckBox // this.SetSetterTypeCheckBox.AutoSize = true; - this.SetSetterTypeCheckBox.Location = new System.Drawing.Point(13, 48); - this.SetSetterTypeCheckBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.SetSetterTypeCheckBox.Location = new System.Drawing.Point(10, 39); + this.SetSetterTypeCheckBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.SetSetterTypeCheckBox.Name = "SetSetterTypeCheckBox"; - this.SetSetterTypeCheckBox.Size = new System.Drawing.Size(51, 21); + this.SetSetterTypeCheckBox.Size = new System.Drawing.Size(42, 17); this.SetSetterTypeCheckBox.TabIndex = 3; this.SetSetterTypeCheckBox.Text = "&Set"; this.SetSetterTypeCheckBox.UseVisualStyleBackColor = true; @@ -236,10 +224,10 @@ private void InitializeComponent() // LetSetterTypeCheckBox // this.LetSetterTypeCheckBox.AutoSize = true; - this.LetSetterTypeCheckBox.Location = new System.Drawing.Point(13, 21); - this.LetSetterTypeCheckBox.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.LetSetterTypeCheckBox.Location = new System.Drawing.Point(10, 17); + this.LetSetterTypeCheckBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.LetSetterTypeCheckBox.Name = "LetSetterTypeCheckBox"; - this.LetSetterTypeCheckBox.Size = new System.Drawing.Size(50, 21); + this.LetSetterTypeCheckBox.Size = new System.Drawing.Size(41, 17); this.LetSetterTypeCheckBox.TabIndex = 2; this.LetSetterTypeCheckBox.Text = "&Let"; this.LetSetterTypeCheckBox.UseVisualStyleBackColor = true; @@ -247,10 +235,10 @@ private void InitializeComponent() // EncapsulateFieldDialog // this.AcceptButton = this.OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.CancelDialogButton; - this.ClientSize = new System.Drawing.Size(667, 498); + this.ClientSize = new System.Drawing.Size(500, 405); this.Controls.Add(this.SetterTypeGroupBox); this.Controls.Add(this.InvalidVariableNameIcon); this.Controls.Add(this.ParameterNameTextBox); @@ -264,7 +252,7 @@ private void InitializeComponent() this.Controls.Add(this.DescriptionPanel); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "EncapsulateFieldDialog"; diff --git a/RetailCoder.VBE/UI/Refactorings/EncapsulateFieldDialog.cs b/RetailCoder.VBE/UI/Refactorings/EncapsulateFieldDialog.cs index 55ef8e0b5e..6955bdee81 100644 --- a/RetailCoder.VBE/UI/Refactorings/EncapsulateFieldDialog.cs +++ b/RetailCoder.VBE/UI/Refactorings/EncapsulateFieldDialog.cs @@ -14,6 +14,7 @@ public partial class EncapsulateFieldDialog : Form, IEncapsulateFieldDialog { private readonly RubberduckParserState _state; private readonly IIndenter _indenter; + private PropertyGenerator _previewGenerator; public string NewPropertyName { @@ -29,76 +30,39 @@ public string ParameterName public Declaration TargetDeclaration { get; set; } - public bool CanImplementLetSetterType - { - get { return LetSetterTypeCheckBox.Enabled; } - set - { - if (!value) - { - LetSetterTypeCheckBox.Checked = false; - } - LetSetterTypeCheckBox.Enabled = value; - } - } + public bool CanImplementLetSetterType { get; set; } + + public bool CanImplementSetSetterType { get; set; } + + public bool LetSetterSelected { get { return LetSetterTypeCheckBox.Checked; } } + + public bool SetSetterSelected { get { return SetSetterTypeCheckBox.Checked; } } - public bool CanImplementSetSetterType - { - get { return SetSetterTypeCheckBox.Enabled; } - set - { - if (!value) - { - SetSetterTypeCheckBox.Checked = false; - } - SetSetterTypeCheckBox.Enabled = value; - } - } - public bool MustImplementLetSetterType { - get { return LetSetterTypeCheckBox.Checked; } - set - { - if (value) - { - LetSetterTypeCheckBox.Checked = true; - } - LetSetterTypeCheckBox.Enabled = !value; - } + get { return CanImplementLetSetterType && !CanImplementSetSetterType; } } public bool MustImplementSetSetterType { - get { return SetSetterTypeCheckBox.Checked; } - set - { - if (value) - { - SetSetterTypeCheckBox.Checked = true; - } - SetSetterTypeCheckBox.Enabled = !value; - } + get { return CanImplementSetSetterType && !CanImplementLetSetterType; } } public EncapsulateFieldDialog(RubberduckParserState state, IIndenter indenter) { _state = state; _indenter = indenter; + InitializeComponent(); LocalizeDialog(); - - PropertyNameTextBox.TextChanged += PropertyNameBox_TextChanged; - ParameterNameTextBox.TextChanged += VariableNameBox_TextChanged; - - LetSetterTypeCheckBox.CheckedChanged += EncapsulateFieldDialog_SetterTypeChanged; - SetSetterTypeCheckBox.CheckedChanged += EncapsulateFieldDialog_SetterTypeChanged; - + Shown += EncapsulateFieldDialog_Shown; } void EncapsulateFieldDialog_SetterTypeChanged(object sender, EventArgs e) { + _previewGenerator.GenerateSetter = SetSetterTypeCheckBox.Checked; + _previewGenerator.GenerateLetter = LetSetterTypeCheckBox.Checked; UpdatePreview(); } @@ -116,62 +80,67 @@ private void LocalizeDialog() void EncapsulateFieldDialog_Shown(object sender, EventArgs e) { + if (MustImplementSetSetterType) + { + SetSetterTypeCheckBox.Checked = true; + LetSetterTypeCheckBox.Enabled = false; + } + else + { + LetSetterTypeCheckBox.Checked = true; + SetSetterTypeCheckBox.Enabled = !MustImplementLetSetterType; + } + ValidatePropertyName(); ValidateVariableName(); + + _previewGenerator = new PropertyGenerator + { + PropertyName = NewPropertyName, + AsTypeName = TargetDeclaration.AsTypeName, + BackingField = TargetDeclaration.IdentifierName, + ParameterName = ParameterName, + GenerateSetter = SetSetterTypeCheckBox.Checked, + GenerateLetter = LetSetterTypeCheckBox.Checked + }; + + LetSetterTypeCheckBox.CheckedChanged += EncapsulateFieldDialog_SetterTypeChanged; + SetSetterTypeCheckBox.CheckedChanged += EncapsulateFieldDialog_SetterTypeChanged; + PropertyNameTextBox.TextChanged += PropertyNameBox_TextChanged; + ParameterNameTextBox.TextChanged += VariableNameBox_TextChanged; + UpdatePreview(); } private void PropertyNameBox_TextChanged(object sender, EventArgs e) { ValidatePropertyName(); + _previewGenerator.PropertyName = NewPropertyName; UpdatePreview(); } private void VariableNameBox_TextChanged(object sender, EventArgs e) { ValidateVariableName(); + _previewGenerator.ParameterName = ParameterName; UpdatePreview(); } private void UpdatePreview() { - PreviewBox.Text = GetPropertyText(); - } - - private string GetPropertyText() - { - if (TargetDeclaration == null) { return string.Empty; } - - var getterText = string.Join(Environment.NewLine, - string.Format("Public Property Get {0}() As {1}", NewPropertyName, TargetDeclaration.AsTypeName), - string.Format(" {0}{1} = {2}", MustImplementSetSetterType || !CanImplementLetSetterType ? "Set " : string.Empty, NewPropertyName, TargetDeclaration.IdentifierName), - "End Property"); - - var letterText = string.Join(Environment.NewLine, - string.Format(Environment.NewLine + Environment.NewLine + "Public Property Let {0}(ByVal {1} As {2})", - NewPropertyName, ParameterName, TargetDeclaration.AsTypeName), - string.Format(" {0} = {1}", TargetDeclaration.IdentifierName, ParameterName), - "End Property"); - - var setterText = string.Join(Environment.NewLine, - string.Format(Environment.NewLine + Environment.NewLine + "Public Property Set {0}(ByVal {1} As {2})", - NewPropertyName, ParameterName, TargetDeclaration.AsTypeName), - string.Format(" Set {0} = {1}", TargetDeclaration.IdentifierName, ParameterName), - "End Property"); - - var propertyText = getterText + - (MustImplementLetSetterType ? letterText : string.Empty) + - (MustImplementSetSetterType ? setterText : string.Empty); - - var propertyTextLines = propertyText.Split(new[] { Environment.NewLine }, StringSplitOptions.None); - return string.Join(Environment.NewLine, _indenter.Indent(propertyTextLines)); + if (TargetDeclaration == null) + { + PreviewBox.Text = string.Empty; + } + var propertyTextLines = _previewGenerator.AllPropertyCode.Split(new[] { Environment.NewLine }, StringSplitOptions.None); + PreviewBox.Text = string.Join(Environment.NewLine, _indenter.Indent(propertyTextLines, true)); } private void ValidatePropertyName() { InvalidPropertyNameIcon.Visible = ValidateName(NewPropertyName, ParameterName) || _state.AllUserDeclarations.Where(a => a.ParentScope == TargetDeclaration.ParentScope) - .Any(a => a.IdentifierName == NewPropertyName); + .Any(a => a.IdentifierName.Equals(NewPropertyName, StringComparison.InvariantCultureIgnoreCase)); SetOkButtonEnabledState(); } @@ -188,8 +157,8 @@ private bool ValidateName(string changedName, string otherName) var tokenValues = typeof(Tokens).GetFields().Select(item => item.GetValue(null)).Cast().Select(item => item); return TargetDeclaration == null - || changedName == TargetDeclaration.IdentifierName - || changedName == otherName + || changedName.Equals(TargetDeclaration.IdentifierName, StringComparison.InvariantCultureIgnoreCase) + || changedName.Equals(otherName, StringComparison.InvariantCultureIgnoreCase) || !char.IsLetter(changedName.FirstOrDefault()) || tokenValues.Contains(ParameterName, StringComparer.InvariantCultureIgnoreCase) || changedName.Any(c => !char.IsLetterOrDigit(c) && c != '_'); diff --git a/RetailCoder.VBE/UI/Refactorings/EncapsulateFieldDialog.resx b/RetailCoder.VBE/UI/Refactorings/EncapsulateFieldDialog.resx index d3a1a2980d..0a0a5023e2 100644 --- a/RetailCoder.VBE/UI/Refactorings/EncapsulateFieldDialog.resx +++ b/RetailCoder.VBE/UI/Refactorings/EncapsulateFieldDialog.resx @@ -120,23 +120,26 @@ - AAABAAEAEA4AAAEAIADgAwAAFgAAACgAAAAQAAAAHAAAAAEAIAAAAAAAuAMAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAB4AAABxAAEBtQEYGOMCLCz3AzEx/AIhIewABwfFAAAAiQAAADYAAAABAAAAAAAA - AAAAAAAAAAAAAQAAAJIDODj5CJqa/wzh4f8O/f3/Dv///w7///8O////De/v/wq0tP8ES0v/AAAAewAA - AAAAAAAAAAAAAAAAAEcFWlr/Dv///w7///8O////Dv///w7///8O////Dv///w7///8O////Dvv7/wMw - MPkAAAAgAAAAAAAAAAAAAQGpC8zM/w7///8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8JoKD/AAAAfAAAAAAAAAAAARMT4g78/P8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////DNzc/wAAALAAAAAAAAAAAAImJvcO////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w3o6P8AAAC8AAAAAAAAAAACHh7vDv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w7///8LxMT/AAAAngAAAAAAAAAAAAQExg3o6P8O////Dv///wmnp/8GZ2f/B3l5/wZ1 - df8Kr6//Dv///w7///8O////Bmxs/wAAAFIAAAAAAAAAAAAAAGwHgoL/Dv///wq+vv8BDAzTAAAAOQAA - AE8BDQ3yDNLS/w7///8O////Dv///wZlZf8AABS4AAAPgQAAAA0AAAAIAQwM1AVjY/8ABwfEAAAAGAAA - AAAAAABNBnJy/w7///8O////Dv///w7///8N5ub/AAM+/wAA4P8AAC62AAAAAAAAACAAAABLAAAAAgAA - AAAAAAAAAAAAaAiUlP8O////Dv///wvKyv8Lvr7/Dvv7/wEQMf8AAP//AACF/wAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAADkFV1f/Dv///w7///8HdHT/Blxc/wvMzP8AAAXWAAAoogAAF58AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAEBrwiQkP8O+/v/Dv///wzY2P8CLCz1AAAAMQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACHARkZ4wIpKfQABga8AAAANgAAAAAAAAAAAAAAAMAH - AAAABwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAQAAACMAAAA/AAAAP4DAAD+BwAA + AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAEAAAAAAAAABwAAAAgAAAAGAAAABwAAAAgAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAABAwNEAAAA/zpkZP8uXmP/LGBl/y9hY/80ZGP/OWlo/0t2dP8AAAD/AAAAxwEC + AogAAAAAAAAAAAAAAAAAAQGTCicr/zTk+f9U3v//RtX//0rV//9P3f//Ve3//y/p//855/v/Qv3//1T/ + //8MLS/+AAAA0QAAAAAAAQGRBBMW/zXn/f846v//SNz9/0jL/v8xvv//OMv//0DU//8/3v3/L+j//zTo + //8r4/z/Svr//0mAf/4BAgKIISko/ynQ5v8x6P//Men//y7Z7v9ApLn/LrH4/y+y9f84vfT/K57K/y/l + +v8x5///L+j//0v2//+M////AAAAihIsLf8w7f//MOr//zXq//8x6f//JK6+/yeIp/8gZoL/LYyq/ynF + 2f8w5/7/MOj//zTq//9K9P//g////wAAAJUAAADSROX//1LK//9E5f//OO7//zLr//8w4ff/L+X7/y/j + +v8x6P//N+z//zHo//8s5v//gv3//7j///4AAACcAAAAlD+Cof87c4z/RGNj/zRdY/8xoK7+LfX//xrm + //8c2v//IeD//zDx//9G+P//Vvr//9z///8kKir/AAAAAAAAAFYAAABtAAAAGgAAAAgAAAALAAAA2yTb + +v8Y0f//HNr//xzf//8z+///Yv///2y8vP4qMjL/BAUFMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3Cac + r/8t0/7/Icn//x7Y//8o+P7/Sv///wAAAP8AAACgAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEwwh + I/873P//JMj//xS8//8Wyv//Gpi2/wIADv8LCgC5AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + ACUqYWT/Mtb//xy6//8Gt/7/Htr//xlhbP8fRvX/O1Hs/jlCctsAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAaSGpo/0vZ//4Zs///n+z//wAAAP9FVFz/E0Gh/z1G//9AS2j/AAAAAwAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAABAAAAKiS8/7MOr3//pLc/v/v////Pmxs/zBBPcIAAAD/ISEv/wAAAAQAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAABNAAAAtqXk8shM0v//Ppac/wAAAP8AAAA2AAAAAAAAAAcAAAABAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAACfAAAAlAAAAIAAAAA3AAAAAQAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAOADAACAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAD4AwAA8AcAAPAPAADwBwAA8AcAAPAH + AAD4PwAA/H8AAA== \ No newline at end of file diff --git a/RetailCoder.VBE/UI/Refactorings/ExtractInterfaceDialog.Designer.cs b/RetailCoder.VBE/UI/Refactorings/ExtractInterfaceDialog.Designer.cs index 7c294dd60f..d3b4e7b2b1 100644 --- a/RetailCoder.VBE/UI/Refactorings/ExtractInterfaceDialog.Designer.cs +++ b/RetailCoder.VBE/UI/Refactorings/ExtractInterfaceDialog.Designer.cs @@ -116,7 +116,7 @@ private void InitializeComponent() this.TitleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold); this.TitleLabel.Location = new System.Drawing.Point(15, 9); this.TitleLabel.Name = "TitleLabel"; - this.TitleLabel.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.TitleLabel.Padding = new System.Windows.Forms.Padding(2); this.TitleLabel.Size = new System.Drawing.Size(115, 19); this.TitleLabel.TabIndex = 2; this.TitleLabel.Text = "Extract Interface"; @@ -126,7 +126,7 @@ private void InitializeComponent() this.InstructionsLabel.Location = new System.Drawing.Point(15, 24); this.InstructionsLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.InstructionsLabel.Name = "InstructionsLabel"; - this.InstructionsLabel.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); + this.InstructionsLabel.Padding = new System.Windows.Forms.Padding(3); this.InstructionsLabel.Size = new System.Drawing.Size(412, 28); this.InstructionsLabel.TabIndex = 3; this.InstructionsLabel.Text = "Please specify interface name and members."; @@ -151,9 +151,9 @@ private void InitializeComponent() this.MembersGroupBox.Controls.Add(this.DeselectAllButton); this.MembersGroupBox.Controls.Add(this.SelectAllButton); this.MembersGroupBox.Location = new System.Drawing.Point(12, 115); - this.MembersGroupBox.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.MembersGroupBox.Margin = new System.Windows.Forms.Padding(2); this.MembersGroupBox.Name = "MembersGroupBox"; - this.MembersGroupBox.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.MembersGroupBox.Padding = new System.Windows.Forms.Padding(2); this.MembersGroupBox.Size = new System.Drawing.Size(436, 174); this.MembersGroupBox.TabIndex = 1; this.MembersGroupBox.TabStop = false; @@ -169,7 +169,7 @@ private void InitializeComponent() this.InterfaceMembersGridView.ColumnHeadersVisible = false; this.InterfaceMembersGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter; this.InterfaceMembersGridView.Location = new System.Drawing.Point(5, 21); - this.InterfaceMembersGridView.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.InterfaceMembersGridView.Margin = new System.Windows.Forms.Padding(2); this.InterfaceMembersGridView.MultiSelect = false; this.InterfaceMembersGridView.Name = "InterfaceMembersGridView"; this.InterfaceMembersGridView.RowHeadersVisible = false; @@ -183,7 +183,7 @@ private void InitializeComponent() // DeselectAllButton // this.DeselectAllButton.Location = new System.Drawing.Point(331, 52); - this.DeselectAllButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.DeselectAllButton.Margin = new System.Windows.Forms.Padding(2); this.DeselectAllButton.Name = "DeselectAllButton"; this.DeselectAllButton.Size = new System.Drawing.Size(100, 26); this.DeselectAllButton.TabIndex = 3; @@ -193,7 +193,7 @@ private void InitializeComponent() // SelectAllButton // this.SelectAllButton.Location = new System.Drawing.Point(331, 21); - this.SelectAllButton.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.SelectAllButton.Margin = new System.Windows.Forms.Padding(2); this.SelectAllButton.Name = "SelectAllButton"; this.SelectAllButton.Size = new System.Drawing.Size(100, 26); this.SelectAllButton.TabIndex = 2; @@ -215,7 +215,7 @@ private void InitializeComponent() this.Controls.Add(this.flowLayoutPanel2); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.Margin = new System.Windows.Forms.Padding(2); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ExtractInterfaceDialog"; diff --git a/RetailCoder.VBE/UI/Refactorings/ExtractInterfaceDialog.resx b/RetailCoder.VBE/UI/Refactorings/ExtractInterfaceDialog.resx index d3a1a2980d..0a0a5023e2 100644 --- a/RetailCoder.VBE/UI/Refactorings/ExtractInterfaceDialog.resx +++ b/RetailCoder.VBE/UI/Refactorings/ExtractInterfaceDialog.resx @@ -120,23 +120,26 @@ - AAABAAEAEA4AAAEAIADgAwAAFgAAACgAAAAQAAAAHAAAAAEAIAAAAAAAuAMAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAB4AAABxAAEBtQEYGOMCLCz3AzEx/AIhIewABwfFAAAAiQAAADYAAAABAAAAAAAA - AAAAAAAAAAAAAQAAAJIDODj5CJqa/wzh4f8O/f3/Dv///w7///8O////De/v/wq0tP8ES0v/AAAAewAA - AAAAAAAAAAAAAAAAAEcFWlr/Dv///w7///8O////Dv///w7///8O////Dv///w7///8O////Dvv7/wMw - MPkAAAAgAAAAAAAAAAAAAQGpC8zM/w7///8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8JoKD/AAAAfAAAAAAAAAAAARMT4g78/P8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////DNzc/wAAALAAAAAAAAAAAAImJvcO////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w3o6P8AAAC8AAAAAAAAAAACHh7vDv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w7///8LxMT/AAAAngAAAAAAAAAAAAQExg3o6P8O////Dv///wmnp/8GZ2f/B3l5/wZ1 - df8Kr6//Dv///w7///8O////Bmxs/wAAAFIAAAAAAAAAAAAAAGwHgoL/Dv///wq+vv8BDAzTAAAAOQAA - AE8BDQ3yDNLS/w7///8O////Dv///wZlZf8AABS4AAAPgQAAAA0AAAAIAQwM1AVjY/8ABwfEAAAAGAAA - AAAAAABNBnJy/w7///8O////Dv///w7///8N5ub/AAM+/wAA4P8AAC62AAAAAAAAACAAAABLAAAAAgAA - AAAAAAAAAAAAaAiUlP8O////Dv///wvKyv8Lvr7/Dvv7/wEQMf8AAP//AACF/wAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAADkFV1f/Dv///w7///8HdHT/Blxc/wvMzP8AAAXWAAAoogAAF58AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAEBrwiQkP8O+/v/Dv///wzY2P8CLCz1AAAAMQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACHARkZ4wIpKfQABga8AAAANgAAAAAAAAAAAAAAAMAH - AAAABwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAQAAACMAAAA/AAAAP4DAAD+BwAA + AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAEAAAAAAAAABwAAAAgAAAAGAAAABwAAAAgAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAABAwNEAAAA/zpkZP8uXmP/LGBl/y9hY/80ZGP/OWlo/0t2dP8AAAD/AAAAxwEC + AogAAAAAAAAAAAAAAAAAAQGTCicr/zTk+f9U3v//RtX//0rV//9P3f//Ve3//y/p//855/v/Qv3//1T/ + //8MLS/+AAAA0QAAAAAAAQGRBBMW/zXn/f846v//SNz9/0jL/v8xvv//OMv//0DU//8/3v3/L+j//zTo + //8r4/z/Svr//0mAf/4BAgKIISko/ynQ5v8x6P//Men//y7Z7v9ApLn/LrH4/y+y9f84vfT/K57K/y/l + +v8x5///L+j//0v2//+M////AAAAihIsLf8w7f//MOr//zXq//8x6f//JK6+/yeIp/8gZoL/LYyq/ynF + 2f8w5/7/MOj//zTq//9K9P//g////wAAAJUAAADSROX//1LK//9E5f//OO7//zLr//8w4ff/L+X7/y/j + +v8x6P//N+z//zHo//8s5v//gv3//7j///4AAACcAAAAlD+Cof87c4z/RGNj/zRdY/8xoK7+LfX//xrm + //8c2v//IeD//zDx//9G+P//Vvr//9z///8kKir/AAAAAAAAAFYAAABtAAAAGgAAAAgAAAALAAAA2yTb + +v8Y0f//HNr//xzf//8z+///Yv///2y8vP4qMjL/BAUFMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3Cac + r/8t0/7/Icn//x7Y//8o+P7/Sv///wAAAP8AAACgAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEwwh + I/873P//JMj//xS8//8Wyv//Gpi2/wIADv8LCgC5AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + ACUqYWT/Mtb//xy6//8Gt/7/Htr//xlhbP8fRvX/O1Hs/jlCctsAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAaSGpo/0vZ//4Zs///n+z//wAAAP9FVFz/E0Gh/z1G//9AS2j/AAAAAwAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAABAAAAKiS8/7MOr3//pLc/v/v////Pmxs/zBBPcIAAAD/ISEv/wAAAAQAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAABNAAAAtqXk8shM0v//Ppac/wAAAP8AAAA2AAAAAAAAAAcAAAABAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAACfAAAAlAAAAIAAAAA3AAAAAQAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAOADAACAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAD4AwAA8AcAAPAPAADwBwAA8AcAAPAH + AAD4PwAA/H8AAA== \ No newline at end of file diff --git a/RetailCoder.VBE/UI/Refactorings/ExtractMethodDialog.Designer.cs b/RetailCoder.VBE/UI/Refactorings/ExtractMethodDialog.Designer.cs index 409633a9ab..a882325525 100644 --- a/RetailCoder.VBE/UI/Refactorings/ExtractMethodDialog.Designer.cs +++ b/RetailCoder.VBE/UI/Refactorings/ExtractMethodDialog.Designer.cs @@ -62,21 +62,19 @@ private void InitializeComponent() this.flowLayoutPanel2.Controls.Add(this.OkButton); this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 539); - this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 438); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(11, 10, 0, 10); - this.flowLayoutPanel2.Size = new System.Drawing.Size(800, 53); + this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(8, 8, 0, 8); + this.flowLayoutPanel2.Size = new System.Drawing.Size(600, 43); this.flowLayoutPanel2.TabIndex = 1; // // CancelDialogButton // this.CancelDialogButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.CancelDialogButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.CancelDialogButton.Location = new System.Drawing.Point(685, 14); - this.CancelDialogButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.CancelDialogButton.Location = new System.Drawing.Point(514, 11); this.CancelDialogButton.Name = "CancelDialogButton"; - this.CancelDialogButton.Size = new System.Drawing.Size(100, 28); + this.CancelDialogButton.Size = new System.Drawing.Size(75, 23); this.CancelDialogButton.TabIndex = 4; this.CancelDialogButton.Text = "Cancel"; this.CancelDialogButton.UseVisualStyleBackColor = false; @@ -85,10 +83,9 @@ private void InitializeComponent() // this.OkButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.OkButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.OkButton.Location = new System.Drawing.Point(577, 14); - this.OkButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.OkButton.Location = new System.Drawing.Point(433, 11); this.OkButton.Name = "OkButton"; - this.OkButton.Size = new System.Drawing.Size(100, 28); + this.OkButton.Size = new System.Drawing.Size(75, 23); this.OkButton.TabIndex = 3; this.OkButton.Text = "Ok"; this.OkButton.UseVisualStyleBackColor = false; @@ -100,29 +97,28 @@ private void InitializeComponent() this.panel2.Controls.Add(this.InstructionsLabel); this.panel2.Dock = System.Windows.Forms.DockStyle.Top; this.panel2.Location = new System.Drawing.Point(0, 0); - this.panel2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(800, 84); + this.panel2.Size = new System.Drawing.Size(600, 68); this.panel2.TabIndex = 13; // // TitleLabel // this.TitleLabel.AutoSize = true; this.TitleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.TitleLabel.Location = new System.Drawing.Point(20, 11); - this.TitleLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.TitleLabel.Location = new System.Drawing.Point(15, 9); this.TitleLabel.Name = "TitleLabel"; - this.TitleLabel.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.TitleLabel.Size = new System.Drawing.Size(128, 22); + this.TitleLabel.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.TitleLabel.Size = new System.Drawing.Size(107, 19); this.TitleLabel.TabIndex = 2; this.TitleLabel.Text = "Extract Method"; // // InstructionsLabel // - this.InstructionsLabel.Location = new System.Drawing.Point(20, 30); + this.InstructionsLabel.Location = new System.Drawing.Point(15, 24); + this.InstructionsLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.InstructionsLabel.Name = "InstructionsLabel"; - this.InstructionsLabel.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.InstructionsLabel.Size = new System.Drawing.Size(549, 34); + this.InstructionsLabel.Padding = new System.Windows.Forms.Padding(3, 3, 3, 3); + this.InstructionsLabel.Size = new System.Drawing.Size(412, 28); this.InstructionsLabel.TabIndex = 3; this.InstructionsLabel.Text = "Please specify method name, return type and/or parameters (if applicable), and ot" + "her options."; @@ -138,17 +134,15 @@ private void InitializeComponent() this.panel1.Controls.Add(this.AccessibilityLabel); this.panel1.Controls.Add(this.MethodNameBox); this.panel1.Controls.Add(this.NameLabel); - this.panel1.Location = new System.Drawing.Point(0, 87); - this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.panel1.Location = new System.Drawing.Point(0, 71); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(800, 458); + this.panel1.Size = new System.Drawing.Size(600, 372); this.panel1.TabIndex = 14; // // InvalidNameValidationIcon // this.InvalidNameValidationIcon.Image = global::Rubberduck.Properties.Resources.cross_circle; - this.InvalidNameValidationIcon.Location = new System.Drawing.Point(769, 1); - this.InvalidNameValidationIcon.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.InvalidNameValidationIcon.Location = new System.Drawing.Point(577, 1); this.InvalidNameValidationIcon.Name = "InvalidNameValidationIcon"; this.InvalidNameValidationIcon.Size = new System.Drawing.Size(16, 16); this.InvalidNameValidationIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -161,13 +155,12 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.PreviewBox.BackColor = System.Drawing.Color.White; this.PreviewBox.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.PreviewBox.Location = new System.Drawing.Point(24, 254); - this.PreviewBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.PreviewBox.Location = new System.Drawing.Point(18, 206); this.PreviewBox.Multiline = true; this.PreviewBox.Name = "PreviewBox"; this.PreviewBox.ReadOnly = true; this.PreviewBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.PreviewBox.Size = new System.Drawing.Size(759, 181); + this.PreviewBox.Size = new System.Drawing.Size(570, 148); this.PreviewBox.TabIndex = 9; this.PreviewBox.TabStop = false; this.PreviewBox.WordWrap = false; @@ -175,10 +168,9 @@ private void InitializeComponent() // PreviewLabel // this.PreviewLabel.AutoSize = true; - this.PreviewLabel.Location = new System.Drawing.Point(20, 234); - this.PreviewLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.PreviewLabel.Location = new System.Drawing.Point(15, 190); this.PreviewLabel.Name = "PreviewLabel"; - this.PreviewLabel.Size = new System.Drawing.Size(61, 17); + this.PreviewLabel.Size = new System.Drawing.Size(48, 13); this.PreviewLabel.TabIndex = 8; this.PreviewLabel.Text = "Preview:"; // @@ -188,72 +180,66 @@ private void InitializeComponent() this.MethodParametersGrid.AllowUserToDeleteRows = false; this.MethodParametersGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.MethodParametersGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.MethodParametersGrid.Location = new System.Drawing.Point(24, 101); - this.MethodParametersGrid.Margin = new System.Windows.Forms.Padding(11, 4, 11, 4); + this.MethodParametersGrid.Location = new System.Drawing.Point(18, 82); + this.MethodParametersGrid.Margin = new System.Windows.Forms.Padding(8, 3, 8, 3); this.MethodParametersGrid.Name = "MethodParametersGrid"; - this.MethodParametersGrid.Size = new System.Drawing.Size(760, 119); + this.MethodParametersGrid.Size = new System.Drawing.Size(570, 97); this.MethodParametersGrid.TabIndex = 2; // // ParametersLabel // this.ParametersLabel.AutoSize = true; - this.ParametersLabel.Location = new System.Drawing.Point(20, 81); - this.ParametersLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.ParametersLabel.Location = new System.Drawing.Point(15, 66); this.ParametersLabel.Name = "ParametersLabel"; - this.ParametersLabel.Size = new System.Drawing.Size(85, 17); + this.ParametersLabel.Size = new System.Drawing.Size(63, 13); this.ParametersLabel.TabIndex = 6; this.ParametersLabel.Text = "Parameters:"; // // MethodAccessibilityCombo // this.MethodAccessibilityCombo.FormattingEnabled = true; - this.MethodAccessibilityCombo.Location = new System.Drawing.Point(573, 42); - this.MethodAccessibilityCombo.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.MethodAccessibilityCombo.Location = new System.Drawing.Point(430, 34); this.MethodAccessibilityCombo.Name = "MethodAccessibilityCombo"; - this.MethodAccessibilityCombo.Size = new System.Drawing.Size(205, 24); + this.MethodAccessibilityCombo.Size = new System.Drawing.Size(155, 21); this.MethodAccessibilityCombo.TabIndex = 1; // // AccessibilityLabel // this.AccessibilityLabel.AutoSize = true; - this.AccessibilityLabel.Location = new System.Drawing.Point(475, 46); - this.AccessibilityLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.AccessibilityLabel.Location = new System.Drawing.Point(356, 37); this.AccessibilityLabel.Name = "AccessibilityLabel"; - this.AccessibilityLabel.Size = new System.Drawing.Size(88, 17); + this.AccessibilityLabel.Size = new System.Drawing.Size(67, 13); this.AccessibilityLabel.TabIndex = 4; this.AccessibilityLabel.Text = "Accessibility:"; // // MethodNameBox // - this.MethodNameBox.Location = new System.Drawing.Point(111, 9); - this.MethodNameBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.MethodNameBox.Location = new System.Drawing.Point(83, 7); this.MethodNameBox.Name = "MethodNameBox"; - this.MethodNameBox.Size = new System.Drawing.Size(667, 22); + this.MethodNameBox.Size = new System.Drawing.Size(501, 20); this.MethodNameBox.TabIndex = 0; // // NameLabel // this.NameLabel.AutoSize = true; - this.NameLabel.Location = new System.Drawing.Point(20, 12); - this.NameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.NameLabel.Location = new System.Drawing.Point(15, 10); this.NameLabel.Name = "NameLabel"; - this.NameLabel.Size = new System.Drawing.Size(49, 17); + this.NameLabel.Size = new System.Drawing.Size(38, 13); this.NameLabel.TabIndex = 0; this.NameLabel.Text = "Name:"; // // ExtractMethodDialog // this.AcceptButton = this.OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.CancelDialogButton; - this.ClientSize = new System.Drawing.Size(800, 592); + this.ClientSize = new System.Drawing.Size(600, 481); this.Controls.Add(this.panel1); this.Controls.Add(this.panel2); this.Controls.Add(this.flowLayoutPanel2); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ExtractMethodDialog"; diff --git a/RetailCoder.VBE/UI/Refactorings/ExtractMethodDialog.resx b/RetailCoder.VBE/UI/Refactorings/ExtractMethodDialog.resx index d3a1a2980d..0a0a5023e2 100644 --- a/RetailCoder.VBE/UI/Refactorings/ExtractMethodDialog.resx +++ b/RetailCoder.VBE/UI/Refactorings/ExtractMethodDialog.resx @@ -120,23 +120,26 @@ - AAABAAEAEA4AAAEAIADgAwAAFgAAACgAAAAQAAAAHAAAAAEAIAAAAAAAuAMAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAB4AAABxAAEBtQEYGOMCLCz3AzEx/AIhIewABwfFAAAAiQAAADYAAAABAAAAAAAA - AAAAAAAAAAAAAQAAAJIDODj5CJqa/wzh4f8O/f3/Dv///w7///8O////De/v/wq0tP8ES0v/AAAAewAA - AAAAAAAAAAAAAAAAAEcFWlr/Dv///w7///8O////Dv///w7///8O////Dv///w7///8O////Dvv7/wMw - MPkAAAAgAAAAAAAAAAAAAQGpC8zM/w7///8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8JoKD/AAAAfAAAAAAAAAAAARMT4g78/P8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////DNzc/wAAALAAAAAAAAAAAAImJvcO////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w3o6P8AAAC8AAAAAAAAAAACHh7vDv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w7///8LxMT/AAAAngAAAAAAAAAAAAQExg3o6P8O////Dv///wmnp/8GZ2f/B3l5/wZ1 - df8Kr6//Dv///w7///8O////Bmxs/wAAAFIAAAAAAAAAAAAAAGwHgoL/Dv///wq+vv8BDAzTAAAAOQAA - AE8BDQ3yDNLS/w7///8O////Dv///wZlZf8AABS4AAAPgQAAAA0AAAAIAQwM1AVjY/8ABwfEAAAAGAAA - AAAAAABNBnJy/w7///8O////Dv///w7///8N5ub/AAM+/wAA4P8AAC62AAAAAAAAACAAAABLAAAAAgAA - AAAAAAAAAAAAaAiUlP8O////Dv///wvKyv8Lvr7/Dvv7/wEQMf8AAP//AACF/wAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAADkFV1f/Dv///w7///8HdHT/Blxc/wvMzP8AAAXWAAAoogAAF58AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAEBrwiQkP8O+/v/Dv///wzY2P8CLCz1AAAAMQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACHARkZ4wIpKfQABga8AAAANgAAAAAAAAAAAAAAAMAH - AAAABwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAQAAACMAAAA/AAAAP4DAAD+BwAA + AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAEAAAAAAAAABwAAAAgAAAAGAAAABwAAAAgAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAABAwNEAAAA/zpkZP8uXmP/LGBl/y9hY/80ZGP/OWlo/0t2dP8AAAD/AAAAxwEC + AogAAAAAAAAAAAAAAAAAAQGTCicr/zTk+f9U3v//RtX//0rV//9P3f//Ve3//y/p//855/v/Qv3//1T/ + //8MLS/+AAAA0QAAAAAAAQGRBBMW/zXn/f846v//SNz9/0jL/v8xvv//OMv//0DU//8/3v3/L+j//zTo + //8r4/z/Svr//0mAf/4BAgKIISko/ynQ5v8x6P//Men//y7Z7v9ApLn/LrH4/y+y9f84vfT/K57K/y/l + +v8x5///L+j//0v2//+M////AAAAihIsLf8w7f//MOr//zXq//8x6f//JK6+/yeIp/8gZoL/LYyq/ynF + 2f8w5/7/MOj//zTq//9K9P//g////wAAAJUAAADSROX//1LK//9E5f//OO7//zLr//8w4ff/L+X7/y/j + +v8x6P//N+z//zHo//8s5v//gv3//7j///4AAACcAAAAlD+Cof87c4z/RGNj/zRdY/8xoK7+LfX//xrm + //8c2v//IeD//zDx//9G+P//Vvr//9z///8kKir/AAAAAAAAAFYAAABtAAAAGgAAAAgAAAALAAAA2yTb + +v8Y0f//HNr//xzf//8z+///Yv///2y8vP4qMjL/BAUFMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3Cac + r/8t0/7/Icn//x7Y//8o+P7/Sv///wAAAP8AAACgAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEwwh + I/873P//JMj//xS8//8Wyv//Gpi2/wIADv8LCgC5AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + ACUqYWT/Mtb//xy6//8Gt/7/Htr//xlhbP8fRvX/O1Hs/jlCctsAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAaSGpo/0vZ//4Zs///n+z//wAAAP9FVFz/E0Gh/z1G//9AS2j/AAAAAwAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAABAAAAKiS8/7MOr3//pLc/v/v////Pmxs/zBBPcIAAAD/ISEv/wAAAAQAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAABNAAAAtqXk8shM0v//Ppac/wAAAP8AAAA2AAAAAAAAAAcAAAABAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAACfAAAAlAAAAIAAAAA3AAAAAQAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAOADAACAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAD4AwAA8AcAAPAPAADwBwAA8AcAAPAH + AAD4PwAA/H8AAA== \ No newline at end of file diff --git a/RetailCoder.VBE/UI/Refactorings/RemoveParametersDialog.Designer.cs b/RetailCoder.VBE/UI/Refactorings/RemoveParametersDialog.Designer.cs index 2f3d83ddc5..d34f98c4a0 100644 --- a/RetailCoder.VBE/UI/Refactorings/RemoveParametersDialog.Designer.cs +++ b/RetailCoder.VBE/UI/Refactorings/RemoveParametersDialog.Designer.cs @@ -53,21 +53,19 @@ private void InitializeComponent() this.flowLayoutPanel2.Controls.Add(this.OkButton); this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 285); - this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(4); + this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 232); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(11, 10, 0, 10); - this.flowLayoutPanel2.Size = new System.Drawing.Size(536, 53); + this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(8, 8, 0, 8); + this.flowLayoutPanel2.Size = new System.Drawing.Size(402, 43); this.flowLayoutPanel2.TabIndex = 11; // // CancelDialogButton // this.CancelDialogButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.CancelDialogButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.CancelDialogButton.Location = new System.Drawing.Point(421, 14); - this.CancelDialogButton.Margin = new System.Windows.Forms.Padding(4); + this.CancelDialogButton.Location = new System.Drawing.Point(316, 11); this.CancelDialogButton.Name = "CancelDialogButton"; - this.CancelDialogButton.Size = new System.Drawing.Size(100, 28); + this.CancelDialogButton.Size = new System.Drawing.Size(75, 23); this.CancelDialogButton.TabIndex = 4; this.CancelDialogButton.Text = "Cancel"; this.CancelDialogButton.UseVisualStyleBackColor = false; @@ -76,10 +74,9 @@ private void InitializeComponent() // this.OkButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.OkButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.OkButton.Location = new System.Drawing.Point(313, 14); - this.OkButton.Margin = new System.Windows.Forms.Padding(4); + this.OkButton.Location = new System.Drawing.Point(235, 11); this.OkButton.Name = "OkButton"; - this.OkButton.Size = new System.Drawing.Size(100, 28); + this.OkButton.Size = new System.Drawing.Size(75, 23); this.OkButton.TabIndex = 3; this.OkButton.Text = "Ok"; this.OkButton.UseVisualStyleBackColor = false; @@ -91,20 +88,18 @@ private void InitializeComponent() this.panel1.Controls.Add(this.TitleLabel); this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Margin = new System.Windows.Forms.Padding(4); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(536, 87); + this.panel1.Size = new System.Drawing.Size(402, 71); this.panel1.TabIndex = 12; // // InstructionsLabel // this.InstructionsLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.InstructionsLabel.Location = new System.Drawing.Point(12, 37); - this.InstructionsLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.InstructionsLabel.Location = new System.Drawing.Point(9, 30); this.InstructionsLabel.Name = "InstructionsLabel"; - this.InstructionsLabel.Padding = new System.Windows.Forms.Padding(5); - this.InstructionsLabel.Size = new System.Drawing.Size(511, 42); + this.InstructionsLabel.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.InstructionsLabel.Size = new System.Drawing.Size(383, 34); this.InstructionsLabel.TabIndex = 6; this.InstructionsLabel.Text = "Select a parameter and double-click it or use buttons to remove or restore it."; // @@ -112,11 +107,10 @@ private void InitializeComponent() // this.TitleLabel.AutoSize = true; this.TitleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.TitleLabel.Location = new System.Drawing.Point(16, 11); - this.TitleLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.TitleLabel.Location = new System.Drawing.Point(12, 9); this.TitleLabel.Name = "TitleLabel"; - this.TitleLabel.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.TitleLabel.Size = new System.Drawing.Size(166, 22); + this.TitleLabel.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.TitleLabel.Size = new System.Drawing.Size(140, 19); this.TitleLabel.TabIndex = 4; this.TitleLabel.Text = "Remove parameters"; // @@ -128,8 +122,8 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.MethodParametersGrid.BackgroundColor = System.Drawing.Color.White; this.MethodParametersGrid.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; - this.MethodParametersGrid.Location = new System.Drawing.Point(12, 95); - this.MethodParametersGrid.Margin = new System.Windows.Forms.Padding(11, 4, 11, 4); + this.MethodParametersGrid.Location = new System.Drawing.Point(9, 77); + this.MethodParametersGrid.Margin = new System.Windows.Forms.Padding(8, 3, 8, 3); this.MethodParametersGrid.MultiSelect = false; this.MethodParametersGrid.Name = "MethodParametersGrid"; this.MethodParametersGrid.RowHeadersVisible = false; @@ -139,7 +133,7 @@ private void InitializeComponent() this.MethodParametersGrid.ShowCellToolTips = false; this.MethodParametersGrid.ShowEditingIcon = false; this.MethodParametersGrid.ShowRowErrors = false; - this.MethodParametersGrid.Size = new System.Drawing.Size(401, 183); + this.MethodParametersGrid.Size = new System.Drawing.Size(301, 149); this.MethodParametersGrid.TabIndex = 0; // // RemoveButton @@ -147,10 +141,9 @@ private void InitializeComponent() this.RemoveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.RemoveButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RemoveButton.Image = global::Rubberduck.Properties.Resources.cross_script; - this.RemoveButton.Location = new System.Drawing.Point(421, 95); - this.RemoveButton.Margin = new System.Windows.Forms.Padding(4); + this.RemoveButton.Location = new System.Drawing.Point(316, 77); this.RemoveButton.Name = "RemoveButton"; - this.RemoveButton.Size = new System.Drawing.Size(100, 89); + this.RemoveButton.Size = new System.Drawing.Size(75, 72); this.RemoveButton.TabIndex = 1; this.RemoveButton.Text = "Remove"; this.RemoveButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter; @@ -164,10 +157,9 @@ private void InitializeComponent() this.RestoreButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.RestoreButton.Image = global::Rubberduck.Properties.Resources.arrow_return_180_left; this.RestoreButton.ImageAlign = System.Drawing.ContentAlignment.TopCenter; - this.RestoreButton.Location = new System.Drawing.Point(421, 190); - this.RestoreButton.Margin = new System.Windows.Forms.Padding(4); + this.RestoreButton.Location = new System.Drawing.Point(316, 154); this.RestoreButton.Name = "RestoreButton"; - this.RestoreButton.Size = new System.Drawing.Size(100, 89); + this.RestoreButton.Size = new System.Drawing.Size(75, 72); this.RestoreButton.TabIndex = 2; this.RestoreButton.Text = "Restore"; this.RestoreButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter; @@ -178,10 +170,10 @@ private void InitializeComponent() // RemoveParametersDialog // this.AcceptButton = this.OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.CancelDialogButton; - this.ClientSize = new System.Drawing.Size(536, 338); + this.ClientSize = new System.Drawing.Size(402, 275); this.Controls.Add(this.flowLayoutPanel2); this.Controls.Add(this.RestoreButton); this.Controls.Add(this.panel1); @@ -189,7 +181,7 @@ private void InitializeComponent() this.Controls.Add(this.RemoveButton); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "RemoveParametersDialog"; diff --git a/RetailCoder.VBE/UI/Refactorings/RemoveParametersDialog.resx b/RetailCoder.VBE/UI/Refactorings/RemoveParametersDialog.resx index d3a1a2980d..0a0a5023e2 100644 --- a/RetailCoder.VBE/UI/Refactorings/RemoveParametersDialog.resx +++ b/RetailCoder.VBE/UI/Refactorings/RemoveParametersDialog.resx @@ -120,23 +120,26 @@ - AAABAAEAEA4AAAEAIADgAwAAFgAAACgAAAAQAAAAHAAAAAEAIAAAAAAAuAMAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAB4AAABxAAEBtQEYGOMCLCz3AzEx/AIhIewABwfFAAAAiQAAADYAAAABAAAAAAAA - AAAAAAAAAAAAAQAAAJIDODj5CJqa/wzh4f8O/f3/Dv///w7///8O////De/v/wq0tP8ES0v/AAAAewAA - AAAAAAAAAAAAAAAAAEcFWlr/Dv///w7///8O////Dv///w7///8O////Dv///w7///8O////Dvv7/wMw - MPkAAAAgAAAAAAAAAAAAAQGpC8zM/w7///8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8JoKD/AAAAfAAAAAAAAAAAARMT4g78/P8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////DNzc/wAAALAAAAAAAAAAAAImJvcO////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w3o6P8AAAC8AAAAAAAAAAACHh7vDv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w7///8LxMT/AAAAngAAAAAAAAAAAAQExg3o6P8O////Dv///wmnp/8GZ2f/B3l5/wZ1 - df8Kr6//Dv///w7///8O////Bmxs/wAAAFIAAAAAAAAAAAAAAGwHgoL/Dv///wq+vv8BDAzTAAAAOQAA - AE8BDQ3yDNLS/w7///8O////Dv///wZlZf8AABS4AAAPgQAAAA0AAAAIAQwM1AVjY/8ABwfEAAAAGAAA - AAAAAABNBnJy/w7///8O////Dv///w7///8N5ub/AAM+/wAA4P8AAC62AAAAAAAAACAAAABLAAAAAgAA - AAAAAAAAAAAAaAiUlP8O////Dv///wvKyv8Lvr7/Dvv7/wEQMf8AAP//AACF/wAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAADkFV1f/Dv///w7///8HdHT/Blxc/wvMzP8AAAXWAAAoogAAF58AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAEBrwiQkP8O+/v/Dv///wzY2P8CLCz1AAAAMQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACHARkZ4wIpKfQABga8AAAANgAAAAAAAAAAAAAAAMAH - AAAABwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAQAAACMAAAA/AAAAP4DAAD+BwAA + AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAEAAAAAAAAABwAAAAgAAAAGAAAABwAAAAgAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAABAwNEAAAA/zpkZP8uXmP/LGBl/y9hY/80ZGP/OWlo/0t2dP8AAAD/AAAAxwEC + AogAAAAAAAAAAAAAAAAAAQGTCicr/zTk+f9U3v//RtX//0rV//9P3f//Ve3//y/p//855/v/Qv3//1T/ + //8MLS/+AAAA0QAAAAAAAQGRBBMW/zXn/f846v//SNz9/0jL/v8xvv//OMv//0DU//8/3v3/L+j//zTo + //8r4/z/Svr//0mAf/4BAgKIISko/ynQ5v8x6P//Men//y7Z7v9ApLn/LrH4/y+y9f84vfT/K57K/y/l + +v8x5///L+j//0v2//+M////AAAAihIsLf8w7f//MOr//zXq//8x6f//JK6+/yeIp/8gZoL/LYyq/ynF + 2f8w5/7/MOj//zTq//9K9P//g////wAAAJUAAADSROX//1LK//9E5f//OO7//zLr//8w4ff/L+X7/y/j + +v8x6P//N+z//zHo//8s5v//gv3//7j///4AAACcAAAAlD+Cof87c4z/RGNj/zRdY/8xoK7+LfX//xrm + //8c2v//IeD//zDx//9G+P//Vvr//9z///8kKir/AAAAAAAAAFYAAABtAAAAGgAAAAgAAAALAAAA2yTb + +v8Y0f//HNr//xzf//8z+///Yv///2y8vP4qMjL/BAUFMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3Cac + r/8t0/7/Icn//x7Y//8o+P7/Sv///wAAAP8AAACgAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEwwh + I/873P//JMj//xS8//8Wyv//Gpi2/wIADv8LCgC5AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + ACUqYWT/Mtb//xy6//8Gt/7/Htr//xlhbP8fRvX/O1Hs/jlCctsAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAaSGpo/0vZ//4Zs///n+z//wAAAP9FVFz/E0Gh/z1G//9AS2j/AAAAAwAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAABAAAAKiS8/7MOr3//pLc/v/v////Pmxs/zBBPcIAAAD/ISEv/wAAAAQAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAABNAAAAtqXk8shM0v//Ppac/wAAAP8AAAA2AAAAAAAAAAcAAAABAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAACfAAAAlAAAAIAAAAA3AAAAAQAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAOADAACAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAD4AwAA8AcAAPAPAADwBwAA8AcAAPAH + AAD4PwAA/H8AAA== \ No newline at end of file diff --git a/RetailCoder.VBE/UI/Refactorings/RenameDialog.Designer.cs b/RetailCoder.VBE/UI/Refactorings/RenameDialog.Designer.cs index c1bb88de85..12c742a48d 100644 --- a/RetailCoder.VBE/UI/Refactorings/RenameDialog.Designer.cs +++ b/RetailCoder.VBE/UI/Refactorings/RenameDialog.Designer.cs @@ -55,31 +55,28 @@ private void InitializeComponent() this.panel1.Controls.Add(this.InstructionsLabel); this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Margin = new System.Windows.Forms.Padding(4); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(684, 79); + this.panel1.Size = new System.Drawing.Size(513, 64); this.panel1.TabIndex = 0; // // TitleLabel // this.TitleLabel.AutoSize = true; this.TitleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.TitleLabel.Location = new System.Drawing.Point(16, 11); - this.TitleLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.TitleLabel.Location = new System.Drawing.Point(12, 9); this.TitleLabel.Name = "TitleLabel"; - this.TitleLabel.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.TitleLabel.Size = new System.Drawing.Size(145, 22); + this.TitleLabel.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.TitleLabel.Size = new System.Drawing.Size(126, 19); this.TitleLabel.TabIndex = 4; this.TitleLabel.Text = "Rename identifier"; // // InstructionsLabel // this.InstructionsLabel.AutoSize = true; - this.InstructionsLabel.Location = new System.Drawing.Point(12, 37); - this.InstructionsLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.InstructionsLabel.Location = new System.Drawing.Point(9, 30); this.InstructionsLabel.Name = "InstructionsLabel"; - this.InstructionsLabel.Padding = new System.Windows.Forms.Padding(5); - this.InstructionsLabel.Size = new System.Drawing.Size(230, 27); + this.InstructionsLabel.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.InstructionsLabel.Size = new System.Drawing.Size(174, 21); this.InstructionsLabel.TabIndex = 5; this.InstructionsLabel.Text = "Please specify new name for \'{0}\'."; // @@ -88,10 +85,9 @@ private void InitializeComponent() this.panel2.BackColor = System.Drawing.SystemColors.ControlDark; this.panel2.Controls.Add(this.flowLayoutPanel2); this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panel2.Location = new System.Drawing.Point(0, 157); - this.panel2.Margin = new System.Windows.Forms.Padding(4); + this.panel2.Location = new System.Drawing.Point(0, 128); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(684, 52); + this.panel2.Size = new System.Drawing.Size(513, 42); this.panel2.TabIndex = 1; // // flowLayoutPanel2 @@ -102,20 +98,18 @@ private void InitializeComponent() this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; this.flowLayoutPanel2.Location = new System.Drawing.Point(0, -1); - this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(4); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(11, 10, 0, 10); - this.flowLayoutPanel2.Size = new System.Drawing.Size(684, 53); + this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(8, 8, 0, 8); + this.flowLayoutPanel2.Size = new System.Drawing.Size(513, 43); this.flowLayoutPanel2.TabIndex = 2; // // CancelDialogButton // this.CancelDialogButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.CancelDialogButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.CancelDialogButton.Location = new System.Drawing.Point(569, 14); - this.CancelDialogButton.Margin = new System.Windows.Forms.Padding(4); + this.CancelDialogButton.Location = new System.Drawing.Point(427, 11); this.CancelDialogButton.Name = "CancelDialogButton"; - this.CancelDialogButton.Size = new System.Drawing.Size(100, 28); + this.CancelDialogButton.Size = new System.Drawing.Size(75, 23); this.CancelDialogButton.TabIndex = 2; this.CancelDialogButton.Text = "Cancel"; this.CancelDialogButton.UseVisualStyleBackColor = false; @@ -124,10 +118,9 @@ private void InitializeComponent() // this.OkButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.OkButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.OkButton.Location = new System.Drawing.Point(461, 14); - this.OkButton.Margin = new System.Windows.Forms.Padding(4); + this.OkButton.Location = new System.Drawing.Point(346, 11); this.OkButton.Name = "OkButton"; - this.OkButton.Size = new System.Drawing.Size(100, 28); + this.OkButton.Size = new System.Drawing.Size(75, 23); this.OkButton.TabIndex = 1; this.OkButton.Text = "Ok"; this.OkButton.UseVisualStyleBackColor = false; @@ -135,8 +128,7 @@ private void InitializeComponent() // InvalidNameValidationIcon // this.InvalidNameValidationIcon.Image = global::Rubberduck.Properties.Resources.cross_circle; - this.InvalidNameValidationIcon.Location = new System.Drawing.Point(657, 86); - this.InvalidNameValidationIcon.Margin = new System.Windows.Forms.Padding(4); + this.InvalidNameValidationIcon.Location = new System.Drawing.Point(493, 70); this.InvalidNameValidationIcon.Name = "InvalidNameValidationIcon"; this.InvalidNameValidationIcon.Size = new System.Drawing.Size(16, 16); this.InvalidNameValidationIcon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -145,29 +137,27 @@ private void InitializeComponent() // // NewNameBox // - this.NewNameBox.Location = new System.Drawing.Point(76, 97); - this.NewNameBox.Margin = new System.Windows.Forms.Padding(4); + this.NewNameBox.Location = new System.Drawing.Point(57, 79); this.NewNameBox.Name = "NewNameBox"; - this.NewNameBox.Size = new System.Drawing.Size(592, 22); + this.NewNameBox.Size = new System.Drawing.Size(445, 20); this.NewNameBox.TabIndex = 0; // // NameLabel // this.NameLabel.AutoSize = true; - this.NameLabel.Location = new System.Drawing.Point(12, 101); - this.NameLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.NameLabel.Location = new System.Drawing.Point(9, 82); this.NameLabel.Name = "NameLabel"; - this.NameLabel.Size = new System.Drawing.Size(49, 17); + this.NameLabel.Size = new System.Drawing.Size(38, 13); this.NameLabel.TabIndex = 11; this.NameLabel.Text = "Name:"; // // RenameDialog // this.AcceptButton = this.OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.CancelDialogButton; - this.ClientSize = new System.Drawing.Size(684, 209); + this.ClientSize = new System.Drawing.Size(513, 170); this.Controls.Add(this.InvalidNameValidationIcon); this.Controls.Add(this.NewNameBox); this.Controls.Add(this.NameLabel); @@ -175,7 +165,6 @@ private void InitializeComponent() this.Controls.Add(this.panel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "RenameDialog"; diff --git a/RetailCoder.VBE/UI/Refactorings/RenameDialog.resx b/RetailCoder.VBE/UI/Refactorings/RenameDialog.resx index d3a1a2980d..0a0a5023e2 100644 --- a/RetailCoder.VBE/UI/Refactorings/RenameDialog.resx +++ b/RetailCoder.VBE/UI/Refactorings/RenameDialog.resx @@ -120,23 +120,26 @@ - AAABAAEAEA4AAAEAIADgAwAAFgAAACgAAAAQAAAAHAAAAAEAIAAAAAAAuAMAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAB4AAABxAAEBtQEYGOMCLCz3AzEx/AIhIewABwfFAAAAiQAAADYAAAABAAAAAAAA - AAAAAAAAAAAAAQAAAJIDODj5CJqa/wzh4f8O/f3/Dv///w7///8O////De/v/wq0tP8ES0v/AAAAewAA - AAAAAAAAAAAAAAAAAEcFWlr/Dv///w7///8O////Dv///w7///8O////Dv///w7///8O////Dvv7/wMw - MPkAAAAgAAAAAAAAAAAAAQGpC8zM/w7///8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8JoKD/AAAAfAAAAAAAAAAAARMT4g78/P8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////DNzc/wAAALAAAAAAAAAAAAImJvcO////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w3o6P8AAAC8AAAAAAAAAAACHh7vDv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w7///8LxMT/AAAAngAAAAAAAAAAAAQExg3o6P8O////Dv///wmnp/8GZ2f/B3l5/wZ1 - df8Kr6//Dv///w7///8O////Bmxs/wAAAFIAAAAAAAAAAAAAAGwHgoL/Dv///wq+vv8BDAzTAAAAOQAA - AE8BDQ3yDNLS/w7///8O////Dv///wZlZf8AABS4AAAPgQAAAA0AAAAIAQwM1AVjY/8ABwfEAAAAGAAA - AAAAAABNBnJy/w7///8O////Dv///w7///8N5ub/AAM+/wAA4P8AAC62AAAAAAAAACAAAABLAAAAAgAA - AAAAAAAAAAAAaAiUlP8O////Dv///wvKyv8Lvr7/Dvv7/wEQMf8AAP//AACF/wAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAADkFV1f/Dv///w7///8HdHT/Blxc/wvMzP8AAAXWAAAoogAAF58AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAEBrwiQkP8O+/v/Dv///wzY2P8CLCz1AAAAMQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACHARkZ4wIpKfQABga8AAAANgAAAAAAAAAAAAAAAMAH - AAAABwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAQAAACMAAAA/AAAAP4DAAD+BwAA + AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAEAAAAAAAAABwAAAAgAAAAGAAAABwAAAAgAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAABAwNEAAAA/zpkZP8uXmP/LGBl/y9hY/80ZGP/OWlo/0t2dP8AAAD/AAAAxwEC + AogAAAAAAAAAAAAAAAAAAQGTCicr/zTk+f9U3v//RtX//0rV//9P3f//Ve3//y/p//855/v/Qv3//1T/ + //8MLS/+AAAA0QAAAAAAAQGRBBMW/zXn/f846v//SNz9/0jL/v8xvv//OMv//0DU//8/3v3/L+j//zTo + //8r4/z/Svr//0mAf/4BAgKIISko/ynQ5v8x6P//Men//y7Z7v9ApLn/LrH4/y+y9f84vfT/K57K/y/l + +v8x5///L+j//0v2//+M////AAAAihIsLf8w7f//MOr//zXq//8x6f//JK6+/yeIp/8gZoL/LYyq/ynF + 2f8w5/7/MOj//zTq//9K9P//g////wAAAJUAAADSROX//1LK//9E5f//OO7//zLr//8w4ff/L+X7/y/j + +v8x6P//N+z//zHo//8s5v//gv3//7j///4AAACcAAAAlD+Cof87c4z/RGNj/zRdY/8xoK7+LfX//xrm + //8c2v//IeD//zDx//9G+P//Vvr//9z///8kKir/AAAAAAAAAFYAAABtAAAAGgAAAAgAAAALAAAA2yTb + +v8Y0f//HNr//xzf//8z+///Yv///2y8vP4qMjL/BAUFMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3Cac + r/8t0/7/Icn//x7Y//8o+P7/Sv///wAAAP8AAACgAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEwwh + I/873P//JMj//xS8//8Wyv//Gpi2/wIADv8LCgC5AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + ACUqYWT/Mtb//xy6//8Gt/7/Htr//xlhbP8fRvX/O1Hs/jlCctsAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAaSGpo/0vZ//4Zs///n+z//wAAAP9FVFz/E0Gh/z1G//9AS2j/AAAAAwAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAABAAAAKiS8/7MOr3//pLc/v/v////Pmxs/zBBPcIAAAD/ISEv/wAAAAQAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAABNAAAAtqXk8shM0v//Ppac/wAAAP8AAAA2AAAAAAAAAAcAAAABAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAACfAAAAlAAAAIAAAAA3AAAAAQAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAOADAACAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAD4AwAA8AcAAPAPAADwBwAA8AcAAPAH + AAD4PwAA/H8AAA== \ No newline at end of file diff --git a/RetailCoder.VBE/UI/Refactorings/ReorderParametersDialog.Designer.cs b/RetailCoder.VBE/UI/Refactorings/ReorderParametersDialog.Designer.cs index 8f7e5f215c..7cada55d5f 100644 --- a/RetailCoder.VBE/UI/Refactorings/ReorderParametersDialog.Designer.cs +++ b/RetailCoder.VBE/UI/Refactorings/ReorderParametersDialog.Designer.cs @@ -51,10 +51,9 @@ private void InitializeComponent() this.MoveDownButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.MoveDownButton.Image = ((System.Drawing.Image)(resources.GetObject("MoveDownButton.Image"))); this.MoveDownButton.ImageAlign = System.Drawing.ContentAlignment.TopCenter; - this.MoveDownButton.Location = new System.Drawing.Point(421, 190); - this.MoveDownButton.Margin = new System.Windows.Forms.Padding(4); + this.MoveDownButton.Location = new System.Drawing.Point(316, 154); this.MoveDownButton.Name = "MoveDownButton"; - this.MoveDownButton.Size = new System.Drawing.Size(100, 89); + this.MoveDownButton.Size = new System.Drawing.Size(75, 72); this.MoveDownButton.TabIndex = 2; this.MoveDownButton.Text = "Move down"; this.MoveDownButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter; @@ -69,21 +68,19 @@ private void InitializeComponent() this.flowLayoutPanel2.Controls.Add(this.OkButton); this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 285); - this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(4); + this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 232); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(11, 10, 0, 10); - this.flowLayoutPanel2.Size = new System.Drawing.Size(536, 53); + this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(8, 8, 0, 8); + this.flowLayoutPanel2.Size = new System.Drawing.Size(402, 43); this.flowLayoutPanel2.TabIndex = 3; // // CancelDialogButton // this.CancelDialogButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.CancelDialogButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.CancelDialogButton.Location = new System.Drawing.Point(421, 14); - this.CancelDialogButton.Margin = new System.Windows.Forms.Padding(4); + this.CancelDialogButton.Location = new System.Drawing.Point(316, 11); this.CancelDialogButton.Name = "CancelDialogButton"; - this.CancelDialogButton.Size = new System.Drawing.Size(100, 28); + this.CancelDialogButton.Size = new System.Drawing.Size(75, 23); this.CancelDialogButton.TabIndex = 4; this.CancelDialogButton.Text = "Cancel"; this.CancelDialogButton.UseVisualStyleBackColor = false; @@ -92,10 +89,9 @@ private void InitializeComponent() // this.OkButton.BackColor = System.Drawing.SystemColors.ButtonFace; this.OkButton.DialogResult = System.Windows.Forms.DialogResult.OK; - this.OkButton.Location = new System.Drawing.Point(313, 14); - this.OkButton.Margin = new System.Windows.Forms.Padding(4); + this.OkButton.Location = new System.Drawing.Point(235, 11); this.OkButton.Name = "OkButton"; - this.OkButton.Size = new System.Drawing.Size(100, 28); + this.OkButton.Size = new System.Drawing.Size(75, 23); this.OkButton.TabIndex = 3; this.OkButton.Text = "Ok"; this.OkButton.UseVisualStyleBackColor = false; @@ -107,20 +103,18 @@ private void InitializeComponent() this.panel1.Controls.Add(this.TitleLabel); this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Margin = new System.Windows.Forms.Padding(4); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(536, 87); + this.panel1.Size = new System.Drawing.Size(402, 71); this.panel1.TabIndex = 4; // // InstructionsLabel // this.InstructionsLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.InstructionsLabel.Location = new System.Drawing.Point(12, 37); - this.InstructionsLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.InstructionsLabel.Location = new System.Drawing.Point(9, 30); this.InstructionsLabel.Name = "InstructionsLabel"; - this.InstructionsLabel.Padding = new System.Windows.Forms.Padding(5); - this.InstructionsLabel.Size = new System.Drawing.Size(511, 42); + this.InstructionsLabel.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.InstructionsLabel.Size = new System.Drawing.Size(383, 34); this.InstructionsLabel.TabIndex = 6; this.InstructionsLabel.Text = "Select a parameter and drag it or use buttons to move it up or down."; // @@ -128,11 +122,10 @@ private void InitializeComponent() // this.TitleLabel.AutoSize = true; this.TitleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.TitleLabel.Location = new System.Drawing.Point(16, 11); - this.TitleLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.TitleLabel.Location = new System.Drawing.Point(12, 9); this.TitleLabel.Name = "TitleLabel"; - this.TitleLabel.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2); - this.TitleLabel.Size = new System.Drawing.Size(165, 22); + this.TitleLabel.Padding = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.TitleLabel.Size = new System.Drawing.Size(140, 19); this.TitleLabel.TabIndex = 4; this.TitleLabel.Text = "Reorder parameters"; // @@ -144,8 +137,8 @@ private void InitializeComponent() | System.Windows.Forms.AnchorStyles.Right))); this.MethodParametersGrid.BackgroundColor = System.Drawing.Color.White; this.MethodParametersGrid.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; - this.MethodParametersGrid.Location = new System.Drawing.Point(12, 95); - this.MethodParametersGrid.Margin = new System.Windows.Forms.Padding(11, 4, 11, 4); + this.MethodParametersGrid.Location = new System.Drawing.Point(9, 77); + this.MethodParametersGrid.Margin = new System.Windows.Forms.Padding(8, 3, 8, 3); this.MethodParametersGrid.MultiSelect = false; this.MethodParametersGrid.Name = "MethodParametersGrid"; this.MethodParametersGrid.RowHeadersVisible = false; @@ -155,17 +148,16 @@ private void InitializeComponent() this.MethodParametersGrid.ShowCellToolTips = false; this.MethodParametersGrid.ShowEditingIcon = false; this.MethodParametersGrid.ShowRowErrors = false; - this.MethodParametersGrid.Size = new System.Drawing.Size(401, 183); + this.MethodParametersGrid.Size = new System.Drawing.Size(301, 149); this.MethodParametersGrid.TabIndex = 0; // // MoveUpButton // this.MoveUpButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.MoveUpButton.Image = ((System.Drawing.Image)(resources.GetObject("MoveUpButton.Image"))); - this.MoveUpButton.Location = new System.Drawing.Point(421, 95); - this.MoveUpButton.Margin = new System.Windows.Forms.Padding(4); + this.MoveUpButton.Location = new System.Drawing.Point(316, 77); this.MoveUpButton.Name = "MoveUpButton"; - this.MoveUpButton.Size = new System.Drawing.Size(100, 89); + this.MoveUpButton.Size = new System.Drawing.Size(75, 72); this.MoveUpButton.TabIndex = 1; this.MoveUpButton.Text = "Move up"; this.MoveUpButton.TextAlign = System.Drawing.ContentAlignment.BottomCenter; @@ -176,10 +168,10 @@ private void InitializeComponent() // ReorderParametersDialog // this.AcceptButton = this.OkButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.CancelDialogButton; - this.ClientSize = new System.Drawing.Size(536, 338); + this.ClientSize = new System.Drawing.Size(402, 275); this.Controls.Add(this.MethodParametersGrid); this.Controls.Add(this.panel1); this.Controls.Add(this.flowLayoutPanel2); @@ -187,7 +179,7 @@ private void InitializeComponent() this.Controls.Add(this.MoveUpButton); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ReorderParametersDialog"; diff --git a/RetailCoder.VBE/UI/Refactorings/ReorderParametersDialog.resx b/RetailCoder.VBE/UI/Refactorings/ReorderParametersDialog.resx index 885f8871f0..b81f9c2d9c 100644 --- a/RetailCoder.VBE/UI/Refactorings/ReorderParametersDialog.resx +++ b/RetailCoder.VBE/UI/Refactorings/ReorderParametersDialog.resx @@ -148,23 +148,26 @@ - AAABAAEAEA4AAAEAIADgAwAAFgAAACgAAAAQAAAAHAAAAAEAIAAAAAAAuAMAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAB4AAABxAAEBtQEYGOMCLCz3AzEx/AIhIewABwfFAAAAiQAAADYAAAABAAAAAAAA - AAAAAAAAAAAAAQAAAJIDODj5CJqa/wzh4f8O/f3/Dv///w7///8O////De/v/wq0tP8ES0v/AAAAewAA - AAAAAAAAAAAAAAAAAEcFWlr/Dv///w7///8O////Dv///w7///8O////Dv///w7///8O////Dvv7/wMw - MPkAAAAgAAAAAAAAAAAAAQGpC8zM/w7///8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8JoKD/AAAAfAAAAAAAAAAAARMT4g78/P8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////DNzc/wAAALAAAAAAAAAAAAImJvcO////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w3o6P8AAAC8AAAAAAAAAAACHh7vDv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w7///8LxMT/AAAAngAAAAAAAAAAAAQExg3o6P8O////Dv///wmnp/8GZ2f/B3l5/wZ1 - df8Kr6//Dv///w7///8O////Bmxs/wAAAFIAAAAAAAAAAAAAAGwHgoL/Dv///wq+vv8BDAzTAAAAOQAA - AE8BDQ3yDNLS/w7///8O////Dv///wZlZf8AABS4AAAPgQAAAA0AAAAIAQwM1AVjY/8ABwfEAAAAGAAA - AAAAAABNBnJy/w7///8O////Dv///w7///8N5ub/AAM+/wAA4P8AAC62AAAAAAAAACAAAABLAAAAAgAA - AAAAAAAAAAAAaAiUlP8O////Dv///wvKyv8Lvr7/Dvv7/wEQMf8AAP//AACF/wAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAADkFV1f/Dv///w7///8HdHT/Blxc/wvMzP8AAAXWAAAoogAAF58AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAEBrwiQkP8O+/v/Dv///wzY2P8CLCz1AAAAMQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACHARkZ4wIpKfQABga8AAAANgAAAAAAAAAAAAAAAMAH - AAAABwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAQAAACMAAAA/AAAAP4DAAD+BwAA + AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAEAAAAAAAAABwAAAAgAAAAGAAAABwAAAAgAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAABAwNEAAAA/zpkZP8uXmP/LGBl/y9hY/80ZGP/OWlo/0t2dP8AAAD/AAAAxwEC + AogAAAAAAAAAAAAAAAAAAQGTCicr/zTk+f9U3v//RtX//0rV//9P3f//Ve3//y/p//855/v/Qv3//1T/ + //8MLS/+AAAA0QAAAAAAAQGRBBMW/zXn/f846v//SNz9/0jL/v8xvv//OMv//0DU//8/3v3/L+j//zTo + //8r4/z/Svr//0mAf/4BAgKIISko/ynQ5v8x6P//Men//y7Z7v9ApLn/LrH4/y+y9f84vfT/K57K/y/l + +v8x5///L+j//0v2//+M////AAAAihIsLf8w7f//MOr//zXq//8x6f//JK6+/yeIp/8gZoL/LYyq/ynF + 2f8w5/7/MOj//zTq//9K9P//g////wAAAJUAAADSROX//1LK//9E5f//OO7//zLr//8w4ff/L+X7/y/j + +v8x6P//N+z//zHo//8s5v//gv3//7j///4AAACcAAAAlD+Cof87c4z/RGNj/zRdY/8xoK7+LfX//xrm + //8c2v//IeD//zDx//9G+P//Vvr//9z///8kKir/AAAAAAAAAFYAAABtAAAAGgAAAAgAAAALAAAA2yTb + +v8Y0f//HNr//xzf//8z+///Yv///2y8vP4qMjL/BAUFMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3Cac + r/8t0/7/Icn//x7Y//8o+P7/Sv///wAAAP8AAACgAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEwwh + I/873P//JMj//xS8//8Wyv//Gpi2/wIADv8LCgC5AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + ACUqYWT/Mtb//xy6//8Gt/7/Htr//xlhbP8fRvX/O1Hs/jlCctsAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAaSGpo/0vZ//4Zs///n+z//wAAAP9FVFz/E0Gh/z1G//9AS2j/AAAAAwAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAABAAAAKiS8/7MOr3//pLc/v/v////Pmxs/zBBPcIAAAD/ISEv/wAAAAQAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAABNAAAAtqXk8shM0v//Ppac/wAAAP8AAAA2AAAAAAAAAAcAAAABAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAACfAAAAlAAAAIAAAAA3AAAAAQAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAOADAACAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAD4AwAA8AcAAPAPAADwBwAA8AcAAPAH + AAD4PwAA/H8AAA== \ No newline at end of file diff --git a/RetailCoder.VBE/UI/RegexAssistant/RegexAssistantDialog.Designer.cs b/RetailCoder.VBE/UI/RegexAssistant/RegexAssistantDialog.Designer.cs index e1f92c6068..c77c8e2b21 100644 --- a/RetailCoder.VBE/UI/RegexAssistant/RegexAssistantDialog.Designer.cs +++ b/RetailCoder.VBE/UI/RegexAssistant/RegexAssistantDialog.Designer.cs @@ -90,7 +90,7 @@ private void InitializeComponent() this.flowLayoutPanel2.Controls.Add(this.CloseButton); this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Bottom; this.flowLayoutPanel2.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 398); + this.flowLayoutPanel2.Location = new System.Drawing.Point(0, 399); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; this.flowLayoutPanel2.Padding = new System.Windows.Forms.Padding(8, 8, 0, 8); this.flowLayoutPanel2.Size = new System.Drawing.Size(464, 43); @@ -102,7 +102,7 @@ private void InitializeComponent() this.ElementHost.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.ElementHost.Location = new System.Drawing.Point(0, 64); this.ElementHost.Name = "ElementHost"; - this.ElementHost.Size = new System.Drawing.Size(464, 334); + this.ElementHost.Size = new System.Drawing.Size(464, 335); this.ElementHost.TabIndex = 4; this.ElementHost.Child = this.RegexAssistant; // @@ -111,7 +111,7 @@ private void InitializeComponent() this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.CloseButton; - this.ClientSize = new System.Drawing.Size(464, 441); + this.ClientSize = new System.Drawing.Size(464, 442); this.Controls.Add(this.ElementHost); this.Controls.Add(this.flowLayoutPanel2); this.Controls.Add(this.panel1); diff --git a/RetailCoder.VBE/UI/RegexAssistant/RegexAssistantDialog.resx b/RetailCoder.VBE/UI/RegexAssistant/RegexAssistantDialog.resx index d3a1a2980d..0a0a5023e2 100644 --- a/RetailCoder.VBE/UI/RegexAssistant/RegexAssistantDialog.resx +++ b/RetailCoder.VBE/UI/RegexAssistant/RegexAssistantDialog.resx @@ -120,23 +120,26 @@ - AAABAAEAEA4AAAEAIADgAwAAFgAAACgAAAAQAAAAHAAAAAEAIAAAAAAAuAMAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAB4AAABxAAEBtQEYGOMCLCz3AzEx/AIhIewABwfFAAAAiQAAADYAAAABAAAAAAAA - AAAAAAAAAAAAAQAAAJIDODj5CJqa/wzh4f8O/f3/Dv///w7///8O////De/v/wq0tP8ES0v/AAAAewAA - AAAAAAAAAAAAAAAAAEcFWlr/Dv///w7///8O////Dv///w7///8O////Dv///w7///8O////Dvv7/wMw - MPkAAAAgAAAAAAAAAAAAAQGpC8zM/w7///8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8JoKD/AAAAfAAAAAAAAAAAARMT4g78/P8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////DNzc/wAAALAAAAAAAAAAAAImJvcO////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w3o6P8AAAC8AAAAAAAAAAACHh7vDv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w7///8LxMT/AAAAngAAAAAAAAAAAAQExg3o6P8O////Dv///wmnp/8GZ2f/B3l5/wZ1 - df8Kr6//Dv///w7///8O////Bmxs/wAAAFIAAAAAAAAAAAAAAGwHgoL/Dv///wq+vv8BDAzTAAAAOQAA - AE8BDQ3yDNLS/w7///8O////Dv///wZlZf8AABS4AAAPgQAAAA0AAAAIAQwM1AVjY/8ABwfEAAAAGAAA - AAAAAABNBnJy/w7///8O////Dv///w7///8N5ub/AAM+/wAA4P8AAC62AAAAAAAAACAAAABLAAAAAgAA - AAAAAAAAAAAAaAiUlP8O////Dv///wvKyv8Lvr7/Dvv7/wEQMf8AAP//AACF/wAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAADkFV1f/Dv///w7///8HdHT/Blxc/wvMzP8AAAXWAAAoogAAF58AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAEBrwiQkP8O+/v/Dv///wzY2P8CLCz1AAAAMQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACHARkZ4wIpKfQABga8AAAANgAAAAAAAAAAAAAAAMAH - AAAABwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAQAAACMAAAA/AAAAP4DAAD+BwAA + AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAEAAAAAAAAABwAAAAgAAAAGAAAABwAAAAgAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAABAwNEAAAA/zpkZP8uXmP/LGBl/y9hY/80ZGP/OWlo/0t2dP8AAAD/AAAAxwEC + AogAAAAAAAAAAAAAAAAAAQGTCicr/zTk+f9U3v//RtX//0rV//9P3f//Ve3//y/p//855/v/Qv3//1T/ + //8MLS/+AAAA0QAAAAAAAQGRBBMW/zXn/f846v//SNz9/0jL/v8xvv//OMv//0DU//8/3v3/L+j//zTo + //8r4/z/Svr//0mAf/4BAgKIISko/ynQ5v8x6P//Men//y7Z7v9ApLn/LrH4/y+y9f84vfT/K57K/y/l + +v8x5///L+j//0v2//+M////AAAAihIsLf8w7f//MOr//zXq//8x6f//JK6+/yeIp/8gZoL/LYyq/ynF + 2f8w5/7/MOj//zTq//9K9P//g////wAAAJUAAADSROX//1LK//9E5f//OO7//zLr//8w4ff/L+X7/y/j + +v8x6P//N+z//zHo//8s5v//gv3//7j///4AAACcAAAAlD+Cof87c4z/RGNj/zRdY/8xoK7+LfX//xrm + //8c2v//IeD//zDx//9G+P//Vvr//9z///8kKir/AAAAAAAAAFYAAABtAAAAGgAAAAgAAAALAAAA2yTb + +v8Y0f//HNr//xzf//8z+///Yv///2y8vP4qMjL/BAUFMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3Cac + r/8t0/7/Icn//x7Y//8o+P7/Sv///wAAAP8AAACgAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEwwh + I/873P//JMj//xS8//8Wyv//Gpi2/wIADv8LCgC5AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + ACUqYWT/Mtb//xy6//8Gt/7/Htr//xlhbP8fRvX/O1Hs/jlCctsAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAaSGpo/0vZ//4Zs///n+z//wAAAP9FVFz/E0Gh/z1G//9AS2j/AAAAAwAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAABAAAAKiS8/7MOr3//pLc/v/v////Pmxs/zBBPcIAAAD/ISEv/wAAAAQAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAABNAAAAtqXk8shM0v//Ppac/wAAAP8AAAA2AAAAAAAAAAcAAAABAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAACfAAAAlAAAAIAAAAA3AAAAAQAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAOADAACAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAD4AwAA8AcAAPAPAADwBwAA8AcAAPAH + AAD4PwAA/H8AAA== \ No newline at end of file diff --git a/RetailCoder.VBE/UI/SelectionChangeService.cs b/RetailCoder.VBE/UI/SelectionChangeService.cs new file mode 100644 index 0000000000..50f45fd5cf --- /dev/null +++ b/RetailCoder.VBE/UI/SelectionChangeService.cs @@ -0,0 +1,191 @@ +using System; +using System.Linq; +using Rubberduck.Parsing; +using Rubberduck.Parsing.Symbols; +using Rubberduck.VBEditor.Events; +using Rubberduck.VBEditor.SafeComWrappers; +using Rubberduck.VBEditor.SafeComWrappers.Abstract; +using Rubberduck.VBEditor.SafeComWrappers.MSForms; + +namespace Rubberduck.UI +{ + public interface ISelectionChangeService + { + event EventHandler SelectedDeclarationChanged; + event EventHandler SelectionChanged; + } + + public class SelectionChangeService : ISelectionChangeService, IDisposable + { + public event EventHandler SelectedDeclarationChanged; + public event EventHandler SelectionChanged; + + private Declaration _lastSelectedDeclaration; + private readonly IVBE _vbe; + private readonly IParseCoordinator _parser; + + public SelectionChangeService(IVBE vbe, IParseCoordinator parser) + { + _parser = parser; + _vbe = vbe; + VBENativeServices.SelectionChanged += OnVbeSelectionChanged; + VBENativeServices.WindowFocusChange += OnVbeFocusChanged; + } + + private void OnVbeSelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (e.CodePane == null || e.CodePane.IsWrappingNullReference) + { + return; + } + + var eventArgs = new DeclarationChangedEventArgs(e.CodePane, _parser.State.FindSelectedDeclaration(e.CodePane)); + DispatchSelectedDeclaration(eventArgs); + } + + private void OnVbeFocusChanged(object sender, WindowChangedEventArgs e) + { + if (e.EventType == FocusType.GotFocus) + { + switch (e.Window.Type) + { + case WindowKind.Designer: + //Designer or control on designer form selected. + if (e.Window == null || e.Window.IsWrappingNullReference || e.Window.Type != WindowKind.Designer) + { + return; + } + DispatchSelectedDesignerDeclaration(_vbe.SelectedVBComponent); + break; + case WindowKind.CodeWindow: + //Caret changed in a code pane. + if (e.CodePane != null && !e.CodePane.IsWrappingNullReference) + { + DispatchSelectedDeclaration(new DeclarationChangedEventArgs(e.CodePane, _parser.State.FindSelectedDeclaration(e.CodePane))); + } + break; + } + } + else if (e.EventType == FocusType.ChildFocus) + { + //Treeview selection changed in project window. + DispatchSelectedProjectNodeDeclaration(_vbe.SelectedVBComponent); + } + } + + private void DispatchSelectionChanged(DeclarationChangedEventArgs eventArgs) + { + if (SelectionChanged == null) + { + return; + } + SelectionChanged.Invoke(null, eventArgs); + } + + + private void DispatchSelectedDeclaration(DeclarationChangedEventArgs eventArgs) + { + DispatchSelectionChanged(eventArgs); + + if (!DeclarationChanged(eventArgs.Declaration)) + { + return; + } + + _lastSelectedDeclaration = eventArgs.Declaration; + if (SelectedDeclarationChanged != null) + { + SelectedDeclarationChanged.Invoke(null, eventArgs); + } + } + + private void DispatchSelectedDesignerDeclaration(IVBComponent component) + { + if (component == null || string.IsNullOrEmpty(component.Name)) + { + return; + } + + var selected = component.SelectedControls.Count; + if (selected == 1) + { + var name = component.SelectedControls.First().Name; + var control = + _parser.State.AllUserDeclarations.SingleOrDefault(decl => + decl.IdentifierName.Equals(name) && + decl.ParentDeclaration.IdentifierName.Equals(component.Name) && + decl.ProjectId.Equals(component.ParentProject.ProjectId)); + + DispatchSelectedDeclaration(new DeclarationChangedEventArgs(null, control, component)); + return; + } + var form = + _parser.State.AllUserDeclarations.SingleOrDefault(decl => + decl.IdentifierName.Equals(component.Name) && + decl.ProjectId.Equals(component.ParentProject.ProjectId)); + + DispatchSelectedDeclaration(new DeclarationChangedEventArgs(null, form, component, selected > 1)); + } + + private void DispatchSelectedProjectNodeDeclaration(IVBComponent component) + { + if ((component == null || component.IsWrappingNullReference) && !_vbe.ActiveVBProject.IsWrappingNullReference) + { + //The user might have selected the project node in Project Explorer. If they've chosen a folder, we'll return the project anyway. + var project = + _parser.State.DeclarationFinder.UserDeclarations(DeclarationType.Project) + .SingleOrDefault(decl => decl.ProjectId.Equals(_vbe.ActiveVBProject.ProjectId)); + + DispatchSelectedDeclaration(new DeclarationChangedEventArgs(null, project, component)); + } + else if (component != null && component.Type == ComponentType.UserForm && component.HasOpenDesigner) + { + DispatchSelectedDesignerDeclaration(component); + } + else if (component != null) + { + //The user might have selected the project node in Project Explorer. If they've chosen a folder, we'll return the project anyway. + var module = + _parser.State.AllUserDeclarations.SingleOrDefault( + decl => decl.DeclarationType.HasFlag(DeclarationType.Module) && + decl.IdentifierName.Equals(component.Name) && + decl.ProjectId.Equals(_vbe.ActiveVBProject.ProjectId)); + + DispatchSelectedDeclaration(new DeclarationChangedEventArgs(null, module, component)); + } + } + + private bool DeclarationChanged(Declaration current) + { + if ((_lastSelectedDeclaration == null && current == null) || + ((_lastSelectedDeclaration != null && current != null) && !_lastSelectedDeclaration.Equals(current))) + { + return false; + } + return true; + } + + public void Dispose() + { + VBENativeServices.SelectionChanged -= OnVbeSelectionChanged; + VBENativeServices.WindowFocusChange -= OnVbeFocusChanged; + } + } + + public class DeclarationChangedEventArgs : EventArgs + { + public ICodePane ActivePane { get; private set; } + public Declaration Declaration { get; private set; } + // ReSharper disable once InconsistentNaming + public IVBComponent VBComponent { get; private set; } + public bool MultipleControlsSelected { get; private set; } + + public DeclarationChangedEventArgs(ICodePane pane, Declaration declaration, IVBComponent component = null, bool multipleControls = false) + { + ActivePane = pane; + Declaration = declaration; + VBComponent = component; + MultipleControlsSelected = multipleControls; + } + } +} diff --git a/RetailCoder.VBE/UI/Settings/SettingsForm.Designer.cs b/RetailCoder.VBE/UI/Settings/SettingsForm.Designer.cs index 9dcb154532..84b8e5ce85 100644 --- a/RetailCoder.VBE/UI/Settings/SettingsForm.Designer.cs +++ b/RetailCoder.VBE/UI/Settings/SettingsForm.Designer.cs @@ -38,9 +38,9 @@ private void InitializeComponent() this.ElementHost.Dock = System.Windows.Forms.DockStyle.Fill; this.ElementHost.ImeMode = System.Windows.Forms.ImeMode.NoControl; this.ElementHost.Location = new System.Drawing.Point(0, 0); - this.ElementHost.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.ElementHost.Margin = new System.Windows.Forms.Padding(2); this.ElementHost.Name = "ElementHost"; - this.ElementHost.Size = new System.Drawing.Size(624, 473); + this.ElementHost.Size = new System.Drawing.Size(904, 582); this.ElementHost.TabIndex = 0; this.ElementHost.Child = this.SettingsControl; // @@ -48,10 +48,10 @@ private void InitializeComponent() // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(624, 473); + this.ClientSize = new System.Drawing.Size(904, 582); this.Controls.Add(this.ElementHost); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.Margin = new System.Windows.Forms.Padding(2); this.MaximizeBox = false; this.MinimizeBox = false; this.MinimumSize = new System.Drawing.Size(920, 620); diff --git a/RetailCoder.VBE/UI/Settings/SettingsForm.resx b/RetailCoder.VBE/UI/Settings/SettingsForm.resx index d3a1a2980d..0a0a5023e2 100644 --- a/RetailCoder.VBE/UI/Settings/SettingsForm.resx +++ b/RetailCoder.VBE/UI/Settings/SettingsForm.resx @@ -120,23 +120,26 @@ - AAABAAEAEA4AAAEAIADgAwAAFgAAACgAAAAQAAAAHAAAAAEAIAAAAAAAuAMAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAB4AAABxAAEBtQEYGOMCLCz3AzEx/AIhIewABwfFAAAAiQAAADYAAAABAAAAAAAA - AAAAAAAAAAAAAQAAAJIDODj5CJqa/wzh4f8O/f3/Dv///w7///8O////De/v/wq0tP8ES0v/AAAAewAA - AAAAAAAAAAAAAAAAAEcFWlr/Dv///w7///8O////Dv///w7///8O////Dv///w7///8O////Dvv7/wMw - MPkAAAAgAAAAAAAAAAAAAQGpC8zM/w7///8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8JoKD/AAAAfAAAAAAAAAAAARMT4g78/P8O////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////DNzc/wAAALAAAAAAAAAAAAImJvcO////Dv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w3o6P8AAAC8AAAAAAAAAAACHh7vDv///w7///8O////Dv///w7///8O////Dv///w7/ - //8O////Dv///w7///8LxMT/AAAAngAAAAAAAAAAAAQExg3o6P8O////Dv///wmnp/8GZ2f/B3l5/wZ1 - df8Kr6//Dv///w7///8O////Bmxs/wAAAFIAAAAAAAAAAAAAAGwHgoL/Dv///wq+vv8BDAzTAAAAOQAA - AE8BDQ3yDNLS/w7///8O////Dv///wZlZf8AABS4AAAPgQAAAA0AAAAIAQwM1AVjY/8ABwfEAAAAGAAA - AAAAAABNBnJy/w7///8O////Dv///w7///8N5ub/AAM+/wAA4P8AAC62AAAAAAAAACAAAABLAAAAAgAA - AAAAAAAAAAAAaAiUlP8O////Dv///wvKyv8Lvr7/Dvv7/wEQMf8AAP//AACF/wAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAADkFV1f/Dv///w7///8HdHT/Blxc/wvMzP8AAAXWAAAoogAAF58AAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAEBrwiQkP8O+/v/Dv///wzY2P8CLCz1AAAAMQAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAACHARkZ4wIpKfQABga8AAAANgAAAAAAAAAAAAAAAMAH - AAAABwAAAAMAAAADAAAAAwAAAAMAAAADAAAAAwAAAAAAAAQAAACMAAAA/AAAAP4DAAD+BwAA + AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAEAAAAAAAAABwAAAAgAAAAGAAAABwAAAAgAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAABAwNEAAAA/zpkZP8uXmP/LGBl/y9hY/80ZGP/OWlo/0t2dP8AAAD/AAAAxwEC + AogAAAAAAAAAAAAAAAAAAQGTCicr/zTk+f9U3v//RtX//0rV//9P3f//Ve3//y/p//855/v/Qv3//1T/ + //8MLS/+AAAA0QAAAAAAAQGRBBMW/zXn/f846v//SNz9/0jL/v8xvv//OMv//0DU//8/3v3/L+j//zTo + //8r4/z/Svr//0mAf/4BAgKIISko/ynQ5v8x6P//Men//y7Z7v9ApLn/LrH4/y+y9f84vfT/K57K/y/l + +v8x5///L+j//0v2//+M////AAAAihIsLf8w7f//MOr//zXq//8x6f//JK6+/yeIp/8gZoL/LYyq/ynF + 2f8w5/7/MOj//zTq//9K9P//g////wAAAJUAAADSROX//1LK//9E5f//OO7//zLr//8w4ff/L+X7/y/j + +v8x6P//N+z//zHo//8s5v//gv3//7j///4AAACcAAAAlD+Cof87c4z/RGNj/zRdY/8xoK7+LfX//xrm + //8c2v//IeD//zDx//9G+P//Vvr//9z///8kKir/AAAAAAAAAFYAAABtAAAAGgAAAAgAAAALAAAA2yTb + +v8Y0f//HNr//xzf//8z+///Yv///2y8vP4qMjL/BAUFMwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA3Cac + r/8t0/7/Icn//x7Y//8o+P7/Sv///wAAAP8AAACgAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAEwwh + I/873P//JMj//xS8//8Wyv//Gpi2/wIADv8LCgC5AAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + ACUqYWT/Mtb//xy6//8Gt/7/Htr//xlhbP8fRvX/O1Hs/jlCctsAAAADAAAAAAAAAAAAAAAAAAAAAAAA + AAAAAAAaSGpo/0vZ//4Zs///n+z//wAAAP9FVFz/E0Gh/z1G//9AS2j/AAAAAwAAAAAAAAAAAAAAAAAA + AAAAAAAAAAAABAAAAKiS8/7MOr3//pLc/v/v////Pmxs/zBBPcIAAAD/ISEv/wAAAAQAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAABNAAAAtqXk8shM0v//Ppac/wAAAP8AAAA2AAAAAAAAAAcAAAABAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA0AAACfAAAAlAAAAIAAAAA3AAAAAQAAAAAAAAAAAAAAAAAA + AAAAAAAA//8AAOADAACAAQAAAAAAAAAAAAAAAAAAAAAAAAABAAD4AwAA8AcAAPAPAADwBwAA8AcAAPAH + AAD4PwAA/H8AAA== \ No newline at end of file diff --git a/RetailCoder.VBE/UI/SourceControl/BranchesViewViewModel.cs b/RetailCoder.VBE/UI/SourceControl/BranchesViewViewModel.cs index edd8c25155..28e620ac92 100644 --- a/RetailCoder.VBE/UI/SourceControl/BranchesViewViewModel.cs +++ b/RetailCoder.VBE/UI/SourceControl/BranchesViewViewModel.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.RegularExpressions; using NLog; using Rubberduck.SourceControl; using Rubberduck.UI.Command; @@ -219,45 +220,12 @@ public string NewBranchName } } - public bool IsNotValidBranchName - { - get { return !IsValidBranchName(NewBranchName); } - } + // Courtesy of http://stackoverflow.com/a/12093994/4088852 - Assumes --allow-onelevel is set TODO: Verify provider honor that. + private static readonly Regex ValidBranchNameRegex = new Regex(@"^(?!@$|build-|/|.*([/.]\.|//|@\{|\\))[^\u0000-\u0037\u0177 ~^:?*[]+/?[^\u0000-\u0037\u0177 ~^:?*[]+(? _configService; private readonly IMessageBox _messageBox; + private readonly IEnvironmentProvider _environment; private readonly FileSystemWatcher _fileSystemWatcher; private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly IEnumerable VbFileExtensions = new[] { "cls", "bas", "frm" }; @@ -49,7 +52,8 @@ public SourceControlViewViewModel( IFolderBrowserFactory folderBrowserFactory, IConfigProvider configService, IEnumerable views, - IMessageBox messageBox) + IMessageBox messageBox, + IEnvironmentProvider environment) { _vbe = vbe; _state = state; @@ -61,6 +65,7 @@ public SourceControlViewViewModel( _configService = configService; _config = _configService.Create(); _messageBox = messageBox; + _environment = environment; _initRepoCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => InitRepo(), _ => _vbe.VBProjects.Count != 0); _openRepoCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), _ => OpenRepo(), _ => _vbe.VBProjects.Count != 0); @@ -129,7 +134,7 @@ private void ComponentAdded(object sender, ComponentEventArgs e) } Logger.Trace("Component {0} added", e.Component.Name); - var fileStatus = Provider.Status().SingleOrDefault(stat => stat.FilePath.Split('.')[0] == e.Component.Name); + var fileStatus = Provider.Status().SingleOrDefault(stat => Path.GetFileNameWithoutExtension(stat.FilePath) == e.Component.Name); if (fileStatus != null) { Provider.AddFile(fileStatus.FilePath); @@ -146,7 +151,7 @@ private void ComponentRemoved(object sender, ComponentEventArgs e) } Logger.Trace("Component {0] removed", e.Component.Name); - var fileStatus = Provider.Status().SingleOrDefault(stat => stat.FilePath.Split('.')[0] == e.Component.Name); + var fileStatus = Provider.Status().SingleOrDefault(stat => Path.GetFileNameWithoutExtension(stat.FilePath) == e.Component.Name); if (fileStatus != null) { Provider.RemoveFile(fileStatus.FilePath, true); @@ -163,16 +168,14 @@ private void ComponentRenamed(object sender, ComponentRenamedEventArgs e) } Logger.Trace("Component {0} renamed to {1}", e.OldName, e.Component.Name); - var fileStatus = Provider.LastKnownStatus().SingleOrDefault(stat => stat.FilePath.Split('.')[0] == e.OldName); + var fileStatus = Provider.LastKnownStatus().SingleOrDefault(stat => Path.GetFileNameWithoutExtension(stat.FilePath) == e.OldName); if (fileStatus != null) { var directory = Provider.CurrentRepository.LocalLocation; - directory += directory.EndsWith("\\") ? string.Empty : "\\"; - - var fileExt = "." + fileStatus.FilePath.Split('.').Last(); + var fileExt = "." + Path.GetExtension(fileStatus.FilePath); _fileSystemWatcher.EnableRaisingEvents = false; - File.Move(directory + fileStatus.FilePath, directory + e.Component.Name + fileExt); + File.Move(Path.Combine(directory, fileStatus.FilePath), Path.Combine(directory, e.Component.Name + fileExt)); _fileSystemWatcher.EnableRaisingEvents = true; Provider.RemoveFile(e.OldName + fileExt, false); @@ -260,7 +263,7 @@ public ISourceControlProvider Provider private void _fileSystemWatcher_Changed(object sender, FileSystemEventArgs e) { // the file system filter doesn't support multiple filters - if (!VbFileExtensions.Contains(e.Name.Split('.').Last())) + if (!VbFileExtensions.Contains(Path.GetExtension(e.Name))) { return; } @@ -282,7 +285,7 @@ private void _fileSystemWatcher_Changed(object sender, FileSystemEventArgs e) private void _fileSystemWatcher_Renamed(object sender, RenamedEventArgs e) { // the file system filter doesn't support multiple filters - if (!VbFileExtensions.Contains(e.Name.Split('.').Last())) + if (!VbFileExtensions.Contains(Path.GetExtension(e.Name))) { return; } @@ -327,7 +330,7 @@ private void _fileSystemWatcher_Deleted(object sender, FileSystemEventArgs e) private void _fileSystemWatcher_Created(object sender, FileSystemEventArgs e) { // the file system filter doesn't support multiple filters - if (!VbFileExtensions.Contains(e.Name.Split('.').Last())) + if (!VbFileExtensions.Contains(Path.GetExtension(e.Name))) { return; } @@ -429,6 +432,8 @@ public bool DisplayPublishRepoGrid } } + private static readonly Regex LocalFileSystemOrNetworkPathRegex = new Regex(@"^([A-Z]:|\\).*"); + private string _cloneRemotePath; public string CloneRemotePath { @@ -438,11 +443,8 @@ public string CloneRemotePath if (_cloneRemotePath != value) { _cloneRemotePath = value; - LocalDirectory = - _config.DefaultRepositoryLocation + - (_config.DefaultRepositoryLocation.EndsWith("\\") ? string.Empty : "\\") + - _cloneRemotePath.Split('/').Last().Replace(".git", string.Empty); - + var delimiter = LocalFileSystemOrNetworkPathRegex.IsMatch(_cloneRemotePath) ? '\\' : '/'; + LocalDirectory = Path.Combine(_config.DefaultRepositoryLocation, _cloneRemotePath.Split(delimiter).Last().Replace(".git", string.Empty)); OnPropertyChanged(); OnPropertyChanged("IsNotValidCloneRemotePath"); } @@ -535,7 +537,7 @@ public BitmapImage ErrorIcon get { return _errorIcon; } set { - if (_errorIcon != value) + if (!Equals(_errorIcon, value)) { _errorIcon = value; OnPropertyChanged(); @@ -628,7 +630,7 @@ public void CreateProviderWithCredentials(SecureCredentials credentials) private void InitRepo() { - using (var folderPicker = _folderBrowserFactory.CreateFolderBrowser((RubberduckUI.SourceControl_CreateNewRepo))) + using (var folderPicker = _folderBrowserFactory.CreateFolderBrowser(RubberduckUI.SourceControl_CreateNewRepo, false, GetDefaultRepoFolderOrDefault())) { if (folderPicker.ShowDialog() != DialogResult.OK) { @@ -708,7 +710,7 @@ private void AddOrUpdateLocalPathConfig(Repository repo) private void OpenRepo() { - using (var folderPicker = _folderBrowserFactory.CreateFolderBrowser(RubberduckUI.SourceControl_OpenWorkingDirectory, false)) + using (var folderPicker = _folderBrowserFactory.CreateFolderBrowser(RubberduckUI.SourceControl_OpenWorkingDirectory, false, GetDefaultRepoFolderOrDefault())) { if (folderPicker.ShowDialog() != DialogResult.OK) { @@ -746,7 +748,7 @@ private void OpenRepo() } } - private bool _isCloning = false; + private bool _isCloning; private void CloneRepo(SecureCredentials credentials = null) { _isCloning = true; @@ -769,7 +771,7 @@ private void CloneRepo(SecureCredentials credentials = null) catch (SourceControlException ex) { const string unauthorizedMessage = "Request failed with status code: 401"; - if (ex.InnerException.Message != unauthorizedMessage) + if (ex.InnerException != null && ex.InnerException.Message != unauthorizedMessage) { _isCloning = false; } @@ -942,9 +944,27 @@ private bool ValidRepoExists() return false; } + private string GetDefaultRepoFolderOrDefault() + { + var settings = _configService.Create(); + var folder = settings.DefaultRepositoryLocation; + if (string.IsNullOrEmpty(folder)) + { + try + { + folder = _environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); + } + catch + { + // ignored - empty is fine if the environment call fails. + } + } + return folder; + } + private void ShowFilePicker() { - using (var folderPicker = _folderBrowserFactory.CreateFolderBrowser("Default Repository Directory")) + using (var folderPicker = _folderBrowserFactory.CreateFolderBrowser("Default Repository Directory", true, GetDefaultRepoFolderOrDefault())) { if (folderPicker.ShowDialog() == DialogResult.OK) { diff --git a/Rubberduck.Parsing/Symbols/DeclarationFinder.cs b/Rubberduck.Parsing/Symbols/DeclarationFinder.cs index c5f927dcdb..7da0ee93f9 100644 --- a/Rubberduck.Parsing/Symbols/DeclarationFinder.cs +++ b/Rubberduck.Parsing/Symbols/DeclarationFinder.cs @@ -98,15 +98,23 @@ public DeclarationFinder(IReadOnlyList declarations, IEnumerable ParserRuleContextHelper.HasParent(reference.Context)) .Select(reference => new { IdentifierReference = reference, Context = ParserRuleContextHelper.GetParent(reference.Context)})); - var interfaceMembers = implementsInstructions.Select(item => new + var interfaceModules = implementsInstructions.Select(item => item.IdentifierReference.Declaration).Distinct(); + + var interfaceMembers = interfaceModules.Select(item => new { - InterfaceModule = item.IdentifierReference.Declaration, - InterfaceMembers = _declarations[item.IdentifierReference.Declaration.QualifiedName.QualifiedModuleName] - .Where(member => member.DeclarationType.HasFlag(DeclarationType.Member)) + InterfaceModule = item, + InterfaceMembers = _declarations[item.QualifiedName.QualifiedModuleName] + .Where(member => member.DeclarationType.HasFlag(DeclarationType.Member)) }); _interfaceMembers = new Lazy>(() => - new ConcurrentDictionary(interfaceMembers.ToDictionary(item => item.InterfaceModule, item => item.InterfaceMembers.ToArray())), true); + new ConcurrentDictionary( + interfaceMembers.ToDictionary( + item => item.InterfaceModule, + item => item.InterfaceMembers.ToArray() + ) + ) + , true); var implementingNames = new Lazy>(() => implementsInstructions.SelectMany(item => _declarations[item.IdentifierReference.Declaration.QualifiedName.QualifiedModuleName] @@ -133,7 +141,12 @@ public IEnumerable Undeclared public IEnumerable Members(Declaration module) { - return _declarations[module.QualifiedName.QualifiedModuleName]; + return Members(module.QualifiedName.QualifiedModuleName); + } + + public IEnumerable Members(QualifiedModuleName module) + { + return _declarations[module]; } private IEnumerable _nonBaseAsType; diff --git a/Rubberduck.Parsing/VBA/ModuleState.cs b/Rubberduck.Parsing/VBA/ModuleState.cs index 7e97c6b1d3..9773b718ab 100644 --- a/Rubberduck.Parsing/VBA/ModuleState.cs +++ b/Rubberduck.Parsing/VBA/ModuleState.cs @@ -6,6 +6,7 @@ using Antlr4.Runtime.Tree; using Rubberduck.Parsing.Annotations; using Rubberduck.Parsing.Symbols; +using Rubberduck.VBEditor; namespace Rubberduck.Parsing.VBA { @@ -20,6 +21,8 @@ public class ModuleState public List Annotations { get; private set; } public SyntaxErrorException ModuleException { get; private set; } public IDictionary, Attributes> ModuleAttributes { get; private set; } + public ConcurrentDictionary HasReferenceToModule { get; private set; } + public HashSet IsReferencedByModule { get; private set; } public bool IsNew { get; private set; } @@ -43,6 +46,8 @@ public ModuleState(ConcurrentDictionary declarations) Annotations = new List(); ModuleException = null; ModuleAttributes = new Dictionary, Attributes>(); + HasReferenceToModule = new ConcurrentDictionary(); + IsReferencedByModule = new HashSet(); IsNew = true; } @@ -58,6 +63,8 @@ public ModuleState(ParserState state) Annotations = new List(); ModuleException = null; ModuleAttributes = new Dictionary, Attributes>(); + HasReferenceToModule = new ConcurrentDictionary(); + IsReferencedByModule = new HashSet(); IsNew = true; } @@ -73,6 +80,8 @@ public ModuleState(SyntaxErrorException moduleException) Annotations = new List(); ModuleException = moduleException; ModuleAttributes = new Dictionary, Attributes>(); + HasReferenceToModule = new ConcurrentDictionary(); + IsReferencedByModule = new HashSet(); IsNew = true; } @@ -88,6 +97,8 @@ public ModuleState(IDictionary, Attributes> modul Annotations = new List(); ModuleException = null; ModuleAttributes = moduleAttributes; + HasReferenceToModule = new ConcurrentDictionary(); + IsReferencedByModule = new HashSet(); IsNew = true; } @@ -141,6 +152,17 @@ public ModuleState SetModuleAttributes(IDictionary(); + } + + public void RefreshIsReferencedByModule() + { + IsReferencedByModule = new HashSet(); + } + + private bool _isDisposed; public void Dispose() { diff --git a/Rubberduck.Parsing/VBA/ParseCoordinator.cs b/Rubberduck.Parsing/VBA/ParseCoordinator.cs index a41ee656fa..22109be3ac 100644 --- a/Rubberduck.Parsing/VBA/ParseCoordinator.cs +++ b/Rubberduck.Parsing/VBA/ParseCoordinator.cs @@ -215,7 +215,9 @@ private void ExecuteCommonParseActivities(List toParse, Cancellati token.ThrowIfCancellationRequested(); _projectDeclarations.Clear(); - State.ClearBuiltInReferences(); + State.ClearAllReferences(); + + ClearModuleToModuleReferences(toParse); ParseComponents(toParse, token); @@ -268,6 +270,14 @@ private void SetModuleStates(List components, ParserState parserSt } } + private void ClearModuleToModuleReferences(List toClear) + { + foreach (var component in toClear) + { + State.ClearModuleToModuleReferencesFromModule(new QualifiedModuleName(component)); + } + } + private void ParseComponents(List components, CancellationToken token) { token.ThrowIfCancellationRequested(); @@ -496,6 +506,10 @@ private void ResolveAllReferences(CancellationToken token) token.ThrowIfCancellationRequested(); + AddModuleToModuleReferences(State.DeclarationFinder, token); + + token.ThrowIfCancellationRequested(); + AddUndeclaredVariablesToDeclarations(); //This is here and not in the calling method because it has to happen before the ready state is reached. @@ -555,6 +569,41 @@ private void ResolveReferences(DeclarationFinder finder, QualifiedModuleName qua } } + private void AddModuleToModuleReferences(DeclarationFinder finder, CancellationToken token) + { + var options = new ParallelOptions(); + options.CancellationToken = token; + options.MaxDegreeOfParallelism = _maxDegreeOfReferenceResolverParallelism; + try + { + Parallel.For(0, State.ParseTrees.Count, options, + (index) => AddModuleToModuleReferences(finder, State.ParseTrees[index].Key) + ); + } + catch (AggregateException exception) + { + if (exception.Flatten().InnerExceptions.All(ex => ex is OperationCanceledException)) + { + throw exception.InnerException; //This eliminates the stack trace, but for the cancellation, this is irrelevant. + } + State.SetStatusAndFireStateChanged(this, ParserState.ResolverError); + throw; + } + } + + private void AddModuleToModuleReferences(DeclarationFinder finder, QualifiedModuleName referencedModule) + { + var referencingModules = finder.Members(referencedModule) + .SelectMany(declaration => declaration.References) + .Select(reference => reference.QualifiedModuleName) + .Distinct() + .Where(referencingModule => !referencedModule.Equals(referencingModule)); + foreach (var referencingModule in referencingModules) + { + State.AddModuleToModuleReference(referencedModule, referencingModule); + } + } + private void AddUndeclaredVariablesToDeclarations() { var undeclared = State.DeclarationFinder.Undeclared.ToList(); @@ -612,7 +661,7 @@ private void ParseAllInternal(object requestor, CancellationToken token) token.ThrowIfCancellationRequested(); - var componentsRemoved = ClearStateCashForRemovedComponents(components); + var componentsRemoved = CleanUpRemovedComponents(components); token.ThrowIfCancellationRequested(); @@ -642,15 +691,16 @@ private void ParseAllInternal(object requestor, CancellationToken token) } /// - /// Clears state cach for removed components. + /// Clears state cache of removed components. /// Returns whether components have been removed. /// - private bool ClearStateCashForRemovedComponents(List components) + private bool CleanUpRemovedComponents(List components) { var removedModuledecalrations = RemovedModuleDeclarations(components); var componentRemoved = removedModuledecalrations.Any(); foreach (var declaration in removedModuledecalrations) { + State.ClearModuleToModuleReferencesFromModule(declaration.QualifiedName.QualifiedModuleName); State.ClearStateCache(declaration.QualifiedName.QualifiedModuleName); } return componentRemoved; diff --git a/Rubberduck.Parsing/VBA/RubberduckParserState.cs b/Rubberduck.Parsing/VBA/RubberduckParserState.cs index c4c8cd2af6..d5501d5ba4 100644 --- a/Rubberduck.Parsing/VBA/RubberduckParserState.cs +++ b/Rubberduck.Parsing/VBA/RubberduckParserState.cs @@ -303,8 +303,9 @@ public IReadOnlyList> ModuleExceptions private void OnStateChanged(object requestor, ParserState state = ParserState.Pending) { var handler = StateChanged; + Logger.Debug("RubberduckParserState raised StateChanged ({0})", Status); if (handler != null) - { + { handler.Invoke(requestor, new ParserStateEventArgs(state)); } } @@ -742,6 +743,14 @@ public void ClearBuiltInReferences() } } + public void ClearAllReferences() + { + foreach (var declaration in AllDeclarations) + { + declaration.ClearReferences(); + } + } + public bool ClearStateCache(IVBComponent component, bool notifyStateChanged = false) { return component != null && ClearStateCache(new QualifiedModuleName(component), notifyStateChanged); @@ -1082,6 +1091,62 @@ public void RemoveBuiltInDeclarations(IReference reference) } } + public void AddModuleToModuleReference(QualifiedModuleName referencedModule, QualifiedModuleName referencingModule) + { + ModuleState referencedModuleState; + ModuleState referencingModuleState; + if (!_moduleStates.TryGetValue(referencedModule, out referencedModuleState) || !_moduleStates.TryGetValue(referencingModule, out referencingModuleState)) + { + return; + } + if (referencedModuleState.IsReferencedByModule.Contains(referencingModule)) + { + return; + } + referencedModuleState.IsReferencedByModule.Add(referencingModule); + referencingModuleState.HasReferenceToModule.AddOrUpdate(referencedModule, 1, (key, value) => value); + } + + public void ClearModuleToModuleReferencesFromModule(QualifiedModuleName referencingModule) + { + ModuleState referencingModuleState; + if (!_moduleStates.TryGetValue(referencingModule, out referencingModuleState)) + { + return; + } + + ModuleState referencedModuleState; + foreach (var referencedModule in referencingModuleState.HasReferenceToModule.Keys) + { + if (!_moduleStates.TryGetValue(referencedModule,out referencedModuleState)) + { + continue; + } + referencedModuleState.IsReferencedByModule.Remove(referencingModule); + } + referencingModuleState.RefreshHasReferenceToModule(); + } + + public HashSet ModulesReferencedBy(QualifiedModuleName referencingModule) + { + ModuleState referencingModuleState; + if (!_moduleStates.TryGetValue(referencingModule, out referencingModuleState)) + { + return new HashSet(); + } + return new HashSet(referencingModuleState.HasReferenceToModule.Keys); + } + + public HashSet ModulesReferencing(QualifiedModuleName referencedModule) + { + ModuleState referencedModuleState; + if (!_moduleStates.TryGetValue(referencedModule, out referencedModuleState)) + { + return new HashSet(); + } + return new HashSet(referencedModuleState.IsReferencedByModule); + } + private bool _isDisposed; public void Dispose() diff --git a/Rubberduck.VBEEditor/Events/VBENativeServices.cs b/Rubberduck.VBEEditor/Events/VBENativeServices.cs index a3e75fcaa2..5f03b3a159 100644 --- a/Rubberduck.VBEEditor/Events/VBENativeServices.cs +++ b/Rubberduck.VBEEditor/Events/VBENativeServices.cs @@ -60,6 +60,8 @@ public static void UnhookEvents() info.Subclass.FocusChange -= FocusDispatcher; info.Subclass.Dispose(); } + SafeComWrappers.VBA.VBProjects.DetatchEvents(); + SafeComWrappers.VBA.VBComponents.DetatchEvents(); } } diff --git a/Rubberduck.VBEEditor/SafeComWrappers/VBA/VBComponents.cs b/Rubberduck.VBEEditor/SafeComWrappers/VBA/VBComponents.cs index 638ca53818..cd655b5511 100644 --- a/Rubberduck.VBEEditor/SafeComWrappers/VBA/VBComponents.cs +++ b/Rubberduck.VBEEditor/SafeComWrappers/VBA/VBComponents.cs @@ -1,6 +1,5 @@ using System; using System.Collections; -using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; @@ -15,8 +14,8 @@ namespace Rubberduck.VBEditor.SafeComWrappers.VBA public class VBComponents : SafeComWrapper, IVBComponents { private static readonly Guid VBComponentsEventsGuid = new Guid("0002E116-0000-0000-C000-000000000046"); - private static HashSet _handlers = new HashSet(); private static object _lockObject = new object(); + private static VB.VBComponents _components; private enum ComponentEventDispId { @@ -30,7 +29,10 @@ private enum ComponentEventDispId public VBComponents(VB.VBComponents target) : base(target) { - AttachEvents(Target); + if (_components == null) + { + AttachEvents(target); + } } public int Count @@ -98,8 +100,7 @@ IEnumerator IEnumerable.GetEnumerator() public override void Release(bool final = false) { if (!IsWrappingNullReference) - { - DetatchEvents(Target); + { for (var i = 1; i <= Count; i++) { this[i].Release(); @@ -199,38 +200,38 @@ private static void AttachEvents(VB.VBComponents components) { lock (_lockObject) { - if (components != null && !_handlers.Contains(components)) + if (_components == null) { + _components = components; _componentAdded = OnComponentAdded; _componentRemoved = OnComponentRemoved; _componentRenamed = OnComponentRenamed; _componentSelected = OnComponentSelected; _componentActivated = OnComponentActivated; _componentReloaded = OnComponentReloaded; - ComEventsHelper.Combine(components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemAdded, _componentAdded); - ComEventsHelper.Combine(components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemRemoved, _componentRemoved); - ComEventsHelper.Combine(components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemRenamed, _componentRenamed); - ComEventsHelper.Combine(components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemSelected, _componentSelected); - ComEventsHelper.Combine(components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemActivated, _componentActivated); - ComEventsHelper.Combine(components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemReloaded, _componentReloaded); - _handlers.Add(components); + ComEventsHelper.Combine(_components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemAdded, _componentAdded); + ComEventsHelper.Combine(_components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemRemoved, _componentRemoved); + ComEventsHelper.Combine(_components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemRenamed, _componentRenamed); + ComEventsHelper.Combine(_components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemSelected, _componentSelected); + ComEventsHelper.Combine(_components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemActivated, _componentActivated); + ComEventsHelper.Combine(_components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemReloaded, _componentReloaded); } } } - private static void DetatchEvents(VB.VBComponents components) + internal static void DetatchEvents() { lock (_lockObject) { - if (components != null && _handlers.Contains(components)) + if (_components != null) { - ComEventsHelper.Remove(components, VBComponentsEventsGuid, (int) ComponentEventDispId.ItemAdded, _componentAdded); - ComEventsHelper.Remove(components, VBComponentsEventsGuid, (int) ComponentEventDispId.ItemRemoved, _componentRemoved); - ComEventsHelper.Remove(components, VBComponentsEventsGuid, (int) ComponentEventDispId.ItemRenamed, _componentRenamed); - ComEventsHelper.Remove(components, VBComponentsEventsGuid, (int) ComponentEventDispId.ItemSelected, _componentSelected); - ComEventsHelper.Remove(components, VBComponentsEventsGuid, (int) ComponentEventDispId.ItemActivated, _componentActivated); - ComEventsHelper.Remove(components, VBComponentsEventsGuid, (int) ComponentEventDispId.ItemReloaded, _componentReloaded); - _handlers.Remove(components); + ComEventsHelper.Remove(_components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemAdded, _componentAdded); + ComEventsHelper.Remove(_components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemRemoved, _componentRemoved); + ComEventsHelper.Remove(_components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemRenamed, _componentRenamed); + ComEventsHelper.Remove(_components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemSelected, _componentSelected); + ComEventsHelper.Remove(_components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemActivated, _componentActivated); + ComEventsHelper.Remove(_components, VBComponentsEventsGuid, (int)ComponentEventDispId.ItemReloaded, _componentReloaded); + _components = null; } } } @@ -261,7 +262,10 @@ private static void OnComponentRenamed(VB.VBComponent vbComponent, string oldNam { var component = new VBComponent(vbComponent); var project = component.Collection.Parent; - handler.Invoke(component, new ComponentRenamedEventArgs(project.ProjectId, project, new VBComponent(vbComponent), oldName)); + if (project.Protection != ProjectProtection.Locked) + { + handler.Invoke(component, new ComponentRenamedEventArgs(project.ProjectId, project, new VBComponent(vbComponent), oldName)); + } } } @@ -296,7 +300,10 @@ private static void OnDispatch(EventHandler dispatched, VB.V { var component = new VBComponent(vbComponent); var project = component.Collection.Parent; - handler.Invoke(component, new ComponentEventArgs(project.ProjectId, project, component)); + if (project.Protection != ProjectProtection.Locked) + { + handler.Invoke(component, new ComponentEventArgs(project.ProjectId, project, component)); + } } } diff --git a/Rubberduck.VBEEditor/SafeComWrappers/VBA/VBProjects.cs b/Rubberduck.VBEEditor/SafeComWrappers/VBA/VBProjects.cs index dfeae049c9..ea49af5661 100644 --- a/Rubberduck.VBEEditor/SafeComWrappers/VBA/VBProjects.cs +++ b/Rubberduck.VBEEditor/SafeComWrappers/VBA/VBProjects.cs @@ -84,7 +84,6 @@ public override void Release(bool final = false) { if (!IsWrappingNullReference) { - DetatchEvents(); for (var i = 1; i <= Count; i++) { this[i].Release(); @@ -111,10 +110,9 @@ public override int GetHashCode() #region Events - private static bool _eventsAttached; private static void AttachEvents() { - if (!_eventsAttached) + if (_projects != null) { _projectAdded = OnProjectAdded; _projectRemoved = OnProjectRemoved; @@ -124,19 +122,18 @@ private static void AttachEvents() ComEventsHelper.Combine(_projects, VBProjectsEventsGuid, (int)ProjectEventDispId.ItemRemoved, _projectRemoved); ComEventsHelper.Combine(_projects, VBProjectsEventsGuid, (int)ProjectEventDispId.ItemRenamed, _projectRenamed); ComEventsHelper.Combine(_projects, VBProjectsEventsGuid, (int)ProjectEventDispId.ItemActivated, _projectActivated); - _eventsAttached = true; } } - private static void DetatchEvents() + internal static void DetatchEvents() { - if (!_eventsAttached && _projects != null) + if (_projects != null) { ComEventsHelper.Remove(_projects, VBProjectsEventsGuid, (int)ProjectEventDispId.ItemAdded, _projectAdded); ComEventsHelper.Remove(_projects, VBProjectsEventsGuid, (int)ProjectEventDispId.ItemRemoved, _projectRemoved); ComEventsHelper.Remove(_projects, VBProjectsEventsGuid, (int)ProjectEventDispId.ItemRenamed, _projectRenamed); ComEventsHelper.Remove(_projects, VBProjectsEventsGuid, (int)ProjectEventDispId.ItemActivated, _projectActivated); - _eventsAttached = false; + _projects = null; } } @@ -145,7 +142,10 @@ private static void DetatchEvents() private static ItemAddedDelegate _projectAdded; private static void OnProjectAdded(VB.VBProject vbProject) { - if (IsInDesignMode()) OnDispatch(ProjectAdded, vbProject, true); + if (IsInDesignMode() && vbProject.Protection == VB.vbext_ProjectProtection.vbext_pp_none) + { + OnDispatch(ProjectAdded, vbProject, true); + } } public static event EventHandler ProjectRemoved; @@ -153,7 +153,10 @@ private static void OnProjectAdded(VB.VBProject vbProject) private static ItemRemovedDelegate _projectRemoved; private static void OnProjectRemoved(VB.VBProject vbProject) { - if (IsInDesignMode()) OnDispatch(ProjectRemoved, vbProject); + if (IsInDesignMode() && vbProject.Protection == VB.vbext_ProjectProtection.vbext_pp_none) + { + OnDispatch(ProjectRemoved, vbProject); + } } public static event EventHandler ProjectRenamed; @@ -161,15 +164,18 @@ private static void OnProjectRemoved(VB.VBProject vbProject) private static ItemRenamedDelegate _projectRenamed; private static void OnProjectRenamed(VB.VBProject vbProject, string oldName) { - if (!IsInDesignMode()) { return; } + if (!IsInDesignMode() || vbProject.Protection == VB.vbext_ProjectProtection.vbext_pp_locked) + { + return; + } var project = new VBProject(vbProject); var projectId = project.ProjectId; var handler = ProjectRenamed; - if (handler != null) + if (handler != null && projectId != null) { - handler(project, new ProjectRenamedEventArgs(projectId, project, oldName)); + handler.Invoke(project, new ProjectRenamedEventArgs(projectId, project, oldName)); } } @@ -178,13 +184,16 @@ private static void OnProjectRenamed(VB.VBProject vbProject, string oldName) private static ItemActivatedDelegate _projectActivated; private static void OnProjectActivated(VB.VBProject vbProject) { - if (IsInDesignMode()) OnDispatch(ProjectActivated, vbProject); + if (IsInDesignMode() && vbProject.Protection == VB.vbext_ProjectProtection.vbext_pp_none) + { + OnDispatch(ProjectActivated, vbProject); + } } private static void OnDispatch(EventHandler dispatched, VB.VBProject vbProject, bool assignId = false) { var handler = dispatched; - if (handler != null) + if (handler != null && vbProject.Protection != VB.vbext_ProjectProtection.vbext_pp_locked) { var project = new VBProject(vbProject); if (assignId) @@ -192,7 +201,10 @@ private static void OnDispatch(EventHandler dispatched, VB.VBP project.AssignProjectId(); } var projectId = project.ProjectId; - handler.Invoke(project, new ProjectEventArgs(projectId, project)); + if (projectId != null) + { + handler.Invoke(project, new ProjectEventArgs(projectId, project)); + } } } @@ -201,7 +213,10 @@ private static bool IsInDesignMode() if (_projects == null) return true; foreach (var project in _projects.Cast()) { - if (project.Mode != VB.vbext_VBAMode.vbext_vm_Design) return false; + if (project.Mode != VB.vbext_VBAMode.vbext_vm_Design) + { + return false; + } } return true; } diff --git a/RubberduckTests/Refactoring/EncapsulateFieldTests.cs b/RubberduckTests/Refactoring/EncapsulateFieldTests.cs index 2b22efc08c..0c52c9da25 100644 --- a/RubberduckTests/Refactoring/EncapsulateFieldTests.cs +++ b/RubberduckTests/Refactoring/EncapsulateFieldTests.cs @@ -460,7 +460,11 @@ public void EncapsulatePublicField_FieldDeclarationHasMultipleFields_MoveFirst() Private fizz As Variant Public Property Get Name() As Variant - Set Name = fizz + If IsObject(fizz) Then + Set Name = fizz + Else + Name = fizz + End If End Property Public Property Let Name(ByVal value As Variant) @@ -502,9 +506,10 @@ End Property //Act var refactoring = new EncapsulateFieldRefactoring(vbe.Object, CreateIndenter(vbe.Object), factory.Object); refactoring.Refactor(qualifiedSelection); + var actual = module.Content(); //Assert - Assert.AreEqual(expectedCode, module.Content()); + Assert.AreEqual(expectedCode, actual); } [TestMethod] @@ -676,9 +681,10 @@ End Property //Act var refactoring = new EncapsulateFieldRefactoring(vbe.Object, CreateIndenter(vbe.Object), factory.Object); refactoring.Refactor(qualifiedSelection); + var actual = module.Content(); //Assert - Assert.AreEqual(expectedCode, module.Content()); + Assert.AreEqual(expectedCode, actual); } [TestMethod] @@ -1178,6 +1184,11 @@ public void Presenter_Accept_ReturnsModelWithCanImplementLetChanged() Assert.AreEqual(true, presenter.Show().CanImplementLet); } + //NOTE: The tests below are commented out pending some sort of refactoring that enables them + //to actually *test* something. Currently, all of the behavior the tests are looking for is + //being mocked. + + /* [TestMethod] public void Presenter_Accept_ReturnsModelWithImplementLetChanged() { @@ -1530,6 +1541,7 @@ Sub foo() Assert.AreEqual(true, view.Object.MustImplementSetSetterType); } + [TestMethod] public void Presenter_Accept_DefaultCreateGetOnly_PrimitiveType_NoReference() { @@ -1616,7 +1628,7 @@ public void Presenter_Accept_DefaultCreateGetOnly_Variant_NoReference() Assert.AreEqual(false, model.ImplementLetSetterType); Assert.AreEqual(false, model.ImplementSetSetterType); } - + */ #region setup private static Mock> SetupFactory(EncapsulateFieldModel model) { diff --git a/RubberduckTests/SourceControl/ChangesViewModelTests.cs b/RubberduckTests/SourceControl/ChangesViewModelTests.cs index 154cc205f3..54f8029ebc 100644 --- a/RubberduckTests/SourceControl/ChangesViewModelTests.cs +++ b/RubberduckTests/SourceControl/ChangesViewModelTests.cs @@ -342,7 +342,7 @@ public void Undo_UndoesChanges() Provider = _provider.Object }; - var localLocation = "C:\\users\\desktop\\git\\"; + var localLocation = @"C:\users\desktop\git\"; _provider.Setup(git => git.Status()).Returns(fileStatusEntries); _provider.SetupGet(git => git.CurrentRepository).Returns(new Repository{LocalLocation = localLocation}); @@ -351,7 +351,7 @@ public void Undo_UndoesChanges() vm.UndoChangesToolbarButtonCommand.Execute(fileStatusEntries[0]); //Assert - _provider.Verify(git => git.Undo(localLocation + fileStatusEntries[0].FilePath)); + _provider.Verify(git => git.Undo(@"C:\users\desktop\git\module.bas")); } [TestCategory("SourceControl")] diff --git a/RubberduckTests/SourceControl/SourceControlViewModelTests.cs b/RubberduckTests/SourceControl/SourceControlViewModelTests.cs index 0e303c8990..aef0416fcb 100644 --- a/RubberduckTests/SourceControl/SourceControlViewModelTests.cs +++ b/RubberduckTests/SourceControl/SourceControlViewModelTests.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Collections.ObjectModel; using System.Security; using System.Windows.Forms; @@ -10,7 +11,6 @@ using Rubberduck.UI; using Rubberduck.UI.SourceControl; using Rubberduck.VBEditor.Application; -using Rubberduck.VBEditor.Events; using Rubberduck.VBEditor.SafeComWrappers; using Rubberduck.VBEditor.SafeComWrappers.Abstract; using RubberduckTests.Mocks; @@ -60,7 +60,8 @@ public void InitializeMocks() _folderBrowser = new Mock(); _folderBrowserFactory = new Mock(); _folderBrowserFactory.Setup(f => f.CreateFolderBrowser(It.IsAny())).Returns(_folderBrowser.Object); - _folderBrowserFactory.Setup(f => f.CreateFolderBrowser(It.IsAny(), false)).Returns(_folderBrowser.Object); + _folderBrowserFactory.Setup(f => f.CreateFolderBrowser(It.IsAny(), It.IsAny())).Returns(_folderBrowser.Object); + _folderBrowserFactory.Setup(f => f.CreateFolderBrowser(It.IsAny(), It.IsAny(), It.IsAny())).Returns(_folderBrowser.Object); var masterRemote = new Mock(); @@ -121,7 +122,7 @@ private void SetupVM() }; _vm = new SourceControlViewViewModel(_vbe.Object, new RubberduckParserState(_vbe.Object), _providerFactory.Object, _folderBrowserFactory.Object, - _configService.Object, views, new Mock().Object); + _configService.Object, views, new Mock().Object, GetDummyEnvironment()); } [TestCategory("SourceControl")] @@ -1050,7 +1051,7 @@ public void NullProject_DisplaysError() private SourceControlSettings GetDummyConfig() { - return new SourceControlSettings("username", "username@email.com", string.Empty, + return new SourceControlSettings("username", "username@email.com", @"C:\path\to", new List { GetDummyRepo() }, "ps.exe"); } @@ -1063,5 +1064,12 @@ private static Repository GetDummyRepo() @"https://github.com/ckuhn203/SourceControlTest.git" ); } + + private static IEnvironmentProvider GetDummyEnvironment() + { + var environment = new Mock(); + environment.Setup(e => e.GetFolderPath(Environment.SpecialFolder.MyDocuments)).Returns(@"C:\Users\Christopher\Documents"); + return environment.Object; + } } }