void SeqStudioWindow::ToggleColumn(const char* name) { BColumnListView* table = dynamic_cast<BColumnListView*>( FindView(ENDPOINT_LIST_STR) ); if (!table) return; BColumn* col = column_named(name, table); if (!col) return; if (col->IsVisible() ) col->SetVisible(false); else col->SetVisible(true); }
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); } } } } }
status_t SeqManageRosterWindow::GetConfiguration(BMessage* config) { ArpASSERT(config); config->what = ConfigWhat(); status_t err = GetDimensions(config, this); if (err != B_OK) return err; /* Add the columns */ BColumnListView* table = dynamic_cast<BColumnListView*>( FindView(TABLE_STR) ); if (table) { BColumn* col; for( int32 k = 0; (col = table->ColumnAt(k)); k++ ) { BMessage colMsg; BString colName; col->GetColumnName(&colName); if( colMsg.AddString("name", colName.String() ) == B_OK && colMsg.AddFloat("width", col->Width() ) == B_OK && colMsg.AddBool("visible", col->IsVisible() ) == B_OK ) { config->AddMessage("column", &colMsg); } } } return B_OK; }