public OcadCreation(SymbolDB symbolDB, EventDB eventDB, Controller controller, CourseAppearance courseAppearance, OcadCreationSettings creationSettings) { this.symbolDB = symbolDB; this.eventDB = eventDB; this.controller = controller; this.courseAppearance = courseAppearance; this.creationSettings = creationSettings; }
public OcadCreation(SymbolDB symbolDB, EventDB eventDB, Controller controller, CourseAppearance courseAppearance, OcadCreationSettings creationSettings) { this.symbolDB = symbolDB; this.eventDB = eventDB; this.controller = controller; this.courseAppearance = courseAppearance; this.creationSettings = creationSettings; }
// Update the map file on display. void UpdateMapFile() { if (mapDisplay != controller.MapDisplay) { // The mapDisplay object is new. This currently only happens on startup. mapDisplay = controller.MapDisplay; mapDisplay.MapIntensity = Settings.Default.MapIntensity; mapDisplay.AntiAlias = Settings.Default.MapHighQuality; controller.ShowAllControls = Settings.Default.ViewAllControls; mapViewer.SetMap(mapDisplay); ShowRectangle(mapDisplay.MapBounds); } if (mapDisplay.MapType != controller.MapType || mapDisplay.FileName != controller.MapFileName || (controller.MapType == MapType.Bitmap && mapDisplay.Dpi != controller.MapDpi)) { // A new map file has been loaded, or the DPI has changed. mapViewer.ZoomFactor = 1.0F; // used if the map bounds are empty, then this zoom factor is preserved. ShowRectangle(mapDisplay.MapBounds); // Reset the OCAD file creating settings dialog to default settings. ocadCreationSettingsPrevious = null; } if (mapDisplay.OcadOverprintEffect != controller.OcadOverprintEffect) { mapDisplay.OcadOverprintEffect = controller.OcadOverprintEffect; } }
private void createOcadFilesMenu_Click(object sender, EventArgs e) { MapFileFormatKind restrictToKind; // restrict to outputting this kind of map. if (mapDisplay.MapType == MapType.OCAD) { restrictToKind = mapDisplay.MapVersion.kind; } else { restrictToKind = MapFileFormatKind.None; } // Get the settings for the dialog. If we've previously show the dialog, then // use the previous settings. Note that the previous settings are wiped out when a new map file // is loaded. OcadCreationSettings settings; if (ocadCreationSettingsPrevious != null) { settings = ocadCreationSettingsPrevious.Clone(); if (restrictToKind != MapFileFormatKind.None & restrictToKind != ocadCreationSettingsPrevious.fileFormat.kind) { settings.fileFormat = mapDisplay.MapVersion; } } else { // Default settings: creating in file directory, use format of the current map file. settings = new OcadCreationSettings(); settings.fileDirectory = true; settings.mapDirectory = false; settings.outputDirectory = Path.GetDirectoryName(controller.FileName); if (mapDisplay.MapType == MapType.OCAD) { settings.fileFormat = mapDisplay.MapVersion; } else { settings.fileFormat = new MapFileFormat(MapFileFormatKind.OCAD, 8); // TODO: Maybe change the default to OpenMapper? } } // Get the correct purple color to use. FindPurple.GetPurpleColor(mapDisplay, controller.GetCourseAppearance(), out settings.colorOcadId, out settings.cyan, out settings.magenta, out settings.yellow, out settings.black, out settings.purpleOverprint); // Initialize the dialog. // CONSIDER: shouldn't have GetEventDB here! Do something different. CreateOcadFiles createOcadFilesDialog = new CreateOcadFiles(controller.GetEventDB(), restrictToKind, controller.CreateOcadFilesText(false)); createOcadFilesDialog.OcadCreationSettings = settings; // show the dialog; on success, create the files. while (createOcadFilesDialog.ShowDialog(this) == DialogResult.OK) { List<string> overwritingFiles = controller.OverwritingOcadFiles(createOcadFilesDialog.OcadCreationSettings); if (overwritingFiles.Count > 0) { OverwritingOcadFilesDialog overwriteDialog = new OverwritingOcadFilesDialog(); overwriteDialog.Filenames = overwritingFiles; if (overwriteDialog.ShowDialog(this) == DialogResult.Cancel) continue; } // Save settings persisted between invocations of this dialog. ocadCreationSettingsPrevious = createOcadFilesDialog.OcadCreationSettings; controller.CreateOcadFiles(createOcadFilesDialog.OcadCreationSettings); // PP keeps bitmaps in memory and locks them. Tell the user to close PP. if (mapDisplay.MapType == MapType.Bitmap) InfoMessage(MiscText.ClosePPBeforeLoadingOCAD); break; } // And the dialog is done. createOcadFilesDialog.Dispose(); }