Exemplo n.º 1
0
long AliasDialog::onModify(FXObject*, FXSelector, void*)
{
    FXint row = m_table->getCurrentItem();
    FXString oldkey = m_table->getItemText(row).before('\t');
    FXDialogBox aliasEdit(this, _("Alias edit"), DECOR_TITLE|DECOR_BORDER, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    FXVerticalFrame *contents = new FXVerticalFrame(&aliasEdit, LAYOUT_SIDE_LEFT|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0, 10, 10, 10, 10, 0, 0);
    FXMatrix *matrix = new FXMatrix(contents, 2, MATRIX_BY_COLUMNS|LAYOUT_SIDE_TOP|LAYOUT_FILL_X|LAYOUT_FILL_Y);
    new FXLabel(matrix, _("Alias:"), NULL, JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
    FXTextField *alias = new FXTextField(matrix, 25, NULL, 0, FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
    alias->setText(oldkey);
    new FXLabel(matrix, _("Command:"), NULL, JUSTIFY_LEFT|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
    FXTextField *command = new FXTextField(matrix, 25, NULL, 0, FRAME_THICK|FRAME_SUNKEN|LAYOUT_FILL_COLUMN|LAYOUT_FILL_ROW);
    command->setText(m_table->getItemText(row).after('\t'));

    FXHorizontalFrame *buttonframe = new FXHorizontalFrame(contents, LAYOUT_FILL_X|LAYOUT_FILL_Y|PACK_UNIFORM_WIDTH);
    new dxEXButton(buttonframe, _("&Cancel"), NULL, &aliasEdit, FXDialogBox::ID_CANCEL, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT, 0, 0, 0, 0, 10, 10, 2, 2);
    new dxEXButton(buttonframe, _("&OK"), NULL, &aliasEdit, FXDialogBox::ID_ACCEPT, BUTTON_INITIAL|BUTTON_DEFAULT|FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT, 0, 0, 0, 0, 10, 10, 2, 2);

    if(aliasEdit.execute(PLACEMENT_OWNER))
        {
        if(alias->getText().empty() || command->getText().empty())
            return 1;
        if(alias->getText()[0] != '/')
        {
            dxEXMessageBox::information(this, MBOX_OK, _("Information"), _("Alias command has to start with '/'"));
            return 1;
        }
        if(alias->getText().contains(' '))
        {
            dxEXMessageBox::information(this, MBOX_OK, _("Information"), _("Alias command cann't contain space"));
            return 1;
        }
        if(commandExist(alias->getText()) && comparecase(alias->getText(), oldkey))
        {
            dxEXMessageBox::information(this, MBOX_OK, _("Information"), _("Command '%s' already exist"), alias->getText().text());
            return 1;
        }
        m_aliases.erase(oldkey);
        m_aliases.insert(StringPair(alias->getText(), command->getText()));
        updateTable();
    }
    return 1;
}
Exemplo n.º 2
0
long fx_disp_lookup_window::on_cmd_replace_comp(FXObject *, FXSelector, void *)
{
    const int i = selected_component;
    disp_lookup *lookup = &disp->disp.lookup;
    disp_t *new_disp = ui_choose_dispersion(this);
    if (!new_disp) return 1;
    disp_free(lookup->component[i].disp);
    lookup->component[i].disp = new_disp;
    FXTextField *tf = (FXTextField *) matrix->childAtRowCol(i + 1, 1);
    tf->setText(CSTR(new_disp->name));
    return 1;
}
Exemplo n.º 3
0
long
fit_panel::on_update_param(FXObject *_txt, FXSelector, void*)
{
    FXTextField *txt = (FXTextField *) _txt;
    param_info* p = (param_info*) txt->getUserData();
    if(p->is_dirty) {
        unsigned k = this->get_parameter_index(p);
        FXString s = FXStringFormat("%g", m_fit->get_parameter_value(k));
        txt->setText(s, false);
        p->is_dirty = false;
        return 1;
    }
    return 0;
}
Exemplo n.º 4
0
void fx_disp_window::setup_name()
{
    regress_pro *app = (regress_pro *) getApp();

    FXHorizontalFrame *modelfm = new FXHorizontalFrame(this, LAYOUT_FILL_X|FRAME_GROOVE, 0,0,0,0, 0,0,0,0, 0,0);
    FXString model_name(disp->dclass->full_name);
    model_name.append(" Model");
    FXLabel *model_label = new FXLabel(modelfm, model_name, NULL, LABEL_NORMAL|LAYOUT_FILL_X, 0, 0, 0, 0, 2*DEFAULT_PAD, 2*DEFAULT_PAD, 3*DEFAULT_PAD, 3*DEFAULT_PAD);
    model_label->setFont(&app->big_web_font);
    model_label->setTextColor(app->blue_web);
    model_label->setBackColor(FXRGB(255, 206, 91));

    FXHorizontalFrame *namehf = new FXHorizontalFrame(this, LAYOUT_FILL_X);
    new FXLabel(namehf, "Name ");
    FXTextField *tf = new FXTextField(namehf, 24, this, ID_NAME, FRAME_SUNKEN);
    tf->setText(CSTR(disp->name));
}