Skip to content
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
MultiKeyGesture management in shortcut management add-in
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/shortcuts@4331 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
  • Loading branch information
sandrejev committed Jun 20, 2009
1 parent c30b0f3 commit 17374b1
Show file tree
Hide file tree
Showing 36 changed files with 911 additions and 370 deletions.
Binary file modified src/AddIns/Misc/ShortcutsManagement/ShortcutsManagement.suo
Binary file not shown.
Expand Up @@ -140,4 +140,31 @@
<data name="ShortcutsManagement.UnspecifiedCategoryName" xml:space="preserve">
<value>Uncategorized</value>
</data>
<data name="ShortcutsManagement.GestureTextBox.FirstChordIsIncomplete" xml:space="preserve">
<value>First chord must have a modifier</value>
</data>
<data name="ShortcutsManagement.GestureTextBox.GestureIsValid" xml:space="preserve">
<value>Valid gesture</value>
</data>
<data name="ShortcutsManagement.GestureTextBox.LastChordIsIncomplete" xml:space="preserve">
<value>Multi key gesture is not finished</value>
</data>
<data name="ShortcutsManagement.GestureTextBox.SequenceIsNotCoherent" xml:space="preserve">
<value>Invalid gesture. Sequence is not coherent.</value>
</data>
<data name="ShortcutsManagement.GestureTextBox.TimeExpired" xml:space="preserve">
<value>Time given for gesture entry expired</value>
</data>
<data name="ShortcutsManagement.ModificationWindow.AdditionFailedFirstChordIsIncomplete" xml:space="preserve">
<value>Failed to add a gesture. First chord should contain a modifier</value>
</data>
<data name="ShortcutsManagement.ModificationWindow.AdditionFailedLastChordIsIncompete" xml:space="preserve">
<value>Failed to add a gesture. Gesture is unfinished. Last chord should have a key</value>
</data>
<data name="ShortcutsManagement.ModificationWindow.AdditionFailedNoChords" xml:space="preserve">
<value>Failed to add a gesture. Gesture must have atleast one chord</value>
</data>
<data name="ShortcutsManagement.ModificationWindow.AdditionIsSuccessfull" xml:space="preserve">
<value>Gesture added</value>
</data>
</root>
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -14,6 +14,6 @@
<Path name = "/SharpDevelop/Dialogs/OptionsDialog/TextEditorOptions">
<OptionPanel id = "ShortcutsManagement"
label = "Shortcuts management"
class = "ICSharpCode.ShortcutsManagement.ShortcutsManagementOptionsPanel" />
class = "ICSharpCode.ShortcutsManagement.Dialogs.ShortcutsManagementOptionsPanel" />
</Path>
</AddIn>
Expand Up @@ -62,6 +62,8 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
Expand All @@ -88,6 +90,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Src\Dialogs\MultiKeyGestureTextBox.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Src\Dialogs\Resources.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -142,11 +148,14 @@
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="Src\Data\GestureFilterMode.cs" />
<Compile Include="Src\Data\IShortcutTreeEntry.cs" />
<Compile Include="Src\Data\KeyGestureTemplate.cs" />
<Compile Include="Src\Data\Shortcut.cs" />
<Compile Include="Src\Data\ShortcutCategory.cs" />
<Compile Include="Src\Data\ShortcutsFinder.cs" />
<Compile Include="Src\Dialogs\MultiKeyGestureTextBox.xaml.cs">
<DependentUpon>MultiKeyGestureTextBox.xaml</DependentUpon>
</Compile>
<Compile Include="Src\Dialogs\ShortcutManagementWindow.xaml.cs">
<DependentUpon>ShortcutManagementWindow.xaml</DependentUpon>
</Compile>
Expand All @@ -157,6 +166,7 @@
<Compile Include="Src\Dialogs\ShortcutsTreeView.xaml.cs">
<DependentUpon>ShortcutsTreeView.xaml</DependentUpon>
</Compile>
<Compile Include="Src\Extensions\PartialKeyGestureExtensions.cs" />
<Compile Include="Src\Extensions\TextBlockBehavior.cs" />
<Compile Include="Src\Extensions\TreeViewExtensions.cs" />
<Compile Include="Src\Converters\TypeNameConverter.cs" />
Expand All @@ -176,6 +186,13 @@
<Resource Include="Resources\add_correction_16x16.gif" />
<Resource Include="Resources\key_enter.png" />
<Resource Include="Resources\key_enter_pressed.png" />
<Resource Include="Resources\block_small.png" />
<Resource Include="Resources\delete_small.png" />
<Resource Include="Resources\info_small.png" />
<Resource Include="Resources\plus_small.png" />
<Resource Include="Resources\search_small.png" />
<Resource Include="Resources\tick_small.png" />
<Resource Include="Resources\warning_small.png" />
<Content Include="ShortcutsManagement.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down
Expand Up @@ -26,12 +26,12 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
return (bool)value ? "Visible" : hidden;
}

throw new NotImplementedException();
throw new NotSupportedException();
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
throw new NotSupportedException();
}
}
}
Expand Up @@ -31,7 +31,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
foreach (var gesture in (ObservableCollection<InputGesture>)value) {
inputGestureCollection.Add(gesture);
}
return new InputGestureCollectionConverter().ConvertToInvariantString(inputGestureCollection).Replace("|", " | ");
return new InputGestureCollectionConverter().ConvertToInvariantString(inputGestureCollection);
}

return value.ToString();
Expand Down
Expand Up @@ -2,6 +2,7 @@
using System.Globalization;
using System.Windows.Data;
using System.Windows.Input;
using ICSharpCode.Core.Presentation;

namespace ICSharpCode.ShortcutsManagement.Converters
{
Expand All @@ -20,6 +21,11 @@ public class InputGestureConverter : IValueConverter
/// <returns></returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is MultiKeyGesture && targetType == typeof(string))
{
return new MultiKeyGestureConverter().ConvertToInvariantString(value).Replace("+", " + ");
}

if(value is KeyGesture && targetType == typeof(string))
{
return new KeyGestureConverter().ConvertToInvariantString(value).Replace("+", " + ");
Expand Down
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel;

namespace ICSharpCode.ShortcutsManagement.Data
Expand Down Expand Up @@ -73,17 +72,6 @@ public AddIn(string addInName)
Categories = new List<ShortcutCategory>();
}

/// <summary>
/// Invoke dependency property changed event
/// </summary>
/// <param name="propertyName">Name of dependency property from this classs</param>
private void InvokePropertyChanged(string propertyName)
{
if (PropertyChanged != null) {
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}

/// <summary>
/// Find shortcut by shortcutId in add-in categories
/// </summary>
Expand Down Expand Up @@ -115,6 +103,9 @@ public object Clone()
return clonedAddIn;
}

/// <summary>
/// Sort add-in sub categories
/// </summary>
public void SortSubEntries()
{
Categories.Sort((a, b) => a.Name.CompareTo(b.Name));
Expand All @@ -129,12 +120,29 @@ public void SortSubEntries()
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;

/// <summary>
/// Compare add-in to other instances of <see cref="IShortcutTreeEntry"/>
/// </summary>
/// <param name="obj">Compared object</param>
/// <returns>Comparison result</returns>
public int CompareTo(object obj) {
if (obj is ShortcutCategory) return 1;
if (obj is Shortcut) return 1;

var addInObj = (AddIn)obj;
return Name.CompareTo(addInObj.Name);
}
}

/// <summary>
/// Invoke dependency property changed event
/// </summary>
/// <param name="propertyName">Name of dependency property from this classs</param>
private void InvokePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ICSharpCode.ShortcutsManagement.Data
{
/// <summary>
/// Gesture filtering mode
/// </summary>
public enum GestureFilterMode
{
/// <summary>
/// Match is successful if template gesture strictly matches compared gesture
/// </summary>
StrictlyMatches,

/// <summary>
/// Match is successfull if template gesture partly matches compared geture.
/// Template is found in any place within matched gesture
/// </summary>
PartlyMatches,

/// <summary>
/// match is successfull if matched gesture starts with provided template
/// </summary>
StartsWith
}
}
@@ -1,24 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ICSharpCode.ShortcutsManagement.Data
{
public interface IShortcutTreeEntry : IComparable, ICloneable
{
/// <summary>
/// Shortcut entry name displayed in shortcuts tree
/// </summary>
string Name
{
get; set;
}

/// <summary>
/// Specifies whether shortcut tree entry is visible
/// </summary>
bool IsVisible
{
get; set;
}

/// <summary>
/// Sort shortcut entry sub elements
/// </summary>
void SortSubEntries();

/// <summary>
/// Search for shortcut in this shortcut entry and sub-elements
/// </summary>
/// <param name="shortcutId"></param>
/// <returns></returns>
Shortcut FindShortcut(string shortcutId);
}
}

0 comments on commit 17374b1

Please sign in to comment.