File: MainCairoDrawing.cs

package info (click to toggle)
sysinfo 0.7-10
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,852 kB
  • ctags: 1,161
  • sloc: cs: 2,933; sh: 701; makefile: 115; xml: 98
file content (312 lines) | stat: -rw-r--r-- 13,093 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
// Filename: MainCairoDrawing.cs
// Contains functions to draw main cairo graphics

using System;
using Cairo;
using Gtk;

namespace Sysinfo {
	
	public class MainCairoDrawing {
		
		//intro top Welcome
		public void IntroTop(Cairo.Context g, Int32 width) {
			
			PointD p1,p2,p3,p4,s1,s2,s3,s4;
			p1 = new PointD (10,10); p2 = new PointD (width, 10); s1 = new PointD (width + 2, 12); s2 = new PointD (width + 2, 38);
			p3 = new PointD (width, 40); p4 = new PointD (10,40); s3 = new PointD (8, 38); s4 = new PointD (8, 12);
			    
		    g.Color = new Color (0.3, 0.4, 0.6, 1);
		    g.MoveTo (p1); g.LineTo (p2); g.LineTo (s1); g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
		    g.ClosePath (); g.LineWidth = 1; g.Stroke  ();
		   	
		    g.MoveTo (p1); g.LineTo (p2);  g.LineTo (s1); g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
			g.ClosePath ();
				
		    Cairo.Gradient pat = new Cairo.LinearGradient (80,10, 80, 80);
			pat.AddColorStop (0, new Cairo.Color (0.3,0.4,0.6,0.6));
			pat.AddColorStop (1, new Cairo.Color (0,0,0,1));
			g.Pattern = pat; g.FillPreserve  ();

			g.SetFontSize(22);
			g.SelectFontFace ("", FontSlant.Italic, FontWeight.Bold);
			g.MoveTo ( new PointD(22, 33));
			g.Color = new Color (1, 1, 1, 1);
			g.ShowText ("Welcome to");
			   
			((IDisposable) g.Target).Dispose ();                               
			((IDisposable) g).Dispose ();
		}
		
		//intro bottom tips
		public void IntroBottom(Cairo.Context g) {
			
			PointD p1,p2,p3,p4,s1,s2,s3,s4;
		    p1 = new PointD (30,10); p2 = new PointD (420, 10); s1 = new PointD (422, 12); s2 = new PointD (422, 88);
		    p3 = new PointD (420, 90); p4 = new PointD (30,90); s3 = new PointD (28, 88); s4 = new PointD (28, 12);
		    
		    g.Color = new Color (0.3, 0.4, 0.6, 0.8);
		    g.MoveTo (p1); g.LineTo (p2); g.LineTo (s1); g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
		    g.ClosePath (); g.LineWidth = 1; g.Stroke  ();
		   	
	        g.MoveTo (p1); g.LineTo (p2); g.LineTo (s1); g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
			g.ClosePath ();
			
		    Cairo.Gradient pat = new Cairo.LinearGradient (80,20, 80, 80);
	        pat.AddColorStop (0, new Cairo.Color (0.3,0.4,0.6,0));
	        pat.AddColorStop (1, new Cairo.Color (0.3,0.4,0.6,0.3));
	        g.Pattern = pat;
		    g.FillPreserve  ();
		    	    
		    
			g.Color = new Color (0, 0, 0, 0.8);
			g.SelectFontFace ("", FontSlant.Italic , FontWeight.Bold );
			g.SetFontSize(18);
			g.MoveTo ( new PointD(88, 28) );
			g.ShowText (".");
			g.MoveTo ( new PointD(88, 58) );
			g.ShowText (".");
			g.SelectFontFace ("", FontSlant.Italic , FontWeight.Normal );
			g.SetFontSize(10);
			g.MoveTo ( new PointD(98, 30) );
			g.ShowText ("Use the navigation on the left to choose different categories");
			g.MoveTo ( new PointD(98, 42) );
			g.ShowText ("of your computer and system information to display.");
			g.MoveTo ( new PointD(98, 60) );
			g.ShowText ("When you click on a category in the navigation, the dynamic");
			g.MoveTo ( new PointD(98, 72) );
		    g.ShowText ("information is automatically refreshed.");
					
			g.MoveTo ( new PointD(38, 35));
			g.Color = new Color (0.3, 0.4, 0.6, 1);
			g.SelectFontFace ("", FontSlant.Normal , FontWeight.Bold );
			g.SetFontSize(18);
			g.ShowText ("Tips");
			
			g.NewPath ();
			/*
			g.Color = new Color (0.3, 0.4, 0.6, 0.8);
			g.Scale (34, 34);
			g.LineWidth = 0.06;
			g.Arc (1.0, 1.0, 0.6, 0, 360);
			g.Stroke ();*/
		    
		   	((IDisposable) g.Target).Dispose ();                               
		   	((IDisposable) g).Dispose ();
		}
		
		//system top
		public void SystemTop(Cairo.Context g, Int32 width) {
			
		    PointD p1,p2,p3,p4,s1,s2,s3,s4;
		    p1 = new PointD (5,5); p2 = new PointD (width, 5); s1 = new PointD (width + 2, 7); s2 = new PointD (width + 2, 28);
		    p3 = new PointD (width, 30); p4 = new PointD (5,30); s3 = new PointD (3, 28); s4 = new PointD (3, 7);
		    
		    g.Color = new Color (0.3, 0.4, 0.6, 1);
		    g.MoveTo (p1); g.LineTo (p2);  g.LineTo (s1);  g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
		    g.ClosePath (); g.LineWidth = 1; g.Stroke  ();
		   	
	        g.MoveTo (p1); g.LineTo (p2); g.LineTo (s1); g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
			g.ClosePath ();
			
		    Cairo.Gradient pat = new Cairo.LinearGradient (80,10, 80, 60);
	        pat.AddColorStop (0, new Cairo.Color (0.3,0.4,0.6,0.6));
	       	pat.AddColorStop (1, new Cairo.Color (0,0,0,1));
	        g.Pattern = pat;
		    g.FillPreserve  ();

		    g.SetFontSize(17);
			g.SelectFontFace ("", FontSlant.Normal, FontWeight.Bold);
			g.MoveTo ( new PointD(12, 23));
			g.Color = new Color (1, 1, 1, 1);
			g.ShowText ("General system information");
		   
		   ((IDisposable) g.Target).Dispose ();                               
		   ((IDisposable) g).Dispose ();
		}
		
		//cpu top
		public void CpuTop(Cairo.Context g, Int32 width) {
			
			PointD p1,p2,p3,p4,s1,s2,s3,s4;
		    p1 = new PointD (5,5); p2 = new PointD (width, 5); s1 = new PointD (width + 2, 7); s2 = new PointD (width + 2, 28);
		    p3 = new PointD (width, 30); p4 = new PointD (5,30); s3 = new PointD (3, 28); s4 = new PointD (3, 7);
		    
		    g.Color = new Color (0.3, 0.4, 0.6, 1);
		    g.MoveTo (p1); g.LineTo (p2);  g.LineTo (s1);  g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
		    g.ClosePath (); g.LineWidth = 1; g.Stroke  ();
		   	
	        g.MoveTo (p1); g.LineTo (p2); g.LineTo (s1); g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
			g.ClosePath ();
			
		    Cairo.Gradient pat = new Cairo.LinearGradient (80,10, 80, 60);
	        pat.AddColorStop (0, new Cairo.Color (0.3,0.4,0.6,0.6));
	       	pat.AddColorStop (1, new Cairo.Color (0,0,0,1));
	        g.Pattern = pat;
		    g.FillPreserve  ();

		    g.SetFontSize(17);
			g.SelectFontFace ("", FontSlant.Normal, FontWeight.Bold);
			g.MoveTo ( new PointD(12, 23));
			g.Color = new Color (1, 1, 1, 1);
			g.ShowText ("CPU information");
		   
		   ((IDisposable) g.Target).Dispose ();                               
		   ((IDisposable) g).Dispose ();
		}
		
		
		//memory top
		public void MemoryTop(Cairo.Context g, Int32 width) {
			
			PointD p1,p2,p3,p4,s1,s2,s3,s4;
		    p1 = new PointD (5,5); p2 = new PointD (width, 5); s1 = new PointD (width + 2, 7); s2 = new PointD (width + 2, 28);
		    p3 = new PointD (width, 30); p4 = new PointD (5,30); s3 = new PointD (3, 28); s4 = new PointD (3, 7);
		    
		    g.Color = new Color (0.3, 0.4, 0.6, 1);
		    g.MoveTo (p1); g.LineTo (p2);  g.LineTo (s1);  g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
		    g.ClosePath (); g.LineWidth = 1; g.Stroke  ();
		   	
	        g.MoveTo (p1); g.LineTo (p2); g.LineTo (s1); g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
			g.ClosePath ();
			
		    Cairo.Gradient pat = new Cairo.LinearGradient (80,10, 80, 60);
	        pat.AddColorStop (0, new Cairo.Color (0.3,0.4,0.6,0.6));
	       	pat.AddColorStop (1, new Cairo.Color (0,0,0,1));
	        g.Pattern = pat;
		    g.FillPreserve  ();
			
		    g.SetFontSize(17);
			g.SelectFontFace ("", FontSlant.Normal, FontWeight.Bold);
			g.MoveTo ( new PointD(12, 23));
			g.Color = new Color (1, 1, 1, 1);
			g.ShowText ("Memory information");
		   
		   ((IDisposable) g.Target).Dispose ();                               
		   ((IDisposable) g).Dispose ();
		}
		
		//storage top
		public void StorageTop(Cairo.Context g, Int32 width) {
			
			PointD p1,p2,p3,p4,s1,s2,s3,s4;
		    p1 = new PointD (5,5); p2 = new PointD (width, 5); s1 = new PointD (width + 2, 7); s2 = new PointD (width + 2, 28);
		    p3 = new PointD (width, 30); p4 = new PointD (5,30); s3 = new PointD (3, 28); s4 = new PointD (3, 7);
		    
		    g.Color = new Color (0.3, 0.4, 0.6, 1);
		    g.MoveTo (p1); g.LineTo (p2);  g.LineTo (s1);  g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
		    g.ClosePath (); g.LineWidth = 1; g.Stroke  ();
		   	
	        g.MoveTo (p1); g.LineTo (p2); g.LineTo (s1); g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
			g.ClosePath ();
			
		    Cairo.Gradient pat = new Cairo.LinearGradient (80,10, 80, 60);
	        pat.AddColorStop (0, new Cairo.Color (0.3,0.4,0.6,0.6));
	       	pat.AddColorStop (1, new Cairo.Color (0,0,0,1));
	        g.Pattern = pat;
		    g.FillPreserve  ();
			
		    g.SetFontSize(17);
			g.SelectFontFace ("", FontSlant.Normal, FontWeight.Bold);
			g.MoveTo ( new PointD(12, 23));
			g.Color = new Color (1, 1, 1, 1);
			g.ShowText ("Storage information");
		   
		   ((IDisposable) g.Target).Dispose ();                               
		   ((IDisposable) g).Dispose ();
		}
		
		//partitions top
		public void PartitionsTop(Cairo.Context g, Int32 width) {
			
			PointD p1,p2,p3,p4,s1,s2,s3,s4;
		    p1 = new PointD (5,5); p2 = new PointD (width, 5); s1 = new PointD (width + 2, 7); s2 = new PointD (width + 2, 28);
		    p3 = new PointD (width, 30); p4 = new PointD (5,30); s3 = new PointD (3, 28); s4 = new PointD (3, 7);
		    
		    g.Color = new Color (0.3, 0.4, 0.6, 1);
		    g.MoveTo (p1); g.LineTo (p2);  g.LineTo (s1);  g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
		    g.ClosePath (); g.LineWidth = 1; g.Stroke  ();
		   	
	        g.MoveTo (p1); g.LineTo (p2); g.LineTo (s1); g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
			g.ClosePath ();
			
		    Cairo.Gradient pat = new Cairo.LinearGradient (80,10, 80, 60);
	        pat.AddColorStop (0, new Cairo.Color (0.3,0.4,0.6,0.6));
	       	pat.AddColorStop (1, new Cairo.Color (0,0,0,1));
	        g.Pattern = pat;
		    g.FillPreserve  ();
			
		    g.SetFontSize(17);
			g.SelectFontFace ("", FontSlant.Normal, FontWeight.Bold);
			g.MoveTo ( new PointD(12, 23));
			g.Color = new Color (1, 1, 1, 1);
			g.ShowText ("Partitions information");
		   
		   ((IDisposable) g.Target).Dispose ();                               
		   ((IDisposable) g).Dispose ();
		}
		
		//hardware top
		public void HardwareTop(Cairo.Context g, Int32 width) {
			
			PointD p1,p2,p3,p4,s1,s2,s3,s4;
		    p1 = new PointD (5,5); p2 = new PointD (width, 5); s1 = new PointD (width + 2, 7); s2 = new PointD (width + 2, 28);
		    p3 = new PointD (width, 30); p4 = new PointD (5,30); s3 = new PointD (3, 28); s4 = new PointD (3, 7);
		    
		    g.Color = new Color (0.3, 0.4, 0.6, 1);
		    g.MoveTo (p1); g.LineTo (p2);  g.LineTo (s1);  g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
		    g.ClosePath (); g.LineWidth = 1; g.Stroke  ();
		   	
	        g.MoveTo (p1); g.LineTo (p2); g.LineTo (s1); g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
			g.ClosePath ();
			
		    Cairo.Gradient pat = new Cairo.LinearGradient (80,10, 80, 60);
	        pat.AddColorStop (0, new Cairo.Color (0.3,0.4,0.6,0.6));
	       	pat.AddColorStop (1, new Cairo.Color (0,0,0,1));
	        g.Pattern = pat;
		    g.FillPreserve  ();
			
		    g.SetFontSize(17);
			g.SelectFontFace ("", FontSlant.Normal, FontWeight.Bold);
			g.MoveTo ( new PointD(12, 23));
			g.Color = new Color (1, 1, 1, 1);
			g.ShowText ("Hardware information");
		   
		   ((IDisposable) g.Target).Dispose ();                               
		   ((IDisposable) g).Dispose ();
		}
		
		//nvidia top
		public void NvidiaTop(Cairo.Context g, Int32 width) {
			
			PointD p1,p2,p3,p4,s1,s2,s3,s4;
		    p1 = new PointD (5,5); p2 = new PointD (width, 5); s1 = new PointD (width + 2, 7); s2 = new PointD (width + 2, 28);
		    p3 = new PointD (width, 30); p4 = new PointD (5,30); s3 = new PointD (3, 28); s4 = new PointD (3, 7);
		    
		    g.Color = new Color (0.3, 0.4, 0.6, 1);
		    g.MoveTo (p1); g.LineTo (p2);  g.LineTo (s1);  g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
		    g.ClosePath (); g.LineWidth = 1; g.Stroke  ();
		   	
	        g.MoveTo (p1); g.LineTo (p2); g.LineTo (s1); g.LineTo (s2); g.LineTo (p3); g.LineTo (p4); g.LineTo (s3); g.LineTo (s4); g.LineTo (p1);
			g.ClosePath ();
			
		    Cairo.Gradient pat = new Cairo.LinearGradient (80,10, 80, 60);
	        pat.AddColorStop (0, new Cairo.Color (0.3,0.4,0.6,0.6));
	       	pat.AddColorStop (1, new Cairo.Color (0,0,0,1));
	        g.Pattern = pat;
		    g.FillPreserve  ();
			
		    g.SetFontSize(17);
			g.SelectFontFace ("", FontSlant.Normal, FontWeight.Bold);
			g.MoveTo ( new PointD(12, 23));
			g.Color = new Color (1, 1, 1, 1);
			g.ShowText ("NVIDIA graphic card information");
		   
		   ((IDisposable) g.Target).Dispose ();                               
		   ((IDisposable) g).Dispose ();
		}
			
	}
}

//ghaefb