Exemple #1
0
 internal FreeformAdder(int hvoType, RootSite site, bool fNeedReconstruct, InterlinVc vc) : base(site.Cache)
 {
     m_hvoType          = hvoType;
     m_site             = site;
     m_fNeedReconstruct = fNeedReconstruct;
     m_choices          = vc.LineChoices;
     m_vc = vc;
 }
        protected override int DesiredHeight(RootSite rs)
        {
            int height = base.DesiredHeight(rs);

            // only include the height of the insertion contorl when it is visible
            if (RuleFormulaControl.InsertionControl.Visible)
            {
                height += RuleFormulaControl.InsertionControl.Height;
            }
            return(height);
        }
Exemple #3
0
        /// <summary>
        /// Somehow a slice (I think one that has never scrolled to become visible?)
        /// can get an OnLoad message for its view in the course of deleting it from the
        /// parent controls collection. This can be bad (at best it's a waste of time
        /// to do the Layout in the OnLoad, but it can be actively harmful if the object
        /// the view is displaying has been deleted). So suppress it.
        /// </summary>
        public override void AboutToDiscard()
        {
            CheckDisposed();
            base.AboutToDiscard();
            RootSite rs = RootSite;

            if (rs != null)
            {
                rs.AboutToDiscard();
            }
        }
Exemple #4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates the control in column.
        /// </summary>
        /// <param name="cell">The cell that will host the control we create.</param>
        /// ------------------------------------------------------------------------------------
        private void CreateHostedControl(DataGridViewControlCell cell)
        {
            if (cell.ControlCreateInfo == null || cell.ControlCreateInfo.ViewProxy == null)
            {
                return;
            }

            IRootSiteGroup group = cell.ControlCreateInfo.Group;
            Control        c     = cell.ControlCreateInfo.ViewProxy.CreateView(this);

            if (c is RootSite)
            {
                RootSite rs = c as RootSite;
                rs.Cache      = m_cache;
                rs.StyleSheet = m_StyleSheet;
            }

            if (group != null && c is IRootSiteSlave)
            {
                IRootSiteSlave slave = c as IRootSiteSlave;
                group.AddToSyncGroup(slave);

                if (cell.ControlCreateInfo.IsScrollingController)
                {
#if __MonoCS__
                    // TODO-Linux: HACK Check to see if a ScrollingControl has (in error) already been set.
                    // hack to prevent multiple scrollbars controling a group
                    // This isn't needed in Windows as RootSite.cs check to see if it is the Group ScrollingController
                    // Which should mean that if multiple scrolling Control are set only the last one actually contains a scrollbar
                    // However because on mono Creating events aren't exactly the same (shame!) the group property of the RootSite get set before
                    // the second RootSite with the ScrollingControl set, get created meaning when the group is set it IS the scrolling controler! (and hence AutoScroll isn't set to false)
                    // A alternative way of fixing this (and probably better) would be to change the ViewWrapperContructor to only set a single ScrollingControl
                    // (currently BtWrapper set one) and calls it base which also has set one.
                    if (group.ScrollingController != null)
                    {
                        if (group.ScrollingController is ScrollableControl)
                        {
                            (group.ScrollingController as ScrollableControl).AutoScroll = false;
                        }
                    }
#endif
                    group.ScrollingController = slave;
                }
            }

            if (c is ISelectableView)
            {
                ((ISelectableView)c).BaseInfoBarCaption = m_baseInfoBarCaption;
            }

            cell.ControlCreateInfo.Control = c;

            OnHostedControlCreated(c);
        }
Exemple #5
0
        /// <summary>
        /// Some 'unreal' slices can become 'real' (ready to actually display) without
        /// actually replacing themselves with a different object. Such slices override
        /// this method to do whatever is needed and then answer true. If a slice
        /// answers false to IsRealSlice, this is tried, and if it returns false,
        /// then BecomeReal is called.
        /// </summary>
        /// <returns></returns>
        public override bool BecomeRealInPlace()
        {
            CheckDisposed();
            RootSite rs = this.RootSite;

            if (rs.RootBox == null)
            {
                IntPtr dummy = rs.Handle;      // This typically gets the root box created, so setting AllowLayout can lay it out.
            }
            rs.AllowLayout = true;             // also does PerformLayout.
            SetHeightFromRootBox(rs);
            return(true);
        }
Exemple #6
0
        public override void FinishInit()
        {
            base.FinishInit();

            string paramType = XmlUtils.GetOptionalAttributeValue(m_configurationNode.ParentNode, "paramType");

            if (paramType == "LiteralString")
            {
                // Instead of the parameter being a layout name, it is literal text which will be
                // the whole contents of the slice, with standard properties.
                string text = XmlUtils.GetManditoryAttributeValue(m_callerNode, "label");
                if (m_stringTable != null)
                {
                    text = m_stringTable.LocalizeAttributeValue(text);
                }
                m_view = new LiteralLabelView(text, this);
            }
            else
            {
                m_layout = XmlUtils.GetOptionalAttributeValue(m_callerNode, "param")
                           ?? XmlUtils.GetManditoryAttributeValue(m_configurationNode, "layout");
                m_collapsedLayout = XmlUtils.GetOptionalAttributeValue(m_callerNode, "collapsedLayout")
                                    ?? XmlUtils.GetOptionalAttributeValue(m_configurationNode, "collapsedLayout");
                m_view          = new SummaryXmlView(m_obj.Hvo, m_layout, m_stringTable, this);
                m_view.Mediator = Mediator;
            }

            var panel = new Panel {
                Dock = DockStyle.Fill
            };

            Control = panel;

            m_view.Dock = DockStyle.Left;
            m_view.LayoutSizeChanged += m_view_LayoutSizeChanged;
            panel.Controls.Add(m_view);

            m_button = new ExpandCollapseButton {
                Dock = DockStyle.Left
            };
            m_button.Click += m_button_Click;
            panel.Controls.Add(m_button);
            panel.MouseDown += OnMouseDownInPanel;

            m_commandControl = new SummaryCommandControl(this)
            {
                Dock    = DockStyle.Fill,
                Visible = XmlUtils.GetOptionalBooleanAttributeValue(m_callerNode, "commandVisible", false)
            };
            panel.Controls.Add(m_commandControl);
        }
Exemple #7
0
        /// <summary>
        /// Some 'unreal' slices can become 'real' (ready to actually display) without
        /// actually replacing themselves with a different object. Such slices override
        /// this method to do whatever is needed and then answer true. If a slice
        /// answers false to IsRealSlice, this is tried, and if it returns false,
        /// then BecomeReal is called.
        /// </summary>
        /// <returns></returns>
        public override bool BecomeRealInPlace()
        {
            CheckDisposed();
            RootSite rs = this.RootSite;

            if (rs.RootBox == null)
            {
#pragma warning disable 0219              // error CS0219: The variable ... is assigned but its value is never used
                IntPtr dummy = rs.Handle; // This typically gets the root box created, so setting AllowLayout can lay it out.
#pragma warning restore 0219
            }
            rs.AllowLayout = true;             // also does PerformLayout.
            SetHeightFromRootBox(rs);
            return(true);
        }
Exemple #8
0
        protected override void SetupDataContext()
        {
            Debug.Assert(m_configurationParameters != null);

            base.SetupDataContext();
            m_rootSite = ConstructRoot();
            m_rootSite.Init(m_mediator, m_configurationParameters);             // Init it as xCoreColleague.
            //m_rootSite.PersistenceProvder = new XCore.PersistenceProvider(m_mediator.PropertyTable);

            m_rootSite.Dock  = System.Windows.Forms.DockStyle.Fill;
            m_rootSite.Cache = Cache;

            Controls.Add(m_rootSite);
            m_rootSite.BringToFront();             // Review JohnT: is this needed?
        }
Exemple #9
0
        protected override int DesiredHeight(RootSite rs)
        {
            if (rs != null && !rs.AllowLayout)
            {
                rs.AllowLayout = true;                 // Fixes LT-13603 where sometimes the slice was constructed by not laid out by now.
            }
            int height = base.DesiredHeight(rs);

            // only include the height of the insertion contorl when it is visible
            if (RuleFormulaControl.InsertionControl.Visible)
            {
                height += RuleFormulaControl.InsertionControl.Height;
            }
            return(height);
        }
Exemple #10
0
        protected internal override void SetWidthForDataTreeLayout(int width)
        {
            CheckDisposed();

            if (Width == width)
            {
                return;                 // Nothing to do.
            }
            base.SetWidthForDataTreeLayout(width);

            if (RootSite.RootBox == null)
            {
                RootSite.MakeRoot();
            }
        }
Exemple #11
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Creates the control in column.
        /// </summary>
        /// <param name="cell">The cell that will host the control we create.</param>
        /// ------------------------------------------------------------------------------------
        private void CreateHostedControl(DataGridViewControlCell cell)
        {
            if (cell.ControlCreateInfo == null || (ControlCreator == null &&
                                                   !(cell.ControlCreateInfo.ClientControlInfo is FixedControlCreateInfo)))
            {
                return;
            }

            IRootSiteGroup group = cell.ControlCreateInfo.Group;
            Control        c;

            if (cell.ControlCreateInfo.ClientControlInfo is FixedControlCreateInfo)
            {
                // We know how to deal with this!
                c = ((FixedControlCreateInfo)cell.ControlCreateInfo.ClientControlInfo).Control;
            }
            else
            {
                c = ControlCreator.Create(this, cell.ControlCreateInfo.ClientControlInfo);
            }

            if (c is RootSite)
            {
                RootSite rs = c as RootSite;
                rs.Cache      = m_cache;
                rs.StyleSheet = m_StyleSheet;
            }

            if (group != null && c is IRootSiteSlave)
            {
                IRootSiteSlave slave = c as IRootSiteSlave;
                group.AddToSyncGroup(slave);

                if (cell.ControlCreateInfo.IsScrollingController)
                {
                    group.ScrollingController = slave;
                }
            }

            if (c is ISelectableView)
            {
                ((ISelectableView)c).BaseInfoBarCaption = m_baseInfoBarCaption;
            }

            cell.ControlCreateInfo.Control = c;

            OnHostedControlCreated(c);
        }
Exemple #12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="parent"></param>
        public override void Install(DataTree parent)
        {
            CheckDisposed();
            // Sometimes we get a spurious "out of memory" error while trying to create a handle for the
            // RootSite if its cache isn't set before we add it to its parent.
            RootSite rs = RootSite;

            rs.Cache = Cache;
            // JT: seems to actually cause a problem if we replace it with itself. RootSite probably needs a fix.
            if (rs.StyleSheet != parent.StyleSheet)
            {
                rs.StyleSheet = parent.StyleSheet;
            }

            base.Install(parent);

            rs.SetAccessibleName(this.Label);
        }
Exemple #13
0
        protected override void OnSizeChanged(EventArgs e)
        {
            base.OnSizeChanged(e);
            if (this.Width == m_dxLastWidth)
            {
                return;
            }
            m_dxLastWidth = Width;             // BEFORE doing anything, actions below may trigger recursive call.
            ReferenceLauncher rl = (ReferenceLauncher)this.Control;
            RootSite          rs = (RootSite)rl.MainControl;

            rs.PerformLayout();
            if (rs.RootBox != null)
            {
                // Allow it to be the height it wants + fluff to get rid of scroll bar.
                // Adjust our own height to suit.
                // Note that this may produce a recursive call!
                this.Height = rs.RootBox.Height + 8;
            }
        }
Exemple #14
0
        protected internal override void SetWidthForDataTreeLayout(int width)
        {
            CheckDisposed();

            if (Width == width)
            {
                return;                 // Nothing to do.
            }
            base.SetWidthForDataTreeLayout(width);

            RootSite rs = this.RootSite;

            if (rs.AllowLayout)
            {
                // already laid out at some other width, need to do it again right now so
                // we can get an accurate height.
                rs.PerformLayout();
                SetHeightFromRootBox(rs);
            }
        }
Exemple #15
0
        /// <summary>
        /// Executes in two distinct scenarios.
        ///
        /// 1. If disposing is true, the method has been called directly
        /// or indirectly by a user's code via the Dispose method.
        /// Both managed and unmanaged resources can be disposed.
        ///
        /// 2. If disposing is false, the method has been called by the
        /// runtime from inside the finalizer and you should not reference (access)
        /// other managed objects, as they already have been garbage collected.
        /// Only unmanaged resources can be disposed.
        /// </summary>
        /// <param name="disposing"></param>
        /// <remarks>
        /// If any exceptions are thrown, that is fine.
        /// If the method is being done in a finalizer, it will be ignored.
        /// If it is thrown by client code calling Dispose,
        /// it needs to be handled by fixing the bug.
        ///
        /// If subclasses override this method, they should call the base implementation.
        /// </remarks>
        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)
            {
                // Dispose managed resources here.
            }

            // Dispose unmanaged resources here, whether disposing is true or false.
            m_view           = null;   // Gets disposed elsewhere, since it is in the Controls collection of another active widget.
            m_commandControl = null;   // Gets disposed elsewhere, since it is in the Controls collection of another active widget.

            base.Dispose(disposing);
        }
Exemple #16
0
 private void SetHeightFromRootBox(RootSite rs)
 {
     if (rs.RootBox != null)
     {
         //Debug.WriteLine(String.Format("ViewSlice.SetHeightFromRootBox(): orig rs.Size = {0}, this.Size = {1}",
         //    rs.Size.ToString(), this.Size.ToString()));
         int widthOrig = rs.Width;
         this.Height = Math.Max(LabelHeight, DesiredHeight(rs));                  // Allow it to be the height it wants.
         //Debug.WriteLine(String.Format("ViewSlice.SetHeightFromRootBox(): new rs.Size = {0}, this.Size = {1}",
         //    rs.Size.ToString(), this.Size.ToString()));
         if (widthOrig != rs.Width)
         {
             // If the rootsite width changes, we need to layout again.  See LT-6156.  (This is too much
             // like a band-aid, but it's taken me 3 days to figure even this much out!)
             rs.AllowLayout = true;
             this.Height    = Math.Max(LabelHeight, DesiredHeight(rs));
             //    Debug.WriteLine(String.Format("ViewSlice.SetHeightFromRootBox(): final rs.Size = {0}, this.Size = {1}",
             //        rs.Size.ToString(), this.Size.ToString()));
         }
     }
 }
Exemple #17
0
        /// -----------------------------------------------------------------------------------
        /// <summary>
        /// Clean up any resources being used.
        /// </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)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (m_rootSite != null)
                {
                    m_rootSite.Dispose();
                }
            }
            m_rootSite = null;
            // m_mediator = null; // Bad idea, since superclass still needs it.

            base.Dispose(disposing);
        }
Exemple #18
0
        /// <summary>
        /// Construct one, using the "part ref" element (caller) that
        /// invoked the "slice" node that specified this editor.
        /// </summary>
        /// <param name="caller"></param>
        /// <param name="node"></param>
        public SummarySlice(ICmObject obj, XmlNode caller, XmlNode node, StringTable stringTbl)
            : base()
        {
            string paramType = XmlUtils.GetOptionalAttributeValue(node.ParentNode, "paramType");

            if (paramType == "LiteralString")
            {
                // Instead of the parameter being a layout name, it is literal text which will be
                // the whole contents of the slice, with standard properties.
                string text = XmlUtils.GetManditoryAttributeValue(caller, "label");
                if (stringTbl != null)
                {
                    text = stringTbl.LocalizeAttributeValue(text);
                }
                m_view           = new LiteralLabelView(text, this);
                m_fLiteralString = true;
            }
            else
            {
                string layout = XmlUtils.GetOptionalAttributeValue(caller, "param");
                if (layout == null)
                {
                    layout = XmlUtils.GetManditoryAttributeValue(node, "layout");
                }
                m_view = new SummaryXmlView(obj.Hvo, layout, stringTbl, this);
            }
            UserControl mainControl = new UserControl();

            m_view.Dock = DockStyle.Left;
            m_view.LayoutSizeChanged += new EventHandler(m_view_LayoutSizeChanged);
            mainControl.Height        = m_view.Height;
            Control = mainControl;

            m_commandControl         = new SummaryCommandControl(this);
            m_commandControl.Dock    = DockStyle.Fill;
            m_commandControl.Visible = XmlUtils.GetOptionalBooleanAttributeValue(caller, "commandVisible", false);
            mainControl.Controls.Add(m_commandControl);
            mainControl.Dock = DockStyle.Fill;
            mainControl.Controls.Add(m_view);
        }
 public ViewPropertySlice(RootSite ctrlT, int hvoObj, int flid) : base(ctrlT)
 {
     m_hvoContext = hvoObj;
     m_flid       = flid;
 }
Exemple #20
0
 public bool ShowFindReplaceDialog(bool fReplace, RootSite rootsite)
 {
     throw new NotImplementedException();
 }
Exemple #21
0
 /// <summary>
 /// Override to give the height that the AnalysisInterlinearRs wants to be.
 /// </summary>
 /// <param name="rs"></param>
 /// <returns></returns>
 protected override int DesiredHeight(RootSite rs)
 {
     return(((AnalysisInterlinearRs)rs).DesiredSize.Height);
 }
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Start the undo task
 /// </summary>
 /// <param name="actionHandler">The action handler.</param>
 /// <param name="rootSite">The view</param>
 /// <param name="stid">String resource id used for Undo/Redo labels</param>
 /// ------------------------------------------------------------------------------------
 public DummyUndoTaskHelper(IActionHandler actionHandler, RootSite rootSite, string stid)
     : base(actionHandler, rootSite, stid)
 {
 }
Exemple #23
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 /// ------------------------------------------------------------------------------------
 private void ViewSlice_Enter(object sender, System.EventArgs e)
 {
     RootSite.Focus();
     ContainingDataTree.ActiveControl = RootSite;
 }
 protected override int DesiredHeight(RootSite rs)
 {
     return(Math.Max(base.DesiredHeight(rs), (Control as MSADlgLauncher).LauncherButton.Height));
 }
 /// -----------------------------------------------------------------------------------
 /// <summary>
 /// Start the undo task
 /// </summary>
 /// <param name="rootSite">The view</param>
 /// <param name="stid">String resource id used for Undo/Redo labels</param>
 /// -----------------------------------------------------------------------------------
 public DummyUndoTaskHelper(RootSite rootSite, string stid) : base(rootSite, stid)
 {
 }
Exemple #26
0
 /// <summary></summary>
 public ViewPropertySlice(RootSite ctrlT, ICmObject obj, int flid) : base(ctrlT)
 {
     Reuse(obj, flid);
 }
Exemple #27
0
 /// -----------------------------------------------------------------------------------
 /// <summary>
 /// Start the undo task
 /// </summary>
 /// <param name="rootSite">The view</param>
 /// <param name="stid">String resource id used for Undo/Redo labels</param>
 /// <param name="fSavePoint"><c>true</c> to set a save point</param>
 /// -----------------------------------------------------------------------------------
 public DummyUndoTaskHelper(RootSite rootSite, string stid, bool fSavePoint)
     : base(rootSite, stid, fSavePoint)
 {
 }
 protected override int DesiredHeight(RootSite rs)
 {
     return(Math.Max(base.DesiredHeight(rs), (Control as PhonologicalFeatureListDlgLauncher).LauncherButton.Height));
 }
Exemple #29
0
 /// <summary>
 /// The height that the slice would ideally be to accommodate the rootsite.
 /// </summary>
 /// <param name="rs"></param>
 /// <returns></returns>
 protected virtual int DesiredHeight(RootSite rs)
 {
     return(rs.RootBox.Height);
 }