static void curframe_cb(Fl_Widget *w, void *v) { Fl_Input *inp = (Fl_Input *)w; VMDApp *app = (VMDApp *)v; int val = atoi(inp->value()); int max = app->molecule_numframes(app->molecule_top()); if (val < 0) val = 0; if (val >= max) val = max-1; app->animation_set_frame(val); }
static void mol_delete_ts_cb(Fl_Widget *w, void *v) { VMDApp *app = (VMDApp *)w->user_data(); MolBrowser *browser = (MolBrowser *)v; int molid=-1; for (int i=0; i<browser->size(); i++) if (browser->selected(i+1)) { molid = app->molecule_id(i); break; } if (molid < 0) return; // this code snippet is replicated in MolBrowser.C: int numframes = app->molecule_numframes(molid); if (!numframes) { fl_alert("Molecule %d has no frames to delete!", molid); } else { const char *molname = app->molecule_name(molid); int first=0, last=numframes-1, stride=0; int ok = frame_delete_selector(molname, last, &first, &last, &stride); if (ok) app->molecule_deleteframes(molid, first, last, stride); } }