Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 36 additions & 66 deletions src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,11 @@ void printstatus()
if (optimizerealtime)
printtext(dpos.statusTopFvX+6, dpos.statusTopY, colors.CHEADER, "RO");

if (ntsc)
printtext(dpos.statusTopFvX+9, dpos.statusTopY, colors.CHEADER, "NTSC");
else
printtext(dpos.statusTopFvX+9, dpos.statusTopY, colors.CHEADER, " PAL");
const char *clk = ntsc ? "NTSC" : "PAL";
printtext(dpos.statusTopFvX+9, dpos.statusTopY, colors.CHEADER, clk);

if (!sidmodel)
printtext(dpos.statusTopFvX+14, dpos.statusTopY, colors.CHEADER, "6581");
else
printtext(dpos.statusTopFvX+14, dpos.statusTopY, colors.CHEADER, "8580");
const char *model = sidmodel ? "8580" : "6581";
printtext(dpos.statusTopFvX+14, dpos.statusTopY, colors.CHEADER, model);

std::sprintf(textbuffer, "HR:%04X", adparam);
printtext(dpos.statusTopFvX+19, dpos.statusTopY, colors.CHEADER, textbuffer);
Expand Down Expand Up @@ -250,7 +246,6 @@ void printstatus()
{
int p = epview+d;
int color = colors.CNORMAL;
int color2;
if ((epnum[c] == chn[c].pattnum) && (isplaying()))
{
int chnrow = chn[c].pattptr / 4;
Expand Down Expand Up @@ -298,18 +293,11 @@ void printstatus()
}
}
textbuffer[3] = 0;
if (p%stepsize)
{
printtext(dpos.patternsX-1+c*13, dpos.patternsY+1+d, colors.CNORMAL, textbuffer);
}
else
{
printtext(dpos.patternsX-1+c*13, dpos.patternsY+1+d, colors.CCOMMAND, textbuffer);
}
if (color == colors.CNORMAL)
color2 = colors.CCOMMAND;
else
color2 = color;

int color2 = (p%stepsize) ? colors.CNORMAL : colors.CCOMMAND;
printtext(dpos.patternsX-1+c*13, dpos.patternsY+1+d, color2, textbuffer);

color2 = (color == colors.CNORMAL) ? colors.CCOMMAND : color;
printtext(dpos.patternsX+3+c*13, dpos.patternsY+1+d, color2, &textbuffer[4]);
printtext(dpos.patternsX+7+c*13, dpos.patternsY+1+d, color, &textbuffer[8]);
printtext(dpos.patternsX+9+c*13, dpos.patternsY+1+d, color2, &textbuffer[10]);
Expand Down Expand Up @@ -354,10 +342,8 @@ void printstatus()
printtext(dpos.orderlistX+31, dpos.orderlistY, colors.CEDIT|(colors.CHDRBG<<4), textbuffer);
std::sprintf(textbuffer, ")");
printtext(dpos.orderlistX+33, dpos.orderlistY, colors.CTITLE|(colors.CHDRBG<<4), textbuffer);
if (numsids == 2)
std::sprintf(textbuffer, " ");
else
std::sprintf(textbuffer, " ");
const char *olhdr = (numsids == 1) ? " " : " ";
std::sprintf(textbuffer, olhdr);
printtext(dpos.orderlistX+34, dpos.orderlistY, colors.CTITLE|(colors.CHDRBG<<4), textbuffer);

for (int c = 0; c < maxChns; c++)
Expand Down Expand Up @@ -500,7 +486,7 @@ void printstatus()
{
for (int d = 0; d < VISIBLETABLEROWS; d++)
{
int p = etview[c]+d;
int p = tables.view(c)+d;

int color = colors.CNORMAL;
switch (c)
Expand All @@ -517,7 +503,7 @@ void printstatus()
if ((ltable[c][p] >= 0x80) || ((!ltable[c][p]) && (rtable[c][p]))) color = colors.CCOMMAND;
break;
}
if ((p == etpos) && (etnum == c)) color = colors.CEDIT;
if ((p == tables.pos()) && (tables.num() == c)) color = colors.CEDIT;
std::sprintf(textbuffer, "%02X:%02X %02X", p+1, ltable[c][p], rtable[c][p]);
if (patterndispmode & 2)
{
Expand All @@ -529,16 +515,16 @@ void printstatus()
}
printtext(dpos.instrumentsX+12*c, dpos.instrumentsY+8+d, color, textbuffer);

if (etmarknum == c)
if (tables.marknum() == c)
{
if (etmarkstart <= etmarkend)
if (tables.markstart() <= tables.markend())
{
if ((p >= etmarkstart) && (p <= etmarkend))
if ((p >= tables.markstart()) && (p <= tables.markend()))
printbg(dpos.instrumentsX+3+12*c, dpos.instrumentsY+8+d, colors.CHDRBG, 5);
}
else
{
if ((p <= etmarkstart) && (p >= etmarkend))
if ((p <= tables.markstart()) && (p >= tables.markend()))
printbg(dpos.instrumentsX+3+12*c, dpos.instrumentsY+8+d, colors.CHDRBG, 5);
}
}
Expand All @@ -547,7 +533,7 @@ void printstatus()

if (editmode == EDIT_TABLES)
{
if (!eamode) printbg(dpos.instrumentsX+3+etnum*12+(etcolumn & 1)+(etcolumn/2)*3, dpos.instrumentsY+8+etpos-etview[etnum], cc, 1);
if (!eamode) printbg(dpos.instrumentsX+3+tables.num()*12+tables.column(), dpos.instrumentsY+8+tables.pos()-tables.curview(), cc, 1);
}

// Info view
Expand Down Expand Up @@ -599,46 +585,31 @@ void printstatus()
break;
}

if (recordmode) printtext(dpos.octaveX, dpos.octaveY+1, color, "EDITMODE");
else printtext(dpos.octaveX, dpos.octaveY+1, color, "JAM MODE");
const char *edtmode = recordmode ? "EDITMODE" : "JAM MODE";
printtext(dpos.octaveX, dpos.octaveY+1, color, edtmode);

if (isplaying()) printtext(dpos.octaveX+10, dpos.octaveY, colors.CTITLE, "PLAYING");
else printtext(dpos.octaveX+10, dpos.octaveY, colors.CTITLE, "STOPPED");
const char *playmode = isplaying() ? "PLAYING" : "STOPPED";
printtext(dpos.octaveX+10, dpos.octaveY, colors.CTITLE, playmode);
int idx;
if (multiplier)
{
if (!ntsc)
std::sprintf(textbuffer, " %02d%c%02d ", timemin, timechar[timeframe/(25*multiplier) & 1], timesec);
else
std::sprintf(textbuffer, " %02d%c%02d ", timemin, timechar[timeframe/(30*multiplier) & 1], timesec);
idx = (ntsc ? 30 : 25) * multiplier;
}
else
{
if (!ntsc)
std::sprintf(textbuffer, " %02d%c%02d ", timemin, timechar[(timeframe/13) & 1], timesec);
else
std::sprintf(textbuffer, " %02d%c%02d ", timemin, timechar[(timeframe/15) & 1], timesec);
idx = ntsc ? 15 : 13;
}
std::sprintf(textbuffer, " %02d%c%02d ", timemin, timechar[(timeframe/idx) & 1], timesec);

printtext(dpos.octaveX+10, dpos.octaveY+1, colors.CEDIT, textbuffer);

if (numsids == 1)
{
printtext(
dpos.channelsX,
dpos.channelsY,
colors.CTITLE,
" CHN1 CHN2 CHN3 "
);
}
else if (numsids == 2)
{
printtext(
dpos.channelsX,
dpos.channelsY,
colors.CTITLE,
" CHN1 CHN2 CHN3 CHN4 CHN5 CHN6 "
);
}
const char *chnls = (numsids == 1) ? " CHN1 CHN2 CHN3 " : " CHN1 CHN2 CHN3 CHN4 CHN5 CHN6 ";
printtext(
dpos.channelsX,
dpos.channelsY,
colors.CTITLE,
chnls
);
for (int c = 0; c < maxChns; c++)
{
int chnpos = chn[c].songptr;
Expand All @@ -648,13 +619,12 @@ void printstatus()
if (chnrow > getPattlen(chn[c].pattnum)) chnrow = getPattlen(chn[c].pattnum);
if (chnrow >= 100) chnrow -= 100;

std::sprintf(textbuffer, "%03X/%02X",
chnpos,chnrow);
std::sprintf(textbuffer, "%03X/%02X", chnpos, chnrow);
printtext(dpos.channelsX+7*c, dpos.channelsY+1, chn[c].mute ? colors.CMUTE : colors.CEDIT, textbuffer);
}

if (etlock) printtext(dpos.channelsX-2, dpos.channelsY+1, colors.CTITLE, " ");
else printtext(dpos.channelsX-2, dpos.channelsY+1, colors.CTITLE, "U");
const char *lock = tables.islocked() ? " " : "U";
printtext(dpos.channelsX-2, dpos.channelsY+1, colors.CTITLE, lock);
}


Expand Down
19 changes: 15 additions & 4 deletions src/instr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ void instrumentcommands()
case KEY_U:
if (shiftpressed)
{
etlock ^= 1;
validatetableview();
tables.fliplock();
tables.validatetableview();
}
break;

Expand Down Expand Up @@ -251,6 +251,17 @@ void clearinstr(int num)
}
}

void clearinstr()
{
for (int c = 0; c < MAX_INSTR; c++)
clearinstr(c);
std::memset(&instrcopybuffer, 0, sizeof(INSTR));
eipos = 0;
eicolumn = 0;
eirow = 1;
einum = 1;
}

void gotoinstr(int i)
{
if ((i < 0) || (i >= MAX_INSTR)) return;
Expand Down Expand Up @@ -279,12 +290,12 @@ void previnstr()

void showinstrtable()
{
if (!etlock)
if (!tables.islocked())
{
for (int c = MAX_TABLES-1; c >= 0; c--)
{
if (instr[einum].ptr[c])
settableviewfirst(c, instr[einum].ptr[c] - 1);
tables.settableviewfirst(c, instr[einum].ptr[c] - 1);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/instr.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ extern int einum;
extern int eirow;
extern int eipos;
extern int eicolumn;
extern INSTR instrcopybuffer;
#endif

void instrumentcommands();
void nextinstr();
void previnstr();
void clearinstr();
void clearinstr(int num);
void gotoinstr(int i);
void showinstrtable();
Expand Down
23 changes: 8 additions & 15 deletions src/loadtrk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,9 @@ void mousecommands()
(mousex <= dpos.instrumentsX+7+(MAX_TABLES-1)*12))
{
if (win_mouseywheel > 0.f)
tableup();
tables.tableup(shiftpressed);
else if (win_mouseywheel < 0.f)
tabledown();
tables.tabledown(shiftpressed);
}
}

Expand Down Expand Up @@ -729,31 +729,24 @@ void mousecommands()
(mousex >= dpos.instrumentsX+3+c*12) &&
(mousex <= dpos.instrumentsX+7+c*12))
{
int newpos = mousey-(dpos.instrumentsY+8)+etview[etnum];
int newpos = mousey-(dpos.instrumentsY+8)+tables.curview();
if (newpos < 0) newpos = 0;
if (newpos >= MAX_TABLELEN) newpos = MAX_TABLELEN-1;

editmode = EDIT_TABLES;

if ((mouseb & (MOUSEB_RIGHT|MOUSEB_MIDDLE)) && (!prevmouseb))
{
if ((etmarknum != etnum) || (newpos != etmarkend))
{
etmarknum = c;
etmarkstart = etmarkend = newpos;
}
tables.setmarkstart(c, newpos);
}
if (mouseb & MOUSEB_LEFT)
{
etnum = c;
etpos = mousey-(dpos.instrumentsY+8)+etview[etnum];
etcolumn = mousex-(dpos.instrumentsX+3+c*12);
tables.setnum(c);
tables.setpos(mousey-(dpos.instrumentsY+8)+tables.curview());
tables.setcolumn(mousex-(dpos.instrumentsX+3+c*12));
}
if (etcolumn >= 2) etcolumn--;
if (etpos < 0) etpos = 0;
if (etpos > MAX_TABLELEN-1) etpos = MAX_TABLELEN-1;

if (mouseb & (MOUSEB_RIGHT|MOUSEB_MIDDLE)) etmarkend = newpos;
if (mouseb & (MOUSEB_RIGHT|MOUSEB_MIDDLE)) tables.setmarkend(newpos);
}
}

Expand Down
Loading
Loading