示例#1
0
void update_region_ui(RegionUI *ui, Quark *q)
{
    region *r = region_get_data(q);
    if (ui && r) {
        SetOptionChoice(ui->type, r->type);
        SetOptionChoice(ui->color, r->color);
    }
}
示例#2
0
static void update_line_ui(LineUI *ui, DOLineData *odata)
{
    SpinChoiceSetValue(ui->v_x, odata->vector.x);
    SpinChoiceSetValue(ui->v_y, odata->vector.y);
    SetOptionChoice(ui->arrow_end, odata->arrow_end);

    SetOptionChoice(ui->a_type, odata->arrow.type);
    SpinChoiceSetValue(ui->a_length, odata->arrow.length);
    SpinChoiceSetValue(ui->a_dL_ff, odata->arrow.dL_ff);
    SpinChoiceSetValue(ui->a_lL_ff, odata->arrow.lL_ff);
}
示例#3
0
static void update_pdf_setup_frame(PDF_UI_data *ui)
{
    if (ui->frame) {
        PDF_data *pdf = ui->pdf;
        
        SetOptionChoice(ui->compat,     pdf->compat);
        SetOptionChoice(ui->colorspace, pdf->colorspace);
        SetSpinChoice(ui->compression, (double) pdf->compression);
        SetSpinChoice(ui->fpprec,      (double) pdf->fpprec);
    }
}
示例#4
0
/*
 * This CB services the axis "Scale" selector 
 */
static void axis_scale_cb(OptionStructure *opt, int value, void *data)
{
    int scale = value;
    double axestart, axestop;
    char buf[32];
    TextStructure *axis_world_start;
    TextStructure *axis_world_stop;

    ExplorerUI *eui = (ExplorerUI *) data;
    GraphUI *ui = eui->graph_ui;

    if (opt == ui->scale_x) {
        axis_world_start = ui->start_x;
        axis_world_stop  = ui->stop_x;
    } else {
        axis_world_start = ui->start_y;
        axis_world_stop  = ui->stop_y;
    }

    xv_evalexpr(axis_world_start, &axestart) ;
    xv_evalexpr(axis_world_stop,  &axestop);

    switch (scale) {
    case SCALE_LOG:
        if (axestart <= 0.0 && axestop <= 0.0) {
            errmsg("Can't set logarithmic scale for negative coordinates");
            SetOptionChoice(opt, SCALE_NORMAL);
            return;
        } else if (axestart <= 0.0) {
            axestart = axestop/1.0e3;
            sprintf(buf, "%g", axestart);
            TextSetString(axis_world_start, buf);
        }
        break;
    case SCALE_LOGIT:
        if (axestart <= 0.0 && axestop <= 0.0) {
            errmsg("Can't set logit scale for values outside 0 and 1");
            SetOptionChoice(opt, SCALE_NORMAL);
            return;
        } 
        if (axestart <= 0.0) {
            axestart = 0.1;
            sprintf(buf, "%g", axestart);
            TextSetString(axis_world_start, buf);
        }
        if (axestop >= 1.0) {
            axestop = 0.95;
            sprintf(buf, "%g", axestop);
            TextSetString(axis_world_stop, buf);
        }
        break;
    }
}
示例#5
0
static void update_pnm_setup_frame(PNM_UI_data *ui)
{
    if (ui->frame) {
        PNM_data *pnm = ui->pnm;
        SetOptionChoice(ui->format, pnm->format);
        SetToggleButtonState(ui->rawbits, pnm->rawbits);
    }
}
示例#6
0
static void update_hpdf_setup_frame(HPDF_UI_data *ui)
{
    if (ui->frame) {
        HPDF_data *hpdf = ui->hpdf;
        
        SetOptionChoice(ui->colorspace, hpdf->colorspace);
        SetToggleButtonState(ui->compression, hpdf->compression);
    }
}
示例#7
0
void update_graph_ui(GraphUI *ui, Quark *q)
{
    if (q && quark_fid_get(q) == QFlavorGraph) {
        char buf[32];
        world w;
        GLocator *locator;
        
        graph_get_world(q, &w);
        locator = graph_get_locator(q);

        SetOptionChoice(ui->graph_type, graph_get_type(q));
        SetToggleButtonState(ui->stacked, graph_is_stacked(q));
        SetToggleButtonState(ui->flip_xy, graph_get_xyflip(q));

        sprintf(buf, "%.9g", w.xg1);
        xv_setstr(ui->start_x, buf);
        sprintf(buf, "%.9g", w.xg2);
        xv_setstr(ui->stop_x, buf);
        SetOptionChoice(ui->scale_x, graph_get_xscale(q));
        SetToggleButtonState(ui->invert_x, graph_is_xinvert(q));

        sprintf(buf, "%.9g", w.yg1);
        xv_setstr(ui->start_y, buf);
        sprintf(buf, "%.9g", w.yg2);
        xv_setstr(ui->stop_y, buf);
        SetOptionChoice(ui->scale_y, graph_get_yscale(q));
        SetToggleButtonState(ui->invert_y, graph_is_yinvert(q));

        sprintf(buf, "%g", graph_get_znorm(q));
        xv_setstr(ui->znorm, buf);

        SetSpinChoice(ui->bargap, graph_get_bargap(q));


	SetToggleButtonState(ui->fixedp, locator->pointset);
	SetOptionChoice(ui->loc_type, locator->type);
        SetFormatChoice(ui->loc_fx, &locator->fx);
        SetFormatChoice(ui->loc_fy, &locator->fy);
	sprintf(buf, "%g", locator->origin.x);
	xv_setstr(ui->locx, buf);
	sprintf(buf, "%g", locator->origin.y);
	xv_setstr(ui->locy, buf);
    }
}
示例#8
0
void update_object_ui(ObjectUI *ui, Quark *q)
{
    DObject *o = object_get_data(q);
    if (o && ui) {
        char *format, buf[32];
        
        if (object_get_loctype(q) == COORD_WORLD) {
            format = "%.8g";
        } else {
            format = "%.4f";
        }
        sprintf(buf, format, o->ap.x);
        TextSetString(ui->x, buf);
        sprintf(buf, format, o->ap.y);
        TextSetString(ui->y, buf);
        
        SpinChoiceSetValue(ui->offsetx, o->offset.x);
        SpinChoiceSetValue(ui->offsety, o->offset.y);
        SetAngleChoice(ui->angle, (int) rint(o->angle));
        
        SpinChoiceSetValue(ui->linew, o->line.width);
        SetOptionChoice(ui->lines, o->line.style);
        SetPenChoice(ui->linepen, &o->line.pen);
        SetPenChoice(ui->fillpen, &o->fillpen);
        
        switch (o->type) {
        case DO_LINE:
            update_line_ui(ui->line_ui, (DOLineData *) o->odata);
            
            WidgetManage(ui->line_ui->top);
            WidgetUnmanage(ui->box_ui->top);
            WidgetUnmanage(ui->arc_ui->top);
            break;
        case DO_BOX:
            update_box_ui(ui->box_ui, (DOBoxData *) o->odata);
            
            WidgetUnmanage(ui->line_ui->top);
            WidgetManage(ui->box_ui->top);
            WidgetUnmanage(ui->arc_ui->top);
            break;
        case DO_ARC:
            update_arc_ui(ui->arc_ui, (DOArcData *) o->odata);
            
            WidgetUnmanage(ui->line_ui->top);
            WidgetUnmanage(ui->box_ui->top);
            WidgetManage(ui->arc_ui->top);
            break;
        default:
            WidgetUnmanage(ui->line_ui->top);
            WidgetUnmanage(ui->box_ui->top);
            WidgetUnmanage(ui->arc_ui->top);
            break;
        }
    }
}
示例#9
0
文件: axis_ui.c 项目: mariusal/grace
void update_axis_ui(AxisUI *ui, Quark *q)
{
    if (ui && q && quark_fid_get(q) == QFlavorAxis) {
        SetOptionChoice(ui->position, axis_get_position(q));
        SpinChoiceSetValue(ui->offset, axis_get_offset(q));
        
        ToggleButtonSetState(ui->draw_bar,    axis_bar_enabled(q));
        ToggleButtonSetState(ui->draw_ticks,  axis_ticks_enabled(q));
        ToggleButtonSetState(ui->draw_labels, axis_labels_enabled(q));
    }
}
示例#10
0
static void update_arc_ui(ArcUI *ui, DOArcData *odata)
{
    SpinChoiceSetValue(ui->width,  odata->width);
    SpinChoiceSetValue(ui->height, odata->height);
    
    SetAngleChoice(ui->angle1, (int) rint(odata->angle1));
    SetAngleChoice(ui->angle2, (int) rint(odata->angle2));
    
    SetOptionChoice(ui->closure_type, odata->closure_type);
    ToggleButtonSetState(ui->draw_closure, odata->draw_closure);
}
示例#11
0
static void update_ps_setup_frame(PS_UI_data *ui)
{
    if (ui->frame) {
        PS_data *ps = ui->ps;
        
        SetToggleButtonState(ui->level2, ps->level2);
        SetOptionChoice(ui->colorspace, ps->colorspace);
        colorspace_cb(NULL, ps->level2, ui->colorspace);
        SetOptionChoice(ui->fonts, ps->fonts);
        SetOptionChoice(ui->docdata, ps->docdata);
        if (ps->format == EPS_FORMAT) {
            SetToggleButtonState(ui->printable, ps->printable);
        }
        if (ps->format == PS_FORMAT) {
            SetSpinChoice(ui->offset_x, (double) ps->offset_x);
            SetSpinChoice(ui->offset_y, (double) ps->offset_y);
            SetOptionChoice(ui->feed, ps->feed);
            SetToggleButtonState(ui->hwres, ps->hwres);
        }
    }
}
示例#12
0
static void update_jpg_setup_frame(JPG_UI_data *ui)
{
    if (ui->frame) {
        JPG_data *jpg = ui->jpg;
        
        SetToggleButtonState(ui->grayscale,   jpg->grayscale);
        SetToggleButtonState(ui->baseline,    jpg->baseline);
        SetToggleButtonState(ui->optimize,    jpg->optimize);
        SetToggleButtonState(ui->progressive, jpg->progressive);
        SetSpinChoice       (ui->quality,     jpg->quality);
        SetSpinChoice       (ui->smoothing,   jpg->smoothing);
        SetOptionChoice     (ui->dct,         jpg->dct);
    }
}
示例#13
0
文件: axis_ui.c 项目: mariusal/grace
/*
 * Fill 'Axes' dialog with values
 */
void update_axisgrid_ui(AGridUI *ui, Quark *q)
{
    tickmarks *t = axisgrid_get_data(q);

    if (t && ui) {
        char buf[128];
        int i;
        Widget vbar;

        SetOptionChoice(ui->type, t->type);

        if (is_log_axis(q)) {
            if (t->tmajor <= 1.0) {
                t->tmajor = 10.0;
            }
            sprintf(buf, "%g", t->tmajor);	    
        } else if (is_logit_axis(q)) {
	    if (t->tmajor <= 0.0) {
                t->tmajor = 0.1;
            }
	    else if (t->tmajor >= 0.5) {
                t->tmajor = 0.4;
	    }
            sprintf(buf, "%g", t->tmajor);
        } else if (t->tmajor > 0) {
            sprintf(buf, "%g", t->tmajor);
        } else {
            strcpy(buf, "UNDEFINED");
        }
        TextSetString(ui->tmajor, buf);
 
        SpinChoiceSetValue(ui->nminor, t->nminor);

        SetOptionChoice(ui->tlfont, t->tl_tprops.font);
        SetOptionChoice(ui->tlcolor, t->tl_tprops.color);
        SetOptionChoice(ui->tlskip, t->tl_skip);
        SetOptionChoice(ui->tlstagger, t->tl_staggered);
        TextSetString(ui->tlappstr, t->tl_appstr);
        TextSetString(ui->tlprestr, t->tl_prestr);
        SetOptionChoice(ui->tlstarttype, t->tl_starttype == TYPE_SPEC);
        if (t->tl_starttype == TYPE_SPEC) {
            sprintf(buf, "%f", t->tl_start);
            TextSetString(ui->tlstart, buf);
            sprintf(buf, "%f", t->tl_stop);
            TextSetString(ui->tlstop, buf);
        }
        SetOptionChoice(ui->tlstoptype, t->tl_stoptype == TYPE_SPEC);
        if (t->tl_stoptype == TYPE_SPEC) {
            sprintf(buf, "%f", t->tl_stop);
            TextSetString(ui->tlstop, buf);
        }
        SetFormatChoice(ui->tlform, &t->tl_format);
        TextSetString(ui->tlformula, t->tl_formula);

        sprintf(buf, "%.2f", t->tl_gap.x);
        TextSetString(ui->tlgap_para, buf);
        sprintf(buf, "%.2f", t->tl_gap.y);
        TextSetString(ui->tlgap_perp, buf);

        SpinChoiceSetValue(ui->tlcharsize, t->tl_tprops.charsize);
        SetAngleChoice(ui->tlangle, t->tl_tprops.angle);

        
        SetOptionChoice(ui->autonum, t->t_autonum - 2);

        ToggleButtonSetState(ui->tround, t->t_round);

        ToggleButtonSetState(ui->tgrid, t->gprops.onoff);
        SetPenChoice(ui->tgridpen, &t->gprops.line.pen);
        SpinChoiceSetValue(ui->tgridlinew, t->gprops.line.width);
        SetOptionChoice(ui->tgridlines, t->gprops.line.style);

        ToggleButtonSetState(ui->tmgrid, t->mgprops.onoff);
        SetPenChoice(ui->tmgridpen, &t->mgprops.line.pen);
        SpinChoiceSetValue(ui->tmgridlinew, t->mgprops.line.width);
        SetOptionChoice(ui->tmgridlines, t->mgprops.line.style);

        SetPenChoice(ui->barpen, &t->bar.pen);
        SpinChoiceSetValue(ui->barlinew, t->bar.width);
        SetOptionChoice(ui->barlines, t->bar.style);

        SetOptionChoice(ui->tinout, t->props.inout);
        SpinChoiceSetValue(ui->tlen, t->props.size);
        SetPenChoice(ui->tpen, &t->props.line.pen);
        SpinChoiceSetValue(ui->tlinew, t->props.line.width);
        SetOptionChoice(ui->tlines, t->props.line.style);
        
        SetOptionChoice(ui->tminout, t->mprops.inout);
        SpinChoiceSetValue(ui->tmlen, t->mprops.size);
        SetPenChoice(ui->tmpen, &t->mprops.line.pen);
        SpinChoiceSetValue(ui->tmlinew, t->mprops.line.width);
        SetOptionChoice(ui->tmlines, t->mprops.line.style);

        SetOptionChoice(ui->specticks, t->t_spec);
        SpinChoiceSetValue(ui->nspec, t->nticks);
        for (i = 0; i < t->nticks; i++) {
            sprintf(buf, "%.9g", t->tloc[i].wtpos);
            TextSetString(ui->specloc[i], buf);
            if (t->tloc[i].type == TICK_TYPE_MAJOR) {
                TextSetString(ui->speclabel[i], t->tloc[i].label);
            } else {
                TextSetString(ui->speclabel[i], "");
            }
        }

        /* set reasonable scrolling */
        vbar = GetVerticalScrollBar(ui->sw);
        if (vbar) {
            int maxval;
            GetScrollBarValues(vbar, NULL, &maxval, NULL, NULL);
            SetScrollBarIncrement(vbar, (int) rint(maxval/MAX_TICKS));
        }
    }
}
示例#14
0
void update_project_ui(ProjectUI *ui, Quark *q)
{
    Project *pr = project_get_data(q);
    if (pr) {
        int y, m, d, h, mm, sec;
        char date_string[64], wrap_year_string[64], buf[32];
        double factor;
        int format;

        SetSpinChoice(ui->prec, project_get_prec(q));
        TextSetString(ui->description, project_get_description(q));

        switch (GetOptionChoice(ui->page_size_unit)) {
        case PAGE_UNITS_IN:
            factor = 1.0/72.0;
            break;
        case PAGE_UNITS_CM:
            factor = CM_PER_INCH/72.0;
            break;
        default:
            factor = 1.0;
        }

        sprintf (buf, "%.2f", factor*pr->page_wpp); 
        TextSetString(ui->page_x, buf);
        sprintf (buf, "%.2f", factor*pr->page_hpp); 
        TextSetString(ui->page_y, buf);

        if ((pr->page_wpp == 612 && pr->page_hpp == 792) ||
            (pr->page_hpp == 612 && pr->page_wpp == 792)) {
            format = PAGE_FORMAT_USLETTER;
        } else
        if ((pr->page_wpp == 595 && pr->page_hpp == 842) ||
            (pr->page_hpp == 595 && pr->page_wpp == 842)) {
            format = PAGE_FORMAT_A4;
        } else {
            format = PAGE_FORMAT_CUSTOM;
        }
        if (format == PAGE_FORMAT_CUSTOM) {
            WidgetSetSensitive(ui->page_x->form, TRUE);
            WidgetSetSensitive(ui->page_y->form, TRUE);
            WidgetSetSensitive(ui->page_orient->menu, FALSE);
        } else {
            WidgetSetSensitive(ui->page_x->form, FALSE);
            WidgetSetSensitive(ui->page_y->form, FALSE);
            WidgetSetSensitive(ui->page_orient->menu, TRUE);
        }
        SetOptionChoice(ui->page_format, format);
        
        if (pr->page_wpp > pr->page_hpp) {
            SetOptionChoice(ui->page_orient, PAGE_ORIENT_LANDSCAPE);
        } else {
            SetOptionChoice(ui->page_orient, PAGE_ORIENT_PORTRAIT);
        }

        SetOptionChoice(ui->bg_color, pr->bgcolor);
        SetToggleButtonState(ui->bg_fill, pr->bgfill);

        SetSpinChoice(ui->fsize_scale, pr->fscale);
        SetSpinChoice(ui->lwidth_scale, pr->lscale);

	    jdate_to_datetime(q, 0.0, ROUND_SECOND, &y, &m, &d, &h, &mm, &sec);
        sprintf(date_string, "%d-%02d-%02d %02d:%02d:%02d",
            y, m, d, h, mm, sec);
        TextSetString(ui->refdate, date_string);
        SetToggleButtonState(ui->two_digits_years, pr->two_digits_years);
        sprintf(wrap_year_string, "%04d", pr->wrap_year);
        TextSetString(ui->wrap_year, wrap_year_string);
        WidgetSetSensitive(ui->wrap_year->form, pr->two_digits_years ? TRUE:FALSE);
    }
}
示例#15
0
ProjectUI *create_project_ui(ExplorerUI *eui)
{
    ProjectUI *ui;
    Widget form, fr, rc, rc1;

    form = CreateVContainer(eui->scrolled_window);
    AddHelpCB(form, "doc/UsersGuide.html#project-properties");
    
    ui = xmalloc(sizeof(ProjectUI));
    ui->current_page_units = PAGE_UNITS_PP;

    fr = CreateFrame(form, "Project description");
    ui->description  = CreateScrolledText(fr, "", 5);
    AddTextActivateCB(ui->description, text_explorer_cb, eui);

    fr = CreateFrame(form, "Page dimensions");
    rc1 = CreateVContainer(fr);

    rc = CreateHContainer(rc1);
    ui->page_orient = CreatePaperOrientationChoice(rc, "Orientation:");
    AddOptionChoiceCB(ui->page_orient, do_orient_toggle, ui);
    AddOptionChoiceCB(ui->page_orient, oc_explorer_cb, eui);

    ui->page_format = CreatePaperFormatChoice(rc, "Size:");
    AddOptionChoiceCB(ui->page_format, do_format_toggle, ui);
    AddOptionChoiceCB(ui->page_format, oc_explorer_cb, eui);

    rc = CreateHContainer(rc1);
    ui->page_x = CreateText2(rc, "Dimensions:", 7);
    AddTextActivateCB(ui->page_x, text_explorer_cb, eui);
    ui->page_y = CreateText2(rc, "x ", 7);
    AddTextActivateCB(ui->page_y, text_explorer_cb, eui);
    ui->page_size_unit = CreateOptionChoiceVA(rc, " ",
        "pp", PAGE_UNITS_PP,
        "in", PAGE_UNITS_IN,
        "cm", PAGE_UNITS_CM,
        NULL);
    SetOptionChoice(ui->page_size_unit, ui->current_page_units);
    AddOptionChoiceCB(ui->page_size_unit, do_units_toggle, ui);

    
    fr = CreateFrame(form, "Page background");
    FormAddVChild(form, fr);
    rc = CreateHContainer(fr);
    ui->bg_color = CreateColorChoice(rc, "Color:");
    AddOptionChoiceCB(ui->bg_color, oc_explorer_cb, eui);
    ui->bg_fill = CreateToggleButton(rc, "Fill");
    AddToggleButtonCB(ui->bg_fill, tb_explorer_cb, eui);

    fr = CreateFrame(form, "Scaling factors");
    FormAddVChild(form, fr);
    rc = CreateVContainer(fr);
    ui->fsize_scale = CreateSpinChoice(rc, "Font size:", 5,
        SPIN_TYPE_FLOAT, 0.0, 1.0, 0.005);
    AddSpinChoiceCB(ui->fsize_scale, sp_explorer_cb, eui);
    ui->lwidth_scale = CreateSpinChoice(rc, "Line width:", 6,
        SPIN_TYPE_FLOAT, 0.0, 1.0, 0.0005);
    AddSpinChoiceCB(ui->lwidth_scale, sp_explorer_cb, eui);

    fr = CreateFrame(form, "Data & Dates");
    rc1 = CreateVContainer(fr);
    ui->prec = CreateSpinChoice(rc1, "Data precision:", 3,
        SPIN_TYPE_INT, DATA_PREC_MIN, DATA_PREC_MAX, 1);
    AddSpinChoiceCB(ui->prec, sp_explorer_cb, eui);
    ui->refdate = CreateText2(rc1, "Reference date:", 20);
    AddTextActivateCB(ui->refdate, text_explorer_cb, eui);
    rc = CreateHContainer(rc1);
    ui->two_digits_years = CreateToggleButton(rc, "Two-digit year span");
    AddToggleButtonCB(ui->two_digits_years, tb_explorer_cb, eui);
    ui->wrap_year = CreateText2(rc, "Wrap year:", 4);
    AddTextActivateCB(ui->wrap_year, text_explorer_cb, eui);
    AddToggleButtonCB(ui->two_digits_years, wrap_year_cb, ui->wrap_year);
    
    ui->top = form;
    
    return ui;
}