Subversion Repositories Kolibri OS

Rev

Rev 7275 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7274 leency 1
 
2
3
 
4
//                                                   //
5
//                       CODE                        //
6
//                                                   //
7
//===================================================//
8
9
 
10
char text_rows[4];
11
12
 
13
	0x10000000,sizeof(text_columns)-1,#text_columns,0, 1000000000000010b};
14
edit_box edit_rows = {60,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff,
15
	0x10000000,sizeof(text_rows)-1,#text_rows,0, 1000000000000000b};
16
17
 
18
19
 
20
{
21
	int id, butw;
22
23
 
24
	sprintf(#text_rows, "%i", image.rows);
25
	edit_columns.size = edit_columns.pos = edit_columns.shift = edit_columns.shift_old = strlen(#text_columns);
26
	edit_rows.size = edit_rows.pos = edit_rows.shift = edit_rows.shift_old = strlen(#text_rows);
27
28
 
29
	loop() switch(WaitEvent())
30
	{
31
	case evMouse:
32
		edit_box_mouse stdcall (#edit_columns);
33
		edit_box_mouse stdcall (#edit_rows);
34
		break;
35
36
 
37
		GetKeys();
38
39
 
40
		if (SCAN_CODE_ENTER == key_scancode) EventApplyClick();
41
		if (SCAN_CODE_TAB == key_scancode) EventTabClick();
42
43
 
44
		edit_box_key stdcall (#edit_columns);
45
		edit_box_key stdcall (#edit_rows);
46
		break;
47
48
 
49
		id = GetButtonID();
50
		if (CLOSE_BTN == id) ExitProcess();
51
		if (BTN_APPLY == id) EventApplyClick();
52
		break;
53
54
 
55
		DefineAndDrawWindow(Form.left+canvas.x + 100, Form.top+skin_height+canvas.y+40,
56
			200, 170, 0x34, system.color.work, "Canvas", 0);
57
		WriteText(20, 20, 0x90, system.color.work_text, "Width");
58
		WriteText(20, 60, 0x90, system.color.work_text, "Height");
59
		DrawStandartCaptButton(20, 100, BTN_APPLY, "OK");
60
		DrawEditBoxes();
61
	}
62
}
63
64
 
65
{
66
	DrawEditBoxPos(20+70, 20-4, #edit_columns);
67
	DrawEditBoxPos(20+70, 60-4, #edit_rows);
68
}
69
70
 
71
//                                                   //
72
//                      EVENTS                       //
73
//                                                   //
74
//===================================================//
75
76
 
77
{
78
	int new_rows = atoi(#text_rows);
79
	int new_columns = atoi(#text_columns);
80
	if (new_columns>MAX_CELL_SIZE) || (new_rows>MAX_CELL_SIZE) {
81
		notify("'Maximum icon size exceeded!\nPlease, try something less or equal to 256x256.' -E");
82
		return;
83
	}
84
	image.create(new_rows, new_columns);
85
	actionsHistory.init();
86
	ActivateWindow(GetProcessSlot(Form.ID));
87
	ExitProcess();
88
}
89
90
 
91
{
92
	if (edit_columns.flags & 0b10) { edit_columns.flags -= 0b10; edit_rows.flags += 0b10; }
93
	else { edit_columns.flags += 0b10; edit_rows.flags -= 0b10; }
94
	DrawEditBoxes();
95
}
96