GNOME Bugzilla – Bug 674954
Conditional formatting should use managed dependents
Last modified: 2013-02-06 02:28:03 UTC
Right now we store 0-2 expressions in a GnmStyleCond. We should store them in managed deps so they respect insert/row insert/delete and other similar operations. This should also allow us to trigger recomputation and thus redisplay.
Storage fixed. That leaves recomputation issues.
Created attachment 219078 [details] Sample file This sample file has a conditional format on A3:A4 which sets a bold font if the value is bigger than the value to the right of the cell. We link this dependent incorrectly to B1 (presumably because that is the cell to the right of A1). When B1's cell changes, the "eval" on the managed dependent triggers. (That's currently a no-op.) When B3:B4 changes, nothing happens.
B1 does indeed come from A1 which, in turn, comes from eval_pos_init_dep as called from dependent_link. We have only one copy of the conditional style, so clearly we cannot have two positions. Tricky. I don't know if we should keep this as one condition or split. If we keep it as one, then we need to figure out dependents for each cell the style is being used in. I'm not sure how we would be told when a new cell uses the existing style or when a cell ceases to use the style. If we split -- each cell with a conditional format gets its own copy of the format -- then we can make eval_pos_init_dep know the position somehow. A new dependent type's eval notifier could clear the rendered value. Easy. But this solution also requires us to know when a format is being reused so we can split. "How" is the question. We would use more memory, but since the common case of no-dependencies would not need splitting, that is probably not important. As a third alternative it might also be able to link B3 and B4 as dependencies of A3 and A4. We would get an unnecessary evaluation of A3 and A4. Also, the value-unchanged check in gnm_cell_eval_content would have to be revisited. (Or we would need a new special kind of dependency that was tagged with affects-rendering-only.)
Patch landed over in bug 654495. *** This bug has been marked as a duplicate of bug 654495 ***