Subversion Repositories Kolibri OS

Rev

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

Rev 6662 Rev 7037
Line 39... Line 39...
39
#define PANEL_BOTTOM_H 30
39
#define PANEL_BOTTOM_H 30
40
#define LIST_PADDING 12
40
#define LIST_PADDING 12
Line 41... Line 41...
41
 
41
 
Line 42... Line -...
42
proc_info Form;
-
 
43
 
-
 
44
Clipboard clipboard;
-
 
45
 
42
proc_info Form;
46
 
43
 
47
//===================================================//
44
//===================================================//
48
//                                                   //
45
//                                                   //
49
//                       CODE                        //
46
//                       CODE                        //
Line 50... Line 47...
50
//                                                   //
47
//                                                   //
51
//===================================================//
48
//===================================================//
52
 
49
 
53
void main()
50
void main()
54
{   
51
{   
55
	int id;
52
	int id;
56
	SetEventMask(0x27);
53
	SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
57
	load_dll(boxlib, #box_lib_init,0);
54
	load_dll(boxlib, #box_lib_init,0);
58
	loop() 
55
	loop() 
59
	{
56
	{
60
	  WaitEventTimeout(10);
57
	  WaitEventTimeout(10);
61
	  switch(EAX & 0xFF)
-
 
62
	  {
58
	  switch(EAX & 0xFF)
63
	  	case evMouse:
59
	  {
Line 64... Line 60...
64
			if (!CheckActiveProcess(Form.ID)) break;
60
	  	case evMouse:
65
			SelectList_ProcessMouse();
61
			SelectList_ProcessMouse();
Line 96... Line 92...
96
				);
92
				);
97
		 	DrawWindowContent();
93
		 	DrawWindowContent();
98
		 	break;
94
		 	break;
Line 99... Line 95...
99
 
95
 
100
		default:
96
		default:
101
			if (clipboard.GetSlotCount() > select_list.count) ClipViewSelectListDraw();
97
			if (Clipboard__GetSlotCount() > select_list.count) ClipViewSelectListDraw();
102
			break;
98
			break;
103
	  }
99
	  }
104
   }
100
   }
Line 117... Line 113...
117
	WriteText(select_list.x+select_list.w-68, select_list.y - 23, select_list.font_type, system.color.work_text, T_COLUMN_VIEW);
113
	WriteText(select_list.x+select_list.w-68, select_list.y - 23, select_list.font_type, system.color.work_text, T_COLUMN_VIEW);
118
 	ClipViewSelectListDraw();
114
 	ClipViewSelectListDraw();
119
 	SelectList_DrawBorder();
115
 	SelectList_DrawBorder();
120
}
116
}
Line -... Line 117...
-
 
117
 
-
 
118
dword slot_data;
-
 
119
struct clipboard_data
-
 
120
{
-
 
121
	dword	size;
-
 
122
	dword	type;
-
 
123
	dword	encoding;
-
 
124
	dword	content;
-
 
125
	dword	content_offset;
-
 
126
} cdata;
121
 
127
 
122
void SelectList_DrawLine(dword i)
128
void SelectList_DrawLine(dword i)
123
{
129
{
124
	int yyy, length, slot_data_type_number;
130
	int yyy, length, slot_data_type_number;
125
	dword line_text[2048];
131
	dword line_text[2048];
126
	dword size_kb;
132
	dword size_kb;
Line 127... Line 133...
127
	dword text_color = 0;
133
	dword text_color = 0;
-
 
134
 
-
 
135
	slot_data = Clipboard__GetSlotData(select_list.first + i);
-
 
136
	cdata.size = ESDWORD[slot_data];
-
 
137
	cdata.type = ESDWORD[slot_data+4];
-
 
138
	if (cdata.type==SLOT_DATA_TYPE_TEXT) || (cdata.type==SLOT_DATA_TYPE_TEXT_BLOCK)
-
 
139
		cdata.content_offset = 12;
-
 
140
	else 
-
 
141
		cdata.content_offset = 8;
128
 
142
	cdata.content = slot_data + cdata.content_offset; 
129
	clipboard.GetSlotData(select_list.first + i);
143
 
130
	yyy = i*select_list.item_h+select_list.y;
-
 
131
	WriteText(select_list.x+12, yyy+select_list.text_y, select_list.font_type, text_color, itoa(select_list.first + i));
144
	yyy = i*select_list.item_h+select_list.y;
132
	//WriteText(select_list.x+44, yyy+select_list.text_y, select_list.font_type, text_color, itoa(clipboard.slot_data.size));
145
	WriteText(select_list.x+12, yyy+select_list.text_y, select_list.font_type, text_color, itoa(select_list.first + i));
133
	size_kb = ConvertSizeToKb(clipboard.slot_data.size);
146
	size_kb = ConvertSizeToKb(cdata.size);
134
	WriteText(select_list.x+44, yyy+select_list.text_y, select_list.font_type, text_color, size_kb);
147
	WriteText(select_list.x+44, yyy+select_list.text_y, select_list.font_type, text_color, size_kb);
135
	slot_data_type_number = clipboard.slot_data.type;
148
	slot_data_type_number = cdata.type;
136
	WriteText(select_list.x+140, yyy+select_list.text_y, select_list.font_type, text_color, data_type[slot_data_type_number]);
149
	WriteText(select_list.x+140, yyy+select_list.text_y, select_list.font_type, text_color, data_type[slot_data_type_number]);
137
	WriteText(select_list.x+select_list.w - 88, yyy+select_list.text_y, select_list.font_type, 0x006597, T_VIEW_OPTIONS);
150
	WriteText(select_list.x+select_list.w - 88, yyy+select_list.text_y, select_list.font_type, 0x006597, T_VIEW_OPTIONS);
Line 138... Line 151...
138
	DefineButton(select_list.x+select_list.w - 95, yyy, 50, select_list.item_h, 100+i+BT_HIDE, NULL);
151
	DefineButton(select_list.x+select_list.w - 95, yyy, 50, select_list.item_h, 100+i+BT_HIDE, NULL);
139
	DefineButton(select_list.x+select_list.w - 95 + 51, yyy, 40, select_list.item_h, 300+i+BT_HIDE, NULL);
152
	DefineButton(select_list.x+select_list.w - 95 + 51, yyy, 40, select_list.item_h, 300+i+BT_HIDE, NULL);
140
 
153
 
141
	length = select_list.w-236 - 95 / select_list.font_w - 2;
154
	length = select_list.w-236 - 95 / select_list.font_w - 2;
142
	if (clipboard.slot_data.size-8 < length) length = clipboard.slot_data.size-8;
155
	if (cdata.size - cdata.content_offset < length) length = cdata.size - cdata.content_offset;
143
	memmov(#line_text, clipboard.slot_data.content, length);
156
	memmov(#line_text, cdata.content, length);
Line 153... Line 166...
153
		if (ESBYTE[in_str+i] == from_char) ESBYTE[in_str+i] = to_char;
166
		if (ESBYTE[in_str+i] == from_char) ESBYTE[in_str+i] = to_char;
154
	}
167
	}
155
	ESBYTE[in_str+length]=0;
168
	ESBYTE[in_str+length]=0;
156
}
169
}
Line 157... Line 170...
157
 
170
 
158
int SaveSlotContents(int slot_id) {
-
 
159
	clipboard.GetSlotData(slot_id);
171
int SaveSlotContents(dword size, off) {
160
	EAX = WriteFile(clipboard.slot_data.size, clipboard.slot_data.content, DEFAULT_SAVE_PATH);
172
	EAX = WriteFile(size, off, DEFAULT_SAVE_PATH);
161
	if (!EAX)
173
	if (!EAX)
162
	{
174
	{
163
		return true;
175
		return true;
164
	}
176
	}
Line 167... Line 179...
167
	 	return false;
179
	 	return false;
168
	}
180
	}
169
}
181
}
Line 170... Line 182...
170
 
182
 
171
void ClipViewSelectListDraw() {
183
void ClipViewSelectListDraw() {
172
	select_list.count = clipboard.GetSlotCount();
184
	select_list.count = Clipboard__GetSlotCount();
173
	SelectList_Draw();
185
	SelectList_Draw();
Line 174... Line 186...
174
}
186
}
175
 
187
 
Line 186... Line 198...
186
void EventDeleteLastSlot()
198
void EventDeleteLastSlot()
187
{
199
{
188
	int i;
200
	int i;
189
	for (i=0; i
201
	for (i=0; i
190
	for (i=0; i
202
	for (i=0; i
191
	clipboard.DelLastSlot();
203
	Clipboard__DeleteLastSlot();
192
	ClipViewSelectListDraw();
204
	ClipViewSelectListDraw();
193
}
205
}
Line 194... Line 206...
194
 
206
 
195
void EventDeleteAllSlots()
207
void EventDeleteAllSlots()
196
{
208
{
197
	while (clipboard.GetSlotCount()) clipboard.DelLastSlot();
209
	while (Clipboard__GetSlotCount()) Clipboard__DeleteLastSlot();
198
	ClipViewSelectListDraw();
210
	ClipViewSelectListDraw();
Line 199... Line 211...
199
}
211
}
200
 
212
 
201
void EventResetBufferLock() {
213
void EventResetBufferLock() {
202
	clipboard.ResetBlockingBuffer();
214
	Clipboard__ResetBlockingBuffer();
Line 203... Line 215...
203
	ClipViewSelectListDraw();
215
	ClipViewSelectListDraw();
-
 
216
}
-
 
217
 
-
 
218
void EventOpenAsText(int slot_id) {
204
}
219
	slot_data = Clipboard__GetSlotData(slot_id);
205
 
220
	cdata.size = ESDWORD[slot_data]-12;
Line 206... Line 221...
206
void EventOpenAsText(int slot_id) {
221
	cdata.content = slot_data+12;
-
 
222
	if (SaveSlotContents(cdata.size, cdata.content)) RunProgram("/sys/tinypad", DEFAULT_SAVE_PATH);
-
 
223
}
-
 
224
 
207
	if (SaveSlotContents(slot_id)) RunProgram("/sys/tinypad", DEFAULT_SAVE_PATH);
225
void EventOpenAsHex(int slot_id) {
208
}
226
	slot_data = Clipboard__GetSlotData(slot_id);
Line 209... Line 227...
209
 
227
	cdata.size = ESDWORD[slot_data];