Merge pull request #72 from gergelypolonkai/point-tables
Add point tables
This commit is contained in:
commit
89396da4ab
@ -48,6 +48,7 @@ struct _AgWindowPrivate {
|
|||||||
|
|
||||||
GtkWidget *aspect_table;
|
GtkWidget *aspect_table;
|
||||||
GtkWidget *chart_web_view;
|
GtkWidget *chart_web_view;
|
||||||
|
GtkWidget *points_eq;
|
||||||
GtkAdjustment *year_adjust;
|
GtkAdjustment *year_adjust;
|
||||||
|
|
||||||
AgSettings *settings;
|
AgSettings *settings;
|
||||||
@ -402,6 +403,79 @@ ag_window_redraw_aspect_table(AgWindow *window)
|
|||||||
gtk_widget_show_all(priv->aspect_table);
|
gtk_widget_show_all(priv->aspect_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ag_window_set_element_point(AgWindow *window,
|
||||||
|
GsweElement element,
|
||||||
|
guint left,
|
||||||
|
guint top)
|
||||||
|
{
|
||||||
|
guint points;
|
||||||
|
GtkWidget *label;
|
||||||
|
gchar *points_string;
|
||||||
|
AgWindowPrivate *priv = ag_window_get_instance_private(window);
|
||||||
|
|
||||||
|
points = gswe_moment_get_element_points(
|
||||||
|
GSWE_MOMENT(priv->chart),
|
||||||
|
element
|
||||||
|
);
|
||||||
|
|
||||||
|
if ((label = gtk_grid_get_child_at(
|
||||||
|
GTK_GRID(priv->points_eq),
|
||||||
|
left, top
|
||||||
|
)) == NULL) {
|
||||||
|
label = gtk_label_new("");
|
||||||
|
gtk_grid_attach(GTK_GRID(priv->points_eq), label, left, top, 1, 1);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
points_string = g_strdup_printf("%d", points);
|
||||||
|
gtk_label_set_text(GTK_LABEL(label), points_string);
|
||||||
|
g_free(points_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ag_window_set_quality_point(AgWindow *window,
|
||||||
|
GsweQuality quality,
|
||||||
|
guint left,
|
||||||
|
guint top)
|
||||||
|
{
|
||||||
|
guint points;
|
||||||
|
GtkWidget *label;
|
||||||
|
gchar *points_string;
|
||||||
|
AgWindowPrivate *priv = ag_window_get_instance_private(window);
|
||||||
|
|
||||||
|
points = gswe_moment_get_quality_points(
|
||||||
|
GSWE_MOMENT(priv->chart),
|
||||||
|
quality
|
||||||
|
);
|
||||||
|
|
||||||
|
if ((label = gtk_grid_get_child_at(
|
||||||
|
GTK_GRID(priv->points_eq),
|
||||||
|
left, top
|
||||||
|
)) == NULL) {
|
||||||
|
label = gtk_label_new("");
|
||||||
|
gtk_grid_attach(GTK_GRID(priv->points_eq), label, left, top, 1, 1);
|
||||||
|
gtk_widget_show(label);
|
||||||
|
}
|
||||||
|
|
||||||
|
points_string = g_strdup_printf("%d", points);
|
||||||
|
gtk_label_set_text(GTK_LABEL(label), points_string);
|
||||||
|
g_free(points_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ag_window_redraw_points_table(AgWindow *window)
|
||||||
|
{
|
||||||
|
ag_window_set_element_point(window, GSWE_ELEMENT_FIRE, 4, 1);
|
||||||
|
ag_window_set_element_point(window, GSWE_ELEMENT_EARTH, 4, 2);
|
||||||
|
ag_window_set_element_point(window, GSWE_ELEMENT_AIR, 4, 3);
|
||||||
|
ag_window_set_element_point(window, GSWE_ELEMENT_WATER, 4, 4);
|
||||||
|
|
||||||
|
ag_window_set_quality_point(window, GSWE_QUALITY_CARDINAL, 1, 5);
|
||||||
|
ag_window_set_quality_point(window, GSWE_QUALITY_FIX, 2, 5);
|
||||||
|
ag_window_set_quality_point(window, GSWE_QUALITY_MUTABLE, 3, 5);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ag_window_redraw_chart:
|
* ag_window_redraw_chart:
|
||||||
* @window: the #AgWindow to operate on
|
* @window: the #AgWindow to operate on
|
||||||
@ -441,6 +515,7 @@ ag_window_redraw_chart(AgWindow *window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ag_window_redraw_aspect_table(window);
|
ag_window_redraw_aspect_table(window);
|
||||||
|
ag_window_redraw_points_table(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -1387,6 +1462,7 @@ ag_window_display_changed(GSettings *settings, gchar *key, AgWindow *window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ag_window_redraw_aspect_table(window);
|
ag_window_redraw_aspect_table(window);
|
||||||
|
ag_window_redraw_points_table(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1991,6 +2067,11 @@ ag_window_class_init(AgWindowClass *klass)
|
|||||||
AgWindow,
|
AgWindow,
|
||||||
selection_toolbar
|
selection_toolbar
|
||||||
);
|
);
|
||||||
|
gtk_widget_class_bind_template_child_private(
|
||||||
|
widget_class,
|
||||||
|
AgWindow,
|
||||||
|
points_eq
|
||||||
|
);
|
||||||
|
|
||||||
gtk_widget_class_bind_template_callback(
|
gtk_widget_class_bind_template_callback(
|
||||||
widget_class,
|
widget_class,
|
||||||
|
@ -820,11 +820,130 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkScrolledWindow" id="points_tab">
|
<object class="GtkGrid" id="tab_points">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="shadow_type">none</property>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkGrid" id="points_table">
|
<object class="GtkFrame">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label_xalign">0</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkGrid" id="points_eq">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="column_homogeneous">True</property>
|
||||||
|
<property name="column_spacing">5</property>
|
||||||
|
<property name="row_homogeneous">True</property>
|
||||||
|
<property name="row_spacing">5</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Fire</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Earth</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Air</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">3</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Water</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">4</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Points</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">0</property>
|
||||||
|
<property name="top_attach">5</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Cardinal</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Fixed</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">2</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Mutable</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">3</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Points</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">4</property>
|
||||||
|
<property name="top_attach">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child type="label">
|
||||||
|
<object class="GtkLabel">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Elements and Qualities</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
Loading…
Reference in New Issue
Block a user