mirror of https://github.com/KLayout/klayout.git
WIP: refactoring ongoing - starts looking good :)
This commit is contained in:
parent
a2d4b02238
commit
a14e90f367
|
|
@ -4334,8 +4334,8 @@ public:
|
||||||
menu_entries.push_back (lay::separator ("macros_group", at));
|
menu_entries.push_back (lay::separator ("macros_group", at));
|
||||||
|
|
||||||
at = "@toolbar.end";
|
at = "@toolbar.end";
|
||||||
menu_entries.push_back (lay::menu_item ("cm_prev_display_state", "prev_display_state", at, "-"));
|
menu_entries.push_back (lay::menu_item ("cm_prev_display_state", "prev_display_state", at, tl::to_string (QObject::tr ("Back(Shift+Tab)<:/back.png>"))));
|
||||||
menu_entries.push_back (lay::menu_item ("cm_next_display_state", "next_display_state", at, "-"));
|
menu_entries.push_back (lay::menu_item ("cm_next_display_state", "next_display_state", at, tl::to_string (QObject::tr ("Forward(Tab)<:/forward.png>"))));
|
||||||
menu_entries.push_back (lay::separator ("toolbar_post_navigation_group", at));
|
menu_entries.push_back (lay::separator ("toolbar_post_navigation_group", at));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1729,6 +1729,19 @@ AbstractMenu::group (const std::string &name) const
|
||||||
return grp;
|
return grp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<lay::Action>
|
||||||
|
AbstractMenu::group_actions (const std::string &name) const
|
||||||
|
{
|
||||||
|
std::vector<std::string> grp = group (name);
|
||||||
|
|
||||||
|
std::vector<lay::Action> actions;
|
||||||
|
actions.reserve (grp.size ());
|
||||||
|
for (std::vector<std::string>::const_iterator g = grp.begin (); g != grp.end (); ++g) {
|
||||||
|
actions.push_back (action (*g));
|
||||||
|
}
|
||||||
|
return actions;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
AbstractMenu::collect_group (std::vector<std::string> &grp, const std::string &name, const AbstractMenuItem &item) const
|
AbstractMenu::collect_group (std::vector<std::string> &grp, const std::string &name, const AbstractMenuItem &item) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -771,6 +771,14 @@ public:
|
||||||
*/
|
*/
|
||||||
std::vector<std::string> group (const std::string &name) const;
|
std::vector<std::string> group (const std::string &name) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the group members as Action objects
|
||||||
|
*
|
||||||
|
* @param group The group name
|
||||||
|
* @param A vector of all members (as actions) of the group
|
||||||
|
*/
|
||||||
|
std::vector<lay::Action> group_actions (const std::string &name) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the detached menu
|
* @brief Get the detached menu
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -8115,8 +8115,8 @@ public:
|
||||||
menu_entries.push_back (lay::separator ("redraw_group", at));
|
menu_entries.push_back (lay::separator ("redraw_group", at));
|
||||||
menu_entries.push_back (lay::menu_item ("cm_redraw", "redraw", at, tl::to_string (QObject::tr ("Redraw"))));
|
menu_entries.push_back (lay::menu_item ("cm_redraw", "redraw", at, tl::to_string (QObject::tr ("Redraw"))));
|
||||||
menu_entries.push_back (lay::separator ("state_group", at));
|
menu_entries.push_back (lay::separator ("state_group", at));
|
||||||
menu_entries.push_back (lay::menu_item ("cm_prev_display_state", "prev_display_state", at, tl::to_string (QObject::tr ("Back(Shift+Tab)<:/back.png>"))));
|
menu_entries.push_back (lay::menu_item_copy ("cm_prev_display_state", "prev_display_state", at, "@toolbar.prev_display_state"));
|
||||||
menu_entries.push_back (lay::menu_item ("cm_next_display_state", "next_display_state", at, tl::to_string (QObject::tr ("Forward(Tab)<:/forward.png>"))));
|
menu_entries.push_back (lay::menu_item_copy ("cm_next_display_state", "next_display_state", at, "@toolbar.next_display_state"));
|
||||||
|
|
||||||
menu_entries.push_back (lay::separator ("select_group", at));
|
menu_entries.push_back (lay::separator ("select_group", at));
|
||||||
menu_entries.push_back (lay::menu_item ("cm_select_cell", "select_cell:edit", at, tl::to_string (QObject::tr ("Select Cell"))));
|
menu_entries.push_back (lay::menu_item ("cm_select_cell", "select_cell:edit", at, tl::to_string (QObject::tr ("Select Cell"))));
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,11 @@ PluginDeclaration::init_menu (lay::Dispatcher *dispatcher)
|
||||||
|
|
||||||
for (std::vector<lay::MenuEntry>::const_iterator m = menu_entries.begin (); m != menu_entries.end (); ++m) {
|
for (std::vector<lay::MenuEntry>::const_iterator m = menu_entries.begin (); m != menu_entries.end (); ++m) {
|
||||||
|
|
||||||
if (m->separator) {
|
if (! m->copy_from.empty ()) {
|
||||||
|
|
||||||
|
menu.insert_item (m->insert_pos, m->menu_name, menu.action (m->copy_from));
|
||||||
|
|
||||||
|
} else if (m->separator) {
|
||||||
|
|
||||||
menu.insert_separator (m->insert_pos, m->menu_name);
|
menu.insert_separator (m->insert_pos, m->menu_name);
|
||||||
|
|
||||||
|
|
@ -520,6 +524,16 @@ MenuEntry menu_item (const std::string &symbol, const std::string &menu_name, co
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MenuEntry menu_item_copy (const std::string &symbol, const std::string &menu_name, const std::string &insert_pos, const std::string ©_from)
|
||||||
|
{
|
||||||
|
MenuEntry e;
|
||||||
|
e.symbol = symbol;
|
||||||
|
e.menu_name = menu_name;
|
||||||
|
e.insert_pos = insert_pos;
|
||||||
|
e.copy_from = copy_from;
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
MenuEntry submenu (const std::string &menu_name, const std::string &insert_pos, const std::string &title)
|
MenuEntry submenu (const std::string &menu_name, const std::string &insert_pos, const std::string &title)
|
||||||
{
|
{
|
||||||
MenuEntry e;
|
MenuEntry e;
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ struct LAYBASIC_PUBLIC MenuEntry
|
||||||
std::string symbol;
|
std::string symbol;
|
||||||
std::string insert_pos;
|
std::string insert_pos;
|
||||||
std::string title;
|
std::string title;
|
||||||
|
std::string copy_from;
|
||||||
std::string cname;
|
std::string cname;
|
||||||
std::string cvalue;
|
std::string cvalue;
|
||||||
std::string exclusive_group;
|
std::string exclusive_group;
|
||||||
|
|
@ -134,6 +135,16 @@ LAYBASIC_PUBLIC MenuEntry separator (const std::string &menu_name, const std::st
|
||||||
*/
|
*/
|
||||||
LAYBASIC_PUBLIC MenuEntry menu_item (const std::string &symbol, const std::string &menu_name, const std::string &insert_pos, const std::string &title);
|
LAYBASIC_PUBLIC MenuEntry menu_item (const std::string &symbol, const std::string &menu_name, const std::string &insert_pos, const std::string &title);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Creates a menu entry as a linked copy from another one
|
||||||
|
*
|
||||||
|
* @param symbol The symbol to send when this menu item is selected
|
||||||
|
* @param menu_name The name of the menu item (see layAbstractMenu.h)
|
||||||
|
* @param insert_pos The position where to insert (see layAbstractMenu.h)
|
||||||
|
* @param copy_from The path of the item where to copy from (must exist)
|
||||||
|
*/
|
||||||
|
LAYBASIC_PUBLIC MenuEntry menu_item_copy (const std::string &symbol, const std::string &menu_name, const std::string &insert_pos, const std::string ©_from);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates a submenu entry
|
* @brief Creates a submenu entry
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue