From 53e9f00269a26548db25a58bd163d3af73faa87f Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Thu, 13 Aug 2020 22:21:19 -0400 Subject: [PATCH] add plugins that are referenced in SLN but haven't been committed yet --- .../Controls/PresentationSlideControl.cs | 62 +++++++++++++ .../Editors/PresentationEditor.cs | 84 +++++++++++++++++ .../Properties/AssemblyInfo.cs | 46 +++++++++ ...Editor.Plugins.Office.UserInterface.csproj | 77 +++++++++++++++ .../Flash/Base/FlashBaseDataFormat.cs | 93 +++++++++++++++++++ .../Flash/Base/FlashBaseObjectModel.cs | 38 ++++++++ .../Flash/Base/FlashBaseTag.cs | 35 +++++++ .../Properties/AssemblyInfo.cs | 46 +++++++++ .../UniversalEditor.Plugins.Adobe.csproj | 58 ++++++++++++ 9 files changed, 539 insertions(+) create mode 100644 Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/Controls/PresentationSlideControl.cs create mode 100644 Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/Editors/PresentationEditor.cs create mode 100644 Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/Properties/AssemblyInfo.cs create mode 100644 Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/UniversalEditor.Plugins.Office.UserInterface.csproj create mode 100644 Plugins/UniversalEditor.Plugins.Adobe/Flash/Base/FlashBaseDataFormat.cs create mode 100644 Plugins/UniversalEditor.Plugins.Adobe/Flash/Base/FlashBaseObjectModel.cs create mode 100644 Plugins/UniversalEditor.Plugins.Adobe/Flash/Base/FlashBaseTag.cs create mode 100644 Plugins/UniversalEditor.Plugins.Adobe/Properties/AssemblyInfo.cs create mode 100644 Plugins/UniversalEditor.Plugins.Adobe/UniversalEditor.Plugins.Adobe.csproj diff --git a/Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/Controls/PresentationSlideControl.cs b/Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/Controls/PresentationSlideControl.cs new file mode 100644 index 00000000..4c0b95b0 --- /dev/null +++ b/Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/Controls/PresentationSlideControl.cs @@ -0,0 +1,62 @@ +// +// PresentationSlideControl.cs +// +// Author: +// Michael Becker +// +// 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 . +using System; +using MBS.Framework.Drawing; +using MBS.Framework.UserInterface; +using MBS.Framework.UserInterface.Drawing; +using MBS.Framework.UserInterface.Input.Mouse; +using UniversalEditor.Plugins.Designer.UserInterface.Editors.Designer.Controls; + +namespace UniversalEditor.Plugins.Office.UserInterface.Controls +{ + public class PresentationSlideControl : DesignerControl + { + private int SlideOffsetX = 32, SlideOffsetY = 0; + private int SlideWidth = 640, SlideHeight = 480; + + private double _ZoomFactor = 1.0; + public double ZoomFactor { get { return _ZoomFactor; } set { _ZoomFactor = value; Refresh(); } } + + private int ShadowOffset = 4; + + public PresentationSlideControl() + { + // TODO: add support for multiple designer areas with their own sets of components + // DesignerAreas.Clear(); + + // DesignerAreas.Add(new DesignerArea()); + } + + protected override void OnBeforePaint(PaintEventArgs e) + { + base.OnBeforePaint(e); + + double zp = ((double)SlideHeight / SlideWidth); + + int maxw = (int)(Size.Width - SlideOffsetX - SlideOffsetX); + int x = SlideOffsetX, w = (int)(ZoomFactor * maxw), h = (int)(ZoomFactor * (zp * maxw)); + int y = (int)((Size.Height - h) / 2) + SlideOffsetY; + + e.Graphics.FillRectangle(new SolidBrush(Colors.Black), new Rectangle(x + ShadowOffset, y + ShadowOffset, w, h)); + e.Graphics.FillRectangle(new SolidBrush(Colors.White), new Rectangle(x, y, w, h)); + } + } +} diff --git a/Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/Editors/PresentationEditor.cs b/Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/Editors/PresentationEditor.cs new file mode 100644 index 00000000..c08ae271 --- /dev/null +++ b/Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/Editors/PresentationEditor.cs @@ -0,0 +1,84 @@ +// +// PresentationEditor.cs +// +// Author: +// Michael Becker +// +// 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 . + +using System; +using MBS.Framework.UserInterface; +using MBS.Framework.UserInterface.Layouts; +using UniversalEditor.Plugins.Office.ObjectModels.Presentation; +using UniversalEditor.Plugins.Office.UserInterface.Controls; +using UniversalEditor.UserInterface; + +namespace UniversalEditor.Plugins.Office.UserInterface.Editors +{ + public class PresentationEditor : Editor + { + private static EditorReference _er = null; + public override EditorReference MakeReference() + { + if (_er == null) + { + _er = base.MakeReference(); + _er.SupportedObjectModels.Add(typeof(PresentationObjectModel)); + } + return _er; + } + + public override void UpdateSelections() + { + } + + protected override EditorSelection CreateSelectionInternal(object content) + { + return null; + } + + protected override void OnDocumentExplorerSelectionChanged(EditorDocumentExplorerSelectionChangedEventArgs e) + { + base.OnDocumentExplorerSelectionChanged(e); + } + + protected override void OnObjectModelChanged(EventArgs e) + { + base.OnObjectModelChanged(e); + + DocumentExplorer.Nodes.Clear(); + + PresentationObjectModel pres = (ObjectModel as PresentationObjectModel); + if (pres == null) return; + + if (pres.Slides.Count == 0) + pres.Slides.Add(new Slide()); + + EditorDocumentExplorerNode nodeSlides = DocumentExplorer.Nodes.Add("Slides"); + for (int i = 0; i < pres.Slides.Count; i++) + { + EditorDocumentExplorerNode nodeSlide = new EditorDocumentExplorerNode(String.Format("Slide {0}", (i + 1).ToString())); + nodeSlides.Nodes.Add(nodeSlide); + } + } + + public PresentationEditor() + { + Layout = new BoxLayout(Orientation.Vertical); + Controls.Add(new PresentationSlideControl(), new BoxLayout.Constraints(true, true)); + } + } +} diff --git a/Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/Properties/AssemblyInfo.cs b/Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..780d7647 --- /dev/null +++ b/Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/Properties/AssemblyInfo.cs @@ -0,0 +1,46 @@ +// +// AssemblyInfo.cs +// +// Author: +// Michael Becker +// +// 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 . +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.Office.UserInterface")] +[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("")] diff --git a/Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/UniversalEditor.Plugins.Office.UserInterface.csproj b/Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/UniversalEditor.Plugins.Office.UserInterface.csproj new file mode 100644 index 00000000..9f23a40e --- /dev/null +++ b/Plugins.UserInterface/UniversalEditor.Plugins.Office.UserInterface/UniversalEditor.Plugins.Office.UserInterface.csproj @@ -0,0 +1,77 @@ + + + + Debug + AnyCPU + {317CDFBC-9B41-4157-B2C0-D37E2BCEB42B} + Library + UniversalEditor.Plugins.Office.UserInterface + UniversalEditor.Plugins.Office.UserInterface + v4.0 + 4.0.2019.12 + + + true + full + false + ..\..\Output\Debug\Plugins + DEBUG; + prompt + 4 + false + + + true + ..\..\Output\Release\Plugins + prompt + 4 + false + + + + + + + + + + + + + + + + {8622EBC4-8E20-476E-B284-33D472081F5C} + UniversalEditor.UserInterface + + + {2D4737E6-6D95-408A-90DB-8DFF38147E85} + UniversalEditor.Core + + + {30467E5C-05BC-4856-AADC-13906EF4CADD} + UniversalEditor.Essential + + + {5D62192C-EB3E-4E73-A440-C53579B6EB47} + UniversalEditor.Plugins.Office + + + {00266B21-35C9-4A7F-A6BA-D54D7FDCC25C} + MBS.Framework + + + {29E1C1BB-3EA5-4062-B62F-85EEC703FE07} + MBS.Framework.UserInterface + + + {899E3DD6-EA65-4168-AAE3-867A4F9650A6} + UniversalEditor.Plugins.Designer + + + {08168BEA-E652-4493-8D89-5AB72B225841} + UniversalEditor.Plugins.Designer.UserInterface + + + + \ No newline at end of file diff --git a/Plugins/UniversalEditor.Plugins.Adobe/Flash/Base/FlashBaseDataFormat.cs b/Plugins/UniversalEditor.Plugins.Adobe/Flash/Base/FlashBaseDataFormat.cs new file mode 100644 index 00000000..5aabc3ac --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.Adobe/Flash/Base/FlashBaseDataFormat.cs @@ -0,0 +1,93 @@ +// +// FlashBaseDataFormat.cs +// +// Author: +// Michael Becker +// +// 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 . +using System; +using MBS.Framework.Drawing; +using UniversalEditor.IO; + +namespace UniversalEditor.Plugins.Adobe.Flash.Base +{ + public class FlashBaseDataFormat : DataFormat + { + private static DataFormatReference _dfr = null; + protected override DataFormatReference MakeReferenceInternal() + { + if (_dfr == null) + { + _dfr = base.MakeReferenceInternal(); + _dfr.Capabilities.Add(typeof(FlashBaseObjectModel), DataFormatCapabilities.All); + } + return _dfr; + } + + public bool Compressed { get; set; } = false; + public byte FormatVersion { get; set; } = 5; + + protected override void LoadInternal(ref ObjectModel objectModel) + { + FlashBaseObjectModel swf = (objectModel as FlashBaseObjectModel); + if (swf == null) + throw new ObjectModelNotSupportedException(); + + Reader reader = Accessor.Reader; + string signature = reader.ReadFixedLengthString(3); + if (signature == "CWS") + { + Compressed = true; + } + else if (signature == "FWS") + { + Compressed = false; + } + else + { + throw new InvalidDataFormatException("file does not begin with 'CWS' (compressed) or 'FWS' (uncompressed)"); + } + + FormatVersion = reader.ReadByte(); + + uint totalFileLength = reader.ReadUInt32(); + Rectangle frameSize = ReadRECT(reader); + + ushort frameRate = reader.ReadUInt16(); // 8.8 + ushort frameCount = reader.ReadUInt16(); + } + + private Rectangle ReadRECT(Reader reader) + { + // Bit values are stored by using the minimum number of bits possible for the range needed. + // Most bit value fields use a fixed number of bits.Some use a variable number of bits, but in all + // such cases, the number of bits to be used is explicitly stated in another field in the same + // structure.In these variable - length cases, applications that generate SWF files must determine + // the minimum number of bits necessary to represent the actual values that will be specified. + // For signed-bit values, if the number to be encoded is positive, an extra bit is necessary to + // preserve the leading 0; otherwise sign extension changes the bit value into a negative number. + int nbits_ = reader.ReadBitsAsInt32(5); + + int xmin = 0, ymin = 0, xmax = 0, ymax = 0; + return new Rectangle(xmin, ymin, xmax - xmin, ymax - ymin); + } + + protected override void SaveInternal(ObjectModel objectModel) + { + throw new NotImplementedException(); + } + } +} diff --git a/Plugins/UniversalEditor.Plugins.Adobe/Flash/Base/FlashBaseObjectModel.cs b/Plugins/UniversalEditor.Plugins.Adobe/Flash/Base/FlashBaseObjectModel.cs new file mode 100644 index 00000000..f30a106d --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.Adobe/Flash/Base/FlashBaseObjectModel.cs @@ -0,0 +1,38 @@ +// +// FlashBaseObjectModel.cs +// +// Author: +// Michael Becker +// +// 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 . +using System; +namespace UniversalEditor.Plugins.Adobe.Flash.Base +{ + public class FlashBaseObjectModel : ObjectModel + { + public override void Clear() + { + throw new NotImplementedException(); + } + + public override void CopyTo(ObjectModel where) + { + throw new NotImplementedException(); + } + + public FlashBaseTag.FlashBaseTagCollection Tags { get; } = new FlashBaseTag.FlashBaseTagCollection(); + } +} diff --git a/Plugins/UniversalEditor.Plugins.Adobe/Flash/Base/FlashBaseTag.cs b/Plugins/UniversalEditor.Plugins.Adobe/Flash/Base/FlashBaseTag.cs new file mode 100644 index 00000000..2de47cfd --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.Adobe/Flash/Base/FlashBaseTag.cs @@ -0,0 +1,35 @@ +// +// FlashBaseTag.cs +// +// Author: +// Michael Becker +// +// 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 . + +namespace UniversalEditor.Plugins.Adobe.Flash.Base +{ + public class FlashBaseTag + { + public class FlashBaseTagCollection + : System.Collections.ObjectModel.Collection + { + + } + + public byte TagType { get; set; } = 0; + public byte[] Data { get; set; } = new byte[0]; + } +} diff --git a/Plugins/UniversalEditor.Plugins.Adobe/Properties/AssemblyInfo.cs b/Plugins/UniversalEditor.Plugins.Adobe/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..c67e98ee --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.Adobe/Properties/AssemblyInfo.cs @@ -0,0 +1,46 @@ +// +// AssemblyInfo.cs +// +// Author: +// Michael Becker +// +// 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 . +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.Adobe")] +[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("")] diff --git a/Plugins/UniversalEditor.Plugins.Adobe/UniversalEditor.Plugins.Adobe.csproj b/Plugins/UniversalEditor.Plugins.Adobe/UniversalEditor.Plugins.Adobe.csproj new file mode 100644 index 00000000..83cc9798 --- /dev/null +++ b/Plugins/UniversalEditor.Plugins.Adobe/UniversalEditor.Plugins.Adobe.csproj @@ -0,0 +1,58 @@ + + + + Debug + AnyCPU + {FD46EA8D-7711-4BAF-A486-719D754504F8} + Library + UniversalEditor.Plugins.Adobe + UniversalEditor.Plugins.Adobe + v4.0 + 4.0.2019.12 + + + true + full + false + ..\..\Output\Debug\Plugins + DEBUG; + prompt + 4 + false + + + true + ..\..\Output\Release\Plugins + prompt + 4 + false + + + + + + + + + + + + + + + + + {2D4737E6-6D95-408A-90DB-8DFF38147E85} + UniversalEditor.Core + + + {30467E5C-05BC-4856-AADC-13906EF4CADD} + UniversalEditor.Essential + + + {00266B21-35C9-4A7F-A6BA-D54D7FDCC25C} + MBS.Framework + + + + \ No newline at end of file