Example #1
0
		public SourceView()
		{
			this.Build();
			
			_eventModel = new EventModel(EventModel.EventModelType.All);
			Gtk.TreeViewColumn eventNameCol = new Gtk.TreeViewColumn();
			Gtk.CellRenderer rend = new Gtk.CellRendererToggle();
			eventNameCol.Title = "Event";
			eventNameCol.PackStart(rend, false);
			eventNameCol.AddAttribute(rend, "active", (int)EventModel.Columns.Included);
			((Gtk.CellRendererToggle)rend).Activatable = true;
			((Gtk.CellRendererToggle)rend).Toggled += new Gtk.ToggledHandler(OnIncluded_Toggle);
			rend = new Gtk.CellRendererText();
			eventNameCol.PackStart(rend, true);
			eventNameCol.AddAttribute(rend, "text", (int)EventModel.Columns.Readable);

			EventTypeTreeView.AppendColumn(eventNameCol);		
			EventTypeTreeView.Model = _eventModel;

			
			Gtk.TreeViewColumn buttonCol = new Gtk.TreeViewColumn();
			GtkCellRendererButton butRend = new GtkCellRendererButton();
			butRend.StockId = "gtk-remove";
			buttonCol.PackStart(butRend,true);
			
			Gtk.TreeViewColumn noteCountCol = new Gtk.TreeViewColumn();
			rend = new Gtk.CellRendererText();
			noteCountCol.Title = "No.";
			noteCountCol.PackStart(rend,true);
			noteCountCol.SetCellDataFunc(rend, new Gtk.TreeCellDataFunc(ListModelUtil.RenderEventRecordedCount));
		
			EventGroupTreeView.AppendColumn(buttonCol);
			EventGroupTreeView.AppendColumn(noteCountCol);

			Gtk.TreeSelection selection = EventGroupTreeView.Selection;
			selection.Changed += new EventHandler(OnEventGroupSelection_Changed);
			
			_eventGroups = new GenericListModel<GedcomRecordedEvent>();
			EventGroupTreeView.Model = _eventGroups.Adapter;
			
			Gtk.TreeViewColumn callNumberCol = new Gtk.TreeViewColumn();
			rend = new Gtk.CellRendererText();
			callNumberCol.Title = "Call Number";
			callNumberCol.PackStart(rend,true);
			callNumberCol.AddAttribute(rend, "text", 0);
			
			Gtk.TreeViewColumn mediaTypeCol = new Gtk.TreeViewColumn();
			rend = new Gtk.CellRendererText();
			mediaTypeCol.Title = "Media Type";
			mediaTypeCol.PackStart(rend,true);
			mediaTypeCol.AddAttribute(rend, "text", 1);
			
			CallNumberTreeView.AppendColumn(callNumberCol);
			CallNumberTreeView.AppendColumn(mediaTypeCol);
			
			RepositoryCitationListModel repoCitationListModel = new RepositoryCitationListModel();
			CallNumberTreeView.Model = repoCitationListModel;
			
			selection = CallNumberTreeView.Selection;
			selection.Changed += new EventHandler(OnCallNumberSelection_Changed);
					
			// How to handle SourceMediaType.Other ?
			// don't include in initial and if the select one is SourceMediaType.Other
			// add an item into the dropdown for its value?
			// as other isn't really valid this seems like a reasonable idea
			Gtk.ListStore mediaTypes = new Gtk.ListStore(typeof(string));
			foreach (SourceMediaType mediaType in Enum.GetValues(typeof(SourceMediaType)))
			{
				if (mediaType != SourceMediaType.Other)
				{
					Gtk.TreeIter iter = mediaTypes.Append();
					mediaTypes.SetValue(iter, 0, mediaType.ToString());
				}
			}
			rend = new Gtk.CellRendererText();
			MediaTypeCombo.PackStart(rend,true);
			MediaTypeCombo.AddAttribute(rend, "text", 0);
			MediaTypeCombo.Model = mediaTypes;
			
			Notebook.Page = 0;
		}
Example #2
0
		public void FillView()
		{
			GedcomSourceRecord source = _record as GedcomSourceRecord;
				
			NotesView.Record = source;
			DataNotesView.Record = source;
			RepositoryCitationListModel repoCitationListModel = new RepositoryCitationListModel();
			repoCitationListModel.Database = _database;
			CallNumberTreeView.Model = repoCitationListModel;
						
			if (source != null)
			{
				if (!string.IsNullOrEmpty(source.Title))
				{
					TitleEntry.Text = source.Title;
				}
				if (!string.IsNullOrEmpty(source.Originator))
				{
					OriginatorEntry.Text = source.Originator;
				}
				if (!string.IsNullOrEmpty(source.FiledBy))
				{
					FiledByEntry.Text = source.FiledBy;
				}
				if (!string.IsNullOrEmpty(source.Agency))
				{
					AgencyTextBox.Text = source.Agency;
				}
				if (!string.IsNullOrEmpty(source.PublicationFacts))
				{
					PublicationFactsTextView.Buffer.Text = source.PublicationFacts;
				}
							
				if (!string.IsNullOrEmpty(source.Text))
				{
					TextTextView.Buffer.Text = source.Text;	
				}
				
				if (source.RepositoryCitations.Count > 0)
				{
					repoCitationListModel.Record = source.RepositoryCitations[0];
					
					RepoNotesView.Record = source.RepositoryCitations[0];
				}
				
				if (_recordedEvent != null)
				{
					_eventModel.IncludedEvents = _recordedEvent.Types;
				}
				else
				{
					_eventModel.IncludedEvents = null;
				}
				
				_eventGroups.List = source.EventsRecorded;
			}
			else
			{
				_eventModel.IncludedEvents = null;
				_eventGroups.Clear();
			}
		}