Subversion Repositories Kolibri OS

Rev

Rev 6919 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6919 Rev 7037
Line 9... Line 9...
9
//                       DATA                        //
9
//                       DATA                        //
10
//                                                   //
10
//                                                   //
11
//===================================================//
11
//===================================================//
Line 12... Line 12...
12
 
12
 
13
proc_info Form;
-
 
14
Clipboard clipboard;
13
proc_info Form;
15
dword pick_active = true;
14
dword pick_active = true;
16
dword picked_color = 0;
15
dword picked_color = 0;
17
char picked_color_string[10];
16
char picked_color_string[11]="0x00111222\0";
18
#define FORM_W 167
17
#define FORM_W 167
19
#define FORM_H 60
18
#define FORM_H 60
20
#define COLOR_BLOCK_SIZE 42
19
#define COLOR_BLOCK_SIZE 42
21
#define COLOR_BLOCK_PADDING FORM_H - COLOR_BLOCK_SIZE / 2
20
#define COLOR_BLOCK_PADDING FORM_H - COLOR_BLOCK_SIZE / 2
Line 53... Line 52...
53
			break;
52
			break;
Line 54... Line 53...
54
 
53
 
55
		case evButton:
54
		case evButton:
56
			btn = GetButtonID();
55
			btn = GetButtonID();
57
			if (btn == BUTTON_ID_CLOSE) ExitProcess();
56
			if (btn == BUTTON_ID_CLOSE) ExitProcess();
58
			if (btn == BUTTON_ID_COPY) EventCopyIntoSystemBuffer();
57
			if (btn == BUTTON_ID_COPY) EventCopyHex();
59
			if (btn == BUTTON_ID_PICK) pick_active = true;
58
			if (btn == BUTTON_ID_PICK) pick_active = true;
Line 60... Line 59...
60
			break;
59
			break;
61
 
60
 
62
		case evKey:
61
		case evKey:
63
			GetKeys();
62
			GetKeys();
64
			if (key_scancode == SCAN_CODE_ESC) ExitProcess();
63
			if (key_scancode == SCAN_CODE_ESC) ExitProcess();
65
			if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) 
64
			if (key_modifier&KEY_LCTRL) || (key_modifier&KEY_RCTRL) 
Line 66... Line 65...
66
				if (key_scancode==SCAN_CODE_KEY_C) EventCopyIntoSystemBuffer();
65
				if (key_scancode==SCAN_CODE_KEY_C) EventCopyHex();
67
			break;
66
			break;
68
		 
67
		 
Line 111... Line 110...
111
	DefineHiddenButton(_x+1, _y+1, _w-2, _h-2, BUTTON_ID_COPY);
110
	DefineHiddenButton(_x+1, _y+1, _w-2, _h-2, BUTTON_ID_COPY);
112
	DrawRectangle(_x, _y, _w, _h, _color);
111
	DrawRectangle(_x, _y, _w, _h, _color);
113
	WriteTextCenter(_x, _h-8/2 + _y, _w, _color, "Copy");
112
	WriteTextCenter(_x, _h-8/2 + _y, _w, _color, "Copy");
114
}
113
}
Line 115... Line 114...
115
 
114
 
116
struct _clipboard_pipet_data_text
115
void EventCopyHex()
117
{
-
 
118
	dword size;
-
 
119
	dword type;
-
 
120
	dword encoding; //encoding 0=UTF, 1=866, 2=1251
-
 
121
	char color_text[7];
-
 
122
};
-
 
123
 
-
 
124
void EventCopyIntoSystemBuffer()
-
 
125
{
-
 
126
	_clipboard_pipet_data_text clipboard_buf;
-
 
127
	clipboard_buf.size = 19;
-
 
128
	clipboard_buf.type = SLOT_DATA_TYPE_TEXT;
-
 
129
	clipboard_buf.encoding = 1; 
116
{
130
	strcpy(#clipboard_buf.color_text, #picked_color_string+4);
-
 
131
	clipboard_buf.color_text[7] = NULL;
-
 
132
	clipboard.SetSlotData(clipboard_buf.size, #clipboard_buf);
117
	Clipboard__CopyText(#picked_color_string+4);