On Thu, Apr 28, 2011 at 09:30, Oto BREZINA <otik_at_printflow.eu> wrote:
> On 2011-04-28 08:53, Stefan Küng wrote:
>> On Wed, Apr 27, 2011 at 23:22, Oto BREZINA<otik_at_printflow.eu> wrote:
>>> On 2011-04-27 22:22, Oto BREZINA wrote:
>>>> second try
>>>>
>>>> It saves about 6 BuildAllScreen2ViewVector executions on start and
>>>> about 5 calls per reload.
>>>>
>>>> This is first approach for review (you may suggest better names) to
>>>> don't spend too much time with something wrong from base.
>>> Same with:
>>> Using array+enum instead of set of variables
>>> Better handling of update of locator
>> Haven't checked your patch yet (still in the office).
>> But I had an idea on how to deal with this without using
>> locks/counters/whatever:
>>
>> How about using a separate class for the screen/view vector. Access to
>> the vector is controlled by the class methods. That way, you can just
>> set a flag "rebuild necessary", and the vector is then rebuilt on the
>> first read access.
>> With such an implementation, the vector really is only rebuilt when necessary.
>>
>> Thoughts?
> Sounds good to me, I did not want to make that big change just improve
> actual code. Of course real solutions are better then hacks.
> In fact "all" static attributes may be refactored out.
> However this vector is needed for updating scrolls and other stuffs, so
> not sure how it can be implemented properly ...
class Screen2View
{
public:
int GetViewLine(int screenline);
private:
void RebuildVector();
vector<> m_screen2view;
};
int GetViewLine(int screenline)
{
if (needsrebuild)
{
RebuildVector();
needrebuild = false;
}
return m_screen2View[screenline];
}
basically, you hide the vector completely from the outside. Not sure
why you think that updating scrollbars is somehow related to this?
Stefan
--
___
oo // \\ "De Chelonian Mobile"
(_,\/ \_/ \ TortoiseSVN
\ \_/_\_/> The coolest Interface to (Sub)Version Control
/_/ \_\ http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=2725436
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2011-04-28 12:24:06 CEST