Subversion Repositories Kolibri OS

Rev

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

Rev 8833 Rev 8854
Line 41... Line 41...
41
	collection list;
41
	collection list;
42
	int dev_num;
42
	int dev_num;
43
	void Get();
43
	void Get();
44
	void Draw();
44
	void Draw();
45
	void Click();
45
	void DrawSelect();
-
 
46
	void DrawOptions();
-
 
47
	void Click();
46
} SystemDiscs=0;
48
} SystemDiscs=0;
47
 
49
 
Line 48... Line 50...
48
#define DEV_H 17
50
#define DEV_H 17
49
#define DEV_H_HOR 21
51
#define DEV_H_HOR 20
Line 50... Line 52...
50
 
52
 
51
void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name)
53
void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name)
52
{
54
{
53
	switch(disk_first_letter)
55
	switch(disk_first_letter)
Line 122... Line 124...
122
	}
124
	}
123
	free(devbuf);
125
	free(devbuf);
124
}
126
}
125
 
127
 
Line -... Line 128...
-
 
128
#define DDW 120
-
 
129
 
126
void _SystemDiscs::Draw()
130
void _SystemDiscs::Draw()
127
{    
131
{    
128
	char dev_name[15], disc_name[100], i, dev_icon, is_active, name_len;
132
	char dev_name[15], disc_name[100], i, dev_icon, is_active=0, name_len;
129
	int draw_y, draw_x;
133
	int draw_y, draw_x;
Line 130... Line 134...
130
	
134
	
Line -... Line 135...
-
 
135
	for (i=0; i<30; i++) DeleteButton(100+i);
-
 
136
 
131
	for (i=0; i<30; i++) DeleteButton(100+i);
137
	if (efm) { 
-
 
138
		if (active_panel==1) {
-
 
139
			DrawSelect(Form.cwidth/2-DDW, 10, #path, KFM_DEV_DROPDOWN_1);
-
 
140
			DrawSelect(Form.cwidth-DDW-2, 10, #inactive_path, KFM_DEV_DROPDOWN_2);
132
 
141
		} else {
133
	if (two_panels.checked) { draw_y = 41; draw_x =  2; }
142
			DrawSelect(Form.cwidth/2-DDW, 10, #inactive_path, KFM_DEV_DROPDOWN_1);
-
 
143
			DrawSelect(Form.cwidth-DDW-2, 10, #path, KFM_DEV_DROPDOWN_2);		
-
 
144
		}
-
 
145
		files.y = 40 + 17;
-
 
146
	} else { 
134
	                   else { draw_y = 74; draw_x = 17; }
147
		draw_y = 74; 
135
 
-
 
136
	for (i=0;i
148
		draw_x = 17; 
137
	{
149
		for (i=0;i
138
		strcpy(#dev_name, list.get(i));
150
			strcpy(#dev_name, list.get(i));
139
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
-
 
140
		if (strstr(#path, #dev_name)-#path==0) is_active=true; else is_active=false;
-
 
141
		if (two_panels.checked)
-
 
142
		{
-
 
143
			name_len = strlen(#dev_name)-1*8;
-
 
144
			DrawBar(draw_x, draw_y, name_len + 31, DEV_H_HOR, 0xFFFFFF);
-
 
145
			DefineButton(draw_x+2, draw_y, name_len + 27, DEV_H_HOR-1, 100+i+BT_HIDE,0xFFFFFF);
-
 
146
			_PutImage(draw_x + 5, draw_y+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
-
 
147
			WriteText(draw_x + 24, draw_y+3, 10110000b, 0, #dev_name+1);
-
 
148
			draw_x += name_len + 31;
-
 
149
			if (draw_x>=Form.cwidth-100) && (Form.cwidth) {
-
 
150
				DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, DEV_H_HOR, 0xFFFFFF);
-
 
151
				draw_x = 2;
-
 
152
				draw_y += DEV_H_HOR;
-
 
153
			}
-
 
154
		}
151
			GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
155
		else
152
			if (strstr(#path, #dev_name)!=0) is_active=true; else is_active=false;
156
		{
153
 
157
			DrawBar(draw_x,draw_y,6,DEV_H+1,0xFFFFFF);
154
			DrawBar(draw_x,draw_y,6,DEV_H+1,0xFFFFFF);
158
			DrawBar(draw_x+6+18,draw_y,160-6-18,DEV_H+1,0xFFFFFF);
155
			DrawBar(draw_x+6+18,draw_y,160-6-18,DEV_H+1,0xFFFFFF);
159
			DefineButton(draw_x,draw_y,159,16,100+i+BT_HIDE,0xFFFFFF);
156
			DefineButton(draw_x,draw_y,159,16,100+i+BT_HIDE,0xFFFFFF);
160
			if (show_dev_name.checked)
157
			if (show_dev_name.checked)
161
			{
158
			{
162
				strcat(#disc_name, #dev_name);
159
				strcat(#disc_name, #dev_name);
-
 
160
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#disc_name);
-
 
161
				WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name);
-
 
162
				//if (is_active) kfont.bold = true;
163
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#disc_name);
163
				//kfont.WriteIntoWindow(draw_x + 29, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #disc_name);
164
				WriteText(draw_x+29,draw_y+5,0x80,0,#disc_name);
164
				//kfont.bold = false;
165
			} else {
165
			} else {
166
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#dev_name);
166
				if (is_active) WriteText(draw_x+30,draw_y+5,0x80,0x555555,#dev_name);
167
				WriteText(draw_x+29,draw_y+5,0x80,0,#dev_name);
167
				WriteText(draw_x+29,draw_y+5,0x80,0,#dev_name);
168
			}
168
			}
169
			_PutImage(draw_x+6,draw_y, 18,17, is_active*7+dev_icon*17*18*3+#devices);
169
			_PutImage(draw_x+6,draw_y, 18,17, is_active*7+dev_icon*17*18*3+#devices);
-
 
170
			draw_y += DEV_H;			
170
			draw_y += DEV_H;
171
		}
-
 
172
		DrawBar(draw_x+6, draw_y, 18, 1, 0xFFFfff);
-
 
173
	}
171
		}
174
}
172
	}
175
 
-
 
176
void _SystemDiscs::DrawSelect(int draw_x, draw_y, path1, btid)
-
 
177
{
-
 
178
	char dev_name[15], disc_name[100], i, dev_icon, is_active=0;
-
 
179
	if (ESBYTE[path1+1]=='\0') {
-
 
180
		strcpy(#dev_name, "/root");
-
 
181
		dev_icon = 0;
-
 
182
	} else if (chrnum(path1, '/')==1) {
-
 
183
		strcpy(#dev_name, path1);
-
 
184
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
-
 
185
	} else for (i=0;i
-
 
186
		strcpy(#dev_name, list.get(i));
-
 
187
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
-
 
188
		if (strstr(path1, #dev_name)-path1==0) break;
-
 
189
	}
-
 
190
	DrawRectangle(draw_x-1, draw_y-1, DDW+2-DEV_H_HOR, DEV_H_HOR+1, sc.work_graph);
-
 
191
	DrawBar(draw_x, draw_y, DDW+1-DEV_H_HOR, DEV_H_HOR, 0xFFFFFF);
-
 
192
	_PutImage(draw_x + 5, draw_y+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
-
 
193
	kfont.WriteIntoWindow(draw_x + 24, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1);
-
 
194
	UnsafeDefineButton(draw_x, draw_y, DDW-1, DEV_H_HOR-1, btid+1+BT_HIDE,0xFFFFFF);
-
 
195
	DrawFlatButtonSmall(draw_x+DDW-DEV_H_HOR+1, draw_y-1, DEV_H_HOR-1, DEV_H_HOR+1, btid, "\x19");
173
	if (two_panels.checked)
196
 
-
 
197
	draw_x += DDW + 1;
-
 
198
	//DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, DEV_H_HOR, sc.work);
-
 
199
}
-
 
200
 
-
 
201
void _SystemDiscs::DrawOptions(int draw_x, draw_y)
-
 
202
{
174
	{
203
	char dev_name[15], disc_name[100], i, dev_icon, is_active=0;
-
 
204
		
-
 
205
	for (i=0; i<30; i++) DeleteButton(100+i);
-
 
206
 
175
		DrawBar(draw_x, draw_y, Form.cwidth - draw_x - 2, DEV_H_HOR, 0xFFFFFF);
207
	DrawPopup(draw_x, draw_y, DDW, list.count*DEV_H_HOR, 1, -1, sc.work_graph);
-
 
208
 
-
 
209
	for (i=0;i
-
 
210
		strcpy(#dev_name, list.get(i));
-
 
211
		GetDiskIconAndName(dev_name[1], #dev_icon, #disc_name);
176
		files.y = draw_y + DEV_H_HOR + 17;
212
		if (strstr(#path, #dev_name)!=0) is_active=true; else is_active=false;
-
 
213
 
-
 
214
		DrawBar(draw_x, draw_y, DDW, DEV_H_HOR, 0xFFFFFF);
-
 
215
		DefineButton(draw_x, draw_y, DDW, DEV_H_HOR-1, 100+i+BT_HIDE,0xFFFFFF);
-
 
216
		_PutImage(draw_x + 5, draw_y+2, 18,17, is_active*7+dev_icon*17*18*3+#devices);
-
 
217
		if (is_active) kfont.bold = true;
-
 
218
		kfont.WriteIntoWindow(draw_x + 24, draw_y+2, 0xFFFfff, 0x000000, kfont.size.pt, #dev_name+1);
177
	} else {
219
		kfont.bold = false;
178
		DrawBar(draw_x+6, draw_y, 18, 1, 0xFFFfff);
220
		draw_y += DEV_H_HOR;
Line 179... Line 221...
179
	}
221
	}
180
}
222
}