void fit_panel::setup() { param_matrix = new FXMatrix(scroll_window, 2, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_Y|MATRIX_BY_COLUMNS, 0, 0, 0, 0, DEFAULT_SPACING, DEFAULT_SPACING, DEFAULT_SPACING, DEFAULT_SPACING, 1, 1); new FXLabel(param_matrix, "Range"); m_wl_entry = new FXTextField(param_matrix, 10, this, ID_SPECTR_RANGE, FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_ROW); config_spectral_range(); m_parameters.resize(m_fit->parameters_number()); Str pname; FXString label_text; int current_layer = 0; for(unsigned k = 0; k < m_parameters.size(); k++) { param_info* p = this->get_parameter_pointer(k); m_fit->get_parameter(k, &p->fp); if(p->fp.id == PID_LAYER_N && p->fp.layer_nb != current_layer) { current_layer = p->fp.layer_nb; label_text.format("Layer %i", current_layer); FXLabel *lab = new FXLabel(param_matrix, label_text); lab->setFont(®ressProApp()->bold_font); new FXLabel(param_matrix, ""); } get_param_name(&p->fp, pname.str()); FXString fxpname((const FXchar *) pname.cstr()); FXCheckButton* bt = new FXCheckButton(param_matrix, fxpname, this, ID_PARAM_SELECT); FXTextField* tf = new fx_numeric_field(param_matrix, 10, this, ID_PARAM_VALUE, FRAME_SUNKEN|FRAME_THICK|TEXTFIELD_REAL|LAYOUT_FILL_ROW); tf->setUserData(p); bt->setUserData(p); p->text_field = tf; p->selected = false; p->is_dirty = true; } m_undo_manager.clear(); m_canvas = new plot_canvas(this, NULL, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y); m_fit->config_plot(m_canvas); }
fit_window::fit_window(fit_manager* fit, FXApp* a,const FXString& name,FXIcon *ic,FXIcon *mi,FXuint opts,FXint x,FXint y,FXint w,FXint h,FXint pl,FXint pr,FXint pt,FXint pb,FXint hs,FXint vs) : FXMainWindow(a, "Dispersion Fit", ic, mi, opts, x, y, w, h, pl, pr, pt, pb, hs, vs), m_canvas(0), m_fit(fit) { // Menubar menubar = new FXMenuBar(this, LAYOUT_SIDE_TOP|LAYOUT_FILL_X); statusbar = new FXStatusBar(this, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_X|FRAME_RAISED|STATUSBAR_WITH_DRAGCORNER); // fit menu fitmenu = new FXMenuPane(this); new FXMenuCommand(fitmenu, "&Run", NULL, this, ID_RUN_FIT); new FXMenuTitle(menubar, "&Fit", NULL, fitmenu); // plot menu plotmenu = new FXMenuPane(this); new FXMenuCommand(plotmenu, "&Auto Scale", NULL, this, ID_PLOT_SCALE); new FXMenuTitle(menubar, "&Plot", NULL, plotmenu); FXHorizontalFrame *mf = new FXHorizontalFrame(this, LAYOUT_FILL_X|LAYOUT_FILL_Y); FXScrollWindow *iw = new FXScrollWindow(mf, VSCROLLER_ALWAYS | HSCROLLING_OFF | LAYOUT_FILL_Y); FXMatrix *matrix = new FXMatrix(iw, 2, LAYOUT_SIDE_BOTTOM|LAYOUT_FILL_Y|MATRIX_BY_COLUMNS, 0, 0, 0, 0, DEFAULT_SPACING, DEFAULT_SPACING, DEFAULT_SPACING, DEFAULT_SPACING, 1, 1); new FXLabel(matrix, "Range"); m_wl_entry = new FXTextField(matrix, 10, this, ID_SPECTR_RANGE, FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_ROW); { double wls, wle, wld; m_fit->get_sampling(wls, wle, wld); if (wld == 0.0) m_wl_entry->setText(FXStringFormat("%.3g-%.3g", wls, wle)); else m_wl_entry->setText(FXStringFormat("%.3g-%.3g,%g", wls, wle, wld)); } m_parameters.resize(m_fit->parameters_number()); m_bold_font = new FXFont(getApp(), "helvetica", 9, FXFont::Bold, FXFont::Italic); Str pname; FXString label_text; int current_layer = 0; for (unsigned k = 0; k < m_parameters.size(); k++) { param_info* p = this->get_parameter_pointer(k); m_fit->get_parameter(k, &p->fp); if (p->fp.id == PID_LAYER_N && p->fp.layer_nb != current_layer) { current_layer = p->fp.layer_nb; label_text.format("Layer %i", current_layer); FXLabel *lab = new FXLabel(matrix, label_text); lab->setFont(m_bold_font); new FXLabel(matrix, ""); } get_param_name(&p->fp, pname.str()); FXString fxpname((const FXchar *) pname.cstr()); FXCheckButton* bt = new FXCheckButton(matrix, fxpname, this, ID_PARAM_SELECT); FXTextField* tf = new fx_numeric_field(matrix, 10, this, ID_PARAM_VALUE, FRAME_SUNKEN|FRAME_THICK|TEXTFIELD_REAL|LAYOUT_FILL_ROW); tf->setUserData(p); bt->setUserData(p); p->text_field = tf; p->selected = false; p->is_dirty = true; } m_canvas = new plot_canvas(mf, NULL, 0, LAYOUT_FILL_X|LAYOUT_FILL_Y); m_fit->config_plot(m_canvas); }