12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- /* GCSx
- ** CLIPBOARD.H
- **
- ** Our internal clipboard, with cross-platform clipboard reading/writing
- ** added transparently as code becomes available
- */
- /*****************************************************************************
- ** Copyright (C) 2003-2006 Janson
- **
- ** This program is free software; you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation; either version 2 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program; if not, write to the Free Software
- ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
- #ifndef __GCSx_CLIPBOARD_H_
- #define __GCSx_CLIPBOARD_H_
- // Types of data we care about that can be in the clipboard
- enum ClipboardType {
- CLIPBOARD_NONE = 0, // Or nothing recognizable
- CLIPBOARD_TEXT_LINE, // One line of text (no end-of-line)
- CLIPBOARD_TEXT_MULTI, // Multiple lines of text; we use \n only
- CLIPBOARD_IMAGE, // A 32-bit RGBA SDL_Surface
- CLIPBOARD_LAYER, // A tile layer chunk
- CLIPBOARD_RGBA, // One or more RGBA colors
- CLIPBOARD_SPAWN, // One or more spawn points
- // Other GCSx-specific types will be added as needed
- CLIPBOARD_COUNT,
- };
- // Type of data currently in *internal* clipboard
- ClipboardType typeInClipboard();
- // Can data in clipboard (internal or platform-specific) convert to requested type?
- int canConvertClipboard(ClipboardType type);
- // Clear clipboard (only clears *internal* clipboard, not platform-specific clipboard)
- void clipboardClear();
- // Clear references to a given tileset out of clipboard
- void clipboardClearTileset(const void* tileset);
- // @TODO: clipboardClearAnimgroup/Script (spawns) also apply to previous
- // Copy data to clipboard (internal or platform-specific)
- void clipboardCopy(const std::string& text);
- // (must be a surface32)
- void clipboardCopy(SDL_Surface* surface, int x, int y, int width, int height);
- void clipboardCopy(const Uint8* colors, int count);
- // (map layer(s)- fx ptr(s) may be NULL; pitch is in dwords)
- // (tileset of NULL if no specific tileset associated with data, else pass a TileSet*)
- // (either tileset or tileset[] may be NULL; either dataFx or dataFx[] may be NULL;
- // either dataExt or dataExt[] may be NULL
- void clipboardCopy(int numLayers, const void* const* tileset, const Uint32* const* data, const Uint32* const* dataExt, const Uint32* const* dataFx, int x, int y, int width, int height, int pitch);
- // Spawns- layers are relative for multiple-layer copy (you do not need to zero-base them)
- void clipboardCopy(const std::vector<class SpawnEdit const*>& spawns, const std::vector<int>& layers);
- // Load data from clipboard (internal or platform-specific)
- void clipboardPasteTextLine(std::string& paste);
- void clipboardPasteTextMulti(std::string& paste);
- // (get size of image to be pasted)
- void clipboardPasteImageSize(int* width, int* height);
- // (must pass a surface32)
- void clipboardPasteImage(SDL_Surface* dest, int x, int y);
- // (will clip count to count actually in clipboard; returns count pasted)
- int clipboardPasteColor(Uint8* dest, int maxCount);
- // (get data on layer in clipboard)
- void clipboardPasteLayerInfo(int* numLayers, int* width, int* height);
- // (tileset of NULL if no specific tileset associated with data)
- void clipboardPasteLayerInfoDetails(int layer, const void** tileset, int* hasExt, int* hasFx);
- // (paste one layer from clipboard; clipboard may contain multiple layers)
- // (default data/fx/ext used if needed to "flesh out" data in clipboard)
- // (dataFx/dataExt may be NULL; height/width are max size that can be pasted; pitch is in dwords)
- void clipboardPasteLayer(int layer, Uint32* data, Uint32* dataExt, Uint32* dataFx, int x, int y, int width, int height, int pitch, Uint32 defaultData, Uint32 defaultExt, Uint32 defaultFx);
- // Number of spawns available to paste, and count of unique layers spanned
- void clipboardPasteSpawnInfo(int* numSpawns, int* numLayers);
- // Returns one spawn at a time (pass a newly constructed spawn) and returns layer number (zero-based)
- // Pass base x/y position to place spawns at
- void clipboardPasteSpawn(int spawnNum, class SpawnEdit* newSpawn, int* layerNum, int baseX, int baseY);
- #endif
|