From: Philip Chimento Date: Sun, 16 Sep 2012 13:21:23 +0000 (+0200) Subject: Remove code for styling the pager X-Git-Tag: v0.9~5^2~4 X-Git-Url: https://git.stderr.nl/gitweb?p=projects%2Fchimara%2Fchimara.git;a=commitdiff_plain;h=fd95bbfc8f01fe812d9f24d1d377079df5f968d5 Remove code for styling the pager It can be done by normal GTK CSS styling when we switch to that. --- diff --git a/libchimara/chimara-glk-private.h b/libchimara/chimara-glk-private.h index 0469b8d..01b4a25 100644 --- a/libchimara/chimara-glk-private.h +++ b/libchimara/chimara-glk-private.h @@ -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 */ diff --git a/libchimara/chimara-glk.c b/libchimara/chimara-glk.c index 6bd6a2f..1155175 100644 --- a/libchimara/chimara-glk.c +++ b/libchimara/chimara-glk.c @@ -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 diff --git a/libchimara/style.c b/libchimara/style.c index a17a236..406a884 100644 --- a/libchimara/style.c +++ b/libchimara/style.c @@ -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; istyles->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 diff --git a/libchimara/style.h b/libchimara/style.h index ba9939a..ee456d8 100644 --- a/libchimara/style.h +++ b/libchimara/style.h @@ -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 diff --git a/libchimara/window.h b/libchimara/window.h index 4c753c3..aa32502 100644 --- a/libchimara/window.h +++ b/libchimara/window.h @@ -101,7 +101,6 @@ struct glk_window_struct cairo_surface_t *backing_store; /* Pager (textbuffer only) */ gboolean currently_paging; - PangoLayout *pager_layout; }; #endif diff --git a/player/preferences.c b/player/preferences.c index 9154f4e..1f39927 100644 --- a/player/preferences.c +++ b/player/preferences.c @@ -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 diff --git a/player/style.css b/player/style.css index 87f5026..37cc434 100644 --- a/player/style.css +++ b/player/style.css @@ -78,8 +78,3 @@ buffer.user1 { buffer.user2 { } - -buffer.pager { - color: #ffffff; - background-color: #303030; -}