GUI: add option to center pattern - INCOMPLETE

if you right click on the left area it doesn't work
This commit is contained in:
tildearrow 2022-10-03 19:22:24 -05:00
parent c63ff7320e
commit 70e0b4ab52
4 changed files with 20 additions and 0 deletions

View file

@ -5420,6 +5420,7 @@ FurnaceGUI::FurnaceGUI():
curWindow(GUI_WINDOW_NOTHING), curWindow(GUI_WINDOW_NOTHING),
nextWindow(GUI_WINDOW_NOTHING), nextWindow(GUI_WINDOW_NOTHING),
curWindowLast(GUI_WINDOW_NOTHING), curWindowLast(GUI_WINDOW_NOTHING),
lastPatternWidth(0.0f),
nextDesc(NULL), nextDesc(NULL),
latchNote(-1), latchNote(-1),
latchIns(-2), latchIns(-2),

View file

@ -1209,6 +1209,7 @@ class FurnaceGUI {
int midiOutClock; int midiOutClock;
int midiOutMode; int midiOutMode;
int maxRecentFile; int maxRecentFile;
int centerPattern;
unsigned int maxUndoSteps; unsigned int maxUndoSteps;
String mainFontPath; String mainFontPath;
String patFontPath; String patFontPath;
@ -1334,6 +1335,7 @@ class FurnaceGUI {
midiOutClock(0), midiOutClock(0),
midiOutMode(1), midiOutMode(1),
maxRecentFile(10), maxRecentFile(10),
centerPattern(0),
maxUndoSteps(100), maxUndoSteps(100),
mainFontPath(""), mainFontPath(""),
patFontPath(""), patFontPath(""),
@ -1373,6 +1375,7 @@ class FurnaceGUI {
float peak[2]; float peak[2];
float patChanX[DIV_MAX_CHANS+1]; float patChanX[DIV_MAX_CHANS+1];
float patChanSlideY[DIV_MAX_CHANS+1]; float patChanSlideY[DIV_MAX_CHANS+1];
float lastPatternWidth;
const int* nextDesc; const int* nextDesc;
String nextDescName; String nextDescName;

View file

@ -403,6 +403,12 @@ void FurnaceGUI::drawPattern() {
ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_SELECTION]); ImGui::PushStyleColor(ImGuiCol_Header,uiColors[GUI_COLOR_PATTERN_SELECTION]);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,uiColors[GUI_COLOR_PATTERN_SELECTION_HOVER]); ImGui::PushStyleColor(ImGuiCol_HeaderHovered,uiColors[GUI_COLOR_PATTERN_SELECTION_HOVER]);
ImGui::PushStyleColor(ImGuiCol_HeaderActive,uiColors[GUI_COLOR_PATTERN_SELECTION_ACTIVE]); ImGui::PushStyleColor(ImGuiCol_HeaderActive,uiColors[GUI_COLOR_PATTERN_SELECTION_ACTIVE]);
if (settings.centerPattern) {
float centerOff=(ImGui::GetContentRegionAvail().x-lastPatternWidth)*0.5;
if (centerOff>0.0f) {
ImGui::SetCursorPosX(ImGui::GetCursorPosX()+centerOff);
}
}
if (ImGui::BeginTable("PatternView",displayChans+2,ImGuiTableFlags_BordersInnerV|ImGuiTableFlags_ScrollX|ImGuiTableFlags_ScrollY|ImGuiTableFlags_NoPadInnerX|ImGuiTableFlags_NoBordersInFrozenArea)) { if (ImGui::BeginTable("PatternView",displayChans+2,ImGuiTableFlags_BordersInnerV|ImGuiTableFlags_ScrollX|ImGuiTableFlags_ScrollY|ImGuiTableFlags_NoPadInnerX|ImGuiTableFlags_NoBordersInFrozenArea)) {
ImGui::TableSetupColumn("pos",ImGuiTableColumnFlags_WidthFixed); ImGui::TableSetupColumn("pos",ImGuiTableColumnFlags_WidthFixed);
char chanID[2048]; char chanID[2048];
@ -427,6 +433,7 @@ void FurnaceGUI::drawPattern() {
} }
ImGui::TableNextRow(); ImGui::TableNextRow();
ImGui::TableNextColumn(); ImGui::TableNextColumn();
float lpwStart=ImGui::GetCursorPosX();
if (ImGui::Selectable((extraChannelButtons==2)?" --##ExtraChannelButtons":" ++##ExtraChannelButtons",false,ImGuiSelectableFlags_NoPadWithHalfSpacing,ImVec2(0.0f,lineHeight+1.0f*dpiScale))) { if (ImGui::Selectable((extraChannelButtons==2)?" --##ExtraChannelButtons":" ++##ExtraChannelButtons",false,ImGuiSelectableFlags_NoPadWithHalfSpacing,ImVec2(0.0f,lineHeight+1.0f*dpiScale))) {
if (++extraChannelButtons>2) extraChannelButtons=0; if (++extraChannelButtons>2) extraChannelButtons=0;
} }
@ -839,6 +846,7 @@ void FurnaceGUI::drawPattern() {
} }
} }
ImGui::TableNextColumn(); ImGui::TableNextColumn();
lastPatternWidth=ImGui::GetCursorPosX()-lpwStart+ImGui::GetStyle().ScrollbarSize;
if (e->hasExtValue()) { if (e->hasExtValue()) {
ImGui::TextColored(uiColors[GUI_COLOR_EE_VALUE]," %.2X",e->getExtValue()); ImGui::TextColored(uiColors[GUI_COLOR_EE_VALUE]," %.2X",e->getExtValue());
} }

View file

@ -1443,6 +1443,11 @@ void FurnaceGUI::drawSettings() {
settings.germanNotation=germanNotationB; settings.germanNotation=germanNotationB;
} }
bool centerPatternB=settings.centerPattern;
if (ImGui::Checkbox("Center pattern view",&centerPatternB)) {
settings.centerPattern=centerPatternB;
}
bool unsignedDetuneB=settings.unsignedDetune; bool unsignedDetuneB=settings.unsignedDetune;
if (ImGui::Checkbox("Unsigned FM detune values",&unsignedDetuneB)) { if (ImGui::Checkbox("Unsigned FM detune values",&unsignedDetuneB)) {
settings.unsignedDetune=unsignedDetuneB; settings.unsignedDetune=unsignedDetuneB;
@ -2363,6 +2368,7 @@ void FurnaceGUI::syncSettings() {
settings.maxRecentFile=e->getConfInt("maxRecentFile",10); settings.maxRecentFile=e->getConfInt("maxRecentFile",10);
settings.midiOutClock=e->getConfInt("midiOutClock",0); settings.midiOutClock=e->getConfInt("midiOutClock",0);
settings.midiOutMode=e->getConfInt("midiOutMode",1); settings.midiOutMode=e->getConfInt("midiOutMode",1);
settings.centerPattern=e->getConfInt("centerPattern",0);
clampSetting(settings.mainFontSize,2,96); clampSetting(settings.mainFontSize,2,96);
clampSetting(settings.patFontSize,2,96); clampSetting(settings.patFontSize,2,96);
@ -2466,6 +2472,7 @@ void FurnaceGUI::syncSettings() {
clampSetting(settings.maxRecentFile,0,30); clampSetting(settings.maxRecentFile,0,30);
clampSetting(settings.midiOutClock,0,1); clampSetting(settings.midiOutClock,0,1);
clampSetting(settings.midiOutMode,0,2); clampSetting(settings.midiOutMode,0,2);
clampSetting(settings.centerPattern,0,1);
String initialSys2=e->getConfString("initialSys2",""); String initialSys2=e->getConfString("initialSys2","");
if (initialSys2.empty()) { if (initialSys2.empty()) {
@ -2630,6 +2637,7 @@ void FurnaceGUI::commitSettings() {
e->setConf("maxRecentFile",settings.maxRecentFile); e->setConf("maxRecentFile",settings.maxRecentFile);
e->setConf("midiOutClock",settings.midiOutClock); e->setConf("midiOutClock",settings.midiOutClock);
e->setConf("midiOutMode",settings.midiOutMode); e->setConf("midiOutMode",settings.midiOutMode);
e->setConf("centerPattern",settings.centerPattern);
// colors // colors
for (int i=0; i<GUI_COLOR_MAX; i++) { for (int i=0; i<GUI_COLOR_MAX; i++) {