Esempio n. 1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Back Translation/Print Layout View
		/// </summary>
		/// <param name="userView"></param>
		/// <param name="viewType"></param>
		/// ------------------------------------------------------------------------------------
		protected virtual void AddBackTransPrintLayoutView(UserView userView, 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 = userView.ViewNameShort;
			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(userView, viewType,
				pubName, CreateBackTransPrintLayoutView));
		}
Esempio n. 2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Scripture/Print layout View
		/// </summary>
		/// <param name="userView">The user view.</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="viewName">Name of the resource string for 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(UserView userView, TeViewType viewType,
			string viewName, 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 = userView.ViewNameShort;
			itemProps.ImageIndex = (int)sideBarIndex;
			itemProps.Tag = viewType;
			itemProps.Message = "SwitchActiveView";
			AddSideBarTabItem(kScrSBTabName, itemProps);
			m_uncreatedViews.Add(viewType,
				new TePrintLayoutViewFactory(userView, viewType, pubName, CreatePrintLayoutView));
		}
Esempio n. 3
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Back Translation/Draft View
		/// </summary>
		/// <param name="userView"></param>
		/// ------------------------------------------------------------------------------------
		protected virtual void AddBackTransDraftView(UserView userView)
		{
			// Add this user view to the BackTrans sidebar tab.
			SBTabItemProperties itemProps = new SBTabItemProperties(this);
			itemProps.Name = kBTDraftViewSBItemName;
			itemProps.Text = userView.ViewNameShort;
			itemProps.ImageIndex = (int)TeResourceHelper.SideBarIndices.BTDraft;
			itemProps.Tag = TeViewType.BackTranslationDraft;
			itemProps.Message = "SwitchActiveView";
			AddSideBarTabItem(kBTSBTabName, itemProps);
			m_uncreatedViews.Add(TeViewType.BackTranslationDraft,
				new TeSelectableViewFactory(userView, TeViewType.BackTranslationDraft,
					CreateBackTransDraftView));
		}
Esempio n. 4
0
		/// <summary>
		/// Make a deep copy of a UserView.
		/// </summary>
		/// <returns>A deep copy of a UserView, but with new database IDs for all objects.</returns>
		internal IUserView Clone()
		{
			int iID = m_cache.CreateObject(ClassID);
			UserView uvClone = new UserView(m_cache , iID);
			// Regular properties.
			uvClone.Name.AnalysisDefaultWritingSystem = Name.AnalysisDefaultWritingSystem;
			uvClone.Name.VernacularDefaultWritingSystem = Name.VernacularDefaultWritingSystem;
			uvClone.Type = Type;
			uvClone.App = App;
			uvClone.System = System;
			uvClone.SubType = SubType;
			// UserViewRec objects.
			foreach (UserViewRec uvr in RecordsOC)
			{
				IUserViewRec uvrClone = uvr.Clone(uvClone);
			}
			// Handle extra data members.
			uvClone.m_wsAlt = m_wsAlt;
			uvClone.m_iwndClient = m_iwndClient;
			uvClone.m_fIgnoreHier = m_fIgnoreHier;
			uvClone.m_nMaxLines = m_nMaxLines;
			ResetDetails();

			return uvClone as IUserView;
		}
Esempio n. 5
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the Scripture/Draft View
		/// </summary>
		/// <param name="userView">The user view.</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="tabItem">The tab item.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected ISelectableView CreateDraftView(UserView userView, TeViewType viewType,
			SBTabItemProperties tabItem)
		{
			DraftViewCreateInfo topDraftView = new DraftViewCreateInfo("TopDraftView", false,
				false, false, true, true, TeViewType.DraftView);
			StylebarCreateInfo topStylebar = new StylebarCreateInfo("Top", false);
			DraftViewCreateInfo bottomDraftView = new DraftViewCreateInfo("BottomDraftView", false,
				false, false, true, true, TeViewType.DraftView);
			StylebarCreateInfo bottomStylebar = new StylebarCreateInfo("Bottom", false);

			FootnoteCreateInfo footnoteDraftView = new FootnoteCreateInfo("DraftFootnoteView", false,
				true);
			StylebarCreateInfo footnoteStylebar = new StylebarCreateInfo("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 = userView.ViewNameShort;
			draftViewWrap.ResumeLayout();

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

			Debug.Assert(m_scrDraftView == null, "Shouldn't try to create a draft view if one already exists");
			m_scrDraftView = draftViewWrap;
			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();
			ClientWindows.Add(TeEditingHelper.ViewTypeString(viewType), draftViewWrap);
			m_uncreatedViews.Remove(viewType);
			return draftViewWrap;
		}
Esempio n. 6
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Back Translation/Draft View
		/// </summary>
		/// <param name="userView"></param>
		/// ------------------------------------------------------------------------------------
		protected override void AddBackTransDraftView(UserView userView)
		{
			// We don't want to add anything but Scripture/Draft View.
		}
Esempio n. 7
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Checking/Key Terms View
		/// </summary>
		/// <param name="userView"></param>
		/// ------------------------------------------------------------------------------------
		protected override void AddKeyTermsView(UserView userView)
		{
			// We don't want to add anything but Scripture/Draft View.
		}
Esempio n. 8
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the key terms view when the user switches to it.
		/// </summary>
		/// <param name="userView">The user view.</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="tabItem">The tab item.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected virtual ISelectableView CreateKeyTermsView(UserView userView,
			TeViewType viewType, SBTabItemProperties tabItem)
		{
			Debug.Assert(TheKeyTermsWrapper == null);

			m_cache.MapType(typeof(ChkRef), typeof(KeyTermRef));

			// Construct a key terms view (client window)
			ChecksDraftViewCreateInfo keyTermsCreateInfo = new ChecksDraftViewCreateInfo(
				"KeyTermsDraftView", true);
			KeyTermsViewWrapper keyTermsViewWrapper = new KeyTermsViewWrapper(this, m_cache,
				keyTermsCreateInfo, SettingsKey, Handle.ToInt32(), m_delegate.GetProjectName(m_cache));
			((ISelectableView)keyTermsViewWrapper).BaseInfoBarCaption = userView.ViewNameShort;

			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);
			ClientWindows.Add(TeEditingHelper.ViewTypeString(TeViewType.KeyTerms),
				keyTermsViewWrapper as IRootSite);
			m_uncreatedViews.Remove(TeViewType.KeyTerms);

			return keyTermsViewWrapper;
		}
Esempio n. 9
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create RecordSpecs for default UserViewSpecs for the various views.
		/// </summary>
		/// <param name="userViewType">view type (e.g., kvwtConc, kvwtDraft)</param>
		/// <param name="taskName">Name of the task.</param>
		/// <param name="shortName">The short name of the view.</param>
		/// <returns>Newly created UserViewSpec</returns>
		/// ------------------------------------------------------------------------------------
		private UserView MakeNewView(UserViewType userViewType, string taskName,
			string shortName)
		{
			int hvoUserView = Cache.CreateObject(UserView.kclsidUserView);
			UserView userView = new UserView(Cache, hvoUserView);
			m_cache.UserViewSpecs.Add(userView);

			userView.Type = (int)userViewType;
			userView.FactoryView = true;
			userView.App = TeApp.AppGuid;
			userView.TaskName = taskName;
			userView.ViewNameShort = shortName; // prob same as userView.Name

			return userView;
		}
Esempio n. 10
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the Back Translation/Print Layout View
		/// </summary>
		/// <param name="userView">The user 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>
		/// ------------------------------------------------------------------------------------
		protected ISelectableView CreateBackTransPrintLayoutView(UserView userView,
			TeViewType viewType, string pubName, SBTabItemProperties tabItem)
		{
			// Construct the publication control (client window)
			IPublication pub = Publication.FindByName(m_cache, pubName);
			ScripturePublication pubControl = CreatePublicationView(pub, viewType);
			pubControl.BaseInfoBarCaption = userView.ViewNameShort;
			ILgWritingSystem lgws = new LgWritingSystem(m_cache, m_cache.DefaultAnalWs);

			using (new SuppressSubTasks(m_cache)) // We don't want this change to be undoable
			{
				pub.IsLeftBound = !lgws.RightToLeft;
			}

			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);
			ClientWindows.Add(TeEditingHelper.ViewTypeString(viewType), pubControl);
			m_uncreatedViews.Remove(viewType);
			pubControl.BackTranslationWS = GetBackTranslationWsForView(pubControl.Name);
			return pubControl;
		}
Esempio n. 11
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the editorial checks view when the user switches to it.
		/// </summary>
		/// <param name="userView">The user view.</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="tabItem">The tab item.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected virtual ISelectableView CreateEditorialChecksView(UserView userView,
			TeViewType viewType, SBTabItemProperties tabItem)
		{
			// Construct a editorial checks view (client window)
			ChecksDraftViewCreateInfo checkingViewInfo = new ChecksDraftViewCreateInfo(
				"EditorialChecksDraftView", true);

			EditorialChecksViewWrapper viewWrapper =
				new EditorialChecksViewWrapper(this, m_cache, m_bookFilter,
				checkingViewInfo, SettingsKey, m_delegate.GetProjectName(m_cache));

			((ISelectableView)viewWrapper).BaseInfoBarCaption = userView.ViewNameShort;

			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);
			ClientWindows.Add(TeEditingHelper.ViewTypeString(TeViewType.EditorialChecks),
				viewWrapper as IRootSite);
			m_uncreatedViews.Remove(TeViewType.EditorialChecks);

			return viewWrapper;
		}
Esempio n. 12
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the Back Translation/Draft View
		/// </summary>
		/// <param name="userView">The user view.</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="tabItem">The tab item.</param>
		/// ------------------------------------------------------------------------------------
		protected ISelectableView CreateBackTransDraftView(UserView userView, TeViewType viewType,
			SBTabItemProperties tabItem)
		{
			DraftViewCreateInfo draftView = new DraftViewCreateInfo(kDraftViewName, false,
				true, false, true, true, TeViewType.DraftView);
				// REVIEW (EberhardB): Do we need to or the Scripture and BT flags like this?   true, false, true, true, TeViewType.Scripture | TeViewType.BackTranslationDraft);
			DraftViewCreateInfo btDraftView = new DraftViewCreateInfo(kBackTransView, true,
				true, false, true, true, TeViewType.BackTranslationDraft);
			StylebarCreateInfo stylebar = new StylebarCreateInfo("BTSplit", false);

			FootnoteCreateInfo footnoteDraftView = new FootnoteCreateInfo(kDraftFootnoteViewName,
				false, true);
			FootnoteCreateInfo footnoteBtDraftView = new FootnoteCreateInfo(kBackTransFootnoteView,
				true, true);
			StylebarCreateInfo footnoteStylebar = new StylebarCreateInfo("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 = userView.ViewNameShort;

			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(ClientWindows.Count >= 1);
			ClientWindows.Add(TeEditingHelper.ViewTypeString(TeViewType.BackTranslationDraft), btWrap);
			m_uncreatedViews.Remove(TeViewType.BackTranslationDraft);
			return btWrap;
		}
Esempio n. 13
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the Back Translation Review view
		/// </summary>
		/// <param name="userView">The user view.</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="tabItem">The tab item.</param>
		/// <returns></returns>
		/// ------------------------------------------------------------------------------------
		protected ISelectableView CreateBackTransConsultantCheckView(UserView userView,
			TeViewType viewType, SBTabItemProperties tabItem)
		{
			DraftViewCreateInfo topDraftView = new DraftViewCreateInfo("BTReviewDraftView", true,
				false, false, true, false, TeViewType.BackTranslationConsultantCheck);
			StylebarCreateInfo topStylebar = new StylebarCreateInfo("BTReview", false);

			FootnoteCreateInfo footnoteDraftView = new FootnoteCreateInfo("BTReviewFootnoteView", true,
				false);
			StylebarCreateInfo footnoteStylebar = new StylebarCreateInfo("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 = userView.ViewNameShort;

			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();
			ClientWindows.Add(TeEditingHelper.ViewTypeString(TeViewType.BackTranslationConsultantCheck),
				reviewWrap);
			m_uncreatedViews.Remove(TeViewType.BackTranslationConsultantCheck);
			return reviewWrap;
		}
Esempio n. 14
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates the Scripture/Vertical View.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected ISelectableView CreateVerticalView(UserView userView, 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, false, true, 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;
			vDraft.Name = "vertical draft view";
			((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();
			ClientWindows.Add(TeEditingHelper.ViewTypeString(TeViewType.VerticalView), vDraft);
			m_uncreatedViews.Remove(TeViewType.VerticalView);
			return vDraft;
		}
Esempio n. 15
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Scripture/Draft View
		/// </summary>
		/// <param name="userView"></param>
		/// ------------------------------------------------------------------------------------
		protected override void AddDraftView(UserView userView)
		{
			base.AddDraftView(userView);
			m_DraftViewSpec = userView;
		}
Esempio n. 16
0
			/// --------------------------------------------------------------------------------
			/// <summary>
			/// Initializes a new instance of the <see cref="TeSelectableViewFactory"/> class.
			/// </summary>
			/// <param name="userView">The user view.</param>
			/// <param name="creatorMethod">The creator method.</param>
			/// <param name="viewType">Type of the view.</param>
			/// --------------------------------------------------------------------------------
			public TeSelectableViewFactory(UserView userView, TeViewType viewType,
				CreatorDelegate creatorMethod)
			{
				m_UserView = userView;
				m_CreatorMethod = creatorMethod;
				m_ViewType = viewType;
			}
Esempio n. 17
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Scripture/Print layout View
		/// </summary>
		/// <param name="userView">The user view.</param>
		/// <param name="viewType">Type of the view.</param>
		/// <param name="viewName">Name of the view.</param>
		/// <param name="pubName">Name of the publication.</param>
		/// <param name="sideBarIndex">Index of the side bar.</param>
		/// <param name="sideBarItemName">Name of the side bar item.</param>
		/// ------------------------------------------------------------------------------------
		protected override void  AddPrintLayoutView(UserView userView, TeViewType viewType,
			string viewName, string pubName, TeResourceHelper.SideBarIndices sideBarIndex,
			string sideBarItemName)
		{
			// We don't want to add anything but Scripture/Draft View.
		}
Esempio n. 18
0
			/// --------------------------------------------------------------------------------
			/// <summary>
			/// Initializes a new instance of the <see cref="TePrintLayoutViewFactory"/> class.
			/// </summary>
			/// <param name="userView">The user view.</param>
			/// <param name="viewType">Type of the view.</param>
			/// <param name="pubName">Name of the publication.</param>
			/// <param name="creatorMethod">The creator method.</param>
			/// --------------------------------------------------------------------------------
			public TePrintLayoutViewFactory(UserView userView, TeViewType viewType,
				string pubName, PrintLayoutCreatorDelegate creatorMethod)
				: base(userView, viewType, null)
			{
				m_pubName = pubName;
				m_CreatorMethod = creatorMethod;
			}
Esempio n. 19
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Back Translation/Print Layout View
		/// </summary>
		/// <param name="userView"></param>
		/// <param name="viewType"></param>
		/// ------------------------------------------------------------------------------------
		protected override void AddBackTransPrintLayoutView(UserView userView, TeViewType viewType)
		{
			// We don't want to add anything but Scripture/Draft View.
		}
Esempio n. 20
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Compares the names of the task and user views found in the resource file with the
		/// ones found in the DB. If they are different, then the one found in the resource
		/// file is written to the DB.
		/// </summary>
		/// <param name="userView">The user view.</param>
		/// <param name="kstidTask">The string id of the user view name.</param>
		/// <param name="kstidViewName">The string id of the user view name resource string.
		/// </param>
		/// ------------------------------------------------------------------------------------
		protected virtual void CheckUserViewName(UserView userView, string kstidTask,
			string kstidViewName)
		{
			// Don't do anything if the view is not a factory view (i.e. a custom user view).
			if (!userView.FactoryView)
				return;

			// Get the task names from the resource file and the DB.
			string rcTaskName = TeResourceHelper.GetResourceString(kstidTask);
			string dbTaskName = userView.TaskName;
			if (rcTaskName != dbTaskName && !string.IsNullOrEmpty(rcTaskName))
			{
				userView.TaskName = rcTaskName;
				m_cache.Save();
			}

			// Get the user view names from the resource file and the DB.
			string rcViewName = TeResourceHelper.GetResourceString(kstidViewName);
			string dbViewName = userView.ViewNameShort;

			if (rcViewName != dbViewName && !string.IsNullOrEmpty(rcViewName))
			{
				userView.ViewNameShort = rcViewName;
				m_cache.Save();
			}
		}
Esempio n. 21
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Notes Data Entry View
		/// </summary>
		/// <param name="userView"></param>
		/// <param name="wsUser"></param>
		/// ------------------------------------------------------------------------------------
		protected virtual void AddNotesView(UserView userView, int wsUser)
		{
			if (userView.RecordsOC.Count == 0)
			{
				// Scripture is displayed by showing its BookAnnotations (which are ScrBookAnnotations).
				UserViewRec rec = new UserViewRec();
				userView.RecordsOC.Add(rec);
				rec.Clsid = Scripture.kClassId;

				UserViewField field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)Scripture.ScriptureTags.kflidBookAnnotations;

				// Each ScrBookAnnotations record is displayed by showing its Notes (which are ScrScriptureNotes).
				rec = new UserViewRec();
				userView.RecordsOC.Add(rec);
				rec.Clsid = ScrBookAnnotations.kClassId;

				field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)ScrBookAnnotations.ScrBookAnnotationsTags.kflidNotes;

				// Each ScrScriptureNote record is displayed by showing its status, references, categories, etc.
				rec = new UserViewRec();
				userView.RecordsOC.Add(rec);
				rec.Clsid = ScrScriptureNote.kClassId;

				field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)ScrScriptureNote.ScrScriptureNoteTags.kflidResolutionStatus;

				field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)CmBaseAnnotation.CmBaseAnnotationTags.kflidBeginRef;

				field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)CmBaseAnnotation.CmBaseAnnotationTags.kflidEndRef;

				field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)ScrScriptureNote.ScrScriptureNoteTags.kflidCategories;
				field.PossListRAHvo = m_scr.NoteCategoriesOAHvo;

				field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)ScrScriptureNote.ScrScriptureNoteTags.kflidRecommendation;

				field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)ScrScriptureNote.ScrScriptureNoteTags.kflidResolution;

				field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)ScrScriptureNote.ScrScriptureNoteTags.kflidDiscussion;

				field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)ScrScriptureNote.ScrScriptureNoteTags.kflidResponses;

				field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)ScrScriptureNote.ScrScriptureNoteTags.kflidQuote;

// TODO: There will be a date created and modified for each of the previous five fields.
// We need to determine how they will be differntiated.
				field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)StJournalText.StJournalTextTags.kflidDateCreated;

				field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)StJournalText.StJournalTextTags.kflidDateModified;

				field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)CmAnnotation.CmAnnotationTags.kflidSource;

				field = new UserViewField();
				rec.FieldsOS.Append(field);
				field.Flid = (int)CmAnnotation.CmAnnotationTags.kflidAnnotationType;
				field.PossListRAHvo = m_cache.LangProject.AnnotationDefsOAHvo;
			}

			m_dataEntryView = new NotesDataEntryView(m_cache, userView, 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);
			string name = string.IsNullOrEmpty(userView.ViewNameShort) ?
			TeResourceHelper.GetResourceString("kstidNotes") : userView.ViewNameShort;
			itemProps.Name = name;
			itemProps.Text = name;
			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();
			ClientWindows.Add(m_dataEntryView.GetType().Name, m_dataEntryView);
		}
Esempio n. 22
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Scripture/Vertical View.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected virtual void AddVerticalView(UserView userView)
		{
			// 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(userView, TeViewType.VerticalView, CreateVerticalView));
		}
Esempio n. 23
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a single user view for testing
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private void CreateTestUserView()
		{
			m_inMemoryCache.InitializeUserViews();
			IEnumerator userViews = Cache.UserViewSpecs.GetEnumerator();
			userViews.MoveNext();
			m_userView = (UserView)userViews.Current;

			// Scripture is displayed by showing it's Book Annotations (which are ScrScriptureNotes)
			UserViewRec rec = new UserViewRec();
			m_userView.RecordsOC.Add(rec);
			rec.Clsid = Scripture.Scripture.kClassId;

			UserViewField field = new UserViewField();
			rec.FieldsOS.Append(field);
			field.Flid = (int)Scripture.Scripture.ScriptureTags.kflidBookAnnotations;

			// Each ScrBookAnnotations record is displayed by showing its Notes (which are ScrScriptureNotes).
			rec = new UserViewRec();
			m_userView.RecordsOC.Add(rec);
			rec.Clsid = ScrBookAnnotations.kClassId;

			field = new UserViewField();
			rec.FieldsOS.Append(field);
			field.Flid = (int)ScrBookAnnotations.ScrBookAnnotationsTags.kflidNotes;

			// Each ScrScriptureNote record is displayed by showing its status, references, categories, etc.
			rec = new UserViewRec();
			m_userView.RecordsOC.Add(rec);
			rec.Clsid = ScrScriptureNote.kClassId;

			field = new UserViewField();
			rec.FieldsOS.Append(field);
			field.Flid = (int)ScrScriptureNote.ScrScriptureNoteTags.kflidResolutionStatus;

			field = new UserViewField();
			rec.FieldsOS.Append(field);
			field.Flid = (int)CmAnnotation.CmAnnotationTags.kflidAnnotationType;
			field.PossListRAHvo = Cache.LangProject.AnnotationDefsOAHvo;

			field = new UserViewField();
			rec.FieldsOS.Append(field);
			field.Flid = (int)ScrScriptureNote.ScrScriptureNoteTags.kflidCategories;
			field.PossListRAHvo = m_scr.NoteCategoriesOAHvo;
		}
Esempio n. 24
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Adds the Checking/Key Terms View
		/// </summary>
		/// <param name="userView"></param>
		/// ------------------------------------------------------------------------------------
		protected virtual void AddKeyTermsView(UserView userView)
		{
			// Add this user view to the Checking sidebar tab.
			SBTabItemProperties itemProps = new SBTabItemProperties(this);
			itemProps.Name = kChkKeyTermsSBItemName;
			itemProps.Text = userView.ViewNameShort;
			itemProps.ImageIndex = (int)TeResourceHelper.SideBarIndices.KeyTerms;
			itemProps.Tag = TeViewType.KeyTerms;
			itemProps.Message = "SwitchActiveView";
			AddSideBarTabItem(kChkSBTabName, itemProps);
			m_uncreatedViews.Add(TeViewType.KeyTerms, new TeSelectableViewFactory(userView,
				TeViewType.KeyTerms, CreateKeyTermsView));
		}