Exemple #1
0
static void do_format_toggle(OptionStructure *opt, int value, void *data)
{
    ProjectUI *ui = (ProjectUI *) data;
    int orientation;
    double px, py;
    int page_units;
    char buf[32];
    
    if (value == PAGE_FORMAT_CUSTOM) {
        WidgetSetSensitive(ui->page_x->form, TRUE);
        WidgetSetSensitive(ui->page_y->form, TRUE);
        WidgetSetSensitive(ui->page_orient->menu, FALSE);
        return;
    } else {
        WidgetSetSensitive(ui->page_x->form, FALSE);
        WidgetSetSensitive(ui->page_y->form, FALSE);
        WidgetSetSensitive(ui->page_orient->menu, TRUE);
    }
    
    switch (value) {
    case PAGE_FORMAT_USLETTER:
        px = 612.0;
        py = 792.0;
        break;
    case PAGE_FORMAT_A4:
        px = 595.0;
        py = 842.0;
        break;
    default:
        return;
    }

    
    page_units = GetOptionChoice(ui->page_size_unit);
    orientation = GetOptionChoice(ui->page_orient);
    
    switch (page_units) {
    case PAGE_UNITS_IN:
        px /= 72.0;
        py /= 72.0;
        break;
    case PAGE_UNITS_CM:
        px /= 72.0/CM_PER_INCH;
        py /= 72.0/CM_PER_INCH;
        break;
    }
    
    if ((orientation == PAGE_ORIENT_LANDSCAPE && px > py) ||
        (orientation == PAGE_ORIENT_PORTRAIT  && px < py) ) {
        sprintf (buf, "%.2f", px);
        TextSetString(ui->page_x, buf);
        sprintf (buf, "%.2f", py);
        TextSetString(ui->page_y, buf);
    } else {
        sprintf (buf, "%.2f", py);
        TextSetString(ui->page_x, buf);
        sprintf (buf, "%.2f", px);
        TextSetString(ui->page_y, buf);
    }
}
Exemple #2
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;
        }
    }
}
Exemple #3
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;
    }
}
Exemple #4
0
static void do_units_toggle(OptionStructure *opt, int value, void *data)
{
    ProjectUI *ui = (ProjectUI *) data;
    char buf[32];
    double page_x, page_y;
    int page_units = value;
    
    if (xv_evalexpr(ui->page_x, &page_x) != RETURN_SUCCESS ||
        xv_evalexpr(ui->page_y, &page_y) != RETURN_SUCCESS ) {
        errmsg("Invalid page dimension(s)");
        return;
    }
    
    if (ui->current_page_units == page_units) {
        return;
    }
    
    switch (ui->current_page_units) {
    case PAGE_UNITS_IN:
        page_x *= 72.0;
        page_y *= 72.0;
        break;
    case PAGE_UNITS_CM:
        page_x *= 72.0/CM_PER_INCH;
        page_y *= 72.0/CM_PER_INCH;
        break;
    }

    switch (page_units) {
    case PAGE_UNITS_IN:
        page_x /= 72.0;
        page_y /= 72.0;
        break;
    case PAGE_UNITS_CM:
        page_x /= 72.0/CM_PER_INCH;
        page_y /= 72.0/CM_PER_INCH;
        break;
    }
    
    ui->current_page_units = page_units;
    
    sprintf (buf, "%.2f", page_x); 
    TextSetString(ui->page_x, buf);
    sprintf (buf, "%.2f", page_y); 
    TextSetString(ui->page_y, buf);
}
Exemple #5
0
static void do_orient_toggle(OptionStructure *opt, int value, void *data)
{
    ProjectUI *ui = (ProjectUI *) data;
    double px, py;
    char buf[32];
    int orientation = value;

    if (xv_evalexpr(ui->page_x, &px) != RETURN_SUCCESS ||
        xv_evalexpr(ui->page_y, &py) != RETURN_SUCCESS ) {
        errmsg("Invalid page dimension(s)");
        return;
    }
    
    if ((orientation == PAGE_ORIENT_LANDSCAPE && px < py) ||
        (orientation == PAGE_ORIENT_PORTRAIT  && px > py) ) {
        sprintf (buf, "%.2f", py);
        TextSetString(ui->page_x, buf);
        sprintf (buf, "%.2f", px);
        TextSetString(ui->page_y, buf);
    }
}
Exemple #6
0
static int fonttool_aac_cb(void *data)
{
    fonttool_ui *ui = (fonttool_ui *) data;
    if (ui->cstext_parent != NULL) {
        char *s = TextGetString(ui->cstext);
        int pos = TextGetCursorPos(ui->cstext);
        TextSetString(ui->cstext_parent, s);
        TextSetCursorPos(ui->cstext_parent, pos);
        xfree(s);
    }
    
    return RETURN_SUCCESS;
}
Exemple #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);
        TextSetString(ui->start_x, buf);
        sprintf(buf, "%.9g", w.xg2);
        TextSetString(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);
        TextSetString(ui->start_y, buf);
        sprintf(buf, "%.9g", w.yg2);
        TextSetString(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));
        TextSetString(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);
        TextSetString(ui->locx, buf);
        sprintf(buf, "%g", locator->origin.y);
        TextSetString(ui->locy, buf);
    }
}
Exemple #8
0
/*
 * 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));
        }
    }
}
Exemple #9
0
static int highlight_cb(TreeEvent *event)
{
    ExplorerUI *ui = (ExplorerUI *) event->anydata;
    TreeItemList items;
    int count;
    Quark *q = NULL;
    int fid = -1;
    int parent_fid = -1;
    int homogeneous_selection = TRUE;

    TreeGetHighlighted(event->w, &items);
    count = items.count;
    
    ui->homogeneous_parent = TRUE;

    if (count > 0) {
        int i;

        q = TreeGetQuark(items.items[0]);
        fid = quark_fid_get(q);
        parent_fid = quark_fid_get(quark_parent_get(q));

        for (i = 1; i < count; i++) {
            Quark *iq = TreeGetQuark(items.items[i]);
            
            if ((int) quark_fid_get(iq) != fid) {
                homogeneous_selection = FALSE;
            }
            if ((int) quark_fid_get(quark_parent_get(iq)) != parent_fid) {
                ui->homogeneous_parent = FALSE;
            }
        }
    }
    xfree(items.items);

    if (!count || !homogeneous_selection) {
        WidgetSetSensitive(ui->aacbuts[0], FALSE);
        WidgetSetSensitive(ui->aacbuts[1], FALSE);
        
        manage_plugin(ui, NULL);
    } else {
        Widget managed_top;

        WidgetSetSensitive(ui->aacbuts[0], TRUE);
        WidgetSetSensitive(ui->aacbuts[1], TRUE);
        
        switch (fid) {
        case QFlavorProject:
            update_project_ui(ui->project_ui, q);
            managed_top = ui->project_ui->top;
            break;
        case QFlavorSSD:
            update_ssd_ui(ui->ssd_ui, q);
            managed_top = ui->ssd_ui->top;
            break;
        case QFlavorFrame:
            update_frame_ui(ui->frame_ui, q);
            managed_top = ui->frame_ui->top;
            break;
        case QFlavorGraph:
            update_graph_ui(ui->graph_ui, q);
            managed_top = ui->graph_ui->top;
            break;
        case QFlavorSet:
            update_set_ui(ui->set_ui, q);
            managed_top = ui->set_ui->top;
            break;
        case QFlavorAGrid:
            update_axisgrid_ui(ui->axisgrid_ui, q);
            managed_top = ui->axisgrid_ui->top;
            break;
        case QFlavorAxis:
            update_axis_ui(ui->axis_ui, q);
            managed_top = ui->axis_ui->top;
            break;
        case QFlavorDObject:
            update_object_ui(ui->object_ui, q);
            managed_top = ui->object_ui->top;
            break;
        case QFlavorAText:
            update_atext_ui(ui->atext_ui, q);
            managed_top = ui->atext_ui->top;
            break;
        case QFlavorRegion:
            update_region_ui(ui->region_ui, q);
            managed_top = ui->region_ui->top;
            break;
        default:
            managed_top = NULL;
            break;
        }

        manage_plugin(ui, managed_top);
    }

    WidgetSetSensitive(ui->insert_frame_bt,    FALSE);
    WidgetSetSensitive(ui->insert_graph_bt,    FALSE);
    WidgetSetSensitive(ui->insert_set_bt,      FALSE);
    WidgetSetSensitive(ui->insert_ssd_bt,      FALSE);
    WidgetSetSensitive(ui->insert_axisgrid_bt, FALSE);
    WidgetSetSensitive(ui->insert_axis_bt,     FALSE);
    WidgetSetSensitive(ui->insert_object_pane, FALSE);
    if (count == 1) {
        WidgetSetSensitive(ui->idstr->form, TRUE);
        TextSetString(ui->idstr, QIDSTR(q));
        switch (fid) {
        case QFlavorProject:
            WidgetSetSensitive(ui->insert_frame_bt,    TRUE);
            WidgetSetSensitive(ui->insert_object_pane, TRUE);
            break;
        case QFlavorFrame:
            WidgetSetSensitive(ui->insert_graph_bt,    TRUE);
            WidgetSetSensitive(ui->insert_object_pane, TRUE);
            break;
        case QFlavorGraph:
            WidgetSetSensitive(ui->insert_ssd_bt,      TRUE);
            WidgetSetSensitive(ui->insert_axisgrid_bt, TRUE);
            WidgetSetSensitive(ui->insert_object_pane, TRUE);
            break;
        case QFlavorAGrid:
            WidgetSetSensitive(ui->insert_axis_bt,     TRUE);
            break;
        case QFlavorAxis:
            WidgetSetSensitive(ui->insert_object_pane, TRUE);
            break;
        }
        
        if (get_parent_ssd(q) &&
            (fid == QFlavorGraph || fid == QFlavorSSD)) {
            WidgetSetSensitive(ui->insert_set_bt,      TRUE);
        }
    } else {
        WidgetSetSensitive(ui->idstr->form, FALSE);
        TextSetString(ui->idstr, NULL);
    }

    return TRUE;
}
Exemple #10
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);
    }
}
Exemple #11
0
void create_fonttool(TextStructure *cstext_parent)
{
    static fonttool_ui *ui = NULL;
    
    if (ui == NULL) {
        ui = xmalloc(sizeof(fonttool_ui));
        memset(ui, 0, sizeof(fonttool_ui));
	
        ui->fonttool_panel = CreateDialog(app_shell, "Font tool");

        ui->font_select = CreateFontChoice(ui->fonttool_panel, "Font:");
        FormAddVChild(ui->fonttool_panel, ui->font_select->menu);
        
        ui->font_table = CreateTable("fontTable", ui->fonttool_panel,
                                     FONT_TOOL_ROWS, FONT_TOOL_COLS,
                                     8, 16);
        TableFontInit(ui->font_table);
        TableSetDefaultColWidth(ui->font_table, 2);
        TableSetDefaultColAlignment(ui->font_table, ALIGN_BEGINNING);
        TableUpdateVisibleRowsCols(ui->font_table);

        AddTableDrawCellCB(ui->font_table, DrawCB, ui);
        AddTableEnterCellCB(ui->font_table, EnterCB, ui);
        AddOptionChoiceCB(ui->font_select, update_fonttool_cb, ui);

        FormAddVChild(ui->fonttool_panel, ui->font_table);

        ui->cstext = CreateCSText(ui->fonttool_panel, "CString:");

        AddTextValidateCB(ui->cstext, EditStringCB, ui);
        
        ui->aac_buts = CreateAACDialog(ui->fonttool_panel,
            ui->cstext->form, fonttool_aac_cb, ui);

        FormFixateVChild(ui->cstext->form);
        
        update_fonttool_cb(NULL, 0, ui);
    }

    if (cstext_parent == ui->cstext) {
        /* avoid recursion */
        return;
    }
    
    ui->cstext_parent = cstext_parent;
    
    if (ui->cstext_parent == NULL) {
        TextSetString(ui->cstext, "");
        WidgetSetSensitive(ui->aac_buts[0], FALSE);
        WidgetSetSensitive(ui->aac_buts[1], FALSE);
    } else {
        char *s = TextGetString(ui->cstext_parent);
        int pos = TextGetCursorPos(ui->cstext_parent);
        TextSetString(ui->cstext, s);
        TextSetCursorPos(ui->cstext, pos);
        xfree(s);
        WidgetSetSensitive(ui->aac_buts[0], TRUE);
        WidgetSetSensitive(ui->aac_buts[1], TRUE);
    }
    
    DialogRaise(ui->fonttool_panel);
}