예제 #1
0
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				// Do as early as possible, we don't want to do more spell checking while being disposed.
				Application.Idle -= new EventHandler(Application_Idle);
				// Do this here, before disposing m_messageSequencer,
				// as we still get messages during dispose.
				// Once the the base class has shut down the window handle,
				// we are good to go on.
				// If we find we getting messages during this call,
				// we will be forced to call DestroyHandle() first.
				// That is done part way through the base method code,
				// but it may not be soon enough, for all the re-entrant events
				// that keep showing up.
				DestroyHandle();
			}

			base.Dispose(disposing);

			if (disposing)
			{
				if (m_rootb != null)
					CloseRootBox();

				if (g_focusRootSite == this)
					g_focusRootSite = null;
				if (m_Timer != null)
				{
					m_Timer.Stop();
					m_Timer.Tick -= new EventHandler(OnTimer);
					m_Timer.Dispose();
				}

				// Remove the filter when we are disposed now.
				if (m_messageFilterInstalled)
				{
					Application.RemoveMessageFilter(this);
					m_messageFilterInstalled = false;
				}

				if (m_editingHelper != null)
					m_editingHelper.Dispose();
				if (m_messageSequencer != null)
					m_messageSequencer.Dispose();
				if (m_graphicsManager != null)
				{
					// Uninit() first in case we're in the middle of displaying something.  See LT-7365.
					m_graphicsManager.Uninit();
					m_graphicsManager.Dispose();
				}
				if (components != null)
					components.Dispose();
			}

			if (m_vdrb != null && Marshal.IsComObject(m_vdrb))
				Marshal.ReleaseComObject(m_vdrb);
			m_vdrb = null;
			if (m_styleSheet != null && Marshal.IsComObject(m_styleSheet))
				Marshal.ReleaseComObject(m_styleSheet);
			m_rootb = null;
			m_styleSheet = null;
			m_graphicsManager = null;
			m_editingHelper = null;
			m_Timer = null;
			m_mediator = null;
			m_wsf = null;
			m_styleSheet = null;
			m_savedSelection = null;
			m_messageSequencer = null;

			// Don't do it here.
			//base.Dispose( disposing );

			m_fDisposed = true;
		}
예제 #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Destroy all divisions and pages
		/// </summary>
		/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources;
		/// <c>false</c> to release only unmanaged resources.</param>
		/// ------------------------------------------------------------------------------------
		protected override void Dispose(bool disposing)
		{
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if( disposing )
			{
				if(components != null)
					components.Dispose();

				// Even if disposing is false, we still dispose of our pages and and divisions
				// to force their rootboxes to close.
				// NOTE from RandyR: No. If it is false,
				// then the other disposable stuff may have been finalized already,
				// and accessing those kinds of objects will throw exceptions.
				DisposePages();	// also calls m_pages.Clear();

				if (m_divisions != null)
				{
					foreach (DivisionLayoutMgr div in m_divisions)
						div.Dispose();
				}
				if (m_divisions != null)
					m_divisions.Clear();

				if (m_editingHelper != null)
					m_editingHelper.Dispose();

				if (m_sharedStreams != null)
				{
					foreach (IVwRootBox rootb in m_sharedStreams)
						rootb.Close();
				}

				if (m_screenGraphics != null)
					m_screenGraphics.Dispose();
				if (m_printerGraphics != null)
					m_printerGraphics.Dispose();
				if (m_Timer != null)
					m_Timer.Dispose();
			}
			m_divisions = null;
			m_sharedStreams = null;
			components = null;
			m_editingHelper = null;
			m_screenGraphics = null;
			m_printerGraphics = null;
			m_Timer = null;

			base.Dispose(disposing);
		}
예제 #3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public SimpleRootSite()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			m_dxdLayoutWidth = kForceLayout; // Unlikely to be real current window width!
			m_wsPending = -1;
			BackColor = SystemColors.Window;
			//AllowScrolling = true;
			m_messageSequencer = new MessageSequencer(this);
			m_graphicsManager = CreateGraphicsManager();
			m_orientationManager = CreateOrientationManager();
		}
예제 #4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="PublicationControl"/> class with
		/// no divisions.
		/// </summary>
		/// <param name="stylesheet">The stylesheet.</param>
		/// <param name="publication">The publication that this PublicationControl gets
		/// it's information from (or null to keep the defaults)</param>
		/// <param name="printDateTime">The print date time.</param>
		/// <param name="fApplyStyleOverrides">if set to <c>true</c>, apply style overrides.</param>
		/// <param name="fUniformLineSpacing">if set to <c>true</c> apply uniform line spacing,
		/// rather than proportional spacing.</param>
		/// ------------------------------------------------------------------------------------
		public PublicationControl(FwStyleSheet stylesheet, IPublication publication,
			DateTime printDateTime, bool fApplyStyleOverrides, bool fUniformLineSpacing)
		{
			m_origStylesheet = stylesheet;
			if (publication != null) // Can be null in tests
				m_cache = publication.Cache;
			m_publication = publication;
			m_printDateTime = printDateTime;
			m_fApplyStyleOverrides = fApplyStyleOverrides;
			m_fUniformLineSpacing = fUniformLineSpacing;

			AutoScroll = true;
			BackColor = SystemColors.Window;
			components = new System.ComponentModel.Container();
			m_Timer = new Timer(this.components);
			m_sequencer = new MessageSequencer(this);

			SetInfoFromDB();

			PrinterUtils.GetDefaultPrinterDPI(out m_printerDpiX, out m_printerDpiY);
			m_screenGraphics = new GraphicsManager(this);
			m_printerGraphics = new GraphicsManager(this);

			// If view overrides the stylesheet
			if (fApplyStyleOverrides)
			{
				m_origStylesheet.InitStylesheet += new EventHandler(OnInitOriginalStylesheet);

				ApplyPubOverrides();
			}
			else
				m_stylesheet = m_origStylesheet;
		}