[gimp/wip/animation: 55/197] plug-ins: reset framerate warning when it comes back to acceptable rate.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/animation: 55/197] plug-ins: reset framerate warning when it comes back to acceptable rate.
- Date: Sat, 7 Oct 2017 03:03:01 +0000 (UTC)
commit 03b3d46a03f9b9f1abcbfa8efe8f86a1f6ce2c15
Author: Jehan <jehan girinstud io>
Date: Mon Apr 11 03:53:37 2016 +0200
plug-ins: reset framerate warning when it comes back to acceptable rate.
plug-ins/animation-play/core/animation.c | 11 ++++--
plug-ins/animation-play/widgets/animation-dialog.c | 37 +++++++++++++------
2 files changed, 33 insertions(+), 15 deletions(-)
---
diff --git a/plug-ins/animation-play/core/animation.c b/plug-ins/animation-play/core/animation.c
index 3faefcd..aac999e 100644
--- a/plug-ins/animation-play/core/animation.c
+++ b/plug-ins/animation-play/core/animation.c
@@ -279,9 +279,8 @@ animation_class_init (AnimationClass *klass)
* @actual_fps: the current playback framerate in fps.
*
* The ::low-framerate signal is emitted when the playback framerate
- * is lower than expected.
- * The @actual_fps is not necessarily meaningful for animation with
- * various frame duration.
+ * is lower than expected. It is also emitted once when the framerate
+ * comes back to acceptable rate.
*/
animation_signals[LOW_FRAMERATE] =
g_signal_new ("low-framerate-playback",
@@ -791,6 +790,12 @@ animation_advance_frame_callback (Animation *animation)
}
else
{
+ if (prev_low_framerate)
+ {
+ /* Let's reset framerate warning. */
+ g_signal_emit (animation, animation_signals[LOW_FRAMERATE], 0,
+ animation_get_framerate (animation));
+ }
prev_low_framerate = FALSE;
}
priv->frames_played++;
diff --git a/plug-ins/animation-play/widgets/animation-dialog.c
b/plug-ins/animation-play/widgets/animation-dialog.c
index 416ee73..e885444 100755
--- a/plug-ins/animation-play/widgets/animation-dialog.c
+++ b/plug-ins/animation-play/widgets/animation-dialog.c
@@ -2066,7 +2066,7 @@ framerate_changed (Animation *animation,
AnimationDialogPrivate *priv = GET_PRIVATE (dialog);
gchar *text;
- g_signal_handlers_block_by_func (priv->fpscombo,
+ g_signal_handlers_block_by_func (priv->fpscombo,
G_CALLBACK (fpscombo_changed),
dialog);
g_signal_handlers_block_by_func (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->fpscombo))),
@@ -2075,7 +2075,7 @@ framerate_changed (Animation *animation,
text = g_strdup_printf (_("%g fps"), fps);
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->fpscombo))), text);
g_free (text);
- g_signal_handlers_unblock_by_func (priv->fpscombo,
+ g_signal_handlers_unblock_by_func (priv->fpscombo,
G_CALLBACK (fpscombo_changed),
dialog);
g_signal_handlers_unblock_by_func (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->fpscombo))),
@@ -2089,30 +2089,43 @@ low_framerate_cb (Animation *animation,
AnimationDialog *dialog)
{
AnimationDialogPrivate *priv = GET_PRIVATE (dialog);
- GdkColor gdk_red;
gchar *text;
- gdk_red.red = 65535;
- gdk_red.green = 0;
- gdk_red.blue = 0;
-
g_signal_handlers_block_by_func (priv->fpscombo,
G_CALLBACK (fpscombo_changed),
dialog);
g_signal_handlers_block_by_func (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->fpscombo))),
G_CALLBACK (fpscombo_activated),
dialog);
- gtk_widget_modify_text (gtk_bin_get_child (GTK_BIN (priv->fpscombo)), GTK_STATE_NORMAL, &gdk_red);
- text = g_strdup_printf (_("%g fps"), real_framerate);
- gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->fpscombo))), text);
+ if (real_framerate >= animation_get_framerate (priv->animation))
+ {
+ /* Reset to normal color. */
+ gtk_widget_modify_text (gtk_bin_get_child (GTK_BIN (priv->fpscombo)), GTK_STATE_NORMAL, NULL);
+ gimp_help_set_help_data (priv->fpscombo, _("Frame Rate"), NULL);
+
+ text = g_strdup_printf (_("%g fps"), real_framerate);
+ gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->fpscombo))), text);
+ }
+ else
+ {
+ GdkColor gdk_red;
+
+ gdk_red.red = 65535;
+ gdk_red.green = 0;
+ gdk_red.blue = 0;
+
+ gtk_widget_modify_text (gtk_bin_get_child (GTK_BIN (priv->fpscombo)), GTK_STATE_NORMAL, &gdk_red);
+ text = g_strdup_printf (_("%g fps"), real_framerate);
+ gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->fpscombo))), text);
+ gtk_widget_set_tooltip_text (priv->fpscombo,
+ _ ("Playback is too slow. We would drop a frame if frame dropping were
implemented."));
+ }
g_signal_handlers_unblock_by_func (priv->fpscombo,
G_CALLBACK (fpscombo_changed),
dialog);
g_signal_handlers_unblock_by_func (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (priv->fpscombo))),
G_CALLBACK (fpscombo_activated),
dialog);
- gtk_widget_set_tooltip_text (priv->fpscombo,
- _ ("Playback is too slow. We would drop a frame if frame dropping were
implemented."));
}
/* Rendering Functions */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]