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

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
> loads
> the font's different styles in to the select-box, but it does not read
> the 
> current style from font->style and sets the selected to the loaded
> value.
> 
> I am mostly programming in java. I am only starting at learning C and I
> do
> know even lesser about GTK, so will somebody pleasehelp me with this
> one??

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
284c284
<   int i=0;
---
>   int i=0, select = 0;
290,292c290,295
<     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;
>     i++;
298c301
<   // Need to dealloc the menu, methings
---
>   // Need to dealloc the menu, methinks
301a305,306
>   gtk_option_menu_set_history(GTK_OPTION_MENU(fs->style_omenu), select);
>   gtk_menu_set_active(fs->style_menu, select);

-Lars

-- 
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| 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] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK