if candidate_undo_text && candidate_undo_text != textview.buffer.text
$modified = true
save_undo(_("text edit"),
- Proc.new { |text|
+ proc { |text|
save_text = textview.buffer.text
textview.buffer.text = text
textview.grab_focus
$notebook.set_page(pagenum)
- Proc.new {
+ proc {
textview.buffer.text = save_text
textview.grab_focus
$notebook.set_page(pagenum)
rotate_real(angle, thumbnail_img, img, xmlelem, attributes_prefix, desired_x, desired_y)
save_undo(angle == 90 ? _("rotate clockwise") : angle == -90 ? _("rotate counter-clockwise") : _("flip upside-down"),
- Proc.new { |angle|
+ proc { |angle|
rotate_real(angle, thumbnail_img, img, xmlelem, attributes_prefix, desired_x, desired_y)
$notebook.set_page(attributes_prefix != '' ? 0 : 1)
- Proc.new {
+ proc {
rotate_real(-angle, thumbnail_img, img, xmlelem, attributes_prefix, desired_x, desired_y)
$notebook.set_page(0)
$notebook.set_page(attributes_prefix != '' ? 0 : 1)
end
def popup_thumbnail_menu(event, optionals, fullpath, type, xmldir, attributes_prefix, possible_actions, closures)
- distribute_multiple_call = Proc.new { |action, arg|
+ distribute_multiple_call = proc { |action, arg|
$selected_elements.each_key { |path|
$name2widgets[path][:img].pixbuf = $selected_elements[path][:pixbuf]
}
#- to be able to find widgets by name
$name2widgets[filename] = { :textview => textview, :evtbox => evtbox, :vbox => vbox, :img => img, :type => type }
- cleanup_all_thumbnails = Proc.new {
+ cleanup_all_thumbnails = proc {
#- remove out of sync images
dest_img_base = build_full_dest_filename(filename).sub(/\.[^\.]+$/, '')
for sizeobj in $images_size
}
- rotate_and_cleanup = Proc.new { |angle|
+ rotate_and_cleanup = proc { |angle|
rotate(angle, thumbnail_img, img, $xmldir.elements["*[@filename='#{filename}']"], '', $default_thumbnails[:x], $default_thumbnails[:y])
cleanup_all_thumbnails.call
}
- move = Proc.new { |direction|
+ move = proc { |direction|
do_method = "move_#{direction}"
undo_method = "move_" + case direction; when 'left'; 'right'; when 'right'; 'left'; when 'up'; 'down'; when 'down'; 'up' end
- perform = Proc.new {
+ perform = proc {
done = autotable.method(do_method).call(vbox)
textview.grab_focus #- because if moving, focus is stolen
done
}
if perform.call
save_undo(_("move %s") % direction,
- Proc.new {
+ proc {
autotable.method(undo_method).call(vbox)
textview.grab_focus #- because if moving, focus is stolen
autoscroll_if_needed($autotable_sw, img, textview)
$notebook.set_page(1)
- Proc.new {
+ proc {
autotable.method(do_method).call(vbox)
textview.grab_focus #- because if moving, focus is stolen
autoscroll_if_needed($autotable_sw, img, textview)
end
}
- color_swap_and_cleanup = Proc.new {
- perform_color_swap_and_cleanup = Proc.new {
+ color_swap_and_cleanup = proc {
+ perform_color_swap_and_cleanup = proc {
color_swap($xmldir.elements["*[@filename='#{filename}']"], '')
my_gen_real_thumbnail.call
}
perform_color_swap_and_cleanup.call
save_undo(_("color swap"),
- Proc.new {
+ proc {
perform_color_swap_and_cleanup.call
textview.grab_focus
autoscroll_if_needed($autotable_sw, img, textview)
$notebook.set_page(1)
- Proc.new {
+ proc {
perform_color_swap_and_cleanup.call
textview.grab_focus
autoscroll_if_needed($autotable_sw, img, textview)
})
}
- change_frame_offset_and_cleanup_real = Proc.new { |values|
- perform_change_frame_offset_and_cleanup = Proc.new { |val|
+ change_frame_offset_and_cleanup_real = proc { |values|
+ perform_change_frame_offset_and_cleanup = proc { |val|
change_frame_offset($xmldir.elements["*[@filename='#{filename}']"], '', val)
my_gen_real_thumbnail.call
}
perform_change_frame_offset_and_cleanup.call(values[:new])
save_undo(_("specify frame offset"),
- Proc.new {
+ proc {
perform_change_frame_offset_and_cleanup.call(values[:old])
textview.grab_focus
autoscroll_if_needed($autotable_sw, img, textview)
$notebook.set_page(1)
- Proc.new {
+ proc {
perform_change_frame_offset_and_cleanup.call(values[:new])
textview.grab_focus
autoscroll_if_needed($autotable_sw, img, textview)
})
}
- change_frame_offset_and_cleanup = Proc.new {
+ change_frame_offset_and_cleanup = proc {
if values = ask_new_frame_offset($xmldir.elements["*[@filename='#{filename}']"], '')
change_frame_offset_and_cleanup_real.call(values)
end
}
- change_pano_amount_and_cleanup_real = Proc.new { |values|
- perform_change_pano_amount_and_cleanup = Proc.new { |val|
+ change_pano_amount_and_cleanup_real = proc { |values|
+ perform_change_pano_amount_and_cleanup = proc { |val|
change_pano_amount($xmldir.elements["*[@filename='#{filename}']"], '', val)
}
perform_change_pano_amount_and_cleanup.call(values[:new])
save_undo(_("change panorama amount"),
- Proc.new {
+ proc {
perform_change_pano_amount_and_cleanup.call(values[:old])
textview.grab_focus
autoscroll_if_needed($autotable_sw, img, textview)
$notebook.set_page(1)
- Proc.new {
+ proc {
perform_change_pano_amount_and_cleanup.call(values[:new])
textview.grab_focus
autoscroll_if_needed($autotable_sw, img, textview)
})
}
- change_pano_amount_and_cleanup = Proc.new {
+ change_pano_amount_and_cleanup = proc {
if values = ask_new_pano_amount($xmldir.elements["*[@filename='#{filename}']"], '')
change_pano_amount_and_cleanup_real.call(values)
end
}
- whitebalance_and_cleanup_real = Proc.new { |values|
- perform_change_whitebalance_and_cleanup = Proc.new { |val|
+ whitebalance_and_cleanup_real = proc { |values|
+ perform_change_whitebalance_and_cleanup = proc { |val|
change_whitebalance($xmldir.elements["*[@filename='#{filename}']"], '', val)
recalc_whitebalance(val, fullpath, thumbnail_img, img,
$xmldir.elements["*[@filename='#{filename}']"], '', $default_thumbnails[:x], $default_thumbnails[:y], '')
perform_change_whitebalance_and_cleanup.call(values[:new])
save_undo(_("fix white balance"),
- Proc.new {
+ proc {
perform_change_whitebalance_and_cleanup.call(values[:old])
textview.grab_focus
autoscroll_if_needed($autotable_sw, img, textview)
$notebook.set_page(1)
- Proc.new {
+ proc {
perform_change_whitebalance_and_cleanup.call(values[:new])
textview.grab_focus
autoscroll_if_needed($autotable_sw, img, textview)
})
}
- whitebalance_and_cleanup = Proc.new {
+ whitebalance_and_cleanup = proc {
if values = ask_whitebalance(fullpath, thumbnail_img, img,
$xmldir.elements["*[@filename='#{filename}']"], '', $default_thumbnails[:x], $default_thumbnails[:y], '')
whitebalance_and_cleanup_real.call(values)
end
}
- enhance_and_cleanup = Proc.new {
- perform_enhance_and_cleanup = Proc.new {
+ enhance_and_cleanup = proc {
+ perform_enhance_and_cleanup = proc {
enhance($xmldir.elements["*[@filename='#{filename}']"], '')
my_gen_real_thumbnail.call
}
perform_enhance_and_cleanup.call
save_undo(_("enhance"),
- Proc.new {
+ proc {
perform_enhance_and_cleanup.call
textview.grab_focus
autoscroll_if_needed($autotable_sw, img, textview)
$notebook.set_page(1)
- Proc.new {
+ proc {
perform_enhance_and_cleanup.call
textview.grab_focus
autoscroll_if_needed($autotable_sw, img, textview)
})
}
- delete = Proc.new { |isacut|
+ delete = proc { |isacut|
if autotable.current_order.size > 1 || show_popup($main_window, utf8(_("Do you confirm this subalbum needs to be completely removed? This operation cannot be undone.")), { :okcancel => true })
$modified = true
after = nil
- perform_delete = Proc.new {
+ perform_delete = proc {
after = autotable.get_next_widget(vbox)
if !after
after = autotable.get_previous_widget(vbox)
delete_current_subalbum
else
save_undo(_("delete"),
- Proc.new { |pos|
+ proc { |pos|
autotable.reinsert(pos, vbox, filename)
$notebook.set_page(1)
autotable.queue_draws << proc { textview.grab_focus; autoscroll_if_needed($autotable_sw, img, textview) }
$cuts = []
msg 3, "removing deletion schedule of: #{fullpath}"
$todelete.delete(fullpath) #- unconditional because deleteondisk option could have been modified
- Proc.new {
+ proc {
perform_delete.call
$notebook.set_page(1)
}
end
}
- cut = Proc.new {
+ cut = proc {
delete.call(true)
$cuts << { :vbox => vbox, :filename => filename }
$statusbar.push(0, utf8(_("%s elements in the clipboard.") % $cuts.size ))
}
- paste = Proc.new {
+ paste = proc {
if $cuts.size > 0
$cuts.each { |elem|
autotable.reinsert(autotable.get_current_number(vbox), elem[:vbox], elem[:filename])
autoscroll_if_needed($autotable_sw, $vbox2widgets[last[:vbox]][:image], $vbox2widgets[last[:vbox]][:textview])
}
save_undo(_("paste"),
- Proc.new { |cuts|
+ proc { |cuts|
cuts.each { |elem| autotable.remove(elem[:vbox]) }
$notebook.set_page(1)
- Proc.new {
+ proc {
cuts.each { |elem|
autotable.reinsert(autotable.get_current_number(vbox), elem[:vbox], elem[:filename])
}
if !done
ctxt.targets.each { |target|
if target.name == 'reorder-elements'
- move_dnd = Proc.new { |from,to|
+ move_dnd = proc { |from,to|
if from != to
$modified = true
autotable.move(from, to)
save_undo(_("reorder"),
- Proc.new { |from, to|
+ proc { |from, to|
if to > from
autotable.move(to - 1, from)
else
autotable.move(to, from + 1)
end
$notebook.set_page(1)
- Proc.new {
+ proc {
autotable.move(from, to)
$notebook.set_page(1)
}
#- follows stuff for handling multiple elements selection
press_x = nil; press_y = nil; pos_x = nil; pos_y = nil; $selected_elements = {}
gc = nil
- update_selected = Proc.new {
+ update_selected = proc {
$autotable.current_order.each { |path|
w = $name2widgets[path][:evtbox].window
xm = w.position[0] + w.size[0]/2
gc.function = Gdk::GC::INVERT
#- autoscroll handling for DND and multiple selections
Gtk.timeout_add(100) {
- w, x, y, mask = $autotable.window.pointer
- if mask & Gdk::Window::BUTTON1_MASK != 0
- if y < $autotable_sw.vadjustment.value
- if pos_x
- $autotable.window.draw_lines(gc, [[press_x, press_y], [pos_x, press_y], [pos_x, pos_y], [press_x, pos_y], [press_x, press_y]])
- end
- if $button1_pressed_autotable || press_x
- scroll_upper($autotable_sw, y)
- end
- if not press_x.nil?
- w, pos_x, pos_y = $autotable.window.pointer
- $autotable.window.draw_lines(gc, [[press_x, press_y], [pos_x, press_y], [pos_x, pos_y], [press_x, pos_y], [press_x, press_y]])
- update_selected.call
- end
- end
- if y > $autotable_sw.vadjustment.value + $autotable_sw.vadjustment.page_size
- if pos_x
- $autotable.window.draw_lines(gc, [[press_x, press_y], [pos_x, press_y], [pos_x, pos_y], [press_x, pos_y], [press_x, press_y]])
- end
- if $button1_pressed_autotable || press_x
- scroll_lower($autotable_sw, y)
+ if ! $autotable.window.nil?
+ w, x, y, mask = $autotable.window.pointer
+ if mask & Gdk::Window::BUTTON1_MASK != 0
+ if y < $autotable_sw.vadjustment.value
+ if pos_x
+ $autotable.window.draw_lines(gc, [[press_x, press_y], [pos_x, press_y], [pos_x, pos_y], [press_x, pos_y], [press_x, press_y]])
+ end
+ if $button1_pressed_autotable || press_x
+ scroll_upper($autotable_sw, y)
+ end
+ if not press_x.nil?
+ w, pos_x, pos_y = $autotable.window.pointer
+ $autotable.window.draw_lines(gc, [[press_x, press_y], [pos_x, press_y], [pos_x, pos_y], [press_x, pos_y], [press_x, press_y]])
+ update_selected.call
+ end
end
- if not press_x.nil?
- w, pos_x, pos_y = $autotable.window.pointer
- $autotable.window.draw_lines(gc, [[press_x, press_y], [pos_x, press_y], [pos_x, pos_y], [press_x, pos_y], [press_x, press_y]])
- update_selected.call
+ if y > $autotable_sw.vadjustment.value + $autotable_sw.vadjustment.page_size
+ if pos_x
+ $autotable.window.draw_lines(gc, [[press_x, press_y], [pos_x, press_y], [pos_x, pos_y], [press_x, pos_y], [press_x, press_y]])
+ end
+ if $button1_pressed_autotable || press_x
+ scroll_lower($autotable_sw, y)
+ end
+ if not press_x.nil?
+ w, pos_x, pos_y = $autotable.window.pointer
+ $autotable.window.draw_lines(gc, [[press_x, press_y], [pos_x, press_y], [pos_x, pos_y], [press_x, pos_y], [press_x, press_y]])
+ update_selected.call
+ end
end
end
end
- true
+ ! $autotable.window.nil?
}
}
$xmldir.delete_attribute('already-generated')
- propagate_children = Proc.new { |xmldir|
+ propagate_children = proc { |xmldir|
if xmldir.attributes['subdirs-caption']
xmldir.delete_attribute('already-generated')
end
$name2widgets[File.basename(path)][:textview].buffer.text = ''
}
save_undo(_("remove all captions"),
- Proc.new { |texts|
+ proc { |texts|
texts.each_key { |key|
$name2widgets[key][:textview].buffer.text = texts[key]
}
$notebook.set_page(1)
- Proc.new {
+ proc {
texts.each_key { |key|
$name2widgets[key][:textview].buffer.text = ''
}
subalbums_counter = 0
subalbums_edits_bypos = {}
- add_subalbum = Proc.new { |xmldir, counter|
+ add_subalbum = proc { |xmldir, counter|
$subalbums_edits[xmldir.attributes['path']] = { :position => counter }
subalbums_edits_bypos[counter] = $subalbums_edits[xmldir.attributes['path']]
if xmldir == $xmldir
$subalbums.attach(Gtk::Alignment.new(0, 0.5, 0.5, 0).add(frame),
1, 2, current_y_sub_albums, current_y_sub_albums + 1, Gtk::FILL, Gtk::FILL, 2, 2)
- change_image = Proc.new {
+ change_image = proc {
fc = Gtk::FileChooserDialog.new(utf8(_("Select image for caption")),
nil,
Gtk::FileChooser::ACTION_OPEN,
new_file = fc.filename
msg 3, "new captionfile is: #{fc.filename}"
- perform_changefile = Proc.new {
+ perform_changefile = proc {
$subalbums_edits[xmldir.attributes['path']][:captionfile] = captionfile = new_file
$modified_pixbufs.delete(thumbnail_file)
xmldir.delete_attribute("#{infotype}-rotate")
perform_changefile.call
save_undo(_("change caption file for sub-album"),
- Proc.new {
+ proc {
$subalbums_edits[xmldir.attributes['path']][:captionfile] = captionfile = old_file
xmldir.add_attribute("#{infotype}-rotate", old_rotate)
xmldir.add_attribute("#{infotype}-color-swap", old_color_swap)
xmldir.add_attribute("#{infotype}-frame-offset", old_frame_offset)
my_gen_real_thumbnail.call
$notebook.set_page(0)
- Proc.new {
+ proc {
perform_changefile.call
$notebook.set_page(0)
}
fc.destroy
}
- rotate_and_cleanup = Proc.new { |angle|
+ rotate_and_cleanup = proc { |angle|
rotate(angle, thumbnail_file, img, xmldir, "#{infotype}-", $default_albums_thumbnails[:x], $default_albums_thumbnails[:y])
system("rm -f '#{thumbnail_file}'")
}
- move = Proc.new { |direction|
+ move = proc { |direction|
$modified = true
save_changes('forced')
$albums_tv.selection.select_path(sel[0])
}
- color_swap_and_cleanup = Proc.new {
- perform_color_swap_and_cleanup = Proc.new {
+ color_swap_and_cleanup = proc {
+ perform_color_swap_and_cleanup = proc {
color_swap(xmldir, "#{infotype}-")
my_gen_real_thumbnail.call
}
perform_color_swap_and_cleanup.call
save_undo(_("color swap"),
- Proc.new {
+ proc {
perform_color_swap_and_cleanup.call
$notebook.set_page(0)
- Proc.new {
+ proc {
perform_color_swap_and_cleanup.call
$notebook.set_page(0)
}
})
}
- change_frame_offset_and_cleanup = Proc.new {
+ change_frame_offset_and_cleanup = proc {
if values = ask_new_frame_offset(xmldir, "#{infotype}-")
- perform_change_frame_offset_and_cleanup = Proc.new { |val|
+ perform_change_frame_offset_and_cleanup = proc { |val|
change_frame_offset(xmldir, "#{infotype}-", val)
my_gen_real_thumbnail.call
}
perform_change_frame_offset_and_cleanup.call(values[:new])
save_undo(_("specify frame offset"),
- Proc.new {
+ proc {
perform_change_frame_offset_and_cleanup.call(values[:old])
$notebook.set_page(0)
- Proc.new {
+ proc {
perform_change_frame_offset_and_cleanup.call(values[:new])
$notebook.set_page(0)
}
end
}
- whitebalance_and_cleanup = Proc.new {
+ whitebalance_and_cleanup = proc {
if values = ask_whitebalance(captionfile, thumbnail_file, img, xmldir, "#{infotype}-",
$default_albums_thumbnails[:x], $default_albums_thumbnails[:y], infotype)
- perform_change_whitebalance_and_cleanup = Proc.new { |val|
+ perform_change_whitebalance_and_cleanup = proc { |val|
change_whitebalance(xmldir, "#{infotype}-", val)
recalc_whitebalance(val, captionfile, thumbnail_file, img, xmldir, "#{infotype}-",
$default_albums_thumbnails[:x], $default_albums_thumbnails[:y], infotype)
perform_change_whitebalance_and_cleanup.call(values[:new])
save_undo(_("fix white balance"),
- Proc.new {
+ proc {
perform_change_whitebalance_and_cleanup.call(values[:old])
$notebook.set_page(0)
- Proc.new {
+ proc {
perform_change_whitebalance_and_cleanup.call(values[:new])
$notebook.set_page(0)
}
end
}
- enhance_and_cleanup = Proc.new {
- perform_enhance_and_cleanup = Proc.new {
+ enhance_and_cleanup = proc {
+ perform_enhance_and_cleanup = proc {
enhance(xmldir, "#{infotype}-")
my_gen_real_thumbnail.call
}
perform_enhance_and_cleanup.call
save_undo(_("enhance"),
- Proc.new {
+ proc {
perform_enhance_and_cleanup.call
$notebook.set_page(0)
- Proc.new {
+ proc {
perform_enhance_and_cleanup.call
$notebook.set_page(0)
}
end
def show_password_protections
- examine_dir_elem = Proc.new { |parent_iter, xmldir, already_protected|
+ examine_dir_elem = proc { |parent_iter, xmldir, already_protected|
child_iter = $albums_iters[xmldir.attributes['path']]
if xmldir.attributes['password-protect']
child_iter[2] = pixbuf_or_nil("#{$FPATH}/images/galeon-secure.png")
return
end
- append_dir_elem = Proc.new { |parent_iter, xmldir|
+ append_dir_elem = proc { |parent_iter, xmldir|
child_iter = $albums_ts.append(parent_iter)
child_iter[0] = File.basename(xmldir.attributes['path'])
child_iter[1] = xmldir.attributes['path']
src_nb_calculated_for = ''
src_nb_thread = nil
- process_src_nb = Proc.new {
+ process_src_nb = proc {
if src.text != src_nb_calculated_for
src_nb_calculated_for = src.text
if src_nb_thread
$redo_tb.signal_connect('clicked') { perform_redo }
$redo_mb.signal_connect('activate') { perform_redo }
- one_click_explain_try = Proc.new {
+ one_click_explain_try = proc {
if !$config['one-click-explained']
show_one_click_explanation(_("You have just clicked on a One-Click tool."))
$config['one-click-explained'] = true
$xmldir.add_attribute('password-protect', newval)
end
save_undo(_("set password protection for %s") % File.basename($current_path),
- Proc.new {
+ proc {
if value.nil?
$xmldir.delete_attribute('password-protect')
else
$xmldir.add_attribute('password-protect', value)
end
- Proc.new {
+ proc {
if newval.nil?
$xmldir.delete_attribute('password-protect')
else