void LLPanelClassifiedEdit::onOpen(const LLSD& key) { mIsNew = key.isUndefined(); scrollToTop(); // classified is not created yet bool is_new = isNew() || isNewWithErrors(); if(is_new) { resetData(); resetControls(); fillIn(key); if(isNew()) { LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); } } else { LLPanelClassifiedInfo::onOpen(key); } std::string save_btn_label = is_new ? getString("publish_label") : getString("save_label"); getChild<LLUICtrl>("save_changes_btn")->setLabelArg("[LABEL]", save_btn_label); enableVerbs(is_new); enableEditing(is_new); showEditing(!is_new); resetDirty(); setInfoLoaded(false); }
FillIn::FillIn(const QMap<QString, NutrientAmount>& originalNutrients, int excludeSingleFoodId, QWidget *parent) : QDialog(parent), originalNutrients(originalNutrients), excludeSingleFoodId(excludeSingleFoodId), filledIn(false) { ui.setupUi(this); connect(ui.fscSearch, SIGNAL(beginNewSearch()), this, SLOT(clearFoodList())); connect(ui.fscSearch, SIGNAL(newResult(const FoodSearchControl::Result&)), this, SLOT(addToFoodList(const FoodSearchControl::Result&))); connect(ui.lstResults, SIGNAL(currentRowChanged(int)), this, SLOT(updateMetrics())); connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(ui.btnFillIn, SIGNAL(clicked()), this, SLOT(fillIn())); QSettings settings("Nerdland", "Nutrition Tracker"); settings.beginGroup("fillin"); resize(settings.value("size", size()).toSize()); if (!settings.value("position").isNull()) { move(settings.value("position", pos()).toPoint()); } settings.endGroup(); }
void dirPopup(Widget w, XEvent *event, String *params, Cardinal *num_params) { int i; FileWindowRec *fw; Display *dpy; Window root, child; int x, y, x_win, y_win; unsigned int mask; i = findWidget(w, &fw); if (!fw) { /* error("Internal error:", "widget not found in dirPopup"); */ return; } popup_fw = fw; fileSelect(w, event, params, num_params); if (!strcmp(fw->files[i]->name, ".") || !strcmp(fw->files[i]->name, "..")) { grayOut(dir_popup_items[2]); grayOut(dir_popup_items[3]); grayOut(dir_popup_items[6]); } else { fillIn(dir_popup_items[2]); fillIn(dir_popup_items[3]); fillIn(dir_popup_items[6]); } dpy = XtDisplay(toplevel); XQueryPointer(dpy, DefaultRootWindow(dpy), &root, &child, &x, &y, &x_win, &y_win, &mask); XtVaSetValues(dir_popup_widget, XtNx, (XtArgVal) x, XtNy, (XtArgVal) y, NULL); XtPopupSpringLoaded(dir_popup_widget); }
int main(int argc, char *argv[]) { int t; #define INPUTLEN 256 char input[INPUTLEN]; char cmd[INPUTLEN]; int ins[MaxInputs]; int outs[MaxOutputs]; int index; /* check -addr 0x378 */ for (t = 1; t < argc; t++) { if (!strcmp(argv[t], "-addr")) { if (t == argc - 1) { fprintf(stderr, "no address specified\n"); exit(1); } else if (1 != sscanf(argv[t+1], "%li", &NC200_IO_ADDRESS)) { fprintf(stderr, "bad address specified: %s\n", argv[t+1]); exit(1); } else { t++; /* step over address */ continue; } } else { fprintf(stderr, "syntax: %s -addr <io address>\n", argv[0]); exit(1); } } if (-1 == nc200DioInit(0)) { fprintf(stderr, "can't init\n"); exit(1); } while (! feof(stdin)) { printf("nc200> "); fflush(stdout); if (NULL == fgets(input, INPUTLEN, stdin)) { /* EOF */ break; } if (1 != sscanf(input, "%s", cmd)) { /* blank line-- print input */ fillIn(ins); printIn(ins); continue; } if (! strcmp(cmd, "help") || ! strcmp(cmd, "?")) { printf("help/? print this help\n"); printf("s <#> set bit #\n"); printf("c <#> clear bit #\n"); printf("k check outputs\n"); printf("ENTER print inputs\n"); printf("q quit\n"); } else if (! strcmp(cmd, "s")) { /* set */ if (1 != sscanf(input, "%*s %d", &index)) { printf("bad input: %s\n", input); continue; } if (0 != nc200DioWrite(index, 1)) { printf("index out of range\n"); } } else if (! strcmp(cmd, "c")) { /* set */ if (1 != sscanf(input, "%*s %d", &index)) { printf("bad input: %s\n", input); continue; } if (0 != nc200DioWrite(index, 0)) { printf("index out of range\n"); } } else if (! strcmp(cmd, "k")) { /* check outputs */ fillOut(outs); printOut(outs); } else if (! strcmp(cmd, "q")) { break; } else { printf("?\n"); } } nc200DioQuit(); exit(0); }