"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "examples/markers.c" between
gtkdatabox-0.9.3.1.tar.gz and gtkdatabox-1.0.0.tar.gz

About: GtkDatabox is a Gtk+-widget for live display of large amounts of fluctuating numerical data.

markers.c  (gtkdatabox-0.9.3.1):markers.c  (gtkdatabox-1.0.0)
skipping to change at line 17 skipping to change at line 17
* as published by the Free Software Foundation; either version 2.1 * as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details. * GNU Lesser General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include <stdio.h> #include <stdio.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gtkdatabox.h> #include <gtkdatabox.h>
#include <gtkdatabox_points.h> #include <gtkdatabox_points.h>
#include <gtkdatabox_markers.h> #include <gtkdatabox_markers.h>
#include <math.h> #include <math.h>
#define POINTS 24 #define POINTS 24
skipping to change at line 88 skipping to change at line 88
GtkWidget *box2; GtkWidget *box2;
GtkWidget *close_button; GtkWidget *close_button;
GtkWidget *box; GtkWidget *box;
GtkWidget *table; GtkWidget *table;
GtkWidget *label; GtkWidget *label;
GtkWidget *separator; GtkWidget *separator;
gfloat *X; gfloat *X;
gfloat *Y; gfloat *Y;
gint i; gint i;
GtkDataboxGraph *graph; GtkDataboxGraph *graph;
GdkColor color; GdkRGBA color;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL); window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_size_request (window, 600, 600); gtk_widget_set_size_request (window, 600, 600);
g_signal_connect (GTK_OBJECT (window), "destroy", g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL); G_CALLBACK (gtk_main_quit), NULL);
gtk_window_set_title (GTK_WINDOW (window), "GtkDatabox: Markers"); gtk_window_set_title (GTK_WINDOW (window), "GtkDatabox: Markers");
gtk_container_set_border_width (GTK_CONTAINER (window), 0); gtk_container_set_border_width (GTK_CONTAINER (window), 0);
box1 = gtk_vbox_new (FALSE, 0); box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), box1); gtk_container_add (GTK_CONTAINER (window), box1);
label = label =
gtk_label_new gtk_label_new
("Some markerss (green) are shown below.\nThe text corresponds to the posi tion of the text, relative to the markers.\n\nThere are also some texts (yellow) .\n\nData points are red\n"); ("Some markers (green) are shown below.\nThe text corresponds to the posit ion of the text, relative to the markers.\n\nThere are also some texts (yellow). \n\nData points are red\n");
gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
separator = gtk_hseparator_new (); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, FALSE, 0);
gtk_databox_create_box_with_scrollbars_and_rulers (&box, &table, gtk_databox_create_box_with_scrollbars_and_rulers (&box, &table,
TRUE, TRUE, TRUE, TRUE); TRUE, TRUE, TRUE, TRUE);
gtk_box_pack_start (GTK_BOX (box1), table, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box1), table, TRUE, TRUE, 0);
color.red = 16383; gtk_databox_set_bg_color (GTK_DATABOX (box), "#545454");
color.green = 16383;
color.blue = 16383;
gtk_widget_modify_bg (box, GTK_STATE_NORMAL, &color);
X = g_new0 (gfloat, 20 + 4 + 5); X = g_new0 (gfloat, 20 + 4 + 5);
Y = g_new0 (gfloat, 20 + 4 + 5); Y = g_new0 (gfloat, 20 + 4 + 5);
for (i = 0; i < 20 + 4 + 5; ++i) for (i = 0; i < 20 + 4 + 5; ++i)
{ {
X[i] = i % 4; X[i] = i % 4;
Y[i] = i / 4; Y[i] = i / 4;
} }
X[20] = -0.5; X[20] = -0.5;
skipping to change at line 146 skipping to change at line 143
Y[24] = -1.; Y[24] = -1.;
X[25] = -1.; X[25] = -1.;
Y[25] = +5.; Y[25] = +5.;
X[26] = +4.; X[26] = +4.;
Y[26] = -1.; Y[26] = -1.;
X[27] = +4.; X[27] = +4.;
Y[27] = +5.; Y[27] = +5.;
X[28] = +1.5; X[28] = +1.5;
Y[28] = +2.; Y[28] = +2.;
color.red = 65535; color.red = 1;
color.green = 0; color.green = 0;
color.blue = 0; color.blue = 0;
color.alpha = 1;
graph = gtk_databox_points_new (20 + 4 + 5, X, Y, &color, 3); graph = gtk_databox_points_new (20 + 4 + 5, X, Y, &color, 3);
gtk_databox_graph_add (GTK_DATABOX (box), graph); gtk_databox_graph_add (GTK_DATABOX (box), graph);
color.red = 0; color.red = 0;
color.green = 65535; color.green = 1;
color.blue = 0; color.blue = 0;
color.alpha = 1;
graph = gtk_databox_markers_new (20, X, Y, &color, 15, graph = gtk_databox_markers_new (20, X, Y, &color, 15,
GTK_DATABOX_MARKERS_TRIANGLE); GTK_DATABOX_MARKERS_TRIANGLE);
gtk_databox_graph_add (GTK_DATABOX (box), graph); gtk_databox_graph_add (GTK_DATABOX (box), graph);
setM (graph, 0, GTK_DATABOX_MARKERS_W, GTK_DATABOX_MARKERS_TEXT_W, "West", FA LSE); setM (graph, 0, GTK_DATABOX_MARKERS_W, GTK_DATABOX_MARKERS_TEXT_W, "West", FA LSE);
setM (graph, 1, GTK_DATABOX_MARKERS_N, GTK_DATABOX_MARKERS_TEXT_N, "North", F ALSE); setM (graph, 1, GTK_DATABOX_MARKERS_N, GTK_DATABOX_MARKERS_TEXT_N, "North", F ALSE);
setM (graph, 2, GTK_DATABOX_MARKERS_S, GTK_DATABOX_MARKERS_TEXT_S, "South", F ALSE); setM (graph, 2, GTK_DATABOX_MARKERS_S, GTK_DATABOX_MARKERS_TEXT_S, "South", F ALSE);
setM (graph, 3, GTK_DATABOX_MARKERS_E, GTK_DATABOX_MARKERS_TEXT_E, "East", FA LSE); setM (graph, 3, GTK_DATABOX_MARKERS_E, GTK_DATABOX_MARKERS_TEXT_E, "East", FA LSE);
skipping to change at line 195 skipping to change at line 194
graph = gtk_databox_markers_new (4, X + 20, Y + 20, &color, 1, graph = gtk_databox_markers_new (4, X + 20, Y + 20, &color, 1,
GTK_DATABOX_MARKERS_DASHED_LINE); GTK_DATABOX_MARKERS_DASHED_LINE);
gtk_databox_graph_add (GTK_DATABOX (box), graph); gtk_databox_graph_add (GTK_DATABOX (box), graph);
setL (graph, 0, GTK_DATABOX_MARKERS_N, GTK_DATABOX_MARKERS_TEXT_W, "West", TR UE); setL (graph, 0, GTK_DATABOX_MARKERS_N, GTK_DATABOX_MARKERS_TEXT_W, "West", TR UE);
setL (graph, 1, GTK_DATABOX_MARKERS_E, GTK_DATABOX_MARKERS_TEXT_S, "South", T RUE); setL (graph, 1, GTK_DATABOX_MARKERS_E, GTK_DATABOX_MARKERS_TEXT_S, "South", T RUE);
setL (graph, 2, GTK_DATABOX_MARKERS_W, GTK_DATABOX_MARKERS_TEXT_N, "North", T RUE); setL (graph, 2, GTK_DATABOX_MARKERS_W, GTK_DATABOX_MARKERS_TEXT_N, "North", T RUE);
setL (graph, 3, GTK_DATABOX_MARKERS_S, GTK_DATABOX_MARKERS_TEXT_E, "East", TR UE); setL (graph, 3, GTK_DATABOX_MARKERS_S, GTK_DATABOX_MARKERS_TEXT_E, "East", TR UE);
color.red = 65535; color.red = 1;
color.green = 65535; color.green = 1;
color.blue = 0; color.blue = 0;
color.alpha = 1;
graph = gtk_databox_markers_new (5, X + 20 + 4, Y + 20 + 4, &color, 1, graph = gtk_databox_markers_new (5, X + 20 + 4, Y + 20 + 4, &color, 1,
GTK_DATABOX_MARKERS_NONE); GTK_DATABOX_MARKERS_NONE);
gtk_databox_graph_add (GTK_DATABOX (box), graph); gtk_databox_graph_add (GTK_DATABOX (box), graph);
setT (graph, 0, GTK_DATABOX_MARKERS_TEXT_N, "North", FALSE); setT (graph, 0, GTK_DATABOX_MARKERS_TEXT_N, "North", FALSE);
setT (graph, 1, GTK_DATABOX_MARKERS_TEXT_E, "East", FALSE); setT (graph, 1, GTK_DATABOX_MARKERS_TEXT_E, "East", FALSE);
setT (graph, 2, GTK_DATABOX_MARKERS_TEXT_S, "South", FALSE); setT (graph, 2, GTK_DATABOX_MARKERS_TEXT_S, "South", FALSE);
setT (graph, 3, GTK_DATABOX_MARKERS_TEXT_W, "West", FALSE); setT (graph, 3, GTK_DATABOX_MARKERS_TEXT_W, "West", FALSE);
setT (graph, 4, GTK_DATABOX_MARKERS_TEXT_CENTER, "Centered", TRUE); setT (graph, 4, GTK_DATABOX_MARKERS_TEXT_CENTER, "Centered", TRUE);
gtk_databox_auto_rescale (GTK_DATABOX (box), 0.05); gtk_databox_auto_rescale (GTK_DATABOX (box), 0.05);
separator = gtk_hseparator_new (); separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
box2 = gtk_vbox_new (FALSE, 10); box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_container_set_border_width (GTK_CONTAINER (box2), 10); gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
gtk_box_pack_end (GTK_BOX (box1), box2, FALSE, TRUE, 0); gtk_box_pack_end (GTK_BOX (box1), box2, FALSE, TRUE, 0);
close_button = gtk_button_new_with_label ("close"); close_button = gtk_button_new_with_label ("close");
g_signal_connect_swapped (GTK_OBJECT (close_button), "clicked", g_signal_connect_swapped (G_OBJECT (close_button), "clicked",
G_CALLBACK (gtk_main_quit), GTK_OBJECT (box)); G_CALLBACK (gtk_main_quit), G_OBJECT (box));
gtk_box_pack_start (GTK_BOX (box2), close_button, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (box2), close_button, TRUE, TRUE, 0);
gtk_widget_set_can_default(close_button, GTK_CAN_DEFAULT); gtk_widget_set_can_default(close_button, TRUE);
gtk_widget_grab_default (close_button); gtk_widget_grab_default (close_button);
gtk_widget_show_all (window); gtk_widget_show_all (window);
} }
gint gint
main (gint argc, char *argv[]) main (gint argc, char *argv[])
{ {
gtk_init (&argc, &argv); gtk_init (&argc, &argv);
 End of changes. 17 change blocks. 
19 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)