Exemplo n.º 1
0
static void
curvature_update_preview(CurvatureControls *controls,
                         CurvatureArgs *args)
{
    GwyDataField *source, *mask = NULL;
    GwySelection *selection;
    Intersection i1[2], i2[2];
    gboolean ok;
    guint i;

    source = gwy_container_get_object_by_name(controls->data, "/0/data");
    selection = gwy_container_get_object_by_name(controls->data,
                                                 "/0/select/line");
    gwy_container_gis_object_by_name(controls->data, "/0/mask", &mask);

    ok = curvature_calculate(source, mask, args, controls->params, i1, i2);
    for (i = 0; i < PARAM_NPARAMS; i++)
        gwy_null_store_row_changed(controls->paramstore, i);

    if (ok) {
        curvature_set_selection(source, i1, i2, selection);
        curvature_plot_graph(source, i1, i2, controls->gmodel);
        gtk_label_set_text(GTK_LABEL(controls->warning), "");
    }
    else {
        gwy_selection_clear(selection);
        gwy_graph_model_remove_all_curves(controls->gmodel);
        gtk_label_set_text(GTK_LABEL(controls->warning),
                           _("Axes are outside the image."));
    }

    update_target_graphs(controls);
}
Exemplo n.º 2
0
static void
prof_separate_changed(ProfControls *controls)
{
    ProfArgs *args = controls->args;
    args->separate
        = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(controls->separate));
    gtk_widget_set_sensitive(controls->target_hbox, !args->separate);
    update_target_graphs(controls);
}
Exemplo n.º 3
0
static void
axis_quantity_changed(GrainCrossControls *controls)
{
    GtkTreeSelection *selection;
    GwyGraphModel *gmodel;
    GwyGrainValue *gvalue;
    GtkTreeModel *model;
    GtkTreeIter iter;
    gboolean ok;

    ok = TRUE;

    selection = gtk_tree_view_get_selection(controls->abscissa);
    if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
        gtk_tree_model_get(model, &iter,
                           GWY_GRAIN_VALUE_STORE_COLUMN_ITEM, &gvalue,
                           -1);
        controls->args->abscissa = gwy_resource_get_name(GWY_RESOURCE(gvalue));
    }
    else
        ok = FALSE;

    selection = gtk_tree_view_get_selection(controls->ordinate);
    if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
        gtk_tree_model_get(model, &iter,
                           GWY_GRAIN_VALUE_STORE_COLUMN_ITEM, &gvalue,
                           -1);
        controls->args->ordinate = gwy_resource_get_name(GWY_RESOURCE(gvalue));
    }
    else
        ok = FALSE;

    gmodel = create_corr_graph(controls->args, controls->dfield);
    gwy_graph_set_model(GWY_GRAPH(controls->graph), gmodel);
    g_object_unref(gmodel);

    gtk_dialog_set_response_sensitive(controls->dialog, GTK_RESPONSE_OK, ok);
    update_target_graphs(controls);
}