diff options
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/gtkblockview.c | 147 |
1 files changed, 4 insertions, 143 deletions
diff --git a/src/gtkext/gtkblockview.c b/src/gtkext/gtkblockview.c index 2ea7ae2..70cd8ea 100644 --- a/src/gtkext/gtkblockview.c +++ b/src/gtkext/gtkblockview.c @@ -27,9 +27,6 @@ #include <malloc.h> #include <string.h> -#define GTK_TEXT_USE_INTERNAL_UNSUPPORTED_API -#include <gtk/gtktextdisplay.h> - #include "gtkbinview-int.h" #include "support.h" @@ -39,7 +36,6 @@ #include "../glibext/gcodebuffer.h" -#include "../glibext/gbuffersegment.h" #ifndef _ @@ -108,8 +104,6 @@ struct _GtkBlockView bool show_code; /* Affichage du code brut ? */ GBufferView *buffer_view; /* Code sous forme de texte */ - GtkTextBuffer *buffer; /* Code sous forme de texte */ - GtkTextLayout *layout; /* Disposition du texte */ gint line_height; /* Hauteur maximale des lignes */ gint left_margin; /* Marge gauche + espace */ @@ -141,24 +135,6 @@ struct _GtkBlockViewClass -static void -gtk_text_view2_set_attributes_from_style (GtkTextAttributes *values, - GtkStyle *style) -{ - PangoFontDescription *font_desc; - - values->appearance.bg_color = style->base[GTK_STATE_NORMAL]; - values->appearance.fg_color = style->text[GTK_STATE_NORMAL]; - - if (values->font) - pango_font_description_free (values->font); - - font_desc = pango_font_description_from_string ("mono 10"); - - values->font = pango_font_description_copy (/*style->*/font_desc); - pango_font_description_free (font_desc); -} - /* Procède à l'initialisation de l'afficheur d'un bloc binaire. */ static void gtk_block_view_init(GtkBlockView *); @@ -524,13 +500,6 @@ static void gtk_block_view_init(GtkBlockView *view) { GtkBinView *binview; /* Instance parente */ - - PangoFontDescription *font_desc; - PangoContext *ltr_context, *rtl_context; - GtkTextAttributes *style; - static bool done = false; - - binview = GTK_BIN_VIEW(view); binview->scroll = (scroll_fc)gtk_block_view_scroll; @@ -538,66 +507,6 @@ static void gtk_block_view_init(GtkBlockView *view) binview->get_coordinates = (get_addr_coordinates_fc)gtk_block_view_get_address_coordinates; - - view->buffer = gtk_text_buffer_new(get_gtk_tag_table()); - - - - view->layout = gtk_text_layout_new(); - - - - if (!done || 1) - { - done = true; - - gtk_text_layout_set_overwrite_mode(GTK_BLOCK_VIEW(view)->layout, FALSE); - - - ltr_context = gtk_widget_create_pango_context(view); - pango_context_set_base_dir(ltr_context, PANGO_DIRECTION_LTR); - rtl_context = gtk_widget_create_pango_context(view); - pango_context_set_base_dir(rtl_context, PANGO_DIRECTION_RTL); - - gtk_text_layout_set_contexts(GTK_BLOCK_VIEW(view)->layout, ltr_context, rtl_context); - - - - style = gtk_text_attributes_new (); - - gtk_widget_ensure_style(view); - - font_desc = pango_font_description_from_string ("mono 10"); - gtk_widget_modify_font (view, font_desc); - pango_font_description_free (font_desc); - - gtk_text_view2_set_attributes_from_style(style, GTK_WIDGET(view)->style); - /* - style->pixels_above_lines = 5; - style->pixels_below_lines = 5; - style->pixels_inside_wrap = 10; - style->left_margin = 10; - style->right_margin = 10; - style->indent = 10;*/ - style->left_margin = 10; - style->right_margin = 10; - - style->wrap_mode = GTK_WRAP_NONE; - style->justification = GTK_JUSTIFY_LEFT; - - style->direction = gtk_widget_get_direction(view); - - - gtk_text_layout_set_default_style(GTK_BLOCK_VIEW(view)->layout, style); - - gtk_text_attributes_unref(style); - - - //gtk_text_layout_get_size (GTK_BLOCK_VIEW(view)->layout, &width, &height); - - } - - view->_buffer = g_code_buffer_new(); @@ -734,7 +643,7 @@ static gboolean gtk_block_view_button_press(GtkWidget *widget, GdkEventButton *e GRenderingLine *line; /* Ligne de rendu */ result = FALSE; - +#if 0 view = GTK_BLOCK_VIEW(widget); gtk_text_layout_get_line_at_y(view->layout, &iter, event->y, NULL); @@ -748,7 +657,7 @@ static gboolean gtk_block_view_button_press(GtkWidget *widget, GdkEventButton *e result = TRUE; g_rendering_line_toggle_flag(line, RLF_BREAK_POINT); } - +#endif return result; } @@ -1127,64 +1036,16 @@ static void gtk_block_view_set_rendering_lines(GtkBlockView *view, GRenderingLin static void gtk_block_view_complete_building_content(GDelayedInsertion *insertion, GtkBlockView *view) { - size_t lengths[SAR_COUNT]; /* Différentes tailles de zone */ - GtkTextIter pos; /* Point d'insertion */ - PangoTabArray *tabs; /* Tailles de tabulation */ - GdkRectangle rect; /* Zone d'un point */ - - lengths[SAR_ADDRESS] = insertion->lengths[SAR_ADDRESS]; - lengths[SAR_CODE] = insertion->lengths[SAR_CODE]; - lengths[SAR_INSTRUCTION] = insertion->lengths[SAR_INSTRUCTION]; - gdk_threads_enter(); - gtk_text_layout_set_buffer(view->layout, view->buffer); - - gtk_text_layout_set_cursor_visible(GTK_BLOCK_VIEW(view)->layout, FALSE); - - gtk_text_buffer_get_end_iter(view->buffer, &pos); - gtk_text_layout_move_iter_visually(view->layout, &pos, -1); - gtk_text_layout_get_iter_location(view->layout, &pos, &rect); - - /* Taille des tabulations */ - - if (lengths[SAR_ADDRESS] > 0 && lengths[SAR_CODE] > 0) - tabs = pango_tab_array_new_with_positions(3, TRUE, - PANGO_TAB_LEFT, rect.width * (lengths[SAR_ADDRESS] + 3), - PANGO_TAB_LEFT, rect.width * (lengths[SAR_ADDRESS] + 3 + lengths[SAR_CODE] + 3), - PANGO_TAB_LEFT, rect.width * (lengths[SAR_ADDRESS] + 3 + lengths[SAR_CODE] + 3 + lengths[SAR_INSTRUCTION] + 4)); - - else if (lengths[SAR_ADDRESS] > 0 && lengths[SAR_CODE] == 0) - tabs = pango_tab_array_new_with_positions(2, TRUE, - PANGO_TAB_LEFT, rect.width * (lengths[SAR_ADDRESS] + 3), - PANGO_TAB_LEFT, rect.width * (lengths[SAR_ADDRESS] + 3 + lengths[SAR_INSTRUCTION] + 4)); - - else if (lengths[SAR_ADDRESS] == 0 && lengths[SAR_CODE] > 0) - tabs = pango_tab_array_new_with_positions(2, TRUE, - PANGO_TAB_LEFT, rect.width * (lengths[SAR_CODE] + 3), - PANGO_TAB_LEFT, rect.width * (lengths[SAR_CODE] + 3 + lengths[SAR_INSTRUCTION] + 4)); - - else - tabs = pango_tab_array_new_with_positions(1, TRUE, - PANGO_TAB_LEFT, rect.width * (lengths[SAR_INSTRUCTION] + 4)); - - if (view->layout->default_style->tabs) - pango_tab_array_free(view->layout->default_style->tabs); - - view->layout->default_style->tabs = tabs; - - gtk_text_layout_default_style_changed(view->layout); - /* Taille des marges */ - +#if 0 view->line_height = rect.height; view->left_margin = 2 * rect.height; view->left_text = -2.5 * rect.height; - +#endif /* Validation finale */ - gtk_text_layout_validate(GTK_BLOCK_VIEW(view)->layout, G_MAXINT); - gtk_block_view_recompute_size_request(view); gdk_flush (); |