void SeqManageRosterWindow::MenusBeginning() { inherited::MenusBeginning(); BMenuBar* bar = KeyMenuBar(); if (!bar) return; BColumnListView* table = dynamic_cast<BColumnListView*>( FindView(TABLE_STR) ); if (!table) return; BMenu* menu; BMenuItem* item; // Entry menu bool canEdit = false, canDuplicate = false; BString key, filePath; bool readOnly; if (GetSelectionInfo(key, filePath, &readOnly) == B_OK) { canEdit = !readOnly; canDuplicate = true; } if ( (menu = bar->SubmenuAt(ENTRY_MENU_INDEX)) != NULL) { if ( (item = menu->FindItem(EDIT_ENTRY_MSG)) != NULL) item->SetEnabled(canEdit); if ( (item = menu->FindItem(DUPLICATE_ENTRY_MSG)) != NULL) item->SetEnabled(canDuplicate); if ( (item = menu->FindItem(DELETE_ENTRY_MSG)) != NULL) item->SetEnabled(canEdit); } // Attributes menu if ( (menu = bar->SubmenuAt(ATTRIBUTES_MENU_INDEX)) != NULL) { for (int32 k = 0; (item = menu->ItemAt(k)) != NULL; k++) { const char* n; if (item->Message() && item->Message()->FindString(COLUMN_NAME_STR, &n) == B_OK) { BColumn* col = column_named(n, table); if (col && col->IsVisible() ) { if (!item->IsMarked() ) item->SetMarked(true); } else { if (item->IsMarked() ) item->SetMarked(false); } } } } }
void SeqStudioWindow::MenusBeginning() { inherited::MenusBeginning(); BMenuBar* bar = KeyMenuBar(); if (!bar) return; BColumnListView* table = dynamic_cast<BColumnListView*>( FindView(ENDPOINT_LIST_STR) ); if (!table) return; if (mDeviceCtrl && mDeviceCtrl->Menu() ) add_device_menu_items(mDeviceCtrl->Menu() ); // MIDI Port menu if (mPortMenu) { bool deleteEnabled = false; _EndpointRow* r = dynamic_cast<_EndpointRow*>(table->CurrentSelection() ); if (r && !r->mIsValid && r->mEndpoint.channel < 0) deleteEnabled = true; BMenuItem* deleteItem = mPortMenu->FindItem(DELETE_STR); if (deleteItem && deleteItem->IsEnabled() != deleteEnabled) deleteItem->SetEnabled(deleteEnabled); } // Attributes menu BMenu* menu; BMenuItem* item; if ( (menu = bar->SubmenuAt(ATTRIBUTES_MENU_INDEX)) != NULL) { for (int32 k = 0; (item = menu->ItemAt(k)) != NULL; k++) { const char* n; if (item->Message() && item->Message()->FindString(COLUMN_NAME_STR, &n) == B_OK) { BColumn* col = column_named(n, table); if (col && col->IsVisible() ) { if (!item->IsMarked() ) item->SetMarked(true); } else { if (item->IsMarked() ) item->SetMarked(false); } } } } }