Example #1
0
	protected void OnSelectNewNote(object sender, NoteArgs e)
	{
		NoteListDialog listDialog = new NoteListDialog();
		
		if (sender is Gtk.Dialog)
		{
			listDialog.TransientFor = (Gtk.Window)sender;
		}
		else
		{
			listDialog.TransientFor = this;
		}
		
		listDialog.Database = _database;
		listDialog.Record = null;
		
		listDialog.Modal = true;
		
		int response = listDialog.Run();
		
		if (response == (int)Gtk.ResponseType.Apply)
		{
			e.Note = listDialog.Note;
		}
		else if (response == (int)Gtk.ResponseType.Ok)
		{
			// Create new note
			GedcomNoteRecord note = new GedcomNoteRecord(_database);
			
			e.Note = note;
		}
		
		listDialog.Destroy();
	}
Example #2
0
	protected void OnListNotes_Response(object sender, Gtk.ResponseArgs e)
	{
		NoteListDialog listDialog = sender as NoteListDialog;
		
		if (e.ResponseId == Gtk.ResponseType.Apply)
		{
			if (listDialog.Record != null)
			{
				NotesViewView.Database = _database;
				NotesViewView.Record = listDialog.Note;
				NotesViewView.Note = listDialog.Note;
				ViewNotebook.Page = NotePage;
			}
		}
		else if (e.ResponseId == Gtk.ResponseType.Ok)
		{
			// Create new multimedia item
			GedcomNoteRecord note = new GedcomNoteRecord(_database);
			
			NotesViewView.Database = _database;
			NotesViewView.Record = note;
			ViewNotebook.Page = NotePage;
		}
	
		listDialog.Destroy();
	}
		private string AddNoteRecord(GedcomRecord record)
		{
			string xref = string.Empty;
			
			if (_lineValueType == GedcomLineValueType.PointerType)
			{
				if (!_removedNotes.Contains(_lineValue))
				{
					record.Notes.Add(_lineValue);
					xref = _lineValue;
					_missingReferences.Add(_lineValue);
				}
			}
			else
			{
				GedcomNoteRecord note = new GedcomNoteRecord();
				note.Level = 0; // new top level note, always 0 (not true, 1 in header, fixed up later)
				note.ParsingLevel = _level;
				note.XRefID = Database.GenerateXref("NOTE");
				
				if (_lineValue != string.Empty)
				{
					note.ParsedText.Append(_lineValue);
				}
				
				_ParseState.Records.Push(note);
				
				record.Notes.Add(note.XRefID);
				xref = note.XRefID;
			}	
			
			return xref;
		}
Example #4
0
	protected virtual void OnNewNote_Activated (object sender, System.EventArgs e)
	{
		// Create new note
		GedcomNoteRecord note = new GedcomNoteRecord(_database);
		
		NotesViewView.Database = _database;
		NotesViewView.Record = note;
		NotesViewView.Note = note;
		ViewNotebook.Page = NotePage;
	}
		private void Parser_TagFound(object sender, EventArgs e)
		{
			_level = _Parser.Level;
			_xrefID = _Parser.XrefID;
			_tag = TagMap(_Parser.Tag);
			_lineValue = _Parser.LineValue;
			_lineValueType = _Parser.LineValueType;
					
			GedcomRecord current = null;

			// pop previous levels from the stack
			
			current = PopStack(_level);
			
			if (current == null)
			{
				switch (_tag)
				{
					case "FAM":
						
						// must have an xref id to have a family record
						// otherwise it can't be referenced anywhere
						if (!string.IsNullOrEmpty(_xrefID))
						{
							current = new GedcomFamilyRecord();
						}
						break;
					case "INDI":
						
						// must have an xref id to have an individual record
						// otherwise it can't be referenced anywhere
						if (!string.IsNullOrEmpty(_xrefID))
						{
							current = new GedcomIndividualRecord();
						}
						break;
					case "OBJE":
						
						// must have an xref id to have a multimedia record
						// otherwise it can't be referenced anywhere
						if (!string.IsNullOrEmpty(_xrefID))
						{
							current = new GedcomMultimediaRecord();
						}
						break;
					case "NOTE":
						
						// must have an xref id to have a note record
						// otherwise it can't be referenced anywhere
						if (!string.IsNullOrEmpty(_xrefID))
						{
							GedcomNoteRecord note = new GedcomNoteRecord();
							current = note;
							
							// set initial note text if needed
							
							if (_lineValueType == GedcomLineValueType.DataType)
							{
								note.ParsedText.Append(_lineValue);
							}
							else if (_lineValue != string.Empty)
							{
								// pointer to a note, this should not occur
								// as we should be at level 0 here
								
								Debug.WriteLine("Spurious Note pointer: " + _xrefID + "\t at level: " + _level);
							}
						}
						break;
					case "REPO":
						
						// must have an xref id to have a repository record
						// otherwise it can't be referenced anywhere
						if (!string.IsNullOrEmpty(_xrefID))
						{
							current = new GedcomRepositoryRecord();
						}
						break;
					case "SOUR":
						
						// must have an xref id to have a source record
						// otherwise it can't be referenced anywhere
						if (!string.IsNullOrEmpty(_xrefID))
						{
							current = new GedcomSourceRecord();
						}
						break;
					case "SUBM":
						
						// must have an xref id to have a submitter record
						// otherwise it can't be referenced anywhere
						if (!string.IsNullOrEmpty(_xrefID))
						{
							current = new GedcomSubmitterRecord();
						}
						break;
					case "HEAD":
						
						// header record
						current = new GedcomHeader();
					
						break;

					case "SUBN":

						// Submission record
						if (!string.IsNullOrEmpty(_xrefID))
						{
							current = new GedcomSubmissionRecord();
						}
						break;
						
					case "TRLR":
						
						break;
					default:
						
						// Unknown tag
						
						Debug.WriteLine("Unknown: " + _tag + " at level: " + _level);
						break;
				}
				
				// if we created a new record push it onto the stack
				if (current != null)
				{
					if (!string.IsNullOrEmpty(_xrefID))
					{
						current.XRefID = _xrefID;
					}
					current.Database = _ParseState.Database;
					current.Level = _level;
					_ParseState.Records.Push(current);
				}
			}
			else
			{
				switch (current.RecordType)
				{
					case GedcomRecordType.Header:
						ReadHeaderRecord();
						break;
					case GedcomRecordType.Family:
						ReadFamilyRecord();
						break;
					case GedcomRecordType.Individual:
						ReadIndividualRecord();
						break;
					case GedcomRecordType.Multimedia:
						ReadMultimediaRecord();
						break;
					case GedcomRecordType.Note:
						ReadNoteRecord();
						break;
					case GedcomRecordType.Repository:
						ReadRepositoryRecord();
						break;
					case GedcomRecordType.Source:
						ReadSourceRecord();
						break;
					case GedcomRecordType.Submitter:
						ReadSubmitterRecord();
						break;
					case GedcomRecordType.Submission:
						ReadSubmissionRecord();						
						break;
					
					// Non top level records
					case GedcomRecordType.Event:
						ReadEventRecord();
						break;
					case GedcomRecordType.FamilyEvent:
						ReadEventRecord();
						break;
					case GedcomRecordType.IndividualEvent:
						ReadEventRecord();
						break;
					
					case GedcomRecordType.Place:
						ReadPlaceRecord();
						break;
					case GedcomRecordType.SourceCitation:
						ReadSourceCitationRecord();
						break;
					case GedcomRecordType.FamilyLink:
						ReadFamilyLinkRecord();
						break;
					case GedcomRecordType.Association:
						ReadAssociationRecord();
						break;
					case GedcomRecordType.Name:
						ReadNameRecord();
						break;
					case GedcomRecordType.Date:
						ReadDateRecord();
						break;
					case GedcomRecordType.RepositoryCitation:
						ReadRepositoryCitation();
						break;
					case GedcomRecordType.CustomRecord:
						ReadEventRecord();
						break;
				}
			}
			
			_ParseState.AddPreviousTag(_tag, _level);
		}