Bug 1042319 - [Gallery] Update gallery edit UI r=djf

Consider re-arranging this big block of inserted code so that the most important functions come first and the utilities come later.

I think seeing setEditTool(), cancelEditTool() and applyEditTool() first would make it easier to understand the code. These initial show and hide utilities are pretty boring, but if you haven't read the stuff that follows them they might seem important at first.