2009/12/2 Fulvio <[email protected]>
> Pascal Georges wrote:
> >> Many tricks are used in code to try to fix it: temporarily disabling,
> >> erasing the comment window text to avoid duplication, etc...
> >> But in my opinion it's a design error: preMoveCommand and every
> >> reference to it should be deleted.
> >>
> >
> > "preMoveCommand" is indeed difficult to handle, but I think I found
> > the solution. I will test and commit later in CVS.
> >
>
> Let's take for example some lines of code that i write for arrows with
> variations starting with the same move:
>
> if {$move == $main_move} {
> sc_var moveInto $i
> set move [sc_game info nextMoveUCI]
> sc_var exit
> }
>
>
> I didn't take in consideration the preMoveCommand, but how could I?
> I mean, i can look at the preMoveCommand code. And probably if you write
> a comment and leave the comment window open, when moving forward the
> comment will be duplicated in every variation. (preMoveCommand stores
> text, so calling "sc_var exit" stores the text of the comment window in
> every variation).
> Maybe i can write some code trick to temporarily fix it.
> But the point is:
> How can i foresee what the preMoveCommand will do in the future?
> That's why i said that in my opinion it's a design error.
> If preMoveCommand is useful (i don't like that comments are stored
> without user permission) in my opinion it should be explicitly called by
> ::move functions.
>
Finally I think your analysis is perfectly correct. "preMoveCommand" is
evil. I thought I could work with it but there are many use cases where it
will not work. There is one simple solution to work around it : remove the
auto-store of comments when the board changes. The user simply has to click
on the save button which seems logical.
There is no easy way to call explicitely preMoveCommand from ::move
functions as those functions are not the only way to move, and
preMoveCommand is triggered from C++ code, not only from TCL.
So I commited this (disabling auto storage of comments), let me know what
you think about it (for the least I hope there will be no more weird stuff
with comments !).
Pascal
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
Scid-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scid-users