Wind* windmk(char *label, char *target) { Wind *w; w = mallocz(sizeof(*w), 1); w->cs = newcontrolset(screen, nil, nil, nil); w->column = createcolumn(w->cs, "column"); w->top = createlabel(w->cs, "top"); w->body = createtext(w->cs, "body"); w->input = createentry(w->cs, "input"); w->event = chancreate(sizeof(char*), 0); w->blines = 0; if(target != nil) w->target = strdup(target); ctlprint(w->top, "value %s", label); ctlprint(w->top, "border 1"); ctlprint(w->top, "size %d %d %d %d", 10, font->height+1, 10000, font->height+1); ctlprint(w->body, "border 1"); ctlprint(w->body, "scroll 1"); ctlprint(w->input, "border 1"); ctlprint(w->input, "size %d %d %d %d", 10, font->height+1, 10000, font->height+1); controlwire(w->input, "event", w->event); chanprint(w->cs->ctl, "column add top"); chanprint(w->cs->ctl, "column add body"); chanprint(w->cs->ctl, "column add input"); activate(w->input); return w; }
/* Callback for the partition directory */ static uint8_t pdir_refill(buffer_t* buf) { cbmdirent_t dent; buf->position = 0; /* read volume name */ while(buf->pvt.pdir.part < max_part) { if (disk_label(buf->pvt.pdir.part, dent.name)) { free_buffer(buf); return 1; } dent.blocksize = buf->pvt.pdir.part+1; if (partition[buf->pvt.pdir.part].fop == &d64ops) { /* Use the correct partition type for Dxx images */ dent.typeflags = (partition[buf->pvt.pdir.part].imagetype & D64_TYPE_MASK) + TYPE_NAT - 1; } else { /* Anything else is "native" */ dent.typeflags = TYPE_NAT; } buf->pvt.pdir.part++; /* Parse the name pattern */ if (buf->pvt.pdir.matchstr && !match_name(buf->pvt.pdir.matchstr, &dent, 0)) continue; createentry(&dent, buf, DIR_FMT_CBM); return 0; } buf->lastused = 1; buf->sendeoi = 1; memset(buf->data,0,2); return 0; }