757
766
get_view().clear();
760
public override void switching_to_fullscreen() {
761
base.switching_to_fullscreen();
769
public override void switching_to_fullscreen(FullscreenWindow fsw) {
770
base.switching_to_fullscreen(fsw);
763
772
deactivate_tool();
766
775
is_pan_in_progress = false;
768
if (controller != null)
769
controller.items_selected.connect(on_selection_changed);
777
Page page = fsw.get_current_page();
779
page.get_view().items_selected.connect(on_selection_changed);
772
public override void returning_from_fullscreen() {
773
base.returning_from_fullscreen();
782
public override void returning_from_fullscreen(FullscreenWindow fsw) {
783
base.returning_from_fullscreen(fsw);
777
if (controller != null)
778
controller.items_selected.disconnect(on_selection_changed);
787
Page page = fsw.get_current_page();
789
page.get_view().items_selected.disconnect(on_selection_changed);
781
792
private void on_selection_changed(Gee.Iterable<DataView> selected) {
1955
1952
#if !NO_SET_BACKGROUND
1956
ui.add_ui(ui.new_merge_id(), "/PhotoMenuBar/PhotoMenu/SetBackgroundPlaceholder",
1957
"SetBackground", "SetBackground", Gtk.UIManagerItemType.MENUITEM, false);
1958
ui.add_ui(ui.new_merge_id(), "/PhotoContextMenu/ContextSetBackgroundPlaceholder",
1953
ui.add_ui(ui.new_merge_id(), "/PhotoMenuBar/FileMenu/SetBackgroundPlaceholder",
1959
1954
"SetBackground", "SetBackground", Gtk.UIManagerItemType.MENUITEM, false);
2021
2019
remove_from_library.tooltip = _("Remove the photo from the library");
2022
2020
actions += remove_from_library;
2024
Gtk.ActionEntry move_to_trash = { "MoveToTrash", Gtk.STOCK_DELETE, TRANSLATABLE, "Delete",
2022
Gtk.ActionEntry move_to_trash = { "MoveToTrash", "user-trash-full", TRANSLATABLE, "Delete",
2025
2023
TRANSLATABLE, on_move_to_trash };
2026
2024
move_to_trash.label = Resources.MOVE_TO_TRASH_MENU;
2027
2025
move_to_trash.tooltip = _("Move the photo to the trash");
2105
2103
revert.tooltip = Resources.REVERT_TOOLTIP;
2106
2104
actions += revert;
2108
Gtk.ActionEntry revert_editable = { "RevertEditable", null, TRANSLATABLE, null,
2109
TRANSLATABLE, on_revert_editable };
2110
revert_editable.label = Resources.REVERT_EDITABLE_MENU;
2111
revert_editable.tooltip = Resources.REVERT_EDITABLE_TOOLTIP;
2112
actions += revert_editable;
2114
2106
Gtk.ActionEntry rename = { "PhotoRename", null, TRANSLATABLE, "F2", TRANSLATABLE,
2116
2108
rename.label = Resources.RENAME_PHOTO_MENU;
2123
2115
adjust_date_time.tooltip = Resources.ADJUST_DATE_TIME_TOOLTIP;
2124
2116
actions += adjust_date_time;
2126
Gtk.ActionEntry external_edit = { "ExternalEdit", Gtk.STOCK_EDIT, TRANSLATABLE, null,
2127
TRANSLATABLE, on_external_edit };
2118
Gtk.ActionEntry external_edit = { "ExternalEdit", Gtk.STOCK_EDIT, TRANSLATABLE,
2119
"<Ctrl>Return", TRANSLATABLE, on_external_edit };
2128
2120
external_edit.label = Resources.EXTERNAL_EDIT_MENU;
2129
2121
external_edit.tooltip = Resources.EXTERNAL_EDIT_TOOLTIP;
2130
2122
actions += external_edit;
2132
Gtk.ActionEntry edit_raw = { "ExternalEditRAW", null, TRANSLATABLE, null, TRANSLATABLE,
2133
on_external_edit_raw };
2125
Gtk.ActionEntry edit_raw = { "ExternalEditRAW", null, TRANSLATABLE, "<Ctrl><Shift>Return",
2126
TRANSLATABLE, on_external_edit_raw };
2134
2127
edit_raw.label = Resources.EXTERNAL_EDIT_RAW_MENU;
2135
2128
edit_raw.tooltip = Resources.EXTERNAL_EDIT_RAW_TOOLTIP;
2136
2129
actions += edit_raw;
2138
Gtk.ActionEntry jump_to_file = { "JumpToFile", Gtk.STOCK_JUMP_TO, TRANSLATABLE, null,
2139
TRANSLATABLE, on_jump_to_file };
2140
jump_to_file.label = Resources.JUMP_TO_FILE_MENU;
2141
jump_to_file.tooltip = Resources.JUMP_TO_FILE_TOOLTIP;
2142
actions += jump_to_file;
2144
2132
#if !NO_SET_BACKGROUND
2145
2133
Gtk.ActionEntry set_background = { "SetBackground", null, TRANSLATABLE, "<Ctrl>B",
2199
2187
protected override void init_actions(int selected_count, int count) {
2200
2188
set_action_sensitive("ExternalEdit", count > 0 && Config.get_instance().get_external_photo_app() != "");
2201
set_action_hidden("ExternalEditRAW");
2202
set_action_sensitive("RevertEditable", has_photo() && get_photo().has_editable());
2190
set_action_sensitive("Revert", has_photo() ?
2191
(get_photo().has_transformations() || get_photo().has_editable()) : false);
2193
#if !NO_SET_BACKGROUND
2194
set_action_sensitive("SetBackground", has_photo());
2204
2197
base.init_actions(selected_count, count);
2207
2200
private void on_contents_altered() {
2208
bool is_raw = has_photo() && get_photo().get_master_file_format() == PhotoFileFormat.RAW;
2210
2201
set_action_sensitive("ExternalEdit", has_photo() && Config.get_instance().get_external_photo_app() != "");
2212
set_action_visible("ExternalEditRAW", Config.get_instance().get_external_raw_app() != "");
2214
set_action_hidden("ExternalEditRAW");
2215
set_action_sensitive("RevertEditable", has_photo() && get_photo().has_editable());
2203
set_action_sensitive("Revert", has_photo() ?
2204
(get_photo().has_transformations() || get_photo().has_editable()) : false);
2206
#if !NO_SET_BACKGROUND
2207
set_action_sensitive("SetBackground", has_photo());
2218
2211
private void on_photos_altered() {
2219
set_action_sensitive("RevertEditable", has_photo() && get_photo().has_editable());
2212
set_action_sensitive("Revert", has_photo() ?
2213
(get_photo().has_transformations() || get_photo().has_editable()) : false);
2222
2216
public void display_for_collection(CollectionPage return_page, Photo photo) {
2272
2266
private void update_zoom_menu_item_sensitivity() {
2273
set_item_sensitive("/PhotoMenuBar/ViewMenu/IncreaseSize", !get_zoom_state().is_max());
2274
set_item_sensitive("/PhotoMenuBar/ViewMenu/DecreaseSize", !get_zoom_state().is_default());
2267
set_item_sensitive("/PhotoMenuBar/ViewMenu/IncreaseSize", !get_zoom_state().is_max()
2268
&& !get_photo_missing());
2269
set_item_sensitive("/PhotoMenuBar/ViewMenu/DecreaseSize", !get_zoom_state().is_default()
2270
&& !get_photo_missing());
2277
2273
protected override void on_increase_size() {
2301
2297
protected override void set_missing_photo_sensitivities(bool sensitivity) {
2298
set_item_sensitive("/PhotoMenuBar/FileMenu/PublishPlaceholder/Publish", sensitivity);
2299
set_item_sensitive("/PhotoMenuBar/FileMenu/PrintPlaceholder/Print", sensitivity);
2300
set_item_sensitive("/PhotoMenuBar/FileMenu/JumpToFile", sensitivity);
2301
set_item_sensitive("/PhotoMenuBar/EditMenu/Undo", sensitivity);
2302
set_item_sensitive("/PhotoMenuBar/EditMenu/Redo", sensitivity);
2303
set_item_sensitive("/PhotoMenuBar/ViewMenu/IncreaseSize", sensitivity);
2304
set_item_sensitive("/PhotoMenuBar/ViewMenu/DecreaseSize", sensitivity);
2302
2305
set_item_sensitive("/PhotoMenuBar/PhotoMenu/RotateClockwise", sensitivity);
2303
2306
set_item_sensitive("/PhotoMenuBar/PhotoMenu/RotateCounterclockwise", sensitivity);
2304
2307
set_item_sensitive("/PhotoMenuBar/PhotoMenu/Mirror", sensitivity);
2307
2310
set_item_sensitive("/PhotoMenuBar/PhotoMenu/Tools/Crop", sensitivity);
2308
2311
set_item_sensitive("/PhotoMenuBar/PhotoMenu/Tools/RedEye", sensitivity);
2309
2312
set_item_sensitive("/PhotoMenuBar/PhotoMenu/Tools/Adjust", sensitivity);
2310
set_item_sensitive("/PhotoMenuBar/PhotoMenu/Revert", sensitivity);
2313
set_item_sensitive("/PhotoMenuBar/PhotoMenu/FavoriteUnfavorite", sensitivity);
2314
set_item_sensitive("/PhotoMenuBar/PhotoMenu/HideUnhide", sensitivity);
2315
set_item_sensitive("/PhotoMenuBar/PhotoMenu/PhotoRename", sensitivity);
2316
set_item_sensitive("/PhotoMenuBar/PhotoMenu/AdjustDateTime", sensitivity);
2317
set_item_sensitive("/PhotoMenuBar/PhotoMenu/ExternalEdit", sensitivity);
2318
set_item_sensitive("/PhotoMenuBar/PhotoMenu/ExternalEditRAW", sensitivity);
2319
set_item_sensitive("/PhotoMenuBar/PhotoMenu/Revert", sensitivity);
2320
set_item_sensitive("/PhotoMenuBar/TagsMenu/AddTags", sensitivity);
2321
set_item_sensitive("/PhotoMenuBar/TagsMenu/ModifyTags", sensitivity);
2322
//AppWindow.get_instance().set_common_action_sensitive("CommonFullscreen", sensitivity);
2312
set_item_sensitive("/PhotoContextMenu/ContextRotateClockwise", sensitivity);
2313
set_item_sensitive("/PhotoContextMenu/ContextRotateCounterclockwise", sensitivity);
2314
set_item_sensitive("/PhotoContextMenu/PhotoRename", sensitivity);
2315
set_item_sensitive("/PhotoContextMenu/AdjustDateTime", sensitivity);
2316
set_action_sensitive("JumpToFile", sensitivity);
2324
set_item_sensitive("/PhotoContextMenu/ContextEnhance", sensitivity);
2325
set_item_sensitive("/PhotoContextMenu/ContextRevert", sensitivity);
2326
set_item_sensitive("/PhotoContextMenu/ContextAddTags", sensitivity);
2327
set_item_sensitive("/PhotoContextMenu/ContextModifyTags", sensitivity);
2328
set_item_sensitive("/PhotoContextMenu/ContextFavoriteUnfavorite", sensitivity);
2329
set_item_sensitive("/PhotoContextMenu/ContextHideUnhide", sensitivity);
2330
set_item_sensitive("/PhotoContextMenu/ContextPhotoRename", sensitivity);
2331
set_item_sensitive("/PhotoContextMenu/ContextExternalEdit", sensitivity);
2332
set_item_sensitive("/PhotoContextMenu/ContextExternalEditRAW", sensitivity);
2333
set_item_sensitive("/PhotoContextMenu/JumpToFile", sensitivity);
2334
set_item_sensitive("/PhotoContextMenu/ContextMoveToTrash", sensitivity);
2318
2336
#if !NO_SET_BACKGROUND
2319
set_item_sensitive("/PhotoMenuBar/PhotoMenu/SetBackgroundPlaceholder/SetBackground",
2321
set_item_sensitive("/PhotoContextMenu/ContextSetBackgroundPlaceholder/SetBackground",
2337
set_action_sensitive("SetBackground", sensitivity);
2325
2340
set_item_sensitive("/PhotoContextMenu/ContextHideUnhide", sensitivity);
2379
2394
private override bool on_context_invoked() {
2380
2395
if (!has_photo())
2399
bool is_raw = has_photo() && get_photo().get_master_file_format() == PhotoFileFormat.RAW;
2383
set_item_sensitive("/PhotoContextMenu/ContextRotateClockwise", is_rotate_available(get_photo()));
2384
set_item_sensitive("/PhotoContextMenu/ContextRotateCounterclockwise",
2385
is_rotate_available(get_photo()));
2386
2402
set_item_sensitive("/PhotoContextMenu/ContextEnhance", is_enhance_available(get_photo()));
2387
set_item_sensitive("/PhotoContextMenu/ContextRevert", get_photo().has_transformations());
2389
2404
set_hide_item_label("/PhotoContextMenu/ContextHideUnhide");
2390
2405
set_favorite_item_label("/PhotoContextMenu/ContextFavoriteUnfavorite");
2409
set_item_visible("/PhotoContextMenu/ContextExternalEditRAW",
2410
Config.get_instance().get_external_raw_app() != "");
2412
set_item_hidden("/PhotoContextMenu/ContextExternalEditRAW");
2392
2415
return base.on_context_invoked();
2540
2570
private void on_file_menu() {
2541
2571
#if !NO_PRINTING
2542
set_item_sensitive("/PhotoMenuBar/FileMenu/PrintPlaceholder/Print", has_photo());
2572
set_item_sensitive("/PhotoMenuBar/FileMenu/PrintPlaceholder/Print", has_photo() &&
2573
!get_photo_missing());
2545
set_item_sensitive("/PhotoMenuBar/FileMenu/Export", has_photo());
2576
set_item_sensitive("/PhotoMenuBar/FileMenu/Export", has_photo() && !get_photo_missing());
2547
2578
#if !NO_PUBLISHING
2548
set_item_sensitive("/PhotoMenuBar/FileMenu/PublishPlaceholder/Publish", has_photo());
2579
set_item_sensitive("/PhotoMenuBar/FileMenu/PublishPlaceholder/Publish", has_photo() &&
2580
!get_photo_missing());
2563
2595
private void on_edit_menu() {
2564
2596
decorate_undo_item("/PhotoMenuBar/EditMenu/Undo");
2565
2597
decorate_redo_item("/PhotoMenuBar/EditMenu/Redo");
2566
set_item_sensitive("/PhotoMenuBar/EditMenu/MoveToTrash", has_photo());
2598
// Override the decorate calls of the photo is missing
2599
if (get_photo_missing()) {
2600
set_item_sensitive("/PhotoMenuBar/EditMenu/Undo", false);
2601
set_item_sensitive("/PhotoMenuBar/EditMenu/Redo", false);
2603
set_item_sensitive("/PhotoMenuBar/EditMenu/MoveToTrash", has_photo() && !get_photo_missing());
2569
2606
protected void set_favorite_item_label(string path) {
2594
2633
set_item_sensitive("/PhotoMenuBar/PhotoMenu/RotateCounterclockwise", rotate_possible);
2595
2634
set_item_sensitive("/PhotoMenuBar/PhotoMenu/Mirror", rotate_possible);
2596
2635
set_item_sensitive("/PhotoMenuBar/PhotoMenu/Flip", rotate_possible);
2597
set_item_sensitive("/PhotoMenuBar/PhotoMenu/Revert", revert_possible);
2598
2636
set_hide_item_label("/PhotoMenuBar/PhotoMenu/HideUnhide");
2599
2637
set_favorite_item_label("/PhotoMenuBar/PhotoMenu/FavoriteUnfavorite");
2641
set_item_visible("/PhotoMenuBar/PhotoMenu/ExternalEditRAW",
2642
Config.get_instance().get_external_raw_app() != "");
2644
set_item_hidden("/PhotoMenuBar/PhotoMenu/ExternalEditRAW");
2602
2648
private void on_tools() {
2905
2951
ui.add_ui(ui.new_merge_id(), "/DirectMenuBar/FileMenu/PrintPlaceholder", "Print",
2906
2952
"Print", Gtk.UIManagerItemType.MENUITEM, false);
2955
#if !NO_SET_BACKGROUND
2956
ui.add_ui(ui.new_merge_id(), "/DirectMenuBar/FileMenu/SetBackgroundPlaceholder",
2957
"SetBackground", "SetBackground", Gtk.UIManagerItemType.MENUITEM, false);
2909
2960
context_menu = (Gtk.Menu) ui.get_widget("/DirectContextMenu");
2962
get_view().contents_altered.connect(on_contents_altered);
2912
2965
private Gtk.ActionEntry[] create_actions() {
3025
3078
adjust_date_time.tooltip = Resources.ADJUST_DATE_TIME_TOOLTIP;
3026
3079
actions += adjust_date_time;
3028
Gtk.ActionEntry jump_to_file = { "JumpToFile", Gtk.STOCK_JUMP_TO, TRANSLATABLE, null,
3029
TRANSLATABLE, on_jump_to_file };
3030
jump_to_file.label = Resources.JUMP_TO_FILE_MENU;
3031
jump_to_file.tooltip = Resources.JUMP_TO_FILE_TOOLTIP;
3032
actions += jump_to_file;
3034
3081
#if !NO_SET_BACKGROUND
3035
3082
Gtk.ActionEntry set_background = { "SetBackground", null, TRANSLATABLE, "<Ctrl>B",
3036
3083
TRANSLATABLE, on_set_background };
3109
3157
private void update_zoom_menu_item_sensitivity() {
3110
set_item_sensitive("/DirectMenuBar/ViewMenu/IncreaseSize", !get_zoom_state().is_max());
3111
set_item_sensitive("/DirectMenuBar/ViewMenu/DecreaseSize", !get_zoom_state().is_default());
3158
set_item_sensitive("/DirectMenuBar/ViewMenu/IncreaseSize", !get_zoom_state().is_max()
3159
&& !get_photo_missing());
3160
set_item_sensitive("/DirectMenuBar/ViewMenu/DecreaseSize", !get_zoom_state().is_default()
3161
&& !get_photo_missing());
3114
3164
protected override void on_increase_size() {
3126
3176
protected override void set_missing_photo_sensitivities(bool sensitivity) {
3127
3177
set_item_sensitive("/DirectMenuBar/FileMenu/Save", sensitivity);
3128
3178
set_item_sensitive("/DirectMenuBar/FileMenu/SaveAs", sensitivity);
3179
set_item_sensitive("/DirectMenuBar/FileMenu/PublishPlaceholder/Publish", sensitivity);
3180
set_item_sensitive("/DirectMenuBar/FileMenu/PrintPlaceholder/Print", sensitivity);
3181
set_item_sensitive("/DirectMenuBar/FileMenu/JumpToFile", sensitivity);
3183
set_item_sensitive("/DirectMenuBar/ViewMenu/IncreaseSize", sensitivity);
3184
set_item_sensitive("/DirectMenuBar/ViewMenu/IncreaseSize", sensitivity);
3185
set_item_sensitive("/DirectMenuBar/ViewMenu/DecreaseSize", sensitivity);
3130
3187
set_item_sensitive("/DirectMenuBar/PhotoMenu/RotateClockwise", sensitivity);
3131
3188
set_item_sensitive("/DirectMenuBar/PhotoMenu/RotateCounterclockwise", sensitivity);
3132
3189
set_item_sensitive("/DirectMenuBar/PhotoMenu/Mirror", sensitivity);
3133
3190
set_item_sensitive("/DirectMenuBar/PhotoMenu/Flip", sensitivity);
3134
set_item_sensitive("/PhotoMenuBar/PhotoMenu/Tools/Enhance", sensitivity);
3135
set_item_sensitive("/PhotoMenuBar/PhotoMenu/Tools/Crop", sensitivity);
3136
set_item_sensitive("/PhotoMenuBar/PhotoMenu/Tools/RedEye", sensitivity);
3137
set_item_sensitive("/PhotoMenuBar/PhotoMenu/Tools/Adjust", sensitivity);
3191
set_item_sensitive("/DirectMenuBar/PhotoMenu/Tools/Enhance", sensitivity);
3192
set_item_sensitive("/DirectMenuBar/PhotoMenu/Tools/Crop", sensitivity);
3193
set_item_sensitive("/DirectMenuBar/PhotoMenu/Tools/RedEye", sensitivity);
3194
set_item_sensitive("/DirectMenuBar/PhotoMenu/Tools/Adjust", sensitivity);
3138
3195
set_item_sensitive("/DirectMenuBar/PhotoMenu/Revert", sensitivity);
3196
set_item_sensitive("/DirectMenuBar/PhotoMenu/AdjustDateTime", sensitivity);
3197
set_item_sensitive("/DirectMenuBar/PhotoMenu/Fullscreen", sensitivity);
3140
set_item_sensitive("/DirectContextMenu/ContextRotateClockwise", sensitivity);
3141
set_item_sensitive("/DirectContextMenu/ContextRotateCounterclockwise", sensitivity);
3142
3199
set_item_sensitive("/DirectContextMenu/ContextEnhance", sensitivity);
3143
3200
set_item_sensitive("/DirectContextMenu/ContextRevert", sensitivity);
3201
set_item_sensitive("/DirectContextMenu/JumpToFile", sensitivity);
3145
3203
#if !NO_SET_BACKGROUND
3146
set_item_sensitive("/DirectContextMenu/ContextSetBackgroundPlaceholder/ContextSetBackground", sensitivity);
3204
set_action_sensitive("SetBackground", has_photo() && !get_photo_missing());
3149
3207
base.set_missing_photo_sensitivities(sensitivity);
3210
protected override void init_actions(int selected_count, int count) {
3211
#if !NO_SET_BACKGROUND
3212
set_action_sensitive("SetBackground", has_photo());
3215
base.init_actions(selected_count, count);
3218
private void on_contents_altered() {
3219
#if !NO_SET_BACKGROUND
3220
set_action_sensitive("SetBackground", has_photo());
3152
3224
private override bool on_context_invoked() {
3153
3225
if (get_photo() == null)
3156
set_item_sensitive("/DirectContextMenu/ContextRotateClockwise", is_rotate_available(get_photo()));
3157
set_item_sensitive("/DirectContextMenu/ContextRotateCounterclockwise",
3158
is_rotate_available(get_photo()));
3159
3228
set_item_sensitive("/DirectContextMenu/ContextEnhance", is_enhance_available(get_photo()));
3160
set_item_sensitive("/DirectContextMenu/ContextRevert", get_photo().has_transformations());
3229
set_item_sensitive("/DirectContextMenu/ContextRevert", get_photo().has_transformations() &&
3230
!get_photo_missing());
3231
//set_item_sensitive("/DirectContextMenu/JumpToFile", !get_photo_missing());
3162
3233
return base.on_context_invoked();
3320
3394
private void on_edit_menu() {
3321
3395
decorate_undo_item("/DirectMenuBar/EditMenu/Undo");
3322
3396
decorate_redo_item("/DirectMenuBar/EditMenu/Redo");
3397
// Override the decorate calls of the photo is missing
3398
if (get_photo_missing()) {
3399
set_item_sensitive("/PhotoMenuBar/EditMenu/Undo", false);
3400
set_item_sensitive("/PhotoMenuBar/EditMenu/Redo", false);
3325
3404
private void on_photo_menu() {
3326
3405
bool multiple = (get_controller() != null) ? get_controller().get_count() > 1 : false;
3327
bool revert_possible = has_photo() ? get_photo().has_transformations() : false;
3406
bool revert_possible = has_photo() ? get_photo().has_transformations()
3407
&& !get_photo_missing() : false;
3328
3408
bool rotate_possible = has_photo() ? is_rotate_available(get_photo()) : false;
3330
3410
set_item_sensitive("/DirectMenuBar/PhotoMenu/PrevPhoto", multiple);