[pinpoint] Introduced options notes-font and notes-font-size; first (incomplete) attempt at implementing notes-



commit 3c9fdc03e6ce3a8085190725df003803c801c7ca
Author: Christoph Fischer <chris toph de>
Date:   Fri Jun 1 21:13:23 2012 +0200

    Introduced options notes-font and notes-font-size; first (incomplete)
    attempt at implementing notes-font-size=auto

 pinpoint.c   |    4 ++++
 pinpoint.h   |    2 ++
 pp-clutter.c |   26 +++++++++++++++++++++++---
 3 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/pinpoint.c b/pinpoint.c
index 8be2432..3f52f15 100644
--- a/pinpoint.c
+++ b/pinpoint.c
@@ -68,6 +68,8 @@ static PinPointPoint pin_default_point = {
   .text = NULL,
   .position = CLUTTER_GRAVITY_CENTER,
   .font = "Sans 60px",
+  .notes_font = "Sans",
+  .notes_font_size = "20px",
   .text_color = "white",
   .text_align = PP_TEXT_LEFT,
   .use_markup = TRUE,
@@ -451,6 +453,8 @@ parse_setting (PinPointPoint *point,
   START_PARSER
   IF_PREFIX("stage-color=") point->stage_color = STRING;
   IF_PREFIX("font=")        point->font = STRING;
+  IF_PREFIX("notes-font=")  point->notes_font = STRING;
+  IF_PREFIX("notes-font-size=")  point->notes_font_size = STRING;
   IF_PREFIX("text-color=")  point->text_color = STRING;
   IF_PREFIX("text-align=")  ENUM(point->text_align, PPTextAlign, STRING);
   IF_PREFIX("shading-color=") point->shading_color = STRING;
diff --git a/pinpoint.h b/pinpoint.h
index 3f26630..b242f01 100644
--- a/pinpoint.h
+++ b/pinpoint.h
@@ -90,6 +90,8 @@ struct _PinPointPoint
   const char        *text;            /*  the text of the slide */
   ClutterGravity     position;
   const char        *font;
+  const char        *notes_font;
+  const char        *notes_font_size;
   PPTextAlign        text_align;
   const char        *text_color;
   gboolean           use_markup;
diff --git a/pp-clutter.c b/pp-clutter.c
index e3ac8cf..93acc98 100644
--- a/pp-clutter.c
+++ b/pp-clutter.c
@@ -665,6 +665,8 @@ clutter_renderer_init_speaker_screen (ClutterRenderer *renderer)
   renderer->speaker_screen = clutter_stage_new ();
   clutter_stage_set_title(CLUTTER_STAGE(renderer->speaker_screen), "Pinpoint speaker screen");
 
+
+
   renderer->speaker_notes = g_object_new (CLUTTER_TYPE_TEXT,
                                 "x", 10.0,
                                 "y", 0.0,
@@ -2027,12 +2029,30 @@ static gboolean update_speaker_screen (ClutterRenderer *renderer)
   if (point->speaker_notes) {
     clutter_text_set_text (CLUTTER_TEXT (renderer->speaker_notes),
                            point->speaker_notes);
+    char *spc_text = " ";
     float preview_width = clutter_actor_get_width(CLUTTER_ACTOR(renderer->speaker_preview_bar));
     clutter_actor_set_position (renderer->speaker_notes,
   		  	  	  	  	  	  (preview_width+20.0),
-  		  	  	  	  	  	  //clutter_actor_get_width(renderer->speaker_preview_bar)+20.0,
-                                (20.0+clutter_actor_get_height(CLUTTER_ACTOR(renderer->speaker_buttons_group))));
-    clutter_actor_set_width    (renderer->speaker_notes, nw-(preview_width+40.0));
+                              (20.0+clutter_actor_get_height(CLUTTER_ACTOR(renderer->speaker_buttons_group))));
+
+    clutter_actor_set_width  (renderer->speaker_notes, nw-(preview_width+40.0));
+
+    // handle notes-font-size=auto:
+    float text_scale;
+    if (g_strcmp0(point->notes_font_size, "auto")==0) {
+    	text_scale = (nh-(clutter_actor_get_height(CLUTTER_ACTOR(renderer->speaker_buttons_group))+40.0))/clutter_actor_get_width(renderer->speaker_notes);
+        clutter_text_set_font_name(CLUTTER_TEXT (renderer->speaker_notes),
+        					   g_strconcat(point->notes_font, spc_text, "20px", NULL));
+    } else {
+    	text_scale = 1.0;
+        clutter_text_set_font_name(CLUTTER_TEXT (renderer->speaker_notes),
+        					   g_strconcat(point->notes_font, spc_text, point->notes_font_size, NULL));
+    }
+    g_object_set (renderer->speaker_notes,
+				  "scale-x", text_scale,
+				  "scale-y", text_scale,
+				  NULL);
+    clutter_actor_set_width  (renderer->speaker_notes, nw-(preview_width+40.0));
   }
   else
     clutter_text_set_text (CLUTTER_TEXT (renderer->speaker_notes), "");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]