2015-07-22 20:32:54 +02:00
|
|
|
#ifndef INCLUDE_CLIPBOARD_H
|
|
|
|
#define INCLUDE_CLIPBOARD_H
|
2015-08-04 17:48:36 +02:00
|
|
|
#print "[include <clipboard.h>]\n"
|
2015-07-22 20:32:54 +02:00
|
|
|
|
|
|
|
#ifndef INCLUDE_KOLIBRI_H
|
|
|
|
#include "../lib/kolibri.h"
|
|
|
|
#endif
|
|
|
|
|
2017-10-01 13:57:00 +02:00
|
|
|
|
|
|
|
#ifndef INCLUDE_FILESYSTEM_H
|
|
|
|
#include "../lib/file_system.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//===================================================//
|
|
|
|
// //
|
|
|
|
// Kolibri Clipboard System Functions //
|
|
|
|
// //
|
|
|
|
//===================================================//
|
|
|
|
|
|
|
|
#define SLOT_DATA_TYPE_TEXT 0
|
|
|
|
#define SLOT_DATA_TYPE_TEXT_BLOCK 1
|
|
|
|
#define SLOT_DATA_TYPE_IMAGE 2
|
|
|
|
#define SLOT_DATA_TYPE_RAW 3
|
|
|
|
|
|
|
|
inline fastcall dword Clipboard__GetSlotCount()
|
2014-01-06 01:33:26 +01:00
|
|
|
{
|
|
|
|
$mov eax, 54
|
|
|
|
$mov ebx, 0
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2017-10-01 13:57:00 +02:00
|
|
|
inline fastcall dword Clipboard__GetSlotData( ECX) //ECX = slot number
|
2014-01-06 01:33:26 +01:00
|
|
|
{
|
|
|
|
$mov eax, 54
|
|
|
|
$mov ebx, 1
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2017-10-01 13:57:00 +02:00
|
|
|
inline fastcall dword Clipboard__SetSlotData( ECX, EDX) //ECX = data size, EDX - pointer to data
|
2014-01-06 01:33:26 +01:00
|
|
|
{
|
|
|
|
$mov eax, 54
|
|
|
|
$mov ebx, 2
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2017-10-01 13:57:00 +02:00
|
|
|
inline fastcall dword Clipboard__DeleteLastSlot()
|
2014-01-06 01:33:26 +01:00
|
|
|
{
|
|
|
|
$mov eax, 54
|
|
|
|
$mov ebx, 3
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2017-10-01 13:57:00 +02:00
|
|
|
inline fastcall dword Clipboard__ResetBlockingBuffer()
|
2014-01-06 01:33:26 +01:00
|
|
|
{
|
|
|
|
$mov eax, 54
|
2016-10-05 00:44:07 +02:00
|
|
|
$mov ebx, 4
|
2014-01-06 01:33:26 +01:00
|
|
|
$int 0x40
|
2015-07-22 20:32:54 +02:00
|
|
|
}
|
|
|
|
|
2017-10-01 13:57:00 +02:00
|
|
|
//===================================================//
|
|
|
|
// //
|
|
|
|
// Some useful patterns //
|
|
|
|
// //
|
|
|
|
//===================================================//
|
|
|
|
|
|
|
|
:void Clipboard__CopyText(dword _text)
|
|
|
|
{
|
|
|
|
int size_buf;
|
|
|
|
dword buff_data;
|
|
|
|
|
|
|
|
size_buf = strlen(_text) + 12;
|
|
|
|
buff_data = malloc(size_buf);
|
|
|
|
ESDWORD[buff_data] = size_buf;
|
|
|
|
ESDWORD[buff_data+4] = SLOT_DATA_TYPE_TEXT;
|
|
|
|
ESDWORD[buff_data+8] = 1; //encoding 0=UTF, 1=866, 2=1251
|
|
|
|
strcpy(buff_data+12, _text);
|
|
|
|
|
|
|
|
Clipboard__SetSlotData(size_buf, buff_data);
|
|
|
|
if (EAX!=0) notify("'Error while copying to clipboard!'E");
|
|
|
|
|
|
|
|
buff_data = free(buff_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-07-22 20:32:54 +02:00
|
|
|
#endif
|