Ejemplo n.º 1
0
	protected virtual void OnNewSource_Activated (object sender, System.EventArgs e)
	{
		// Create new source
		GedcomSourceRecord source = new GedcomSourceRecord(_database);
		
		SourceViewView.Database = _database;
		SourceViewView.Record = source;
		ViewNotebook.Page = SourcesPage;
	}
Ejemplo n.º 2
0
	protected void OnListSources_Response(object sender, Gtk.ResponseArgs e)
	{
		SourceListDialog listDialog = sender as SourceListDialog;
				
		if (e.ResponseId == Gtk.ResponseType.Apply)
		{
			if (listDialog.Record != null)
			{
				SourceViewView.Database = _database;
				SourceViewView.Record = listDialog.Record;
				ViewNotebook.Page = SourcesPage;
			}
			
		}
		else if (e.ResponseId == Gtk.ResponseType.Ok)
		{
			// Create new source
			GedcomSourceRecord source = new GedcomSourceRecord(_database);
			
			SourceViewView.Database = _database;
			SourceViewView.Record = source;
			ViewNotebook.Page = SourcesPage;
		}
		listDialog.Destroy();
	}
Ejemplo n.º 3
0
		protected void FillView()
		{
			GedcomSourceCitation citation = _record as GedcomSourceCitation;
				
			NotesView.Record = citation;
							
			if (!string.IsNullOrEmpty(citation.Source))
			{
				GedcomSourceRecord source = _database[citation.Source] as GedcomSourceRecord;
				_masterSource = source;
				if (source != null)
				{
					MasterSourceEntry.Text = source.Title;
				}
				else
				{
					MasterSourceEntry.Text = "<source missing>";
				}
			}
			
			if (!string.IsNullOrEmpty(citation.Page))
			{
				PageEntry.Text = citation.Page;
			}

			if (!string.IsNullOrEmpty(citation.EventType))
			{
				EventTypeEntry.Text = citation.EventType;
			}
			
			if (!string.IsNullOrEmpty(citation.Role))
			{
				RoleEntry.Text = citation.Role;
			}
			
			if (citation.Date != null)
			{
				DateEntry.Text = citation.Date.DateString;
			}
			
			CertaintyComboBox.Active = (int)citation.Certainty;
			
			if (!string.IsNullOrEmpty(citation.Text))
			{
				TextTextView.Buffer.Text = citation.Text;	
			}
		}
Ejemplo n.º 4
0
		protected virtual void OnSelectMasterSourceButton_Click(object sender, System.EventArgs e)
		{
			if (SelectMasterSource != null)
			{
				SourceArgs args = new SourceArgs();
				SelectMasterSource(this, args);
				if (args.Source != null)
				{
					if (_masterSource != null)
					{
						_masterSource.Citations.Remove((GedcomSourceCitation)_record);
					}
					_masterSource = args.Source;
					_masterSource.Citations.Add((GedcomSourceCitation)_record);
					MasterSourceEntry.Text = _masterSource.Title;
				}
			}
		}
Ejemplo n.º 5
0
		private void AddSourceCitation(GedcomRecord record)
		{
			GedcomSourceCitation sourceCitation = new GedcomSourceCitation();
			sourceCitation.Level = _level;
			sourceCitation.Database = _ParseState.Database;
		
			if (_lineValueType == GedcomLineValueType.PointerType)
			{
				sourceCitation.Source = _lineValue;	
				_missingReferences.Add(_lineValue);
			}
			else
			{
				GedcomSourceRecord source = new GedcomSourceRecord();
				source.Level = 0; // new top level source, always 0
				source.ParsingLevel = _level;
				source.XRefID = Database.GenerateXref("SOUR");
				
				if (_lineValue != string.Empty)
				{
					source.Title = _lineValue;	
				}
				
				sourceCitation.Source = source.XRefID;
				
				_ParseState.Database.Add(source.XRefID,source);
			}
			
			record.Sources.Add(sourceCitation);
			_ParseState.Records.Push(sourceCitation);
			
			_sourceCitations.Add(sourceCitation);
		}
Ejemplo n.º 6
0
		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);
		}
Ejemplo n.º 7
0
		public static int CompareByTitle(GedcomSourceRecord sourceA, GedcomSourceRecord sourceB)
		{		
			return string.Compare(sourceA.Title,sourceB.Title);
		}