/// ------------------------------------------------------------------------------------
		/// <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;
		}
Exemple #2
0
		public void UserViewField_DetailsWithoutType()
		{
			m_inMemoryCache.InitializeUserViews();

			UserViewRec rec = new UserViewRec();
			Cache.UserViewSpecs.Item(0).RecordsOC.Add(rec);
			UserViewField field = new UserViewField();
			rec.FieldsOS.Append(field);
			field.HideLabel = true;

			byte[] expected = new byte[] {0x64, 0x00, 0x00, 0x80};
			Assert.AreEqual(expected.Length, field.Details.Length);
			for (int i = 0; i < field.Details.Length; i++)
				Assert.AreEqual(expected[i], field.Details[i], "Byte " + i + " is wrong.");
			Assert.AreEqual(true, field.HideLabel);
			Assert.AreEqual(0x64, field.BrowseColumnWidth);
		}
Exemple #3
0
		public void UserViewField_DetailsWithType()
		{
			m_inMemoryCache.InitializeUserViews();

			UserViewRec rec = new UserViewRec();
			Cache.UserViewSpecs.Item(0).RecordsOC.Add(rec);
			UserViewField field = new UserViewField();
			rec.FieldsOS.Append(field);
			field.HideLabel = true;
			field.Type = (int)FldType.kftExpandable;
			field.ExpandOutline = true;
			field.IsHierarchy = true;
			field.PossibilityNameType = PossNameType.kpntNameAndAbbrev;

			byte[] expected = new byte[] {0x64, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xC0};
			Assert.AreEqual(expected.Length, field.Details.Length);
			for (int i = 0; i < field.Details.Length; i++)
				Assert.AreEqual(expected[i], field.Details[i], "Byte " + i + " is wrong.");
			Assert.AreEqual(true, field.HideLabel);
			Assert.AreEqual(0x64, field.BrowseColumnWidth);
			Assert.AreEqual((int)FldType.kftExpandable, field.Type);
			Assert.AreEqual(true, field.ExpandOutline);
			Assert.AreEqual(true, field.IsHierarchy);
			Assert.AreEqual(PossNameType.kpntNameAndAbbrev, field.PossibilityNameType);
		}
Exemple #4
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);
		}