implement Editor-specific CommandBars for certain Editors

This commit is contained in:
Michael Becker 2021-10-31 14:56:45 -04:00
parent a23e71bfb7
commit 196d47840c
No known key found for this signature in database
GPG Key ID: 98C333A81F18C22C
12 changed files with 281 additions and 18 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>

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

@ -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

@ -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

@ -73,11 +73,11 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Plugins.Transport
{
base.InitializeInternal();
Context.Commands.Add(new Command("Transport_Rewind", "_Rewind"));
Context.Commands.Add(new Command("Transport_Back", "_Back"));
Context.Commands.Add(new Command("Transport_Play", "_Play"));
Context.Commands.Add(new Command("Transport_Forward", "_Forward"));
Context.Commands.Add(new Command("Transport_End", "_End"));
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"),

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;
}