This is the small view that the Header/Footer setup dialog uses to display the header or footer previews
Inheritance: SIL.FieldWorks.Common.RootSites.SimpleRootSite
Beispiel #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Replaces all the header/footer panels with HFSetView's initialized with the correct
        /// H/F info
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void ReplacePanelsWithHFSetViews()
        {
            IPubHFSet hfSet = CurrentHFSet;

            m_hfsvFirstTop    = MakeHFSetView(m_pnlFirstTop, hfSet.FirstHeaderOA, 1);
            m_hfsvFirstBottom = MakeHFSetView(m_pnlFirstBottom, hfSet.FirstFooterOA, 1);
            m_hfsvEvenTop     = MakeHFSetView(m_pnlEvenTop, hfSet.EvenHeaderOA, 2);
            m_hfsvEvenBottom  = MakeHFSetView(m_pnlEvenBottom, hfSet.EvenFooterOA, 2);
            m_hfsvOddTop      = MakeHFSetView(m_pnlOddTop, hfSet.DefaultHeaderOA, 3);
            m_hfsvOddBottom   = MakeHFSetView(m_pnlOddBottom, hfSet.DefaultFooterOA, 3);
        }
Beispiel #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates a header/footer set view for the given information.
        /// </summary>
        /// <param name="pnl"></param>
        /// <param name="toDisplay"></param>
        /// <param name="pageNum"></param>
        /// ------------------------------------------------------------------------------------
        private HFSetView MakeHFSetView(Panel pnl, IPubHeader toDisplay, int pageNum)
        {
            HFDialogsPageInfo info = new HFDialogsPageInfo(m_pub.IsLeftBound);

            info.PageNumber = pageNum;
            HFSetupDlgVC vc   = new HFSetupDlgVC(info, m_cache.DefaultVernWs, DateTime.Now, m_cache);
            HFSetView    view = new HFSetView(m_cache.MainCacheAccessor, vc, toDisplay.Hvo);

            view.Dock = DockStyle.Fill;
            pnl.Controls.Add(view);
            return(view);
        }
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Replaces all the header/footer panels with HFSetView's initialized with the correct
		/// H/F info
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void ReplacePanelsWithHFSetViews()
		{
			IPubHFSet hfSet = CurrentHFSet;

			m_hfsvFirstTop = MakeHFSetView(m_pnlFirstTop, hfSet.FirstHeaderOA, 1);
			m_hfsvFirstBottom = MakeHFSetView(m_pnlFirstBottom, hfSet.FirstFooterOA, 1);
			m_hfsvEvenTop = MakeHFSetView(m_pnlEvenTop, hfSet.EvenHeaderOA, 2);
			m_hfsvEvenBottom = MakeHFSetView(m_pnlEvenBottom, hfSet.EvenFooterOA, 2);
			m_hfsvOddTop = MakeHFSetView(m_pnlOddTop, hfSet.DefaultHeaderOA, 3);
			m_hfsvOddBottom = MakeHFSetView(m_pnlOddBottom, hfSet.DefaultFooterOA, 3);
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates a header/footer set view for the given information.
		/// </summary>
		/// <param name="pnl"></param>
		/// <param name="toDisplay"></param>
		/// <param name="pageNum"></param>
		/// ------------------------------------------------------------------------------------
		private HFSetView MakeHFSetView(Panel pnl, IPubHeader toDisplay, int pageNum)
		{
			HFDialogsPageInfo info = new HFDialogsPageInfo(m_pub.IsLeftBound);
			info.PageNumber = pageNum;
			HFSetupDlgVC vc = new HFSetupDlgVC(info,
				m_cache.DefaultVernWs, DateTime.Now, m_cache);
			HFSetView view = new HFSetView(m_cache.DomainDataByFlid, vc, toDisplay.Hvo);
			view.Dock = DockStyle.Fill;
			pnl.Controls.Add(view);
			return view;
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create the dialog for modifying headers and footers
		/// </summary>
		/// <param name="cache">the cache</param>
		/// <param name="curHFSet">publication header/footer set</param>
		/// <param name="pub">publication (used to determine if the publication is right-bound
		/// or left-bound to determine placement of objects and dialog labels in dialog</param>
		/// <param name="helpProvider">provides context-senstive help for this dialog</param>
		/// ------------------------------------------------------------------------------------
		public HeaderFooterModifyDlg(FdoCache cache, IPubHFSet curHFSet, IPublication pub,
			IHelpTopicProvider helpProvider)
		{
			m_caches = new CachePair();
			m_caches.MainCache = cache;
			m_caches.CreateSecCache();
			m_curHFSet = curHFSet;
			m_pub = pub;
			m_helpProvider = helpProvider;
			LoadRealDataIntoSec();

			InitializeComponent();

			m_innerHeaderText = m_lblLeftHeader.Text;
			m_innerFooterText = m_lblLeftFooter.Text;
			m_outerHeaderText = m_lblRightHeader.Text;
			m_outerFooterText = m_lblRightFooter.Text;

			ChangePanelsToViews();
			m_lastFocusedView = m_hfsvHeader;
			m_txtBoxDescription.Text = m_curHFSet.Description.Text;
			m_txtBoxName.Text = m_curHFSet.Name;
			UpdateOKButton();
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Stores the last view that had focus.  This allows us to refer to that view when
		/// inserting text into a selection
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void view_LostFocus(object sender, EventArgs e)
		{
			m_lastFocusedView = sender as HFSetView;
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing"></param>
		/// ------------------------------------------------------------------------------------
		protected override void Dispose( bool disposing )
		{
			System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
				if (m_caches != null)
					m_caches.Dispose();
				if (m_hfsvHeader != null)
					m_hfsvHeader.Dispose();
				if (m_hfsvFooter != null)
					m_hfsvFooter.Dispose();
			}
			m_lastFocusedView = null;
			m_hfsvHeader = null;
			m_hfsvFooter = null;

			base.Dispose( disposing );
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Changes a header/footer panel to be a HFSetView with the correct info
		/// </summary>
		/// <param name="pan"></param>
		/// <param name="hvoToDisplay"></param>
		/// ------------------------------------------------------------------------------------
		private HFSetView ChangePanelToView(Panel pan, int hvoToDisplay)
		{
			HFDialogsPageInfo info = new HFDialogsPageInfo(m_pub.IsLeftBound);
			info.PageNumber = 1;
			HFModifyDlgVC vc = new HFModifyDlgVC(info,
				m_caches.MainCache.DefaultVernWs,
				DateTime.Now, m_caches.MainCache);
			HFSetView view = new HFSetView(m_caches.DataAccess, vc, hvoToDisplay);
			view.MakeRoot();
			view.Dock = DockStyle.Fill;
			view.LostFocus += new EventHandler(view_LostFocus);
			pan.Controls.Add(view);
			return view;
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Changes all the header/footer panels to be a HFSetView with the correct info
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void ChangePanelsToViews()
		{
			m_hfsvHeader = ChangePanelToView(m_pnlHeader, m_hvoFirstHeaderSec);
			m_hfsvFooter = ChangePanelToView(m_pnlFooter, m_hvoFirstFooterSec);
		}