Example #1
0
		protected virtual void OnHeaderView_AddFile (object sender, MultimediaFileArgs e)
		{
			FileSelectorDialog fileSelector = new FileSelectorDialog();
			fileSelector.Title = "Select Media File";
			fileSelector.AddFilter("image/*", "Images");
			fileSelector.AddFilter("video/*", "Videos");
			fileSelector.AddFilter("audio/*", "Audio");
			fileSelector.AddFilter("text/*", "Text Documents");
			
			fileSelector.FileSelected += new EventHandler(ScrapBookList_AddFileSelected);
			fileSelector.UserData = e;
			fileSelector.Modal = true;
					
			fileSelector.Run();
		}
Example #2
0
	protected void OnMultimediaView_OpenFile(object sender, MultimediaFileArgs e)
	{
		if (!string.IsNullOrEmpty(e.Filename))
		{
			Process process = new Process();
			
			process.StartInfo.FileName = e.Filename;
			process.StartInfo.UseShellExecute = true;
			
			FileInfo info = new FileInfo(_database.Name);
			process.StartInfo.WorkingDirectory = info.Directory.FullName;
			
			System.Console.WriteLine("Launch: " + e.Filename);
			
			if (!process.Start())
			{
				// FIXME: inform user
				System.Console.WriteLine("Failed to launch process");
			}
		}
		else
		{
			// FIXME: inform user
			System.Console.WriteLine("No Filename set for media file");
		}
	}
Example #3
0
		protected virtual void OnFileTreeView_ButtonPressEvent(object sender, Gtk.ButtonPressEventArgs e)
		{
			Gdk.EventButton ev = e.Event;
			
			if (ev.Button == 1)
			{
				int x = (int)ev.X;
				int y = (int)ev.Y;
				Gtk.TreePath path;
								
				if (FileTreeView.GetPathAtPos(x, y, out path))
				{
					Gtk.TreeViewColumn buttonCol = FileTreeView.Columns[0];
					if (x < buttonCol.Width)
					{
						Gtk.TreeIter iter;
						Gtk.CellRenderer[] rends = buttonCol.CellRenderers;
						
						if (_listModel.GetIter(out iter, path))
						{
							GedcomMultimediaFile file = (GedcomMultimediaFile)_listModel.GetValue(iter, 0);
							
							int butX = 0;
							int i = 0;
							foreach (GtkCellRendererButton rend in rends)
							{
								if (x < (butX + rend.Width))
								{
									break;
								}
								butX += rend.Width;
								i ++;
							}
							// open column
							if (i == 0 && OpenFile != null)
							{
								MultimediaFileArgs args = new MultimediaFileArgs();
								args.Filename = file.Filename;
								OpenFile(this,args);
							}
						}
					}
				}
			}
		}
Example #4
0
		protected virtual void OnAddFileButton_Clicked (object sender, System.EventArgs e)
		{
			if (AddFile != null)
			{
				MultimediaFileArgs args = new MultimediaFileArgs();
				
				AddFile(this, args);
				
				string filename = args.Filename;
				
				if (!string.IsNullOrEmpty(filename))
				{
					GedcomMultimediaRecord obje = (GedcomMultimediaRecord)SelectedRecord;
					
					obje.AddMultimediaFile(filename);
				
					_listModel.Record = _listModel.Record;
				
					DoRecordSelectionChange();
				}
			}
			
		}
Example #5
0
		protected virtual void OnSubmitterView_OpenFile (object sender, MultimediaFileArgs e)
		{
			if (OpenFile != null)
			{
				OpenFile(this, e);
			}
		}
Example #6
0
		protected virtual void OnScrapBookView_AddFile (object sender, MultimediaFileArgs e)
		{
			if (AddFile != null)
			{
				AddFile(this, e);
			}
		}