lw_common.ui.note_ctrl.update_author_colors C# (CSharp) Method

update_author_colors() private method

private update_author_colors ( ) : void
return void
        private void update_author_colors() {
            // set author name / color first!
            Debug.Assert(author_name_ != "" && author_color_ != util.transparent);

            /*  by default, we prefer the current user's author color
                for the rest of the colors - just use them from the following array

                the reason I'm not using the author's selected color: the problem with that is that someone could select
                some color very close to another existing color, like - something realy close to blue, and the current user's color is blue.

                In this case, we'd end up having two DIFFERENT colors, but visually they would look very the same, thus the user 
                would need to look very careful to distinguish his notes from the other user's.

                In my solution, I just preserve the user's color. The other colors - use them from this list.
            */

            // any color used more than once - we'll have to end up using another color
            author_colors_.Clear();
            // current author - preserves his color
            author_colors_.Add(author_name_, author_color_);
            foreach ( var n in notes_sorted_by_line_index_)
                if (n.the_note != null) {
                    if (author_colors_.ContainsKey(n.the_note.author_name))
                        // we already know the color for this author
                        continue;

                    // it's a new author
                    add_color_for_author(n.the_note.author_name, n.the_note.author_color);
                }
        }