Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Updates the item props.
        /// </summary>
        /// <param name="itemProps">The item props.</param>
        /// ------------------------------------------------------------------------------------
        internal void UpdateItemProps(SBTabItemProperties itemProps)
        {
            if (!itemProps.Update)
            {
                return;
            }

            ButtonItem item = m_bar.Items[itemProps.Name] as ButtonItem;

            if (item == null)
            {
                return;
            }

            item.Text       = itemProps.Text;
            item.Tooltip    = itemProps.Tooltip;
            item.ImageIndex = itemProps.ImageIndex;
            m_tags[item]    = itemProps.Tag;

            TagHelper tag = item.Tag as TagHelper;

            if (tag == null)
            {
                item.Tag = new TagHelper(itemProps.ClickAlways, itemProps.Message);
            }
            else
            {
                tag.Message     = itemProps.Message;
                tag.ClickAlways = itemProps.ClickAlways;
            }
        }
Exemplo n.º 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Called from the TMAdapter when one of the view menu items needs to be updated.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected bool OnUpdateSideBarViewTabItemMenuHandler(object args)
        {
            TMItemProperties itemProps = args as TMItemProperties;

            if (itemProps == null)
            {
                return(false);
            }

            SBTabItemProperties tabProps = itemProps.Tag as SBTabItemProperties;

            if (tabProps == null)
            {
                return(false);
            }

            SideBarTab tab = m_navPane.Items[tabProps.OwningTabName] as SideBarTab;

            if (tab == null)
            {
                return(false);
            }

            itemProps.Checked = (tab == CurrentTab && tab.CurrentItemProps.Name == itemProps.Name);
            itemProps.Update  = true;
            return(true);
        }
Exemplo n.º 3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Adds an item to the specified tab.
        /// </summary>
        /// <param name="itemProps"></param>
        /// ------------------------------------------------------------------------------------
        internal void AddTabItem(SBTabItemProperties itemProps)
        {
            // Add a new item to this tab's item list (which is just a DNB toolbar) and get
            // back the item created for us.
            ButtonItem item = m_itemPanel.AddItem(itemProps);

            if (item == null)
            {
                return;
            }

            item.Click += item_Click;

            // Create a menu item for this tab item and add it to the menu just above the
            // configure menu item.
            ButtonItem menuItem = (ButtonItem)item.Copy();

            menuItem.Text = menuItem.Text.Replace(Environment.NewLine, " ");

            // Make sure the menu text will be visible.
            if (menuItem.ForeColor == Color.White)
            {
                menuItem.ForeColor = SystemColors.MenuText;
            }

            int i = m_menu.SubItems.IndexOf(m_cfgMenuItem);

            m_menu.SubItems.Add(menuItem, i);
            UpdateMenuImages();
        }
Exemplo n.º 4
0
        /// <summary></summary>
        private void ProcessTabItemClick(SBTabItemProperties itemProperties)
        {
            Debug.Assert(null != itemProperties, "Argument itemProperties shouldn't be null");
            Debug.Assert(null != m_mediator, "m_mediator shouldn't be null");

            m_mediator.SendMessage(itemProperties.Message, itemProperties);
        }
Exemplo n.º 5
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Called from the TMAdapter when one of the view menu items is clicked.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected bool OnSideBarViewTabItemMenuHandler(object args)
        {
            TMItemProperties itemProps = args as TMItemProperties;

            if (itemProps == null)
            {
                return(false);
            }

            SBTabItemProperties tabProps = itemProps.Tag as SBTabItemProperties;

            if (tabProps == null)
            {
                return(false);
            }

            string tabName  = tabProps.OwningTabName;
            string itemName = tabProps.Name;

            SetCurrentTabItem(tabName, itemName, true);
            if (!((ButtonItem)m_navPane.Items[tabName]).Checked)
            {
                SetCurrentTab(tabName, true);
            }

            return(true);
        }
Exemplo n.º 6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Add item to a category tab.
        /// Silently fail if no such tab.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void AddTabItem(int tabIndex, SBTabItemProperties itemProps)
        {
            if (itemProps == null)
            {
                return;
            }

            try {
                ToolStripButton button = new ToolStripButton();
                button.Name              = itemProps.Name + "_button";
                button.Overflow          = ToolStripItemOverflow.AsNeeded;
                button.Text              = itemProps.Text;
                button.TextImageRelation = TextImageRelation.ImageAboveText;

                button.Click       += HandleTabItemClick;
                button.Tag          = itemProps;
                button.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
                button.Padding      = new Padding(0);
                button.Margin       = new Padding(5);
                button.ImageScaling = ToolStripItemImageScaling.None;
                if (m_largeItemImages.Images.Count >= itemProps.ImageIndex)
                {
                    button.Image = m_largeItemImages.Images[itemProps.ImageIndex];
                }

                m_tabItemProps.Add(itemProps);

                // Add item to tab, by also converting from and to an array. TODO not this way, that's ridiculous
                var tab = m_tabProps[tabIndex];
                // Convert tab's Items array to a real list
                List <SBTabItemProperties> tabItemList = new List <SBTabItemProperties>();
                if (tab.Items != null)
                {
                    foreach (var item in tab.Items)
                    {
                        tabItemList.Add(item);
                    }
                }
                tabItemList.Add(itemProps);                 // Add item to tab
                // Convert real list back to array for tab's Items array
                m_tabProps[tabIndex].Items = tabItemList.ToArray();

                // Add button to correct tab
                var strip = m_sidebarItemAreas.Find(area => area.Name == tab.Name + "_toolstrip");
                if (strip != null)
                {
                    strip.Items.Add(button);
                }

                // If a tab received its FIRST item, then set that item as the 'previously-selected-item'.
                if (!m_selectedTabItems.ContainsKey(tab.Name))
                {
                    m_selectedTabItems[tab.Name] = itemProps.Name;
                }
            } catch (Exception e) {
                Debug.WriteLine(String.Format("Warning: AddTabItem() exception ignored: {0}.", e));
            }
        }
Exemplo n.º 7
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// This handler catches all clicks on menu items and side bar tab items.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// ------------------------------------------------------------------------------------
        private void item_Click(object sender, EventArgs e)
        {
            if (m_supressAutoEvent)
            {
                return;
            }

            // Sometimes this has to be forced, so just do it all the
            // time since it's ignored when irrelevant.
            m_menu.ClosePopup();

            ButtonItem item = sender as ButtonItem;

            TagHelper tag = item.Tag as TagHelper;

            // If we clicked on the checked item then don't switch to it.
            if (m_mediator == null || item == null ||
                (item == m_prevSelectedItem && Checked && tag != null && !tag.ClickAlways))
            {
                return;
            }

            // Save the item clicked on so we can check it the next time an item is
            // clicked.
            m_prevSelectedItem = item;

            // Since we might have gotten here by clicking on one of the menu items,
            // make sure the checked side bar item matches the chosen item.
            SetCurrentTabItem(item.Name, false);

            // If we're not checked, it means we got here from clicking on one of the menu
            // items. Therefore, check this tab which will force it to be the active tab.
            if (!Checked)
            {
                Checked = true;
            }

            Application.DoEvents();

            if (tag == null)
            {
                return;
            }

            string message = tag.Message;

            if (message != null)
            {
                SBTabItemProperties itemProps = m_itemPanel.GetItemProps(item.Name);
                if (m_mediator.SendMessage(message, itemProps) &&
                    itemProps != null && itemProps.Update)
                {
                    m_itemPanel.UpdateItemProps(itemProps);
                }
            }
//			m_mediator.PostMessage(message, m_itemPanel.GetItemProps(item.Name));
        }
Exemplo n.º 8
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Adds an item to the specified tab.
        /// </summary>
        /// <param name="tabName"></param>
        /// <param name="itemProps"></param>
        /// ------------------------------------------------------------------------------------
        public void AddTabItem(string tabName, SBTabItemProperties itemProps)
        {
            SideBarTab tab = m_navPane.Items[tabName] as SideBarTab;

            if (tab != null)
            {
                tab.AddTabItem(itemProps);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Called when a sidebar tab item is clicked, to forward the click message and to set
        /// the item's visual appearance to look selected.
        /// </summary>
        private void HandleTabItemClick(object sender, EventArgs e)
        {
            ToolStripItem item = sender as ToolStripItem;

            SBTabItemProperties itemProperties = item.Tag as SBTabItemProperties;

            string tabName = GetTabNameContainingItemName(itemProperties.Name);

            SetCurrentTabItem(tabName, itemProperties.Name, true);
        }
Exemplo n.º 10
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Adds an item to the specified tab.
 /// </summary>
 /// <param name="tabIndex"></param>
 /// <param name="itemProps"></param>
 /// ------------------------------------------------------------------------------------
 public void AddTabItem(int tabIndex, SBTabItemProperties itemProps)
 {
     try
     {
         AddTabItem(m_navPane.Items[tabIndex].Name, itemProps);
     }
     catch
     {
     }
 }
Exemplo n.º 11
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Add item to a category tab
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void AddTabItem(string tabName, SBTabItemProperties itemProps)
        {
            Tab  tab  = m_sidePane.GetTabByName(tabName);
            Item item = new Item(itemProps.Name);

            item.Text = itemProps.Text;
            item.Icon = m_largeItemImages.Images[itemProps.ImageIndex];
            item.Tag  = itemProps;
            m_sidePane.AddItem(tab, item);
        }
Exemplo n.º 12
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="itemName"></param>
        /// <returns></returns>
        /// ------------------------------------------------------------------------------------
        internal SBTabItemProperties GetItemProps(string itemName)
        {
            // TE-7929 indicates there is some case in which a null reference exception
            // can be thrown in this method. However, the exception cannot be reproduced
            // and the stack trace in the issue does not include line numbers so we're not
            // sure which object is null. Therefore, add some checks for insurance.
            if (string.IsNullOrEmpty(itemName) || m_bar == null || m_bar.Items == null ||
                !m_bar.Items.Contains(itemName))
            {
                return(null);
            }

            ButtonItem item = m_bar.Items[itemName] as ButtonItem;

            if (item == null)
            {
                return(null);
            }

            SBTabItemProperties itemProps = new SBTabItemProperties(this.TopLevelControl as Form);

            // TE-7171 indicates there is some case in which a null reference exception
            // can be thrown in this method. However, the exception cannot be reproduced
            // and the stack trace in the issue does not include line numbers so we're not
            // sure which object is null. Therefore, add some checks for insurance.
            if (itemProps == null)
            {
                return(null);
            }

            itemProps.Name          = itemName;
            itemProps.Text          = item.Text;
            itemProps.Tooltip       = item.Tooltip;
            itemProps.ImageIndex    = item.ImageIndex;
            itemProps.OwningTabName = Name;
            object clientTag;

            itemProps.Tag = (m_tags.TryGetValue(item, out clientTag) ? clientTag : null);

            // Before TE-7171 we used to assume item.Tag is always a TagHelper (which should
            // always be the case), but for insurance, put a check here so an exception isn't
            // thrown.
            TagHelper tag = item.Tag as TagHelper;

            if (tag != null)
            {
                itemProps.Message     = tag.Message;
                itemProps.ClickAlways = tag.ClickAlways;
            }

            return(itemProps);
        }
Exemplo n.º 13
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Called from the TMAdapter when one of the view menu items needs to be updated.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected bool OnUpdateSideBarViewTabItemMenuHandler(object args)
        {
            TMItemProperties itemProps = args as TMItemProperties;

            if (itemProps == null)
            {
                return(false);
            }

            SBTabItemProperties tabProps = itemProps.Tag as SBTabItemProperties;

            if (tabProps == null)
            {
                return(false);
            }

            itemProps.Update = true;
            return(true);
        }
Exemplo n.º 14
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Tells the adapter to save it's settings to the specified keys.
        /// </summary>
        /// <param name="key"></param>
        /// ------------------------------------------------------------------------------------
        public void SaveSettings(Microsoft.Win32.RegistryKey key)
        {
            // Save the sidebar's width
            if (m_navPane.Parent != null)
            {
                key.SetValue("SideBarWidth", m_navPane.Parent.Width);
            }

            // Save the active tab and active tab item.
            if (CurrentTab != null)
            {
                key.SetValue("ActiveTab", CurrentTab.Name);

                SBTabItemProperties itemProps = CurrentTab.CurrentItemProps;
                if (itemProps != null)
                {
                    key.SetValue("ActiveTabItem", itemProps.Name);
                }
            }
        }
Exemplo n.º 15
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Add item to a category tab
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void AddTabItem(string tabName, SBTabItemProperties itemProps)
        {
            // Find the tab number by name
            int tabNumber = -1;

            for (int i = 0; i < Tabs.Length; i++)
            {
                var tab = Tabs[i];
                if (tab.Name == tabName)
                {
                    tabNumber = i;
                    break;
                }
            }

            if (tabNumber < 0)
            {
                throw new Exception(String.Format("SIBAdapter.AddTabItem tabName '{0}' not found.", tabName));
            }

            AddTabItem(tabNumber, itemProps);
        }
Exemplo n.º 16
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// <param name="itemName"></param>
        /// <param name="text"></param>
        /// <param name="imageIndex"></param>
        /// ------------------------------------------------------------------------------------
        internal ButtonItem AddItem(SBTabItemProperties itemProps)
        {
            ButtonItem item = new ButtonItem(itemProps.Name, itemProps.Text);

            item.Tag            = new TagHelper(itemProps.ClickAlways, itemProps.Message);
            item.ImageIndex     = itemProps.ImageIndex;
            item.ImagePosition  = (SmallIconMode ? eImagePosition.Left : eImagePosition.Top);
            item.Style          = (m_themesActive ? eDotNetBarStyle.Office2003 : eDotNetBarStyle.Office2000);
            item.OptionGroup    = Name;
            item.AccessibleName = itemProps.Text;
            item.ButtonStyle    = eButtonStyle.ImageAndText;

            m_tags[item] = itemProps.Tag;
            m_bar.Items.Add(item);

            // Don't take the default fore color when we're in Window's 2000 style.
            if (!m_themesActive)
            {
                item.ForeColor = Color.White;
            }

            return(item);
        }
Exemplo n.º 17
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Called from the TMAdapter when one of the view menu items is clicked.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected bool OnSideBarViewTabItemMenuHandler(object args)
        {
            TMItemProperties itemProps = args as TMItemProperties;

            if (itemProps == null)
            {
                return(false);
            }

            SBTabItemProperties tabProps = itemProps.Tag as SBTabItemProperties;

            if (tabProps == null)
            {
                return(false);
            }

            string tabName  = tabProps.OwningTabName;
            string itemName = tabProps.Name;

            SetCurrentTabItem(tabName, itemName, true);

            return(true);
        }
Exemplo n.º 18
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the Back Translation Review view
		/// </summary>
		/// <param name="viewName">Name of the view.</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="tabItem">The tab item.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected ISelectableView CreateBackTransConsultantCheckView(string viewName,
			TeViewType viewType, SBTabItemProperties tabItem)
		{
			TeScrDraftViewProxy topDraftView = new TeScrDraftViewProxy(this, "BTReviewDraftView",
				false, false, false, TeViewType.BackTranslationConsultantCheck);
			DraftStylebarProxy topStylebar = new DraftStylebarProxy(this, "BTReview", false);

			TeFootnoteDraftViewProxy footnoteDraftView = new TeFootnoteDraftViewProxy(this,
				"BTReviewFootnoteView", false, true);
			DraftStylebarProxy footnoteStylebar = new DraftStylebarProxy(this,
				"BTReviewFootnote", true);

			// Construct the one view wrapper (client window)
			ViewWrapper reviewWrap = new ViewWrapper(kBTReviewWrapperName, this, m_cache,
				StyleSheet, SettingsKey, topDraftView, topStylebar, footnoteDraftView,
				footnoteStylebar);
			((ISelectableView)reviewWrap).BaseInfoBarCaption = viewName;

			if (tabItem != null)
			{
				tabItem.Tag = reviewWrap;
				tabItem.Update = true;
			}

			ClientControls.Add(reviewWrap);
			// Bring the draftView to the top of the z-order, so that
			// (if it is the active view) it fills only the remaining space
			reviewWrap.BringToFront();
			m_rgClientViews.Add(TeEditingHelper.ViewTypeString(TeViewType.BackTranslationConsultantCheck),
				reviewWrap);
			m_uncreatedViews.Remove(TeViewType.BackTranslationConsultantCheck);
			return reviewWrap;
		}
Exemplo n.º 19
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Scripture/Print layout View
		/// </summary>
		/// <param name="viewName">Name of the resource string for the view.</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="pubName">Name of the publication.</param>
		/// <param name="sideBarIndex">Index of the icon for the view in the side bar.</param>
		/// <param name="sideBarItemName">Name of the side bar item.</param>
		/// ------------------------------------------------------------------------------------
		protected virtual void AddPrintLayoutView(string viewName, TeViewType viewType,
			string pubName, TeResourceHelper.SideBarIndices sideBarIndex, string sideBarItemName)
		{
			// Add this user view to the Scripture sidebar tab.
			SBTabItemProperties itemProps = new SBTabItemProperties(this);
			itemProps.Name = sideBarItemName;
			itemProps.Text = viewName;
			itemProps.ImageIndex = (int)sideBarIndex;
			itemProps.Tag = viewType;
			itemProps.Message = "SwitchActiveView";
			AddSideBarTabItem(kScrSBTabName, itemProps);
			m_uncreatedViews.Add(viewType,
				new TePrintLayoutViewFactory(viewName, viewType, pubName, CreatePrintLayoutView));
		}
Exemplo n.º 20
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Add item to a category tab.
		/// Silently fail if no such tab.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void AddTabItem(int tabIndex, SBTabItemProperties itemProps)
		{
			throw new NotImplementedException(); // TODO for SilSidePane
		}
Exemplo n.º 21
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the Scripture/Vertical View.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected ISelectableView CreateVerticalView(string viewName, TeViewType viewType,
			SBTabItemProperties tabItem)
		{
			// Current view cannot handle an empty project, so the quick fix is to not put up the
			// view at all for an empty project. User will need to add a book and then re-open TE.
			// Since this is only for testing now, this seems like the safest/easiest fix.
			//
			// This will not prevent crashes if the last book is deleted. There are also other ways
			// you can probably crash the view - delete the section that the view is showing.
			if (Cache.LangProject.TranslatedScriptureOA.ScriptureBooksOS.Count == 0)
				return null;

			// Create a draft view (adapted from CreateDraftContainer).
			DraftView vDraft = new VerticalDraftView(m_cache, m_app, m_app, false, Handle.ToInt32());
			// Although the constructor sets this, setting it with the setter (bizarrely) does extra stuff which for the
			// moment we need. When we refine VerticalDraftView so it doesn't use laziness, we can remove this, since
			// it won't need the paragraph counter which the Cache setter creates.
			vDraft.Cache = m_cache;
			vDraft.StyleSheet = m_StyleSheet;
			vDraft.MakeRoot();
			vDraft.Editable = true;

			vDraft.Anchor = AnchorStyles.Top | AnchorStyles.Left |
				AnchorStyles.Right | AnchorStyles.Bottom;
			vDraft.Dock = DockStyle.Fill;
			((ISelectableView)vDraft).BaseInfoBarCaption = "VEdit";

			// This is done in the constructors of many of our other views, and it is essential that a
			// main client window be not visible, otherwise, it appears initially even if not meant to
			// be selected (at least, the last one created and brought to the front appears). Only one
			// client control is supposed to be visible.
			// I thought it better to put it here because the VerticalDraftView is parallel in function
			// to a regular DraftView, and if there are other clients, they may not want it be initially
			// invisible; unlike other classes used as client windows, this one is not necessarily
			// intended to be used ONLY as a direct client window of the main window. So I put setting
			// the visibility here.
			vDraft.Visible = false;

			if (tabItem != null)
			{
				tabItem.Tag = vDraft;
				tabItem.Update = true;
			}

			ClientControls.Add(vDraft);
			// Bring the draftView to the top of the z-order, so that
			// (if it is the active view) it fills only the remaining space (Review JohnT: is this needed here? Copied from DraftView)
			vDraft.BringToFront();
			m_rgClientViews.Add(TeEditingHelper.ViewTypeString(TeViewType.VerticalView), vDraft);
			m_uncreatedViews.Remove(TeViewType.VerticalView);
			return vDraft;
		}
Exemplo n.º 22
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Add filters to the side bar
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected void AddFilters()
		{
			// Add defined filters to the filters submenu and to the filters sidebar tab
			if (TMAdapter == null)
				return;

			SBTabItemProperties sbItemProps;
			TMItemProperties tmItemProps;
			foreach (ICmFilter filter in m_cache.LangProject.FiltersOC)
			{
				// only use filters that are defined for this application
				if (filter.App != TeResourceHelper.TeAppGuid)
					continue;

				switch (filter.ClassId)
				{
					case ScrScriptureNoteTags.kClassId:
					{
						string strFilterName =
							Properties.Resources.ResourceManager.GetString(filter.FilterName);

						// Add this filter to the Filters sidebar tab
						sbItemProps = new SBTabItemProperties(this);
						sbItemProps.Name = filter.Name;
						sbItemProps.Text = strFilterName;
						sbItemProps.ImageIndex = (int)TeResourceHelper.SideBarIndices.BasicFilter;
						sbItemProps.Tag = filter;
						sbItemProps.Message = "ChangeFilter";
						sbItemProps.ClickAlways = true;
						AddSideBarTabItem(kstidFilterSBTabInternalName, sbItemProps);
						break;
					}
					default:
						// ENHANCE: if other types of filters are needed, add handlers here
						break;
				}
			}
		}
Exemplo n.º 23
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds an item to the specified tab.
		/// </summary>
		/// <param name="tabIndex"></param>
		/// <param name="itemProps"></param>
		/// ------------------------------------------------------------------------------------
		public void AddTabItem(int tabIndex, SBTabItemProperties itemProps)
		{
			try
			{
				AddTabItem(m_navPane.Items[tabIndex].Name, itemProps);
			}
			catch
			{
			}
		}
Exemplo n.º 24
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Checking/Key Terms View
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected virtual void AddKeyTermsView(string viewName)
		{
			// Add this user view to the Checking sidebar tab.
			m_keyTermsViewItemProps = new SBTabItemProperties(this);
			m_keyTermsViewItemProps.Name = kChkKeyTermsSBItemName;
			m_keyTermsViewItemProps.Text = viewName;
			m_keyTermsViewItemProps.ImageIndex = (int)TeResourceHelper.SideBarIndices.KeyTerms;
			m_keyTermsViewItemProps.Tag = TeViewType.KeyTerms;
			m_keyTermsViewItemProps.Message = "SwitchActiveView";
			AddSideBarTabItem(kChkSBTabName, m_keyTermsViewItemProps);
			m_uncreatedViews.Add(TeViewType.KeyTerms, new TeSelectableViewFactory(viewName,
				TeViewType.KeyTerms, CreateKeyTermsView));
		}
Exemplo n.º 25
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds tab items to the sidebar (if the adapter is not null) via the sidebar/info.
		/// bar adapter. When running tests, the adapter will be null. - from FwMainWnd.cs
		/// </summary>
		/// <param name="tab"></param>
		/// <param name="itemProps"></param>
		/// ------------------------------------------------------------------------------------
		protected void AddSideBarTabItem(string tab, SBTabItemProperties itemProps)
		{
			if (SIBAdapter != null)
				SIBAdapter.AddTabItem(tab, itemProps);
		}
Exemplo n.º 26
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the Back Translation/Print Layout View
		/// </summary>
		/// <param name="viewName">Name of the view.</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="pubName">Name of the publication.</param>
		/// <param name="tabItem">The tab item.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected ISelectableView CreateBackTransPrintLayoutView(string viewName,
			TeViewType viewType, string pubName, SBTabItemProperties tabItem)
		{
			// Construct the publication control (client window)
			IPublication pub =
				Cache.ServiceLocator.GetInstance<IPublicationRepository>().FindByName(pubName);
			int ws = GetBackTranslationWsForView(TeEditingHelper.ViewTypeString(viewType));
			ScripturePublication pubControl = CreatePublicationView(pub, viewType, ws);
			pubControl.BaseInfoBarCaption = viewName;
			IWritingSystem wsObj = m_cache.ServiceLocator.WritingSystemManager.Get(ws);

			using (NonUndoableUnitOfWorkHelper uowHelper =
				new NonUndoableUnitOfWorkHelper(m_cache.ServiceLocator.ActionHandler))
			{
				pub.IsLeftBound = !wsObj.RightToLeftScript;
				uowHelper.RollBack = false;
			}

			if (tabItem != null)
			{
				tabItem.Tag = pubControl;
				tabItem.Update = true;
			}

			ClientControls.Add(pubControl);

			// Bring the publication to the top of the z-order, so that
			// (if it is the active view) it fills only the remaining space
			ClientControls.SetChildIndex(pubControl, 0);
			m_rgClientViews.Add(TeEditingHelper.ViewTypeString(viewType), pubControl);
			m_uncreatedViews.Remove(viewType);
			return pubControl;
		}
Exemplo n.º 27
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the Back Translation/Draft View
		/// </summary>
		/// <param name="viewName">Name of the view.</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="tabItem">The tab item.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected ISelectableView CreateBackTransDraftView(string viewName, TeViewType viewType,
			SBTabItemProperties tabItem)
		{
			TeScrDraftViewProxy draftView = new TeScrDraftViewProxy(this, kDraftViewName, true,
				true, false, TeViewType.DraftView);
			TeScrDraftViewProxy btDraftView = new TeScrDraftViewProxy(this, kBackTransView, true,
				true, false, TeViewType.BackTranslationDraft);
			DraftStylebarProxy stylebar = new DraftStylebarProxy(this, "BTSplit", false);

			TeFootnoteDraftViewProxy footnoteDraftView = new TeFootnoteDraftViewProxy(this,
				kDraftFootnoteViewName, true, false);
			TeFootnoteDraftViewProxy footnoteBtDraftView = new TeFootnoteDraftViewProxy(this,
				kBackTransFootnoteView, true, true);
			DraftStylebarProxy footnoteStylebar = new DraftStylebarProxy(this,
				"BackTransFootnote", true);

			// Construct the one view wrapper
			BtDraftSplitWrapper btWrap = new BtDraftSplitWrapper(kBtDraftSplitView, this,
				m_cache, StyleSheet, SettingsKey, draftView, stylebar, btDraftView,
				footnoteDraftView, footnoteStylebar, footnoteBtDraftView);
			((ISelectableView)btWrap).BaseInfoBarCaption = viewName;

			if (tabItem != null)
			{
				tabItem.Tag = btWrap;
				tabItem.Update = true;
			}

			ClientControls.Add(btWrap);
			// Bring the wrapper to the top of the z-order, so that
			// (if it is the active view) it fills only the remaining space
			btWrap.BringToFront();
			//Debug.Assert(m_rgClientViews.Count >= 1);
			m_rgClientViews.Add(TeEditingHelper.ViewTypeString(TeViewType.BackTranslationDraft), btWrap);
			m_uncreatedViews.Remove(TeViewType.BackTranslationDraft);
			return btWrap;
		}
Exemplo n.º 28
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the key terms view when the user switches to it.
		/// </summary>
		/// <param name="viewName">Name of the view.</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="tabItem">The tab item.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected virtual ISelectableView CreateKeyTermsView(string viewName,
			TeViewType viewType, SBTabItemProperties tabItem)
		{
			Debug.Assert(TheKeyTermsWrapper == null);

			// Construct a key terms view (client window)
			CheckingViewProxy checkingViewProxy = new CheckingViewProxy(this, "BiblicalTermsDraftView");

			KeyTermsViewWrapper keyTermsViewWrapper = new KeyTermsViewWrapper(this, m_cache,
				checkingViewProxy, m_app.ProjectSpecificSettingsKey, Handle.ToInt32(),
				m_delegate.GetProjectName(m_cache), m_StyleSheet, m_app);
			((ISelectableView)keyTermsViewWrapper).BaseInfoBarCaption = viewName;

			if (tabItem != null)
			{
				tabItem.Tag = keyTermsViewWrapper;
				tabItem.Update = true;
			}

			ClientControls.Add(keyTermsViewWrapper);
			// Bring the key terms view to the top of the z-order, so that
			// (if it is the active view) it fills only the remaining space
			ClientControls.SetChildIndex(keyTermsViewWrapper, 0);
			m_rgClientViews.Add(TeEditingHelper.ViewTypeString(TeViewType.KeyTerms),
				keyTermsViewWrapper as IRootSite);
			m_uncreatedViews.Remove(TeViewType.KeyTerms);

			return keyTermsViewWrapper;
		}
Exemplo n.º 29
0
		/// <summary></summary>
		private void ProcessTabItemClick(SBTabItemProperties itemProperties)
		{
			Debug.Assert(null != itemProperties, "Argument itemProperties shouldn't be null");
			Debug.Assert(null != m_mediator, "m_mediator shouldn't be null");
			m_selectedTabItems[itemProperties.OwningTabName] = itemProperties.Name;
			m_mediator.SendMessage(itemProperties.Message, itemProperties);
		}
Exemplo n.º 30
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Add item to a category tab
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public void AddTabItem(string tabName, SBTabItemProperties itemProps)
		{
			Tab tab = m_sidePane.GetTabByName(tabName);
			Item item = new Item(itemProps.Name);
			item.Text = itemProps.Text;
			item.Icon = m_largeItemImages.Images[itemProps.ImageIndex];
			item.Tag = itemProps;
			itemProps.OwningTabName = tabName;
			m_tabItemProps.Add(itemProps);
			m_sidePane.AddItem(tab, item);
		}
Exemplo n.º 31
0
        /// <summary></summary>
        private void HandleSidePaneItemClick(Item itemClicked)
        {
            SBTabItemProperties itemProperties = itemClicked.Tag as SBTabItemProperties;

            ProcessTabItemClick(itemProperties);
        }
Exemplo n.º 32
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Back Translation/Print Layout View
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected virtual void AddBackTransPrintLayoutView(string viewName, TeViewType viewType)
		{
			bool fIsSideBySide = viewType == TeViewType.BackTranslationParallelPrint;

			// Add this user view to the BackTrans sidebar tab.
			SBTabItemProperties itemProps = new SBTabItemProperties(this);
			itemProps.Name = fIsSideBySide ?
				kBTPrintLayoutSbsSBItemName : kBTPrintLayoutSBItemName;
			itemProps.Text = viewName;
			itemProps.ImageIndex = fIsSideBySide ?
				(int)TeResourceHelper.SideBarIndices.BTParallelPrintLayout :
				(int)TeResourceHelper.SideBarIndices.BTSimplePrintLayout;
			itemProps.Tag = viewType;
			itemProps.Message = "SwitchActiveView";
			AddSideBarTabItem("TabBackTrans", itemProps);

			string pubName = (viewType == TeViewType.BackTranslationParallelPrint) ?
				"Back Translation Side-by-Side" : "Back Translation";

			m_uncreatedViews.Add(viewType, new TePrintLayoutViewFactory(viewName, viewType,
				pubName, CreateBackTransPrintLayoutView));
		}
Exemplo n.º 33
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Setup the sidebar/info. bar adapter.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void SetupSideBarInfoBar()
		{
			// Null when running tests.
			if (SIBAdapter == null)
				return;

			SIBAdapter.ItemImageListLarge = TeResourceHelper.TeSideBarLargeImages;
			SIBAdapter.ItemImageListSmall = TeResourceHelper.TeSideBarSmallImages;
			SIBAdapter.TabImageList = TeResourceHelper.TeSideBarTabImages;
			SIBAdapter.LargeIconModeImageIndex = 4;
			SIBAdapter.SmallIconModeImageIndex = 5;

			string fmttooltip = TeResourceHelper.GetResourceString("kstidInfoBarButtonTooltipFormat");

			// Add the views tab.
			SBTabProperties tabProps = new SBTabProperties();
			tabProps.Name = kViewsSBTabInternalName;
			tabProps.Text = TeResourceHelper.GetResourceString("kstidViews");
			tabProps.Message = "SideBarTabClicked";
			tabProps.InfoBarButtonToolTipFormat = fmttooltip;
			tabProps.ImageIndex = 0;
			SIBAdapter.AddTab(tabProps);

			// Add the filters tab.
			tabProps = new SBTabProperties();
			tabProps.Name = kstidFilterSBTabInternalName;
			tabProps.Text = TeResourceHelper.GetResourceString("kstidFilters");
			tabProps.InfoBarButtonToolTipFormat = fmttooltip;
			tabProps.ImageIndex = 6;
			SIBAdapter.AddTab(tabProps);

			// Add the "No filter" button to the filters tab
			SBTabItemProperties itemProps = new SBTabItemProperties(this);
			itemProps.Name = kstidNoFilter;
			itemProps.Text = TeResourceHelper.GetResourceString(kstidNoFilter);
			itemProps.ImageIndex = (int)TeResourceHelper.SideBarIndices.NoFilter;
			itemProps.Tag = null;
			itemProps.Message = "ChangeFilter";
			itemProps.ClickAlways = true;
			AddSideBarTabItem(kstidFilterSBTabInternalName, itemProps);

			// Add the sort tab.
			tabProps = new SBTabProperties();
			tabProps.Name = kstidSortSBTabInternalName;
			tabProps.Text = TeResourceHelper.GetResourceString("kstidSort");
			tabProps.InfoBarButtonToolTipFormat = fmttooltip;
			tabProps.ImageIndex = 7;
			SIBAdapter.AddTab(tabProps);

			// Add the "Reference" button to the sort methods tab
			itemProps = new SBTabItemProperties(this);
			// REVIEW: When we implement sort orders defined in the DB, we'll need to consider
			// whether we want to have one hard-coded sort-order like this or not.
			itemProps.Name = kstidReferenceSort;
			itemProps.Text = TeResourceHelper.GetResourceString("kstidReferenceSort");
			itemProps.ImageIndex = (int)TeResourceHelper.SideBarIndices.SortMethod;
			itemProps.Tag = null;
			itemProps.Message = "ChangeSortMethod";
			AddSideBarTabItem(kstidSortSBTabInternalName, itemProps);

			// Set current tab and item - No filter by default
			SIBAdapter.SetCurrentTabItem(kstidFilterSBTabInternalName, kstidNoFilter, true);
			SIBAdapter.SetCurrentTabItem(kstidSortSBTabInternalName, kstidReferenceSort, true);
		}
Exemplo n.º 34
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Back Translation/Draft View
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected virtual void AddBackTransDraftView(string viewName)
		{
			// Add this user view to the BackTrans sidebar tab.
			SBTabItemProperties itemProps = new SBTabItemProperties(this);
			itemProps.Name = kBTDraftViewSBItemName;
			itemProps.Text = viewName;
			itemProps.ImageIndex = (int)TeResourceHelper.SideBarIndices.BTDraft;
			itemProps.Tag = TeViewType.BackTranslationDraft;
			itemProps.Message = "SwitchActiveView";
			AddSideBarTabItem(kBTSBTabName, itemProps);
			m_uncreatedViews.Add(TeViewType.BackTranslationDraft,
				new TeSelectableViewFactory(viewName, TeViewType.BackTranslationDraft,
					CreateBackTransDraftView));
		}
Exemplo n.º 35
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Notes Data Entry View
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected virtual void AddNotesView(string viewName, int wsUser)
		{
			m_dataEntryView = new NotesDataEntryView(Cache, m_app, viewName, this);
			m_dataEntryView.Zoom = m_zoomPercent;
			m_dataEntryView.StyleSheet = m_StyleSheet;
			m_dataEntryView.Dock = DockStyle.Fill;
			m_dataEntryView.FilterChanged += NoteFilterChanged;

			// Add this user view to the sidebar tab.
			SBTabItemProperties itemProps = new SBTabItemProperties(this);
			itemProps.Name = viewName;
			itemProps.Text = viewName;
			itemProps.ImageIndex = (int)TeResourceHelper.SideBarIndices.DataEntry;
			itemProps.Tag = m_dataEntryView;
			itemProps.Message = "SwitchActiveView";
			AddSideBarTabItem(kViewsSBTabInternalName, itemProps);

			ClientControls.Add(m_dataEntryView);
			// Bring the draftView to the top of the z-order, so that
			// (if it is the active view) it fills only the remaining space
			m_dataEntryView.BringToFront();
			m_rgClientViews.Add(m_dataEntryView.GetType().Name, m_dataEntryView);
		}
Exemplo n.º 36
0
			/// --------------------------------------------------------------------------------
			/// <summary>
			/// Creates an ISelectableView
			/// </summary>
			/// <param name="tabItem">The tab item.</param>
			/// <returns></returns>
			/// --------------------------------------------------------------------------------
			public override ISelectableView Create(SBTabItemProperties tabItem)
			{
				return m_creatorMethod(m_viewName, m_viewType, m_pubName, tabItem);
			}
Exemplo n.º 37
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds an item to the specified tab.
		/// </summary>
		/// <param name="tabName"></param>
		/// <param name="itemProps"></param>
		/// ------------------------------------------------------------------------------------
		public void AddTabItem(string tabName, SBTabItemProperties itemProps)
		{
			SideBarTab tab = m_navPane.Items[tabName] as SideBarTab;
			if (tab != null)
				tab.AddTabItem(itemProps);
		}
Exemplo n.º 38
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="itemName"></param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		internal SBTabItemProperties GetItemProps(string itemName)
		{
			// TE-7929 indicates there is some case in which a null reference exception
			// can be thrown in this method. However, the exception cannot be reproduced
			// and the stack trace in the issue does not include line numbers so we're not
			// sure which object is null. Therefore, add some checks for insurance.
			if (string.IsNullOrEmpty(itemName) || m_bar == null || m_bar.Items == null ||
				!m_bar.Items.Contains(itemName))
			{
				return null;
			}

			ButtonItem item = m_bar.Items[itemName] as ButtonItem;

			if (item == null)
				return null;

			SBTabItemProperties itemProps = new SBTabItemProperties(this.TopLevelControl as Form);

			// TE-7171 indicates there is some case in which a null reference exception
			// can be thrown in this method. However, the exception cannot be reproduced
			// and the stack trace in the issue does not include line numbers so we're not
			// sure which object is null. Therefore, add some checks for insurance.
			if (itemProps == null)
				return null;

			itemProps.Name = itemName;
			itemProps.Text = item.Text;
			itemProps.Tooltip = item.Tooltip;
			itemProps.ImageIndex = item.ImageIndex;
			itemProps.OwningTabName = Name;
			object clientTag;
			itemProps.Tag = (m_tags.TryGetValue(item, out clientTag) ? clientTag : null);

			// Before TE-7171 we used to assume item.Tag is always a TagHelper (which should
			// always be the case), but for insurance, put a check here so an exception isn't
			// thrown.
			TagHelper tag = item.Tag as TagHelper;
			if (tag != null)
			{
				itemProps.Message = tag.Message;
				itemProps.ClickAlways = tag.ClickAlways;
			}

			return itemProps;
		}
Exemplo n.º 39
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Scripture/Vertical View.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected virtual void AddVerticalView(string viewName)
		{
			// Add this user view to the Scripture sidebar tab.
			SBTabItemProperties itemProps = new SBTabItemProperties(this);
			itemProps.Name = kScrVerticalViewSBItemName;
			itemProps.Text = "VEdit";
			itemProps.ImageIndex = (int)TeResourceHelper.SideBarIndices.Draft; // should maybe be some new constant?
			itemProps.Tag = TeViewType.VerticalView;
			itemProps.Message = "SwitchActiveView";
			AddSideBarTabItem(kScrSBTabName, itemProps);
			m_uncreatedViews.Add(TeViewType.VerticalView,
				new TeSelectableViewFactory(viewName, TeViewType.VerticalView, CreateVerticalView));
		}
Exemplo n.º 40
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Add item to a category tab.
 /// Silently fail if no such tab.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public void AddTabItem(int tabIndex, SBTabItemProperties itemProps)
 {
     throw new NotImplementedException();             // TODO for SilSidePane
 }
Exemplo n.º 41
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the Scripture/Draft View
		/// </summary>
		/// <param name="viewName">Name of the view.</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="tabItem">The tab item.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected ISelectableView CreateDraftView(string viewName, TeViewType viewType,
			SBTabItemProperties tabItem)
		{
			TeScrDraftViewProxy topDraftView = new TeScrDraftViewProxy(this, "TopDraftView",
				true, false, false, TeViewType.DraftView);
			DraftStylebarProxy topStylebar = new DraftStylebarProxy(this, "Top", false);
			TeScrDraftViewProxy bottomDraftView = new TeScrDraftViewProxy(this, "BottomDraftView",
				true, false, false, TeViewType.DraftView);
			DraftStylebarProxy bottomStylebar = new DraftStylebarProxy(this, "Bottom", false);

			TeFootnoteDraftViewProxy footnoteDraftView = new TeFootnoteDraftViewProxy(this,
				"DraftFootnoteView", true, false);
			DraftStylebarProxy footnoteStylebar = new DraftStylebarProxy(this, "Footnote", true);

			// Construct the one draft view wrapper (client window)
			DraftViewWrapper draftViewWrap = new DraftViewWrapper(kDraftViewWrapperName, this,
				m_cache, StyleSheet, SettingsKey, topDraftView, topStylebar, bottomDraftView,
				bottomStylebar, footnoteDraftView, footnoteStylebar);
			((ISelectableView)draftViewWrap).BaseInfoBarCaption = viewName;
			draftViewWrap.ResumeLayout();

			if (tabItem != null)
			{
				tabItem.Tag = draftViewWrap;
				tabItem.Update = true;
			}

			ClientControls.Add(draftViewWrap);
			// Bring the draftView to the top of the z-order, so that
			// (if it is the active view) it fills only the remaining space
			draftViewWrap.BringToFront();
			m_rgClientViews.Add(TeEditingHelper.ViewTypeString(viewType), draftViewWrap);
			m_uncreatedViews.Remove(viewType);
			return draftViewWrap;
		}
Exemplo n.º 42
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the editorial checks view when the user switches to it.
		/// </summary>
		/// <param name="viewName">Name of the view.</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="tabItem">The tab item.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected virtual ISelectableView CreateEditorialChecksView(string viewName,
			TeViewType viewType, SBTabItemProperties tabItem)
		{
			// Construct a editorial checks view (client window)
			var checkingViewProxy = new CheckingViewProxy(this, "EditorialChecksDraftView");

			EditorialChecksViewWrapper viewWrapper = new EditorialChecksViewWrapper(this,
				m_cache, m_bookFilter, checkingViewProxy, m_app.ProjectSpecificSettingsKey,
				m_delegate.GetProjectName(m_cache), m_app, m_app);

			((ISelectableView)viewWrapper).BaseInfoBarCaption = viewName;

			if (tabItem != null)
			{
				tabItem.Tag = viewWrapper;
				tabItem.Update = true;
			}

			ClientControls.Add(viewWrapper);
			// Bring the key terms view to the top of the z-order, so that
			// (if it is the active view) it fills only the remaining space
			ClientControls.SetChildIndex(viewWrapper, 0);
			m_rgClientViews.Add(TeEditingHelper.ViewTypeString(TeViewType.EditorialChecks),
				viewWrapper);
			m_uncreatedViews.Remove(TeViewType.EditorialChecks);

			return viewWrapper;
		}
Exemplo n.º 43
0
 /// <summary></summary>
 private void ProcessTabItemClick(SBTabItemProperties itemProperties)
 {
     m_mediator.SendMessage(itemProperties.Message, itemProperties);
 }
Exemplo n.º 44
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds an item to the specified tab.
		/// </summary>
		/// <param name="itemProps"></param>
		/// ------------------------------------------------------------------------------------
		internal void AddTabItem(SBTabItemProperties itemProps)
		{
			// Add a new item to this tab's item list (which is just a DNB toolbar) and get
			// back the item created for us.
			ButtonItem item = m_itemPanel.AddItem(itemProps);

			if (item == null)
				return;

			item.Click += item_Click;

			// Create a menu item for this tab item and add it to the menu just above the
			// configure menu item.
			ButtonItem menuItem = (ButtonItem)item.Copy();
			menuItem.Text = menuItem.Text.Replace(Environment.NewLine, " ");

			// Make sure the menu text will be visible.
			if (menuItem.ForeColor == Color.White)
				menuItem.ForeColor = SystemColors.MenuText;

			int i = m_menu.SubItems.IndexOf(m_cfgMenuItem);
			m_menu.SubItems.Add(menuItem, i);
			UpdateMenuImages();
		}
Exemplo n.º 45
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="itemName"></param>
		/// <param name="text"></param>
		/// <param name="imageIndex"></param>
		/// ------------------------------------------------------------------------------------
		internal ButtonItem AddItem(SBTabItemProperties itemProps)
		{
			ButtonItem item = new ButtonItem(itemProps.Name, itemProps.Text);
			item.Tag = new TagHelper(itemProps.ClickAlways, itemProps.Message);
			item.ImageIndex = itemProps.ImageIndex;
			item.ImagePosition = (SmallIconMode ? eImagePosition.Left : eImagePosition.Top);
			item.Style = (m_themesActive ? eDotNetBarStyle.Office2003 : eDotNetBarStyle.Office2000);
			item.OptionGroup = Name;
			item.AccessibleName = itemProps.Text;
			item.ButtonStyle = eButtonStyle.ImageAndText;

			m_tags[item] = itemProps.Tag;
			m_bar.Items.Add(item);

			// Don't take the default fore color when we're in Window's 2000 style.
			if (!m_themesActive)
				item.ForeColor = Color.White;

			return item;
		}
Exemplo n.º 46
0
			/// --------------------------------------------------------------------------------
			/// <summary>
			/// Creates an ISelectableView
			/// /// </summary>
			/// <param name="tabItem">The tab item.</param>
			/// <returns></returns>
			/// --------------------------------------------------------------------------------
			public virtual ISelectableView Create(SBTabItemProperties tabItem)
			{
				return m_creatorMethod(m_viewName, m_viewType, tabItem);
			}
Exemplo n.º 47
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Scripture/Draft View - from TeMainWnd.cs
		/// </summary>
		/// <param name="userView"></param>
		/// ------------------------------------------------------------------------------------
		protected virtual void AddDraftView()//IUserView userView)
		{
			// Add this user view to the Scripture sidebar tab.
			SBTabItemProperties itemProps = new SBTabItemProperties(this);
			itemProps.Name = kScrDraftViewSBItemName;
			itemProps.Text = "Parallel Print Layout";
			itemProps.ImageIndex = (int)TeResourceHelper.SideBarIndices.Draft;
			//itemProps.Tag = TeViewType.DraftView;
			itemProps.Message = "SwitchActiveView";
			AddSideBarTabItem(kScrSBTabName, itemProps);
		}
Exemplo n.º 48
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Updates the item props.
		/// </summary>
		/// <param name="itemProps">The item props.</param>
		/// ------------------------------------------------------------------------------------
		internal void UpdateItemProps(SBTabItemProperties itemProps)
		{
			if (!itemProps.Update)
				return;

			ButtonItem item = m_bar.Items[itemProps.Name] as ButtonItem;

			if (item == null)
				return;

			item.Text = itemProps.Text;
			item.Tooltip = itemProps.Tooltip;
			item.ImageIndex = itemProps.ImageIndex;
			m_tags[item] = itemProps.Tag;

			TagHelper tag = item.Tag as TagHelper;
			if (tag == null)
				item.Tag = new TagHelper(itemProps.ClickAlways, itemProps.Message);
			else
			{
				tag.Message = itemProps.Message;
				tag.ClickAlways = itemProps.ClickAlways;
			}
		}
Exemplo n.º 49
0
		protected virtual void AddVerticalView2()//IUserView userView)
		{
			// Add this user view to the Scripture sidebar tab.
			SBTabItemProperties itemProps = new SBTabItemProperties(this);
			itemProps.Name = kScrVerticalViewSBItemName+"2";
			itemProps.Text = "VEdit2";
			itemProps.ImageIndex = (int)TeResourceHelper.SideBarIndices.Draft;
		//	itemProps.Tag = TeViewType.VerticalView;
			itemProps.Message = "SwitchActiveView";
			AddSideBarTabItem(kBTSBTabName, itemProps);
		}
Exemplo n.º 50
0
		/// <summary></summary>
		private void ProcessTabItemClick(SBTabItemProperties itemProperties)
		{
			m_mediator.SendMessage(itemProperties.Message, itemProperties);
		}