Merge branch 'master' of github.com:alcexhim/UniversalEditor

This commit is contained in:
Michael Becker 2021-11-15 23:52:22 -05:00
commit 972ce41b62
28 changed files with 707 additions and 82 deletions

View File

@ -49,7 +49,7 @@
</Items>
</Command>
<Command ID="FileSystemContextMenu_New_Folder" Title="_Folder" />
<Command ID="FileSystemContextMenu_New_Folder" Title="_Folder" StockType="FolderNew" />
<Command ID="FileSystemContextMenu_New_Shortcut" Title="_Shortcut" />
<Command ID="FileSystemContextMenu_New_Briefcase" Title="Briefcase" />
<Command ID="FileSystemContextMenu_New_BitmapImage" Title="Bitmap image" />
@ -149,6 +149,22 @@
</Items>
</Command>
</Commands>
<CommandBars>
<CommandBar ID="tbFileSystem">
<Items>
<!-- default toolbar layout: New Open Favorites Add Extract Encrypt View Install Wizard -->
<CommandReference CommandID="FileNewDocument" /> <!-- New -->
<CommandReference CommandID="FileOpenDocument" /> <!-- Open -->
<CommandReference CommandID="BookmarksManage" /> <!-- Favorites -->
<CommandReference CommandID="FileSystemContextMenu_Add_ExistingItem" /> <!-- Add -->
<CommandReference CommandID="FileSystemContextMenu_CopyTo" /> <!-- Extract -->
<CommandReference CommandID="FileSystemContextMenu_Encrypt" /> <!-- Encrypt -->
<CommandReference CommandID="File_Open" /> <!-- View -->
<CommandReference CommandID="FileSystemToolbar_Install" /> <!-- Install -->
<CommandReference CommandID="FileSystemToolbar_Wizard" /> <!-- Wizard -->
</Items>
</CommandBar>
</CommandBars>
</Editor>
</Editors>
</UniversalEditor>

View File

@ -74,8 +74,6 @@
</Items>
</Command>
<Command ID="Transport" Title="Tra_nsport" />
<!-- Context Menu -->
<Command ID="PianoRollEditor_ContextMenu_Arrow" Title="_Arrow" />
<Command ID="PianoRollEditor_ContextMenu_Draw" Title="Dra_w" />

View File

@ -3,25 +3,7 @@
<Editor ID="{0EE62532-88BF-4A4A-9DA3-43E79F015DF1}" TypeName="UniversalEditor.Plugins.Multimedia.UserInterface.Editors.Multimedia.Audio.Waveform.WaveformAudioEditor">
<Commands>
<Command ID="WaveformAudioEditor_ContextMenu_Playback_Play" Title="_Play" />
<Command ID="WaveformAudioEditor_ContextMenu_Playback">
<Items>
<CommandReference CommandID="WaveformAudioEditor_ContextMenu_Playback_Play" />
</Items>
</Command>
<Command ID="WaveformAudioEditor_Playback" Title="P_layback">
<Items>
<CommandReference CommandID="WaveformAudioEditor_ContextMenu_Playback_Play" />
</Items>
</Command>
</Commands>
<MenuBar>
<Items>
<CommandReference CommandID="WaveformAudioEditor_Playback" InsertAfter="Project" />
</Items>
</MenuBar>
</Editor>
</Editors>
</UniversalEditor>

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="48"
height="48"
viewBox="0 0 12.7 12.7"
version="1.1"
id="svg2323"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="cubee.svg"
inkscape:export-filename="/home/beckermj/Documents/Projects/UniversalEditor/Content/UniversalEditor.Content.PlatformIndependent/Editors/Multimedia3D/Model/Icons/sphere.png"
inkscape:export-xdpi="64"
inkscape:export-ydpi="64"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview2325"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
width="48mm"
units="px"
inkscape:zoom="4.8931362"
inkscape:cx="-1.4305754"
inkscape:cy="23.195758"
inkscape:window-width="1834"
inkscape:window-height="1016"
inkscape:window-x="86"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs2320">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="-12.467245 : -6.102848 : 1"
inkscape:vp_y="0 : 6333.026 : 0"
inkscape:vp_z="51.169586 : -6.102848 : 1"
inkscape:persp3d-origin="19.351171 : -19.507752 : 1"
id="perspective2604" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
sodipodi:type="inkscape:box3d"
id="g2606"
style="opacity:0.998;fill:#1c1c1c;stroke-width:1.14"
inkscape:perspectiveID="#perspective2604"
inkscape:corner0="1.2552249 : 0.0072360134 : 0 : 1"
inkscape:corner7="0.7749505 : 0.0049691175 : 0.24868518 : 1">
<path
sodipodi:type="inkscape:box3dside"
id="path2618"
style="fill:#e9e9ff;fill-rule:evenodd;stroke:none;stroke-linejoin:round"
inkscape:box3dsidetype="11"
d="M 6.560576,5.8547165 11.076495,2.7817048 V 9.8760207 L 6.560576,11.588273 Z"
points="11.076495,2.7817048 11.076495,9.8760207 6.560576,11.588273 6.560576,5.8547165 " />
<path
sodipodi:type="inkscape:box3dside"
id="path2608"
style="fill:#353564;fill-rule:evenodd;stroke:none;stroke-linejoin:round"
inkscape:box3dsidetype="6"
d="M 1.6415102,4.4269172 V 10.792717 L 6.560576,11.588273 V 5.8547165 Z"
points="1.6415102,10.792717 6.560576,11.588273 6.560576,5.8547165 1.6415102,4.4269172 " />
<path
sodipodi:type="inkscape:box3dside"
id="path2610"
style="fill:#4d4d9f;fill-rule:evenodd;stroke:none;stroke-linejoin:round"
inkscape:box3dsidetype="5"
d="M 1.6415102,4.4269172 5.4591231,0.53701073 11.076495,2.7817048 6.560576,5.8547165 Z"
points="5.4591231,0.53701073 11.076495,2.7817048 6.560576,5.8547165 1.6415102,4.4269172 " />
<path
sodipodi:type="inkscape:box3dside"
id="path2616"
style="fill:#afafde;fill-rule:evenodd;stroke:none;stroke-linejoin:round"
inkscape:box3dsidetype="13"
d="M 1.6415102,10.792717 5.4591231,8.6252986 11.076495,9.8760207 6.560576,11.588273 Z"
points="5.4591231,8.6252986 11.076495,9.8760207 6.560576,11.588273 1.6415102,10.792717 " />
<path
sodipodi:type="inkscape:box3dside"
id="path2614"
style="fill:#d7d7ff;fill-rule:evenodd;stroke:none;stroke-linejoin:round"
inkscape:box3dsidetype="14"
d="M 5.4591231,0.53701073 V 8.6252986 L 11.076495,9.8760207 V 2.7817048 Z"
points="5.4591231,8.6252986 11.076495,9.8760207 11.076495,2.7817048 5.4591231,0.53701073 " />
<path
sodipodi:type="inkscape:box3dside"
id="path2612"
style="fill:#8686bf;fill-rule:evenodd;stroke:none;stroke-linejoin:round"
inkscape:box3dsidetype="3"
d="M 1.6415102,4.4269172 5.4591231,0.53701073 V 8.6252986 L 1.6415102,10.792717 Z"
points="5.4591231,0.53701073 5.4591231,8.6252986 1.6415102,10.792717 1.6415102,4.4269172 " />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="48"
height="48"
viewBox="0 0 12.7 12.7"
version="1.1"
id="svg2323"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
sodipodi:docname="sphere.svg"
inkscape:export-filename="/home/beckermj/Documents/Projects/UniversalEditor/Content/UniversalEditor.Content.PlatformIndependent/Editors/Multimedia3D/Model/Icons/sphere.png"
inkscape:export-xdpi="64"
inkscape:export-ydpi="64"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview2325"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
width="48mm"
units="px"
inkscape:zoom="15.231372"
inkscape:cx="13.656026"
inkscape:cy="22.683446"
inkscape:window-width="1834"
inkscape:window-height="1016"
inkscape:window-x="86"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs2320">
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient1813"
id="radialGradient1815"
cx="171.32903"
cy="35.944698"
fx="171.32903"
fy="35.944698"
r="14.553248"
gradientTransform="matrix(0.35099668,0,0,0.35099668,-52.164799,-8.2372344)"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
id="linearGradient1813">
<stop
style="stop-color:#bebebe;stop-opacity:1;"
offset="0"
id="stop1809" />
<stop
style="stop-color:#1c1c1c;stop-opacity:1"
offset="1"
id="stop1811" />
</linearGradient>
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<circle
style="opacity:0.998;fill:url(#radialGradient1815);fill-opacity:1;stroke:none;stroke-width:0.400138"
id="path98"
cx="6.468751"
cy="6.0936403"
r="4.9087029" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ApplicationFramework>
<Languages DefaultLanguageID="English">
<Language ID="English">
<StringTable>
<StringTableEntry ID="Multimedia3D.Errors.CanvasInaccessible" Value="Unable to access the OpenGL canvas" />
<StringTableEntry ID="Multimedia3D.Errors.RenderingUnavailable" Value="The rendering will be unavailable." />
<StringTableEntry ID="Multimedia3D.Errors.CheckRequiredLibraries" Value="Check to ensure all required libraries are installed properly" />
<StringTableEntry ID="Multimedia3D.Errors.CheckRequiredFile" Value="Check to ensure the file exists and is readable" />
<StringTableEntry ID="Multimedia3D.Errors.VertexShaderNotFound" Value="Vertex shader not found" />
<StringTableEntry ID="Multimedia3D.Errors.FragmentShaderNotFound" Value="Fragment shader not found" />
</StringTable>
</Language>
</Languages>
</ApplicationFramework>

View File

@ -326,6 +326,9 @@
<Content Include="Editors\RavenSoftware\Waypoint\WaypointEditor.glade" />
<Content Include="Editors\RavenSoftware\Strip\StripEditor.uexml" />
<Content Include="Editors\RavenSoftware\Strip\StripEditor.glade" />
<Content Include="Extensions\Multimedia3D\Languages\English.uexml" />
<Content Include="Editors\Multimedia3D\Model\Icons\sphere.png" />
<Content Include="Editors\Multimedia3D\Model\Icons\cube.png" />
</ItemGroup>
<ItemGroup>
<Content Include="Configuration\Application.upl" />
@ -363,6 +366,8 @@
<Folder Include="Editors\Multimedia\Picture\" />
<Folder Include="Templates\Project\General\Images\" />
<Folder Include="Editors\RavenSoftware\Strip\" />
<Folder Include="Extensions\Multimedia3D\" />
<Folder Include="Extensions\Multimedia3D\Languages\" />
</ItemGroup>
<ItemGroup>
<Content Include="Templates\Project\Concertroid\Images\Concert.xcf" />
@ -373,6 +378,8 @@
<None Include="Images\SplashScreen.png" />
<None Include="Images\SplashScreen.xcf" />
<None Include="Documentation\Executable\DataFormats\Executable\Microsoft\ExecutableFormats.txt" />
<None Include="Editors\Multimedia3D\Model\Icons\sphere.svg" />
<None Include="Editors\Multimedia3D\Model\Icons\cube.svg" />
</ItemGroup>
<Target Name="Build">
<Copy SourceFiles="@(Content)" DestinationFiles="@(Content-&gt;'$(OutputPath)%(RelativeDir)%(Filename)%(Extension)')" />

View File

@ -0,0 +1,62 @@
//
// XMLSchemas.cs - provides common XML schema definitions used in a wide variety of applications
//
// Author:
// Michael Becker <alcexhim@gmail.com>
//
// Copyright (c) 2021 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.DataFormats.Markup.XML
{
/// <summary>
/// Provides common XML schema definitions used in a wide variety of applications.
/// </summary>
public static class CommonXMLSchemas
{
/// <summary>
/// The /elements/1.1/ namespace was created in 2000 for the RDF representation of the fifteen-element
/// Dublin Core and has been widely used in data for more than twenty years. This namespace corresponds
/// to the original scope of ISO 15836, which was published first in 2003 and last revised in 2017 as
/// ISO 15836-1:2017.
/// </summary>
/// <value>The XML schema for the original Dublin Core namespace.</value>
public static string DublinCore { get; } = "http://purl.org/dc/elements/1.1/";
/// <summary>
/// The /terms/ namespace was originally created in 2001 for identifying new terms coined outside of the
/// original fifteen-element Dublin Core. In 2008, in the context of defining formal semantic constraints
/// for DCMI metadata terms in support of RDF applications, the original fifteen elements themselves were
/// mirrored in the /terms/ namespace. As a result, there exists both a dc:date (http://purl.org/dc/elements/1.1/date)
/// with no formal range and a corresponding dcterms:date (http://purl.org/dc/terms/date) with a formal
/// range of "literal". While these distinctions are significant for creators of RDF applications, most users
/// can safely treat the fifteen parallel properties as equivalent. The most useful properties and classes of
/// DCMI Metadata Terms have now been published as ISO 15836-2:2019 [ISO 15836-2:2019]. While the /elements/1.1/
/// namespace will be supported indefinitely, DCMI gently encourages use of the /terms/ namespace.
/// </summary>
/// <value>The XML schema for the Dublin Core Terms namespace.</value>
public static string DublinCoreTerms { get; } = "http://purl.org/dc/terms/";
/// <summary>
/// The /dcmitype/ namespace was created in 2001 for the DCMI Type Vocabulary, which defines classes for
/// basic types of thing that can be described using DCMI metadata terms.
/// </summary>
/// <value>The XML schema for the Dublin Core DCMI Type namespace.</value>
public static string DublinCoreDCMIType { get; } = "http://purl.org/dc/dcmitype/";
/// <summary>
/// The /dcam/ namespace was created in 2008 for terms used in the description of DCMI metadata terms.
/// </summary>
/// <value>The XML schema for the Dublin Core DCAM namespace.</value>
public static string DublinCoreDCAM { get; } = "http://purl.org/dc/dcam/";
}
}

View File

@ -21,7 +21,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using UniversalEditor.ObjectModels.Markup;
using UniversalEditor.ObjectModels.PropertyList;
@ -116,7 +116,7 @@ namespace UniversalEditor.DataFormats.Markup.XML
if (element is MarkupTagElement)
{
MarkupTagElement tag = element as MarkupTagElement;
tw.Write(indent + Settings.TagBeginChar.ToString() + element.FullName);
tw.Write(indent + Settings.TagBeginChar.ToString() + GetFullName(element));
if (tag.Attributes.Count > 0)
{
tw.Write(" ");
@ -199,6 +199,40 @@ namespace UniversalEditor.DataFormats.Markup.XML
}
}
}
private string GetFullName(MarkupElement element)
{
if (element is MarkupTagElement)
{
if ((element as MarkupTagElement).XMLSchema != null)
{
StringBuilder sb = new StringBuilder();
sb.Append(GetPrefixForXMLSchema(element.ParentObjectModel, (element as MarkupTagElement).XMLSchema));
sb.Append(':');
sb.Append(element.Name);
return sb.ToString();
}
}
return element.FullName;
}
private string GetPrefixForXMLSchema(MarkupObjectModel mom, string xmlSchema)
{
foreach (MarkupElement el in mom.Elements)
{
if (el is MarkupTagElement)
{
foreach (MarkupAttribute att in (el as MarkupTagElement).Attributes)
{
if (att.Namespace == "xmlns" && att.Value == xmlSchema)
return att.Name;
}
break;
}
}
throw new InvalidOperationException(String.Format("xml prefix not found for schema '{0}'", xmlSchema));
}
public void WriteStartDocument()
{
this.WriteStartPreprocessor("xml");

View File

@ -83,10 +83,14 @@ namespace UniversalEditor.ObjectModels.Markup
return basetag;
}
private string _XMLSchema = null;
public string XMLSchema
{
get
{
if (_XMLSchema != null)
return _XMLSchema;
if (this.Namespace == null)
return null;
@ -103,6 +107,33 @@ namespace UniversalEditor.ObjectModels.Markup
return null;
}
set
{
if (this.ParentObjectModel == null)
{
_XMLSchema = value;
return;
}
for (int i = 0; i < this.ParentObjectModel.Elements.Count; i++)
{
MarkupTagElement tagTopLevel = (this.ParentObjectModel.Elements[i] as MarkupTagElement);
if (tagTopLevel == null)
continue;
foreach (MarkupAttribute att in tagTopLevel.Attributes)
{
if (att.Namespace == "xmlns")
{
if (att.Value == value)
{
Namespace = att.Name;
break;
}
}
}
}
}
}
protected override void UpdateParentObjectModel()

View File

@ -29,6 +29,21 @@ namespace UniversalEditor.ObjectModels.Markup
/// </summary>
public class MarkupTagElement : MarkupContainerElement
{
public MarkupTagElement()
{
}
public MarkupTagElement(string fullName, string innerMarkup)
{
FullName = fullName;
Value = innerMarkup;
}
public MarkupTagElement(string schema, string name, string innerMarkup)
{
XMLSchema = schema;
Name = name;
Value = innerMarkup;
}
/// <summary>
/// Combines the attributes and child elements of this <see cref="MarkupTagElement" /> with the given <see cref="MarkupElement" />.
/// </summary>

View File

@ -46,11 +46,41 @@ namespace UniversalEditor.ObjectModels.PropertyList
}
public override void CopyTo(ObjectModel objectModel)
{
PropertyListObjectModel omb = objectModel as PropertyListObjectModel;
if (omb == null) throw new ObjectModelNotSupportedException();
PropertyListObjectModel clone = objectModel as PropertyListObjectModel;
if (clone == null) throw new ObjectModelNotSupportedException();
// omb.Combine(this);
Combine(clone);
}
public void Combine(PropertyListObjectModel clone)
{
foreach (PropertyListItem item in Items)
{
if (item is Property)
{
if (clone.Items.Contains(item.Name) && clone.Items[item.Name] is Property)
{
(clone.Items[item.Name] as Property).Value = (item as Property).Value;
}
else
{
clone.Items.Add(((Property)item).Clone() as Property);
}
}
else if (item is Group)
{
if (clone.Items.Contains(item.Name) && clone.Items[item.Name] is Group)
{
(clone.Items[item.Name] as Group).Combine(item as Group);
}
else
{
clone.Items.Add(((Group)item).Clone() as Group);
}
}
}
}
public T GetValue<T>(string propertyName)
{
return this.GetValue<T>(new string[]

View File

@ -217,6 +217,7 @@
<Compile Include="DataFormats\Package\OpenDocument\Internal\ManifestXML\ManifestXMLObjectModel.cs" />
<Compile Include="DataFormats\Package\OpenDocument\Internal\ManifestXML\ManifestFileEntry.cs" />
<Compile Include="DataFormats\Package\OpenDocument\Internal\ManifestXML\XMLSchemas.cs" />
<Compile Include="DataFormats\Markup\XML\CommonXMLSchemas.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\UniversalEditor.Core\UniversalEditor.Core.csproj">

View File

@ -296,6 +296,20 @@ namespace UniversalEditor.UserInterface.Common
er.Variables.Add(varr);
}
}
MarkupTagElement tagCommandBars = (tagEditor.Elements["CommandBars"] as MarkupTagElement);
if (tagCommandBars != null)
{
foreach (MarkupElement elCommandBar in tagCommandBars.Elements)
{
CommandBar cb = CommandBarLoader.LoadCommandBarXML(elCommandBar as MarkupTagElement);
if (cb != null)
{
er.CommandBars.Add(cb);
}
}
}
}
}
}

View File

@ -829,30 +829,13 @@ namespace UniversalEditor.UserInterface
Editor ed = LastWindow.GetCurrentEditor();
if (ed == null) return;
Accessor acc = ed.ObjectModel?.Accessor ?? (ed.Parent as Pages.EditorPage)?.Document?.Accessor;
// we cannot yet bookmark a file that does not yet exist. (this would be akin to creating a shortcut to a template I guess...?)
if (acc == null) return;
// FIXME: BookmarksAdd copypasta
string filename = acc.GetFileName();
BookmarksManager.FileNames.Add(filename);
Command cmdBookmarks = Application.Instance.Commands["Bookmarks"];
if (cmdBookmarks.Items.Count == 4)
{
cmdBookmarks.Items.Add(new SeparatorCommandItem());
}
((UIApplication)Application.Instance).Commands.Add(new Command(String.Format("{0}", (((EditorApplication)Application.Instance).BookmarksManager.FileNames.Count - 1).ToString()), System.IO.Path.GetFileName(((EditorApplication)Application.Instance).BookmarksManager.FileNames[(BookmarksManager.FileNames.Count - 1)])));
((UIApplication)Application.Instance).Commands["Bookmarks"].Items.Add(new CommandReferenceCommandItem(String.Format("Bookmarks_Bookmark{0}", (BookmarksManager.FileNames.Count - 1).ToString())));
Application.Instance.AttachCommandEventHandler(String.Format("Bookmarks_Bookmark{0}", (((EditorApplication)Application.Instance).BookmarksManager.FileNames.Count - 1).ToString()), Bookmarks_Bookmark_Click);
AddBookmark(ed.ObjectModel?.Accessor ?? (ed.Parent as Pages.EditorPage)?.Document?.Accessor);
ShowBookmarksManagerDialog();
});
Application.Instance.AttachCommandEventHandler("BookmarksAddAll", delegate (object sender, EventArgs e)
{
Page[] pages = LastWindow.GetPages();
for (int i = 0; i < pages.Length; i++)
{
if (pages[i] is Pages.EditorPage)
@ -860,20 +843,7 @@ namespace UniversalEditor.UserInterface
Pages.EditorPage ep = (pages[i] as Pages.EditorPage);
Editor ed = (ep.Controls[0] as Editor);
// FIXME: BookmarksAdd copypasta
string filename = ed.ObjectModel.Accessor.GetFileName();
BookmarksManager.FileNames.Add(filename);
Command cmdBookmarks = ((UIApplication)Application.Instance).Commands["Bookmarks"];
if (cmdBookmarks.Items.Count == 4)
{
cmdBookmarks.Items.Add(new SeparatorCommandItem());
}
Application.Instance.Commands.Add(new Command(String.Format("Bookmarks_Bookmark{0}", (((EditorApplication)Application.Instance).BookmarksManager.FileNames.Count - 1)), System.IO.Path.GetFileName(((EditorApplication)Application.Instance).BookmarksManager.FileNames[(BookmarksManager.FileNames.Count - 1)])));
Application.Instance.Commands["Bookmarks"].Items.Add(new CommandReferenceCommandItem(String.Format("Bookmarks_Bookmark{0}", ((EditorApplication)Application.Instance).BookmarksManager.FileNames.Count - 1)));
Application.Instance.AttachCommandEventHandler(String.Format("Bookmarks_Bookmark{0}", (((EditorApplication)Application.Instance).BookmarksManager.FileNames.Count - 1).ToString()), Bookmarks_Bookmark_Click);
AddBookmark(ed.ObjectModel?.Accessor ?? (ed.Parent as Pages.EditorPage)?.Document?.Accessor);
}
}
@ -1029,6 +999,32 @@ namespace UniversalEditor.UserInterface
#endregion
}
/// <summary>
/// Adds a bookmark referencing the specified <see cref="Accessor" /> to the application's bookmarks menu.
/// </summary>
/// <returns><c>true</c>, if bookmark was added, <c>false</c> otherwise.</returns>
/// <param name="accessor">The <see cref="Accessor" /> referencing the bookmark to add.</param>
public bool AddBookmark(Accessor accessor)
{
// we cannot yet bookmark a file that does not yet exist. (this would be akin to creating a shortcut to a template I guess...?)
if (accessor == null) return false;
string filename = accessor.GetFileName();
BookmarksManager.FileNames.Add(filename);
Command cmdBookmarks = Application.Instance.Commands["Bookmarks"];
if (cmdBookmarks.Items.Count == 4)
{
cmdBookmarks.Items.Add(new SeparatorCommandItem());
}
((UIApplication)Application.Instance).Commands.Add(new Command(String.Format("{0}", (((EditorApplication)Application.Instance).BookmarksManager.FileNames.Count - 1).ToString()), System.IO.Path.GetFileName(((EditorApplication)Application.Instance).BookmarksManager.FileNames[(BookmarksManager.FileNames.Count - 1)])));
((UIApplication)Application.Instance).Commands["Bookmarks"].Items.Add(new CommandReferenceCommandItem(String.Format("Bookmarks_Bookmark{0}", (BookmarksManager.FileNames.Count - 1).ToString())));
Application.Instance.AttachCommandEventHandler(String.Format("Bookmarks_Bookmark{0}", (((EditorApplication)Application.Instance).BookmarksManager.FileNames.Count - 1).ToString()), Bookmarks_Bookmark_Click);
return true;
}
void Td_HyperlinkClicked(object sender, TaskDialogHyperlinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("https://www.gnu.org/licenses/gpl-3.0.en.html");

View File

@ -45,6 +45,10 @@ namespace UniversalEditor.UserInterface
{
Commands.Add(reference.Commands[i]);
}
for (int i = 0; i < reference.CommandBars.Count; i++)
{
CommandBars.Add(reference.CommandBars[i]);
}
for (int i = 0; i < reference.MenuBar.Items.Count; i++)
{
MenuItems.Add(reference.MenuBar.Items[i]);

View File

@ -30,6 +30,7 @@ namespace UniversalEditor.UserInterface
public MarkupTagElement Configuration { get; set; } = null;
public CommandBar MenuBar { get; } = new CommandBar();
public CommandBar.CommandBarCollection CommandBars { get; } = new CommandBar.CommandBarCollection();
public Command.CommandCollection Commands { get; } = new Command.CommandCollection();
public PanelReference.PanelReferenceCollection Panels { get; } = new PanelReference.PanelReferenceCollection();
public EditorView.EditorViewCollection Views { get; } = new EditorView.EditorViewCollection();

View File

@ -59,6 +59,7 @@ namespace UniversalEditor.Editors.Contact
this.Padding = new Padding(26);
TabContainer sidebar = new TabContainer();
sidebar.TabStyle = TabContainerTabStyle.Sidebar;
#region Summary Panel
{

View File

@ -25,6 +25,8 @@ using MBS.Framework.UserInterface.Layouts;
using UniversalEditor.UserInterface;
using UniversalEditor.ObjectModels.Multimedia.Audio.Synthesized;
using System;
using MBS.Framework;
namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized
{
@ -35,6 +37,8 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized
InitializeComponent();
}
public MBS.Audio.ITransport Transport { get; set; } = null;
private static EditorReference _er = null;
public override EditorReference MakeReference()
{

View File

@ -106,6 +106,8 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Editors.Multimedia.Au
WaveformAudioEditorTrack track = (Parent as WaveformAudioEditorTrack);
WaveformAudioObjectModel wave = track.ObjectModel;
if (wave.RawSamples == null)
return;
ScrollBounds = new MBS.Framework.Drawing.Dimension2D(wave.RawSamples.Length, 0);

View File

@ -43,6 +43,8 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Editors.Multimedia.Au
return _er;
}
public MBS.Audio.ITransport Transport { get; set; } = null;
public WaveformAudioEditor()
{
Layout = new BoxLayout(Orientation.Vertical);
@ -66,17 +68,21 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Editors.Multimedia.Au
protected override void OnCreated(EventArgs e)
{
base.OnCreated(e);
Context.AttachCommandEventHandler("WaveformAudioEditor_ContextMenu_Playback_Play", delegate (object sender, EventArgs ee)
{
WaveformAudioObjectModel wave = (ObjectModel as WaveformAudioObjectModel);
if (wave == null) return;
// get the setting "Editors -> Audio -> Waveform -> Audio engine
Transport = new MBS.Audio.CustomTransport(Transport_Play, null, null);
}
// get the setting "Editors -> Audio -> Waveform -> Synchronize with JACK transport
AudioPlayer player = new AudioPlayer();
player.Play(wave);
});
private bool Transport_Play()
{
WaveformAudioObjectModel wave = (ObjectModel as WaveformAudioObjectModel);
if (wave == null) return false;
// get the setting "Editors -> Audio -> Waveform -> Audio engine
// get the setting "Editors -> Audio -> Waveform -> Synchronize with JACK transport
AudioPlayer player = new AudioPlayer();
player.Play(wave);
return true;
}
public override void UpdateSelections()

View File

@ -0,0 +1,181 @@
//
// TransportPlugin.cs
//
// Author:
// Michael Becker <alcexhim@gmail.com>
//
// Copyright (c) 2021 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 MBS.Framework;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Dialogs;
using UniversalEditor.UserInterface;
namespace UniversalEditor.Plugins.Multimedia.UserInterface.Plugins.Transport
{
public class TransportPlugin : UserInterfacePlugin
{
public TransportPlugin()
{
ID = new Guid("{02e071ec-b2cd-4a72-999f-3b626e06d609}");
Title = "Transport Plugin";
Context = new UIContext(ID, "Transport Plugin");
cbTransport = new CommandBar("cbTransport", "Transport", new CommandItem[]
{
new CommandReferenceCommandItem("Transport_Rewind"),
new CommandReferenceCommandItem("Transport_Back"),
new CommandReferenceCommandItem("Transport_Play"),
new CommandReferenceCommandItem("Transport_Forward"),
new CommandReferenceCommandItem("Transport_End")
});
}
private CommandBar cbTransport = null;
private CommandReferenceCommandItem miTransport = null;
void Handle_EditorChanging(object sender, EditorChangingEventArgs e)
{
if (e.CurrentEditor == null)
return;
Type t = e.CurrentEditor.GetType();
System.Reflection.PropertyInfo piTransport = t.GetProperty("Transport", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
if (piTransport != null && piTransport.PropertyType == typeof(MBS.Audio.ITransport))
{
if (!e.CurrentEditor.Context.CommandBars.Contains(cbTransport))
{
e.CurrentEditor.Context.CommandBars.Add(cbTransport);
}
if (!e.CurrentEditor.Context.MenuItems.Contains(miTransport))
{
e.CurrentEditor.Context.MenuItems.Add(miTransport);
}
}
}
protected override void InitializeInternal()
{
base.InitializeInternal();
Context.Commands.Add(new Command("Transport_Rewind", "_Rewind") { StockType = StockType.MediaPrevious });
Context.Commands.Add(new Command("Transport_Back", "_Back") { StockType = StockType.MediaRewind });
Context.Commands.Add(new Command("Transport_Play", "_Play") { StockType = StockType.MediaPlay });
Context.Commands.Add(new Command("Transport_Forward", "_Forward") { StockType = StockType.MediaForward });
Context.Commands.Add(new Command("Transport_End", "_End") { StockType = StockType.MediaNext });
Context.Commands.Add(new Command("Transport_Transport", "P_layback", new CommandItem[]
{
new CommandReferenceCommandItem("Transport_Rewind"),
new CommandReferenceCommandItem("Transport_Back"),
new CommandReferenceCommandItem("Transport_Play"),
new CommandReferenceCommandItem("Transport_Forward"),
new CommandReferenceCommandItem("Transport_End"),
}));
Context.AttachCommandEventHandler("Transport_Rewind", Transport_Rewind);
Context.AttachCommandEventHandler("Transport_Back", Transport_Back);
Context.AttachCommandEventHandler("Transport_Play", Transport_Play);
Context.AttachCommandEventHandler("Transport_Forward", Transport_Forward);
Context.AttachCommandEventHandler("Transport_End", Transport_End);
((EditorApplication)Application.Instance).EditorChanging += Handle_EditorChanging;
miTransport = new CommandReferenceCommandItem("Transport_Transport");
miTransport.InsertAfterID = "Project";
}
private void Transport_End(object sender, EventArgs e)
{
Editor ed = (((UIApplication)Application.Instance).CurrentWindow as UniversalEditor.UserInterface.MainWindow)?.GetCurrentEditor();
Type t = ed?.GetType();
System.Reflection.PropertyInfo piTransport = t?.GetProperty("Transport", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
MBS.Audio.ITransport transport = (piTransport?.GetValue(ed, null) as MBS.Audio.ITransport);
if (transport == null)
{
MessageDialog.ShowDialog("Transport unavailable", "Error", MessageDialogButtons.OK, MessageDialogIcon.Error);
return;
}
}
private void Transport_Forward(object sender, EventArgs e)
{
Editor ed = (((UIApplication)Application.Instance).CurrentWindow as UniversalEditor.UserInterface.MainWindow)?.GetCurrentEditor();
Type t = ed?.GetType();
System.Reflection.PropertyInfo piTransport = t?.GetProperty("Transport", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
MBS.Audio.ITransport transport = (piTransport?.GetValue(ed, null) as MBS.Audio.ITransport);
if (transport == null)
{
MessageDialog.ShowDialog("Transport unavailable", "Error", MessageDialogButtons.OK, MessageDialogIcon.Error);
return;
}
}
private void Transport_Play(object sender, EventArgs e)
{
Editor ed = (((UIApplication)Application.Instance).CurrentWindow as UniversalEditor.UserInterface.MainWindow)?.GetCurrentEditor();
Type t = ed?.GetType();
System.Reflection.PropertyInfo piTransport = t?.GetProperty("Transport", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
MBS.Audio.ITransport transport = (piTransport?.GetValue(ed, null) as MBS.Audio.ITransport);
if (transport == null)
{
MessageDialog.ShowDialog("Transport unavailable", "Error", MessageDialogButtons.OK, MessageDialogIcon.Error);
return;
}
transport.Play();
}
private void Transport_Back(object sender, EventArgs e)
{
Editor ed = (((UIApplication)Application.Instance).CurrentWindow as UniversalEditor.UserInterface.MainWindow)?.GetCurrentEditor();
Type t = ed?.GetType();
System.Reflection.PropertyInfo piTransport = t?.GetProperty("Transport", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
MBS.Audio.ITransport transport = (piTransport?.GetValue(ed, null) as MBS.Audio.ITransport);
if (transport == null)
{
MessageDialog.ShowDialog("Transport unavailable", "Error", MessageDialogButtons.OK, MessageDialogIcon.Error);
return;
}
}
private void Transport_Rewind(object sender, EventArgs e)
{
Editor ed = (((UIApplication)Application.Instance).CurrentWindow as UniversalEditor.UserInterface.MainWindow)?.GetCurrentEditor();
Type t = ed?.GetType();
System.Reflection.PropertyInfo piTransport = t?.GetProperty("Transport", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
MBS.Audio.ITransport transport = (piTransport?.GetValue(ed, null) as MBS.Audio.ITransport);
if (transport == null)
{
MessageDialog.ShowDialog("Transport unavailable", "Error", MessageDialogButtons.OK, MessageDialogIcon.Error);
return;
}
transport.Stop();
}
}
}

View File

@ -60,6 +60,7 @@
<Compile Include="Editors\Multimedia\Audio\Synthesized\Views\PianoRoll\NoteEvent.cs" />
<Compile Include="Controls\ColorPalette\ColorPaletteControl.cs" />
<Compile Include="Editors\Multimedia\Palette\Dialogs\CalculateNeighboringColorsDialog.cs" />
<Compile Include="Plugins\Transport\TransportPlugin.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Editors\" />
@ -83,6 +84,8 @@
<Folder Include="Editors\Multimedia\VectorImage\" />
<Folder Include="Editors\Multimedia\VectorImage\Controls\" />
<Folder Include="Controls\ColorPalette\" />
<Folder Include="Plugins\" />
<Folder Include="Plugins\Transport\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">

View File

@ -27,6 +27,7 @@ using MBS.Framework.Rendering;
using MBS.Framework.UserInterface;
using MBS.Framework.UserInterface.Controls;
using MBS.Framework.UserInterface.Dialogs;
using MBS.Framework.UserInterface.Input.Mouse;
using MBS.Framework.UserInterface.Layouts;
using UniversalEditor.ObjectModels.Multimedia3D.Model;
@ -46,18 +47,29 @@ namespace UniversalEditor.Plugins.Multimedia3D.UserInterface.Editors.Model
{
_er = base.MakeReference();
_er.SupportedObjectModels.Add(typeof(ModelObjectModel));
_er.Commands.Add(new Command("ModelEditor_Insert_Cube", "Cube") { ImageFileName = "Editors/Multimedia3D/Model/Icons/cube.png" });
_er.Commands.Add(new Command("ModelEditor_Insert_Sphere", "Sphere") { ImageFileName = "Editors/Multimedia3D/Model/Icons/sphere.png" });
_er.Commands.Add(new Command("ModelEditor_Insert_Plane", "Plane") { ImageFileName = "Editors/Multimedia3D/Model/Icons/plane.png" });
_er.CommandBars.Add(new CommandBar("ModelEditor_Insert", "Insert", new CommandItem[]
{
new CommandReferenceCommandItem("ModelEditor_Insert_Cube"),
new CommandReferenceCommandItem("ModelEditor_Insert_Sphere"),
new CommandReferenceCommandItem("ModelEditor_Insert_Plane"),
new SeparatorCommandItem()
}));
}
return _er;
}
public override void UpdateSelections()
{
throw new NotImplementedException();
}
protected override Selection CreateSelectionInternal(object content)
{
throw new NotImplementedException();
return null;
}
private OpenGLCanvas gla = null;
@ -67,6 +79,7 @@ namespace UniversalEditor.Plugins.Multimedia3D.UserInterface.Editors.Model
this.Layout = new BoxLayout(Orientation.Vertical);
gla = new OpenGLCanvas();
gla.FocusOnClick = true;
gla.Realize += gla_Realize;
gla.Render += gla_Render;
this.Controls.Add(gla, new BoxLayout.Constraints(true, true));
@ -116,7 +129,7 @@ namespace UniversalEditor.Plugins.Multimedia3D.UserInterface.Editors.Model
new VERTEX(-0.5f, -0.366f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f)
};
VertexArray[] vaos = null;
VertexArray vao = null;
/// <summary>
/// Computes the modelview projection
@ -176,6 +189,16 @@ namespace UniversalEditor.Plugins.Multimedia3D.UserInterface.Editors.Model
void gla_Render(object sender, OpenGLCanvasRenderEventArgs e)
{
if (fatalError)
return;
if (e.Canvas == null)
{
MessageDialog.ShowDialog(String.Format("{0} . {1} {2} .\n\n", this._("Multimedia3D.Errors.CanvasInaccessible"), this._("Multimedia3D.Errors.RenderingUnavailable"), this._("Multimedia3D.Errors.CheckRequiredLibraries")), this._("Framework.Errors.GenericErrorTitle"), MessageDialogButtons.OK, MessageDialogIcon.Error);
fatalError = true;
return;
}
e.Canvas.Clear(Colors.Gray);
if (p == null && !fatalError)
@ -185,7 +208,7 @@ namespace UniversalEditor.Plugins.Multimedia3D.UserInterface.Editors.Model
string vtxFileName = ((UIApplication)Application.Instance).ExpandRelativePath("~/Editors/Multimedia3D/Model/Shaders/Default/default_vtx.glsl");
if (!System.IO.File.Exists(vtxFileName))
{
MessageDialog.ShowDialog(String.Format("Vertex shader not found . The rendering will be unavailable. Check to ensure the file exists and is readable .\n\n{0}", vtxFileName), "Error", MessageDialogButtons.OK, MessageDialogIcon.Error);
MessageDialog.ShowDialog(String.Format("{0} . {1} {2} .\n\n", this._("Multimedia3D.Errors.VertexShaderNotFound"), this._("Multimedia3D.Errors.RenderingUnavailable"), this._("Multimedia3D.Errors.CheckRequiredFile")), this._("Framework.Errors.GenericErrorTitle"), MessageDialogButtons.OK, MessageDialogIcon.Error);
fatalError = true;
p = null;
return;
@ -197,7 +220,7 @@ namespace UniversalEditor.Plugins.Multimedia3D.UserInterface.Editors.Model
string frgFileName = ((UIApplication)Application.Instance).ExpandRelativePath("~/Editors/Multimedia3D/Model/Shaders/Default/default_frg.glsl");
if (!System.IO.File.Exists(vtxFileName))
{
MessageDialog.ShowDialog(String.Format("Fragment shader not found . The rendering will be unavailable. Check to ensure the file exists and is readable .\n\n{0}", frgFileName), "Error", MessageDialogButtons.OK, MessageDialogIcon.Error);
MessageDialog.ShowDialog(String.Format("{0} . {1} {2} .\n\n", this._("Multimedia3D.Errors.FragmentShaderNotFound"), this._("Multimedia3D.Errors.RenderingUnavailable"), this._("Multimedia3D.Errors.CheckRequiredFile")), this._("Framework.Errors.GenericErrorTitle"), MessageDialogButtons.OK, MessageDialogIcon.Error);
fatalError = true;
p = null;
return;
@ -220,11 +243,11 @@ namespace UniversalEditor.Plugins.Multimedia3D.UserInterface.Editors.Model
}
/* use the buffers in the VAO */
if (vaos != null)
if (vao != null)
{
try
{
vaos[0].Bind();
vao.Bind();
/* draw the three vertices as a triangle */
e.Canvas.DrawArrays(RenderMode.Triangles, 0, vertex_data.Length);
@ -289,18 +312,18 @@ namespace UniversalEditor.Plugins.Multimedia3D.UserInterface.Editors.Model
vertex_data = list.ToArray();
}
if (vaos != null)
if (vao != null)
{
gla.Engine.DeleteVertexArray(vaos);
gla.Engine.DeleteVertexArray(vao);
}
// we need to create a VAO to store the other buffers
vaos = gla.Engine.CreateVertexArray(1);
vao = gla.Engine.CreateVertexArray();
// this is the VBO that holds the vertex data
using (RenderBuffer buffer = gla.Engine.CreateBuffer())
{
vaos[0].Bind();
vao.Bind();
buffer.Bind(BufferTarget.ArrayBuffer);
buffer.SetData(vertex_data, BufferDataUsage.StaticDraw);
@ -320,7 +343,7 @@ namespace UniversalEditor.Plugins.Multimedia3D.UserInterface.Editors.Model
// reset the state; we will re-enable the VAO when needed
buffer.Unbind();
vaos[0].Unbind(); // must be called BEFORE the buffer gets disposed
vao.Unbind(); // must be called BEFORE the buffer gets disposed
}
changed = false;
}

View File

@ -152,8 +152,8 @@ namespace UniversalEditor.ObjectModels.Multimedia.Audio.Waveform
clone.Header.DataRate = this.Header.DataRate;
clone.Header.FormatTag = this.Header.FormatTag;
clone.Header.SampleRate = this.Header.SampleRate;
clone.RawData = (this.mvarRawData.Clone() as byte[]);
clone.RawSamples = (this.RawSamples.Clone() as WaveformAudioSamples);
clone.RawData = (this.RawData?.Clone() as byte[]);
clone.RawSamples = (this.RawSamples?.Clone() as WaveformAudioSamples);
clone.Information.AlbumTitle = (Information.AlbumTitle.Clone() as string);
clone.Information.Comments = (Information.Comments.Clone() as string);

16
update.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
GIT_USER=alcexhim
GIT_URL=git@github.com:$GIT_USER
GIT_PROJECTS="MBS.Audio MBS.Framework MBS.Framework.UserInterface MBS.Framework.Rendering UniversalEditor"
for name in $GIT_PROJECTS; do
if [ -d ../$name ]; then
cd ../$name && git pull
else
cd ../ && git clone $GIT_URL/$name
cd $name
fi
done