The description formatter takes a CourseView, and transforms it into a generic description sheet -- an array of DescriptionLine objects.
예제 #1
0
        // Get a description renderer for rendering the description from a course view.
        private DescriptionRenderer GetRenderer(CourseView courseView)
        {
            DescriptionFormatter descFormatter = new DescriptionFormatter(courseView, symbolDB, DescriptionFormatter.Purpose.ForPrinting);
            DescriptionKind      descKind      = GetDescriptionKind(courseView);

            DescriptionLine[]   description = descFormatter.CreateDescription(descKind == DescriptionKind.Symbols);
            DescriptionRenderer renderer    = new DescriptionRenderer(symbolDB);

            renderer.CellSize        = descPrintSettings.BoxSize / 0.254F;
            renderer.Description     = description;
            renderer.DescriptionKind = descKind;
            renderer.Margin          = 0;

            return(renderer);
        }
예제 #2
0
 // Update the active description.
 void UpdateActiveDescription()
 {
     DescriptionFormatter descFormatter = new DescriptionFormatter(activeCourseView, symbolDB);
     activeDescription = descFormatter.CreateDescription(true);
 }
예제 #3
0
 // Update the active description.
 void UpdateActiveDescription()
 {
     DescriptionFormatter descFormatter = new DescriptionFormatter(activeCourseView, symbolDB, DescriptionFormatter.Purpose.ForUI);
     activeDescription = descFormatter.CreateDescription(true);
 }
예제 #4
0
        // Find the longest description we have. If we have no courses, then return None.
        static CourseDesignator FindLongestDescription(EventDB eventDB, SymbolDB symbolDB)
        {
            int longest = 0;
            CourseDesignator longestCourse = CourseDesignator.AllControls;

            foreach (Id<Course> courseId in eventDB.AllCourseIds) {
                int numberOfParts = QueryEvent.CountCourseParts(eventDB, courseId);
                for (int part = 0; part < numberOfParts; ++part) {
                    DescriptionFormatter descFormatter = new DescriptionFormatter(CourseView.CreateViewingCourseView(eventDB, new CourseDesignator(courseId, part)), symbolDB);
                    DescriptionKind descKind = QueryEvent.GetDefaultDescKind(eventDB, courseId);
                    DescriptionLine[] description = descFormatter.CreateDescription(descKind == DescriptionKind.Symbols);
                    if (description.Length > longest) {
                        longest = description.Length;
                        longestCourse = new CourseDesignator(courseId, part);
                    }
                }
            }

            return longestCourse;
        }
예제 #5
0
        // Return the description and description kind for a given CourseView.
        public static DescriptionLine[] GetCourseDescription(EventDB eventDB, SymbolDB symbolDB, CourseDesignator courseDesignator, out DescriptionKind descKind)
        {
            CourseView courseViewDescription;
            DescriptionLine[] description;
            bool noTextOrSymbols = false;

            // Get the course view for the description we're using.
            courseViewDescription = CourseView.CreateViewingCourseView(eventDB, courseDesignator);

            // Create the description. Note the courseId is None only if we're both in all controls, and there are no courses.
            DescriptionFormatter descFormatter = new DescriptionFormatter(courseViewDescription, symbolDB);
            descKind = QueryEvent.GetDefaultDescKind(eventDB, courseDesignator.CourseId);
            description = descFormatter.CreateDescription(descKind == DescriptionKind.Symbols);
            if (noTextOrSymbols)
                DescriptionFormatter.ClearTextAndSymbols(description);

            return description;
        }
예제 #6
0
        // Get a description renderer for rendering the description from a course view.
        private DescriptionRenderer GetRenderer(CourseView courseView)
        {
            DescriptionFormatter descFormatter = new DescriptionFormatter(courseView, symbolDB);
            DescriptionKind descKind = GetDescriptionKind(courseView);
            DescriptionLine[] description = descFormatter.CreateDescription(descKind == DescriptionKind.Symbols);
            DescriptionRenderer renderer = new DescriptionRenderer(symbolDB);
            renderer.CellSize = descPrintSettings.BoxSize / 0.254F;
            renderer.Description = description;
            renderer.DescriptionKind = descKind;
            renderer.Margin = 0;

            return renderer;
        }