[chronojump] First concept of JumpsProfile graph
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] First concept of JumpsProfile graph
- Date: Mon, 27 Jun 2016 23:55:51 +0000 (UTC)
commit b77c4f3ddbfba23f90123cb1b74f2f399e2b8492
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Jun 28 01:55:21 2016 +0200
First concept of JumpsProfile graph
glade/chronojump.glade | 106 +++++++++++++++++++++++++++++++++++++-
src/Makefile.am | 1 +
src/gui/chronojump.cs | 15 +++---
src/gui/jumpsProfile.cs | 130 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 242 insertions(+), 10 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index c383a3f..1325075 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -11970,6 +11970,52 @@ on current Chronojump version.</property>
<property name="type">tab</property>
</packing>
</child>
+ <child>
+ <widget class="GtkVBox" id="vbox82">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkLabel" id="label168">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">Chronojump Jumps Profile</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">10</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkDrawingArea" id="drawingarea_jumps_profile">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <signal name="expose_event"
handler="on_drawingarea_jumps_profile_expose_event" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label164">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">Jumps profile</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -16718,6 +16764,9 @@ on current Chronojump version.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -21434,6 +21483,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -22631,6 +22683,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -24320,6 +24375,9 @@ by you</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkButton" id="button_video_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -25066,6 +25124,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -38200,6 +38261,24 @@ options</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -40951,6 +41030,18 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -42179,9 +42270,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<placeholder/>
</child>
<child>
- <placeholder/>
- </child>
- <child>
<widget class="GtkLabel" id="label218">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -43378,6 +43466,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -47461,6 +47552,9 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -48322,6 +48416,9 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -49198,6 +49295,9 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/Makefile.am b/src/Makefile.am
index 2656f58..ca9fdbe 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,6 +18,7 @@ SOURCES = \
gui/event.cs\
gui/executeAuto.cs\
gui/jump.cs\
+ gui/jumpsProfile.cs\
gui/jumpType.cs\
gui/run.cs\
gui/runType.cs\
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 753e856..ffc82b2 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -1335,7 +1335,7 @@ public partial class ChronoJumpWindow
"http://www.chronojump.org/server.html" + "\n" +
"http://www.chronojump.org/server_es.html");
else
- System.Diagnostics.Process.Start(Constants.ChronojumpWebsite +
Path.DirectorySeparatorChar + "server.html");
+ System.Diagnostics.Process.Start(Constants.ChronojumpWebsite +
System.IO.Path.DirectorySeparatorChar + "server.html");
}
/*
@@ -2494,9 +2494,9 @@ public partial class ChronoJumpWindow
string.Format(Catalog.GetString("Could not delete file:\n{0}"),
runningFileName));
}
- if(File.Exists(Util.GetDatabaseTempDir() + Path.DirectorySeparatorChar + "chronojump.db"))
- File.Move(Util.GetDatabaseTempDir() + Path.DirectorySeparatorChar + "chronojump.db",
- Util.GetDatabaseDir() + Path.DirectorySeparatorChar + "chronojump.db");
+ if(File.Exists(Util.GetDatabaseTempDir() + System.IO.Path.DirectorySeparatorChar +
"chronojump.db"))
+ File.Move(Util.GetDatabaseTempDir() + System.IO.Path.DirectorySeparatorChar +
"chronojump.db",
+ Util.GetDatabaseDir() + System.IO.Path.DirectorySeparatorChar +
"chronojump.db");
LogB.Information("Bye2!");
@@ -6372,9 +6372,9 @@ LogB.Debug("X");
Catalog.GetString("Newer versions will be on this site:") +"\n" +
"<i>http://www.chronojump.org/multimedia.html</i>");
*/
- LogB.Information("Opening manual at: " + Path.GetFullPath(Util.GetManualDir()));
+ LogB.Information("Opening manual at: " + System.IO.Path.GetFullPath(Util.GetManualDir()));
try {
- System.Diagnostics.Process.Start(Path.GetFullPath(Util.GetManualDir()));
+ System.Diagnostics.Process.Start(System.IO.Path.GetFullPath(Util.GetManualDir()));
} catch {
new DialogMessage(Constants.MessageTypes.WARNING, "Sorry, manual folder does not
exist.");
}
@@ -6455,7 +6455,7 @@ LogB.Debug("X");
private void on_preferences_debug_mode_start (object o, EventArgs args) {
//first delete debug file
- Util.FileDelete(Path.GetTempPath() + "chronojump-debug.txt");
+ Util.FileDelete(System.IO.Path.GetTempPath() + "chronojump-debug.txt");
encoderRProcCapture.Debug = true;
encoderRProcAnalyze.Debug = true;
@@ -6897,6 +6897,7 @@ LogB.Debug("X");
button_video_play_this_test.Sensitive = recordedVideo;
}
+
/*
* voluntary crash for testing purposes
*/
diff --git a/src/gui/jumpsProfile.cs b/src/gui/jumpsProfile.cs
new file mode 100644
index 0000000..d20fb9e
--- /dev/null
+++ b/src/gui/jumpsProfile.cs
@@ -0,0 +1,130 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * ChronoJump is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * ChronoJump is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Copyright (C) 2004-2016 Xavier de Blas <xaviblas gmail com>
+ */
+
+using System;
+using Gtk;
+using Glade;
+using Cairo;
+
+partial class ChronoJumpWindow
+{
+ [Widget] Gtk.DrawingArea drawingarea_jumps_profile;
+
+ private void on_drawingarea_jumps_profile_expose_event (object o, ExposeEventArgs args)
+ {
+ DrawingArea area = (DrawingArea) o;
+ Cairo.Context g = Gdk.CairoHelper.Create (area.GdkWindow);
+
+ jp_plotArc(100, 100, 50, 0, 0.25, g, new Cairo.Color(1,0,0));
+ jp_plotArc(100, 100, 50, .25, .75, g, new Cairo.Color(0,1,0));
+ jp_plotArc(100, 100, 50, .75, 2, g, new Cairo.Color(0,0,1));
+
+ //palette: http://www.colourlovers.com/palette/7991/%28not_so%29_still_life
+ jp_plotArc(300, 200, 150, 0, 0.25, g, jp_colorFromRGB(90,68,102));
+ jp_plotArc(300, 200, 150, .25, .75, g, jp_colorFromRGB(240,57,43));
+ jp_plotArc(300, 200, 150, .75, 1.25, g, jp_colorFromRGB(254,176,20));
+ jp_plotArc(300, 200, 150, 1.25, 1.5, g, jp_colorFromRGB(250,209,7));
+ jp_plotArc(300, 200, 150, 1.5, 2, g, jp_colorFromRGB(235,235,207));
+
+ int width = 40;
+ int height = 24;
+ //R seq(from=50,to=(350-24),length.out=5)
+ //[1] 50 119 188 257 326
+ jp_drawRoundedRectangle (500, 50, width, height, 3, g, jp_colorFromRGB(90,68,102));
+ jp_drawRoundedRectangle (500, 119, width, height, 4, g, jp_colorFromRGB(240,57,43));
+ jp_drawRoundedRectangle (500, 188, width, height, 5, g, jp_colorFromRGB(254,176,20));
+ jp_drawRoundedRectangle (500, 257, width, height, 6, g, jp_colorFromRGB(250,209,7));
+ jp_drawRoundedRectangle (500, 326, width, height, 7, g, jp_colorFromRGB(235,235,207));
+
+ g.SelectFontFace("Helvetica", Cairo.FontSlant.Normal, Cairo.FontWeight.Normal);
+ int textHeight = 12;
+ g.SetFontSize(textHeight);
+
+ jp_printText(560, 50, height, textHeight, "Index 1", g);
+ jp_printText(560, 119, height, textHeight, "Index 2", g);
+ jp_printText(560, 188, height, textHeight, "Index 3", g);
+ jp_printText(560, 257, height, textHeight, "Index 4", g);
+ jp_printText(560, 326, height, textHeight, "Index 5", g);
+
+ g.GetTarget().Dispose ();
+ g.Dispose ();
+ }
+
+ private void jp_plotArc(int centerx, int centery, int radius, double start, double end,
+ Cairo.Context g, Cairo.Color color)
+ {
+ //pie chart
+ g.MoveTo (centerx, centery);
+ g.Arc(centerx, centery, radius, start * Math.PI, end * Math.PI);
+ g.ClosePath();
+ g.Color = color;
+ g.FillPreserve ();
+
+ g.Color = new Cairo.Color (0,0,0);
+ g.LineWidth = 2;
+ g.Stroke ();
+ }
+
+ private void jp_printText(int x, int y, int height, int textHeight, string text, Cairo.Context g) {
+ g.MoveTo(x, ((y+y+height)/2) + textHeight/2.0);
+ g.ShowText(text);
+ }
+
+ //http://www.mono-project.com/docs/tools+libraries/libraries/Mono.Cairo/cookbook/
+ private void jp_drawRoundedRectangle (double x, double y, double width, double height,
+ double radius, Cairo.Context g, Cairo.Color color)
+ {
+ g.Save ();
+
+ if ((radius > height / 2) || (radius > width / 2))
+ radius = jp_min (height / 2, width / 2);
+
+ g.MoveTo (x, y + radius);
+ g.Arc (x + radius, y + radius, radius, Math.PI, -Math.PI / 2);
+ g.LineTo (x + width - radius, y);
+ g.Arc (x + width - radius, y + radius, radius, -Math.PI / 2, 0);
+ g.LineTo (x + width, y + height - radius);
+ g.Arc (x + width - radius, y + height - radius, radius, 0, Math.PI / 2);
+ g.LineTo (x + radius, y + height);
+ g.Arc (x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
+ g.ClosePath ();
+ g.Restore ();
+
+ g.Color = color;
+ g.FillPreserve ();
+ g.Color = new Cairo.Color (0, 0, 0);
+ g.LineWidth = 2;
+ g.Stroke ();
+ }
+
+ private double jp_min (params double[] arr)
+ {
+ int minp = 0;
+ for (int i = 1; i < arr.Length; i++)
+ if (arr[i] < arr[minp])
+ minp = i;
+
+ return arr[minp];
+ }
+
+ private Cairo.Color jp_colorFromRGB(int red, int green, int blue) {
+ return new Cairo.Color(red/255.0, green/255.0, blue/255.0);
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]