void
UpdateStylesForIndex (int idx)
{
- int n, i;
+ int n, i, previous_selection;
uint32 flags;
font_family family;
font_style style;
BStringItem *item;
+ char *current_style;
n = all_styles.CountItems ();
+ current_style = NULL;
+ previous_selection = font_style_pane.CurrentSelection ();
+
+ if (previous_selection >= 0)
+ {
+ item = all_styles.ItemAt (previous_selection);
+ current_style = strdup (item->Text ());
+ }
font_style_pane.MakeEmpty ();
all_styles.MakeEmpty ();
else
item = new BStringItem ("<error>");
+ if (current_style && pending_selection_idx < 0
+ && !strcmp (current_style, style))
+ pending_selection_idx = i;
+
font_style_pane.AddItem (item);
all_styles.AddItem (item);
}
pending_selection_idx = -1;
UpdateForSelectedStyle ();
+
+ if (current_style)
+ free (current_style);
}
bool