Exemplo n.º 1
0
        public override GR.Memory.ByteBuffer DisplayDetails()
        {
            GR.Memory.ByteBuffer displayData = new GR.Memory.ByteBuffer();

            displayData.AppendI32(editSource.Caret.LineNumber);
            displayData.AppendI32(editSource.Caret.Position);

            return(displayData);
        }
Exemplo n.º 2
0
        public override GR.Memory.ByteBuffer DisplayDetails()
        {
            GR.Memory.ByteBuffer bufferData = new GR.Memory.ByteBuffer();

            bufferData.AppendI32(listResults.Columns.Count);
            for (int i = 0; i < listResults.Columns.Count; ++i)
            {
                bufferData.AppendI32(listResults.Columns[i].Width);
            }

            bufferData.AppendI32(listResultsSortColumn);
            bufferData.AppendI32((int)listResults.Sorting);
            return(bufferData);
        }
Exemplo n.º 3
0
        public GR.Memory.ByteBuffer ToBuffer()
        {
            GR.Memory.ByteBuffer result = new GR.Memory.ByteBuffer();

            result.AppendI32(Width);
            result.AppendI32(Height);
            result.AppendU32((uint)PixelFormat);

            result.AppendI32(PaletteEntryCount);
            for (int i = 0; i < PaletteEntryCount; ++i)
            {
                result.AppendU8(PaletteRed(i));
                result.AppendU8(PaletteGreen(i));
                result.AppendU8(PaletteBlue(i));
            }
            result.Append(m_ImageData);
            return(result);
        }
Exemplo n.º 4
0
    public override GR.Memory.ByteBuffer DisplayDetails()
    {
      GR.Memory.ByteBuffer      displayData = new GR.Memory.ByteBuffer();

      foreach ( ColumnHeader column in listWatch.Columns )
      {
        displayData.AppendI32( column.Width );
      }
      return displayData;
    }
Exemplo n.º 5
0
        public GR.Memory.ByteBuffer SaveToBuffer()
        {
            GR.Memory.ByteBuffer projectFile = new GR.Memory.ByteBuffer();

            // version
            projectFile.AppendU32(1);
            // Name
            projectFile.AppendString(Name);
            // Value table
            // number of entries
            projectFile.AppendI32(ValueTable.Values.Count);
            foreach (var entry in ValueTable.Values)
            {
                projectFile.AppendString(entry);
            }
            projectFile.AppendString(ValueTable.Formula);
            projectFile.AppendString(ValueTable.StartValue);
            projectFile.AppendString(ValueTable.EndValue);
            projectFile.AppendString(ValueTable.StepValue);

            return(projectFile);
        }
        public GR.Memory.ByteBuffer SaveToBuffer()
        {
            GR.Memory.ByteBuffer projectFile = new GR.Memory.ByteBuffer();

            // version
            projectFile.AppendU32(1);
            // Name
            projectFile.AppendString(System.IO.Path.GetFileNameWithoutExtension(Name));
            // charset Filename
            projectFile.AppendString(System.IO.Path.GetFileNameWithoutExtension(Name));

            for (int i = 0; i < 256; ++i)
            {
                projectFile.AppendI32(Characters[i].Color);
            }
            for (int i = 0; i < 256; ++i)
            {
                projectFile.AppendU8(Characters[i].Multicolor ? (byte)1 : (byte)0);
            }
            projectFile.AppendI32(BackgroundColor);
            projectFile.AppendI32(MultiColor1);
            projectFile.AppendI32(MultiColor2);

            for (int i = 0; i < 256; ++i)
            {
                // Tile colors
                projectFile.AppendI32(0);
                projectFile.AppendI32(0);
                projectFile.AppendI32(0);
                projectFile.AppendI32(0);
                // Tile chars
                projectFile.AppendI32(0);
                projectFile.AppendI32(0);
                projectFile.AppendI32(0);
                projectFile.AppendI32(0);
            }

            // generic multi color
            projectFile.AppendI32(0);

            // test bed
            projectFile.Append(new GR.Memory.ByteBuffer(64));

            // charset data
            for (int i = 0; i < 256; ++i)
            {
                projectFile.Append(Characters[i].Data);
            }

            // used tiles
            projectFile.AppendU32(UsedTiles);

            // export name
            projectFile.AppendString(ExportFilename);
            // export path block table
            projectFile.AppendString("");
            // export path charset
            projectFile.AppendString("");
            // export path editor tiles
            projectFile.AppendString("");
            // categories
            projectFile.AppendI32(Categories.Count);
            foreach (System.Collections.Generic.KeyValuePair <int, string> category in Categories)
            {
                projectFile.AppendI32(category.Key);
                projectFile.AppendString(category.Value);
            }
            for (int i = 0; i < 256; ++i)
            {
                projectFile.AppendI32(Characters[i].Category);
            }
            return(projectFile);
        }
Exemplo n.º 7
0
        public GR.Memory.ByteBuffer SaveToBuffer()
        {
            GR.Memory.ByteBuffer projectFile = new GR.Memory.ByteBuffer();

            // version
            projectFile.AppendU32(1);
            projectFile.AppendI32(Sprites.Count);
            // Name
            projectFile.AppendString(Name);
            for (int i = 0; i < Sprites.Count; ++i)
            {
                projectFile.AppendI32(Sprites[i].Color);
            }
            for (int i = 0; i < Sprites.Count; ++i)
            {
                projectFile.AppendU8(Sprites[i].Multicolor ? (byte)1 : (byte)0);
            }
            projectFile.AppendI32(BackgroundColor);
            projectFile.AppendI32(MultiColor1);
            projectFile.AppendI32(MultiColor2);
            // generic MC
            projectFile.AppendU32(0);
            for (int i = 0; i < Sprites.Count; ++i)
            {
                projectFile.Append(Sprites[i].Data);
                projectFile.AppendU8((byte)Sprites[i].Color);
            }
            projectFile.AppendU32(UsedSprites);

            // export name
            projectFile.AppendString(ExportFilename);

            // exportpath
            projectFile.AppendString("");

            // desc
            for (int i = 0; i < Sprites.Count; ++i)
            {
                projectFile.AppendString("");
            }

            // testbed (not used anymore, write 0 as number of sprites)
            projectFile.AppendI32(0);


            foreach (var layer in SpriteLayers)
            {
                GR.IO.FileChunk chunkLayer = new GR.IO.FileChunk(Types.FileChunk.SPRITESET_LAYER);

                GR.IO.FileChunk chunkLayerInfo = new GR.IO.FileChunk(Types.FileChunk.SPRITESET_LAYER_INFO);
                chunkLayerInfo.AppendString(layer.Name);
                chunkLayerInfo.AppendU8((byte)layer.BackgroundColor);
                chunkLayer.Append(chunkLayerInfo.ToBuffer());

                foreach (var sprite in layer.Sprites)
                {
                    GR.IO.FileChunk chunkLayerSprite = new GR.IO.FileChunk(Types.FileChunk.SPRITESET_LAYER_ENTRY);
                    chunkLayerSprite.AppendI32(sprite.Index);
                    chunkLayerSprite.AppendU8((byte)sprite.Color);
                    chunkLayerSprite.AppendI32(sprite.X);
                    chunkLayerSprite.AppendI32(sprite.Y);
                    chunkLayerSprite.AppendU8((byte)(sprite.ExpandX ? 1 : 0));
                    chunkLayerSprite.AppendU8((byte)(sprite.ExpandY ? 1 : 0));

                    chunkLayer.Append(chunkLayerSprite.ToBuffer());
                }
                projectFile.Append(chunkLayer.ToBuffer());
            }

            /*
             * int spriteTestCount = memIn.ReadInt32();
             * for ( int i = 0; i < spriteTestCount; ++i )
             * {
             * int spriteIndex = memIn.ReadInt32();
             * byte spriteColor = memIn.ReadUInt8();
             * bool spriteMultiColor = ( memIn.ReadUInt8() != 0 );
             * int spriteX = memIn.ReadInt32();
             * int spriteY = memIn.ReadInt32();
             * }*/
            return(projectFile);
        }
Exemplo n.º 8
0
        public GR.Memory.ByteBuffer SaveToBuffer()
        {
            GR.Memory.ByteBuffer projectFile = new GR.Memory.ByteBuffer();

            // version
            projectFile.AppendU32(1);
            // Name
            projectFile.AppendString(System.IO.Path.GetFileNameWithoutExtension(Name));
            // charset Filename
            projectFile.AppendString(System.IO.Path.GetFileNameWithoutExtension(Name));

            for (int i = 0; i < 256; ++i)
            {
                projectFile.AppendI32(Characters[i].Color);
            }
            for (int i = 0; i < 256; ++i)
            {
                projectFile.AppendU8((byte)Characters[i].Mode);
            }
            projectFile.AppendI32(BackgroundColor);
            projectFile.AppendI32(MultiColor1);
            projectFile.AppendI32(MultiColor2);

            for (int i = 0; i < 256; ++i)
            {
                // Tile colors
                projectFile.AppendI32(0);
                projectFile.AppendI32(0);
                projectFile.AppendI32(0);
                projectFile.AppendI32(0);
                // Tile chars
                projectFile.AppendI32(0);
                projectFile.AppendI32(0);
                projectFile.AppendI32(0);
                projectFile.AppendI32(0);
            }

            // generic multi color
            projectFile.AppendI32(0);

            // test bed
            projectFile.Append(new GR.Memory.ByteBuffer(64));

            // charset data
            for (int i = 0; i < 256; ++i)
            {
                projectFile.Append(Characters[i].Data);
            }

            // used tiles
            projectFile.AppendU32(UsedTiles);

            // export name
            projectFile.AppendString(ExportFilename);
            // export path block table
            projectFile.AppendString("");
            // export path charset
            projectFile.AppendString("");
            // export path editor tiles
            projectFile.AppendString("");
            // categories
            projectFile.AppendI32(Categories.Count);
            for (int i = 0; i < Categories.Count; ++i)
            {
                projectFile.AppendI32(i);
                projectFile.AppendString(Categories[i]);
            }
            for (int i = 0; i < 256; ++i)
            {
                projectFile.AppendI32(Characters[i].Category);
            }
            projectFile.AppendI32(NumCharacters);
            projectFile.AppendI32(ShowGrid ? 1 : 0);
            projectFile.AppendI32(StartCharacter);
            projectFile.AppendI32(BGColor4);

            // playground
            projectFile.AppendI32(16); // w
            projectFile.AppendI32(16); // h

            for (int i = 0; i < PlaygroundChars.Count; ++i)
            {
                projectFile.AppendU16(PlaygroundChars[i]);
            }
            return(projectFile);
        }
Exemplo n.º 9
0
        public bool CopyToClipboard()
        {
            if (Entries.Count == 0)
            {
                return(false);
            }

            GR.Memory.ByteBuffer dataSelection = new GR.Memory.ByteBuffer();

            dataSelection.AppendI32(Entries.Count);
            dataSelection.AppendI32(ColumnBased ? 1 : 0);

            dataSelection.AppendI32(Colors.BackgroundColor);
            dataSelection.AppendI32(Colors.MultiColor1);
            dataSelection.AppendI32(Colors.MultiColor2);
            dataSelection.AppendI32(Colors.BGColor4);

            dataSelection.AppendI32(Colors.Palettes.Count);
            for (int j = 0; j < Colors.Palettes.Count; ++j)
            {
                var pal = Colors.Palettes[j];
                dataSelection.AppendI32(pal.NumColors);
                for (int i = 0; i < pal.NumColors; ++i)
                {
                    dataSelection.AppendU32(pal.ColorValues[i]);
                }
            }

            int prevIndex = Entries[0].Index;

            foreach (var entry in Entries)
            {
                // delta in indices
                dataSelection.AppendI32(entry.Index - prevIndex);
                prevIndex = entry.Index;

                dataSelection.AppendI32((int)entry.Tile.Mode);
                dataSelection.AppendI32(entry.Tile.CustomColor);
                dataSelection.AppendI32(entry.Tile.Colors.ActivePalette);
                dataSelection.AppendI32(entry.Tile.Width);
                dataSelection.AppendI32(entry.Tile.Height);
                dataSelection.AppendU32(entry.Tile.Data.Length);
                dataSelection.Append(entry.Tile.Data);
                dataSelection.AppendI32(entry.Index);
            }

            DataObject dataObj = new DataObject();

            dataObj.SetData("C64Studio.ImageList", false, dataSelection.MemoryStream());


            // add as one image
            var fullImage = new GR.Image.MemoryImage(Entries.Count * Entries[0].Tile.Width, Entries[0].Tile.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
            int curX      = 0;

            foreach (var entry in Entries)
            {
                entry.Tile.Image.DrawTo(fullImage, curX, 0);
                curX += entry.Tile.Width;
            }

            GR.Memory.ByteBuffer dibData2 = fullImage.CreateHDIBAsBuffer();

            System.IO.MemoryStream ms2 = dibData2.MemoryStream();
            dataObj.SetData("DeviceIndependentBitmap", ms2);

            Clipboard.SetDataObject(dataObj, true);
            return(true);
        }