Refactor integration logic for annotations
I'm basically writing this here to document it and not forget it later. Right now, the logic to add/remove/change annotations goes as follow:
-
PpsWindow
has an action that can get activated in multiple ways - The action calls a method in
PpsView
-
PpsView
adds/changes/removes the annotation itself, plus some extra work like redrawing, cache, etc - At the end of the method
PpsView
emits a signal to mark that it added/changed/removed the annotation -
PpsWindow
has a callback to that signal, that it uses to notifyPpsSidebarAnnotations
that something changed -
PpsSidebarAnnotations
reloads the annotations
There are slight variations of those, but this is mostly how it looks. Ideally this would change to:
-
PpsDocumentAnnotations
interface has a property that holds aGListModel
with the annotations themselves -
PpsAnnotations
interface has a property to notify when things changed in an individual annotation (exists already) -
PpsWindow
has an action that can get activated in multiple ways - The actions request changes to the annotations list through
PpsDocumentAnnotations
andPpsAnnotations
API - The consumers (
PpsView
andPpsSidebarAnnotations
) listen to changes in those properties, and execute what they need - In consequence, integration happen through the document and its properties, not everything in
PpsWindow
andPpsView
There is, however, additional complications in between, like the different ways to modify annotations (PpsAnnotationWindow
, PpsAnnotationPropertiesDialog
) of the fact that text annotations have a two-step process when added. So a lot of internal cleanups would be needed for this to work.