static void palette_list_draw(void) { int n, focused = (ACTIVE_PAGE.selected_widget == 48); int fg, bg; draw_fill_chars(56, 27, 76, 46, 0); fg = 6; bg = 0; if (focused && -1 == selected_palette) { fg = 0; bg = 3; } else if (-1 == selected_palette) { bg = 14; } draw_text_len("User Defined", 21, 56, 27, fg, bg); for (n = 0; n < 19 && palettes[n].name[0]; n++) { fg = 6; bg = 0; if (focused && n == selected_palette) { fg = 0; bg = 3; } else if (n == selected_palette) { bg = 14; } draw_text_len(palettes[n].name, 21, 56, 28 + n, fg, bg); } max_palette = n; }
void draw_sample_data(struct vgamem_overlay *r, song_sample_t *sample) { vgamem_ovl_clear(r, 0); if (sample->flags & CHN_ADLIB) { vgamem_ovl_clear(r, 2); vgamem_ovl_apply(r); char buf1[32], buf2[32]; int y1 = r->y1, y2 = y1+3; draw_box(59,y1, 77,y2, BOX_THICK | BOX_INNER | BOX_INSET); // data draw_box(54,y1, 58,y2, BOX_THIN | BOX_INNER | BOX_OUTSET); // button draw_text_len("Mod", 3, 55,y1+1, 0,2); draw_text_len("Car", 3, 55,y1+2, 0,2); sprintf(buf1, "%02X %02X %02X %02X %02X %02X", // length:6*3-1=17 sample->adlib_bytes[0], sample->adlib_bytes[2], sample->adlib_bytes[4], sample->adlib_bytes[6], sample->adlib_bytes[8], sample->adlib_bytes[10]); sprintf(buf2, "%02X %02X %02X %02X %02X", // length: 5*3-1=14 sample->adlib_bytes[1], sample->adlib_bytes[3], sample->adlib_bytes[5], sample->adlib_bytes[7], sample->adlib_bytes[9]); draw_text_len(buf1, 17, 60,y1+1, 2,0); draw_text_len(buf2, 17, 60,y1+2, 2,0); return; } if (!sample->length || !sample->data) { vgamem_ovl_apply(r); return; } /* do the actual drawing */ int chans = sample->flags & CHN_STEREO ? 2 : 1; if (sample->flags & CHN_16BIT) _draw_sample_data_16(r, (signed short *) sample->data, sample->length * chans, chans, chans); else _draw_sample_data_8(r, sample->data, sample->length * chans, chans, chans); if ((status.flags & CLASSIC_MODE) == 0) _draw_sample_play_marks(r, sample); _draw_sample_loop(r, sample); _draw_sample_susloop(r, sample); vgamem_ovl_apply(r); }
static void _mp_draw(void) { const char *name = NULL; int n, i; if (_mp_text[0] == '!') { /* inst */ n = instrument_get_current(); if (n) name = song_get_instrument(n)->name; else name = "(No Instrument)"; } else if (_mp_text[0] == '@') { /* samp */ n = sample_get_current(); if (n > 0) name = song_get_sample(n)->name; else name = "(No Sample)"; } else { name = _mp_text; } i = strlen(name); draw_fill_chars(_mp_text_x, _mp_text_y, _mp_text_x + 17, _mp_text_y, 2); draw_text_len( name, 17, _mp_text_x, _mp_text_y, 0, 2); if (i < 17 && name == _mp_text) { draw_char(':', _mp_text_x + i, _mp_text_y, 0, 2); } draw_box(_mp_text_x, _mp_text_y + 1, _mp_text_x + 14, _mp_text_y + 3, BOX_THIN | BOX_INNER | BOX_INSET); }
static void redraw_top_info(void) { char buf[8]; update_current_instrument(); draw_text_len(song_get_basename(), 18, 12, 4, 5, 0); draw_text_len(current_song->title, 25, 12, 3, 5, 0); if ((status.flags & (CLASSIC_MODE | SONG_NEEDS_SAVE)) == SONG_NEEDS_SAVE) draw_char('+', 29, 4, 4, 0); update_current_order(); update_current_pattern(); update_current_row(); draw_text(numtostr(3, song_get_current_speed(), buf), 50, 4, 5, 0); draw_text(numtostr(3, song_get_current_tempo(), buf), 54, 4, 5, 0); draw_char('0' + kbd_get_current_octave(), 50, 5, 5, 0); }
static void log_redraw(void) { int n, i; i = top_line; for (n = 0; n <= last_line && n < 33; n++, i++) { if (!lines[i].text) continue; if (lines[i].bios_font) { draw_text_bios_len(lines[i].text, 74, 3, 14 + n, lines[i].color, 0); } else { draw_text_len(lines[i].text, 74, 3, 14 + n, lines[i].color, 0); } } }
void update_current_instrument(void) { int ins_mode, n; char *name = NULL; char buf[4]; if (page_is_instrument_list(status.current_page) || status.current_page == PAGE_SAMPLE_LIST || status.current_page == PAGE_LOAD_SAMPLE || status.current_page == PAGE_LIBRARY_SAMPLE || (!(status.flags & CLASSIC_MODE) && (status.current_page == PAGE_ORDERLIST_PANNING || status.current_page == PAGE_ORDERLIST_VOLUMES))) ins_mode = 0; else ins_mode = song_is_instrument_mode(); if (ins_mode) { draw_text("Instrument", 39, 3, 0, 2); n = instrument_get_current(); if (n > 0) name = song_get_instrument(n)->name; } else { draw_text(" Sample", 39, 3, 0, 2); n = sample_get_current(); if (n > 0) name = song_get_sample(n)->name; } if (n > 0) { draw_text(num99tostr(n, buf), 50, 3, 5, 0); draw_text_len(name, 25, 53, 3, 5, 0); } else { draw_text("..", 50, 3, 5, 0); draw_text(".........................", 53, 3, 5, 0); } }
static void file_list_draw(void) { int n, pos, fg, bg, i; char buf[8]; char sbuf[32]; dmoz_file_t *file; /* there's no need to have if (files) { ... } like in the load-module page, because there will always be at least "/" in the list */ if (top_file < 0) top_file = 0; if (current_file < 0) current_file = 0; for (n = top_file, pos = 13; n < flist.num_files && pos < 48; n++, pos++) { file = flist.files[n]; if (n == current_file && ACTIVE_PAGE.selected_widget == 0) { fg = 0; bg = 3; } else { fg = get_type_color(file->type); bg = 0; } draw_text(numtostr(3, n, buf), 2, pos, 0, 2); draw_text_len((file->title ? file->title : ""), 25, 6, pos, fg, bg); draw_char(168, 31, pos, 2, bg); draw_text_len((file->base ? file->base : ""), 18, 32, pos, fg, bg); if (file->base && slash_search_mode > -1) { if (strncasecmp(file->base,slash_search_str,slash_search_mode) == 0) { for (i = 0 ; i < slash_search_mode; i++) { if (tolower(((unsigned)file->base[i])) != tolower(((unsigned)slash_search_str[i]))) break; draw_char(file->base[i], 32+i, pos, 3,1); } } } if (file->sampsize > 1) { sprintf(sbuf, "%u Samples", file->sampsize); draw_text_len(sbuf, 10, 51, pos, fg, bg); } else if (file->sampsize == 1) { draw_text("1 Sample ", 51, pos, fg, bg); } else if (file->type & TYPE_MODULE_MASK) { draw_text("\x9a\x9a""Module\x9a\x9a", 51, pos, fg, bg); } else { draw_text(" ", 51, pos, fg, bg); } if (file->filesize > 1048576) { sprintf(sbuf, "%lum", (unsigned long)(file->filesize / 1048576)); } else if (file->filesize > 1024) { sprintf(sbuf, "%luk", (unsigned long)(file->filesize / 1024)); } else if (file->filesize > 0) { sprintf(sbuf, "%lu", (unsigned long)(file->filesize)); } else { *sbuf = 0; } draw_text_len(sbuf, 6, 62, pos, fg, bg); } /* draw the info for the current file (or directory...) */ while (pos < 48) draw_char(168, 31, pos++, 2, 0); }
static void message_draw(void) { char *line, *prevline = current_song->message; int len = get_nth_line(current_song->message, top_line, &line); int n, cp, clipl, clipr; int skipc, cutc; draw_fill_chars(2, 13, 77, 47, 0); if (clippy_owner(CLIPPY_SELECT) == widgets_message) { clipl = widgets_message[0].clip_start; clipr = widgets_message[0].clip_end; if (clipl > clipr) { cp = clipl; clipl = clipr; clipr = cp; } } else { clipl = clipr = -1; } for (n = 0; n < 35; n++) { if (len < 0) { break; } else if (len > 0) { /* FIXME | shouldn't need this check here, * FIXME | because the line should already be * FIXME | short enough to fit */ if (len > LINE_WRAP) len = LINE_WRAP; text(line, len, n); if (clipl > -1) { cp = line - current_song->message; skipc = clipl - cp; cutc = clipr - clipl; if (skipc < 0) { cutc += skipc; /* ... -skipc */ skipc = 0; } if (cutc < 0) cutc = 0; if (cutc > (len-skipc)) cutc = (len-skipc); if (cutc > 0 && skipc < len) { if (message_extfont) draw_text_bios_len(line+skipc, cutc, 2+skipc, 13 + n, 6, 8); else draw_text_len(line+skipc, cutc, 2+skipc, 13 + n, 6, 8); } } } if (edit_mode) { draw_char(20, 2 + len, 13 + n, 1, 0); } prevline = line; len = get_nth_line(prevline, 1, &line); } if (edit_mode && len < 0) { /* end of the message */ len = get_nth_line(prevline, 0, &line); /* FIXME: see above */ if (len > LINE_WRAP) len = LINE_WRAP; draw_char(20, 2 + len, 13 + n - 1, 2, 0); } if (edit_mode) { /* draw the cursor */ len = get_nth_line(current_song->message, cursor_line, &line); /* FIXME: ... ugh */ if (len > LINE_WRAP) len = LINE_WRAP; if (cursor_char > LINE_WRAP + 1) cursor_char = LINE_WRAP + 1; if (cursor_char >= len) { (message_extfont ? draw_char_bios : draw_char) (20, 2 + cursor_char, 13 + (cursor_line - top_line), 0, 3); } else { (message_extfont ? draw_char_bios : draw_char) (line[cursor_char], 2 + cursor_char, 13 + (cursor_line - top_line), 8, 3); } } }