Skip to content

Commit

Permalink
Added icons to right click for add folder and entity
Browse files Browse the repository at this point in the history
fixes #1284
  • Loading branch information
vchelaru committed Dec 11, 2023
1 parent 3116b92 commit c2b4993
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
Binary file added FRBDK/Glue/Glue/Content/Icons/icon_entity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FRBDK/Glue/Glue/Content/Icons/icon_folder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 27 additions & 24 deletions FRBDK/Glue/Glue/FormHelpers/RightClickHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ public static class RightClickHelper
static GeneralToolStripMenuItem setAsStartUpScreenToolStripMenuItem;

static GeneralToolStripMenuItem addObjectToolStripMenuItem;
static GeneralToolStripMenuItem addEntityToolStripMenuItem;

static GeneralToolStripMenuItem removeFromProjectToolStripMenuItem;

static GeneralToolStripMenuItem editResetVariablesToolStripMenuItem;
Expand Down Expand Up @@ -504,9 +504,12 @@ public static class RightClickHelper
#region Images

static System.Windows.Controls.Image BookmarkImage;
static System.Windows.Controls.Image ScreenImage;
static System.Windows.Controls.Image DerivedEntity;
static System.Windows.Controls.Image CollisionRelationshipImage;
static System.Windows.Controls.Image DerivedEntity;
static System.Windows.Controls.Image EntityImage;
static System.Windows.Controls.Image FolderImage;

static System.Windows.Controls.Image ScreenImage;

static bool HasCreatedImages = false;
private static void CreateImages()
Expand All @@ -515,9 +518,11 @@ private static void CreateImages()
{

BookmarkImage = MakeImage("/Content/Icons/StarFilled.png");
ScreenImage = MakeImage("/Content/Icons/icon_screen.png");
DerivedEntity = MakeImage("/Content/Icons/icon_entity_derived.png");
CollisionRelationshipImage = MakeImage("/Content/Icons/icon_collisions.png");
DerivedEntity = MakeImage("/Content/Icons/icon_entity_derived.png");
EntityImage = MakeImage("/Content/Icons/icon_entity.png");
FolderImage = MakeImage("/Content/Icons/icon_folder.png");
ScreenImage = MakeImage("/Content/Icons/icon_screen.png");


HasCreatedImages = true;
Expand All @@ -529,10 +534,13 @@ System.Windows.Controls.Image MakeImage(string sourceName)
bitmapImage.UriSource = new Uri(sourceName, UriKind.Relative);
bitmapImage.EndInit();

return new System.Windows.Controls.Image()
var toReturn = new System.Windows.Controls.Image()
{
Source = bitmapImage
};


return toReturn;
}

}
Expand All @@ -542,7 +550,6 @@ System.Windows.Controls.Image MakeImage(string sourceName)

private static void PopulateRightClickMenuItemsShared(ITreeNode targetNode, MenuShowingAction menuShowingAction, ITreeNode draggedNode)
{
CreateImages();

#region IsScreenNode

Expand Down Expand Up @@ -595,13 +602,11 @@ private static void PopulateRightClickMenuItemsShared(ITreeNode targetNode, Menu
{
if (menuShowingAction == MenuShowingAction.RightButtonDrag && draggedNode.IsEntityNode())
{
var mAddEntityInstance = new GeneralToolStripMenuItem(L.Texts.EntityAddInstance);
mAddEntityInstance.Click += (not, used) => OnAddEntityInstanceClick(targetNode, draggedNode);

var mAddEntityList = new GeneralToolStripMenuItem(L.Texts.EntityListAdd);
mAddEntityList.Click += (not, used) => OnAddEntityListClick(targetNode, draggedNode);

AddItem(mAddEntityInstance);
Add(L.Texts.EntityAddInstance, () => OnAddEntityInstanceClick(targetNode, draggedNode));
AddItem(mAddEntityList);
}
else
Expand Down Expand Up @@ -642,7 +647,7 @@ private static void PopulateRightClickMenuItemsShared(ITreeNode targetNode, Menu
else if (targetNode.IsFilesContainerNode() || targetNode.IsFolderInFilesContainerNode())
{
AddItem(addFileToolStripMenuItem);
Add(L.Texts.FolderAdd, () => RightClickHelper.AddFolderClick(targetNode));
Add(L.Texts.FolderAdd, () => RightClickHelper.AddFolderClick(targetNode), image: FolderImage);
AddSeparator();
Add(L.Texts.ViewInExplorer, () => RightClickHelper.ViewInExplorerClick(targetNode));
AddEvent(L.Texts.CopyPathClipboard, (_, _) => HandleCopyToClipboardClick(targetNode));
Expand Down Expand Up @@ -670,13 +675,10 @@ private static void PopulateRightClickMenuItemsShared(ITreeNode targetNode, Menu

if (menuShowingAction == MenuShowingAction.RightButtonDrag && !isSameObject && draggedNode.IsEntityNode())
{
var mAddEntityInstance = new GeneralToolStripMenuItem(L.Texts.EntityAddInstance);
mAddEntityInstance.Click += (not, used) => OnAddEntityInstanceClick(targetNode, draggedNode);

var mAddEntityList = new GeneralToolStripMenuItem(L.Texts.EntityListAdd);
mAddEntityList.Click += (not, used) => OnAddEntityListClick(targetNode, draggedNode);

AddItem(mAddEntityInstance);
Add(L.Texts.EntityAddInstance, () => OnAddEntityInstanceClick(targetNode, draggedNode));
AddItem(mAddEntityList);
}
else
Expand Down Expand Up @@ -712,7 +714,7 @@ private static void PopulateRightClickMenuItemsShared(ITreeNode targetNode, Menu
else if (targetNode.IsGlobalContentContainerNode())
{
AddItem(addFileToolStripMenuItem);
Add(L.Texts.FolderAdd, () => RightClickHelper.AddFolderClick(targetNode));
Add(L.Texts.FolderAdd, () => RightClickHelper.AddFolderClick(targetNode), image: FolderImage);
Add(L.Texts.CodeRegenerate, () => HandleReGenerateCodeClick(targetNode));

Add(L.Texts.ViewInExplorer, () => RightClickHelper.ViewInExplorerClick(targetNode));
Expand All @@ -724,11 +726,11 @@ private static void PopulateRightClickMenuItemsShared(ITreeNode targetNode, Menu
#region IsRootEntityNode
else if (targetNode.IsRootEntityNode())
{
AddItem(addEntityToolStripMenuItem);
Add(L.Texts.EntityAdd, () => GlueCommands.Self.DialogCommands.ShowAddNewEntityDialog(), image: EntityImage);

Add(L.Texts.EntityImport, () => ImportElementClick(targetNode));
Add(L.Texts.FolderAdd, () => RightClickHelper.AddFolderClick(targetNode), image: FolderImage);

Add(L.Texts.FolderAdd, () => RightClickHelper.AddFolderClick(targetNode));
Add(L.Texts.EntityImport, () => ImportElementClick(targetNode));
}
#endregion

Expand Down Expand Up @@ -940,13 +942,15 @@ private static void PopulateRightClickMenuItemsShared(ITreeNode targetNode, Menu
AddSeparator();


Add(L.Texts.FolderAdd, () => RightClickHelper.AddFolderClick(targetNode));
Add(L.Texts.FolderAdd, () => RightClickHelper.AddFolderClick(targetNode), image: FolderImage);

bool isEntityContainingFolder = targetNode.Root.IsRootEntityNode();

if (isEntityContainingFolder)
{
AddItem(addEntityToolStripMenuItem);
//AddItem(addEntityToolStripMenuItem);

Add(L.Texts.EntityAdd, () => GlueCommands.Self.DialogCommands.ShowAddNewEntityDialog(), image: EntityImage);

Add(L.Texts.EntityImport, () => ImportElementClick(targetNode));
}
Expand Down Expand Up @@ -1147,15 +1151,14 @@ static void AddSeparator()

public static void Initialize()
{
CreateImages();

setAsStartUpScreenToolStripMenuItem = new GeneralToolStripMenuItem(L.Texts.SetAsStartupScreen);
setAsStartUpScreenToolStripMenuItem.Click += (not, used) =>
{
SetStartupScreen();
};

addEntityToolStripMenuItem = new GeneralToolStripMenuItem(L.Texts.EntityAdd);
addEntityToolStripMenuItem.Click += (not, used) => GlueCommands.Self.DialogCommands.ShowAddNewEntityDialog();

addObjectToolStripMenuItem = new GeneralToolStripMenuItem();
addObjectToolStripMenuItem.Text = L.Texts.ObjectAdd;
addObjectToolStripMenuItem.Click += (not, used) => GlueCommands.Self.DialogCommands.ShowAddNewObjectDialog();
Expand Down
4 changes: 4 additions & 0 deletions FRBDK/Glue/Glue/GlueFormsCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@
<None Remove="Content\Icons\folder.png" />
<None Remove="Content\Icons\GlueIcon.png" />
<None Remove="Content\Icons\icon_collisions.png" />
<None Remove="Content\Icons\icon_entity.png" />
<None Remove="Content\Icons\icon_entity_derived.png" />
<None Remove="Content\Icons\icon_folder.png" />
<None Remove="Content\Icons\icon_screen.png" />
<None Remove="Content\Icons\IncreaseArea.Agif" />
<None Remove="Content\Icons\IncreaseArea.gif" />
Expand Down Expand Up @@ -207,7 +209,9 @@
<Resource Include="Content\Icons\folder.png" />
<Resource Include="Content\Icons\GlueIcon.png" />
<Resource Include="Content\Icons\icon_collisions.png" />
<Resource Include="Content\Icons\icon_entity.png" />
<Resource Include="Content\Icons\icon_entity_derived.png" />
<Resource Include="Content\Icons\icon_folder.png" />
<Resource Include="Content\Icons\icon_screen.png" />
<Resource Include="Content\Icons\SaveIcon.png" />
<EmbeddedResource Include="Plugins\EmbeddedPlugins\CameraPlugin\IncreaseArea.Agif">
Expand Down

0 comments on commit c2b4993

Please sign in to comment.