예제 #1
0
static void choice_cb(Fl_Widget* w, void* s) {
	Fl_Choice* c = (Fl_Choice*)w;
	SaverPrefs* sp = (SaverPrefs*)s;

	const char* saver_name = c->text();
	if(!saver_name)
		return;

	/* when we want to disable it */
	if(strcmp(saver_name, "(None)") == 0) {
		xscreensaver_kill_preview();
		/* just draw an empty box */
		Fl_Box* b = new Fl_Box(0, 0, 180, 134);
		preview_win->add(b);
		preview_win->redraw();

		sp->mode = SAVER_OFF;
		return;
	}

	/* FIXME: for now only one is allowed */
	sp->mode = SAVER_ONE;

	/* find the name matches in our list and run it's command */
	HackListIter it = sp->hacks.begin(), it_end = sp->hacks.end();
	for(; it != it_end; ++it) {
		if((*it)->name == saver_name) {
			xscreensaver_preview(fl_xid(preview_win), (*it)->exec.c_str());
			sp->curr_hack = (*it)->sindex;
			break;
		}
	}
}
static void repchooser_cb(Fl_Widget *w, void *v) {
  Fl_Choice *c = (Fl_Choice *)w;
  if (c->value()) 
    ((SaveTrajectoryFltkMenu *)v)->select_atoms(c->text());
}