indexing description: "[ Command for moving objects. ]" date: "$Date$" revision: "$Revision$" class MOVE_OBJECT inherit COMMAND create make feature -- Initialization make is -- creation procedure. do end feature {HISTORY} -- Access execute (args: TUPLE) is -- move multiple image panes -- args.item (1) :: objects: DS_LINKED_LIST [OBJECT] -- args.item (2) :: move_vector: EM_VECTOR_2D local v: EM_VECTOR_2D cursor: DS_LINKED_LIST_CURSOR [OBJECT] p: DS_LINKED_LIST [OBJECT] do execute_successful := False if args.count = 2 then p ?= args.item (1) v ?= args.item (2) -- copy pane references to image_panes create objects.make create cursor.make (p) from cursor.start until cursor.off loop objects.force_last (cursor.item) cursor.forth end if objects /= Void and v /= Void and (v.x /= 0 or v.y /= 0) then dx := v.x dy := v.y create cursor.make (objects) from cursor.start until cursor.off loop cursor.item.set_true_x_y (cursor.item.true_x + dx, cursor.item.true_y + dy) cursor.item.recreate_collidable cursor.forth end execute_successful := True end end end undo (args: TUPLE) is -- Undo command require else objects_not_void: objects /= Void local cursor: DS_LINKED_LIST_CURSOR [OBJECT] do create cursor.make (objects) from cursor.start until cursor.off loop cursor.item.set_true_x_y (cursor.item.true_x - dx, cursor.item.true_y - dy) cursor.item.recreate_collidable cursor.forth end execute_successful := False undo_successful := True redo_successful := False end redo (args: TUPLE) is -- Redo command require else objects_not_void: objects /= Void local cursor: DS_LINKED_LIST_CURSOR [OBJECT] do create cursor.make (objects) from cursor.start until cursor.off loop cursor.item.set_true_x_y (cursor.item.true_x + dx, cursor.item.true_y + dy) cursor.item.recreate_collidable cursor.forth end execute_successful := False undo_successful := False redo_successful := True end name: STRING is "move objects" -- The nama of the current command feature -- Implementation objects: DS_LINKED_LIST [OBJECT] -- backup of the list of image panes dx, dy: DOUBLE -- movement vector end