On Fri, Dec 12, 2003 at 11:12:34AM +0000, Angus Leeming spake thusly:

> Martin,
> 
> I note that the branches dialog isn't very useful at the moment and 
> suspect that this is my doing. The choice of available branches is 
> empty. I'll sort it out but have a few questions of my own:
> 
> 1 Looking at the code in FormBranch.C, QBranch.C:
> why do you bother filling the choice in 'build'? It is subsequently 
> overwritten in 'update', so this is just a waste of cycles.

Is it? I.e. does build do an implicit update? If so, it is
unnecessary. I do vaguely remember that it was necessary, but see if
you can get rid of it.
 
> 2 Why do you store a copy of the list of available branches in the 
> inset? Why not provide an accessor from the controller. Eg
> 
> std::vector<std::string> const
> ControlBranches::all_branches() const
> {
>         BranchList const & branchlist =
>                 kernel().buffer().params().branchlist();
> 
>         ...
> }

Sure. But remember you have to store the branchlist in the .lyx file.
If you can make it work, fine... I was already very happy getting this
to work at all.
 
> 3. Why do you store the list of all branch names in BranchList as a 
> '|'-separated string. Why not use a vector?

Seemed the easiest, as this is immediately used in filling in the
choice box in the xforms frontend (yes, this an xforms-ism. Not
nice).  Also I chose this as the storage format in the .lyx file, as
it is nice and compact. A vector would require extra logic -- and/or
change the file format again.

Might be a little cleaner though.

> If you're worried about filling the choice in the xforms frontend, 
> then don't be:
>         string const all_branches =
>                 ' ' +
>                 getStringFromVector(controller().all_branches(), " | ") +
>                 ' ';
>         fl_clear_choice(dialog_->choice_branch);
>         fl_addto_choice(dialog_->choice_branch, all_branches.c_str());

Sure... I've seen that in other places. So using '|' wasn't even my
invention ;-)
 
> 4. I notice a bug in the display of new branches. For example:
> * I created a branch 'Purple' and a branch 'Green' in that order and 
> set the colours of both appropriately.
> * I created a 'Purple' branch inset and discovered it was displayed 
> with a green background. I subsequently created a 'Green' inset. It 
> also had a green background.
> * Close the file and re-open and all is Ok. (Maybe I restarted LyX.)

Ah... this *did* work OK earlier. Could it have to do with the change
in the ColorHandler logic -- a lack of refresh of the colour lookup
table?
 
> I propose to address questions 1-3 myself and to fix the currently 
> useless Branch dialog. Ok?

OK. 1 is just verifying if you can remove it, 2 is tricky but should
be possible (thorough testing!) 3: go right ahead if you think it is
The Right Thing. 4. ... testing needed. I suspect colour lookup table
refresh/caching (is there still such a thing?)
 
> -- 
> Angus

- Martin 

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to