public override void MakeRoot() { CheckDisposed(); base.MakeRoot(); if (m_fdoCache == null || DesignMode) { return; } IVwRootBox rootb = VwRootBoxClass.Create(); rootb.SetSite(this); m_vc = new LiteralLabelVc(m_text, m_fdoCache.WritingSystemFactory.UserWs); rootb.DataAccess = m_fdoCache.DomainDataByFlid; // Since the VC just displays a literal, both the root HVO and the root frag are arbitrary. rootb.SetRootObject(1, m_vc, 2, StyleSheet); m_rootb = rootb; // pathologically (mainly during Refresh, it seems) the slice width may get set before // the root box is created, and no further size adjustment may take place, in which case, // when we have made the root, we need to adjust the width it occupies in the parent slice. m_slice.AdjustMainViewWidth(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ private void Init(PrintPageEventArgs e) { #if false long x1 = System.DateTime.Now.Ticks; #endif // Set these now because the Graphics object will be locked below. m_rcDst = m_rcSrc = new Rect(0, 0, (int)e.Graphics.DpiX, (int)e.Graphics.DpiY); m_dxpAvailWidth = PixelsFrom100ths(e.MarginBounds.Width, (int)e.Graphics.DpiX); // Create and initialize a print context. m_vwPrintContext = VwPrintContextWin32Class.Create(); // TODO: When we provide a way for the user to specify the nFirstPageNo (i.e. the // first argument to SetPagePrintInfo), then change the arguments to // SetPagePrintInfo. m_vwPrintContext.SetPagePrintInfo(1, 1, 65535, 1, false); SetMargins(e); IVwGraphics vwGraphics = VwGraphicsWin32Class.Create(); IntPtr hdc = IntPtr.Zero; try { // Get the printer's hdc and use it to initialize other stuff. hdc = e.Graphics.GetHdc(); ((IVwGraphicsWin32)vwGraphics).Initialize(hdc); m_vwPrintContext.SetGraphics(vwGraphics); // Make a rootbox for printing and initialize it. m_rootb = VwRootBoxClass.Create(); m_rootb.SetSite(this); m_rootb.DataAccess = m_sda; m_rootb.SetRootObject(m_hvo, m_vc, m_frags, m_styleSheet); m_rootb.InitializePrinting(m_vwPrintContext); m_totalNumberOfPages = m_rootb.GetTotalPrintPages(m_vwPrintContext, null); m_psettings = e.PageSettings.PrinterSettings; SetPrintRange(); } catch { m_rootb = null; string errorMsg = ResourceHelper.GetResourceString("kstidErrorCreatingPrintRootSite"); // TODO: Add the help file and url when we have a help file. MessageBox.Show(errorMsg, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (hdc != IntPtr.Zero) { vwGraphics.ReleaseDC(); e.Graphics.ReleaseHdc(hdc); } } #if false long x2 = System.DateTime.Now.Ticks; Debug.WriteLine("PrintRootSite.Init() took " + DeltaTime(x1, x2) + " seconds."); #endif }
public override void MakeRoot(IVwGraphics vg, ILgEncodingFactory encfParam, out IVwRootBox rootbParam) { rootbParam = null; // JohnT: this is a convenient though somewhat unconventional place to create and partly // initialize the combo box. We can't set its position yet, as that depends on what the user // clicks. Nor do we yet add it to our list of windows, nor make it visible. typeComboBox = new System.Windows.Forms.ComboBox(); typeComboBox.Items.AddRange(new object[] { "sal", "noun", "verb", "det", "adj", "adv" }); typeComboBox.DropDownWidth = 280; // Todo JohnT: make right for showing all options typeComboBox.SelectedValueChanged += new EventHandler(this.HandleComboSelChange); base.MakeRoot(vg, encfParam, out rootbParam); if (m_fdoCache == null || DesignMode) { return; } IVwRootBox rootb = (IVwRootBox) new FwViews.VwRootBoxClass(); rootb.SetSite(this); int hvoRoot = khvoText; // Set up sample data (not in the database for now) ITsStrFactory tsf = (ITsStrFactory) new FwKernelLib.TsStrFactoryClass(); int encEng = 0; // TODO: Implement StrUtil::ParseEnc string[] words = { "Hello", "world!", "This", "is", "an", "interlinear", "view" }; string[] wordtypes = { "sal", "noun", "det", "verb", "det", "adj", "noun" }; int[] rghvoWords = new int[(words.Length)]; for (int i = 0; i < words.Length; ++i) { ITsString tss = tsf.MakeString(words[i], encEng); // Use i+1 as the HVO for the word objects. Avoid using 0 as an HVO m_fdoCache.VwCacheDaAccessor.CacheStringProp(i + 1, ktagWord_Form, tss); tss = tsf.MakeString(wordtypes[i], encEng); // Use i+1 as the HVO for the word objects. Avoid using 0 as an HVO m_fdoCache.VwCacheDaAccessor.CacheStringProp(i + 1, ktagWord_Type, tss); rghvoWords[i] = i + 1; } m_fdoCache.VwCacheDaAccessor.CacheVecProp(khvoText, ktagText_Words, rghvoWords, rghvoWords.Length); int frag = kfrText; m_iVc = new InterlinearVc(); if (encfParam != null) { m_fdoCache.MainCacheAccessor.set_EncodingFactory(encfParam); } rootb.set_DataAccess(m_fdoCache.MainCacheAccessor); rootb.SetRootObject(hvoRoot, m_iVc, frag, null); rootbParam = rootb; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Override this method in your subclass. /// It should make a root box and initialize it with appropriate data and /// view constructor, etc. /// </summary> /// ------------------------------------------------------------------------------------ public override void MakeRoot() { CheckDisposed(); base.MakeRoot(); if (m_fdoCache == null || DesignMode) { return; } IVwRootBox rootb = VwRootBoxClass.Create(); rootb.SetSite(this); bool fEditable = XmlUtils.GetOptionalBooleanAttributeValue(m_xnSpec, "editable", true); string toolName = m_mediator.PropertyTable.GetStringProperty("currentContentControl", null); m_fShowFailingItems = m_mediator.PropertyTable.GetBoolProperty("ShowFailingItems-" + toolName, false); //m_xmlVc = new XmlVc(m_xnSpec, StringTbl); // possibly reinstate for old approach? // Note: we want to keep this logic similar to RecordDocView.GetLayoutName(), except that here // we do NOT want to use the layoutSuffix, though it may be specified so that it can be // used when the configure dialog handles a shared view. string sLayout = null; string sProp = XmlUtils.GetOptionalAttributeValue(m_xnSpec, "layoutProperty", null); if (!String.IsNullOrEmpty(sProp)) { sLayout = m_mediator.PropertyTable.GetStringProperty(sProp, null); } if (String.IsNullOrEmpty(sLayout)) { sLayout = XmlUtils.GetManditoryAttributeValue(m_xnSpec, "layout"); } ISilDataAccess sda = GetSda(); m_xmlVc = new XmlVc(StringTbl, sLayout, fEditable, this, m_app, m_fShowFailingItems ? null : ItemDisplayCondition, sda) { IdentifySource = true }; ReadOnlyView = !fEditable; if (!fEditable) { rootb.MaxParasToScan = 0; } m_xmlVc.Cache = m_fdoCache; m_xmlVc.MainSeqFlid = m_mainFlid; rootb.DataAccess = sda; m_xmlVc.DataAccess = sda; rootb.SetRootObject(m_hvoRoot, m_xmlVc, RootFrag, m_styleSheet); m_rootb = rootb; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Override this method in your subclass. /// It should make a root box and initialize it with appropriate data and /// view constructor, etc. /// </summary> /// ------------------------------------------------------------------------------------ public override void MakeRoot() { CheckDisposed(); base.MakeRoot(); if (m_fdoCache == null || DesignMode) { return; } IVwRootBox rootb = VwRootBoxClass.Create(); rootb.SetSite(this); bool fEditable = XmlUtils.GetOptionalBooleanAttributeValue(m_xnSpec, "editable", true); string toolName = m_mediator.PropertyTable.GetStringProperty("currentContentControl", null); m_fShowFailingItems = m_mediator.PropertyTable.GetBoolProperty("ShowFailingItems-" + toolName, false); //m_xmlVc = new XmlVc(m_xnSpec, StringTbl); // possibly reinstate for old approach? string sLayout = null; string sProp = XmlUtils.GetOptionalAttributeValue(m_xnSpec, "layoutProperty", null); if (!String.IsNullOrEmpty(sProp)) { sLayout = m_mediator.PropertyTable.GetStringProperty(sProp, null); } if (String.IsNullOrEmpty(sLayout)) { sLayout = XmlUtils.GetManditoryAttributeValue(m_xnSpec, "layout"); } m_xmlVc = new XmlVc(StringTbl, sLayout, fEditable, this, m_fShowFailingItems ? null : ItemDisplayCondition); this.ReadOnlyView = !fEditable; if (!fEditable) { rootb.MaxParasToScan = 0; } m_xmlVc.Cache = m_fdoCache; m_xmlVc.MainSeqFlid = m_mainFlid; ISilDataAccess sda = GetSda(); rootb.DataAccess = sda; m_xmlVc.DataAccess = sda; rootb.SetRootObject(m_hvoRoot, m_xmlVc, RootFrag, m_styleSheet); m_rootb = rootb; }
/* * /// <summary> * /// Override to remove the TAB key from treatment as a normal key. * /// </summary> * /// <param name="keyData"></param> * /// <returns>false, if it is a TAB key, otherwise whatever the superclass returns.</returns> * protected override bool IsInputKey(Keys keyData) * { * if (keyData == Keys.Tab) * return false; * return base.IsInputKey(keyData); * } */ public override void MakeRoot() { CheckDisposed(); base.MakeRoot(); if (m_fdoCache == null || DesignMode) { return; } IVwRootBox rootb = VwRootBoxClass.Create(); rootb.SetSite(this); rootb.DataAccess = m_fdoCache.DomainDataByFlid; m_vc = m_info.Vc; if (m_vc == null) { if (m_info.DisplayAsContext) { m_vc = new ContextVc(m_info); } else { m_vc = new SummaryVc(m_info); } } // The root object is the one, if any, that the policy gives us. // If it doesn't give us one the vc will obtain a key string from the policy // directly. The frag argument is arbitrary. Note that we have to use a non-zero // HVO, even when it doesn't mean anything, to avoid triggering an Assert in the Views code. rootb.SetRootObject(m_info.Hvo == 0 ? 1 : m_info.Hvo, m_vc, 1, m_styleSheet); this.m_rootb = rootb; }
public override void MakeRoot() { CheckDisposed(); base.MakeRoot(); if (m_fdoCache == null || DesignMode) { return; } IVwRootBox rootb = VwRootBoxClass.Create(); rootb.SetSite(this); rootb.DataAccess = m_fdoCache.MainCacheAccessor; m_cvc = new ConcVc(m_cp, m_gni, m_index); // The root object is the one, if any, that the policy gives us for this slice. // If it doesn't give us one the vc will obtain a key string from the policy // directly. The frag argument is arbitrary. rootb.SetRootObject(m_cp.Item(m_index), m_cvc, 1, m_styleSheet); m_rootb = rootb; }
private void Init(PrintPageEventArgs e) { #if false long x1 = System.DateTime.Now.Ticks; #endif // Set these now because the Graphics object will be locked below. m_rcDst = m_rcSrc = new Rect(0, 0, (int)e.Graphics.DpiX, (int)e.Graphics.DpiY); int dpix; if (MiscUtils.IsUnix) dpix = 72; else dpix = (int)e.Graphics.DpiX; m_dxpAvailWidth = PixelsFrom100ths(e.MarginBounds.Width, dpix); // Create and initialize a print context. m_vwPrintContext = VwPrintContextWin32Class.Create(); // TODO: When we provide a way for the user to specify the nFirstPageNo (i.e. the // first argument to SetPagePrintInfo), then change the arguments to // SetPagePrintInfo. m_vwPrintContext.SetPagePrintInfo(1, 1, 65535, 1, false); SetMargins(e); IVwGraphics vwGraphics = VwGraphicsWin32Class.Create(); IntPtr hdc = IntPtr.Zero; try { // Get the printer's hdc and use it to initialize other stuff. hdc = e.Graphics.GetHdc(); ((IVwGraphicsWin32)vwGraphics).Initialize(hdc); m_vwPrintContext.SetGraphics(vwGraphics); // Make a rootbox for printing and initialize it. m_rootb = VwRootBoxClass.Create(); m_rootb.SetSite(this); m_rootb.DataAccess = m_sda; m_rootb.SetRootObject(m_hvo, m_vc, m_frags, m_styleSheet); m_rootb.InitializePrinting(m_vwPrintContext); m_totalNumberOfPages = m_rootb.GetTotalPrintPages(m_vwPrintContext); m_psettings = e.PageSettings.PrinterSettings; SetPrintRange(); } catch (Exception ex) { m_rootb = null; throw new ContinuableErrorException("An error has occurred during the setup required for printing.", ex); } finally { if (hdc != IntPtr.Zero) { vwGraphics.ReleaseDC(); e.Graphics.ReleaseHdc(hdc); } } #if false long x2 = System.DateTime.Now.Ticks; Debug.WriteLine("PrintRootSite.Init() took " + DeltaTime(x1,x2) + " seconds."); #endif }
private void Init(PrintPageEventArgs e) { #if false long x1 = System.DateTime.Now.Ticks; #endif // Set these now because the Graphics object will be locked below. m_rcDst = m_rcSrc = new Rect(0, 0, (int)e.Graphics.DpiX, (int)e.Graphics.DpiY); int dpix; if (MiscUtils.IsUnix) { dpix = 72; } else { dpix = (int)e.Graphics.DpiX; } m_dxpAvailWidth = PixelsFrom100ths(e.MarginBounds.Width, dpix); // Create and initialize a print context. m_vwPrintContext = VwPrintContextWin32Class.Create(); // TODO: When we provide a way for the user to specify the nFirstPageNo (i.e. the // first argument to SetPagePrintInfo), then change the arguments to // SetPagePrintInfo. m_vwPrintContext.SetPagePrintInfo(1, 1, 65535, 1, false); SetMargins(e); IVwGraphics vwGraphics = VwGraphicsWin32Class.Create(); IntPtr hdc = IntPtr.Zero; try { // Get the printer's hdc and use it to initialize other stuff. hdc = e.Graphics.GetHdc(); ((IVwGraphicsWin32)vwGraphics).Initialize(hdc); m_vwPrintContext.SetGraphics(vwGraphics); // Make a rootbox for printing and initialize it. m_rootb = VwRootBoxClass.Create(); m_rootb.SetSite(this); m_rootb.DataAccess = m_sda; m_rootb.SetRootObject(m_hvo, m_vc, m_frags, m_styleSheet); m_rootb.InitializePrinting(m_vwPrintContext); m_totalNumberOfPages = m_rootb.GetTotalPrintPages(m_vwPrintContext); m_psettings = e.PageSettings.PrinterSettings; SetPrintRange(); } catch (Exception ex) { m_rootb = null; throw new ContinuableErrorException("An error has occurred during the setup required for printing.", ex); } finally { if (hdc != IntPtr.Zero) { vwGraphics.ReleaseDC(); e.Graphics.ReleaseHdc(hdc); } } #if false long x2 = System.DateTime.Now.Ticks; Debug.WriteLine("PrintRootSite.Init() took " + DeltaTime(x1, x2) + " seconds."); #endif }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ private void Init(PrintPageEventArgs e) { #if false long x1 = System.DateTime.Now.Ticks; #endif // Set these now because the Graphics object will be locked below. m_rcDst = m_rcSrc = new Rect(0, 0, (int)e.Graphics.DpiX, (int)e.Graphics.DpiY); m_dxpAvailWidth = PixelsFrom100ths(e.MarginBounds.Width, (int)e.Graphics.DpiX); // Create and initialize a print context. m_vwPrintContext = VwPrintContextWin32Class.Create(); // TODO: When we provide a way for the user to specify the nFirstPageNo (i.e. the // first argument to SetPagePrintInfo), then change the arguments to // SetPagePrintInfo. m_vwPrintContext.SetPagePrintInfo(1, 1, 65535, 1, false); SetMargins(e); IVwGraphics vwGraphics = VwGraphicsWin32Class.Create(); IntPtr hdc = IntPtr.Zero; try { // Get the printer's hdc and use it to initialize other stuff. hdc = e.Graphics.GetHdc(); ((IVwGraphicsWin32)vwGraphics).Initialize(hdc); m_vwPrintContext.SetGraphics(vwGraphics); // Make a rootbox for printing and initialize it. m_rootb = VwRootBoxClass.Create(); m_rootb.SetSite(this); m_rootb.DataAccess = m_sda; m_rootb.SetRootObject(m_hvo, m_vc, m_frags, m_styleSheet); m_rootb.InitializePrinting(m_vwPrintContext); m_totalNumberOfPages = m_rootb.GetTotalPrintPages(m_vwPrintContext, null); m_psettings = e.PageSettings.PrinterSettings; SetPrintRange(); } catch { m_rootb = null; string errorMsg = ResourceHelper.GetResourceString("kstidErrorCreatingPrintRootSite"); // TODO: Add the help file and url when we have a help file. MessageBox.Show(errorMsg, "", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (hdc != IntPtr.Zero) { vwGraphics.ReleaseDC(); e.Graphics.ReleaseHdc(hdc); } } #if false long x2 = System.DateTime.Now.Ticks; Debug.WriteLine("PrintRootSite.Init() took " + DeltaTime(x1,x2) + " seconds."); #endif }