Lines Matching refs:fsel
70 void (* font_set) (SPFontSelector *fsel, gchar *fontspec);
81 SPFontSelector *fsel);
84 SPFontSelector *fsel);
87 SPFontSelector *fsel);
89 static void sp_font_selector_emit_set (SPFontSelector *fsel);
90 static void sp_font_selector_set_sizes( SPFontSelector *fsel );
116 static void sp_font_selector_set_size_tooltip(SPFontSelector *fsel)
121 gtk_widget_set_tooltip_text (fsel->size, _(tooltip.c_str()));
128 static void sp_font_selector_init(SPFontSelector *fsel)
130 gtk_box_set_homogeneous(GTK_BOX(fsel), TRUE);
131 gtk_box_set_spacing(GTK_BOX(fsel), 4);
136 gtk_box_pack_start (GTK_BOX(fsel), f, TRUE, TRUE, 0);
145 fsel->family_treeview = gtk_tree_view_new ();
146 gtk_tree_view_set_row_separator_func( GTK_TREE_VIEW(fsel->family_treeview),
149 gtk_widget_show_all(GTK_WIDGET (fsel->family_treeview));
157 gtk_tree_view_append_column (GTK_TREE_VIEW(fsel->family_treeview), column);
158 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(fsel->family_treeview), FALSE);
161 gtk_widget_set_name( GTK_WIDGET(fsel->family_treeview), "font_selector_family" );
183 gtk_tree_view_set_model (GTK_TREE_VIEW(fsel->family_treeview), GTK_TREE_MODEL (Glib::unwrap (store)));
184 //gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(fsel->family_treeview),2);
185 gtk_container_add(GTK_CONTAINER(sw), fsel->family_treeview);
188 GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(fsel->family_treeview));
189 g_signal_connect (G_OBJECT(selection), "changed", G_CALLBACK (sp_font_selector_family_select_row), fsel);
190 g_object_set_data (G_OBJECT(fsel), "family-treeview", fsel->family_treeview);
196 gtk_box_pack_start(GTK_BOX (fsel), f, TRUE, TRUE, 0);
215 fsel->style_treeview = gtk_tree_view_new ();
222 gtk_tree_view_append_column (GTK_TREE_VIEW(fsel->style_treeview), column);
228 gtk_tree_view_append_column (GTK_TREE_VIEW(fsel->style_treeview), column);
230 //gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(fsel->style_treeview), 1);
231 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(fsel->style_treeview), TRUE);
232 gtk_container_add(GTK_CONTAINER(sw), fsel->style_treeview);
235 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(fsel->style_treeview));
236 g_signal_connect (G_OBJECT(selection), "changed", G_CALLBACK (sp_font_selector_style_select_row), fsel);
248 fsel->size = gtk_combo_box_text_new_with_entry ();
250 sp_font_selector_set_size_tooltip(fsel);
251 gtk_widget_set_size_request(fsel->size, 90, -1);
252 g_signal_connect (G_OBJECT(fsel->size), "changed", G_CALLBACK (sp_font_selector_size_changed), fsel);
253 gtk_box_pack_end (GTK_BOX(hb), fsel->size, FALSE, FALSE, 0);
259 sp_font_selector_set_sizes(fsel);
261 gtk_widget_show_all (fsel->size);
264 gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(fsel->size))), "18.0");
265 fsel->fontsize = 18.0;
266 fsel->fontsize_dirty = false;
268 fsel->fontspec = new Glib::ustring;
273 SPFontSelector *fsel = SP_FONT_SELECTOR (object);
275 if (fsel->fontspec) {
276 delete fsel->fontspec;
279 if (fsel->families.length > 0) {
280 nr_name_list_release(&fsel->families);
281 fsel->families.length = 0;
284 if (fsel->styles.length > 0) {
285 nr_style_list_release(&fsel->styles);
286 fsel->styles.length = 0;
296 SPFontSelector *fsel)
339 gtk_tree_view_set_model (GTK_TREE_VIEW (fsel->style_treeview), GTK_TREE_MODEL (store));
340 //gtk_tree_view_set_tooltip_column(GTK_TREE_VIEW(fsel->style_treeview),1);
347 gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (fsel->style_treeview)), path);
353 SPFontSelector *fsel)
355 if (!fsel->block_emit)
357 sp_font_selector_emit_set (fsel);
366 static void sp_font_selector_set_sizes( SPFontSelector *fsel )
368 GtkListStore *store = GTK_LIST_STORE(gtk_combo_box_get_model (GTK_COMBO_BOX(fsel->size)));
386 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(fsel->size), Glib::ustring::format(size).c_str());
392 static void sp_font_selector_size_changed( GtkComboBox */*cbox*/, SPFontSelector *fsel )
395 text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (fsel->size));
396 gfloat old_size = fsel->fontsize;
416 fsel->fontsize = value;
417 if ( fabs(fsel->fontsize-old_size) > 0.001)
419 fsel->fontsize_dirty = true;
422 sp_font_selector_emit_set (fsel);
430 static void sp_font_selector_emit_set (SPFontSelector *fsel)
444 model_family = gtk_tree_view_get_model (GTK_TREE_VIEW (fsel->family_treeview));
446 model_style = gtk_tree_view_get_model (GTK_TREE_VIEW (fsel->style_treeview));
449 selection_family = gtk_tree_view_get_selection (GTK_TREE_VIEW (fsel->family_treeview));
450 selection_style = gtk_tree_view_get_selection (GTK_TREE_VIEW (fsel->style_treeview ));
464 *(fsel->fontspec) = fontspec;
466 g_signal_emit(fsel, fs_signals[FONT_SET], 0, fontspec.c_str());
471 SPFontSelector *fsel = SP_FONT_SELECTOR(g_object_new(SP_TYPE_FONT_SELECTOR, NULL));
473 return GTK_WIDGET(fsel);
481 void sp_font_selector_set_fontspec (SPFontSelector *fsel, Glib::ustring fontspec, double size)
500 fsel->block_emit = TRUE;
501 gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (fsel->family_treeview)), path.gobj());
502 gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (fsel->family_treeview), path.gobj(), NULL, TRUE, 0.5, 0.5);
503 fsel->block_emit = FALSE; // TODO: Should this be moved to the end?
520 gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (fsel->style_treeview)), path_c.gobj());
521 gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (fsel->style_treeview), path_c.gobj(), NULL, TRUE, 0.5, 0.5);
523 if (size != fsel->fontsize)
527 gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(fsel->size))), s);
528 fsel->fontsize = size;
529 sp_font_selector_set_size_tooltip(fsel);
530 sp_font_selector_set_sizes(fsel);
536 Glib::ustring sp_font_selector_get_fontspec(SPFontSelector *fsel)
538 return *(fsel->fontspec);
544 double sp_font_selector_get_size(SPFontSelector *fsel)
546 return fsel->fontsize;