Commit 371debeb authored by Eric Gregory's avatar Eric Gregory

3838 Default RAW developer preference.

Newly imported RAW photos are set to the developer set in the preferences dialog.
parent d7a9bd2d
......@@ -124,6 +124,12 @@
<summary>background color</summary>
<description>A grayscale color for use as the background color.</description>
</key>
<key name="raw-developer-default" type="s">
<default>'SHOTWELL'</default>
<summary>RAW developer default</summary>
<description>Default option for which RAW developer Shotwell will use.</description>
</key>
</schema>
<schema id="org.yorba.shotwell.preferences.slideshow" path="/apps/shotwell/preferences/slideshow/">
......
......@@ -940,6 +940,7 @@ public class BatchImport : Object {
} else {
job.ready.batch_result.result = LibraryPhoto.import_create(job.ready.photo_import_params,
out source);
Photo photo = source as Photo;
if (job.ready.photo_import_params.final_associated_file != null) {
// Associate RAW+JPEG in database.
......@@ -954,6 +955,10 @@ public class BatchImport : Object {
warning("Unable to associate JPEG with RAW. File: %s Error: %s",
bpr.filepath, e.message);
}
// Set the default developer for raw photos
if (photo.get_master_file_format() == PhotoFileFormat.RAW)
photo.set_raw_developer(Config.Facade.get_instance().get_default_raw_developer());
}
}
......
......@@ -1747,6 +1747,7 @@ public class PreferencesDialog {
private Gtk.CheckButton lowercase;
private Gtk.Button close_button;
private Plugins.ManifestWidgetMediator plugins_mediator = new Plugins.ManifestWidgetMediator();
private Gtk.ComboBox default_raw_developer_combo;
private PreferencesDialog() {
builder = AppWindow.create_builder();
......@@ -1824,6 +1825,13 @@ public class PreferencesDialog {
Gtk.CheckButton commit_metadata_button = builder.get_object("write_metadata") as Gtk.CheckButton;
commit_metadata_button.set_active(Config.Facade.get_instance().get_commit_metadata_to_masters());
default_raw_developer_combo = builder.get_object("default_raw_developer") as Gtk.ComboBox;
gtk_combo_box_set_as_text(default_raw_developer_combo);
default_raw_developer_combo.append_text(RawDeveloper.SHOTWELL.get_label());
default_raw_developer_combo.append_text(RawDeveloper.CAMERA.get_label());
set_raw_developer_combo(Config.Facade.get_instance().get_default_raw_developer());
default_raw_developer_combo.changed.connect(on_default_raw_developer_changed);
dialog.map_event.connect(map_event);
}
......@@ -2082,6 +2090,23 @@ public class PreferencesDialog {
debug("setting external raw editor to: %s", app.get_commandline());
}
private RawDeveloper raw_developer_from_combo() {
if (default_raw_developer_combo.get_active() == 0)
return RawDeveloper.SHOTWELL;
return RawDeveloper.CAMERA;
}
private void set_raw_developer_combo(RawDeveloper d) {
if (d == RawDeveloper.SHOTWELL)
default_raw_developer_combo.set_active(0);
else
default_raw_developer_combo.set_active(1);
}
private void on_default_raw_developer_changed() {
Config.Facade.get_instance().set_default_raw_developer(raw_developer_from_combo());
}
private void on_current_folder_changed() {
lib_dir = library_dir_button.get_current_folder();
}
......
......@@ -2806,19 +2806,8 @@ public abstract class Photo : PhotoSource, Dateable {
if (is_scaled)
crop = crop.get_scaled_similar(original, scaled);
// The crop region has to move when an image is straightened, and
// this could potentially lead to the crop boundaries being beyond
// the image boundaries. We check for this here and clip them to
// the image to prevent problems with GDK.
Box crop_clipped = Box(crop.left, crop.top, crop.right, crop.bottom);
crop_clipped.left = crop_clipped.left.clamp(0, pixbuf.width - 1);
crop_clipped.right = crop_clipped.right.clamp(0, pixbuf.width - 1);
crop_clipped.top = crop_clipped.top.clamp(0, pixbuf.height - 1);
crop_clipped.bottom = crop_clipped.bottom.clamp(0, pixbuf.height - 1);
pixbuf = new Gdk.Pixbuf.subpixbuf(pixbuf, crop_clipped.left, crop_clipped.top, crop_clipped.get_width(),
crop_clipped.get_height());
pixbuf = new Gdk.Pixbuf.subpixbuf(pixbuf, crop.left, crop.top, crop.get_width(),
crop.get_height());
}
#if MEASURE_PIPELINE
......
......@@ -2574,7 +2574,6 @@ public class LibraryPhotoPage : EditingHostPage {
dev_camera.label = label_camera;
developer_actions += dev_camera;
// todo: change RawDeveloper.SHOTWELL to default
action_group.add_radio_actions(developer_actions, RawDeveloper.SHOTWELL, on_raw_developer_changed);
base.register_radio_actions(action_group);
......
......@@ -569,13 +569,23 @@ public class ImportPage : CheckerboardPage {
}
public override bool complete(MediaSource source, BatchImportRoll import_roll) throws Error {
// Associate paired JPEG with RAW photo.
if (associated_file != null) {
bool ret = false;
if (source is Photo) {
Photo photo = source as Photo;
photo.add_backing_photo_for_development(RawDeveloper.CAMERA, associated_file);
return true;
// Associate paired JPEG with RAW photo.
if (associated_file != null) {
photo.add_backing_photo_for_development(RawDeveloper.CAMERA, associated_file);
ret = true;
}
// Set the default developer for raw photos
if (photo.get_master_file_format() == PhotoFileFormat.RAW) {
photo.set_raw_developer(Config.Facade.get_instance().get_default_raw_developer());
ret = true;
}
}
return false;
return ret;
}
}
......
......@@ -60,6 +60,7 @@ public enum ConfigurableProperty {
PRINTING_PRINT_TITLES,
PRINTING_SIZE_SELECTION,
PRINTING_TITLES_FONT,
RAW_DEVELOPER_DEFAULT,
SHOW_WELCOME_DIALOG,
SIDEBAR_POSITION,
SLIDESHOW_DELAY,
......@@ -194,6 +195,9 @@ public enum ConfigurableProperty {
case PRINTING_TITLES_FONT:
return "PRINTING_TITLES_FONT";
case RAW_DEVELOPER_DEFAULT:
return "RAW_DEVELOPER_DEFAULT";
case SHOW_WELCOME_DIALOG:
return "SHOW_WELCOME_DIALOG";
......@@ -686,6 +690,30 @@ public abstract class ConfigurationFacade : Object {
}
}
//
// Default RAW developer.
//
public virtual RawDeveloper get_default_raw_developer() {
try {
return RawDeveloper.from_string(get_engine().get_string_property(
ConfigurableProperty.RAW_DEVELOPER_DEFAULT));
} catch (ConfigurationError err) {
on_configuration_error(err);
return RawDeveloper.SHOTWELL;
}
}
public virtual void set_default_raw_developer(RawDeveloper d) {
try {
get_engine().set_string_property(ConfigurableProperty.RAW_DEVELOPER_DEFAULT,
d.to_string());
} catch (ConfigurationError err) {
on_configuration_error(err);
return;
}
}
//
// import dir
//
......
......@@ -138,6 +138,9 @@ public class GConfConfigurationEngine : ConfigurationEngine, GLib.Object {
property_paths[ConfigurableProperty.PRINTING_TITLES_FONT] =
"/apps/shotwell/printing/print_titles_font";
property_paths[ConfigurableProperty.RAW_DEVELOPER_DEFAULT] =
PATH_SHOTWELL_PREFS + "/files/raw_developer_default";
property_paths[ConfigurableProperty.SHOW_WELCOME_DIALOG] =
PATH_SHOTWELL_PREFS + "/ui/show_welcome_dialog";
......
......@@ -71,6 +71,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
schema_names[ConfigurableProperty.PRINTING_PRINT_TITLES] = PRINTING_SCHEMA_NAME;
schema_names[ConfigurableProperty.PRINTING_SIZE_SELECTION] = PRINTING_SCHEMA_NAME;
schema_names[ConfigurableProperty.PRINTING_TITLES_FONT] = PRINTING_SCHEMA_NAME;
schema_names[ConfigurableProperty.RAW_DEVELOPER_DEFAULT] = UI_PREFS_SCHEMA_NAME;;
schema_names[ConfigurableProperty.SHOW_WELCOME_DIALOG] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.SIDEBAR_POSITION] = UI_PREFS_SCHEMA_NAME;
schema_names[ConfigurableProperty.SLIDESHOW_DELAY] = SLIDESHOW_PREFS_SCHEMA_NAME;
......@@ -122,6 +123,7 @@ public class GSettingsConfigurationEngine : ConfigurationEngine, GLib.Object {
key_names[ConfigurableProperty.PRINTING_PRINT_TITLES] = "print-titles";
key_names[ConfigurableProperty.PRINTING_SIZE_SELECTION] = "size-selection";
key_names[ConfigurableProperty.PRINTING_TITLES_FONT] = "titles-font";
key_names[ConfigurableProperty.RAW_DEVELOPER_DEFAULT] = "raw-developer-default";
key_names[ConfigurableProperty.SHOW_WELCOME_DIALOG] = "show-welcome-dialog";
key_names[ConfigurableProperty.SIDEBAR_POSITION] = "sidebar-position";
key_names[ConfigurableProperty.SLIDESHOW_DELAY] = "delay";
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment