2015-07-22 21:32:54 +03:00
|
|
|
#ifndef INCLUDE_CLIPBOARD_H
|
|
|
|
#define INCLUDE_CLIPBOARD_H
|
2015-08-04 18:48:36 +03:00
|
|
|
#print "[include <clipboard.h>]\n"
|
2015-07-22 21:32:54 +03:00
|
|
|
|
|
|
|
#ifndef INCLUDE_KOLIBRI_H
|
|
|
|
#include "../lib/kolibri.h"
|
|
|
|
#endif
|
|
|
|
|
2017-10-01 14:57:00 +03:00
|
|
|
|
|
|
|
#ifndef INCLUDE_FILESYSTEM_H
|
2018-04-03 16:57:56 +03:00
|
|
|
#include "../lib/fs.h"
|
2017-10-01 14:57:00 +03:00
|
|
|
#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 04:33:26 +04:00
|
|
|
{
|
|
|
|
$mov eax, 54
|
|
|
|
$mov ebx, 0
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2017-10-01 14:57:00 +03:00
|
|
|
inline fastcall dword Clipboard__GetSlotData( ECX) //ECX = slot number
|
2014-01-06 04:33:26 +04:00
|
|
|
{
|
|
|
|
$mov eax, 54
|
|
|
|
$mov ebx, 1
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2017-10-01 14:57:00 +03:00
|
|
|
inline fastcall dword Clipboard__SetSlotData( ECX, EDX) //ECX = data size, EDX - pointer to data
|
2014-01-06 04:33:26 +04:00
|
|
|
{
|
|
|
|
$mov eax, 54
|
|
|
|
$mov ebx, 2
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2017-10-01 14:57:00 +03:00
|
|
|
inline fastcall dword Clipboard__DeleteLastSlot()
|
2014-01-06 04:33:26 +04:00
|
|
|
{
|
|
|
|
$mov eax, 54
|
|
|
|
$mov ebx, 3
|
|
|
|
$int 0x40
|
|
|
|
}
|
|
|
|
|
2017-10-01 14:57:00 +03:00
|
|
|
inline fastcall dword Clipboard__ResetBlockingBuffer()
|
2014-01-06 04:33:26 +04:00
|
|
|
{
|
|
|
|
$mov eax, 54
|
2016-10-05 01:44:07 +03:00
|
|
|
$mov ebx, 4
|
2014-01-06 04:33:26 +04:00
|
|
|
$int 0x40
|
2015-07-22 21:32:54 +03:00
|
|
|
}
|
|
|
|
|
2017-10-01 14:57:00 +03:00
|
|
|
//===================================================//
|
|
|
|
// //
|
|
|
|
// Some useful patterns //
|
|
|
|
// //
|
|
|
|
//===================================================//
|
|
|
|
|
|
|
|
:void Clipboard__CopyText(dword _text)
|
|
|
|
{
|
2020-05-12 02:02:41 +03:00
|
|
|
dword size_buf;
|
2017-10-01 14:57:00 +03:00
|
|
|
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 21:32:54 +03:00
|
|
|
#endif
|