Re: [Scidvspc-users] [Feature Request] Add more space in Tree Mask to see long comments
Chess Database and Toolkit program
Brought to you by:
stevenaaus
From: Richard F. A. I. <ras...@gm...> - 2015-11-29 20:26:40
|
Ok as a learning exercise I wanted to see what it would take to modify what Yuval is looking for here in terms of displaying the comment. My first assumption was that the comment they are talking about is the position comment, since it is the one that displays as a single line at the top of the tree mask view. To facilitate a multi line display here I needed a word wrap function for the comment, I created one in tcl/utils/strings.tcl library. proc ::utils::string::wrapParagraph {n text} { regsub -all {\s+} [string trim $text] " " text set RE "^(.{1,$n})(?:\\s+(.*))?$" for {set result ""} {[regexp $RE $text -> line text]} {} { append result $line "\n" } return [string trimright $result "\n"] } Then In the tcl/windows/tree.tcl I added a line to wordwrap the comment text to 75 which is the width of the tree view table + the extra column for the mask images Inside proc ::tree:displayLines in the section #Mask position comment at top of move list set wrapPosComment [ ::utils::string::wrapParagraph 75 $posComment] Then I modified this line to display the wrapped text rather than the first line changing this: # $w.f.tl insert end "$firstLine\n" [ list bluefg tagtooltip_poscomment ] to this: $w.f.tl insert end "$wrapPosComment\n" [ list bluefg tagtooltip_poscomment ] At the very least this met the request as far as I can tell in a usable way. *Potential Improvements * After testing the experience with some larger comments, I am thinking the comment might better be displayed with at the very least a horizontal rule line separating it from the table , but my TCL is so new, haven't figured that out yet. It might also be some sort of option for people that don't want the table to jump around for really large comments, to instead move it to the bottom after the table. (this would be pretty easy) This canvas is pretty well done overall, my other job programming experience makes me think that the fixed width of the tree view table might enjoy a responsive width treatment, where in shorter width breakpoints each line of the table could become multi line folding down or hiding entirely some columns like the AvElo, Perf, AvYear, Draw, ECO codes. And then only going single line or unhiding those columns as the display width of the canvas increases. Ditto with the wrapping of the pos comment, as the generic wrapping I added could actually update the wrap point as well. Regards, Richard On 11/28/2015 10:01 PM, Yuval Marcus wrote: > I just got around to using tree masks as a way to create my opening > repertoire, and so far it's been great! > > However, one problem I have is the lack of space to view comments. I > like to put large amount of analysis in my moves and right now the > current solution is that I need to hover over the move and view the > pop-up tooltip to read the entire comment. Is there a way I can view > the comment all in one window, perhaps by wrapping the comment down > (like a paragraph) in the tree window? > > Thanks. > > > ------------------------------------------------------------------------------ > > > _______________________________________________ > Scidvspc-users mailing list > Sci...@li... > https://lists.sourceforge.net/lists/listinfo/scidvspc-users |