/* * Callback for the add name button. This simply calls the blist_name_append * function and adds the name to the UI. */ static void blist_addname(Widget widget, XtPointer client_data, XtPointer cbs) { char *new_name, *end_ptr, buf[MAXNAMELEN]; XEvent *e = ((XmAnyCallbackStruct *)cbs)->event; XmString xmstr; Calendar *c = (Calendar *)client_data; Browselist *bl = (Browselist *)c->browselist; int insert_location; XtVaSetValues(bl->form, XmNresizePolicy, XmRESIZE_NONE, NULL); bl_clear_pending_change(bl); bl_list_is_changed(bl); set_message(bl->message, " "); new_name = XmTextFieldGetString(bl->username); /* crush out leading white space for the name comparison/insert process */ while ((*new_name == ' ') || (*new_name == '\t')) new_name++; /* compress off trailing whitespace */ end_ptr = new_name; while (*end_ptr) end_ptr++; while ((end_ptr > new_name) && ((*(end_ptr - 1) == ' ') || (*(end_ptr - 1) == '\t'))) end_ptr--; *end_ptr = NULL; if (blank_buf(new_name)) { set_message(bl->message, catgets(c->DT_catd, 1, 603, "Type a name to add in the User Name field")); return; } if (embedded_blank(new_name)) { set_message(bl->message, catgets(c->DT_catd, 1, 684, "User Names may not have embedded blanks or tabs")); return; } if ((insert_location = blist_name_append(c, new_name, BLIST_INSERT)) != -1) { xmstr = XmStringCreateLocalized(new_name); XmListAddItem(bl->browse_list, xmstr, insert_location); XmStringFree(xmstr); cm_select_text(bl->username, e->xbutton.time); } else { sprintf(buf, "%s %s", new_name, catgets(c->DT_catd, 1, 604, "is already in the list")); set_message(bl->message, buf); } XtVaSetValues(bl->form, XmNresizePolicy, XmRESIZE_ANY, NULL); }
/* ** This function will consume form values and stuff them into an appointment. */ extern Boolean dssw_form_to_todo(DSSW *dssw, Dtcm_appointment *a, char *name, Tick t) { time_t start_tick, stop_tick; char ampm_buf[BUFSIZ], buf[BUFSIZ]; Props *p = (Props *)dssw->cal->properties; Props_pu *pu = (Props_pu *)dssw->cal->properties_pu; DisplayType dt = get_int_prop(p, CP_DEFAULTDISP); get_dssw_vals(dssw, t); /* * Todo does not have end time. So to distinguish between this * and the editor, zero this out. */ sprintf(dssw->stop_val.val, "\0"); if (blank_buf(dssw->date_val)) { editor_err_msg(dssw->parent, name, MISSING_DATE, pu->xm_error_pixmap); return False; } if (!blank_buf(dssw->start_val.val)) { if (!valid_time(p, dssw->start_val.val)) { editor_err_msg(dssw->parent, name, INVALID_TIME, pu->xm_error_pixmap); return False; } if (dt == HOUR12) { if (dssw->start_val.block == TIME_AM) sprintf(ampm_buf, "am"); else sprintf(ampm_buf, "pm"); } else ampm_buf[0] = '\0'; sprintf(buf, "%s %s%s", dssw->date_val, dssw->start_val.val, ampm_buf); /* * No check here for stop time. */ } else { editor_err_msg(dssw->parent, name, MISSING_TIME, pu->xm_error_pixmap); return False; } start_tick = cm_getdate(buf, NULL); if(start_tick < 0) { editor_err_msg(dssw->parent, name, INVALID_DATE, pu->xm_error_pixmap); return False; } a->time->value->item.date_time_value = (char *) malloc(BUFSIZ); _csa_tick_to_iso8601(start_tick, a->time->value->item.date_time_value); a->what->value->item.string_value = (char *)cm_strdup(dssw->what_val); a->show_time->value->item.sint32_value = True; free(a->end_time->value); a->end_time->value = NULL; return True; }
extern Boolean dssw_form_flags_to_appt(DSSW *dssw, Dtcm_appointment *a, char *name, Tick t, int *flagsP) { time_t start_tick, stop_tick; char ampm_buf[BUFSIZ], buf[BUFSIZ]; Props *p = (Props *)dssw->cal->properties; Props_pu *pu = (Props_pu *)dssw->cal->properties_pu; DisplayType dt = get_int_prop(p, CP_DEFAULTDISP); int flags = 0; if (flagsP == (int *)NULL) flagsP = &flags; /* ** If neither start nor end times exist, then the start time is set ** to 3:41am (magic time) and the end time to 3:41 plus one minute. */ get_dssw_vals(dssw, t); if (blank_buf(dssw->date_val)) { editor_err_msg(dssw->parent, name, MISSING_DATE, pu->xm_error_pixmap); return False; } if (!blank_buf(dssw->start_val.val)) { if (!valid_time(p, dssw->start_val.val)) { if (a->type->value->item.sint32_value == CSA_TYPE_TODO) editor_err_msg(dssw->parent, name, INVALID_TIME_DUE, pu->xm_error_pixmap); else editor_err_msg(dssw->parent, name, INVALID_START, pu->xm_error_pixmap); return False; } if (dt == HOUR12) { /* am and pm should not be translated. They are only * used in the date parsing code and never shown to * the user. */ if (dssw->start_val.block == TIME_AM) sprintf(ampm_buf, "am"); else sprintf(ampm_buf, "pm"); } else ampm_buf[0] = '\0'; sprintf(buf, "%s %s%s", dssw->date_val, dssw->start_val.val, ampm_buf); if (!blank_buf(dssw->stop_val.val) && !valid_time(p, dssw->stop_val.val)) { editor_err_msg(dssw->parent, name, INVALID_STOP, pu->xm_error_pixmap); return False; } } else if (!blank_buf(dssw->stop_val.val)) { editor_err_msg(dssw->parent, name, MISSING_START, pu->xm_error_pixmap); return False; } else sprintf(buf, "%s 3:41am", dssw->date_val); start_tick = cm_getdate(buf, NULL); if(start_tick < 0) { editor_err_msg(dssw->parent, name, INVALID_DATE, pu->xm_error_pixmap); return False; } if (blank_buf(dssw->what_val) && blank_buf(dssw->start_val.val) && blank_buf(dssw->stop_val.val)) { editor_err_msg(dssw->parent, name, INVALID_NOTIME_APPT, pu->xm_error_pixmap); return False; } a->time->value->item.date_time_value = (char *) malloc(BUFSIZ); _csa_tick_to_iso8601(start_tick, a->time->value->item.date_time_value); a->what->value->item.string_value = (char *)cm_strdup(dssw->what_val); a->show_time->value->item.sint32_value = True; if (!blank_buf(dssw->stop_val.val)) { if (dt == HOUR12) { /* am and pm should not be translated. They are only * used in the date parsing code and never shown to * the user. */ if (dssw->stop_val.block == TIME_AM) sprintf(ampm_buf, "am"); else sprintf(ampm_buf, "pm"); } else ampm_buf[0] = '\0'; sprintf(buf, "%s %s%s", dssw->date_val, dssw->stop_val.val, ampm_buf); if ((stop_tick = cm_getdate(buf, NULL)) <= 0) { editor_err_msg(dssw->parent, name, INVALID_DATE, pu->xm_error_pixmap); return False; } if (stop_tick < start_tick) { if (*flagsP == 0) { char *title = XtNewString(catgets(calendar->DT_catd, 1, 248, "Calendar : Schedule Appointment")); char *ident1 = XtNewString(catgets(calendar->DT_catd, 1, 923, "Cancel")); char *ident2 = XtNewString(catgets(calendar->DT_catd, 1, 250, "Next Day")); sprintf(buf, "%s", catgets(calendar->DT_catd, 1, 247, "This appointment has an end time earlier than\nits begin time. Do you want to\nschedule it into the next day?")); *flagsP = dialog_popup(dssw->parent, DIALOG_TITLE, title, DIALOG_TEXT, buf, BUTTON_IDENT, -1, ident1, BUTTON_IDENT, DSSW_NEXT_DAY, ident2, DIALOG_IMAGE, pu->xm_question_pixmap, NULL); XtFree(ident2); XtFree(ident1); XtFree(title); } switch (*flagsP) { case DSSW_NEXT_DAY: stop_tick += daysec; break; default: *flagsP = 0; return False; } } a->end_time->value->item.date_time_value = (char *) malloc(BUFSIZ); _csa_tick_to_iso8601(stop_tick, a->end_time->value->item.date_time_value); } else if (blank_buf(dssw->start_val.val)) { a->end_time->value->item.date_time_value = (char *) malloc(BUFSIZ); _csa_tick_to_iso8601(start_tick + minsec, a->end_time->value->item.date_time_value); a->show_time->value->item.sint32_value = False; } else { free(a->end_time->value); a->end_time->value = NULL; } return True; }
static void cloak_draw(void *data) { switch (opt.cloak_anim) { case 0: { blank_buf(); break; } case 1: { load_val = (opt.quality / 2); draw_flame(); break; } case 2: { draw_radar(); break; } case 3: { draw_aa_radar(); break; } case 4: { draw_aa_triangle(); break; } case 5: { draw_aa_star(); break; } case 6: { draw_starfield(); break; } case 7: { draw_aa_starfield(); break; } case 8: { draw_rotator(); break; } case 9: { draw_scanner(); break; } case 10: { draw_colorwarp(); break; } case 11: { draw_ball(); break; } case 12: { draw_atoms(); break; } case 13: { draw_text(); break; } case 14: { draw_sine(); break; } case 15: { draw_funky_rotator(); break; } default: { blank_buf(); break; } } Epplet_paste_buf(buf, win, 0, 0); Epplet_timer(cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER"); return; data = NULL; }