one_click_explain_try.call
$r270.active = false
$delete.active = false
+ nothing.sensitive = true
else
if !$r270.active? && !$delete.active?
set_mousecursor_normal($autotable)
set_mousecursor_normal($subalbums)
+ nothing.sensitive = false
+ else
+ nothing.sensitive = true
end
end
}
one_click_explain_try.call
$r90.active = false
$delete.active = false
+ nothing.sensitive = true
else
if !$r90.active? && !$delete.active?
set_mousecursor_normal($autotable)
set_mousecursor_normal($subalbums)
+ nothing.sensitive = false
+ else
+ nothing.sensitive = true
end
end
}
one_click_explain_try.call
$r90.active = false
$r270.active = false
+ nothing.sensitive = true
else
if !$r90.active? && !$r270.active?
set_mousecursor_normal($autotable)
set_mousecursor_normal($subalbums)
+ nothing.sensitive = false
+ else
+ nothing.sensitive = true
end
end
}
warn "Critical: child not found!"
end
}
-
- #- handle reordering with drag and drop
- Gtk::Drag.source_set(widget, Gdk::Window::BUTTON1_MASK, [['reorder-elements', Gtk::Drag::TARGET_SAME_APP, 1]], Gdk::DragContext::ACTION_MOVE)
- Gtk::Drag.dest_set(widget, Gtk::Drag::DEST_DEFAULT_ALL, [['reorder-elements', Gtk::Drag::TARGET_SAME_APP, 1]], Gdk::DragContext::ACTION_MOVE)
- widget.signal_connect('drag-data-get') { |w, ctxt, selection_data, info, time|
- selection_data.set(Gdk::Selection::TYPE_STRING, get_current_number(widget).to_s)
- }
- widget.signal_connect('drag-data-received') { |w, ctxt, x, y, selection_data, info, time|
- ctxt.targets.each { |target|
- if target.name == 'reorder-elements'
- insert(selection_data.data.to_i, get_current_number(widget))
- end
- }
- }
end
#- remove a widget from the list of automatically handled widgets
return false
end
+ #- re-insert a widget at a given pos
+ def reinsert(pos, widget, name)
+ child = { :widget => widget, :name => name }
+ @children[pos, 0] = child
+ redistribute(true)
+ end
+
#- remove all widgets
def clear
@children = []
return -1
end
- #- insert a widget before another by numbers
- def insert(src, dst)
+ #- move widgets by numbers
+ def move(src, dst)
if src != dst
chld = @children.delete_at(src)
@children[dst > src ? dst - 1 : dst, 0] = chld
--- /dev/null
+#!/usr/bin/ruby
+#
+# * BOOH *
+#
+# A.k.a `Best web-album Of the world, Or your money back, Humerus'.
+#
+# The acronyn sucks, however this is a tribute to Dragon Ball by
+# Akira Toriyama, where the last enemy beaten by heroes of Dragon
+# Ball is named "Boo". But there was already a free software project
+# called Boo, so this one will be it "Booh". Or whatever.
+#
+#
+# Copyright (c) 2004 Guillaume Cottenceau <gc3 at bluewin.ch>
+#
+# This software may be freely redistributed under the terms of the GNU
+# public license version 2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+module UndoHandler
+
+ @undo_actions = []
+ @redo_actions = []
+
+ module_function
+
+ def save_undo(closure, params)
+ @undo_actions << { :closure => closure, :params => params }
+ end
+
+ def undo
+ todo = @undo_actions.pop
+ redo_closure = todo[:closure].call(*todo[:params])
+ @redo_actions << { :redo => redo_closure, :undo => todo }
+ return !@undo_actions.empty?
+ end
+
+ def redo
+ redo_item = @redo_actions.pop
+ redo_item[:redo].call
+ @undo_actions << redo_item[:undo]
+ return !@redo_actions.empty?
+ end
+
+ def cleanup
+ @undo_actions.clear
+ @redo_actions.clear
+ end
+
+end