Re: dia and fonts [dia & freetype - part II]

On Sat, 27 Apr 2002, Torben H. Nielsen wrote:
But this leads to a new problem - the properties dialog(s) do not
load the font style but resets it to regular...

Well it seems like dia_font_selector_with_stykes() in lib/widgets.c
the font's different styles in to the select-box, but it does not read
current style from font->style and sets the selected to the loaded

I am mostly programming in java. I am only starting at learning C and I
know even lesser about GTK, so will somebody pleasehelp me with this

Here you go.  This might be more complicated than it needs to be, but I'm
not sure if setting the active item while building the menu is a good idea.

Index: lib/widgets.c
RCS file: /cvs/gnome/dia/lib/widgets.c,v
retrieving revision 1.37
diff -r1.37 widgets.c
<   int i=0;
  int i=0, select = 0;
<     DiaFont *font = (DiaFont *)style_list->data;
<     GtkWidget *menuitem = gtk_menu_item_new_with_label (font->style);
<     gtk_object_set_user_data(GTK_OBJECT(menuitem), font->style);
    DiaFont *style_font = (DiaFont *)style_list->data;
    GtkWidget *menuitem = gtk_menu_item_new_with_label (style_font->style);
    gtk_object_set_user_data(GTK_OBJECT(menuitem), style_font->style);
    if (!strcmp(style_font->style, font->style))
      select = i;
<   // Need to dealloc the menu, methings
  // Need to dealloc the menu, methinks
  gtk_option_menu_set_history(GTK_OPTION_MENU(fs->style_omenu), select);
  gtk_menu_set_active(fs->style_menu, select);


Lars Clausen (| Hårdgrim of Numenor
"I do not agree with a word that you say, but I   |----------------------------
will defend to the death your right to say it."   | Where are we going, and
    --Evelyn Beatrice Hall paraphrasing Voltaire  | what's with the handbasket?

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