gcsx_clipboard.h 4.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* GCSx
  2. ** CLIPBOARD.H
  3. **
  4. ** Our internal clipboard, with cross-platform clipboard reading/writing
  5. ** added transparently as code becomes available
  6. */
  7. /*****************************************************************************
  8. ** Copyright (C) 2003-2006 Janson
  9. **
  10. ** This program is free software; you can redistribute it and/or modify
  11. ** it under the terms of the GNU General Public License as published by
  12. ** the Free Software Foundation; either version 2 of the License, or
  13. ** (at your option) any later version.
  14. **
  15. ** This program is distributed in the hope that it will be useful,
  16. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. ** GNU General Public License for more details.
  19. **
  20. ** You should have received a copy of the GNU General Public License
  21. ** along with this program; if not, write to the Free Software
  22. ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
  23. *****************************************************************************/
  24. #ifndef __GCSx_CLIPBOARD_H_
  25. #define __GCSx_CLIPBOARD_H_
  26. // Types of data we care about that can be in the clipboard
  27. enum ClipboardType {
  28. CLIPBOARD_NONE = 0, // Or nothing recognizable
  29. CLIPBOARD_TEXT_LINE, // One line of text (no end-of-line)
  30. CLIPBOARD_TEXT_MULTI, // Multiple lines of text; we use \n only
  31. CLIPBOARD_IMAGE, // A 32-bit RGBA SDL_Surface
  32. CLIPBOARD_LAYER, // A tile layer chunk
  33. CLIPBOARD_RGBA, // One or more RGBA colors
  34. CLIPBOARD_SPAWN, // One or more spawn points
  35. // Other GCSx-specific types will be added as needed
  36. CLIPBOARD_COUNT,
  37. };
  38. // Type of data currently in *internal* clipboard
  39. ClipboardType typeInClipboard();
  40. // Can data in clipboard (internal or platform-specific) convert to requested type?
  41. int canConvertClipboard(ClipboardType type);
  42. // Clear clipboard (only clears *internal* clipboard, not platform-specific clipboard)
  43. void clipboardClear();
  44. // Clear references to a given tileset out of clipboard
  45. void clipboardClearTileset(const void* tileset);
  46. // @TODO: clipboardClearAnimgroup/Script (spawns) also apply to previous
  47. // Copy data to clipboard (internal or platform-specific)
  48. void clipboardCopy(const std::string& text);
  49. // (must be a surface32)
  50. void clipboardCopy(SDL_Surface* surface, int x, int y, int width, int height);
  51. void clipboardCopy(const Uint8* colors, int count);
  52. // (map layer(s)- fx ptr(s) may be NULL; pitch is in dwords)
  53. // (tileset of NULL if no specific tileset associated with data, else pass a TileSet*)
  54. // (either tileset or tileset[] may be NULL; either dataFx or dataFx[] may be NULL;
  55. // either dataExt or dataExt[] may be NULL
  56. 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);
  57. // Spawns- layers are relative for multiple-layer copy (you do not need to zero-base them)
  58. void clipboardCopy(const std::vector<class SpawnEdit const*>& spawns, const std::vector<int>& layers);
  59. // Load data from clipboard (internal or platform-specific)
  60. void clipboardPasteTextLine(std::string& paste);
  61. void clipboardPasteTextMulti(std::string& paste);
  62. // (get size of image to be pasted)
  63. void clipboardPasteImageSize(int* width, int* height);
  64. // (must pass a surface32)
  65. void clipboardPasteImage(SDL_Surface* dest, int x, int y);
  66. // (will clip count to count actually in clipboard; returns count pasted)
  67. int clipboardPasteColor(Uint8* dest, int maxCount);
  68. // (get data on layer in clipboard)
  69. void clipboardPasteLayerInfo(int* numLayers, int* width, int* height);
  70. // (tileset of NULL if no specific tileset associated with data)
  71. void clipboardPasteLayerInfoDetails(int layer, const void** tileset, int* hasExt, int* hasFx);
  72. // (paste one layer from clipboard; clipboard may contain multiple layers)
  73. // (default data/fx/ext used if needed to "flesh out" data in clipboard)
  74. // (dataFx/dataExt may be NULL; height/width are max size that can be pasted; pitch is in dwords)
  75. 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);
  76. // Number of spawns available to paste, and count of unique layers spanned
  77. void clipboardPasteSpawnInfo(int* numSpawns, int* numLayers);
  78. // Returns one spawn at a time (pass a newly constructed spawn) and returns layer number (zero-based)
  79. // Pass base x/y position to place spawns at
  80. void clipboardPasteSpawn(int spawnNum, class SpawnEdit* newSpawn, int* layerNum, int baseX, int baseY);
  81. #endif