full refactoring of CMM/lib/clipboard.h, ability to copy link URL in WebView, small improvements in clipview and app_plus

git-svn-id: svn://kolibrios.org@7037 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2017-10-01 11:57:00 +00:00
parent c5e4924194
commit 90b630f05f
8 changed files with 130 additions and 107 deletions

View File

@ -84,7 +84,7 @@ bool LinksArray::HoverAndProceed(dword mx, my)
return false; return false;
} }
if (mouse.pkm) && (mouse.up) { if (mouse.pkm) && (mouse.up) {
// EventShowLinkMenu(mouse.x, mouse.y); EventShowLinkMenu(mouse.x, mouse.y);
return false; return false;
} }
if (active==i) return false; if (active==i) return false;

View File

@ -22,9 +22,11 @@ dword scr = FROM "scr.raw_8bit";
dword scr_pal[] = {0xFFFFFF,0xBBDDFF,0x4166B5,0xE0E4E6,0xAFBEDD,0xC4D4E8,0x52ACDD,0x000000, dword scr_pal[] = {0xFFFFFF,0xBBDDFF,0x4166B5,0xE0E4E6,0xAFBEDD,0xC4D4E8,0x52ACDD,0x000000,
0xE9DAB2,0xC99811,0xFDF9D4,0xF8B93C,0xFDEEBE,0xFBEBA6,0xDFAF4F,0xF3D57C}; 0xE9DAB2,0xC99811,0xFDF9D4,0xF8B93C,0xFDEEBE,0xFBEBA6,0xDFAF4F,0xF3D57C};
#define BTN_MANUAL_SEARCH 10
#define APP_PLUS_INI_PATH "/kolibrios/settings/app_plus.ini" #define APP_PLUS_INI_PATH "/kolibrios/settings/app_plus.ini"
#define APP_PLUS_INI_NOT_EXISTS "'APP+\n/kolibrios/settings/app_plus.ini is not exists.\nProgram terminated.' -tE" #define APP_PLUS_INI_NOT_EXISTS "'APP+\n/kolibrios/settings/app_plus.ini does not exists.\nProgram terminated.' -tE"
#define WINDOW_TITLE_TEXT "Error" #define WINDOW_TITLE_TEXT "Error"
#define CONTENT_HEADER_TEXT "/KOLIBRIOS/ IS NOT MOUNTED" #define CONTENT_HEADER_TEXT "/KOLIBRIOS/ IS NOT MOUNTED"
@ -49,9 +51,8 @@ void CheckKosMounted()
} }
} }
void RunAutosearch() void WaitAutosearch()
{ {
if (!CheckProcessExists("SEARCHAP")) io.run("/sys/SEARCHAP",0);
while (CheckProcessExists("SEARCHAP")) pause(2); while (CheckProcessExists("SEARCHAP")) pause(2);
} }
@ -60,25 +61,24 @@ void main()
word id; word id;
CheckKosMounted(); CheckKosMounted();
RunAutosearch(); WaitAutosearch();
CheckKosMounted(); CheckKosMounted();
o_dialog.type = 2; o_dialog.type = 2;
load_dll(Proc_lib, #OpenDialog_init,0); load_dll(Proc_lib, #OpenDialog_init,0);
OpenDialog_init stdcall (#o_dialog); OpenDialog_init stdcall (#o_dialog);
active_button_id = BTN_MANUAL_SEARCH;
loop() switch(WaitEvent()) loop() switch(WaitEvent())
{ {
case evButton: case evButton:
id=GetButtonID(); id=GetButtonID();
if (id==1) ExitProcess(); if (id==1) ExitProcess();
if (id==10) if (id==BTN_MANUAL_SEARCH) EventManualSearch();
{ break;
OpenDialog_start stdcall (#o_dialog); case evKey:
if (o_dialog.status) SetAdditionalSystemDirectory("kolibrios", #openfile_path+1); GetKeys();
pause(3); if (key_scancode == SCAN_CODE_ENTER) EventManualSearch();
CheckKosMounted();
}
break; break;
case evReDraw: case evReDraw:
@ -102,7 +102,15 @@ void draw_window()
PutPaletteImage(#scr,144,171,Form.cwidth-180,y.n,8,#scr_pal); PutPaletteImage(#scr,144,171,Form.cwidth-180,y.n,8,#scr_pal);
DrawRectangle(Form.cwidth-180-1,y.n-1, 144+1,171+1, system.color.work_graph); DrawRectangle(Form.cwidth-180-1,y.n-1, 144+1,171+1, system.color.work_graph);
DrawCaptButton(x,Form.cheight-66,300,30,10,system.color.work_button,system.color.work_button_text,MANUALLY_BUTTON_TEXT); DrawStandartCaptButton(x, Form.cheight-66, BTN_MANUAL_SEARCH, MANUALLY_BUTTON_TEXT);
}
void EventManualSearch()
{
OpenDialog_start stdcall (#o_dialog);
if (o_dialog.status) SetAdditionalSystemDirectory("kolibrios", #openfile_path+1);
pause(3);
CheckKosMounted();
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 881 B

View File

@ -15,6 +15,7 @@
#include "..\lib\collection.h" #include "..\lib\collection.h"
#include "..\lib\menu.h" #include "..\lib\menu.h"
#include "..\lib\random.h" #include "..\lib\random.h"
#include "..\lib\clipboard.h"
//*.obj libraries //*.obj libraries
#include "..\lib\obj\box_lib.h" #include "..\lib\obj\box_lib.h"
@ -30,7 +31,7 @@
char homepage[] = FROM "html\\homepage.htm""\0"; char homepage[] = FROM "html\\homepage.htm""\0";
#ifdef LANG_RUS #ifdef LANG_RUS
char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.71"; char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.72";
?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­" ?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤" ?define T_LAST_SLIDE "<EFBFBD>â® ¯®á«¥¤­¨© á« ©¤"
char loading[] = "‡ £à㧪  áâà ­¨æë...<br>"; char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
@ -40,10 +41,11 @@ char rmb_menu[] =
"<EFBFBD>®á¬®âà¥âì ¨á室­¨ª "<EFBFBD>®á¬®âà¥âì ¨á室­¨ª
<EFBFBD>¥¤ ªâ¨à®¢ âì ¨á室­¨ª <EFBFBD>¥¤ ªâ¨à®¢ âì ¨á室­¨ª
ˆáâ®à¨ï ˆáâ®à¨ï
Žç¨áâ¨âì ªíè ª à⨭®ª
Œ¥­¥¤¦¥à § £à㧮ª"; Œ¥­¥¤¦¥à § £à㧮ª";
char link_menu[] =
"Š®¯¨à®¢ âì áá뫪ã";
#else #else
char version[]="Text-based Browser 1.71"; char version[]="Text-based Browser 1.72";
?define IMAGES_CACHE_CLEARED "Images cache cleared" ?define IMAGES_CACHE_CLEARED "Images cache cleared"
?define T_LAST_SLIDE "This slide is the last" ?define T_LAST_SLIDE "This slide is the last"
char loading[] = "Loading...<br>"; char loading[] = "Loading...<br>";
@ -53,13 +55,11 @@ char rmb_menu[] =
"View source "View source
Edit source Edit source
History History
Free image cache
Download Manager"; Download Manager";
char link_menu[] =
"Copy link";
#endif #endif
char link_menu[] =
"Copy link
Download link";
#define URL_SERVICE_HISTORY "WebView://history" #define URL_SERVICE_HISTORY "WebView://history"
#define URL_SERVICE_HOME "WebView://home" #define URL_SERVICE_HOME "WebView://home"
@ -96,10 +96,9 @@ enum {
VIEW_SOURCE=1100, VIEW_SOURCE=1100,
EDIT_SOURCE, EDIT_SOURCE,
VIEW_HISTORY, VIEW_HISTORY,
FREE_IMG_CACHE, //FREE_IMG_CACHE,
DOWNLOAD_MANAGER, DOWNLOAD_MANAGER,
COPY_LINK=1200, COPY_LINK=1200
DOWNLOAD_LINK
}; };
#include "..\TWB\TWB.c" #include "..\TWB\TWB.c"
@ -130,7 +129,6 @@ void main()
loop() switch(WaitEvent()) loop() switch(WaitEvent())
{ {
case evMouse: case evMouse:
if (!CheckActiveProcess(Form.ID)) break;
edit_box_mouse stdcall (#address_box); edit_box_mouse stdcall (#address_box);
mouse.get(); mouse.get();
if (WB1.list.MouseOver(mouse.x, mouse.y)) if (WB1.list.MouseOver(mouse.x, mouse.y))
@ -361,11 +359,11 @@ void ProcessEvent(dword id__)
} }
else RunProgram("/rd/1/tinypad", #URL); else RunProgram("/rd/1/tinypad", #URL);
return; return;
case FREE_IMG_CACHE: // case FREE_IMG_CACHE:
ImgCache.Free(); // ImgCache.Free();
notify(IMAGES_CACHE_CLEARED); // notify(IMAGES_CACHE_CLEARED);
WB1.DrawPage(); // WB1.DrawPage();
return; // return;
case VIEW_HISTORY: case VIEW_HISTORY:
strcpy(#URL, URL_SERVICE_HISTORY); strcpy(#URL, URL_SERVICE_HISTORY);
OpenPage(); OpenPage();
@ -376,10 +374,13 @@ void ProcessEvent(dword id__)
CreateThread(#Downloader,#downloader_stak+4092); CreateThread(#Downloader,#downloader_stak+4092);
} }
return; return;
case COPY_LINK:
Clipboard__CopyText(PageLinks.GetURL(PageLinks.active));
notify("'URL copied to clipboard'O");
return;
} }
} }
void StopLoading() void StopLoading()
{ {
if (http_transfer) if (http_transfer)

View File

@ -41,9 +41,6 @@ enum {
proc_info Form; proc_info Form;
Clipboard clipboard;
//===================================================// //===================================================//
// // // //
// CODE // // CODE //
@ -53,7 +50,7 @@ Clipboard clipboard;
void main() void main()
{ {
int id; int id;
SetEventMask(0x27); SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
load_dll(boxlib, #box_lib_init,0); load_dll(boxlib, #box_lib_init,0);
loop() loop()
{ {
@ -61,12 +58,11 @@ void main()
switch(EAX & 0xFF) switch(EAX & 0xFF)
{ {
case evMouse: case evMouse:
if (!CheckActiveProcess(Form.ID)) break;
SelectList_ProcessMouse(); SelectList_ProcessMouse();
break; break;
case evButton: case evButton:
id=GetButtonID(); id = GetButtonID();
if (id==1) ExitProcess(); if (id==1) ExitProcess();
if (id==BT_DELETE_LAST_SLOT) EventDeleteLastSlot(); if (id==BT_DELETE_LAST_SLOT) EventDeleteLastSlot();
if (id==BT_DELETE_ALL_SLOTS) EventDeleteAllSlots(); if (id==BT_DELETE_ALL_SLOTS) EventDeleteAllSlots();
@ -98,7 +94,7 @@ void main()
break; break;
default: default:
if (clipboard.GetSlotCount() > select_list.count) ClipViewSelectListDraw(); if (Clipboard__GetSlotCount() > select_list.count) ClipViewSelectListDraw();
break; break;
} }
} }
@ -119,6 +115,16 @@ void DrawWindowContent()
SelectList_DrawBorder(); SelectList_DrawBorder();
} }
dword slot_data;
struct clipboard_data
{
dword size;
dword type;
dword encoding;
dword content;
dword content_offset;
} cdata;
void SelectList_DrawLine(dword i) void SelectList_DrawLine(dword i)
{ {
int yyy, length, slot_data_type_number; int yyy, length, slot_data_type_number;
@ -126,21 +132,28 @@ void SelectList_DrawLine(dword i)
dword size_kb; dword size_kb;
dword text_color = 0; dword text_color = 0;
clipboard.GetSlotData(select_list.first + i); slot_data = Clipboard__GetSlotData(select_list.first + i);
cdata.size = ESDWORD[slot_data];
cdata.type = ESDWORD[slot_data+4];
if (cdata.type==SLOT_DATA_TYPE_TEXT) || (cdata.type==SLOT_DATA_TYPE_TEXT_BLOCK)
cdata.content_offset = 12;
else
cdata.content_offset = 8;
cdata.content = slot_data + cdata.content_offset;
yyy = i*select_list.item_h+select_list.y; yyy = i*select_list.item_h+select_list.y;
WriteText(select_list.x+12, yyy+select_list.text_y, select_list.font_type, text_color, itoa(select_list.first + i)); WriteText(select_list.x+12, yyy+select_list.text_y, select_list.font_type, text_color, itoa(select_list.first + i));
//WriteText(select_list.x+44, yyy+select_list.text_y, select_list.font_type, text_color, itoa(clipboard.slot_data.size)); size_kb = ConvertSizeToKb(cdata.size);
size_kb = ConvertSizeToKb(clipboard.slot_data.size);
WriteText(select_list.x+44, yyy+select_list.text_y, select_list.font_type, text_color, size_kb); WriteText(select_list.x+44, yyy+select_list.text_y, select_list.font_type, text_color, size_kb);
slot_data_type_number = clipboard.slot_data.type; slot_data_type_number = cdata.type;
WriteText(select_list.x+140, yyy+select_list.text_y, select_list.font_type, text_color, data_type[slot_data_type_number]); WriteText(select_list.x+140, yyy+select_list.text_y, select_list.font_type, text_color, data_type[slot_data_type_number]);
WriteText(select_list.x+select_list.w - 88, yyy+select_list.text_y, select_list.font_type, 0x006597, T_VIEW_OPTIONS); WriteText(select_list.x+select_list.w - 88, yyy+select_list.text_y, select_list.font_type, 0x006597, T_VIEW_OPTIONS);
DefineButton(select_list.x+select_list.w - 95, yyy, 50, select_list.item_h, 100+i+BT_HIDE, NULL); DefineButton(select_list.x+select_list.w - 95, yyy, 50, select_list.item_h, 100+i+BT_HIDE, NULL);
DefineButton(select_list.x+select_list.w - 95 + 51, yyy, 40, select_list.item_h, 300+i+BT_HIDE, NULL); DefineButton(select_list.x+select_list.w - 95 + 51, yyy, 40, select_list.item_h, 300+i+BT_HIDE, NULL);
length = select_list.w-236 - 95 / select_list.font_w - 2; length = select_list.w-236 - 95 / select_list.font_w - 2;
if (clipboard.slot_data.size-8 < length) length = clipboard.slot_data.size-8; if (cdata.size - cdata.content_offset < length) length = cdata.size - cdata.content_offset;
memmov(#line_text, clipboard.slot_data.content, length); memmov(#line_text, cdata.content, length);
replace_char(#line_text, 0, 31, length); // 31 is a dot replace_char(#line_text, 0, 31, length); // 31 is a dot
WriteText(select_list.x+236, yyy+select_list.text_y, select_list.font_type, text_color, #line_text); WriteText(select_list.x+236, yyy+select_list.text_y, select_list.font_type, text_color, #line_text);
} }
@ -155,9 +168,8 @@ replace_char(dword in_str, char from_char, to_char, int length) {
ESBYTE[in_str+length]=0; ESBYTE[in_str+length]=0;
} }
int SaveSlotContents(int slot_id) { int SaveSlotContents(dword size, off) {
clipboard.GetSlotData(slot_id); EAX = WriteFile(size, off, DEFAULT_SAVE_PATH);
EAX = WriteFile(clipboard.slot_data.size, clipboard.slot_data.content, DEFAULT_SAVE_PATH);
if (!EAX) if (!EAX)
{ {
return true; return true;
@ -169,7 +181,7 @@ int SaveSlotContents(int slot_id) {
} }
void ClipViewSelectListDraw() { void ClipViewSelectListDraw() {
select_list.count = clipboard.GetSlotCount(); select_list.count = Clipboard__GetSlotCount();
SelectList_Draw(); SelectList_Draw();
} }
@ -188,27 +200,33 @@ void EventDeleteLastSlot()
int i; int i;
for (i=0; i<select_list.visible; i++;) DeleteButton(select_list.first + i + 100); for (i=0; i<select_list.visible; i++;) DeleteButton(select_list.first + i + 100);
for (i=0; i<select_list.visible; i++;) DeleteButton(select_list.first + i + 300); for (i=0; i<select_list.visible; i++;) DeleteButton(select_list.first + i + 300);
clipboard.DelLastSlot(); Clipboard__DeleteLastSlot();
ClipViewSelectListDraw(); ClipViewSelectListDraw();
} }
void EventDeleteAllSlots() void EventDeleteAllSlots()
{ {
while (clipboard.GetSlotCount()) clipboard.DelLastSlot(); while (Clipboard__GetSlotCount()) Clipboard__DeleteLastSlot();
ClipViewSelectListDraw(); ClipViewSelectListDraw();
} }
void EventResetBufferLock() { void EventResetBufferLock() {
clipboard.ResetBlockingBuffer(); Clipboard__ResetBlockingBuffer();
ClipViewSelectListDraw(); ClipViewSelectListDraw();
} }
void EventOpenAsText(int slot_id) { void EventOpenAsText(int slot_id) {
if (SaveSlotContents(slot_id)) RunProgram("/sys/tinypad", DEFAULT_SAVE_PATH); slot_data = Clipboard__GetSlotData(slot_id);
cdata.size = ESDWORD[slot_data]-12;
cdata.content = slot_data+12;
if (SaveSlotContents(cdata.size, cdata.content)) RunProgram("/sys/tinypad", DEFAULT_SAVE_PATH);
} }
void EventOpenAsHex(int slot_id) { void EventOpenAsHex(int slot_id) {
if (SaveSlotContents(slot_id)) RunProgram("/sys/develop/heed", DEFAULT_SAVE_PATH); slot_data = Clipboard__GetSlotData(slot_id);
cdata.size = ESDWORD[slot_data];
cdata.content = slot_data;
if (SaveSlotContents(cdata.size, cdata.content)) RunProgram("/sys/develop/heed", DEFAULT_SAVE_PATH);
} }
stop: stop:

View File

@ -6,69 +6,80 @@
#include "../lib/kolibri.h" #include "../lib/kolibri.h"
#endif #endif
struct buffer_data
{
dword size;
dword type;
dword encoding;
dword content;
};
#ifndef INCLUDE_FILESYSTEM_H
#include "../lib/file_system.h"
#endif
struct Clipboard { //===================================================//
buffer_data slot_data; // //
dword GetSlotCount(); // Kolibri Clipboard System Functions //
dword GetSlotData( ECX); // //
dword SetSlotData( EDX, ESI); //===================================================//
dword DelLastSlot();
dword ResetBlockingBuffer();
};
dword Clipboard::GetSlotCount() #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()
{ {
$mov eax, 54 $mov eax, 54
$mov ebx, 0 $mov ebx, 0
$int 0x40 $int 0x40
} }
#define SLOT_DATA_TYPE_TEXT 0 inline fastcall dword Clipboard__GetSlotData( ECX) //ECX = slot number
#define SLOT_DATA_TYPE_TEXT_WITH_BLOCK_SELECTION 1
#define SLOT_DATA_TYPE_IMAGE 2
#define SLOT_DATA_TYPE_RAW 3
dword Clipboard::GetSlotData( ECX) //ECX = slot number
{ {
dword result;
$mov eax, 54 $mov eax, 54
$mov ebx, 1 $mov ebx, 1
$int 0x40 $int 0x40
result = EAX;
slot_data.size = DSDWORD[result];
slot_data.type = DSDWORD[result+4];
slot_data.encoding = DSDWORD[result+8];
if (slot_data.type == SLOT_DATA_TYPE_TEXT) slot_data.content = result+12;
else slot_data.content = result+8;
return result;
} }
dword Clipboard::SetSlotData( ECX, EDX) //ECX = data size, EDX - pointer to data inline fastcall dword Clipboard__SetSlotData( ECX, EDX) //ECX = data size, EDX - pointer to data
{ {
$mov eax, 54 $mov eax, 54
$mov ebx, 2 $mov ebx, 2
$int 0x40 $int 0x40
} }
dword Clipboard::DelLastSlot() inline fastcall dword Clipboard__DeleteLastSlot()
{ {
$mov eax, 54 $mov eax, 54
$mov ebx, 3 $mov ebx, 3
$int 0x40 $int 0x40
} }
dword Clipboard::ResetBlockingBuffer() inline fastcall dword Clipboard__ResetBlockingBuffer()
{ {
$mov eax, 54 $mov eax, 54
$mov ebx, 4 $mov ebx, 4
$int 0x40 $int 0x40
} }
//===================================================//
// //
// 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);
}
#endif #endif

View File

@ -1,5 +1,5 @@
@del pipet.kex @del pipet
@c-- pipet.c @c-- pipet.c
@rename *.com *.kex @rename *.com *.
@del warning.txt @del warning.txt
@pause @pause

View File

@ -11,10 +11,9 @@
//===================================================// //===================================================//
proc_info Form; proc_info Form;
Clipboard clipboard;
dword pick_active = true; dword pick_active = true;
dword picked_color = 0; dword picked_color = 0;
char picked_color_string[10]; char picked_color_string[11]="0x00111222\0";
#define FORM_W 167 #define FORM_W 167
#define FORM_H 60 #define FORM_H 60
#define COLOR_BLOCK_SIZE 42 #define COLOR_BLOCK_SIZE 42
@ -55,7 +54,7 @@ void main()
case evButton: case evButton:
btn = GetButtonID(); btn = GetButtonID();
if (btn == BUTTON_ID_CLOSE) ExitProcess(); if (btn == BUTTON_ID_CLOSE) ExitProcess();
if (btn == BUTTON_ID_COPY) EventCopyIntoSystemBuffer(); if (btn == BUTTON_ID_COPY) EventCopyHex();
if (btn == BUTTON_ID_PICK) pick_active = true; if (btn == BUTTON_ID_PICK) pick_active = true;
break; break;
@ -63,7 +62,7 @@ void main()
GetKeys(); GetKeys();
if (key_scancode == SCAN_CODE_ESC) ExitProcess(); if (key_scancode == SCAN_CODE_ESC) ExitProcess();
if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL)
if (key_scancode==SCAN_CODE_KEY_C) EventCopyIntoSystemBuffer(); if (key_scancode==SCAN_CODE_KEY_C) EventCopyHex();
break; break;
case evReDraw: case evReDraw:
@ -113,21 +112,7 @@ void DrawCopyButton(dword _x, _y, _w, _h, _color)
WriteTextCenter(_x, _h-8/2 + _y, _w, _color, "Copy"); WriteTextCenter(_x, _h-8/2 + _y, _w, _color, "Copy");
} }
struct _clipboard_pipet_data_text void EventCopyHex()
{ {
dword size; Clipboard__CopyText(#picked_color_string+4);
dword type; }
dword encoding; //encoding 0=UTF, 1=866, 2=1251
char color_text[7];
};
void EventCopyIntoSystemBuffer()
{
_clipboard_pipet_data_text clipboard_buf;
clipboard_buf.size = 19;
clipboard_buf.type = SLOT_DATA_TYPE_TEXT;
clipboard_buf.encoding = 1;
strcpy(#clipboard_buf.color_text, #picked_color_string+4);
clipboard_buf.color_text[7] = NULL;
clipboard.SetSlotData(clipboard_buf.size, #clipboard_buf);
}