node/lib/metasm/metasm/gui/dasm_graph.rb
# place boxes in a good-looking layout
# create artificial 'group' container for boxes, that will later be merged in geometrical patterns
place boxes in a good-looking layout
create artificial 'group' container for boxes, that will later be merged in geometrical patterns
place boxes in a good - looking layout create artificial ' group ' container for boxes that will later be merged in geometrical patterns
def auto_arrange_init
		h = {}	
		@groups = @box.map { |b|
			b.x = -b.w/2
			b.y = -b.h/2
			g = Box.new(nil, [b])
			g.x = b.x - 8
			g.y = b.y - 9
			g.w = b.w + 16
			g.h = b.h + 18
			h[b] = g
			g
		}
		@groups.each { |g|
			g.to   = g.content.first.to.map   { |t| h[t] if t != g }.compact
			g.from = g.content.first.from.map { |f| h[f] if f != g }.compact
		}
		order = order_graph(@groups)
		make_tree(@groups, order)
	end
def auto_arrange_init h = { } @groups = @box . map { | b | b . x = - b . w / 2 b . y = - b . h / 2 g = Box . new ( nil , [ b ] ) g . x = b . x - 8 g . y = b . y - 9 g . w = b . w + 16 g . h = b . h + 18 h [ b ] = g g } @groups . each { | g | g . to = g . content . first . to . map { | t | h [ t ] if t != g } . compact g . from = g . content . first . from . map { | f | h [ f ] if f != g } . compact } order = order_graph ( @groups ) make_tree ( @groups , order ) end
place boxes in a good-looking layout
create artificial 'group' container for boxes, that will later be merged in geometrical patterns
place boxes in a good - looking layout create artificial ' group ' container for boxes that will later be merged in geometrical patterns
# 'group' is an array of boxes # all groups are centered on the origin # { box => group } # init group.to/from # must always point to something that is in the 'groups' array # no self references # a box is in one and only one group in 'groups' # order boxes # remove cycles from the graph