Features

Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Help  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 4
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 4650 times and has 3 replies Next Thread
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 164
Status: Offline
Reply to this Post  Reply with Quote 
Grouping of plug-in actions

Is it possible to group the plug-in actions on the Tools menu as actions "Create photo...", "Create photos at points of view..." and "Create video..." of the 3D View menu?
By default, all actions of a plug-in are separated in Tools menu.
----------------------------------------
EnkoNyito gallery
[Oct 22, 2016 2:28:43 PM] Show Printable Version of Post    View Member Profile    Send Private Message    https://sites.google.com/site/enkonyitogallery/ [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 5837
Status: Offline
Reply to this Post  Reply with Quote 
Re: Grouping of plug-in actions

Not in the current version, since a separator is added before each plug-in menu item.
I guess it would be nice, but specifying groups of menu items might not be so easy to implement. If you have a simple idea, please share it.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Oct 22, 2016 4:51:47 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.eteks.com [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 164
Status: Offline
Reply to this Post  Reply with Quote 
Re: Grouping of plug-in actions

I thought that adding a loop with the list of plug-ins to put a separator after the last action of a menu would work.
A plug-in as AdvancedEditing can have several actions divided in different menus so it is not easy to group them by menu.
----------------------------------------
EnkoNyito gallery
[Oct 23, 2016 6:33:50 PM] Show Printable Version of Post    View Member Profile    Send Private Message    https://sites.google.com/site/enkonyitogallery/ [Link] Report threatening or abusive post: please login first  Go to top 
enkonyito
Advanced Member
Member's Avatar


Joined: May 28, 2015
Post Count: 164
Status: Offline
Reply to this Post  Reply with Quote 
Re: Grouping of plug-in actions

What do you think about this?

// Add menus to menu bar
JMenuBar menuBar = new JMenuBar();
fileMenu.addSeparator(); // test (enkonyito)
menuBar.add(fileMenu);
editMenu.addSeparator(); // test (enkonyito)
menuBar.add(editMenu);
furnitureMenu.addSeparator(); // test (enkonyito)
menuBar.add(furnitureMenu);
if (controller.getPlanController().getView() != null) {
planMenu.addSeparator(); // test (enkonyito)
menuBar.add(planMenu);
}
if (controller.getHomeController3D().getView() != null) {
preview3DMenu.addSeparator(); // test (enkonyito)
menuBar.add(preview3DMenu);
}
menuBar.add(helpMenu);

// Add plugin actions menu items
// debut test (enkonyito)
// Create missing menu
for (Action pluginAction : this.pluginActions) {
String pluginMenu = (String)pluginAction.getValue(PluginAction.Property.MENU.name());
if (pluginMenu != null) {
boolean pluginMenuExisting = false;
for (int i = 0; i < menuBar.getMenuCount(); i++) {
JMenu menu = menuBar.getMenu(i);
if (menu.getText().equals(pluginMenu)) {
pluginMenuExisting = true;
break;
}
}
if (!pluginMenuExisting) {
// Create missing menu before last menu
JMenu menu = new JMenu(pluginMenu);
menuBar.add(menu, menuBar.getMenuCount() - 1);
}
}
}
// Group plug-in actions by menu
for (int i = 0; i < menuBar.getMenuCount(); i++) {
JMenu menu = menuBar.getMenu(i);
for (Plugin plugin : this.plugins) {
boolean pluginActionAdded = false;
createActionsPlugin(plugin);
for (Action pluginAction : this.actionsPlugin) {
String pluginMenu = (String)pluginAction.getValue(PluginAction.Property.MENU.name());
if (pluginMenu != null) {
if (menu.getText().equals(pluginMenu)) {
// Add menu item to existing menu
menu.add(new ResourceAction.MenuItemAction(pluginAction));
pluginActionAdded = true;
}
}
}
if (pluginActionAdded) {
menu.addSeparator();
}
}
}
// fin test (enkonyito)

//debut test (enkonyito)
private void createActionsPlugin(Plugin plugin) {
this.actionsPlugin = new ArrayList<Action>();
if (plugin != null) {
for (final PluginAction pluginAction : plugin.getActions()) {
// Create a Swing action adapter to plug-in action
this.actionsPlugin.add(new ActionAdapter(pluginAction));
}
}
}
//fin test (enkonyito)


before


after

----------------------------------------
EnkoNyito gallery
[Nov 3, 2016 4:29:58 AM] Show Printable Version of Post    View Member Profile    Send Private Message    https://sites.google.com/site/enkonyitogallery/ [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2017 eTeks - All rights reserved