GUI: fix arp macro hover
This commit is contained in:
parent
84b0ffbac3
commit
d021005f26
|
@ -138,6 +138,10 @@ void FurnaceGUI::drawMobileControls() {
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button("Create Ins")) {
|
||||||
|
doAction(GUI_ACTION_INS_LIST_ADD);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Text("Data list goes here...");
|
ImGui::Text("Data list goes here...");
|
||||||
|
|
||||||
if (ImGui::Button("New")) {
|
if (ImGui::Button("New")) {
|
||||||
|
|
|
@ -4669,7 +4669,6 @@ bool FurnaceGUI::init() {
|
||||||
SDL_SetWindowSize(sdlWin,scrW*dpiScale,scrH*dpiScale);
|
SDL_SetWindowSize(sdlWin,scrW*dpiScale,scrH*dpiScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(sdlWin),&displaySize)==0) {
|
if (SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(sdlWin),&displaySize)==0) {
|
||||||
if (scrW>((displaySize.w/dpiScale)-48) && scrH>((displaySize.h/dpiScale)-64)) {
|
if (scrW>((displaySize.w/dpiScale)-48) && scrH>((displaySize.h/dpiScale)-64)) {
|
||||||
|
@ -4684,6 +4683,7 @@ bool FurnaceGUI::init() {
|
||||||
SDL_SetWindowSize(sdlWin,scrW*dpiScale,scrH*dpiScale);
|
SDL_SetWindowSize(sdlWin,scrW*dpiScale,scrH*dpiScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -887,9 +887,10 @@ struct FurnaceGUIMacroDesc {
|
||||||
ImVec4 color;
|
ImVec4 color;
|
||||||
unsigned int bitOffset;
|
unsigned int bitOffset;
|
||||||
bool isBitfield, blockMode, bit30;
|
bool isBitfield, blockMode, bit30;
|
||||||
String (*hoverFunc)(int,float);
|
String (*hoverFunc)(int,float,void*);
|
||||||
|
void* hoverFuncUser;
|
||||||
|
|
||||||
FurnaceGUIMacroDesc(const char* name, DivInstrumentMacro* m, int macroMin, int macroMax, float macroHeight, ImVec4 col=ImVec4(1.0f,1.0f,1.0f,1.0f), bool block=false, const char* mName=NULL, String (*hf)(int,float)=NULL, bool bitfield=false, const char** bfVal=NULL, unsigned int bitOff=0, bool bit30Special=false):
|
FurnaceGUIMacroDesc(const char* name, DivInstrumentMacro* m, int macroMin, int macroMax, float macroHeight, ImVec4 col=ImVec4(1.0f,1.0f,1.0f,1.0f), bool block=false, const char* mName=NULL, String (*hf)(int,float,void*)=NULL, bool bitfield=false, const char** bfVal=NULL, unsigned int bitOff=0, bool bit30Special=false, void* hfu=NULL):
|
||||||
macro(m),
|
macro(m),
|
||||||
height(macroHeight),
|
height(macroHeight),
|
||||||
displayName(name),
|
displayName(name),
|
||||||
|
@ -900,7 +901,8 @@ struct FurnaceGUIMacroDesc {
|
||||||
isBitfield(bitfield),
|
isBitfield(bitfield),
|
||||||
blockMode(block),
|
blockMode(block),
|
||||||
bit30(bit30Special),
|
bit30(bit30Special),
|
||||||
hoverFunc(hf) {
|
hoverFunc(hf),
|
||||||
|
hoverFuncUser(hfu) {
|
||||||
// MSVC -> hell
|
// MSVC -> hell
|
||||||
this->min=macroMin;
|
this->min=macroMin;
|
||||||
this->max=macroMax;
|
this->max=macroMax;
|
||||||
|
|
|
@ -316,27 +316,31 @@ const char* macroRelativeMode="Relative";
|
||||||
const char* macroQSoundMode="QSound";
|
const char* macroQSoundMode="QSound";
|
||||||
const char* macroDummyMode="Bug";
|
const char* macroDummyMode="Bug";
|
||||||
|
|
||||||
String macroHoverNote(int id, float val) {
|
String macroHoverNote(int id, float val, void* u) {
|
||||||
if (val<-60 || val>=120) return "???";
|
int* macroVal=(int*)u;
|
||||||
return fmt::sprintf("%d: %s",id,noteNames[(int)val+60]);
|
if ((macroVal[id]&0xc0000000)==0x40000000 || (macroVal[id]&0xc0000000)==0x80000000) {
|
||||||
|
if (val<-60 || val>=120) return "???";
|
||||||
|
return fmt::sprintf("%d: %s",id,noteNames[(int)val+60]);
|
||||||
|
}
|
||||||
|
return fmt::sprintf("%d: %d",id,(int)val);
|
||||||
}
|
}
|
||||||
|
|
||||||
String macroHover(int id, float val) {
|
String macroHover(int id, float val, void* u) {
|
||||||
return fmt::sprintf("%d: %d",id,val);
|
return fmt::sprintf("%d: %d",id,val);
|
||||||
}
|
}
|
||||||
|
|
||||||
String macroHoverLoop(int id, float val) {
|
String macroHoverLoop(int id, float val, void* u) {
|
||||||
if (val>1) return "Release";
|
if (val>1) return "Release";
|
||||||
if (val>0) return "Loop";
|
if (val>0) return "Loop";
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
String macroHoverBit30(int id, float val) {
|
String macroHoverBit30(int id, float val, void* u) {
|
||||||
if (val>0) return "Fixed";
|
if (val>0) return "Fixed";
|
||||||
return "Relative";
|
return "Relative";
|
||||||
}
|
}
|
||||||
|
|
||||||
String macroHoverES5506FilterMode(int id, float val) {
|
String macroHoverES5506FilterMode(int id, float val, void* u) {
|
||||||
String mode="???";
|
String mode="???";
|
||||||
switch (((int)val)&3) {
|
switch (((int)val)&3) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -357,7 +361,7 @@ String macroHoverES5506FilterMode(int id, float val) {
|
||||||
return fmt::sprintf("%d: %s",id,mode);
|
return fmt::sprintf("%d: %s",id,mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
String macroLFOWaves(int id, float val) {
|
String macroLFOWaves(int id, float val, void* u) {
|
||||||
switch (((int)val)&3) {
|
switch (((int)val)&3) {
|
||||||
case 0:
|
case 0:
|
||||||
return "Saw";
|
return "Saw";
|
||||||
|
@ -1355,7 +1359,7 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
|
||||||
if (i.isBitfield) {
|
if (i.isBitfield) {
|
||||||
PlotBitfield("##IMacro",asInt,totalFit,0,i.bitfieldBits,i.max,ImVec2(availableWidth,(i.macro->open)?(i.height*dpiScale):(32.0f*dpiScale)),sizeof(float),doHighlight);
|
PlotBitfield("##IMacro",asInt,totalFit,0,i.bitfieldBits,i.max,ImVec2(availableWidth,(i.macro->open)?(i.height*dpiScale):(32.0f*dpiScale)),sizeof(float),doHighlight);
|
||||||
} else {
|
} else {
|
||||||
PlotCustom("##IMacro",asFloat,totalFit,macroDragScroll,NULL,i.min+i.macro->vScroll,i.min+i.macro->vScroll+i.macro->vZoom,ImVec2(availableWidth,(i.macro->open)?(i.height*dpiScale):(32.0f*dpiScale)),sizeof(float),i.color,i.macro->len-macroDragScroll,i.hoverFunc,i.blockMode,i.macro->open?genericGuide:NULL,doHighlight);
|
PlotCustom("##IMacro",asFloat,totalFit,macroDragScroll,NULL,i.min+i.macro->vScroll,i.min+i.macro->vScroll+i.macro->vZoom,ImVec2(availableWidth,(i.macro->open)?(i.height*dpiScale):(32.0f*dpiScale)),sizeof(float),i.color,i.macro->len-macroDragScroll,i.hoverFunc,i.hoverFuncUser,i.blockMode,i.macro->open?genericGuide:NULL,doHighlight);
|
||||||
}
|
}
|
||||||
if (i.macro->open && (ImGui::IsItemClicked(ImGuiMouseButton_Left) || ImGui::IsItemClicked(ImGuiMouseButton_Right))) {
|
if (i.macro->open && (ImGui::IsItemClicked(ImGuiMouseButton_Left) || ImGui::IsItemClicked(ImGuiMouseButton_Right))) {
|
||||||
macroDragStart=ImGui::GetItemRectMin();
|
macroDragStart=ImGui::GetItemRectMin();
|
||||||
|
@ -3613,7 +3617,7 @@ void FurnaceGUI::drawInsEdit() {
|
||||||
modTable[i]=ins->fds.modTable[i];
|
modTable[i]=ins->fds.modTable[i];
|
||||||
}
|
}
|
||||||
ImVec2 modTableSize=ImVec2(ImGui::GetContentRegionAvail().x,96.0f*dpiScale);
|
ImVec2 modTableSize=ImVec2(ImGui::GetContentRegionAvail().x,96.0f*dpiScale);
|
||||||
PlotCustom("ModTable",modTable,32,0,NULL,-4,3,modTableSize,sizeof(float),ImVec4(1.0f,1.0f,1.0f,1.0f),0,NULL,true);
|
PlotCustom("ModTable",modTable,32,0,NULL,-4,3,modTableSize,sizeof(float),ImVec4(1.0f,1.0f,1.0f,1.0f),0,NULL,NULL,true);
|
||||||
if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) {
|
if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) {
|
||||||
macroDragStart=ImGui::GetItemRectMin();
|
macroDragStart=ImGui::GetItemRectMin();
|
||||||
macroDragAreaSize=modTableSize;
|
macroDragAreaSize=modTableSize;
|
||||||
|
@ -4232,7 +4236,7 @@ void FurnaceGUI::drawInsEdit() {
|
||||||
if (volMax>0) {
|
if (volMax>0) {
|
||||||
macroList.push_back(FurnaceGUIMacroDesc(volumeLabel,&ins->std.volMacro,volMin,volMax,160,uiColors[GUI_COLOR_MACRO_VOLUME]));
|
macroList.push_back(FurnaceGUIMacroDesc(volumeLabel,&ins->std.volMacro,volMin,volMax,160,uiColors[GUI_COLOR_MACRO_VOLUME]));
|
||||||
}
|
}
|
||||||
macroList.push_back(FurnaceGUIMacroDesc("Arpeggio",&ins->std.arpMacro,-120,120,160,uiColors[GUI_COLOR_MACRO_PITCH],true,NULL,NULL,false,NULL,0,true));
|
macroList.push_back(FurnaceGUIMacroDesc("Arpeggio",&ins->std.arpMacro,-120,120,160,uiColors[GUI_COLOR_MACRO_PITCH],true,NULL,macroHoverNote,false,NULL,0,true,ins->std.arpMacro.val));
|
||||||
if (dutyMax>0) {
|
if (dutyMax>0) {
|
||||||
if (ins->type==DIV_INS_MIKEY) {
|
if (ins->type==DIV_INS_MIKEY) {
|
||||||
macroList.push_back(FurnaceGUIMacroDesc(dutyLabel,&ins->std.dutyMacro,0,dutyMax,160,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,mikeyFeedbackBits));
|
macroList.push_back(FurnaceGUIMacroDesc(dutyLabel,&ins->std.dutyMacro,0,dutyMax,160,uiColors[GUI_COLOR_MACRO_OTHER],false,NULL,NULL,true,mikeyFeedbackBits));
|
||||||
|
|
|
@ -293,7 +293,7 @@ void PlotBitfield(const char* label, const int* values, int values_count, int va
|
||||||
PlotBitfieldEx(label, &Plot_IntArrayGetter, (void*)&data, values_count, values_offset, overlay_text, bits, graph_size, values_highlight, highlightColor);
|
PlotBitfieldEx(label, &Plot_IntArrayGetter, (void*)&data, values_count, values_offset, overlay_text, bits, graph_size, values_highlight, highlightColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
int PlotCustomEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_display_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size, ImVec4 color, int highlight, std::string (*hoverFunc)(int,float), bool blockMode, std::string (*guideFunc)(float), const bool* values_highlight, ImVec4 highlightColor)
|
int PlotCustomEx(ImGuiPlotType plot_type, const char* label, float (*values_getter)(void* data, int idx), void* data, int values_count, int values_display_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 frame_size, ImVec4 color, int highlight, std::string (*hoverFunc)(int,float,void*), void* hoverFuncUser, bool blockMode, std::string (*guideFunc)(float), const bool* values_highlight, ImVec4 highlightColor)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||||
|
@ -359,7 +359,7 @@ int PlotCustomEx(ImGuiPlotType plot_type, const char* label, float (*values_gett
|
||||||
const float v0 = values_getter(data, (v_idx) % values_count);
|
const float v0 = values_getter(data, (v_idx) % values_count);
|
||||||
const float v1 = values_getter(data, (v_idx + 1) % values_count);
|
const float v1 = values_getter(data, (v_idx + 1) % values_count);
|
||||||
if (hoverFunc) {
|
if (hoverFunc) {
|
||||||
std::string hoverText=hoverFunc(v_idx+values_display_offset,v0);
|
std::string hoverText=hoverFunc(v_idx+values_display_offset,v0,hoverFuncUser);
|
||||||
if (!hoverText.empty()) {
|
if (!hoverText.empty()) {
|
||||||
ImGui::SetTooltip("%s",hoverText.c_str());
|
ImGui::SetTooltip("%s",hoverText.c_str());
|
||||||
}
|
}
|
||||||
|
@ -459,8 +459,8 @@ int PlotCustomEx(ImGuiPlotType plot_type, const char* label, float (*values_gett
|
||||||
return idx_hovered;
|
return idx_hovered;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlotCustom(const char* label, const float* values, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size, int stride, ImVec4 color, int highlight, std::string (*hoverFunc)(int,float), bool blockMode, std::string (*guideFunc)(float), const bool* values_highlight, ImVec4 highlightColor)
|
void PlotCustom(const char* label, const float* values, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size, int stride, ImVec4 color, int highlight, std::string (*hoverFunc)(int,float,void*), void* hoverFuncUser, bool blockMode, std::string (*guideFunc)(float), const bool* values_highlight, ImVec4 highlightColor)
|
||||||
{
|
{
|
||||||
FurnacePlotArrayGetterData data(values, stride);
|
FurnacePlotArrayGetterData data(values, stride);
|
||||||
PlotCustomEx(ImGuiPlotType_Histogram, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size, color, highlight, hoverFunc, blockMode, guideFunc, values_highlight, highlightColor);
|
PlotCustomEx(ImGuiPlotType_Histogram, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size, color, highlight, hoverFunc, hoverFuncUser, blockMode, guideFunc, values_highlight, highlightColor);
|
||||||
}
|
}
|
|
@ -22,4 +22,4 @@
|
||||||
|
|
||||||
void PlotNoLerp(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float));
|
void PlotNoLerp(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float));
|
||||||
void PlotBitfield(const char* label, const int* values, int values_count, int values_offset = 0, const char** overlay_text = NULL, int bits = 8, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float), const bool* values_highlight = NULL, ImVec4 highlightColor = ImVec4(1.0f,1.0f,1.0f,1.0f));
|
void PlotBitfield(const char* label, const int* values, int values_count, int values_offset = 0, const char** overlay_text = NULL, int bits = 8, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float), const bool* values_highlight = NULL, ImVec4 highlightColor = ImVec4(1.0f,1.0f,1.0f,1.0f));
|
||||||
void PlotCustom(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float), ImVec4 fgColor = ImVec4(1.0f,1.0f,1.0f,1.0f), int highlight = 0, std::string (*hoverFunc)(int,float) = NULL, bool blockMode=false, std::string (*guideFunc)(float) = NULL, const bool* values_highlight = NULL, ImVec4 highlightColor = ImVec4(1.0f,1.0f,1.0f,1.0f));
|
void PlotCustom(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float), ImVec4 fgColor = ImVec4(1.0f,1.0f,1.0f,1.0f), int highlight = 0, std::string (*hoverFunc)(int,float,void*) = NULL, void* hoverFuncUser=NULL, bool blockMode=false, std::string (*guideFunc)(float) = NULL, const bool* values_highlight = NULL, ImVec4 highlightColor = ImVec4(1.0f,1.0f,1.0f,1.0f));
|
||||||
|
|
|
@ -271,7 +271,7 @@ void FurnaceGUI::drawWaveEdit() {
|
||||||
if (waveEditStyle) {
|
if (waveEditStyle) {
|
||||||
PlotNoLerp("##Waveform",wavePreview,wave->len+1,0,NULL,0,wave->max,contentRegion);
|
PlotNoLerp("##Waveform",wavePreview,wave->len+1,0,NULL,0,wave->max,contentRegion);
|
||||||
} else {
|
} else {
|
||||||
PlotCustom("##Waveform",wavePreview,wave->len,0,NULL,0,wave->max,contentRegion,sizeof(float),ImVec4(1.0f,1.0f,1.0f,1.0f),0,NULL,true);
|
PlotCustom("##Waveform",wavePreview,wave->len,0,NULL,0,wave->max,contentRegion,sizeof(float),ImVec4(1.0f,1.0f,1.0f,1.0f),0,NULL,NULL,true);
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) {
|
if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) {
|
||||||
waveDragStart=ImGui::GetItemRectMin();
|
waveDragStart=ImGui::GetItemRectMin();
|
||||||
|
@ -412,7 +412,7 @@ void FurnaceGUI::drawWaveEdit() {
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||||
ImGui::PushID(i);
|
ImGui::PushID(i);
|
||||||
if (CWSliderInt("##WGMULT",&waveGenMult[i],0,15)) {
|
if (CWSliderInt("##WGMULT",&waveGenMult[i],1,16)) {
|
||||||
doGenerateWave();
|
doGenerateWave();
|
||||||
}
|
}
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
|
|
Loading…
Reference in a new issue