public override bool HandleImport(CharsetProject CharSet, CharsetEditor Editor) { Parser.ASMFileParser asmParser = new RetroDevStudio.Parser.ASMFileParser(); Parser.CompileConfig config = new Parser.CompileConfig(); config.TargetType = Types.CompileTargetType.PLAIN; config.OutputFile = "temp.bin"; config.Assembler = Types.AssemblerType.C64_STUDIO; string temp = "* = $0801\n" + editInput.Text; if ((asmParser.Parse(temp, null, config, null)) && (asmParser.Assemble(config))) { GR.Memory.ByteBuffer charData = asmParser.AssembledOutput.Assembly; int charsToImport = (int)charData.Length / 8; if (charsToImport > CharSet.TotalNumberOfCharacters) { charsToImport = CharSet.TotalNumberOfCharacters; } for (int i = 0; i < charsToImport; ++i) { charData.CopyTo(CharSet.Characters[i].Tile.Data, i * 8, 8); Editor.CharacterChanged(i); } return(true); } return(false); }
public UndoCharsetPlaygroundCharChange(CharsetEditor Editor, CharsetProject Project, int X, int Y) { this.Editor = Editor; this.Project = Project; this.X = X; this.Y = Y; Char = Project.PlaygroundChars[X + Y * 16]; }
public UndoCharsetValuesChange(CharsetEditor Editor, CharsetProject Project) { this.Editor = Editor; this.Project = Project; BGColor = Project.BackgroundColor; MultiColor1 = Project.MultiColor1; MultiColor2 = Project.MultiColor2; BGColor4 = Project.BGColor4; }
public UndoCharsetAddCategory(CharsetEditor Editor, CharsetProject Project, int CategoryIndex) { this.Editor = Editor; this.Project = Project; this.CategoryIndex = CategoryIndex; foreach (var charData in Project.Characters) { CharCategories.Add(charData.Category); } }
public override bool HandleImport(CharsetProject Charset, CharsetEditor Editor) { switch (comboImportFromDefault.SelectedIndex) { case 0: for (int i = 0; i < 256; ++i) { for (int j = 0; j < 8; ++j) { Charset.Characters[i].Tile.Data.SetU8At(j, ConstantData.UpperCaseCharsetC64.ByteAt(i * 8 + j)); } Charset.Characters[i].Tile.CustomColor = 1; } Editor.characterEditor.CharsetUpdated(Charset); return(true); case 1: for (int i = 0; i < 256; ++i) { for (int j = 0; j < 8; ++j) { Charset.Characters[i].Tile.Data.SetU8At(j, ConstantData.LowerCaseCharsetC64.ByteAt(i * 8 + j)); } Charset.Characters[i].Tile.CustomColor = 1; } Editor.characterEditor.CharsetUpdated(Charset); return(true); case 2: for (int i = 0; i < 256; ++i) { for (int j = 0; j < 8; ++j) { Charset.Characters[i].Tile.Data.SetU8At(j, ConstantData.UpperCaseCharsetViC20.ByteAt(i * 8 + j)); } Charset.Characters[i].Tile.CustomColor = 1; } Editor.characterEditor.CharsetUpdated(Charset); return(true); case 3: for (int i = 0; i < 256; ++i) { for (int j = 0; j < 8; ++j) { Charset.Characters[i].Tile.Data.SetU8At(j, ConstantData.LowerCaseCharsetViC20.ByteAt(i * 8 + j)); } Charset.Characters[i].Tile.CustomColor = 1; } Editor.characterEditor.CharsetUpdated(Charset); return(true); } return(false); }
public UndoCharsetCharChange(CharsetEditor Editor, CharsetProject Project, int CharIndex) { this.Editor = Editor; this.Project = Project; this.CharIndex = CharIndex; Char = new CharData(); Char.Tile.Data = new GR.Memory.ByteBuffer(Project.Characters[CharIndex].Tile.Data); Char.Tile.CustomColor = Project.Characters[CharIndex].Tile.CustomColor; Char.Category = Project.Characters[CharIndex].Category; Char.Index = CharIndex; }
public override bool HandleImport(CharsetProject Charset, CharsetEditor Editor) { string filename; if (!Editor.OpenFile("Import Charset from Image", RetroDevStudio.Types.Constants.FILEFILTER_IMAGE_FILES, out filename)) { return(false); } GR.Image.FastImage imgClip = Core.Imaging.LoadImageFromFile(filename); Editor.characterEditor.PasteImage(filename, imgClip, false); return(true); }
public override bool HandleImport(CharsetProject CharScreen, CharsetEditor Editor) { ByteBuffer data; if (checkHexData.Checked) { data = Util.FromBASICHex(editInput.Text); } else { data = Util.FromBASIC(editInput.Text); } Editor.ImportFromData(data); return(true); }
public override bool HandleExport(ExportCharsetScreenInfo Info, TextBox EditOutput, DocumentInfo DocInfo) { Types.ComboItem comboItem = (Types.ComboItem)comboCharsetFiles.SelectedItem; if (comboItem.Tag == null) { // to new file BaseDocument document = null; if (DocInfo.Project == null) { document = Core.MainForm.CreateNewDocument(ProjectElement.ElementType.CHARACTER_SET, null); } else { document = Core.MainForm.CreateNewElement(ProjectElement.ElementType.CHARACTER_SET, "Character Set", DocInfo.Project).Document; } if (document.DocumentInfo.Element != null) { document.SetDocumentFilename("New Character Set.charsetproject"); document.DocumentInfo.Element.Filename = document.DocumentInfo.DocumentFilename; } ((CharsetEditor)document).OpenProject(Info.CharsetData); document.SetModified(); document.Save(SaveMethod.SAVE); } else { DocumentInfo docInfo = (DocumentInfo)comboItem.Tag; CharsetEditor document = (CharsetEditor)docInfo.BaseDoc; if (document == null) { if (docInfo.Project != null) { docInfo.Project.ShowDocument(docInfo.Element); document = (CharsetEditor)docInfo.BaseDoc; } } if (document != null) { document.OpenProject(Info.CharsetData); document.SetModified(); } } return(true); }
public UndoCharsetExchangeMultiColors(CharsetEditor Editor, ExchangeMode Mode) { this.Editor = Editor; this.Mode = Mode; }
public override bool HandleImport(CharsetProject Charset, CharsetEditor Editor) { string filename; //Clear(); if (Editor.OpenFile("Open charset", RetroDevStudio.Types.Constants.FILEFILTER_CHARSET + RetroDevStudio.Types.Constants.FILEFILTER_CHARSET_CHARPAD + RetroDevStudio.Types.Constants.FILEFILTER_ALL, out filename)) { if (System.IO.Path.GetExtension(filename).ToUpper() == ".CHARSETPROJECT") { // a project GR.Memory.ByteBuffer projectFile = GR.IO.File.ReadAllBytes(filename); RetroDevStudio.Formats.CharsetProject project = new RetroDevStudio.Formats.CharsetProject(); if (!project.ReadFromBuffer(projectFile)) { return(false); } Charset.Colors = new ColorSettings(project.Colors); Charset.ExportNumCharacters = project.ExportNumCharacters; Charset.ShowGrid = project.ShowGrid; for (int i = 0; i < Charset.TotalNumberOfCharacters; ++i) { Charset.Characters[i].Tile.CustomColor = project.Characters[i].Tile.CustomColor; Charset.Characters[i].Tile.Data = new GR.Memory.ByteBuffer(project.Characters[i].Tile.Data); } Editor.CharsetWasImported(); Editor.SetModified(); return(true); } else if (System.IO.Path.GetExtension(filename).ToUpper() == ".CTM") { // a charpad project file GR.Memory.ByteBuffer projectFile = GR.IO.File.ReadAllBytes(filename); Formats.CharpadProject cpProject = new RetroDevStudio.Formats.CharpadProject(); if (!cpProject.LoadFromFile(projectFile)) { return(false); } Charset.Colors.BackgroundColor = cpProject.BackgroundColor; Charset.Colors.MultiColor1 = cpProject.MultiColor1; Charset.Colors.MultiColor2 = cpProject.MultiColor2; Charset.ExportNumCharacters = cpProject.NumChars; if (Charset.ExportNumCharacters > 256) { Charset.ExportNumCharacters = 256; } for (int charIndex = 0; charIndex < Charset.ExportNumCharacters; ++charIndex) { Charset.Characters[charIndex].Tile.Data = cpProject.Characters[charIndex].Data; Charset.Characters[charIndex].Tile.CustomColor = cpProject.Characters[charIndex].Color; } Editor.CharsetWasImported(); Editor.SetModified(); return(true); } // treat as binary .chr file GR.Memory.ByteBuffer charData = GR.IO.File.ReadAllBytes(filename); Editor.ImportFromData(charData); } return(true); }
public virtual bool HandleImport(CharsetProject CharScreen, CharsetEditor Editor) { return(false); }