Exemplo n.º 1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="EditorialChecksControl"/> class.
		/// </summary>
		/// <param name="cache">The cache.</param>
		/// <param name="bookFilter">The book filter.</param>
		/// <param name="sCaption">The caption to use when this control is displayed as a
		/// floating window</param>
		/// <param name="sProject">The name of the current project</param>
		/// <param name="tmAdapter">TMAdapter for the main window</param>
		/// ------------------------------------------------------------------------------------
		public EditorialChecksControl(FdoCache cache, FilteredScrBooks bookFilter,
			string sCaption, string sProject, ITMAdapter tmAdapter)
			: base(sCaption, sProject)
		{
			InitializeComponent();

			lblCheckName.Text = string.Empty;

			m_dxButtonGap = m_btnApplyFilter.Left - m_btnRunChecks.Right;
			m_dyButtonGap = pnlButtons.Padding.Top;
			m_buttonPanelHeight1 = pnlButtons.Height;
			m_buttonPanelHeight2 = m_buttonPanelHeight1 + m_btnRunChecks.Height + m_dyButtonGap;
			m_buttonPanelHeight3 = m_buttonPanelHeight2 + m_btnRunChecks.Height + m_dyButtonGap;

			// It's important to subscribe to this event after the previous three
			// heights are saved. Therefore, this event should not be subscribed
			// to in designer (i.e. InitializeComponent()). This fixes TE-6653.
			pnlButtons.ClientSizeChanged += pnlButtons_ClientSizeChanged;

			m_cache = cache;
			m_chkDataSource = new ScrChecksDataSource(cache);

			m_bookFilter = bookFilter;
			m_bookFilter.CheckFilteredBooks();
			m_bookFilter.FilterChanged += OnBookFilterChanged;
			Content = pnlOuter;
			CreateCheckingToolbar(tmAdapter);
			m_nodeTip = new ToolTip();

			m_ComboBox.HideDropDownWhenComboTextChanges = false;

			// Set the minimum allowable with for the
			// control will be based on the widest button.
			int minWidth = m_btnRunChecks.Width;
			minWidth = Math.Max(minWidth, m_btnApplyFilter.Width);
			MinimumSize = new Size(Math.Max(minWidth, m_btnHelp.Width), MinimumSize.Height);

			m_chkHelpIds = new Dictionary<Guid, string>();
			m_chkHelpIds[StandardCheckIds.kguidCharacters] = "khtpScrChecksCharacters";
			m_chkHelpIds[StandardCheckIds.kguidChapterVerse] = "khtpScrChecksChapterVerse";
			m_chkHelpIds[StandardCheckIds.kguidMixedCapitalization] = "khtpScrChecksMixedCapitalization";
			m_chkHelpIds[StandardCheckIds.kguidRepeatedWords] = "khtpScrChecksRepeatedWords";
			m_chkHelpIds[StandardCheckIds.kguidMatchedPairs] = "khtpScrChecksMatchingPunctPairs";
			m_chkHelpIds[StandardCheckIds.kguidPunctuation] = "khtpScrChecksPunctuationPatterns";
			m_chkHelpIds[StandardCheckIds.kguidQuotations] = "khtpScrChecksQuotationMarks";
			m_chkHelpIds[StandardCheckIds.kguidCapitalization] = "khtpScrChecksCapitalization";

			if (tmAdapter != null)
			{
				if (tmAdapter.MessageMediator != null)
					tmAdapter.MessageMediator.AddColleague(this);

				tmAdapter.SetContextMenuForControl(this, "cmnuEditorialChecksTree");
			}
		}
Exemplo n.º 2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Applies the book filter and creates divisions.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected virtual void ApplyBookFilterAndCreateDivisions()
		{
			m_bookFilter = FilteredScrBooks.GetFilterInstance(m_cache, m_filterInstance);
			m_bookFilter.FilterChanged += new EventHandler(OnBookFilterChanged);
			m_bookFilter.CheckFilteredBooks();
			AddDivisionsForBooks();
		}