add option to save unused patterns
closes #106 also prepare for the pattern manager window
This commit is contained in:
parent
edddff8431
commit
d1c5a4725b
|
@ -531,6 +531,7 @@ src/gui/midiMap.cpp
|
||||||
src/gui/newSong.cpp
|
src/gui/newSong.cpp
|
||||||
src/gui/orders.cpp
|
src/gui/orders.cpp
|
||||||
src/gui/osc.cpp
|
src/gui/osc.cpp
|
||||||
|
src/gui/patManager.cpp
|
||||||
src/gui/pattern.cpp
|
src/gui/pattern.cpp
|
||||||
src/gui/piano.cpp
|
src/gui/piano.cpp
|
||||||
src/gui/presets.cpp
|
src/gui/presets.cpp
|
||||||
|
|
|
@ -3515,15 +3515,27 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) {
|
||||||
// high short is channel
|
// high short is channel
|
||||||
// low short is pattern number
|
// low short is pattern number
|
||||||
std::vector<PatToWrite> patsToWrite;
|
std::vector<PatToWrite> patsToWrite;
|
||||||
bool alreadyAdded[256];
|
if (getConfInt("saveUnusedPatterns",0)==1) {
|
||||||
for (int i=0; i<chans; i++) {
|
for (int i=0; i<chans; i++) {
|
||||||
for (size_t j=0; j<song.subsong.size(); j++) {
|
for (size_t j=0; j<song.subsong.size(); j++) {
|
||||||
DivSubSong* subs=song.subsong[j];
|
DivSubSong* subs=song.subsong[j];
|
||||||
memset(alreadyAdded,0,256*sizeof(bool));
|
for (int k=0; k<256; k++) {
|
||||||
for (int k=0; k<subs->ordersLen; k++) {
|
if (subs->pat[i].data[k]==NULL) continue;
|
||||||
if (alreadyAdded[subs->orders.ord[i][k]]) continue;
|
patsToWrite.push_back(PatToWrite(j,i,k));
|
||||||
patsToWrite.push_back(PatToWrite(j,i,subs->orders.ord[i][k]));
|
}
|
||||||
alreadyAdded[subs->orders.ord[i][k]]=true;
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
bool alreadyAdded[256];
|
||||||
|
for (int i=0; i<chans; i++) {
|
||||||
|
for (size_t j=0; j<song.subsong.size(); j++) {
|
||||||
|
DivSubSong* subs=song.subsong[j];
|
||||||
|
memset(alreadyAdded,0,256*sizeof(bool));
|
||||||
|
for (int k=0; k<subs->ordersLen; k++) {
|
||||||
|
if (alreadyAdded[subs->orders.ord[i][k]]) continue;
|
||||||
|
patsToWrite.push_back(PatToWrite(j,i,subs->orders.ord[i][k]));
|
||||||
|
alreadyAdded[subs->orders.ord[i][k]]=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,6 +238,9 @@ void FurnaceGUI::doAction(int what) {
|
||||||
case GUI_ACTION_WINDOW_CHANNELS:
|
case GUI_ACTION_WINDOW_CHANNELS:
|
||||||
nextWindow=GUI_WINDOW_CHANNELS;
|
nextWindow=GUI_WINDOW_CHANNELS;
|
||||||
break;
|
break;
|
||||||
|
case GUI_ACTION_WINDOW_PAT_MANAGER:
|
||||||
|
nextWindow=GUI_WINDOW_PAT_MANAGER;
|
||||||
|
break;
|
||||||
case GUI_ACTION_WINDOW_REGISTER_VIEW:
|
case GUI_ACTION_WINDOW_REGISTER_VIEW:
|
||||||
nextWindow=GUI_WINDOW_REGISTER_VIEW;
|
nextWindow=GUI_WINDOW_REGISTER_VIEW;
|
||||||
break;
|
break;
|
||||||
|
@ -322,6 +325,9 @@ void FurnaceGUI::doAction(int what) {
|
||||||
case GUI_WINDOW_CHANNELS:
|
case GUI_WINDOW_CHANNELS:
|
||||||
channelsOpen=false;
|
channelsOpen=false;
|
||||||
break;
|
break;
|
||||||
|
case GUI_WINDOW_PAT_MANAGER:
|
||||||
|
patManagerOpen=false;
|
||||||
|
break;
|
||||||
case GUI_WINDOW_REGISTER_VIEW:
|
case GUI_WINDOW_REGISTER_VIEW:
|
||||||
regViewOpen=false;
|
regViewOpen=false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -3107,6 +3107,7 @@ bool FurnaceGUI::loop() {
|
||||||
if (ImGui::MenuItem("pattern",BIND_FOR(GUI_ACTION_WINDOW_PATTERN),patternOpen)) patternOpen=!patternOpen;
|
if (ImGui::MenuItem("pattern",BIND_FOR(GUI_ACTION_WINDOW_PATTERN),patternOpen)) patternOpen=!patternOpen;
|
||||||
if (ImGui::MenuItem("mixer",BIND_FOR(GUI_ACTION_WINDOW_MIXER),mixerOpen)) mixerOpen=!mixerOpen;
|
if (ImGui::MenuItem("mixer",BIND_FOR(GUI_ACTION_WINDOW_MIXER),mixerOpen)) mixerOpen=!mixerOpen;
|
||||||
if (ImGui::MenuItem("channels",BIND_FOR(GUI_ACTION_WINDOW_CHANNELS),channelsOpen)) channelsOpen=!channelsOpen;
|
if (ImGui::MenuItem("channels",BIND_FOR(GUI_ACTION_WINDOW_CHANNELS),channelsOpen)) channelsOpen=!channelsOpen;
|
||||||
|
if (ImGui::MenuItem("pattern manager",BIND_FOR(GUI_ACTION_WINDOW_PAT_MANAGER),patManagerOpen)) patManagerOpen=!patManagerOpen;
|
||||||
if (ImGui::MenuItem("compatibility flags",BIND_FOR(GUI_ACTION_WINDOW_COMPAT_FLAGS),compatFlagsOpen)) compatFlagsOpen=!compatFlagsOpen;
|
if (ImGui::MenuItem("compatibility flags",BIND_FOR(GUI_ACTION_WINDOW_COMPAT_FLAGS),compatFlagsOpen)) compatFlagsOpen=!compatFlagsOpen;
|
||||||
if (ImGui::MenuItem("song comments",BIND_FOR(GUI_ACTION_WINDOW_NOTES),notesOpen)) notesOpen=!notesOpen;
|
if (ImGui::MenuItem("song comments",BIND_FOR(GUI_ACTION_WINDOW_NOTES),notesOpen)) notesOpen=!notesOpen;
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
@ -3241,6 +3242,7 @@ bool FurnaceGUI::loop() {
|
||||||
drawPiano();
|
drawPiano();
|
||||||
drawNotes();
|
drawNotes();
|
||||||
drawChannels();
|
drawChannels();
|
||||||
|
drawPatManager();
|
||||||
drawRegView();
|
drawRegView();
|
||||||
drawLog();
|
drawLog();
|
||||||
drawEffectList();
|
drawEffectList();
|
||||||
|
@ -4361,6 +4363,7 @@ bool FurnaceGUI::init() {
|
||||||
pianoOpen=e->getConfBool("pianoOpen",false);
|
pianoOpen=e->getConfBool("pianoOpen",false);
|
||||||
notesOpen=e->getConfBool("notesOpen",false);
|
notesOpen=e->getConfBool("notesOpen",false);
|
||||||
channelsOpen=e->getConfBool("channelsOpen",false);
|
channelsOpen=e->getConfBool("channelsOpen",false);
|
||||||
|
patManagerOpen=e->getConfBool("patManagerOpen",false);
|
||||||
regViewOpen=e->getConfBool("regViewOpen",false);
|
regViewOpen=e->getConfBool("regViewOpen",false);
|
||||||
logOpen=e->getConfBool("logOpen",false);
|
logOpen=e->getConfBool("logOpen",false);
|
||||||
effectListOpen=e->getConfBool("effectListOpen",false);
|
effectListOpen=e->getConfBool("effectListOpen",false);
|
||||||
|
@ -4603,6 +4606,7 @@ bool FurnaceGUI::finish() {
|
||||||
e->setConf("pianoOpen",pianoOpen);
|
e->setConf("pianoOpen",pianoOpen);
|
||||||
e->setConf("notesOpen",notesOpen);
|
e->setConf("notesOpen",notesOpen);
|
||||||
e->setConf("channelsOpen",channelsOpen);
|
e->setConf("channelsOpen",channelsOpen);
|
||||||
|
e->setConf("patManagerOpen",patManagerOpen);
|
||||||
e->setConf("regViewOpen",regViewOpen);
|
e->setConf("regViewOpen",regViewOpen);
|
||||||
e->setConf("logOpen",logOpen);
|
e->setConf("logOpen",logOpen);
|
||||||
e->setConf("effectListOpen",effectListOpen);
|
e->setConf("effectListOpen",effectListOpen);
|
||||||
|
@ -4782,6 +4786,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
subSongsOpen(true),
|
subSongsOpen(true),
|
||||||
findOpen(false),
|
findOpen(false),
|
||||||
spoilerOpen(false),
|
spoilerOpen(false),
|
||||||
|
patManagerOpen(false),
|
||||||
selecting(false),
|
selecting(false),
|
||||||
selectingFull(false),
|
selectingFull(false),
|
||||||
dragging(false),
|
dragging(false),
|
||||||
|
|
|
@ -242,6 +242,7 @@ enum FurnaceGUIWindows {
|
||||||
GUI_WINDOW_PIANO,
|
GUI_WINDOW_PIANO,
|
||||||
GUI_WINDOW_NOTES,
|
GUI_WINDOW_NOTES,
|
||||||
GUI_WINDOW_CHANNELS,
|
GUI_WINDOW_CHANNELS,
|
||||||
|
GUI_WINDOW_PAT_MANAGER,
|
||||||
GUI_WINDOW_REGISTER_VIEW,
|
GUI_WINDOW_REGISTER_VIEW,
|
||||||
GUI_WINDOW_LOG,
|
GUI_WINDOW_LOG,
|
||||||
GUI_WINDOW_EFFECT_LIST,
|
GUI_WINDOW_EFFECT_LIST,
|
||||||
|
@ -361,6 +362,7 @@ enum FurnaceGUIActions {
|
||||||
GUI_ACTION_WINDOW_PIANO,
|
GUI_ACTION_WINDOW_PIANO,
|
||||||
GUI_ACTION_WINDOW_NOTES,
|
GUI_ACTION_WINDOW_NOTES,
|
||||||
GUI_ACTION_WINDOW_CHANNELS,
|
GUI_ACTION_WINDOW_CHANNELS,
|
||||||
|
GUI_ACTION_WINDOW_PAT_MANAGER,
|
||||||
GUI_ACTION_WINDOW_REGISTER_VIEW,
|
GUI_ACTION_WINDOW_REGISTER_VIEW,
|
||||||
GUI_ACTION_WINDOW_LOG,
|
GUI_ACTION_WINDOW_LOG,
|
||||||
GUI_ACTION_WINDOW_EFFECT_LIST,
|
GUI_ACTION_WINDOW_EFFECT_LIST,
|
||||||
|
@ -1117,6 +1119,7 @@ class FurnaceGUI {
|
||||||
int unsignedDetune;
|
int unsignedDetune;
|
||||||
int noThreadedInput;
|
int noThreadedInput;
|
||||||
int clampSamples;
|
int clampSamples;
|
||||||
|
int saveUnusedPatterns;
|
||||||
unsigned int maxUndoSteps;
|
unsigned int maxUndoSteps;
|
||||||
String mainFontPath;
|
String mainFontPath;
|
||||||
String patFontPath;
|
String patFontPath;
|
||||||
|
@ -1228,6 +1231,7 @@ class FurnaceGUI {
|
||||||
unsignedDetune(0),
|
unsignedDetune(0),
|
||||||
noThreadedInput(0),
|
noThreadedInput(0),
|
||||||
clampSamples(0),
|
clampSamples(0),
|
||||||
|
saveUnusedPatterns(0),
|
||||||
maxUndoSteps(100),
|
maxUndoSteps(100),
|
||||||
mainFontPath(""),
|
mainFontPath(""),
|
||||||
patFontPath(""),
|
patFontPath(""),
|
||||||
|
@ -1257,7 +1261,7 @@ class FurnaceGUI {
|
||||||
bool waveListOpen, waveEditOpen, sampleListOpen, sampleEditOpen, aboutOpen, settingsOpen;
|
bool waveListOpen, waveEditOpen, sampleListOpen, sampleEditOpen, aboutOpen, settingsOpen;
|
||||||
bool mixerOpen, debugOpen, inspectorOpen, oscOpen, volMeterOpen, statsOpen, compatFlagsOpen;
|
bool mixerOpen, debugOpen, inspectorOpen, oscOpen, volMeterOpen, statsOpen, compatFlagsOpen;
|
||||||
bool pianoOpen, notesOpen, channelsOpen, regViewOpen, logOpen, effectListOpen, chanOscOpen;
|
bool pianoOpen, notesOpen, channelsOpen, regViewOpen, logOpen, effectListOpen, chanOscOpen;
|
||||||
bool subSongsOpen, findOpen, spoilerOpen;
|
bool subSongsOpen, findOpen, spoilerOpen, patManagerOpen;
|
||||||
|
|
||||||
SelectionPoint selStart, selEnd, cursor, cursorDrag, dragStart, dragEnd;
|
SelectionPoint selStart, selEnd, cursor, cursorDrag, dragStart, dragEnd;
|
||||||
bool selecting, selectingFull, dragging, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI;
|
bool selecting, selectingFull, dragging, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI;
|
||||||
|
@ -1566,6 +1570,7 @@ class FurnaceGUI {
|
||||||
void drawPiano();
|
void drawPiano();
|
||||||
void drawNotes();
|
void drawNotes();
|
||||||
void drawChannels();
|
void drawChannels();
|
||||||
|
void drawPatManager();
|
||||||
void drawRegView();
|
void drawRegView();
|
||||||
void drawAbout();
|
void drawAbout();
|
||||||
void drawSettings();
|
void drawSettings();
|
||||||
|
|
|
@ -487,6 +487,7 @@ const FurnaceGUIActionDef guiActions[GUI_ACTION_MAX]={
|
||||||
D("WINDOW_PIANO", "Piano", 0),
|
D("WINDOW_PIANO", "Piano", 0),
|
||||||
D("WINDOW_NOTES", "Song Comments", 0),
|
D("WINDOW_NOTES", "Song Comments", 0),
|
||||||
D("WINDOW_CHANNELS", "Channels", 0),
|
D("WINDOW_CHANNELS", "Channels", 0),
|
||||||
|
D("WINDOW_PAT_MANAGER", "Pattern Manager", 0),
|
||||||
D("WINDOW_REGISTER_VIEW", "Register View", 0),
|
D("WINDOW_REGISTER_VIEW", "Register View", 0),
|
||||||
D("WINDOW_LOG", "Log Viewer", 0),
|
D("WINDOW_LOG", "Log Viewer", 0),
|
||||||
D("EFFECT_LIST", "Effect List", 0),
|
D("EFFECT_LIST", "Effect List", 0),
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/**
|
||||||
|
* Furnace Tracker - multi-system chiptune tracker
|
||||||
|
* Copyright (C) 2021-2022 tildearrow and contributors
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gui.h"
|
||||||
|
#include "misc/cpp/imgui_stdlib.h"
|
||||||
|
#include "IconsFontAwesome4.h"
|
||||||
|
#include <imgui.h>
|
||||||
|
|
||||||
|
void FurnaceGUI::drawPatManager() {
|
||||||
|
if (nextWindow==GUI_WINDOW_PAT_MANAGER) {
|
||||||
|
patManagerOpen=true;
|
||||||
|
ImGui::SetNextWindowFocus();
|
||||||
|
nextWindow=GUI_WINDOW_NOTHING;
|
||||||
|
}
|
||||||
|
if (!patManagerOpen) return;
|
||||||
|
if (ImGui::Begin("Pattern Manager",&patManagerOpen,globalWinFlags)) {
|
||||||
|
ImGui::Text("Hello World!");
|
||||||
|
}
|
||||||
|
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_PAT_MANAGER;
|
||||||
|
ImGui::End();
|
||||||
|
}
|
|
@ -514,6 +514,11 @@ void FurnaceGUI::drawSettings() {
|
||||||
settings.blankIns=blankInsB;
|
settings.blankIns=blankInsB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool saveUnusedPatternsB=settings.saveUnusedPatterns;
|
||||||
|
if (ImGui::Checkbox("Save unused patterns",&saveUnusedPatternsB)) {
|
||||||
|
settings.saveUnusedPatterns=saveUnusedPatternsB;
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Text("Note preview behavior:");
|
ImGui::Text("Note preview behavior:");
|
||||||
if (ImGui::RadioButton("Never##npb0",settings.notePreviewBehavior==0)) {
|
if (ImGui::RadioButton("Never##npb0",settings.notePreviewBehavior==0)) {
|
||||||
settings.notePreviewBehavior=0;
|
settings.notePreviewBehavior=0;
|
||||||
|
@ -2133,6 +2138,7 @@ void FurnaceGUI::syncSettings() {
|
||||||
settings.macroRelLabel=e->getConfString("macroRelLabel","REL");
|
settings.macroRelLabel=e->getConfString("macroRelLabel","REL");
|
||||||
settings.emptyLabel=e->getConfString("emptyLabel","...");
|
settings.emptyLabel=e->getConfString("emptyLabel","...");
|
||||||
settings.emptyLabel2=e->getConfString("emptyLabel2","..");
|
settings.emptyLabel2=e->getConfString("emptyLabel2","..");
|
||||||
|
settings.saveUnusedPatterns=e->getConfInt("saveUnusedPatterns",0);
|
||||||
|
|
||||||
clampSetting(settings.mainFontSize,2,96);
|
clampSetting(settings.mainFontSize,2,96);
|
||||||
clampSetting(settings.patFontSize,2,96);
|
clampSetting(settings.patFontSize,2,96);
|
||||||
|
@ -2221,6 +2227,7 @@ void FurnaceGUI::syncSettings() {
|
||||||
clampSetting(settings.unsignedDetune,0,1);
|
clampSetting(settings.unsignedDetune,0,1);
|
||||||
clampSetting(settings.noThreadedInput,0,1);
|
clampSetting(settings.noThreadedInput,0,1);
|
||||||
clampSetting(settings.clampSamples,0,1);
|
clampSetting(settings.clampSamples,0,1);
|
||||||
|
clampSetting(settings.saveUnusedPatterns,0,1);
|
||||||
|
|
||||||
settings.initialSys=e->decodeSysDesc(e->getConfString("initialSys",""));
|
settings.initialSys=e->decodeSysDesc(e->getConfString("initialSys",""));
|
||||||
if (settings.initialSys.size()<4) {
|
if (settings.initialSys.size()<4) {
|
||||||
|
@ -2365,6 +2372,7 @@ void FurnaceGUI::commitSettings() {
|
||||||
e->setConf("macroRelLabel",settings.macroRelLabel);
|
e->setConf("macroRelLabel",settings.macroRelLabel);
|
||||||
e->setConf("emptyLabel",settings.emptyLabel);
|
e->setConf("emptyLabel",settings.emptyLabel);
|
||||||
e->setConf("emptyLabel2",settings.emptyLabel2);
|
e->setConf("emptyLabel2",settings.emptyLabel2);
|
||||||
|
e->setConf("saveUnusedPatterns",settings.saveUnusedPatterns);
|
||||||
|
|
||||||
// colors
|
// colors
|
||||||
for (int i=0; i<GUI_COLOR_MAX; i++) {
|
for (int i=0; i<GUI_COLOR_MAX; i++) {
|
||||||
|
|
Loading…
Reference in New Issue