Lines Matching defs:gvs

75 static void sp_gvs_gradient_release(SPObject *obj, SPGradientVectorSelector *gvs);
76 static void sp_gvs_defs_release(SPObject *defs, SPGradientVectorSelector *gvs);
77 static void sp_gvs_defs_modified(SPObject *defs, guint flags, SPGradientVectorSelector *gvs);
79 static void sp_gvs_rebuild_gui_full(SPGradientVectorSelector *gvs);
120 static void sp_gradient_vector_selector_init(SPGradientVectorSelector *gvs)
123 gtk_orientable_set_orientation(GTK_ORIENTABLE(gvs), GTK_ORIENTATION_VERTICAL);
126 gvs->idlabel = TRUE;
128 gvs->swatched = false;
130 gvs->doc = NULL;
131 gvs->gr = NULL;
133 new (&gvs->gradient_release_connection) sigc::connection();
134 new (&gvs->defs_release_connection) sigc::connection();
135 new (&gvs->defs_modified_connection) sigc::connection();
137 gvs->columns = new SPGradientSelector::ModelColumns();
138 gvs->store = Gtk::ListStore::create(*gvs->columns);
139 new (&gvs->tree_select_connection) sigc::connection();
149 SPGradientVectorSelector *gvs = SP_GRADIENT_VECTOR_SELECTOR(object);
151 if (gvs->gr) {
152 gvs->gradient_release_connection.disconnect();
153 gvs->tree_select_connection.disconnect();
154 gvs->gr = NULL;
157 if (gvs->doc) {
158 gvs->defs_release_connection.disconnect();
159 gvs->defs_modified_connection.disconnect();
160 gvs->doc = NULL;
163 gvs->gradient_release_connection.~connection();
164 gvs->defs_release_connection.~connection();
165 gvs->defs_modified_connection.~connection();
166 gvs->tree_select_connection.~connection();
181 GtkWidget *gvs;
186 gvs = static_cast<GtkWidget*>(g_object_new(SP_TYPE_GRADIENT_VECTOR_SELECTOR, NULL));
189 sp_gradient_vector_selector_set_gradient(SP_GRADIENT_VECTOR_SELECTOR(gvs), doc, gr);
191 sp_gvs_rebuild_gui_full(SP_GRADIENT_VECTOR_SELECTOR(gvs));
194 return gvs;
197 void sp_gradient_vector_selector_set_gradient(SPGradientVectorSelector *gvs, SPDocument *doc, SPGradient *gr)
199 // g_message("sp_gradient_vector_selector_set_gradient(%p, %p, %p) [%s] %d %d", gvs, doc, gr,
205 g_return_if_fail(gvs != NULL);
206 g_return_if_fail(SP_IS_GRADIENT_VECTOR_SELECTOR(gvs));
212 if (doc != gvs->doc) {
214 if (gvs->gr) {
215 gvs->gradient_release_connection.disconnect();
216 gvs->gr = NULL;
218 if (gvs->doc) {
219 gvs->defs_release_connection.disconnect();
220 gvs->defs_modified_connection.disconnect();
221 gvs->doc = NULL;
226 gvs->defs_release_connection = doc->getDefs()->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_gvs_defs_release), gvs));
227 gvs->defs_modified_connection = doc->getDefs()->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_gvs_defs_modified), gvs));
230 gvs->gradient_release_connection = gr->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_gvs_gradient_release), gvs));
232 gvs->doc = doc;
233 gvs->gr = gr;
234 sp_gvs_rebuild_gui_full(gvs);
235 if (!suppress) g_signal_emit(G_OBJECT(gvs), signals[VECTOR_SET], 0, gr);
236 } else if (gr != gvs->gr) {
240 sp_gradient_vector_selector_set_gradient(gvs, NULL, NULL);
241 sp_gradient_vector_selector_set_gradient(gvs, doc, gr);
243 g_signal_emit(G_OBJECT(gvs), signals[VECTOR_SET], 0, gr);
248 SPDocument *sp_gradient_vector_selector_get_document(SPGradientVectorSelector *gvs)
250 g_return_val_if_fail(gvs != NULL, NULL);
251 g_return_val_if_fail(SP_IS_GRADIENT_VECTOR_SELECTOR(gvs), NULL);
253 return gvs->doc;
256 SPGradient *sp_gradient_vector_selector_get_gradient(SPGradientVectorSelector *gvs)
258 g_return_val_if_fail(gvs != NULL, NULL);
259 g_return_val_if_fail(SP_IS_GRADIENT_VECTOR_SELECTOR(gvs), NULL);
261 return gvs->gr;
290 static void sp_gvs_rebuild_gui_full(SPGradientVectorSelector *gvs)
293 gvs->tree_select_connection.block();
296 gvs->store->clear();
300 if (gvs->gr) {
301 std::set<SPObject *> gradients = gvs->gr->document->getResourceList("gradient");
304 if ( grad->hasStops() && (grad->isSwatch() == gvs->swatched) ) {
313 gr_get_usage_counts(gvs->doc, &usageCount);
315 if (!gvs->doc) {
316 Gtk::TreeModel::Row row = *(gvs->store->append());
317 row[gvs->columns->name] = _("No document selected");
320 Gtk::TreeModel::Row row = *(gvs->store->append());
321 row[gvs->columns->name] = _("No gradients in document");
323 } else if (!gvs->gr) {
324 Gtk::TreeModel::Row row = *(gvs->store->append());
325 row[gvs->columns->name] = _("No gradient selected");
337 Gtk::TreeModel::Row row = *(gvs->store->append());
338 row[gvs->columns->name] = label.c_str();
339 row[gvs->columns->color] = hhssll;
340 row[gvs->columns->refcount] = usageCount[gr];
341 row[gvs->columns->data] = gr;
342 row[gvs->columns->pixbuf] = Glib::wrap(pixb);
347 gvs->tree_select_connection.unblock();
431 static void sp_gvs_gradient_release(SPObject */*obj*/, SPGradientVectorSelector *gvs)
434 if (gvs->gr) {
435 gvs->gradient_release_connection.disconnect();
436 gvs->gr = NULL;
440 sp_gvs_rebuild_gui_full(gvs);
443 static void sp_gvs_defs_release(SPObject */*defs*/, SPGradientVectorSelector *gvs)
445 gvs->doc = NULL;
447 gvs->defs_release_connection.disconnect();
448 gvs->defs_modified_connection.disconnect();
451 if (gvs->gr) {
452 gvs->gradient_release_connection.disconnect();
453 gvs->gr = NULL;
457 sp_gvs_rebuild_gui_full(gvs);
460 static void sp_gvs_defs_modified(SPObject */*defs*/, guint /*flags*/, SPGradientVectorSelector *gvs)
463 sp_gvs_rebuild_gui_full(gvs);