Remove code for styling the pager
authorPhilip Chimento <philip.chimento@gmail.com>
Sun, 16 Sep 2012 13:21:23 +0000 (15:21 +0200)
committerPhilip Chimento <philip.chimento@gmail.com>
Sun, 16 Sep 2012 13:21:23 +0000 (15:21 +0200)
It can be done by normal GTK CSS styling when we switch to that.

libchimara/chimara-glk-private.h
libchimara/chimara-glk.c
libchimara/style.c
libchimara/style.h
libchimara/window.h
player/preferences.c
player/style.css

index 0469b8da33ac313bacaf97e64c697630ed2f3fc7..01b4a256ddfdc731d7e0fd8ee8a99545a30dbb75 100644 (file)
@@ -30,7 +30,6 @@ struct _ChimaraGlkPrivate {
        /* Hashtable containing the current styles set by CSS and GLK */
        struct StyleSet *styles;
        struct StyleSet *glk_styles;
-       PangoAttrList *pager_attr_list;
        /* Final message displayed when game exits */
        gchar *final_message;
        /* Image cache */
index 6bd6a2ffb5cd3e5c2038c71b6d0d3f698750e6ac..1155175fa9a49f965bf07f14ec260bf68d7c43d5 100644 (file)
@@ -161,7 +161,6 @@ chimara_glk_init(ChimaraGlk *self)
     priv->protect = FALSE;
        priv->styles = g_new0(StyleSet,1);
        priv->glk_styles = g_new0(StyleSet,1);
-       priv->pager_attr_list = pango_attr_list_new();
        priv->final_message = g_strdup("[ The game has finished ]");
        priv->running = FALSE;
     priv->program = NULL;
@@ -270,8 +269,7 @@ chimara_glk_finalize(GObject *object)
        g_hash_table_destroy(priv->styles->text_grid);
        g_hash_table_destroy(priv->glk_styles->text_buffer);
        g_hash_table_destroy(priv->glk_styles->text_grid);
-       pango_attr_list_unref(priv->pager_attr_list);
-       
+
     /* Free the event queue */
     g_mutex_lock(priv->event_lock);
        g_queue_foreach(priv->event_queue, (GFunc)g_free, NULL);
@@ -1497,28 +1495,6 @@ chimara_glk_get_tag_names(ChimaraGlk *glk, unsigned int *num_tags)
        return style_get_tag_names();
 }
 
-/**
- * chimara_glk_update_style:
- * @glk: a #ChimaraGlk widget
- *
- * Processes style updates and updates the widget to reflect the new style.
- * Call this every time you change a property of a #GtkTextTag retrieved by
- * chimara_glk_get_tag().
- */
-void
-chimara_glk_update_style(ChimaraGlk *glk)
-{
-       CHIMARA_GLK_USE_PRIVATE(glk, priv);
-       style_update(glk);
-
-       /* Schedule a redraw */
-       g_mutex_lock(priv->arrange_lock);
-       priv->needs_rearrange = TRUE;
-       priv->ignore_next_arrange_event = TRUE;
-       g_mutex_unlock(priv->arrange_lock);
-       gtk_widget_queue_resize( GTK_WIDGET(priv->self) );
-}
-
 /**
  * chimara_glk_set_resource_load_callback:
  * @glk: a #ChimaraGlk widget
index a17a23659d8427c661d1e735162cb66a6a33a103..406a8848969f6d4cce70a9533694bac5401b374e 100644 (file)
@@ -53,7 +53,6 @@ static const gchar* TAG_NAMES[] = {
        "user1",
        "user2",
        "hyperlink",
-       "pager",
        "default"
 };
 
@@ -123,16 +122,6 @@ glk_set_style_stream(strid_t str, glui32 styl) {
        str->glk_style = (gchar*) get_glk_tag_name(styl);
 }
 
-/* Internal function: call this to initialize the layout of the 'more' prompt. */
-void
-style_init_more_prompt(winid_t win)
-{
-       ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
-
-       win->pager_layout = gtk_widget_create_pango_layout(win->widget, "More");
-       pango_layout_set_attributes(win->pager_layout, glk_data->pager_attr_list);
-}
-
 /* Internal function: call this to initialize the default styles to a textbuffer. */
 void
 style_init_textbuffer(GtkTextBuffer *buffer)
@@ -343,15 +332,9 @@ style_init(ChimaraGlk *glk)
        g_object_set(tag, "foreground", "#0000ff", "foreground-set", TRUE, "underline", PANGO_UNDERLINE_SINGLE, "underline-set", TRUE, NULL);
        g_hash_table_insert(default_text_buffer_styles, "hyperlink", tag);
 
-       GtkTextTag *pager_tag = gtk_text_tag_new("pager");
-       g_object_set(pager_tag, "family", "Monospace", "family-set", TRUE, "foreground", "#ffffff", "foreground-set", TRUE, "background", "#000000", "background-set", TRUE, NULL);
-       g_hash_table_insert(default_text_buffer_styles, "pager", pager_tag);
-       text_tag_to_attr_list(pager_tag, priv->pager_attr_list);
-
        priv->styles->text_grid = default_text_grid_styles;
        priv->styles->text_buffer = default_text_buffer_styles;
 
-
        /* Initialize the GLK styles to empty tags */
        int i;
        for(i=0; i<style_NUMSTYLES; i++) {
@@ -396,9 +379,6 @@ scan_css_file(GScanner *scanner, ChimaraGlk *glk)
        }
 
        g_scanner_destroy(scanner);
-
-       /* Update the pager prompt to the new style */
-       style_update(glk);
 }
 
 /* Internal function: parses a token */
@@ -1206,16 +1186,6 @@ text_tag_to_attr_list(GtkTextTag *tag, PangoAttrList *list)
        }
 }
 
-/* Update pager tag */
-void
-style_update(ChimaraGlk *glk)
-{
-       CHIMARA_GLK_USE_PRIVATE(glk, priv);
-
-       GtkTextTag *pager_tag = GTK_TEXT_TAG( g_hash_table_lookup(priv->styles->text_buffer, "pager") );
-       text_tag_to_attr_list(pager_tag, priv->pager_attr_list);
-}
-
 /* Determine the current colors used to render the text for a given stream. 
  * This can be set in a number of places */
 static void
index ba9939a1f3218eb22bd5aa6949e1a1fdddbbd488..ee456d88c8ab3dab868009f3f8570b647a708021 100644 (file)
@@ -9,9 +9,7 @@
 
 G_GNUC_INTERNAL void style_init_textbuffer(GtkTextBuffer *buffer);
 G_GNUC_INTERNAL void style_init_textgrid(GtkTextBuffer *buffer);
-G_GNUC_INTERNAL void style_init_more_prompt(winid_t win);
 G_GNUC_INTERNAL void style_init(ChimaraGlk *glk);
-G_GNUC_INTERNAL void style_update(ChimaraGlk *glk);
 G_GNUC_INTERNAL const gchar** style_get_tag_names();
 G_GNUC_INTERNAL void reset_default_styles(ChimaraGlk *glk);
 G_GNUC_INTERNAL GScanner *create_css_file_scanner(void);
@@ -29,7 +27,7 @@ typedef struct StyleSet {
        GHashTable *text_buffer;
 } StyleSet;
 
-#define CHIMARA_NUM_STYLES 13
+#define CHIMARA_NUM_STYLES 12
 
 //#define DEBUG_STYLES
 
index 4c753c39b587117c598812128bf5513a17e22bb0..aa3250274a5e5e3609e12252457b587f7a61a0cf 100644 (file)
@@ -101,7 +101,6 @@ struct glk_window_struct
        cairo_surface_t *backing_store;
        /* Pager (textbuffer only) */
        gboolean currently_paging;
-       PangoLayout *pager_layout;
 };
 
 #endif
index 9154f4e290a4299e221fe4211688e2d76cdba244..1f39927082e077073dc8b0aa978a3434521e4595 100644 (file)
@@ -252,7 +252,6 @@ on_toggle_left(GtkToggleButton *button, ChimaraGlk *glk) {
        if( !gtk_toggle_button_get_active(button) )
                return;
        g_object_set(current_tag, "justification", GTK_JUSTIFY_LEFT, "justification-set", TRUE, NULL);
-       chimara_glk_update_style(glk);
 }
 
 void
@@ -260,7 +259,6 @@ on_toggle_center(GtkToggleButton *button, ChimaraGlk *glk) {
        if( !gtk_toggle_button_get_active(button) )
                return;
        g_object_set(current_tag, "justification", GTK_JUSTIFY_CENTER, "justification-set", TRUE, NULL);
-       chimara_glk_update_style(glk);
 }
 
 void
@@ -268,7 +266,6 @@ on_toggle_right(GtkToggleButton *button, ChimaraGlk *glk) {
        if( !gtk_toggle_button_get_active(button) )
                return;
        g_object_set(current_tag, "justification", GTK_JUSTIFY_RIGHT, "justification-set", TRUE, NULL);
-       chimara_glk_update_style(glk);
 }
 
 void
@@ -276,7 +273,6 @@ on_toggle_justify(GtkToggleButton *button, ChimaraGlk *glk) {
        if( !gtk_toggle_button_get_active(button) )
                return;
        g_object_set(current_tag, "justification", GTK_JUSTIFY_FILL, "justification-set", TRUE, NULL);
-       chimara_glk_update_style(glk);
 }
 
 void
@@ -285,8 +281,6 @@ on_toggle_bold(GtkToggleButton *button, ChimaraGlk *glk) {
                g_object_set(current_tag, "weight", PANGO_WEIGHT_BOLD, "weight-set", TRUE, NULL);
        else
                g_object_set(current_tag, "weight", PANGO_WEIGHT_NORMAL, "weight-set", TRUE, NULL);
-
-       chimara_glk_update_style(glk);
 }
 
 void
@@ -295,8 +289,6 @@ on_toggle_italic(GtkToggleButton *button, ChimaraGlk *glk) {
                g_object_set(current_tag, "style", PANGO_STYLE_ITALIC, "style-set", TRUE, NULL);
        else
                g_object_set(current_tag, "style", PANGO_STYLE_NORMAL, "style-set", TRUE, NULL);
-
-       chimara_glk_update_style(glk);
 }
 
 void
@@ -305,8 +297,6 @@ on_toggle_underline(GtkToggleButton *button, ChimaraGlk *glk) {
                g_object_set(current_tag, "underline", PANGO_UNDERLINE_SINGLE, "underline-set", TRUE, NULL);
        else
                g_object_set(current_tag, "underline", PANGO_UNDERLINE_NONE, "underline-set", TRUE, NULL);
-
-       chimara_glk_update_style(glk);
 }
 
 void
@@ -315,7 +305,6 @@ on_foreground_color_set(GtkColorButton *button, ChimaraGlk *glk)
        GdkColor color;
     gtk_color_button_get_color(button, &color);
        g_object_set(current_tag, "foreground-gdk", &color, "foreground-set", TRUE, NULL);
-       chimara_glk_update_style(glk);
 }
 
 void
@@ -324,7 +313,6 @@ on_background_color_set(GtkColorButton *button, ChimaraGlk *glk)
        GdkColor color;
     gtk_color_button_get_color(button, &color);
        g_object_set(current_tag, "background-gdk", &color, "background-set", TRUE, NULL);
-       chimara_glk_update_style(glk);
 }
 
 void
@@ -333,7 +321,6 @@ on_font_set(GtkFontButton *button, ChimaraGlk *glk)
        const gchar *font_name = gtk_font_button_get_font_name(button);
        PangoFontDescription *font_description = pango_font_description_from_string(font_name);
        g_object_set(current_tag, "font-desc", font_description, NULL);
-       chimara_glk_update_style(glk);
 }
 
 void
index 87f5026de5193a6acaa950dfaa5bc35190901036..37cc4346b5621763df8550365057f5b39c6ce015 100644 (file)
@@ -78,8 +78,3 @@ buffer.user1 {
 
 buffer.user2 {
 }
-
-buffer.pager {
-       color: #ffffff;
-       background-color: #303030;
-}