コード例 #1
0
 public UndoCharacterEditorSwapCategories(CharacterEditor Editor, CharsetProject Project, int CategoryIndex1, int CategoryIndex2)
 {
     this.Editor         = Editor;
     this.Project        = Project;
     this.CategoryIndex1 = CategoryIndex1;
     this.CategoryIndex2 = CategoryIndex2;
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        public UndoCharacterEditorValuesChange(CharacterEditor Editor, CharsetProject Project)
        {
            this.Editor  = Editor;
            this.Project = Project;
            Mode         = Project.Mode;

            Colors = new ColorSettings(Project.Colors);
        }
コード例 #4
0
        public UndoCharacterEditorPlaygroundCharChange(CharacterEditor Editor, CharsetProject Project, int X, int Y)
        {
            this.Editor  = Editor;
            this.Project = Project;
            this.X       = X;
            this.Y       = Y;

            Char = Project.PlaygroundChars[X + Y * Project.PlaygroundWidth];
        }
コード例 #5
0
        public UndoCharsetValuesChange(CharsetEditor Editor, CharsetProject Project)
        {
            this.Editor  = Editor;
            this.Project = Project;

            BGColor     = Project.BackgroundColor;
            MultiColor1 = Project.MultiColor1;
            MultiColor2 = Project.MultiColor2;
            BGColor4    = Project.BGColor4;
        }
コード例 #6
0
        public UndoCharsetAddCategory(CharacterEditor Editor, CharsetProject Project, int CategoryIndex)
        {
            this.Editor        = Editor;
            this.Project       = Project;
            this.CategoryIndex = CategoryIndex;

            foreach (var charData in Project.Characters)
            {
                CharCategories.Add(charData.Category);
            }
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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;
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        public UndoCharacterEditorCharChange(CharacterEditor Editor, CharsetProject Project, int CharIndex, int Count)
        {
            this.Editor    = Editor;
            this.Project   = Project;
            this.CharIndex = CharIndex;
            this.CharCount = Count;

            for (int i = 0; i < Count; ++i)
            {
                var charData = new CharData();
                charData.Tile.Data        = new GR.Memory.ByteBuffer(Project.Characters[CharIndex + i].Tile.Data);
                charData.Tile.CustomColor = Project.Characters[CharIndex + i].Tile.CustomColor;
                charData.Category         = Project.Characters[CharIndex + i].Category;
                charData.Index            = CharIndex + i;

                Chars.Add(charData);
            }
        }
コード例 #12
0
ファイル: CharsetEditor.cs プロジェクト: aiSzzPL77/C64Studio
 internal void SetCharsetProject(CharsetProject Charset)
 {
     m_Charset = Charset;
     CharsetWasImported();
 }
コード例 #13
0
        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);
        }
コード例 #14
0
 public virtual bool HandleImport(CharsetProject CharScreen, CharsetEditor Editor)
 {
     return(false);
 }