Exemplo n.º 1
0
//		private decimal m_standardLeadingFactor;
        #endregion

        #region Constructor
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="T:TePageSetupDlg"/> class.
        /// </summary>
        /// <param name="pgLayout">The page layout.</param>
        /// <param name="scr">The Scripture object (which owns the publications).</param>
        /// <param name="publication">The publication.</param>
        /// <param name="division">The division. The NumberOfColumns in the division should be
        /// set before calling this dialog.</param>
        /// <param name="teMainWnd">TE main window (provides callbacks).</param>
        /// <param name="helpTopicProvider">The help topic provider.</param>
        /// <param name="app">The app.</param>
        /// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog
        /// was brought up is Trial Publication view.</param>
        /// <param name="pubPageSizes">The page sizes available for publication.</param>
        /// ------------------------------------------------------------------------------------
        public TePageSetupDlg(IPubPageLayout pgLayout, IScripture scr,
                              IPublication publication, IPubDivision division, IPageSetupCallbacks teMainWnd,
                              IHelpTopicProvider helpTopicProvider, IApp app, bool fIsTrialPub,
                              List <PubPageInfo> pubPageSizes) :
            base(pgLayout, scr, publication, division, teMainWnd, helpTopicProvider,
                 app, pubPageSizes)
        {
            m_fIsTrialPublication = fIsTrialPub;
//			if (!m_chkNonStdChoices.Checked) // following the standard
//				m_standardLeadingFactor = m_nudLineSpacing.Value / m_nudBaseCharSize.Value;
        }
Exemplo n.º 2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:TePageSetupDlg"/> class.
		/// </summary>
		/// <param name="wsUser">The user writing system.</param>
		/// <param name="pgLayout">The page layout.</param>
		/// <param name="scr">The Scripture object (which owns the publications).</param>
		/// <param name="publication">The publication.</param>
		/// <param name="division">The division. The NumberOfColumns in the division should be
		/// set before calling this dialog.</param>
		/// <param name="teMainWnd">TE main window (provides callbacks).</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// <param name="units">The user's prefered measurement units.</param>
		/// <param name="fIsTrialPub">if set to <c>true</c> view from which this dialog
		/// was brought up is Trial Publication view.</param>
		/// <param name="pubPageSizes">The page sizes available for publication.</param>
		/// ------------------------------------------------------------------------------------
		public TePageSetupDlg(int wsUser, IPubPageLayout pgLayout, IScripture scr,
			IPublication publication, IPubDivision division, IPageSetupCallbacks teMainWnd,
			IHelpTopicProvider helpTopicProvider, MsrSysType units, bool fIsTrialPub,
			List<PubPageInfo> pubPageSizes) :
			base(wsUser, pgLayout, scr, publication, division, teMainWnd, helpTopicProvider,
				units, pubPageSizes)
		{
			m_fIsTrialPublication = fIsTrialPub;
			if (!m_chkNonStdChoices.Checked) // following the standard
				m_standardLeadingFactor = m_nudLineSpacing.Value / m_nudBaseCharSize.Value;
		}
Exemplo n.º 3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:PageSetupDlg"/> class.
		/// </summary>
		/// <param name="pgLayout">The page layout.</param>
		/// <param name="pubOwner">The CmMajorObject that owns the publication.</param>
		/// <param name="publication">The publication.</param>
		/// <param name="division">The division. The NumColumns in the division should be
		/// set before calling this dialog.</param>
		/// <param name="callbacks">The callbacks used to get application-specific settings.</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// <param name="app">The app</param>
		/// <param name="pubPageSizes">The page sizes available for publication.</param>
		/// ------------------------------------------------------------------------------------
		public PageSetupDlg(IPubPageLayout pgLayout, ICmMajorObject pubOwner,
			IPublication publication, IPubDivision division, IPageSetupCallbacks callbacks,
			IHelpTopicProvider helpTopicProvider, IApp app, List<PubPageInfo> pubPageSizes) : this()
		{
			m_pubOwner = pubOwner;
			m_publication = publication;
			m_division = division;
			m_pgLayout = pgLayout;
			m_callbacks = callbacks;
			m_helpTopicProvider = helpTopicProvider;
			m_app = app;

			InitializePaperSizes();

			MsrSysType units = app.MeasurementSystem;
			m_udmTop.MeasureType = units;
			m_udmLeft.MeasureType = units;
			m_udmBottom.MeasureType = units;
			m_udmRight.MeasureType = units;
			m_udmGutter.MeasureType = units;
			m_udmPaperWidth.MeasureType = units;
			m_udmPaperWidth.UseVariablePrecision = true;
			m_udmPaperHeight.MeasureType = units;
			m_udmPaperHeight.UseVariablePrecision = true;
			m_udmHeader.MeasureType = units;
			m_udmFooter.MeasureType = units;

			m_udmTop.MeasureValue = pgLayout.MarginTop;
			m_udmLeft.MeasureValue = pgLayout.MarginInside;
			m_udmBottom.MeasureValue = pgLayout.MarginBottom;
			m_udmRight.MeasureValue = pgLayout.MarginOutside;
			m_udmGutter.MeasureValue = publication.GutterMargin;

			//REVIEW: Do we need to call UpdateMarginControls?
			m_numColumns = m_division.NumColumns;

			m_fBookFoldCurrent = publication.IsLandscape;

			//if (m_fBookFoldCurrent)
			//{
			//    pbBookFold.Image = ResourceHelper.BookFoldSelectedIcon;
			//    pbDraft.Image = ResourceHelper.PortraitIcon;
			//    pnlDraftOptions.Visible = false;
			//    pnlBookFoldOptions.Visible = true;

			//}
			//else // Draft
			//{
			//    pbBookFold.Image = ResourceHelper.BookFoldIcon;
			//    pbDraft.Image = ResourceHelper.PortraitSelectedIcon;
			//    pnlDraftOptions.Visible = true;
			//    pnlBookFoldOptions.Visible = false;
			//}

			//rdoSingleSide.Checked = true;
			//rdoDoubleSide.Checked = false;

			if (pubPageSizes != null && pubPageSizes.Count > 0)
			{
				cboPubPageSize.Items.Clear();
				foreach (PubPageInfo pubPgInfo in pubPageSizes)
				{
					cboPubPageSize.Items.Add(pubPgInfo);
					if (publication.PageHeight == pubPgInfo.Height &&
						publication.PageWidth == pubPgInfo.Width)
					{
						cboPubPageSize.SelectedItem = pubPgInfo;
					}
				}
			}
			else
				cboPubPageSize.SelectedIndex = 0;

			int mptPaperHeight = publication.PaperHeight;
			int mptPaperWidth = publication.PaperWidth;
			if (mptPaperHeight == 0)
			{
				m_fSavePaperSize = false;
				Debug.Assert(mptPaperWidth == 0);
				PrinterUtils.GetDefaultPaperSizeInMp(out mptPaperHeight, out mptPaperWidth);
			}
			else
				m_fSavePaperSize = true;

			// Find the paper size in the combo box.
			foreach (PaperSize size in cbPaperSize.Items)
			{
				if (size.Height * kCentiInchToMilliPoints == mptPaperHeight &&
					size.Width * kCentiInchToMilliPoints == mptPaperWidth)
				{
					cbPaperSize.SelectedItem = size;
				}
			}

			m_udmPaperWidth.MeasureValue = mptPaperWidth;
			m_udmPaperHeight.MeasureValue = mptPaperHeight;
			AdjustPaperSize(mptPaperWidth, mptPaperHeight);

			foreach (PubPageInfo pubPgInfo in cboPubPageSize.Items)
			{
				if (pubPgInfo.Height == m_publication.PageHeight &&
					pubPgInfo.Width == m_publication.PageWidth)
				{
					cboPubPageSize.SelectedItem = pubPgInfo;
					break;
				}
			}

			m_cbBookStart.SelectedIndex = (int)m_division.StartAt;
			m_ckbDiffEvenHF.Checked = m_division.DifferentEvenHF;
			m_ckbDiffFirstHF.Checked = m_division.DifferentFirstHF;
			m_udmHeader.MeasureValue = pgLayout.PosHeader;
			m_udmFooter.MeasureValue = pgLayout.PosFooter;
			switch (publication.FootnoteSepWidth)
			{
				case 0:
					m_cboSeparator.SelectedIndex = kFootnoteSepWidthNone;
					break;
				case 333:
					m_cboSeparator.SelectedIndex = kFootnoteSepWidthThird;
					break;
				case 1000:
					m_cboSeparator.SelectedIndex = kFootnoteSepWidthFull;
					break;
				default:
					Debug.Assert(false, "non-default footnote seperator width");
					m_cboSeparator.SelectedIndex = -1;
					break;
			}

			m_fChangingIndex = false;

			// Initialize dialog settings from the publication.
			NumberOfColumns = m_division.NumColumns;
			UpdateColumnButtonStates();

			SetFontSizeAndLineSpacing = true;
			if (PublicationUsesNormalStyle)
			{
				SetDefaultBaseFontAndLineSizes();
			}
			else
			{
				// In the unlikely event that the publication has a default value for one but not
				// both of these values, set the leading to the default percentage and set the
				// implicit value based on the explicit one.

				// Use the absolute value because we only support "exact" line spacing
				decimal mptPubBaseLineSpacing = (decimal)Math.Abs(publication.BaseLineSpacing);
				m_leadingFactor = (publication.BaseFontSize == 0 || publication.BaseLineSpacing == 0) ?
					StandardLeadingFactor : mptPubBaseLineSpacing / publication.BaseFontSize;

				SetBaseCharacterSize(publication.BaseFontSize);
				SetBaseLineSpacing(mptPubBaseLineSpacing);
				if (publication.BaseFontSize == 0)
					SetBaseCharacterSize(BaseLineSpacing / m_leadingFactor);
				else if (publication.BaseLineSpacing == 0)
					SetBaseLineSpacing(BaseCharacterSize * m_leadingFactor);

				m_fSaveBaseFontAndLineSizes = true;
			}
			SetFontSizeAndLineSpacing = false;

			m_chkNonStdChoices.Checked = !FollowsStandardSettings;
			UpdateTextSizeCtlStatus();
		}