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

Commit

Permalink
Clean up ShortcutManagement add-in
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/shortcuts@4640 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
  • Loading branch information
sandrejev committed Aug 10, 2009
1 parent 8aea02b commit b9a04c9
Show file tree
Hide file tree
Showing 32 changed files with 2,219 additions and 2,320 deletions.
12 changes: 0 additions & 12 deletions src/AddIns/Misc/ShortcutsManagement/ShortcutsManagement/App.xaml

This file was deleted.

This file was deleted.

Expand Up @@ -25,6 +25,8 @@
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<StartAction>Program</StartAction>
<StartProgram>..\..\..\..\..\bin\SharpDevelop.exe</StartProgram>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
Expand All @@ -41,6 +43,10 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug in SharpDevelop' ">
<StartAction>Program</StartAction>
<StartProgram>C:\VSC\SharpDevelop40\SharpDevelop\bin\SharpDevelop.exe</StartProgram>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
Expand All @@ -56,9 +62,6 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Src\Converters\AdditionConverter.cs" />
<Compile Include="Src\Converters\BoolToVisibilityConverter.cs" />
Expand All @@ -71,6 +74,7 @@
<Compile Include="Src\Converters\TypeNameConverter.cs" />
<Compile Include="Src\Data\AddIn.cs" />
<Compile Include="Src\Data\IShortcutTreeEntry.cs" />
<Compile Include="Src\Data\IShortcutTreeEntryCloner.cs" />
<Compile Include="Src\Data\MapTable.cs" />
<Compile Include="Src\Data\SeparatorData.cs" />
<Compile Include="Src\Data\Shortcut.cs" />
Expand All @@ -94,9 +98,6 @@
</Compile>
<Compile Include="Src\Extensions\TextBlockBehavior.cs" />
<Compile Include="Src\Extensions\TreeViewExtensions.cs" />
<Compile Include="Window1.xaml.cs">
<DependentUpon>Window1.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="Resources" />
Expand Down Expand Up @@ -129,15 +130,13 @@
<EmbeddedResource Include="Resources\StringResources.resx" />
</ItemGroup>
<ItemGroup>
<Page Include="App.xaml" />
<Page Include="Src\Dialogs\CreateNewProfilePrompt.xaml" />
<Page Include="Src\Dialogs\MultiKeyGestureTextBox.xaml" />
<Page Include="Src\Dialogs\Resources.xaml" />
<Page Include="Src\Dialogs\ShortcutManagementWindow.xaml" />
<Page Include="Src\Dialogs\ShortcutsManagementOptionsPanel.xaml" />
<Page Include="Src\Dialogs\ShortcutsTreeView.xaml" />
<Page Include="Themes\Generic.xaml" />
<Page Include="Window1.xaml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
Expand Down
@@ -1,8 +1,4 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug in SharpDevelop|AnyCPU' ">
<StartAction>Program</StartAction>
<StartProgram>C:\VSC\SharpDevelop40\SharpDevelop\bin\SharpDevelop.exe</StartProgram>
</PropertyGroup>
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
Expand Down
Expand Up @@ -4,40 +4,38 @@

namespace ICSharpCode.ShortcutsManagement.Converters
{
/// <summary>
/// Converts double value to another double value by adding another value provided in converter parameter
/// </summary>
class AddidionConverter : IValueConverter
{
/// <summary>
/// Convert double value to another double value by adding another value provided in converter parameter
/// </summary>
/// <param name="value">Original double value</param>
/// <param name="targetType">Convertion target type</param>
/// <param name="parameter">Another double value to be added to original value</param>
/// <param name="culture">Not used</param>
/// <returns>New double value</returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double additionParameter = 0;
var additionParameterString = parameter as string;
if (additionParameterString != null)
{
Double.TryParse(additionParameterString, out additionParameter);
}

if(value is double)
{
var doubleValue = (double)value;
return doubleValue + additionParameter;
}

return value;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
/// <summary>
/// Converts double value to another double value by adding another value provided in converter parameter
/// </summary>
class AddidionConverter : IValueConverter
{
/// <summary>
/// Convert double value to another double value by adding another value provided in converter parameter
/// </summary>
/// <param name="value">Original double value</param>
/// <param name="targetType">Convertion target type</param>
/// <param name="parameter">Another double value to be added to original value</param>
/// <param name="culture">Not used</param>
/// <returns>New double value</returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
double additionParameter = 0;
var additionParameterString = parameter as string;
if (additionParameterString != null) {
Double.TryParse(additionParameterString, out additionParameter);
}

if(value is double) {
var doubleValue = (double)value;
return doubleValue + additionParameter;
}

return value;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}
Expand Up @@ -5,33 +5,32 @@

namespace ICSharpCode.ShortcutsManagement.Converters
{
/// <summary>
/// Converts boolean value to <see cref="Visibility" /> enum
/// </summary>
public class BoolToVisibilityConverter : IValueConverter
{
/// <summary>
/// Convert forward
/// </summary>
/// <param name="value">Boolean value</param>
/// <param name="targetType">Target type (Only string is supported)</param>
/// <param name="parameter">Hide type (Hidden - reserve space but don't show, Collapse - do not reserve space)</param>
/// <param name="culture">Culture info (Invariant culture is used always)</param>
/// <returns>Visibility value</returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if(value is bool)
{
var hidden = parameter ?? "Hidden";
return (bool)value ? "Visible" : hidden;
}

throw new NotSupportedException();
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
/// <summary>
/// Converts boolean value to <see cref="Visibility" /> enum
/// </summary>
public class BoolToVisibilityConverter : IValueConverter
{
/// <summary>
/// Convert forward
/// </summary>
/// <param name="value">Boolean value</param>
/// <param name="targetType">Target type (Only string is supported)</param>
/// <param name="parameter">Hide type (Hidden - reserve space but don't show, Collapse - do not reserve space)</param>
/// <param name="culture">Culture info (Invariant culture is used always)</param>
/// <returns>Visibility value</returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if(value is bool) {
var hidden = parameter ?? "Hidden";
return (bool)value ? "Visible" : hidden;
}

throw new NotSupportedException();
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}
Expand Up @@ -7,40 +7,40 @@

namespace ICSharpCode.ShortcutsManagement.Converters
{
/// <summary>
/// Converts input gestures collection into string
/// </summary>
public class GesturesListConverter : IValueConverter
{
/// <summary>
/// Convert collection of gestures to a string
/// </summary>
/// <param name="value">Collection of gestures</param>
/// <param name="targetType">Convertion target type (only string is supported)</param>
/// <param name="parameter">Not used</param>
/// <param name="culture">Not used</param>
/// <returns>String representing collection of gestures</returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string converterValue = "";
if (value is InputGestureCollection && (targetType == typeof(string) || targetType.IsSubclassOf(typeof(string)))) {
converterValue = new InputGestureCollectionConverter().ConvertToInvariantString(value);
}

if (value is ObservableCollection<InputGesture> && (targetType == typeof(string) || targetType.IsSubclassOf(typeof(string)))) {
var inputGestureCollection = new InputGestureCollection();
foreach (var gesture in (ObservableCollection<InputGesture>)value) {
inputGestureCollection.Add(gesture);
}
converterValue = new InputGestureCollectionConverter().ConvertToInvariantString(inputGestureCollection);
}

return converterValue.Replace("+", " + ").Replace(",", ", ").Replace(";", "; ");
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
/// <summary>
/// Converts input gestures collection into string
/// </summary>
public class GesturesListConverter : IValueConverter
{
/// <summary>
/// Convert collection of gestures to a string
/// </summary>
/// <param name="value">Collection of gestures</param>
/// <param name="targetType">Convertion target type (only string is supported)</param>
/// <param name="parameter">Not used</param>
/// <param name="culture">Not used</param>
/// <returns>String representing collection of gestures</returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string converterValue = "";
if (value is InputGestureCollection && (targetType == typeof(string) || targetType.IsSubclassOf(typeof(string)))) {
converterValue = new InputGestureCollectionConverter().ConvertToInvariantString(value);
}
if (value is ObservableCollection<InputGesture> && (targetType == typeof(string) || targetType.IsSubclassOf(typeof(string)))) {
var inputGestureCollection = new InputGestureCollection();
foreach (var gesture in (ObservableCollection<InputGesture>)value) {
inputGestureCollection.Add(gesture);
}
converterValue = new InputGestureCollectionConverter().ConvertToInvariantString(inputGestureCollection);
}
return converterValue.Replace("+", " + ").Replace(",", ", ").Replace(";", "; ");
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}
Expand Up @@ -6,38 +6,36 @@

namespace ICSharpCode.ShortcutsManagement.Converters
{
/// <summary>
/// Converts input gesture to string representation
/// </summary>
public class InputGestureConverter : IValueConverter
{
/// <summary>
/// Convert input gesture to string
/// </summary>
/// <param name="value">Input gesture</param>
/// <param name="targetType">Convertion target type (Only string is supported)</param>
/// <param name="parameter">Not used</param>
/// <param name="culture">Not used</param>
/// <returns></returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is KeyGesture && targetType == typeof(string))
{
var gestures = new InputGestureCollection(new[] {value});
return new InputGestureCollectionConverter().ConvertToInvariantString(gestures).Replace("+", " + ").Replace(",", ", ");
}

if(value is MouseGesture && targetType == typeof(string))
{
return new MouseGestureConverter().ConvertToInvariantString(value);
}

return "";
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
/// <summary>
/// Converts input gesture to string representation
/// </summary>
public class InputGestureConverter : IValueConverter
{
/// <summary>
/// Convert input gesture to string
/// </summary>
/// <param name="value">Input gesture</param>
/// <param name="targetType">Convertion target type (Only string is supported)</param>
/// <param name="parameter">Not used</param>
/// <param name="culture">Not used</param>
/// <returns>String representing <see cref="InputGesture" /></returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is KeyGesture && targetType == typeof(string)) {
var gestures = new InputGestureCollection(new[] {value});
return new InputGestureCollectionConverter().ConvertToInvariantString(gestures).Replace("+", " + ").Replace(",", ", ");
}

if(value is MouseGesture && targetType == typeof(string)) {
return new MouseGestureConverter().ConvertToInvariantString(value);
}

return "";
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}

0 comments on commit b9a04c9

Please sign in to comment.