Commit 2be1e084 authored by Jim Nelson's avatar Jim Nelson

Moved PhotoTransformer into TransformablePhoto, which is now properly in the...

Moved PhotoTransformer into TransformablePhoto, which is now properly in the inheritance tree.  Also prepped 
PhotoPage for using TransformablePhoto rather than Photo (which is now LibraryPhoto), so it can be reused for 
direct edit mode.
parent deee14d6
...@@ -47,8 +47,7 @@ SRC_FILES = \ ...@@ -47,8 +47,7 @@ SRC_FILES = \
EditingTools.vala \ EditingTools.vala \
Queryable.vala \ Queryable.vala \
LibraryWindow.vala \ LibraryWindow.vala \
CameraTable.vala \ CameraTable.vala
PhotoTransformer.vala
VAPI_FILES = \ VAPI_FILES = \
libexif.vapi \ libexif.vapi \
......
...@@ -16,8 +16,8 @@ public abstract class BatchImportJob { ...@@ -16,8 +16,8 @@ public abstract class BatchImportJob {
public class BatchImport { public class BatchImport {
public const int IMPORT_DIRECTORY_DEPTH = 3; public const int IMPORT_DIRECTORY_DEPTH = 3;
private class DateComparator : Comparator<Photo> { private class DateComparator : Comparator<LibraryPhoto> {
public override int64 compare(Photo photo_a, Photo photo_b) { public override int64 compare(LibraryPhoto photo_a, LibraryPhoto photo_b) {
return photo_a.get_exposure_time() - photo_b.get_exposure_time(); return photo_a.get_exposure_time() - photo_b.get_exposure_time();
} }
} }
...@@ -120,7 +120,7 @@ public class BatchImport { ...@@ -120,7 +120,7 @@ public class BatchImport {
private string name; private string name;
private uint64 total_bytes; private uint64 total_bytes;
private BatchImport ref_holder = null; private BatchImport ref_holder = null;
private SortedList<Photo> success = null; private SortedList<LibraryPhoto> success = null;
private Gee.ArrayList<string> failed = null; private Gee.ArrayList<string> failed = null;
private Gee.ArrayList<string> skipped = null; private Gee.ArrayList<string> skipped = null;
private ImportID import_id = ImportID(); private ImportID import_id = ImportID();
...@@ -144,13 +144,13 @@ public class BatchImport { ...@@ -144,13 +144,13 @@ public class BatchImport {
public signal void starting(); public signal void starting();
// Called for each Photo imported to the system // Called for each Photo imported to the system
public signal void imported(Photo photo); public signal void imported(LibraryPhoto photo);
// Called when a job fails. import_complete will also be called at the end of the batch // Called when a job fails. import_complete will also be called at the end of the batch
public signal void import_job_failed(ImportResult result, BatchImportJob job, File? file); public signal void import_job_failed(ImportResult result, BatchImportJob job, File? file);
// Called at the end of the batched jobs; this will be signalled exactly once for the batch // Called at the end of the batched jobs; this will be signalled exactly once for the batch
public signal void import_complete(ImportID import_id, SortedList<Photo> photos_by_date, public signal void import_complete(ImportID import_id, SortedList<LibraryPhoto> photos_by_date,
Gee.ArrayList<string> failed, Gee.ArrayList<string> skipped); Gee.ArrayList<string> failed, Gee.ArrayList<string> skipped);
public string get_name() { public string get_name() {
...@@ -179,7 +179,7 @@ public class BatchImport { ...@@ -179,7 +179,7 @@ public class BatchImport {
private bool perform_import() { private bool perform_import() {
starting(); starting();
success = new SortedList<Photo>(new DateComparator()); success = new SortedList<LibraryPhoto>(new DateComparator());
failed = new Gee.ArrayList<string>(); failed = new Gee.ArrayList<string>();
skipped = new Gee.ArrayList<string>(); skipped = new Gee.ArrayList<string>();
import_id = (new PhotoTable()).generate_import_id(); import_id = (new PhotoTable()).generate_import_id();
...@@ -324,8 +324,8 @@ public class BatchImport { ...@@ -324,8 +324,8 @@ public class BatchImport {
import = copied; import = copied;
} }
Photo photo; LibraryPhoto photo;
ImportResult result = Photo.import(import, import_id, out photo); ImportResult result = LibraryPhoto.import(import, import_id, out photo);
if (result != ImportResult.SUCCESS) { if (result != ImportResult.SUCCESS) {
if (copy_to_library) { if (copy_to_library) {
try { try {
......
...@@ -55,7 +55,7 @@ class SlideshowPage : SinglePhotoPage { ...@@ -55,7 +55,7 @@ class SlideshowPage : SinglePhotoPage {
public override void switched_to() { public override void switched_to() {
base.switched_to(); base.switched_to();
set_pixbuf(thumbnail.get_photo().get_pixbuf(PhotoTransformer.SCREEN)); set_pixbuf(thumbnail.get_photo().get_pixbuf(TransformablePhoto.SCREEN));
Timeout.add(CHECK_ADVANCE_MSEC, auto_advance); Timeout.add(CHECK_ADVANCE_MSEC, auto_advance);
timer.start(); timer.start();
...@@ -91,7 +91,7 @@ class SlideshowPage : SinglePhotoPage { ...@@ -91,7 +91,7 @@ class SlideshowPage : SinglePhotoPage {
private void on_next_automatic() { private void on_next_automatic() {
thumbnail = (Thumbnail) controller.get_next_item(thumbnail); thumbnail = (Thumbnail) controller.get_next_item(thumbnail);
set_pixbuf(thumbnail.get_photo().get_pixbuf(PhotoTransformer.SCREEN)); set_pixbuf(thumbnail.get_photo().get_pixbuf(TransformablePhoto.SCREEN));
// reset the timer // reset the timer
timer.start(); timer.start();
...@@ -105,7 +105,7 @@ class SlideshowPage : SinglePhotoPage { ...@@ -105,7 +105,7 @@ class SlideshowPage : SinglePhotoPage {
this.thumbnail = thumbnail; this.thumbnail = thumbnail;
// start with blown-up preview // start with blown-up preview
set_pixbuf(thumbnail.get_photo().get_preview_pixbuf(PhotoTransformer.SCREEN)); set_pixbuf(thumbnail.get_photo().get_preview_pixbuf(TransformablePhoto.SCREEN));
// schedule improvement to real photo // schedule improvement to real photo
Idle.add(on_improvement); Idle.add(on_improvement);
...@@ -115,7 +115,7 @@ class SlideshowPage : SinglePhotoPage { ...@@ -115,7 +115,7 @@ class SlideshowPage : SinglePhotoPage {
} }
private bool on_improvement() { private bool on_improvement() {
set_pixbuf(thumbnail.get_photo().get_pixbuf(PhotoTransformer.SCREEN)); set_pixbuf(thumbnail.get_photo().get_pixbuf(TransformablePhoto.SCREEN));
return false; return false;
} }
...@@ -164,7 +164,7 @@ class SlideshowPage : SinglePhotoPage { ...@@ -164,7 +164,7 @@ class SlideshowPage : SinglePhotoPage {
} }
public override Gee.Iterable<Queryable>? get_queryables() { public override Gee.Iterable<Queryable>? get_queryables() {
Gee.ArrayList<Photo> photo_array_list = new Gee.ArrayList<Photo>(); Gee.ArrayList<LibraryPhoto> photo_array_list = new Gee.ArrayList<LibraryPhoto>();
photo_array_list.add(thumbnail.get_photo()); photo_array_list.add(thumbnail.get_photo());
return photo_array_list; return photo_array_list;
} }
...@@ -466,7 +466,7 @@ public class CollectionPage : CheckerboardPage { ...@@ -466,7 +466,7 @@ public class CollectionPage : CheckerboardPage {
// files first // files first
Gdk.Pixbuf icon = null; Gdk.Pixbuf icon = null;
foreach (LayoutItem item in get_selected()) { foreach (LayoutItem item in get_selected()) {
Photo photo = ((Thumbnail) item).get_photo(); LibraryPhoto photo = ((Thumbnail) item).get_photo();
File file = null; File file = null;
try { try {
...@@ -513,10 +513,14 @@ public class CollectionPage : CheckerboardPage { ...@@ -513,10 +513,14 @@ public class CollectionPage : CheckerboardPage {
drag_items.clear(); drag_items.clear();
foreach (LayoutItem item in get_selected()) {
((Thumbnail) item).get_photo().export_failed();
}
return false; return false;
} }
public void add_photo(Photo photo) { public void add_photo(LibraryPhoto photo) {
// search for duplicates // search for duplicates
if (get_thumbnail_for_photo(photo) != null) if (get_thumbnail_for_photo(photo) != null)
return; return;
...@@ -532,7 +536,7 @@ public class CollectionPage : CheckerboardPage { ...@@ -532,7 +536,7 @@ public class CollectionPage : CheckerboardPage {
slideshow_button.sensitive = true; slideshow_button.sensitive = true;
} }
private void on_photo_removed(Photo photo) { private void on_photo_removed(LibraryPhoto photo) {
Thumbnail found = get_thumbnail_for_photo(photo); Thumbnail found = get_thumbnail_for_photo(photo);
if (found != null) if (found != null)
remove_item(found); remove_item(found);
...@@ -540,7 +544,7 @@ public class CollectionPage : CheckerboardPage { ...@@ -540,7 +544,7 @@ public class CollectionPage : CheckerboardPage {
slideshow_button.sensitive = (get_count() > 0); slideshow_button.sensitive = (get_count() > 0);
} }
private void on_thumbnail_altered(Photo photo) { private void on_thumbnail_altered(LibraryPhoto photo) {
// the thumbnail is only going to reload a low-quality interp, so schedule improval // the thumbnail is only going to reload a low-quality interp, so schedule improval
schedule_thumbnail_improval(); schedule_thumbnail_improval();
...@@ -549,7 +553,7 @@ public class CollectionPage : CheckerboardPage { ...@@ -549,7 +553,7 @@ public class CollectionPage : CheckerboardPage {
refresh(); refresh();
} }
private Thumbnail? get_thumbnail_for_photo(Photo photo) { private Thumbnail? get_thumbnail_for_photo(LibraryPhoto photo) {
foreach (LayoutItem item in get_items()) { foreach (LayoutItem item in get_items()) {
Thumbnail thumbnail = (Thumbnail) item; Thumbnail thumbnail = (Thumbnail) item;
if (thumbnail.get_photo().equals(photo)) if (thumbnail.get_photo().equals(photo))
...@@ -639,7 +643,7 @@ public class CollectionPage : CheckerboardPage { ...@@ -639,7 +643,7 @@ public class CollectionPage : CheckerboardPage {
} }
private void on_export() { private void on_export() {
Gee.ArrayList<Photo> export_list = new Gee.ArrayList<Photo>(); Gee.ArrayList<LibraryPhoto> export_list = new Gee.ArrayList<LibraryPhoto>();
foreach (LayoutItem item in get_selected()) foreach (LayoutItem item in get_selected())
export_list.add(((Thumbnail) item).get_photo()); export_list.add(((Thumbnail) item).get_photo());
...@@ -656,7 +660,7 @@ public class CollectionPage : CheckerboardPage { ...@@ -656,7 +660,7 @@ public class CollectionPage : CheckerboardPage {
// handle the single-photo case // handle the single-photo case
if (export_list.size == 1) { if (export_list.size == 1) {
Photo photo = export_list.get(0); LibraryPhoto photo = export_list.get(0);
File save_as = ExportUI.choose_file(photo.get_file()); File save_as = ExportUI.choose_file(photo.get_file());
if (save_as == null) if (save_as == null)
...@@ -681,7 +685,7 @@ public class CollectionPage : CheckerboardPage { ...@@ -681,7 +685,7 @@ public class CollectionPage : CheckerboardPage {
AppWindow.get_instance().set_busy_cursor(); AppWindow.get_instance().set_busy_cursor();
foreach (Photo photo in export_list) { foreach (LibraryPhoto photo in export_list) {
File save_as = export_dir.get_child(photo.get_file().get_basename()); File save_as = export_dir.get_child(photo.get_file().get_basename());
if (save_as.query_exists(null)) { if (save_as.query_exists(null)) {
if (!ExportUI.query_overwrite(save_as)) if (!ExportUI.query_overwrite(save_as))
...@@ -712,7 +716,7 @@ public class CollectionPage : CheckerboardPage { ...@@ -712,7 +716,7 @@ public class CollectionPage : CheckerboardPage {
private bool can_revert_selected() { private bool can_revert_selected() {
foreach (LayoutItem item in get_selected()) { foreach (LayoutItem item in get_selected()) {
Photo photo = ((Thumbnail) item).get_photo(); LibraryPhoto photo = ((Thumbnail) item).get_photo();
if (photo.has_transformations()) if (photo.has_transformations())
return true; return true;
} }
...@@ -766,7 +770,7 @@ public class CollectionPage : CheckerboardPage { ...@@ -766,7 +770,7 @@ public class CollectionPage : CheckerboardPage {
// in on_photo_removed being called, which we don't want in this case is because it will // in on_photo_removed being called, which we don't want in this case is because it will
// remove from the list while iterating, so disconnect the signals and do the work here // remove from the list while iterating, so disconnect the signals and do the work here
foreach (LayoutItem item in get_selected()) { foreach (LayoutItem item in get_selected()) {
Photo photo = ((Thumbnail) item).get_photo(); LibraryPhoto photo = ((Thumbnail) item).get_photo();
photo.removed -= on_photo_removed; photo.removed -= on_photo_removed;
photo.thumbnail_altered -= on_thumbnail_altered; photo.thumbnail_altered -= on_thumbnail_altered;
...@@ -782,7 +786,7 @@ public class CollectionPage : CheckerboardPage { ...@@ -782,7 +786,7 @@ public class CollectionPage : CheckerboardPage {
private void do_rotations(Gee.Iterable<LayoutItem> c, Rotation rotation) { private void do_rotations(Gee.Iterable<LayoutItem> c, Rotation rotation) {
bool rotation_performed = false; bool rotation_performed = false;
foreach (LayoutItem item in c) { foreach (LayoutItem item in c) {
Photo photo = ((Thumbnail) item).get_photo(); LibraryPhoto photo = ((Thumbnail) item).get_photo();
photo.rotate(rotation); photo.rotate(rotation);
rotation_performed = true; rotation_performed = true;
...@@ -808,7 +812,7 @@ public class CollectionPage : CheckerboardPage { ...@@ -808,7 +812,7 @@ public class CollectionPage : CheckerboardPage {
private void on_revert() { private void on_revert() {
bool revert_performed = false; bool revert_performed = false;
foreach (LayoutItem item in get_selected()) { foreach (LayoutItem item in get_selected()) {
Photo photo = ((Thumbnail) item).get_photo(); LibraryPhoto photo = ((Thumbnail) item).get_photo();
photo.remove_all_transformations(); photo.remove_all_transformations();
revert_performed = true; revert_performed = true;
......
...@@ -92,18 +92,18 @@ public bool verify_databases(out string app_version) { ...@@ -92,18 +92,18 @@ public bool verify_databases(out string app_version) {
// verify photo table // verify photo table
foreach (PhotoID photo_id in photo_ids) { foreach (PhotoID photo_id in photo_ids) {
Photo photo = Photo.fetch(photo_id); LibraryPhoto photo = LibraryPhoto.fetch(photo_id);
switch (photo.check_currency()) { switch (photo.check_currency()) {
case Photo.Currency.CURRENT: case LibraryPhoto.Currency.CURRENT:
// do nothing // do nothing
break; break;
case Photo.Currency.DIRTY: case LibraryPhoto.Currency.DIRTY:
message("Time or filesize changed on %s, reimporting ...", photo.to_string()); message("Time or filesize changed on %s, reimporting ...", photo.to_string());
photo.update(); photo.update();
break; break;
case Photo.Currency.GONE: case LibraryPhoto.Currency.GONE:
message("Unable to locate %s: Removing from photo library", photo.to_string()); message("Unable to locate %s: Removing from photo library", photo.to_string());
photo.remove(true); photo.remove(true);
break; break;
......
...@@ -82,13 +82,13 @@ public abstract class EditingToolWindow : Gtk.Window { ...@@ -82,13 +82,13 @@ public abstract class EditingToolWindow : Gtk.Window {
public abstract class PhotoCanvas { public abstract class PhotoCanvas {
private Gtk.Window container; private Gtk.Window container;
private Gdk.Window drawing_window; private Gdk.Window drawing_window;
private Photo photo; private TransformablePhoto photo;
private Gdk.GC default_gc; private Gdk.GC default_gc;
private Gdk.Drawable drawable; private Gdk.Drawable drawable;
private Gdk.Pixbuf scaled; private Gdk.Pixbuf scaled;
private Gdk.Rectangle scaled_position; private Gdk.Rectangle scaled_position;
public PhotoCanvas(Gtk.Window container, Gdk.Window drawing_window, Photo photo, public PhotoCanvas(Gtk.Window container, Gdk.Window drawing_window, TransformablePhoto photo,
Gdk.GC default_gc, Gdk.Drawable drawable, Gdk.Pixbuf scaled, Gdk.Rectangle scaled_position) { Gdk.GC default_gc, Gdk.Drawable drawable, Gdk.Pixbuf scaled, Gdk.Rectangle scaled_position) {
this.container = container; this.container = container;
this.drawing_window = drawing_window; this.drawing_window = drawing_window;
...@@ -170,7 +170,7 @@ public abstract class PhotoCanvas { ...@@ -170,7 +170,7 @@ public abstract class PhotoCanvas {
return active_rect; return active_rect;
} }
public Photo get_photo() { public TransformablePhoto get_photo() {
return photo; return photo;
} }
...@@ -359,7 +359,7 @@ public abstract class EditingTool { ...@@ -359,7 +359,7 @@ public abstract class EditingTool {
// //
// Note this this method doesn't need to be returning the "proper" pixbuf on-the-fly (i.e. // Note this this method doesn't need to be returning the "proper" pixbuf on-the-fly (i.e.
// a pixbuf with unsaved tool edits in it). That can be handled in the paint() virtual method. // a pixbuf with unsaved tool edits in it). That can be handled in the paint() virtual method.
public virtual Gdk.Pixbuf? get_unscaled_pixbuf(Photo photo) { public virtual Gdk.Pixbuf? get_display_pixbuf(TransformablePhoto photo) {
return null; return null;
} }
...@@ -489,11 +489,11 @@ public class CropTool : EditingTool { ...@@ -489,11 +489,11 @@ public class CropTool : EditingTool {
return crop_tool_window; return crop_tool_window;
} }
public override Gdk.Pixbuf? get_unscaled_pixbuf(Photo photo) { public override Gdk.Pixbuf? get_display_pixbuf(TransformablePhoto photo) {
// show the uncropped photo for editing, but return null if no crop so the current pixbuf // show the uncropped photo for editing, but return null if no crop so the current pixbuf
// is used // is used
return photo.has_crop() ? photo.get_pixbuf(PhotoTransformer.SCREEN, return photo.has_crop() ? photo.get_pixbuf(TransformablePhoto.SCREEN,
PhotoTransformer.Exception.CROP) : null; TransformablePhoto.Exception.CROP) : null;
} }
private void prepare_gc(Gdk.GC default_gc, Gdk.Drawable drawable) { private void prepare_gc(Gdk.GC default_gc, Gdk.Drawable drawable) {
...@@ -1435,8 +1435,8 @@ public class AdjustTool : EditingTool { ...@@ -1435,8 +1435,8 @@ public class AdjustTool : EditingTool {
canvas.paint_pixbuf(draw_to_pixbuf); canvas.paint_pixbuf(draw_to_pixbuf);
} }
public override Gdk.Pixbuf? get_unscaled_pixbuf(Photo photo) { public override Gdk.Pixbuf? get_display_pixbuf(TransformablePhoto photo) {
return photo.get_pixbuf(PhotoTransformer.SCREEN, PhotoTransformer.Exception.ADJUST); return photo.get_pixbuf(TransformablePhoto.SCREEN, TransformablePhoto.Exception.ADJUST);
} }
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
*/ */
public class DirectoryItem : LayoutItem, EventSource { public class DirectoryItem : LayoutItem, EventSource {
public const Gdk.InterpType INTERP = Gdk.InterpType.BILINEAR;
public const int SCALE = public const int SCALE =
ThumbnailCache.MEDIUM_SCALE + ((ThumbnailCache.BIG_SCALE - ThumbnailCache.MEDIUM_SCALE) / 2); ThumbnailCache.MEDIUM_SCALE + ((ThumbnailCache.BIG_SCALE - ThumbnailCache.MEDIUM_SCALE) / 2);
...@@ -19,8 +18,8 @@ public class DirectoryItem : LayoutItem, EventSource { ...@@ -19,8 +18,8 @@ public class DirectoryItem : LayoutItem, EventSource {
PhotoID photo_id = event_table.get_primary_photo(event_id); PhotoID photo_id = event_table.get_primary_photo(event_id);
assert(photo_id.is_valid()); assert(photo_id.is_valid());
Photo photo = Photo.fetch(photo_id); LibraryPhoto photo = LibraryPhoto.fetch(photo_id);
Gdk.Pixbuf pixbuf = photo.get_preview_pixbuf(SCALE, INTERP); Gdk.Pixbuf pixbuf = photo.get_preview_pixbuf(SCALE);
set_image(pixbuf); set_image(pixbuf);
} }
...@@ -35,9 +34,9 @@ public class DirectoryItem : LayoutItem, EventSource { ...@@ -35,9 +34,9 @@ public class DirectoryItem : LayoutItem, EventSource {
public Gee.Iterable<PhotoSource> get_photos() { public Gee.Iterable<PhotoSource> get_photos() {
Gee.ArrayList<PhotoID?> photo_ids = (new PhotoTable()).get_event_photos(event_id); Gee.ArrayList<PhotoID?> photo_ids = (new PhotoTable()).get_event_photos(event_id);
Gee.ArrayList<Photo> photos = new Gee.ArrayList<Photo>(); Gee.ArrayList<LibraryPhoto> photos = new Gee.ArrayList<LibraryPhoto>();
foreach (PhotoID photo_id in photo_ids) { foreach (PhotoID photo_id in photo_ids) {
photos.add(Photo.fetch(photo_id)); photos.add(LibraryPhoto.fetch(photo_id));
} }
return photos; return photos;
} }
......
...@@ -60,8 +60,8 @@ class ImportPreview : LayoutItem, PhotoSource { ...@@ -60,8 +60,8 @@ class ImportPreview : LayoutItem, PhotoSource {
return dimensions; return dimensions;
} }
public Exif.Data get_exif() { public Exif.Data? get_exif() {
return exif; return exif;
} }
} }
...@@ -838,8 +838,8 @@ public class ImportQueuePage : SinglePhotoPage { ...@@ -838,8 +838,8 @@ public class ImportQueuePage : SinglePhotoPage {
current_batch = batch_import; current_batch = batch_import;
} }
private void on_imported(Photo photo) { private void on_imported(LibraryPhoto photo) {
set_pixbuf(photo.get_pixbuf(PhotoTransformer.SCREEN)); set_pixbuf(photo.get_pixbuf(TransformablePhoto.SCREEN));
progress_bytes += photo.get_filesize(); progress_bytes += photo.get_filesize();
double pct = (progress_bytes <= total_bytes) ? (double) progress_bytes / (double) total_bytes double pct = (progress_bytes <= total_bytes) ? (double) progress_bytes / (double) total_bytes
...@@ -850,7 +850,7 @@ public class ImportQueuePage : SinglePhotoPage { ...@@ -850,7 +850,7 @@ public class ImportQueuePage : SinglePhotoPage {
} }
private void on_import_complete(BatchImport batch_import, ImportID import_id, private void on_import_complete(BatchImport batch_import, ImportID import_id,
SortedList<Photo> imported, Gee.ArrayList<string> failed, Gee.ArrayList<string> skipped) { SortedList<LibraryPhoto> imported, Gee.ArrayList<string> failed, Gee.ArrayList<string> skipped) {
assert(batch_import == current_batch); assert(batch_import == current_batch);
current_batch = null; current_batch = null;
......
...@@ -127,10 +127,10 @@ public class LibraryWindow : AppWindow { ...@@ -127,10 +127,10 @@ public class LibraryWindow : AppWindow {
add_parent_page(events_directory_page); add_parent_page(events_directory_page);
add_orphan_page(photo_page); add_orphan_page(photo_page);
// create Photo objects for all photos in the database and load into the Photos page // create LibraryPhoto objects for all photos in the database and load into the Photos page
Gee.ArrayList<PhotoID?> photo_ids = photo_table.get_photos(); Gee.ArrayList<PhotoID?> photo_ids = photo_table.get_photos();
foreach (PhotoID photo_id in photo_ids) { foreach (PhotoID photo_id in photo_ids) {
Photo photo = Photo.fetch(photo_id); LibraryPhoto photo = LibraryPhoto.fetch(photo_id);
photo.removed += on_photo_removed; photo.removed += on_photo_removed;
collection_page.add_photo(photo); collection_page.add_photo(photo);
...@@ -364,7 +364,7 @@ public class LibraryWindow : AppWindow { ...@@ -364,7 +364,7 @@ public class LibraryWindow : AppWindow {
} }
} }
public void photo_imported(Photo photo) { public void photo_imported(LibraryPhoto photo) {
// want to know when it's removed from the system for cleanup // want to know when it's removed from the system for cleanup
photo.removed += on_photo_removed; photo.removed += on_photo_removed;
...@@ -373,7 +373,7 @@ public class LibraryWindow : AppWindow { ...@@ -373,7 +373,7 @@ public class LibraryWindow : AppWindow {
collection_page.refresh(); collection_page.refresh();
} }
public void batch_import_complete(SortedList<Photo> imported_photos) { public void batch_import_complete(SortedList<LibraryPhoto> imported_photos) {
debug("Processing imported photos to create events ..."); debug("Processing imported photos to create events ...");
// walk through photos, splitting into events based on criteria // walk through photos, splitting into events based on criteria
...@@ -381,7 +381,7 @@ public class LibraryWindow : AppWindow { ...@@ -381,7 +381,7 @@ public class LibraryWindow : AppWindow {
time_t current_event_start = 0; time_t current_event_start = 0;
EventID current_event_id = EventID(); EventID current_event_id = EventID();
EventPage current_event_page = null; EventPage current_event_page = null;
foreach (Photo photo in imported_photos) { foreach (LibraryPhoto photo in imported_photos) {
time_t exposure_time = photo.get_exposure_time(); time_t exposure_time = photo.get_exposure_time();
if (exposure_time == 0) { if (exposure_time == 0) {
...@@ -448,7 +448,7 @@ public class LibraryWindow : AppWindow { ...@@ -448,7 +448,7 @@ public class LibraryWindow : AppWindow {
} }
} }
private void on_photo_removed(Photo photo) { private void on_photo_removed(LibraryPhoto photo) {
PhotoID photo_id = photo.get_photo_id(); PhotoID photo_id = photo.get_photo_id();
// update event's primary photo if this is the one; remove event if no more photos in it // update event's primary photo if this is the one; remove event if no more photos in it
...@@ -573,7 +573,7 @@ public class LibraryWindow : AppWindow { ...@@ -573,7 +573,7 @@ public class LibraryWindow : AppWindow {
Gee.ArrayList<PhotoID?> photo_ids = photo_table.get_event_photos(event_id); Gee.ArrayList<PhotoID?> photo_ids = photo_table.get_event_photos(event_id);
foreach (PhotoID photo_id in photo_ids) foreach (PhotoID photo_id in photo_ids)
event_page.add_photo(Photo.fetch(photo_id)); event_page.add_photo(LibraryPhoto.fetch(photo_id));
insert_child_page_sorted(events_directory_page.get_marker(), event_page, insert_child_page_sorted(events_directory_page.get_marker(), event_page,
new CompareEventPage(get_events_sort())); new CompareEventPage(get_events_sort()));
......
This diff is collapsed.
...@@ -25,7 +25,7 @@ public class PhotoPage : SinglePhotoPage { ...@@ -25,7 +25,7 @@ public class PhotoPage : SinglePhotoPage {
private Gtk.Window container = null; private Gtk.Window container = null;
private Gtk.Menu context_menu; private Gtk.Menu context_menu;
private CheckerboardPage controller = null; private CheckerboardPage controller = null;
private Photo photo = null; private TransformablePhoto photo = null;
private Thumbnail thumbnail = null; private Thumbnail thumbnail = null;
private Gtk.Toolbar toolbar = new Gtk.Toolbar(); private Gtk.Toolbar toolbar = new Gtk.Toolbar();
private Gtk.ToolButton rotate_button = null; private Gtk.ToolButton rotate_button = null;
...@@ -170,12 +170,12 @@ public class PhotoPage : SinglePhotoPage { ...@@ -170,12 +170,12 @@ public class PhotoPage : SinglePhotoPage {
// throw a resized large thumbnail up to get an image on the screen quickly, // throw a resized large thumbnail up to get an image on the screen quickly,
// and when ready decode and display the full image // and when ready decode and display the full image
set_pixbuf(photo.get_preview_pixbuf(PhotoTransformer.SCREEN)); set_pixbuf(photo.get_preview_pixbuf(TransformablePhoto.SCREEN));
Idle.add(update_pixbuf); Idle.add(update_pixbuf);
} }
private bool update_pixbuf() { private bool update_pixbuf() {
set_pixbuf(photo.get_pixbuf(PhotoTransformer.SCREEN)); set_pixbuf(photo.get_pixbuf(TransformablePhoto.SCREEN));
return false; return false;
} }
...@@ -197,7 +197,7 @@ public class PhotoPage : SinglePhotoPage { ...@@ -197,7 +197,7 @@ public class PhotoPage : SinglePhotoPage {
deactivate_tool(); deactivate_tool();
// see if the tool wants a different pixbuf displayed // see if the tool wants a different pixbuf displayed
Gdk.Pixbuf unscaled = tool.get_unscaled_pixbuf(photo); Gdk.Pixbuf unscaled = tool.get_display_pixbuf(photo);
if (unscaled != null) if (unscaled != null)
set_pixbuf(unscaled); set_pixbuf(unscaled);
...@@ -359,9 +359,7 @@ public class PhotoPage : SinglePhotoPage { ...@@ -359,9 +359,7 @@ public class PhotoPage : SinglePhotoPage {
} }
} }
private void on_photo_altered(Photo p) { private void on_photo_altered(TransformablePhoto p) {
assert(photo.equals(p));
update_pixbuf(); update_pixbuf();
} }
...@@ -655,7 +653,7 @@ public class PhotoPage : SinglePhotoPage { ...@@ -655,7 +653,7 @@ public class PhotoPage : SinglePhotoPage {
} }
public override Gee.Iterable<Queryable>? get_queryables() { public override Gee.Iterable<Queryable>? get_queryables() {
Gee.ArrayList<Photo> photo_array_list = new Gee.ArrayList<Photo>(); Gee.ArrayList<TransformablePhoto> photo_array_list = new Gee.ArrayList<TransformablePhoto>();
photo_array_list.add(photo); photo_array_list.add(photo);
return photo_array_list; return photo_array_list;
} }
......
This diff is collapsed.
...@@ -15,7 +15,7 @@ public interface PhotoSource : Queryable { ...@@ -15,7 +15,7 @@ public interface PhotoSource : Queryable {
public abstract uint64 get_filesize(); public abstract uint64 get_filesize();
public abstract Exif.Data get_exif(); public abstract Exif.Data? get_exif();
} }
public interface EventSource : Queryable { public interface EventSource : Queryable {
......
...@@ -13,13 +13,13 @@ public class Thumbnail : LayoutItem, PhotoSource { ...@@ -13,13 +13,13 @@ public class Thumbnail : LayoutItem, PhotoSource {
public const Gdk.InterpType LOW_QUALITY_INTERP = Gdk.InterpType.NEAREST; public const Gdk.InterpType LOW_QUALITY_INTERP = Gdk.InterpType.NEAREST;
public const Gdk.InterpType HIGH_QUALITY_INTERP = Gdk.InterpType.BILINEAR; public const Gdk.InterpType HIGH_QUALITY_INTERP = Gdk.InterpType.BILINEAR;
private Photo photo; private LibraryPhoto photo;
private int scale; private int scale;