commit c19356a59615a135b02388879e03a989e52831fc
parent 3c300689c349129fc61c7b9d08ba1845a69a2390
Author: Olav Sørensen <olav.sorensen@live.no>
Date: Fri, 10 May 2024 21:32:38 +0200
Pattern editor fixes
1) Now you cannot edit pattern notes/data while the pattern editor is not visible. This further prevents accidental song edits.
2) While in extended pattern editor mode, show a status bar with global volume, pattern edit status (to see if you are editing), and time elapsed.
3) It was not possible to issue a Note Insert (Insert key) or Line Insert (Shift+Insert) on some keyboards. Added extra keybindings:
Ctrl+Return = Insert Note (same as Insert)
Ctrl+Shift+Return = Insert Line (same as Shift+Insert)
Diffstat:
22 files changed, 162 insertions(+), 96 deletions(-)
diff --git a/src/ft2_about.c b/src/ft2_about.c
@@ -190,7 +190,7 @@ void renderAboutScreenFrame(void)
void showAboutScreen(void) // called once when about screen is opened
{
- if (ui.extended)
+ if (ui.extendedPatternEditor)
exitPatternEditorExtended();
hideTopScreen();
diff --git a/src/ft2_config.c b/src/ft2_config.c
@@ -1091,7 +1091,7 @@ static void setConfigMiscRadioButtonStates(void)
void showConfigScreen(void)
{
- if (ui.extended)
+ if (ui.extendedPatternEditor)
exitPatternEditorExtended();
hideTopScreen();
diff --git a/src/ft2_diskop.c b/src/ft2_diskop.c
@@ -2274,7 +2274,7 @@ void showDiskOpScreen(void)
firstTimeOpeningDiskOp = false;
}
- if (ui.extended)
+ if (ui.extendedPatternEditor)
exitPatternEditorExtended();
hideTopScreen();
diff --git a/src/ft2_edit.c b/src/ft2_edit.c
@@ -628,7 +628,7 @@ bool handleEditKeys(SDL_Keycode keycode, SDL_Scancode scancode)
(scancode >= SDL_SCANCODE_1) && (scancode <= SDL_SCANCODE_0);
if (frKeybHack || !keyb.keyModifierDown)
- return (testEditKeys(scancode, keycode));
+ return testEditKeys(scancode, keycode);
return false;
}
diff --git a/src/ft2_gui.c b/src/ft2_gui.c
@@ -1247,7 +1247,7 @@ void showTopScreen(bool restoreScreens)
void showBottomScreen(void)
{
- if (ui.extended || ui.patternEditorShown)
+ if (ui.extendedPatternEditor || ui.patternEditorShown)
showPatternEditor();
else if (ui.instEditorShown)
showInstEditor();
diff --git a/src/ft2_header.h b/src/ft2_header.h
@@ -12,7 +12,7 @@
#endif
#include "ft2_replayer.h"
-#define PROG_VER_STR "1.82"
+#define PROG_VER_STR "1.83"
// do NOT change these! It will only mess things up...
diff --git a/src/ft2_help.c b/src/ft2_help.c
@@ -373,7 +373,7 @@ void showHelpScreen(void)
{
uint16_t tmpID;
- if (ui.extended)
+ if (ui.extendedPatternEditor)
exitPatternEditorExtended();
hideTopScreen();
diff --git a/src/ft2_inst_ed.c b/src/ft2_inst_ed.c
@@ -2263,7 +2263,7 @@ void updateInstEditor(void)
void showInstEditor(void)
{
- if (ui.extended) exitPatternEditorExtended();
+ if (ui.extendedPatternEditor) exitPatternEditorExtended();
if (ui.sampleEditorShown) hideSampleEditor();
if (ui.sampleEditorExtShown) hideSampleEditorExt();
@@ -2669,7 +2669,7 @@ void drawInstEditorExt(void)
void showInstEditorExt(void)
{
- if (ui.extended)
+ if (ui.extendedPatternEditor)
exitPatternEditorExtended();
hideTopScreen();
@@ -2902,7 +2902,7 @@ bool testInstrSwitcherMouseDown(void)
if (!ui.instrSwitcherShown)
return false;
- if (ui.extended)
+ if (ui.extendedPatternEditor)
return testInstrSwitcherExtended();
else
return testInstrSwitcherNormal();
diff --git a/src/ft2_keyboard.c b/src/ft2_keyboard.c
@@ -70,6 +70,11 @@ void readKeyModifiers(void)
keyb.leftCommandPressed = (modState & KMOD_LGUI) ? true : false;
#endif
keyb.keyModifierDown = (modState & (KMOD_LSHIFT | KMOD_LCTRL | KMOD_LALT | KMOD_LGUI)) ? true : false;
+
+
+#ifdef _WIN32
+ keyb.leftWinKeyDown = (modState & KMOD_LGUI) ? true : false;
+#endif
}
void keyUpHandler(SDL_Scancode scancode, SDL_Keycode keycode)
@@ -86,7 +91,7 @@ void keyUpHandler(SDL_Scancode scancode, SDL_Keycode keycode)
return;
}
- if (cursor.object == CURSOR_NOTE && !keyb.keyModifierDown)
+ if (ui.patternEditorShown && cursor.object == CURSOR_NOTE && !keyb.keyModifierDown)
testNoteKeysRelease(scancode);
if (scancode == SDL_SCANCODE_KP_PLUS)
@@ -152,7 +157,7 @@ void keyDownHandler(SDL_Scancode scancode, SDL_Keycode keycode, bool keyWasRepea
if (scancode == SDL_SCANCODE_KP_PLUS)
keyb.numPadPlusPressed = true;
- if (handleEditKeys(keycode, scancode))
+ if (ui.patternEditorShown && handleEditKeys(keycode, scancode))
return;
if (keyb.keyModifierDown && checkModifiedKeys(keycode))
@@ -340,7 +345,7 @@ static void handleKeys(SDL_Keycode keycode, SDL_Scancode scanKey)
if (!ui.nibblesShown && !ui.configScreenShown &&
!ui.aboutScreenShown && !ui.diskOpShown &&
- !ui.helpScreenShown && !ui.extended)
+ !ui.helpScreenShown && !ui.extendedPatternEditor)
{
drawIDAdd();
}
@@ -559,7 +564,7 @@ static void handleKeys(SDL_Keycode keycode, SDL_Scancode scanKey)
break;
// PATTERN EDITOR POSITION KEYS
-
+
case SDLK_INSERT:
{
if (keyb.leftShiftPressed)
@@ -700,11 +705,18 @@ static bool checkModifiedKeys(SDL_Keycode keycode)
case SDLK_KP_ENTER:
case SDLK_RETURN:
{
- if (keyb.leftAltPressed)
+ if (keyb.leftAltPressed && !keyb.leftCtrlPressed)
{
toggleFullscreen();
return true;
}
+ else if (keyb.leftCommandPressed || keyb.leftCtrlPressed)
+ {
+ if (keyb.leftShiftPressed)
+ insertPatternLine();
+ else
+ insertPatternNote();
+ }
}
break;
@@ -897,7 +909,7 @@ static bool checkModifiedKeys(SDL_Keycode keycode)
video.showFPSCounter ^= 1;
if (!video.showFPSCounter)
{
- if (ui.extended) // yet another kludge...
+ if (ui.extendedPatternEditor) // yet another kludge...
exitPatternEditorExtended();
showTopScreen(false);
@@ -1150,7 +1162,7 @@ static bool checkModifiedKeys(SDL_Keycode keycode)
}
else if (keyb.leftCtrlPressed)
{
- if (ui.extended)
+ if (ui.extendedPatternEditor)
exitPatternEditorExtended();
if (ui.sampleEditorShown) hideSampleEditor();
diff --git a/src/ft2_keyboard.h b/src/ft2_keyboard.h
@@ -8,7 +8,7 @@ typedef struct keyb_t
{
uint8_t keyRepeat, keyPressed;
bool ignoreCurrKeyUp, ignoreTextEditKey, numPadPlusPressed;
- bool keyModifierDown, leftCommandPressed;
+ bool keyModifierDown, leftCommandPressed, leftWinKeyDown;
bool leftShiftPressed, leftCtrlPressed, leftAltPressed;
} keyb_t;
diff --git a/src/ft2_module_loader.c b/src/ft2_module_loader.c
@@ -504,7 +504,7 @@ static void setupLoadedModule(void)
diskOpSetFilename(DISKOP_ITEM_MODULE, editor.tmpFilenameU);
// redraw top part of screen
- if (ui.extended)
+ if (ui.extendedPatternEditor)
{
togglePatternEditorExtended(); // exit
togglePatternEditorExtended(); // re-enter (force redrawing)
diff --git a/src/ft2_mouse.c b/src/ft2_mouse.c
@@ -459,7 +459,7 @@ void mouseWheelHandler(bool directionUp)
if (ui.sysReqShown || editor.editTextFlag)
return;
- if (ui.extended)
+ if (ui.extendedPatternEditor)
{
if (mouse.y <= 52)
{
@@ -585,7 +585,7 @@ static bool testPatternDataMouseDown(void)
{
if (ui.patternEditorShown)
{
- const int32_t y1 = ui.extended ? 56 : 176;
+ const int32_t y1 = ui.extendedPatternEditor ? 71 : 176;
const int32_t y2 = ui.pattChanScrollShown ? 382 : 396;
if (mouse.y >= y1 && mouse.y <= y2 && mouse.x >= 29 && mouse.x <= 602)
diff --git a/src/ft2_nibbles.c b/src/ft2_nibbles.c
@@ -718,7 +718,7 @@ NoMove:
void showNibblesScreen(void)
{
- if (ui.extended)
+ if (ui.extendedPatternEditor)
exitPatternEditorExtended();
hideTopScreen();
diff --git a/src/ft2_pattern_draw.c b/src/ft2_pattern_draw.c
@@ -54,7 +54,7 @@ void updatePattFontPtrs(void)
void drawPatternBorders(void)
{
// get heights/pos/rows depending on configuration
- const pattCoord2_t *pattCoord = &pattCoord2Table[config.ptnStretch][ui.pattChanScrollShown][ui.extended];
+ const pattCoord2_t *pattCoord = &pattCoord2Table[config.ptnStretch][ui.pattChanScrollShown][ui.extendedPatternEditor];
// set pattern cursor Y position
editor.ptnCursorY = pattCoord->lowerRowsY - 9;
@@ -81,7 +81,7 @@ void drawPatternBorders(void)
{
// pattern editor w/ framework
- if (ui.extended)
+ if (ui.extendedPatternEditor)
{
vLine(0, 54, 345, PAL_DSKTOP1);
vLine(631, 53, 346, PAL_DSKTOP2);
@@ -89,8 +89,8 @@ void drawPatternBorders(void)
vLine(1, 54, 345, PAL_DESKTOP);
vLine(630, 54, 345, PAL_DESKTOP);
- hLine(0, 53, 631, PAL_DSKTOP1);
- hLine(1, 54, 630, PAL_DESKTOP);
+ hLine(0, 68, 631, PAL_DSKTOP1);
+ hLine(1, 69, 630, PAL_DESKTOP);
if (!ui.pattChanScrollShown)
{
@@ -145,7 +145,7 @@ void drawPatternBorders(void)
{
// pattern editor without framework
- if (ui.extended)
+ if (ui.extendedPatternEditor)
{
const int32_t clearSize = ui.pattChanScrollShown ? (SCREEN_W * sizeof (int32_t) * 330) : (SCREEN_W * sizeof (int32_t) * 347);
memset(&video.frameBuffer[53 * SCREEN_W], 0, clearSize);
@@ -212,7 +212,7 @@ static void writePatternBlockMark(int32_t currRow, uint32_t rowHeight, const pat
if (pattMark.markX1 > endCh || pattMark.markX2 < startCh || pattMark.markY1 > endRow || pattMark.markY2 < startRow)
return;
- const markCoord_t *markCoord = &markCoordTable[config.ptnStretch][ui.pattChanScrollShown][ui.extended];
+ const markCoord_t *markCoord = &markCoordTable[config.ptnStretch][ui.pattChanScrollShown][ui.extendedPatternEditor];
const int32_t pattYStart = markCoord->upperRowsY;
// X1
@@ -664,7 +664,8 @@ void writePattern(int32_t currRow, int32_t currPattern)
// get heights/pos/rows depending on configuration
uint32_t rowHeight = config.ptnStretch ? 11 : 8;
- const pattCoord_t *pattCoord = &pattCoordTable[config.ptnStretch][ui.pattChanScrollShown][ui.extended];
+ const pattCoord_t *pattCoord = &pattCoordTable[config.ptnStretch][ui.pattChanScrollShown][ui.extendedPatternEditor];
+ const pattCoord2_t *pattCoord2 = &pattCoord2Table[config.ptnStretch][ui.pattChanScrollShown][ui.extendedPatternEditor];
const int32_t midRowTextY = pattCoord->midRowTextY;
const int32_t lowerRowsTextY = pattCoord->lowerRowsTextY;
int32_t row = currRow - pattCoord->numUpperRows;
@@ -742,7 +743,7 @@ void writePattern(int32_t currRow, int32_t currPattern)
// channel numbers must be drawn lastly
if (config.ptnChnNumbers)
- drawChannelNumbering(pattCoord->upperRowsTextY);
+ drawChannelNumbering(pattCoord2->upperRowsY+2);
}
// ========== CHARACTER DRAWING ROUTINES FOR PATTERN EDITOR ==========
diff --git a/src/ft2_pattern_ed.c b/src/ft2_pattern_ed.c
@@ -23,7 +23,6 @@
#include "ft2_bmp.h"
#include "ft2_structs.h"
-
// for pattern marking w/ keyboard
static int8_t lastChMark;
static int16_t lastRowMark;
@@ -224,7 +223,7 @@ void hideAdvEdit(void)
void showAdvEdit(void)
{
- if (ui.extended)
+ if (ui.extendedPatternEditor)
exitPatternEditorExtended();
hideTopScreen();
@@ -296,7 +295,7 @@ void drawTranspose(void)
void showTranspose(void)
{
- if (ui.extended)
+ if (ui.extendedPatternEditor)
exitPatternEditorExtended();
hideTopScreen();
@@ -487,7 +486,7 @@ static void updatePatternEditorGUI(void)
pushButton_t *p;
textBox_t *t;
- if (ui.extended)
+ if (ui.extendedPatternEditor)
{
// extended pattern editor
@@ -624,7 +623,7 @@ void patternEditorExtended(void)
hideSampleEditor();
hideInstEditor();
- ui.extended = true;
+ ui.extendedPatternEditor = true;
ui.patternEditorShown = true;
updatePatternEditorGUI(); // change pattern editor layout (based on ui.extended flag)
ui.updatePatternEditor = true; // redraw pattern editor
@@ -639,6 +638,8 @@ void patternEditorExtended(void)
drawFramework(2, 2, 51, 20, FRAMEWORK_TYPE2);
drawFramework(2, 31, 51, 20, FRAMEWORK_TYPE2);
+ drawFramework(0, 53, SCREEN_W, 15, FRAMEWORK_TYPE1);
+
showScrollBar(SB_POS_ED);
showPushButton(PB_POSED_POS_UP);
@@ -664,6 +665,11 @@ void patternEditorExtended(void)
textOutShadow(222, 39, PAL_FORGRND, PAL_DSKTOP2, "Ptn.");
textOutShadow(305, 39, PAL_FORGRND, PAL_DSKTOP2, "Ln.");
+ textOutShadow(4, 56, PAL_FORGRND, PAL_DSKTOP2, "Global volume");
+ textOutShadow(545, 56, PAL_FORGRND, PAL_DSKTOP2, "Time");
+ charOutShadow(591, 56, PAL_FORGRND, PAL_DSKTOP2, ':');
+ charOutShadow(611, 56, PAL_FORGRND, PAL_DSKTOP2, ':');
+
ui.instrSwitcherShown = true;
showInstrumentSwitcher();
@@ -681,7 +687,7 @@ void patternEditorExtended(void)
void exitPatternEditorExtended(void)
{
- ui.extended = false;
+ ui.extendedPatternEditor = false;
updatePatternEditorGUI();
hidePushButton(PB_EXIT_EXT_PATT);
@@ -713,7 +719,7 @@ void exitPatternEditorExtended(void)
void togglePatternEditorExtended(void)
{
- if (ui.extended)
+ if (ui.extendedPatternEditor)
exitPatternEditorExtended();
else
patternEditorExtended();
@@ -777,7 +783,7 @@ static int8_t mouseXToCh(void) // used to get channel num from mouse x (for patt
static int16_t mouseYToRow(void) // used to get row num from mouse y (for pattern marking)
{
- const pattCoordsMouse_t *pattCoordsMouse = &pattCoordMouseTable[config.ptnStretch][ui.pattChanScrollShown][ui.extended];
+ const pattCoordsMouse_t *pattCoordsMouse = &pattCoordMouseTable[config.ptnStretch][ui.pattChanScrollShown][ui.extendedPatternEditor];
// clamp mouse y to boundaries
const int16_t maxY = ui.pattChanScrollShown ? 382 : 396;
@@ -806,7 +812,7 @@ static int16_t mouseYToRow(void) // used to get row num from mouse y (for patter
int16_t row = (editor.row + 1) + ((my - pattCoordsMouse->lowerRowsY) / charHeight);
// prevent being able to mark the next unseen row on the bottom (in some configurations)
- const uint8_t mode = (ui.extended * 4) + (config.ptnStretch * 2) + ui.pattChanScrollShown;
+ const uint8_t mode = (ui.extendedPatternEditor * 4) + (config.ptnStretch * 2) + ui.pattChanScrollShown;
const int16_t maxRow = (ptnNumRows[mode] + (editor.row - ptnLineSub[mode])) - 1;
if (row > maxRow)
@@ -905,7 +911,7 @@ void handlePatternDataMouseDown(bool mouseButtonHeld)
// scroll down/up with mouse (if song is not playing)
if (!songPlaying)
{
- y1 = ui.extended ? 56 : 176;
+ y1 = ui.extendedPatternEditor ? 71 : 176;
y2 = ui.pattChanScrollShown ? 382 : 396;
if (mouse.y < y1)
@@ -1970,7 +1976,7 @@ void drawPosEdNums(int16_t songPos)
songPos = song.songLength - 1;
// clear
- if (ui.extended)
+ if (ui.extendedPatternEditor)
{
clearRect(8, 4, 39, 16);
fillRect(8, 23, 39, 7, PAL_DESKTOP);
@@ -1995,7 +2001,7 @@ void drawPosEdNums(int16_t songPos)
assert(entry < 256);
- if (ui.extended)
+ if (ui.extendedPatternEditor)
{
pattTwoHexOut(8, 4 + (y * 9), (uint8_t)entry, color1);
pattTwoHexOut(32, 4 + (y * 9), song.orders[entry], color1);
@@ -2010,7 +2016,7 @@ void drawPosEdNums(int16_t songPos)
assert(songPos < 256);
// middle
- if (ui.extended)
+ if (ui.extendedPatternEditor)
{
pattTwoHexOut(8, 23, (uint8_t)songPos, color2);
pattTwoHexOut(32, 23, song.orders[songPos], color2);
@@ -2028,7 +2034,7 @@ void drawPosEdNums(int16_t songPos)
if (entry >= song.songLength)
break;
- if (ui.extended)
+ if (ui.extendedPatternEditor)
{
pattTwoHexOut(8, 33 + (y * 9), (uint8_t)entry, color1);
pattTwoHexOut(32, 33 + (y * 9), song.orders[entry], color1);
@@ -2045,7 +2051,7 @@ void drawSongLength(void)
{
int16_t x, y;
- if (ui.extended)
+ if (ui.extendedPatternEditor)
{
x = 165;
y = 5;
@@ -2063,7 +2069,7 @@ void drawSongLoopStart(void)
{
int16_t x, y;
- if (ui.extended)
+ if (ui.extendedPatternEditor)
{
x = 165;
y = 19;
@@ -2079,7 +2085,7 @@ void drawSongLoopStart(void)
void drawSongBPM(uint16_t val)
{
- if (ui.extended)
+ if (ui.extendedPatternEditor)
return;
if (val > 255)
@@ -2090,7 +2096,7 @@ void drawSongBPM(uint16_t val)
void drawSongSpeed(uint16_t val)
{
- if (ui.extended)
+ if (ui.extendedPatternEditor)
return;
if (val > 99)
@@ -2103,7 +2109,7 @@ void drawEditPattern(uint16_t editPattern)
{
int16_t x, y;
- if (ui.extended)
+ if (ui.extendedPatternEditor)
{
x = 252;
y = 39;
@@ -2121,7 +2127,7 @@ void drawPatternLength(uint16_t editPattern)
{
int16_t x, y;
- if (ui.extended)
+ if (ui.extendedPatternEditor)
{
x = 326;
y = 39;
@@ -2137,11 +2143,13 @@ void drawPatternLength(uint16_t editPattern)
void drawGlobalVol(uint16_t val)
{
- if (ui.extended)
- return;
+ uint16_t x = 87, y = 80;
+
+ if (ui.extendedPatternEditor)
+ y = 56;
assert(val <= 64);
- textOutFixed(87, 80, PAL_FORGRND, PAL_DESKTOP, dec2StrTab[val]);
+ textOutFixed(x, y, PAL_FORGRND, PAL_DESKTOP, dec2StrTab[val]);
}
void drawIDAdd(void)
@@ -2175,9 +2183,17 @@ void drawPlaybackTime(void)
last_TimeS = seconds;
}
- textOutFixed(235, 80, PAL_FORGRND, PAL_DESKTOP, dec2StrTab[last_TimeH]);
- textOutFixed(255, 80, PAL_FORGRND, PAL_DESKTOP, dec2StrTab[last_TimeM]);
- textOutFixed(275, 80, PAL_FORGRND, PAL_DESKTOP, dec2StrTab[last_TimeS]);
+ uint16_t x = 235, y = 80;
+
+ if (ui.extendedPatternEditor)
+ {
+ x = 576;
+ y = 56;
+ }
+
+ textOutFixed(x+0, y, PAL_FORGRND, PAL_DESKTOP, dec2StrTab[last_TimeH]);
+ textOutFixed(x+20, y, PAL_FORGRND, PAL_DESKTOP, dec2StrTab[last_TimeM]);
+ textOutFixed(x+40, y, PAL_FORGRND, PAL_DESKTOP, dec2StrTab[last_TimeS]);
}
void drawSongName(void)
@@ -2230,7 +2246,7 @@ void updateInstrumentSwitcher(void)
if (ui.aboutScreenShown || ui.configScreenShown || ui.helpScreenShown || ui.nibblesShown)
return; // don't redraw instrument switcher when it's not shown!
- if (ui.extended) // extended pattern editor
+ if (ui.extendedPatternEditor) // extended pattern editor
{
//INSTRUMENTS
@@ -2341,7 +2357,7 @@ void showInstrumentSwitcher(void)
for (uint16_t i = 0; i < 8; i++)
showTextBox(TB_INST1 + i);
- if (ui.extended)
+ if (ui.extendedPatternEditor)
{
hidePushButton(PB_SAMPLE_LIST_UP);
hidePushButton(PB_SAMPLE_LIST_DOWN);
diff --git a/src/ft2_sample_ed.c b/src/ft2_sample_ed.c
@@ -2955,7 +2955,7 @@ void exitSampleEditor(void)
void showSampleEditor(void)
{
- if (ui.extended)
+ if (ui.extendedPatternEditor)
exitPatternEditorExtended();
hideInstEditor();
@@ -3492,7 +3492,7 @@ void showSampleEditorExt(void)
hideTopScreen();
showTopScreen(false);
- if (ui.extended)
+ if (ui.extendedPatternEditor)
exitPatternEditorExtended();
if (!ui.sampleEditorShown)
diff --git a/src/ft2_structs.h b/src/ft2_structs.h
@@ -45,7 +45,7 @@ typedef struct ui_t
bool sysReqEnterPressed;
// all screens
- bool extended, sysReqShown;
+ bool extendedPatternEditor, sysReqShown;
// top screens
bool instrSwitcherShown, aboutScreenShown, helpScreenShown, configScreenShown;
diff --git a/src/ft2_sysreqs.c b/src/ft2_sysreqs.c
@@ -104,7 +104,7 @@ static void drawWindow(uint16_t w)
{
const uint16_t h = SYSTEM_REQUEST_H;
const uint16_t x = (SCREEN_W - w) / 2;
- const uint16_t y = ui.extended ? 91 : SYSTEM_REQUEST_Y;
+ const uint16_t y = ui.extendedPatternEditor ? 91 : SYSTEM_REQUEST_Y;
// main fill
fillRect(x + 1, y + 1, w - 2, h - 2, PAL_BUTTONS);
@@ -233,7 +233,7 @@ int16_t okBox(int16_t type, const char *headline, const char *text, void (*check
const uint16_t x = (SCREEN_W - wlen) / 2;
// the dialog's y position differs in extended pattern editor mode
- const uint16_t y = ui.extended ? SYSTEM_REQUEST_Y_EXT : SYSTEM_REQUEST_Y;
+ const uint16_t y = ui.extendedPatternEditor ? SYSTEM_REQUEST_Y_EXT : SYSTEM_REQUEST_Y;
// set up buttons
for (uint16_t i = 0; i < numButtons; i++)
@@ -456,7 +456,7 @@ int16_t inputBox(int16_t type, const char *headline, char *edText, uint16_t maxS
wlen = 600;
// the box y position differs in extended pattern editor mode
- const uint16_t y = ui.extended ? SYSTEM_REQUEST_Y_EXT : SYSTEM_REQUEST_Y;
+ const uint16_t y = ui.extendedPatternEditor ? SYSTEM_REQUEST_Y_EXT : SYSTEM_REQUEST_Y;
// set further text box settings
t->x = (SCREEN_W - TEXTBOX_W) / 2;
diff --git a/src/ft2_tables.c b/src/ft2_tables.c
@@ -471,11 +471,12 @@ const int8_t maxVisibleChans2[4] = { 4, 6, 8, 12 };
const uint16_t chanWidths[6] = { 141, 141, 93, 69, 45, 45 };
+// for pattern marking
const pattCoordsMouse_t pattCoordMouseTable[2][2][2] =
{
/*
- uint16_t upperRowsY, midRowY, lowerRowsY;
- uint16_t numUpperRows;
+ struct organization:
+ upperRowsY, midRowY, lowerRowsY, numUpperRows
*/
// no pattern stretch
@@ -483,13 +484,13 @@ const pattCoordsMouse_t pattCoordMouseTable[2][2][2] =
// no pattern channel scroll
{
{ 177, 281, 293, 13 }, // normal pattern editor
- { 57, 217, 229, 20 }, // extended pattern editor
+ { 73, 225, 237, 19 }, // extended pattern editor
},
// pattern channel scroll
{
{ 177, 274, 286, 12 }, // normal pattern editor
- { 57, 210, 222, 19 }, // extended pattern editor
+ { 73, 225, 237, 19 }, // extended pattern editor
}
},
@@ -498,13 +499,13 @@ const pattCoordsMouse_t pattCoordMouseTable[2][2][2] =
// no pattern channel scroll
{
{ 176, 275, 286, 9 }, // normal pattern editor
- { 56, 221, 232, 15 }, // extended pattern editor
+ { 75, 229, 240, 14 }, // extended pattern editor
},
// pattern channel scroll
{
- { 175, 274, 284, 9 }, // normal pattern editor
- { 55, 209, 219, 14 }, // extended pattern editor
+ { 175, 274, 283, 9 }, // normal pattern editor
+ { 73, 277, 238, 14 }, // extended pattern editor
},
}
};
@@ -565,20 +566,26 @@ const uint8_t hex2Dec[256] =
80,81,82,83,84,85
};
+// for actual pattern data drawing
const pattCoord_t pattCoordTable[2][2][2] =
{
+ /*
+ struct organization:
+ upperRowsY, lowerRowsY, upperRowsTextY, midRowTextY, lowerRowsTextY, numUpperRows, numLowerRows
+ */
+
// no pattern stretch
{
// no pattern channel scroll
{
{ 176, 292, 177, 283, 293, 13, 13 }, // normal pattern editor
- { 56, 228, 57, 219, 229, 20, 21 }, // extended pattern editor
+ { 71, 236, 73, 227, 237, 19, 20 }, // extended pattern editor
},
// pattern channel scroll
{
{ 176, 285, 177, 276, 286, 12, 12 }, // normal pattern editor
- { 56, 221, 57, 212, 222, 19, 20 }, // extended pattern editor
+ { 71, 236, 73, 227, 237, 19, 18 }, // extended pattern editor
}
},
@@ -587,31 +594,37 @@ const pattCoord_t pattCoordTable[2][2][2] =
// no pattern channel scroll
{
{ 177, 286, 178, 277, 288, 9, 10 }, // normal pattern editor
- { 56, 232, 58, 223, 234, 15, 15 }, // extended pattern editor
+ { 71, 240, 77, 231, 242, 14, 14 }, // extended pattern editor
},
// pattern channel scroll
{
{ 176, 285, 177, 276, 286, 9, 9 }, // normal pattern editor
- { 56, 220, 57, 211, 221, 14, 15 }, // extended pattern editor
+ { 71, 238, 75, 229, 240, 14, 13 }, // extended pattern editor
},
}
};
+// for framework drawing
const pattCoord2_t pattCoord2Table[2][2][2] =
{
+ /*
+ struct organization:
+ upperRowsY, lowerRowsY, upperRowsH, lowerRowsH
+ */
+
// no pattern stretch
{
// no pattern channel scroll
{
{ 175, 291, 107, 107 }, // normal pattern editor
- { 55, 227, 163, 171 }, // extended pattern editor
+ { 70, 235, 156, 163 }, // extended pattern editor
},
// pattern channel scroll
{
{ 175, 284, 100, 100 }, // normal pattern editor
- { 55, 220, 156, 164 }, // extended pattern editor
+ { 70, 235, 156, 149 }, // extended pattern editor
}
},
@@ -620,31 +633,36 @@ const pattCoord2_t pattCoord2Table[2][2][2] =
// no pattern channel scroll
{
{ 175, 285, 101, 113 }, // normal pattern editor
- { 55, 231, 167, 167 }, // extended pattern editor
+ { 70, 239, 160, 159 }, // extended pattern editor
},
// pattern channel scroll
{
{ 175, 284, 100, 100 }, // normal pattern editor
- { 55, 219, 155, 165 }, // extended pattern editor
+ { 70, 237, 158, 148 }, // extended pattern editor
},
}
};
const markCoord_t markCoordTable[2][2][2] =
{
+ /*
+ struct organization:
+ upperRowsY, midRowY, lowerRowsY
+ */
+
// no pattern stretch
{
// no pattern channel scroll
{
{ 177, 281, 293 }, // normal pattern editor
- { 57, 217, 229 }, // extended pattern editor
+ { 73, 225, 237 }, // extended pattern editor
},
// pattern channel scroll
{
{ 177, 274, 286 }, // normal pattern editor
- { 57, 210, 222 }, // extended pattern editor
+ { 73, 225, 237 }, // extended pattern editor
}
},
@@ -653,13 +671,13 @@ const markCoord_t markCoordTable[2][2][2] =
// no pattern channel scroll
{
{ 176, 275, 286 }, // normal pattern editor
- { 56, 221, 232 }, // extended pattern editor
+ { 75, 229, 240 }, // extended pattern editor
},
// pattern channel scroll
{
{ 175, 274, 284 }, // normal pattern editor
- { 55, 209, 219 }, // extended pattern editor
+ { 73, 227, 238 }, // extended pattern editor
},
}
};
diff --git a/src/ft2_trim.c b/src/ft2_trim.c
@@ -1099,7 +1099,7 @@ void hideTrimScreen(void)
void showTrimScreen(void)
{
- if (ui.extended)
+ if (ui.extendedPatternEditor)
exitPatternEditorExtended();
hideTopScreen();
diff --git a/src/ft2_video.c b/src/ft2_video.c
@@ -1034,15 +1034,34 @@ void handleRedrawing(void)
if (!songPlaying || editor.wavIsRendering)
setScrollBarPos(SB_POS_ED, editor.songPos, false);
- // draw current mode text (not while in extended pattern editor mode)
- if (!ui.extended)
+ // draw current mode text
+
+ const char *str = NULL;
+ if (playMode == PLAYMODE_PATT) str = "> Play ptn. <";
+ else if (playMode == PLAYMODE_EDIT) str = "> Editing <";
+ else if (playMode == PLAYMODE_RECSONG) str = "> Rec. sng. <";
+ else if (playMode == PLAYMODE_RECPATT) str = "> Rec. ptn. <";
+
+ uint16_t areaWidth = 102;
+ uint16_t maxStrWidth = 76; // wide enough
+ uint16_t x = 101;
+ uint16_t y = 80;
+
+ if (ui.extendedPatternEditor)
{
- fillRect(115, 80, 74, 10, PAL_DESKTOP);
+ y = 56;
+ areaWidth = 443;
+ }
+
+ // clear area
+ uint16_t clrX = x + ((areaWidth - maxStrWidth) / 2);
+ fillRect(clrX, y, maxStrWidth, FONT1_CHAR_H+1, PAL_DESKTOP);
- if (playMode == PLAYMODE_PATT) textOut(115, 80, PAL_FORGRND, "> Play ptn. <");
- else if (playMode == PLAYMODE_EDIT) textOut(121, 80, PAL_FORGRND, "> Editing <");
- else if (playMode == PLAYMODE_RECSONG) textOut(114, 80, PAL_FORGRND, "> Rec. sng. <");
- else if (playMode == PLAYMODE_RECPATT) textOut(115, 80, PAL_FORGRND, "> Rec. ptn. <");
+ // draw text (if needed)
+ if (str != NULL)
+ {
+ x += (areaWidth - textWidth(str)) / 2;
+ textOut(x, y, PAL_FORGRND, str);
}
}
}
@@ -1054,11 +1073,11 @@ void handleRedrawing(void)
setScrollBarEnd(SB_POS_ED, (song.songLength - 1) + 5);
}
- if (!ui.extended)
- {
- if (!ui.diskOpShown)
- drawPlaybackTime();
+ if (!ui.diskOpShown)
+ drawPlaybackTime();
+ if (!ui.extendedPatternEditor)
+ {
if (ui.sampleEditorExtShown)
handleSampleEditorExtRedrawing();
else if (ui.scopesShown)
diff --git a/src/ft2_wav_renderer.c b/src/ft2_wav_renderer.c
@@ -150,7 +150,7 @@ void resetWavRenderer(void)
void showWavRenderer(void)
{
- if (ui.extended)
+ if (ui.extendedPatternEditor)
exitPatternEditorExtended();
hideTopScreen();