Location pane is a separate view attached to file compare view. It's task is to show overall picture of the files compared, and differences in them. It also shows currently selected difference, and visible area in files.
Location pane's main view is
CLocationView which is a view derived from a
CLocationView gets an instance of
CLocationBar as a parent view.
CChildFrame is the frame that owns and constructs both
CMergeEditView (file compare view) and
CLocationView. Both views get pointers to each other for switching data and accessing public methods. This "both calling both" is a bit messy and could be cleaned up.
Current (as of 2.8.0) implementation is dummy, it repaints itself (calculates differences) every time something in bars change (e.g. difference gets merged). This needs to be improved!
- cache diff lists in view's doc class, update list only when (diff) list in file compare changes
- (kimmov) Well, after more thinking I'm not sure anymore caching is a good idea. It is hard to keep lists in synch efficiently. So it is better to just offer a read-only acces to difflist for location pane
- repaint only changed diff
(how to synch lists?)
adding difference adds new diff to both lists, and in the location view
merging difference removes difference from both lists and the location view
- altering difference may change line numbers of difference, or relative size of the difference in the location view
We'll need two-way messaging as:
- changes in file compare needs to be updated to location pane
- location pane scrolling or diff selection etc needs to be forwarded to file compare
- could use windows messages in other direction, to prevent both having pointer to each other?
- do we need direct messaging or could we use
CChildFrameas a mediator, as it owns both?
- from mergedoc/view to location pane:
- add/alter/remove diff
- alter layout of files (add/remove lines between diffs)
- change selected diff
- change visible area (scroll)
- from location pane to mergedoc/view:
- selected diff (?)
- if the location pane gets only read-only access to mergedoc's diff list, then we don't need to synchronize diff list access
- location pane cannot alter diffs, only select the diff and scroll the views (+ goto)
When we have diffs which tell different lines, we'll need to calculate which pixels in the location view match the line. First we calculate the ratio of lines per line of pixels. Using that ratio we then map line numbers in diffs to pixel lines in the pane.
We need to cache the mapping of diffs and pixel lines, for faster re-draw of the view. Usually we can re-draw view numerous times with that same info. E.g. when scrolling views, only visible area changes. we need to empty the cache and re-calculate when:
- size of location pane changes (more than few pixels?)
- line count / layout of files changes (more than few lines?)