/// <summary> /// the primary could as well be called "the one editable collection"... the one at the top /// </summary> private void LoadPrimaryCollectionButtons() { _primaryCollectionReloadPending = false; _primaryCollectionFlow.SuspendLayout(); _primaryCollectionFlow.Controls.Clear(); //without this guy, the FLowLayoutPanel uses the height of a button, on *the next row*, for the height of this row! var invisibleHackPartner = new Label() { Text = "", Width = 0 }; _primaryCollectionFlow.Controls.Add(invisibleHackPartner); var primaryCollectionHeader = new ListHeader() { ForeColor = Palette.TextAgainstDarkBackground }; primaryCollectionHeader.Label.Text = _model.VernacularLibraryNamePhrase; primaryCollectionHeader.AdjustWidth(); _primaryCollectionFlow.Controls.Add(primaryCollectionHeader); //_primaryCollectionFlow.SetFlowBreak(primaryCollectionHeader, true); _primaryCollectionFlow.Controls.Add(_menuTriangle); //NB: we're using a picture box instead of a button because the former can have transparency. LoadOneCollection(_model.GetBookCollections().First(), _primaryCollectionFlow); _primaryCollectionFlow.ResumeLayout(); }
private void LoadSourceCollectionButtons() { if (!_model.ShowSourceCollections) { _sourceBooksFlow.Visible = false; string lockNotice = L10NSharp.LocalizationManager.GetString("CollectionTab.bookSourcesLockNotice", "This collection is locked, so new books cannot be added/removed."); var lockNoticeLabel = new Label() { Text = lockNotice, Size = new Size(_primaryCollectionFlow.Width - 20, 15), ForeColor = Palette.TextAgainstDarkBackground, Padding = new Padding(10, 0, 0, 0) }; _primaryCollectionFlow.Controls.Add(lockNoticeLabel); return; } var collections = _model.GetBookCollections(); //without this guy, the FLowLayoutPanel uses the height of a button, on *the next row*, for the height of this row! var invisibleHackPartner = new Label() { Text = "", Width = 0 }; _sourceBooksFlow.SuspendLayout(); _sourceBooksFlow.Controls.Clear(); var bookSourcesHeader = new ListHeader() { ForeColor = Palette.TextAgainstDarkBackground }; string shellSourceHeading = L10NSharp.LocalizationManager.GetString("CollectionTab.sourcesForNewShellsHeading", "Sources For New Shells"); string bookSourceHeading = L10NSharp.LocalizationManager.GetString("CollectionTab.bookSourceHeading", "Sources For New Books"); bookSourcesHeader.Label.Text = _model.IsShellProject ? shellSourceHeading : bookSourceHeading; invisibleHackPartner = new Label() { Text = "", Width = 0 }; _sourceBooksFlow.Controls.Add(invisibleHackPartner); _sourceBooksFlow.Controls.Add(bookSourcesHeader); _sourceBooksFlow.SetFlowBreak(bookSourcesHeader, true); foreach (BookCollection collection in collections.Skip(1)) { if (_sourceBooksFlow.Controls.Count > 0) { _sourceBooksFlow.SetFlowBreak(_sourceBooksFlow.Controls[_sourceBooksFlow.Controls.Count - 1], true); } int indexForHeader = _sourceBooksFlow.Controls.Count; if (LoadOneCollection(collection, _sourceBooksFlow)) { //without this guy, the FLowLayoutPanel uses the height of a button, on *the next row*, for the height of this row! invisibleHackPartner = new Label() { Text = "", Width = 0 }; _sourceBooksFlow.Controls.Add(invisibleHackPartner); _sourceBooksFlow.Controls.SetChildIndex(invisibleHackPartner, indexForHeader); //We showed at least one book, so now go back and insert the header var collectionHeader = new Label() { Text = collection.Name, Size = new Size(_sourceBooksFlow.Width - 20, 15), ForeColor = Palette.TextAgainstDarkBackground, Padding = new Padding(10, 0, 0, 0) }; collectionHeader.Margin = new Padding(0, 10, 0, 0); collectionHeader.Font = _headerFont; _sourceBooksFlow.Controls.Add(collectionHeader); _sourceBooksFlow.Controls.SetChildIndex(collectionHeader, indexForHeader + 1); _sourceBooksFlow.SetFlowBreak(collectionHeader, true); } } AddWhereIsTheRestLink(); _sourceBooksFlow.ResumeLayout(); }
private void LoadSourceCollectionButtons() { if (!_model.ShowSourceCollections) { _sourceBooksFlow.Visible = false; string lockNotice = LocalizationManager.GetString("CollectionTab.BookSourcesLockNotice", "This collection is locked, so new books cannot be added/removed."); var lockNoticeLabel = new Label() { Text = lockNotice, Size = new Size(_primaryCollectionFlow.Width - 20, 15), ForeColor = Palette.TextAgainstDarkBackground, Padding = new Padding(10, 0, 0, 0) }; _primaryCollectionFlow.Controls.Add(lockNoticeLabel); return; } var collections = _model.GetBookCollections(); //without this guy, the FLowLayoutPanel uses the height of a button, on *the next row*, for the height of this row! var invisibleHackPartner = new Label() {Text = "", Width = 0}; _sourceBooksFlow.SuspendLayout(); _sourceBooksFlow.Controls.Clear(); var bookSourcesHeader = new ListHeader() { ForeColor = Palette.TextAgainstDarkBackground, Width = 450 }; string shellSourceHeading = LocalizationManager.GetString("CollectionTab.SourcesForNewShellsHeading", "Sources For New Shells"); string bookSourceHeading = LocalizationManager.GetString("CollectionTab.BookSourceHeading", "Sources For New Books"); bookSourcesHeader.Label.Text = _model.IsShellProject ? shellSourceHeading : bookSourceHeading; // Don't truncate the heading: see https://jira.sil.org/browse/BL-250. if (bookSourcesHeader.Width < bookSourcesHeader.Label.Width) bookSourcesHeader.Width = bookSourcesHeader.Label.Width; invisibleHackPartner = new Label() {Text = "", Width = 0}; _sourceBooksFlow.Controls.Add(invisibleHackPartner); _sourceBooksFlow.Controls.Add(bookSourcesHeader); _sourceBooksFlow.SetFlowBreak(bookSourcesHeader, true); foreach (BookCollection collection in collections.Skip(1)) { if (_sourceBooksFlow.Controls.Count > 0) _sourceBooksFlow.SetFlowBreak(_sourceBooksFlow.Controls[_sourceBooksFlow.Controls.Count - 1], true); int indexForHeader = _sourceBooksFlow.Controls.Count; if (LoadOneCollection(collection, _sourceBooksFlow)) { //without this guy, the FLowLayoutPanel uses the height of a button, on *the next row*, for the height of this row! invisibleHackPartner = new Label() {Text = "", Width = 0}; _sourceBooksFlow.Controls.Add(invisibleHackPartner); _sourceBooksFlow.Controls.SetChildIndex(invisibleHackPartner, indexForHeader); //We showed at least one book, so now go back and insert the header var collectionHeader = new Label() { Text = L10NSharp.LocalizationManager.GetDynamicString("Bloom", "CollectionTab." + collection.Name, collection.Name), Size = new Size(_sourceBooksFlow.Width - 20, 20), ForeColor = Palette.TextAgainstDarkBackground, Padding = new Padding(10, 0, 0, 0) }; collectionHeader.Margin = new Padding(0, 10, 0, 0); collectionHeader.Font = _headerFont; _sourceBooksFlow.Controls.Add(collectionHeader); _sourceBooksFlow.Controls.SetChildIndex(collectionHeader, indexForHeader + 1); _sourceBooksFlow.SetFlowBreak(collectionHeader, true); } } AddFinalLinks(); _sourceBooksFlow.ResumeLayout(); }
/// <summary> /// the primary could as well be called "the one editable collection"... the one at the top /// </summary> private void LoadPrimaryCollectionButtons() { _primaryCollectionReloadPending = false; _primaryCollectionFlow.SuspendLayout(); _primaryCollectionFlow.Controls.Clear(); //without this guy, the FLowLayoutPanel uses the height of a button, on *the next row*, for the height of this row! var invisibleHackPartner = new Label() {Text = "", Width = 0}; _primaryCollectionFlow.Controls.Add(invisibleHackPartner); var primaryCollectionHeader = new ListHeader() {ForeColor = Palette.TextAgainstDarkBackground}; primaryCollectionHeader.Label.Text = _model.VernacularLibraryNamePhrase; primaryCollectionHeader.AdjustWidth(); _primaryCollectionFlow.Controls.Add(primaryCollectionHeader); //_primaryCollectionFlow.SetFlowBreak(primaryCollectionHeader, true); _primaryCollectionFlow.Controls.Add(_menuTriangle);//NB: we're using a picture box instead of a button because the former can have transparency. LoadOneCollection(_model.GetBookCollections().First(), _primaryCollectionFlow); _primaryCollectionFlow.ResumeLayout(); }