beaver-devel
[Top][All Lists]
Advanced

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

More probs. (was: Re: [Beaver-devel] Pango problems)


From: Leslie Polzer
Subject: More probs. (was: Re: [Beaver-devel] Pango problems)
Date: Thu, 20 Mar 2003 18:48:17 +0100

I do not get any errors - but nothing gets drawn as well.

Code:

  /* display line numbers */
  gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW(FPROPS(CurrentPage, 
Text)), GTK_TEXT_WINDOW_TEXT, 0, 0, &x, &y);
  gtk_text_view_get_line_at_y (GTK_TEXT_VIEW(FPROPS(CurrentPage, Text)), &iter, 
y, &line_top);

  gtk_text_view_set_border_window_size (GTK_TEXT_VIEW(FPROPS(CurrentPage, 
Text)),
        GTK_TEXT_WINDOW_LEFT, 50);  
  AuxWindow = gtk_text_view_get_window (GTK_TEXT_VIEW(FPROPS(CurrentPage, 
Text)),
        GTK_TEXT_WINDOW_LEFT); /* FIXME: should be able to put this on the 
righthand side */  

  gdk_window_resize(AuxWindow, 50, 100);

  gc = gdk_gc_new(AuxWindow);
        
  gdk_drawable_get_size(GDK_DRAWABLE(AuxWindow), &AuxWidth, &AuxHeight);
  g_printf("auxwindow size: %dx%d\n", AuxWidth, AuxHeight);
  
  desc = pango_font_description_from_string ("Serif 10");

  pc = pango_context_new();
  //font_map = pango_ft2_font_map_new();

  display = gdk_x11_get_default_xdisplay();
  if (display == NULL)
          g_print("no default display!\n");
  font_map = pango_x_font_map_for_display (display);

  pango_context_set_font_map(pc, font_map);
  layout = pango_layout_new(pc);
  pango_layout_set_font_description(layout, desc);
  
  black = g_malloc(sizeof(GdkColor));
  black->red = 0;
  black->green = 0;
  black->blue = 0;
  
  col_map = gdk_colormap_new (gdk_visual_get_system(), TRUE);

  gdk_colormap_alloc_color (col_map, black, FALSE, TRUE);
  
  gdk_gc_set_foreground(gc, black);

  num_lines = gtk_text_buffer_get_line_count (gtk_text_view_get_buffer 
(GTK_TEXT_VIEW(FPROPS(CurrentPage, Text))));

  while (y < AuxHeight && current_line_index < num_lines - 1)
  {
        current_line_index = gtk_text_iter_get_line (&iter);
        //if (current_line_index > last_line_index)
        if (1)
        {
                gtk_text_view_buffer_to_window_coords 
(GTK_TEXT_VIEW(FPROPS(CurrentPage, Text)), GTK_TEXT_WINDOW_TEXT, x, line_top, 
&x, &y);
                pango_layout_set_text(layout, g_strdup_printf("%d", 
current_line_index + 1), -1); // -1 =~ null-terminated
                gdk_draw_layout(AuxWindow, gc, 5, y, layout);
                num_vis_lines++;
        }
        gtk_text_iter_forward_line(&iter);
        last_line_index = current_line_index;
  }  
  
  /* end line number stuff */

the loop logic is alright, but Pango refuses to draw.
I can't think of anything I've done wrong... :(

Leslie




reply via email to

[Prev in Thread] Current Thread [Next in Thread]