示例#1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="T:DraftViewWrapper"/> class.
        /// </summary>
        /// <param name="name">The name of the split grid</param>
        /// <param name="parent">The parent of the split wrapper (can be null). Will be replaced
        /// with real parent later.</param>
        /// <param name="cache">The cache.</param>
        /// <param name="styleSheet">The style sheet.</param>
        /// <param name="settingsRegKey">The settings reg key.</param>
        /// <param name="draftView">The vernacular Scripture draft view proxy.</param>
        /// <param name="stylebar">The Scripture stylebar proxy.</param>
        /// <param name="btDraftView">The BT Scripture draft view proxy.</param>
        /// <param name="footnoteDraftView">The vernacular footnote draft view proxy.</param>
        /// <param name="footnoteStylebar">The footnote stylebar proxy.</param>
        /// <param name="footnoteBtDraftView">The BT footnote draft view proxy.</param>
        /// ------------------------------------------------------------------------------------
        internal BtDraftSplitWrapper(string name, Control parent, FdoCache cache,
                                     IVwStylesheet styleSheet, RegistryKey settingsRegKey, TeScrDraftViewProxy draftView,
                                     DraftStylebarProxy stylebar, TeScrDraftViewProxy btDraftView,
                                     TeFootnoteDraftViewProxy footnoteDraftView, DraftStylebarProxy footnoteStylebar,
                                     TeFootnoteDraftViewProxy footnoteBtDraftView)
            : base(name, parent, cache, styleSheet, settingsRegKey, draftView, stylebar,
                   footnoteDraftView, footnoteStylebar, 2, 3)
        {
            m_settingsRegKey = settingsRegKey;

            IRootSiteGroup group = GetGroup(kDraftRow, kDraftViewColumn);

            AddControl(group, kDraftRow, kBackTransColumn, btDraftView, true,
                       !ChangeSides);

            group = GetGroup(kFootnoteRow, kDraftViewColumn);
            AddControl(group, kFootnoteRow, kBackTransColumn, footnoteBtDraftView, false,
                       !ChangeSides);

            DataGridViewControlColumn frontTransColumn = GetColumn(kDraftViewColumn);

            frontTransColumn.FillWeight    = 100;
            frontTransColumn.MaxPercentage = 0.9f;
            frontTransColumn.MinimumWidth  = 60;
            frontTransColumn.IsCollapsible = false;
            frontTransColumn.Visible       = true;

            DataGridViewControlColumn backTransColumn = GetColumn(kBackTransColumn);

            backTransColumn.FillWeight    = 100;
            backTransColumn.MaxPercentage = 0.9f;
            backTransColumn.MinimumWidth  = 60;
            backTransColumn.IsCollapsible = false;
            backTransColumn.Visible       = true;

            // Now set up a persistence object for loading. This will be disposed automatically
            // when we dispose m_Container.
            m_Container = new FwContainer();
            Persistence persistence = new Persistence(m_Container, this);

            persistence.LoadSettings += new Persistence.Settings(OnLoadSettings);

            // Retrieve the parent's Persistence service. We use that for saving rather then
            // our own because otherwise some things like the FDO cache might already be disposed
            // when we try to save the settings.
            if (parent.Site != null)
            {
                persistence = (Persistence)parent.Site.GetService(typeof(Persistence));
                if (persistence != null)
                {
                    persistence.SaveSettings += new Persistence.Settings(OnSaveSettings);
                }
            }

            m_leftPaneWeight  = new RegistryFloatSetting(settingsRegKey, Name + "LeftPaneWeight", -1.0f);
            m_rightPaneWeight = new RegistryFloatSetting(settingsRegKey, Name + "RightPaneWeight", -1.0f);
        }
示例#2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="DraftViewWrapper"/> class.
        /// </summary>
        /// <param name="name">The name of the split grid</param>
        /// <param name="parent">The parent of the split wrapper (can be null). Will be replaced
        /// with real parent later.</param>
        /// <param name="cache">The cache.</param>
        /// <param name="styleSheet">The style sheet.</param>
        /// <param name="settingsRegKey">The settings reg key.</param>
        /// <param name="draftView">The draft view.</param>
        /// <param name="stylebar">The stylebar.</param>
        /// <param name="btDraftView">The bt draft view.</param>
        /// <param name="footnoteDraftView">The footnote draft view.</param>
        /// <param name="footnoteStylebar">The footnote stylebar</param>
        /// <param name="footnoteBtDraftView">The footnote bt draft view.</param>
        /// ------------------------------------------------------------------------------------
        public BtDraftSplitWrapper(string name, Control parent, FdoCache cache,
                                   IVwStylesheet styleSheet, RegistryKey settingsRegKey, object draftView,
                                   object stylebar, object btDraftView, object footnoteDraftView,
                                   object footnoteStylebar, object footnoteBtDraftView)
            : base(name, parent, cache, styleSheet, settingsRegKey, draftView, stylebar,
                   footnoteDraftView, footnoteStylebar, 2, 3)
        {
            IRootSiteGroup group = GetGroup(kDraftRow, kDraftViewColumn);

            AddControl(group, kDraftRow, kBackTransColumn, btDraftView, true,
                       !ChangeSides);

            group = GetGroup(kFootnoteRow, kDraftViewColumn);
            AddControl(group, kFootnoteRow, kBackTransColumn, footnoteBtDraftView, false,
                       !ChangeSides);

            DataGridViewControlColumn frontTransColumn = GetColumn(kDraftViewColumn);

            frontTransColumn.FillWeight    = 100;
            frontTransColumn.MaxPercentage = 0.9f;
            frontTransColumn.MinimumWidth  = 60;
            frontTransColumn.IsCollapsible = false;
            frontTransColumn.Visible       = true;

            DataGridViewControlColumn backTransColumn = GetColumn(kBackTransColumn);

            backTransColumn.FillWeight    = 100;
            backTransColumn.MaxPercentage = 0.9f;
            backTransColumn.MinimumWidth  = 60;
            backTransColumn.IsCollapsible = false;
            backTransColumn.Visible       = true;

            // Now set up a persistence object for loading. This will be disposed automatically
            // when we dispose m_Container.
            m_Container = new FwContainer();
            Persistence persistence = new Persistence(m_Container, this);

            persistence.LoadSettings += new Persistence.Settings(OnLoadSettings);
            // we don't want to implement ISettings, so we set the default key path instead,
            // but we have to strip the HKCU\ of the name.
            persistence.DefaultKeyPath =
                settingsRegKey.Name.Substring(Registry.CurrentUser.Name.Length + 1);

            // Retrieve the parent's Persistence service. We use that for saving rather then
            // our own because otherwise some things like the FDO cache might already be disposed
            // when we try to save the settings.
            if (parent.Site != null)
            {
                persistence = (Persistence)parent.Site.GetService(typeof(Persistence));
                if (persistence != null)
                {
                    persistence.SaveSettings += new Persistence.Settings(OnSaveSettings);
                }
            }
        }
示例#3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="DraftViewWrapper"/> class.
        /// </summary>
        /// <param name="name">The name of the split grid</param>
        /// <param name="parent">The parent of the split wrapper (can be null). Will be replaced
        /// with real parent later.</param>
        /// <param name="cache">The cache.</param>
        /// <param name="styleSheet">The style sheet.</param>
        /// <param name="settingsRegKey">The settings reg key.</param>
        /// <param name="draftView">The Scripture draft view proxy.</param>
        /// <param name="stylebar">The Scripture stylebar proxy.</param>
        /// <param name="footnoteDraftView">The footnote draft view proxy.</param>
        /// <param name="footnoteStylebar">The footnote stylebar proxy</param>
        /// <param name="rows">The number of rows.</param>
        /// <param name="columns">The number of columns.</param>
        /// <remarks>If the view wrapper does not have a stylebar, then override the
        /// kStyleColumn property to a negative value so that it will be ignored.</remarks>
        /// ------------------------------------------------------------------------------------
        internal ViewWrapper(string name, Control parent, FdoCache cache, IVwStylesheet styleSheet,
                             RegistryKey settingsRegKey, TeScrDraftViewProxy draftView, DraftStylebarProxy stylebar,
                             TeFootnoteDraftViewProxy footnoteDraftView, DraftStylebarProxy footnoteStylebar,
                             int rows, int columns) : base(cache, styleSheet, rows, columns)
        {
            Dock             = DockStyle.Fill;
            Name             = name;
            m_stylePaneWidth = new RegistryIntSetting(settingsRegKey, name + "StyleWidth", 0);
            if (parent != null)
            {
                Site = parent.Site;
            }

            IRootSiteGroup group = CreateGroup((int)TeViewGroup.Scripture);

            if (kStyleColumn >= 0)
            {
                AddControl(group, kDraftRow, kStyleColumn, stylebar);
            }
            AddControl(group, kDraftRow, kDraftViewColumn, draftView, true, true);
            group = CreateGroup((int)TeViewGroup.Footnote);
            if (kStyleColumn >= 0)
            {
                AddControl(group, kFootnoteRow, kStyleColumn, footnoteStylebar);
            }
            AddControl(group, kFootnoteRow, kDraftViewColumn, footnoteDraftView, false, true);

            GetRow(kFootnoteRow).FillWeight          = 18;
            m_grid.Rows[kDraftRow].Visible           = true;
            m_grid.Columns[kDraftViewColumn].Visible = true;
            m_grid.ColumnWidthChanged += new DataGridViewColumnEventHandler(OnColumnWidthChanged);
            m_grid.RowHeightChanged   += new DataGridViewRowEventHandler(OnRowHeightChanged);

            if (kStyleColumn >= 0)
            {
                DataGridViewControlColumn styleColumn = GetColumn(kStyleColumn);
                styleColumn.ThresholdWidth = 20;
                styleColumn.StandardWidth  = 100;
                styleColumn.MaxPercentage  = 0.5f;
                styleColumn.IsCollapsible  = true;
                styleColumn.AutoSizeMode   = DataGridViewAutoSizeColumnMode.None;
                if (m_stylePaneWidth.Value > 0)
                {
                    styleColumn.Width   = Math.Max(m_stylePaneWidth.Value, styleColumn.ThresholdWidth);
                    styleColumn.Visible = true;
                }
            }
        }
示例#4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="T:DiffViewWrapper"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="parent">The parent object.</param>
        /// <param name="cache">The cache.</param>
        /// <param name="styleSheet">The style sheet.</param>
        /// <param name="currentDraft">The current draft.</param>
        /// <param name="revisionDraft">The revision draft.</param>
        /// <param name="currentFootnote">The current footnote.</param>
        /// <param name="revisionFootnote">The revision footnote.</param>
        /// <param name="otherControls">A TableLayoutPanel that contains the controls to show
        /// as labels and buttons above and below the current and revision views.</param>
        /// ------------------------------------------------------------------------------------
        public DiffViewWrapper(string name, Control parent, FdoCache cache,
                               IVwStylesheet styleSheet, object currentDraft, object revisionDraft,
                               object currentFootnote, object revisionFootnote, TableLayoutPanel otherControls)
            : base(cache, styleSheet, 4, 2)
        {
            Dock    = DockStyle.Fill;
            Name    = name;
            Parent  = parent;
            Padding = otherControls.Padding;

            // Add the labels at the top
            AddControl(null, kLabelRow, kRevisionColumn, new FixedControlCreateInfo(
                           otherControls.GetControlFromPosition(kRevisionColumn, kLabelRow)));
            AddControl(null, kLabelRow, kCurrentColumn, new FixedControlCreateInfo(
                           otherControls.GetControlFromPosition(kCurrentColumn, kLabelRow)));

            // Add the views
            AddControl(null, kDraftRow, kRevisionColumn, revisionDraft, false, true);
            AddControl(null, kDraftRow, kCurrentColumn, currentDraft, true, true);
            AddControl(null, kFootnoteRow, kRevisionColumn, revisionFootnote, false, true);
            AddControl(null, kFootnoteRow, kCurrentColumn, currentFootnote, false, true);

            // Add the buttons below the views
            AddControl(null, kButtonRow, kRevisionColumn, new FixedControlCreateInfo(
                           otherControls.GetControlFromPosition(kRevisionColumn, kButtonRow)));
            AddControl(null, kButtonRow, kCurrentColumn, new FixedControlCreateInfo(
                           otherControls.GetControlFromPosition(kCurrentColumn, kButtonRow)));

            // Set properties on the rows

            // We have to set the desired height first because this resets the visible
            // state - strange.
            GetRow(kLabelRow).MinimumHeight =
                otherControls.GetControlFromPosition(kRevisionColumn, kLabelRow).Height;
            GetRow(kButtonRow).MinimumHeight =
                otherControls.GetControlFromPosition(kRevisionColumn, kButtonRow).Height;

            DataGridViewControlRow row = GetRow(kLabelRow);

            row.Visible    = true;
            row.Resizable  = DataGridViewTriState.False;
            row.IsAutoFill = false;
            DataGridViewAdvancedBorderStyle noBorder = new DataGridViewAdvancedBorderStyle();

            noBorder.All            = DataGridViewAdvancedCellBorderStyle.None;
            row.AdvancedBorderStyle = noBorder;

            row         = GetRow(kDraftRow);
            row.Visible = true;

            row            = GetRow(kFootnoteRow);
            row.FillWeight = 18;                // 30%
            row.Visible    = false;

            row                     = GetRow(kButtonRow);
            row.Visible             = true;
            row.Resizable           = DataGridViewTriState.False;
            row.IsAutoFill          = false;
            row.AdvancedBorderStyle = noBorder;

            // Set properties on the two columns
            DataGridViewControlColumn column = GetColumn(kRevisionColumn);

            column.MinimumWidth = 220;
            column.Visible      = true;
            column.FillWeight   = 100;
            column.Name         = "RevisionColumn";

            column = GetColumn(kCurrentColumn);
            column.MinimumWidth = 315;
            column.Visible      = true;
            column.FillWeight   = 100;
            column.Name         = "CurrentColumn";
        }