Merge branch 'master' of https://github.com/EugenyP/netradiant-custom into EugenyP-master

This commit is contained in:
Garux 2023-07-21 11:43:31 +06:00
commit 06f34d4fc5

View File

@ -40,54 +40,63 @@ void PlugInMenu_Add( QMenu* plugin_menu, IPlugIn* pPlugIn ){
QMenu *menu; QMenu *menu;
const char *menuText; const char *menuText;
MenuStack menuStack; MenuStack menuStack;
menu = plugin_menu->addMenu( pPlugIn->getMenuName() );
menu->setTearOffEnabled( g_Layout_enableDetachableMenus.m_value );
std::size_t nCount = pPlugIn->getCommandCount(); std::size_t nCount = pPlugIn->getCommandCount();
{ {
while ( nCount > 0 ) globalErrorStream() << pPlugIn->getMenuName() << " count: " << nCount << "\n";
{ if (nCount > 1) {
menuText = pPlugIn->getCommandTitle( --nCount ); menu = plugin_menu->addMenu( pPlugIn->getMenuName() );
menu->setTearOffEnabled( g_Layout_enableDetachableMenus.m_value );
while ( nCount > 0 )
{
menuText = pPlugIn->getCommandTitle( --nCount );
if ( menuText != 0 && strlen( menuText ) > 0 ) {
if ( plugin_menu_separator( menuText ) ) {
menu->addSeparator();
}
else if ( plugin_submenu_in( menuText ) ) {
menuText = pPlugIn->getCommandTitle( --nCount );
if ( plugin_menu_special( menuText ) ) {
globalErrorStream() << pPlugIn->getMenuName() << " Invalid title (" << menuText << ") for submenu.\n";
continue;
}
menuStack.push( menu );
menu = menu->addMenu( menuText );
menu->setTearOffEnabled( g_Layout_enableDetachableMenus.m_value );
if ( menuText != 0 && strlen( menuText ) > 0 ) {
if ( plugin_menu_separator( menuText ) ) {
menu->addSeparator();
}
else if ( plugin_submenu_in( menuText ) ) {
menuText = pPlugIn->getCommandTitle( --nCount );
if ( plugin_menu_special( menuText ) ) {
globalErrorStream() << pPlugIn->getMenuName() << " Invalid title (" << menuText << ") for submenu.\n";
continue; continue;
} }
menuStack.push( menu ); else if ( plugin_submenu_out( menuText ) ) {
menu = menu->addMenu( menuText ); if ( !menuStack.empty() ) {
menu = menuStack.top();
menu->setTearOffEnabled( g_Layout_enableDetachableMenus.m_value ); menuStack.pop();
}
continue; else
} {
else if ( plugin_submenu_out( menuText ) ) { globalErrorStream() << pPlugIn->getMenuName() << ": Attempt to end non-existent submenu ignored.\n";
if ( !menuStack.empty() ) { }
menu = menuStack.top(); continue;
menuStack.pop();
} }
else else
{ {
globalErrorStream() << pPlugIn->getMenuName() << ": Attempt to end non-existent submenu ignored.\n"; create_menu_item_with_mnemonic( menu, menuText, pPlugIn->getGlobalCommand( nCount ) );
} }
continue;
}
else
{
create_menu_item_with_mnemonic( menu, menuText, pPlugIn->getGlobalCommand( nCount ) );
} }
} }
if ( !menuStack.empty() ) {
globalErrorStream() << pPlugIn->getMenuName() << " mismatched > <. " << menuStack.size() << " submenu(s) not closed.\n";
}
} else if (nCount == 1) {
menuText = pPlugIn->getCommandTitle( --nCount );
if ( menuText != 0 && strlen( menuText ) > 0 ) {
create_menu_item_with_mnemonic( plugin_menu, menuText, pPlugIn->getGlobalCommand( nCount ) );
}
} }
if ( !menuStack.empty() ) {
globalErrorStream() << pPlugIn->getMenuName() << " mismatched > <. " << menuStack.size() << " submenu(s) not closed.\n";
}
} }
} }