diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | src/binary.c | 31 | ||||
-rw-r--r-- | src/editor.c | 6 | ||||
-rw-r--r-- | src/gtksnippet.c | 24 |
4 files changed, 62 insertions, 10 deletions
@@ -1,3 +1,14 @@ +2008-07-29 Cyrille Bagard <nocbos@gmail.com> + + * src/binary.c: + Increase the length of the input code. + + * src/editor.c: + Fix a warning about the GtkScrolledWindow. + + * src/gtksnippet.c: + Adapt the size of the GtkSnippet widget. Define a white background. + 2008-07-28 Cyrille Bagard <nocbos@gmail.com> * src/arch/operand.c: diff --git a/src/binary.c b/src/binary.c index a026021..eee4d2b 100644 --- a/src/binary.c +++ b/src/binary.c @@ -157,6 +157,37 @@ void fill_snippet(GtkSnippet *snippet) } + + gtk_snippet_add_line(snippet, offset, NULL, "Simple HelloWorld !"); + + pos = 0; + while (pos < len) + { + offset = base + pos; + + instr = decode_instruction(proc, data, &pos, len); + + gtk_snippet_add_line(snippet, offset, instr, NULL); + + + } + + + gtk_snippet_add_line(snippet, offset, NULL, "Simple HelloWorld !"); + + pos = 0; + while (pos < len) + { + offset = base + pos; + + instr = decode_instruction(proc, data, &pos, len); + + gtk_snippet_add_line(snippet, offset, instr, NULL); + + + } + + /* gtk_snippet_build_content(snippet); */ diff --git a/src/editor.c b/src/editor.c index 1c33296..d80a9f5 100644 --- a/src/editor.c +++ b/src/editor.c @@ -426,9 +426,10 @@ GtkWidget *create_editor(void) gtk_paned_set_position (GTK_PANED (hpaned1), 400); scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_widget_show (scrolledwindow2); gtk_paned_pack1 (GTK_PANED (hpaned1), scrolledwindow2, FALSE, TRUE); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow2), GTK_SHADOW_IN); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(scrolledwindow2), GTK_SHADOW_IN); textview2 = gtk_snippet_new(); gtk_snippet_set_sel(GTK_SNIPPET(textview2), 44); @@ -437,7 +438,8 @@ GtkWidget *create_editor(void) textview2 = gtk_text_view_new (); */ gtk_widget_show (textview2); - gtk_container_add (GTK_CONTAINER (scrolledwindow2), textview2); + /*gtk_container_add (GTK_CONTAINER (scrolledwindow2), textview2);*/ + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow2), textview2); fixed1 = gtk_fixed_new (); gtk_widget_show (fixed1); diff --git a/src/gtksnippet.c b/src/gtksnippet.c index 177c086..15696dc 100644 --- a/src/gtksnippet.c +++ b/src/gtksnippet.c @@ -150,8 +150,9 @@ gtk_snippet_size_allocate(GtkWidget *widget, static void gtk_snippet_realize(GtkWidget *widget) { - GdkWindowAttr attributes; - guint attributes_mask; + GdkWindowAttr attributes; + guint attributes_mask; + GdkColor white; /* Couleur de fond normale */ g_return_if_fail(widget != NULL); g_return_if_fail(GTK_IS_SNIPPET(widget)); @@ -164,8 +165,6 @@ gtk_snippet_realize(GtkWidget *widget) attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; - printf("(%d x %d)\n", widget->allocation.width, widget->allocation.height); - attributes.wclass = GDK_INPUT_OUTPUT; attributes.event_mask = gtk_widget_get_events(widget) | GDK_EXPOSURE_MASK; @@ -178,8 +177,11 @@ gtk_snippet_realize(GtkWidget *widget) gdk_window_set_user_data(widget->window, widget); - widget->style = gtk_style_attach(widget->style, widget->window); - gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL); + widget->style = gtk_style_attach(widget->style, widget->window); + + + gdk_color_white(gtk_widget_get_colormap(widget), &white); + gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &white); GTK_SNIPPET(widget)->layout = gtk_widget_create_pango_layout(widget, NULL); @@ -207,6 +209,7 @@ gtk_snippet_expose(GtkWidget *widget, static void gtk_snippet_paint(GtkWidget *widget) { + /* cairo_t *cr; cr = gdk_cairo_create(widget->window); @@ -236,9 +239,9 @@ gtk_snippet_paint(GtkWidget *widget) cairo_destroy(cr); printf("rendering...\n"); - + */ gdk_draw_layout(GDK_DRAWABLE(widget->window), GTK_SNIPPET(widget)->gc, - 10, 100, GTK_SNIPPET(widget)->layout); + 0, 0, GTK_SNIPPET(widget)->layout); } @@ -357,6 +360,8 @@ void gtk_snippet_build_content(GtkSnippet *snippet) AdressMode mode; /* Affichage des adresses */ unsigned int i; /* Boucle de traitement */ char buffer[CONTENT_BUFFER_LEN]; /* Zone tampon à utiliser */ + int width; /* Largeur de l'objet actuelle */ + int height; /* Hauteur de l'objet actuelle */ content_len = strlen("<tt>") + 1; content = (char *)calloc(content_len, sizeof(char)); @@ -429,6 +434,9 @@ void gtk_snippet_build_content(GtkSnippet *snippet) pango_layout_set_markup(snippet->layout, content, content_len - 1); + pango_layout_get_pixel_size(snippet->layout, &width, &height); + gtk_widget_set_size_request(GTK_WIDGET(snippet), width, height); + } |