preliminary commit of Collaboration plugin and test with drawing atop a SynthesizedAudioEditor
This commit is contained in:
parent
2c01de0531
commit
3134481895
@ -0,0 +1,285 @@
|
||||
//
|
||||
// MyClass.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2020 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MBS.Framework.Drawing;
|
||||
using MBS.Framework.UserInterface;
|
||||
using MBS.Framework.UserInterface.Dialogs;
|
||||
using UniversalEditor.Editors.Multimedia.Audio.Synthesized;
|
||||
using UniversalEditor.Editors.Multimedia.Audio.Synthesized.Views.PianoRoll;
|
||||
using UniversalEditor.ObjectModels.Multimedia.Audio.Synthesized;
|
||||
using UniversalEditor.Plugins.Collaboration;
|
||||
using UniversalEditor.UserInterface;
|
||||
|
||||
namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
|
||||
{
|
||||
public class MultimediaCollaborationPlugin : Plugin
|
||||
{
|
||||
public MultimediaCollaborationPlugin()
|
||||
{
|
||||
Context = new Context(new Guid("{262a622c-c9e3-458b-8fbb-49cf9258b05d}"), "Multimedia Collaboration Plugin");
|
||||
Context.AttachCommandEventHandler("Collaboration_Tracking_Track", delegate (object sender, EventArgs e)
|
||||
{
|
||||
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
|
||||
Document d = editor?.Document;
|
||||
if (d != null)
|
||||
{
|
||||
if (_initted(d))
|
||||
return;
|
||||
|
||||
if (d.ObjectModel is SynthesizedAudioObjectModel)
|
||||
{
|
||||
if (editor is SynthesizedAudioEditor)
|
||||
{
|
||||
SynthesizedAudioEditor ed = (editor as SynthesizedAudioEditor);
|
||||
if (ed.PianoRoll != null)
|
||||
{
|
||||
ed.PianoRoll.Paint += ed_PianoRoll_Paint;
|
||||
ed.PianoRoll.NoteRendered += ed_PianoRoll_NoteRendered;
|
||||
ed.PianoRoll.NoteInserted += ed_PianoRoll_NoteInserted;
|
||||
ed.PianoRoll.NoteDeleted += ed_PianoRoll_NoteDeleted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
__initted[d] = true;
|
||||
}
|
||||
});
|
||||
Context.AttachCommandEventHandler("Collaboration_Tracking_AcceptAll", delegate (object sender, EventArgs e)
|
||||
{
|
||||
if (MessageDialog.ShowDialog("Are you sure you want to accept all tracked changes in this document?", "Accept All Tracked Changes", MessageDialogButtons.YesNo, MessageDialogIcon.Warning) == DialogResult.No)
|
||||
return;
|
||||
|
||||
SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection InsertedCommands = GetChangedCommandsList();
|
||||
InsertedCommands.Clear();
|
||||
});
|
||||
Context.AttachCommandEventHandler("Collaboration_Tracking_PreviousChange", delegate (object sender, EventArgs e)
|
||||
{
|
||||
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
|
||||
Document d = editor?.Document;
|
||||
if (d == null)
|
||||
return;
|
||||
|
||||
if (!_initted(d))
|
||||
return;
|
||||
|
||||
if (d.ObjectModel is SynthesizedAudioObjectModel)
|
||||
{
|
||||
SynthesizedAudioObjectModel om = (d.ObjectModel as SynthesizedAudioObjectModel);
|
||||
if (editor is SynthesizedAudioEditor)
|
||||
{
|
||||
SynthesizedAudioEditor ed = (editor as SynthesizedAudioEditor);
|
||||
if (ed.PianoRoll != null)
|
||||
{
|
||||
SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection InsertedCommands = GetChangedCommandsList();
|
||||
|
||||
SelectedChangeIndex--;
|
||||
if (SelectedChangeIndex < 0)
|
||||
{
|
||||
SelectedChangeIndex = InsertedCommands.Count - 1;
|
||||
}
|
||||
else if (SelectedChangeIndex >= InsertedCommands.Count)
|
||||
{
|
||||
SelectedChangeIndex = InsertedCommands.Count - 1;
|
||||
}
|
||||
|
||||
if (SelectedChangeIndex >= 0 && SelectedChangeIndex < InsertedCommands.Count)
|
||||
{
|
||||
ed.PianoRoll.SelectedCommands.Clear();
|
||||
ed.PianoRoll.SelectedCommands.Add(InsertedCommands[SelectedChangeIndex].Command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Context.AttachCommandEventHandler("Collaboration_Tracking_NextChange", delegate (object sender, EventArgs e)
|
||||
{
|
||||
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
|
||||
Document d = editor?.Document;
|
||||
if (d == null)
|
||||
return;
|
||||
|
||||
if (!_initted(d))
|
||||
return;
|
||||
|
||||
if (d.ObjectModel is SynthesizedAudioObjectModel)
|
||||
{
|
||||
SynthesizedAudioObjectModel om = (d.ObjectModel as SynthesizedAudioObjectModel);
|
||||
if (editor is SynthesizedAudioEditor)
|
||||
{
|
||||
SynthesizedAudioEditor ed = (editor as SynthesizedAudioEditor);
|
||||
if (ed.PianoRoll != null)
|
||||
{
|
||||
SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection InsertedCommands = GetChangedCommandsList();
|
||||
|
||||
SelectedChangeIndex++;
|
||||
if (SelectedChangeIndex < 0)
|
||||
{
|
||||
SelectedChangeIndex = 0;
|
||||
}
|
||||
else if (SelectedChangeIndex >= InsertedCommands.Count)
|
||||
{
|
||||
SelectedChangeIndex = 0;
|
||||
}
|
||||
|
||||
if (SelectedChangeIndex >= 0 && SelectedChangeIndex < InsertedCommands.Count)
|
||||
{
|
||||
ed.PianoRoll.SelectedCommands.Clear();
|
||||
ed.PianoRoll.SelectedCommands.Add(InsertedCommands[SelectedChangeIndex].Command);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection GetChangedCommandsList()
|
||||
{
|
||||
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
|
||||
Document d = editor?.Document;
|
||||
if (d == null)
|
||||
return null;
|
||||
|
||||
if (!_initted(d))
|
||||
return null;
|
||||
|
||||
CollaborationPlugin plugin = (Plugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
|
||||
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
|
||||
|
||||
SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection list = collab.GetExtraData<SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection>("TrackedChanges", new SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection());
|
||||
collab.SetExtraData<SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection>("TrackedChanges", list);
|
||||
return list;
|
||||
}
|
||||
|
||||
private void ed_PianoRoll_NoteInserted(object sender, NoteEventArgs e)
|
||||
{
|
||||
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
|
||||
Document d = editor?.Document;
|
||||
CollaborationPlugin plugin = (Plugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
|
||||
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
|
||||
|
||||
if (collab.TrackChangesEnabled)
|
||||
{
|
||||
SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection ChangedCommands = GetChangedCommandsList();
|
||||
if (ChangedCommands != null)
|
||||
{
|
||||
ChangedCommands.Add(new SynthesizedAudioCommandChange(e.Note, e.Bounds, CollaborationChangeType.Insertion));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ed_PianoRoll_NoteDeleted(object sender, NoteEventArgs e)
|
||||
{
|
||||
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
|
||||
Document d = editor?.Document;
|
||||
CollaborationPlugin plugin = (Plugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
|
||||
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
|
||||
|
||||
if (collab.TrackChangesEnabled)
|
||||
{
|
||||
SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection ChangedCommands = GetChangedCommandsList();
|
||||
if (ChangedCommands != null)
|
||||
{
|
||||
ChangedCommands.Add(new SynthesizedAudioCommandChange(e.Note, e.Bounds, CollaborationChangeType.Deletion));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Dictionary<Document, bool> __initted = new Dictionary<Document, bool>();
|
||||
private bool _initted(Document d)
|
||||
{
|
||||
return __initted.ContainsKey(d) && __initted[d];
|
||||
}
|
||||
|
||||
public int SelectedChangeIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
|
||||
Document d = editor?.Document;
|
||||
CollaborationPlugin plugin = (Plugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
|
||||
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
|
||||
return collab.GetExtraData<int>("SelectedChangeIndex", -1);
|
||||
}
|
||||
set
|
||||
{
|
||||
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
|
||||
Document d = editor?.Document;
|
||||
CollaborationPlugin plugin = (Plugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
|
||||
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
|
||||
collab.SetExtraData<int>("SelectedChangeIndex", value);
|
||||
}
|
||||
}
|
||||
|
||||
private void ed_PianoRoll_Paint(object sender, PaintEventArgs e)
|
||||
{
|
||||
// painting is handled by PianoRoll._vp, not PianoRollView!!!
|
||||
SynthesizedAudioEditor editor = HostApplication.CurrentWindow.GetCurrentEditor() as SynthesizedAudioEditor;
|
||||
CollaborationPlugin plugin = (Plugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
|
||||
CollaborationSettings collab = plugin.GetCollaborationSettings();
|
||||
|
||||
if (collab.TrackChangesEnabled)
|
||||
{
|
||||
SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection ChangedCommands = GetChangedCommandsList();
|
||||
SynthesizedAudioCommandChange[] deletions = ChangedCommands.GetDeletions();
|
||||
for (int i = 0; i < deletions.Length; i++)
|
||||
{
|
||||
if (deletions[i].Command is SynthesizedAudioCommandNote)
|
||||
{
|
||||
editor.PianoRoll.DrawNote(e.Graphics, deletions[i].Bounds, deletions[i].Command as SynthesizedAudioCommandNote, false, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ed_PianoRoll_NoteRendered(object sender, NoteRenderedEventArgs e)
|
||||
{
|
||||
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
|
||||
Document d = editor?.Document;
|
||||
CollaborationPlugin plugin = (Plugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin);
|
||||
CollaborationSettings collab = plugin.GetCollaborationSettings(d);
|
||||
|
||||
if (collab.TrackChangesEnabled)
|
||||
{
|
||||
SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection InsertedCommands = GetChangedCommandsList();
|
||||
if (InsertedCommands.Contains(e.Note))
|
||||
{
|
||||
Color color = Colors.Gray;
|
||||
switch (InsertedCommands[e.Note].ChangeType)
|
||||
{
|
||||
case CollaborationChangeType.Insertion:
|
||||
{
|
||||
color = Colors.Green;
|
||||
break;
|
||||
}
|
||||
case CollaborationChangeType.Deletion:
|
||||
{
|
||||
color = Colors.Red;
|
||||
break;
|
||||
}
|
||||
}
|
||||
e.Graphics.DrawLine(new MBS.Framework.UserInterface.Drawing.Pen(color, new Measurement(2, MeasurementUnit.Pixel)), e.Bounds.X, e.Bounds.Bottom + 2, e.Bounds.Right, e.Bounds.Bottom + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
//
|
||||
// AssemblyInfo.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2020 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Mike Becker's Software")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("Mike Becker's Software")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
@ -0,0 +1,91 @@
|
||||
//
|
||||
// SynthesizedAudioCommandChange.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2020 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using MBS.Framework.Drawing;
|
||||
using UniversalEditor.ObjectModels.Multimedia.Audio.Synthesized;
|
||||
using UniversalEditor.Plugins.Collaboration;
|
||||
|
||||
namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration
|
||||
{
|
||||
public class SynthesizedAudioCommandChange
|
||||
{
|
||||
public class SynthesizedAudioCommandChangeCollection : Collection<SynthesizedAudioCommandChange>
|
||||
{
|
||||
private Dictionary<SynthesizedAudioCommand, SynthesizedAudioCommandChange> _itemsByCommand = new Dictionary<SynthesizedAudioCommand, SynthesizedAudioCommandChange>();
|
||||
public bool Contains(SynthesizedAudioCommand command)
|
||||
{
|
||||
return _itemsByCommand.ContainsKey(command);
|
||||
}
|
||||
|
||||
public SynthesizedAudioCommandChange this[SynthesizedAudioCommand command]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_itemsByCommand.ContainsKey(command))
|
||||
return _itemsByCommand[command];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void InsertItem(int index, SynthesizedAudioCommandChange item)
|
||||
{
|
||||
base.InsertItem(index, item);
|
||||
_itemsByCommand[item.Command] = item;
|
||||
}
|
||||
protected override void RemoveItem(int index)
|
||||
{
|
||||
_itemsByCommand.Remove(this[index].Command);
|
||||
base.RemoveItem(index);
|
||||
}
|
||||
protected override void ClearItems()
|
||||
{
|
||||
base.ClearItems();
|
||||
_itemsByCommand.Clear();
|
||||
}
|
||||
|
||||
public SynthesizedAudioCommandChange[] GetDeletions()
|
||||
{
|
||||
List<SynthesizedAudioCommandChange> list = new List<SynthesizedAudioCommandChange>();
|
||||
for (int i =0; i < Count; i++)
|
||||
{
|
||||
if (this[i].ChangeType == CollaborationChangeType.Deletion)
|
||||
{
|
||||
list.Add(this[i]);
|
||||
}
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public SynthesizedAudioCommandChange(SynthesizedAudioCommand command, Rectangle bounds, CollaborationChangeType changeType)
|
||||
{
|
||||
this.Command = command;
|
||||
this.Bounds = bounds;
|
||||
this.ChangeType = changeType;
|
||||
}
|
||||
|
||||
public SynthesizedAudioCommand Command { get; set; } = null;
|
||||
public Rectangle Bounds { get; set; }
|
||||
public CollaborationChangeType ChangeType { get; set; } = CollaborationChangeType.Unknown;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{75C99631-122C-4880-806E-646FCB021730}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration</RootNamespace>
|
||||
<AssemblyName>UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<ReleaseVersion>4.0.2019.12</ReleaseVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Output\Debug\Plugins</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Output\Release\Plugins</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MultimediaCollaborationPlugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SynthesizedAudioCommandChange.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Plugins\UniversalEditor.Plugins.Multimedia\UniversalEditor.Plugins.Multimedia.csproj">
|
||||
<Project>{BE4D0BA3-0888-42A5-9C09-FC308A4509D2}</Project>
|
||||
<Name>UniversalEditor.Plugins.Multimedia</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\UniversalEditor.Plugins.Multimedia.UserInterface\UniversalEditor.Plugins.Multimedia.UserInterface.csproj">
|
||||
<Project>{D9D5AC3B-9AC0-4D4E-B295-2134FDCF166C}</Project>
|
||||
<Name>UniversalEditor.Plugins.Multimedia.UserInterface</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
|
||||
<Project>{2D4737E6-6D95-408A-90DB-8DFF38147E85}</Project>
|
||||
<Name>UniversalEditor.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Essential\UniversalEditor.Essential.csproj">
|
||||
<Project>{30467E5C-05BC-4856-AADC-13906EF4CADD}</Project>
|
||||
<Name>UniversalEditor.Essential</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MBS.Framework\MBS.Framework\MBS.Framework.csproj">
|
||||
<Project>{00266B21-35C9-4A7F-A6BA-D54D7FDCC25C}</Project>
|
||||
<Name>MBS.Framework</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MBS.Framework.UserInterface\Libraries\MBS.Framework.UserInterface\MBS.Framework.UserInterface.csproj">
|
||||
<Project>{29E1C1BB-3EA5-4062-B62F-85EEC703FE07}</Project>
|
||||
<Name>MBS.Framework.UserInterface</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.UserInterface\UniversalEditor.UserInterface.csproj">
|
||||
<Project>{8622EBC4-8E20-476E-B284-33D472081F5C}</Project>
|
||||
<Name>UniversalEditor.UserInterface</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Plugins\UniversalEditor.Plugins.Collaboration\UniversalEditor.Plugins.Collaboration.csproj">
|
||||
<Project>{37504ECC-D87F-4E93-8E08-89C03BAAA6D9}</Project>
|
||||
<Name>UniversalEditor.Plugins.Collaboration</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@ -0,0 +1,31 @@
|
||||
//
|
||||
// CollaborationChangeType.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2020 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
namespace UniversalEditor.Plugins.Collaboration
|
||||
{
|
||||
public enum CollaborationChangeType
|
||||
{
|
||||
Unknown,
|
||||
Insertion,
|
||||
Deletion,
|
||||
Modification
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
//
|
||||
// MyClass.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2020 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MBS.Framework.UserInterface;
|
||||
using MBS.Framework.UserInterface.Dialogs;
|
||||
using UniversalEditor.UserInterface;
|
||||
|
||||
namespace UniversalEditor.Plugins.Collaboration
|
||||
{
|
||||
public class CollaborationPlugin : Plugin
|
||||
{
|
||||
private Dictionary<Document, CollaborationSettings> _CollaborationSettings = new Dictionary<Document, CollaborationSettings>();
|
||||
public CollaborationSettings GetCollaborationSettings(Document document = null)
|
||||
{
|
||||
if (document == null)
|
||||
{
|
||||
document = HostApplication.CurrentWindow?.GetCurrentEditor()?.Document;
|
||||
}
|
||||
|
||||
if (!_CollaborationSettings.ContainsKey(document))
|
||||
{
|
||||
_CollaborationSettings[document] = new CollaborationSettings();
|
||||
}
|
||||
return _CollaborationSettings[document];
|
||||
}
|
||||
|
||||
public CollaborationPlugin()
|
||||
{
|
||||
ID = new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}");
|
||||
Context = new Context(ID, "Collaboration Plugin");
|
||||
Context.AttachCommandEventHandler("Collaboration_Tracking_Track", delegate (object sender, EventArgs e)
|
||||
{
|
||||
Editor editor = HostApplication.CurrentWindow.GetCurrentEditor();
|
||||
Document d = editor?.Document;
|
||||
if (d != null)
|
||||
{
|
||||
CollaborationSettings collab = GetCollaborationSettings(d);
|
||||
collab.TrackChangesEnabled = !collab.TrackChangesEnabled;
|
||||
|
||||
MessageDialog.ShowDialog(String.Format("Track Changes enabled / disabled for document {0}: {1}", d.Title, collab.TrackChangesEnabled), "Information", MessageDialogButtons.OK, MessageDialogIcon.Information);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
//
|
||||
// CollaborationSettings.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2020 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MBS.Framework.UserInterface;
|
||||
|
||||
namespace UniversalEditor.Plugins.Collaboration
|
||||
{
|
||||
public class CollaborationSettings : ISupportsExtraData
|
||||
{
|
||||
public bool TrackChangesEnabled { get; set; } = false;
|
||||
|
||||
private Dictionary<string, object> _ExtraData = new Dictionary<string, object>();
|
||||
public T GetExtraData<T>(string key, T defaultValue = default(T))
|
||||
{
|
||||
if (_ExtraData.ContainsKey(key) && _ExtraData[key] is T)
|
||||
{
|
||||
return (T)_ExtraData[key];
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public object GetExtraData(string key, object defaultValue = null)
|
||||
{
|
||||
if (_ExtraData.ContainsKey(key))
|
||||
{
|
||||
return _ExtraData[key];
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void SetExtraData<T>(string key, T value)
|
||||
{
|
||||
_ExtraData[key] = value;
|
||||
}
|
||||
|
||||
public void SetExtraData(string key, object value)
|
||||
{
|
||||
_ExtraData[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ApplicationFramework>
|
||||
<Commands>
|
||||
<Command ID="Collaboration_SignIn" />
|
||||
|
||||
<Command ID="Collaboration_Comments_New" />
|
||||
<Command ID="Collaboration_Comments_Delete" />
|
||||
<Command ID="Collaboration_Comments_Previous" />
|
||||
<Command ID="Collaboration_Comments_Next" />
|
||||
<Command ID="Collaboration_Comments_ShowHideComments" />
|
||||
<Command ID="Collaboration_Comments">
|
||||
<Items>
|
||||
<CommandReference CommandID="Collaboration_Comments_New" />
|
||||
<CommandReference CommandID="Collaboration_Comments_Delete" />
|
||||
<Separator />
|
||||
<CommandReference CommandID="Collaboration_Comments_Previous" />
|
||||
<CommandReference CommandID="Collaboration_Comments_Next" />
|
||||
<Separator />
|
||||
<CommandReference CommandID="Collaboration_Comments_ShowHideComments" />
|
||||
</Items>
|
||||
</Command>
|
||||
|
||||
<Command ID="Collaboration_Tracking_Track" />
|
||||
<Command ID="Collaboration_Tracking_PreviousChange" />
|
||||
<Command ID="Collaboration_Tracking_NextChange" />
|
||||
<Command ID="Collaboration_Tracking_Lock" />
|
||||
<Command ID="Collaboration_Tracking_AcceptAll" />
|
||||
<Command ID="Collaboration_Tracking">
|
||||
<Items>
|
||||
<CommandReference CommandID="Collaboration_Tracking_Track" />
|
||||
<Separator />
|
||||
<CommandReference CommandID="Collaboration_Tracking_PreviousChange" />
|
||||
<CommandReference CommandID="Collaboration_Tracking_NextChange" />
|
||||
<Separator />
|
||||
<CommandReference CommandID="Collaboration_Tracking_Lock" />
|
||||
<CommandReference CommandID="Collaboration_Tracking_AcceptAll" />
|
||||
</Items>
|
||||
</Command>
|
||||
|
||||
<Command ID="Collaboration">
|
||||
<Items>
|
||||
<CommandReference CommandID="Collaboration_SignIn" />
|
||||
<Separator />
|
||||
<CommandReference CommandID="Collaboration_Comments" />
|
||||
<CommandReference CommandID="Collaboration_Tracking" />
|
||||
</Items>
|
||||
</Command>
|
||||
</Commands>
|
||||
<Languages>
|
||||
<Language ID="English">
|
||||
<Commands>
|
||||
<Command ID="Collaboration_Comments_New" Title="_New Comment..." />
|
||||
<Command ID="Collaboration_Comments_Delete" Title="_Delete Comment" />
|
||||
<Command ID="Collaboration_Comments_Previous" Title="_Previous Comment" />
|
||||
<Command ID="Collaboration_Comments_Next" Title="_Next Comment" />
|
||||
<Command ID="Collaboration_Comments_ShowHideComments" Title="_Show Comments" />
|
||||
|
||||
<Command ID="Collaboration" Title="_Collaborate" />
|
||||
<Command ID="Collaboration_SignIn" Title="_Sign In" />
|
||||
|
||||
<Command ID="Collaboration_Tracking" Title="_Tracking" />
|
||||
|
||||
<Command ID="Collaboration_Tracking_Track" Title="_Track Changes" />
|
||||
<Command ID="Collaboration_Tracking_PreviousChange" Title="_Previous Change" />
|
||||
<Command ID="Collaboration_Tracking_NextChange" Title="_Next Change" />
|
||||
<Command ID="Collaboration_Tracking_Lock" Title="_Lock Tracking" />
|
||||
<Command ID="Collaboration_Tracking_AcceptAll" Title="_Accept All Changes" />
|
||||
|
||||
<Command ID="Collaboration_Comments" Title="_Comments" />
|
||||
</Commands>
|
||||
</Language>
|
||||
</Languages>
|
||||
<MainMenu>
|
||||
<Items>
|
||||
<CommandReference CommandID="Collaboration" InsertBefore="Window" />
|
||||
</Items>
|
||||
</MainMenu>
|
||||
</ApplicationFramework>
|
||||
@ -0,0 +1,46 @@
|
||||
//
|
||||
// AssemblyInfo.cs
|
||||
//
|
||||
// Author:
|
||||
// Michael Becker <alcexhim@gmail.com>
|
||||
//
|
||||
// Copyright (c) 2020 Mike Becker's Software
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("UniversalEditor.Plugins.Collaboration")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Mike Becker's Software")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("Mike Becker's Software")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{37504ECC-D87F-4E93-8E08-89C03BAAA6D9}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>UniversalEditor.Plugins.Collaboration</RootNamespace>
|
||||
<AssemblyName>UniversalEditor.Plugins.Collaboration</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<ReleaseVersion>4.0.2019.12</ReleaseVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Output\Debug\Plugins</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Output\Release\Plugins</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CollaborationPlugin.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="CollaborationSettings.cs" />
|
||||
<Compile Include="CollaborationChangeType.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Commands\Review.uexml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Commands\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\MBS.Framework\MBS.Framework\MBS.Framework.csproj">
|
||||
<Project>{00266B21-35C9-4A7F-A6BA-D54D7FDCC25C}</Project>
|
||||
<Name>MBS.Framework</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MBS.Framework.UserInterface\Libraries\MBS.Framework.UserInterface\MBS.Framework.UserInterface.csproj">
|
||||
<Project>{29E1C1BB-3EA5-4062-B62F-85EEC703FE07}</Project>
|
||||
<Name>MBS.Framework.UserInterface</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
|
||||
<Project>{2D4737E6-6D95-408A-90DB-8DFF38147E85}</Project>
|
||||
<Name>UniversalEditor.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.Essential\UniversalEditor.Essential.csproj">
|
||||
<Project>{30467E5C-05BC-4856-AADC-13906EF4CADD}</Project>
|
||||
<Name>UniversalEditor.Essential</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\UniversalEditor.UserInterface\UniversalEditor.UserInterface.csproj">
|
||||
<Project>{8622EBC4-8E20-476E-B284-33D472081F5C}</Project>
|
||||
<Name>UniversalEditor.UserInterface</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@ -207,6 +207,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Dat
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Surodoine", "..\Surodoine\Surodoine\Surodoine.csproj", "{E0897B7B-617A-4709-A4C6-FC0F6B441B2A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Collaboration", "Plugins\UniversalEditor.Plugins.Collaboration\UniversalEditor.Plugins.Collaboration.csproj", "{37504ECC-D87F-4E93-8E08-89C03BAAA6D9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration", "Plugins.UserInterface\UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration\UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration.csproj", "{75C99631-122C-4880-806E-646FCB021730}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -595,6 +599,14 @@ Global
|
||||
{E0897B7B-617A-4709-A4C6-FC0F6B441B2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E0897B7B-617A-4709-A4C6-FC0F6B441B2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E0897B7B-617A-4709-A4C6-FC0F6B441B2A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{37504ECC-D87F-4E93-8E08-89C03BAAA6D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{37504ECC-D87F-4E93-8E08-89C03BAAA6D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{37504ECC-D87F-4E93-8E08-89C03BAAA6D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{37504ECC-D87F-4E93-8E08-89C03BAAA6D9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{75C99631-122C-4880-806E-646FCB021730}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{75C99631-122C-4880-806E-646FCB021730}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{75C99631-122C-4880-806E-646FCB021730}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{75C99631-122C-4880-806E-646FCB021730}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{6F0AB1AF-E1A1-4D19-B19C-05BBB15C94B2} = {05D15661-E684-4EC9-8FBD-C014BA433CC5}
|
||||
@ -692,6 +704,8 @@ Global
|
||||
{77C96685-268E-4CAD-867E-C19BBBEB1F3F} = {7B535D74-5496-4802-B809-89ED88274A91}
|
||||
{2EDA483D-E413-4CC5-A944-EBB898611268} = {2ED32D16-6C06-4450-909A-40D32DA67FB4}
|
||||
{E0897B7B-617A-4709-A4C6-FC0F6B441B2A} = {20F315E0-52AE-479F-AF43-3402482C1FC8}
|
||||
{37504ECC-D87F-4E93-8E08-89C03BAAA6D9} = {2ED32D16-6C06-4450-909A-40D32DA67FB4}
|
||||
{75C99631-122C-4880-806E-646FCB021730} = {7B535D74-5496-4802-B809-89ED88274A91}
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
Policies = $0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user