trichview.support
potential feature - deleteUnusedStyle with shared rvStyle |
Author |
Message |
David Novo |
Posted: 01/20/2005 20:16:31 Hi Sergey, I use tRichview in an application similar to powerpoint, with the richview acting as a textbox. So, all my richviews share 1 rvStyle. This is working great, however, I would like to be able to deleteUnusedStyles. You have mentioned many times that this is impossible for rv's that share a rvStyle. Since you said you would make the setStyle method of the rv virtual, this leads me to the following possibility. Create a descendant of TRVStyle called TRvSyle2. It will introduce 3 methods procedure TRvStyle2.registerRv(theRV:tRichview) procedure tRVSTyle2.unregisterRv(theRv:tRichview) procedure tRVStyle2.deleteUnusedStyles. in the setStyle method of rv I will do procedure tRichView.setStyle(newStyle:tRvStyle); if self.style is tRvStyle2 then tRVStyle2(self.style).unregister(self); inherited; if newSyle is tRvStyle2 then tRvSTyle2(newStyle).registerRv(self); end; the rv will also unregister itself when appropriate (in the .destroy). Then, in the tRvStyle2.deleteUnusedStyles it will look through each registered RV and see which styles are being used and which are not. I think it seems quite simple and useful for me. In fact, it seems quite generic. If you always call deleteUnusedStyles on the style, instead of on the rv, then you do not care if the style object is shared or not. I have a couple of questions: 1) Do you see any obvious problems with this? 2) Is there a method on the rv similar to isTextStyleUsed(styleNo:integer), isParaStyleUsed(styleNo:integer) so I can have the TRVStyle2 loop through all the rv's and query them? -Dave |
Powered by ABC Amber Outlook Express Converter