public BlockNavigatorViewModel(Project project, BlocksToDisplay mode, BookBlockIndices startingIndices, ProjectSettingsViewModel settingsViewModel = null) { m_project = project; m_project.QuoteParseCompleted += HandleProjectQuoteParseCompleted; m_navigator = new BlockNavigator(m_project.IncludedBooks); m_includedBooks = project.IncludedBooks.Select(b => b.BookId); Versification = project.Versification; if (settingsViewModel != null) { m_font = new FontProxy(settingsViewModel.WsModel.CurrentDefaultFontName, (int)settingsViewModel.WsModel.CurrentDefaultFontSize, settingsViewModel.WsModel.CurrentRightToLeftScript); } else { m_font = new FontProxy(project.FontFamily, project.FontSizeInPoints, project.RightToLeftScript); } CacheReferenceTextFonts(project.ReferenceText); FontSizeUiAdjustment = project.FontSizeUiAdjustment; Mode = mode; if (startingIndices != null && !startingIndices.IsUndefined) { SetBlock(startingIndices); m_currentBlockIndex = m_relevantBlocks.IndexOf(startingIndices); if (m_currentBlockIndex < 0) { m_temporarilyIncludedBlock = startingIndices; } } }
private void CacheReferenceTextFonts(ReferenceText referenceText) { m_referenceTextFonts[referenceText] = new FontProxy(referenceText.FontFamily, referenceText.FontSizeInPoints, referenceText.RightToLeftScript); if (referenceText.HasSecondaryReferenceText) { CacheReferenceTextFonts(referenceText.SecondaryReferenceText); } }
public UnappliedSplitsDlg(string projectName, FontProxy fontProxy, UnappliedSplitsViewModel model) { m_projectName = projectName; m_font = fontProxy; m_model = model; InitializeComponent(); HandleStringsLocalized(); LocalizeItemDlg <TMXDocument> .StringsLocalized += HandleStringsLocalized; m_browser.Disposed += Browser_Disposed; }
public UnappliedSplitsDlg(string projectName, FontProxy fontProxy, IEnumerable <BookScript> books) { m_projectName = projectName; m_books = books; m_font = fontProxy; InitializeComponent(); HandleStringsLocalized(); LocalizeItemDlg.StringsLocalized += HandleStringsLocalized; m_browser.Disposed += Browser_Disposed; }
public void Initialize(BlockNavigatorViewModel viewModel) { m_colReference = (DataGridViewTextBoxColumn)Columns[0]; m_colText = (DataGridViewTextBoxColumn)Columns.GetLastColumn(DataGridViewElementStates.Visible, DataGridViewElementStates.None); Debug.Assert(m_colReference != null); Debug.Assert(m_colText != null); m_viewModel = viewModel; m_originalDefaultFont = new FontProxy(DefaultCellStyle.Font); SetFontsFromViewModel(); m_minimumWidthFromDesigner = MinimumSize.Width; SizeRefColumnForCurrentBook(); m_viewModel.CurrentBlockChanged += CurrentBlockChanged; m_viewModel.UiFontSizeChanged += HandleUiFontSizeChanged; }
public void Dispose() { if (m_project != null) { m_project.FontSizeUiAdjustment = FontSizeUiAdjustment; m_project.QuoteParseCompleted -= HandleProjectQuoteParseCompleted; } if (m_font != null) { m_font.Dispose(); m_font = null; } foreach (var fontProxy in m_referenceTextFonts.Values) { fontProxy.Dispose(); } m_referenceTextFonts.Clear(); }
public SplitBlockDlg(FontProxy fontProxy, IEnumerable <Block> originalBlocks, IEnumerable <AssignCharacterViewModel.Character> charactersForCurrentReference, string currentBookId) { m_font = fontProxy; m_originalBlocks = originalBlocks.ToList(); m_characters = charactersForCurrentReference; foreach (var block in m_originalBlocks) { if (block.BookCode == null) { block.BookCode = currentBookId; } } InitializeComponent(); m_blocksDisplayBrowser.Disposed += BlocksDisplayBrowser_Disposed; }