Beispiel #1
0
        public void ParseStars(LayoutDescriptionEx ld)
        {
            int totalStars = 0;

            totalStars += UpdateLineDescriptionsWithStars(2 << 6, ld.courseDescription, ld.starsShown);
            totalStars += UpdateLineDescriptionsWithStars(0, ld.secretDescription, ld.starsShown);
            ld.RecountStars();
        }
        private void EditDisplay()
        {
            int  X = picX; int Y = picY;
            int  line     = (int)Math.Floor(Y / gm.SHeight);
            bool isSecret = ((int)Math.Floor(X / (gm.Width / 2))) == 1;
            int  star     = (int)Math.Floor((X - (isSecret ? (gm.Width / 2) : 0)) / gm.SWidth);

            if (star > ld.starsShown)
            {
                return;
            }

            try
            {
                LineDescriptionEx curld;
                if (isSecret)
                {
                    curld = ld.secretDescription[line];
                    if (curld == null)
                    {
                        ld.secretDescription[line] = new TextOnlyLineDescription("");
                        curld = ld.secretDescription[line];
                    }
                }
                else
                {
                    curld = ld.courseDescription[line];
                    if (curld == null)
                    {
                        ld.courseDescription[line] = new TextOnlyLineDescription("");
                        curld = ld.courseDescription[line];
                    }
                }

                if (star == 0 || curld is TextOnlyLineDescription)
                {
                    Settings settings = new Settings(curld, ld.starsShown);
                    settings.ShowDialog();
                    ld.starsShown = settings.starsShown;
                    if (isSecret)
                    {
                        ld.secretDescription[line] = settings.lind;
                    }
                    else
                    {
                        ld.courseDescription[line] = settings.lind;
                    }

                    ld.PrepareForEdit();
                    gm.TestFont();
                }
                if (star > 0 && curld is StarsLineDescription sld)
                {
                    sld.starMask = (byte)(sld.starMask ^ (1 << (star - 1)));
                }

                ld.RecountStars();
                InvalidateCache();
                return;
            }
            catch (Exception) { }
        }