GUI: compact sample editor
automatic button layout depending on available width
This commit is contained in:
parent
69e3515757
commit
012d43b331
|
@ -497,6 +497,15 @@ bool FurnaceGUI::InvCheckbox(const char* label, bool* value) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FurnaceGUI::sameLineMaybe(float width) {
|
||||||
|
if (width<0.0f) width=ImGui::GetFrameHeight();
|
||||||
|
|
||||||
|
logV("sameLineMaybe: %f %f",ImGui::GetContentRegionAvail().x,width);
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::GetContentRegionAvail().x<width) ImGui::NewLine();
|
||||||
|
}
|
||||||
|
|
||||||
const char* FurnaceGUI::getSystemName(DivSystem which) {
|
const char* FurnaceGUI::getSystemName(DivSystem which) {
|
||||||
/*
|
/*
|
||||||
if (settings.chipNames) {
|
if (settings.chipNames) {
|
||||||
|
|
|
@ -2091,6 +2091,8 @@ class FurnaceGUI {
|
||||||
void pushWarningColor(bool warnCond, bool errorCond=false);
|
void pushWarningColor(bool warnCond, bool errorCond=false);
|
||||||
void popWarningColor();
|
void popWarningColor();
|
||||||
|
|
||||||
|
void sameLineMaybe(float width=-1.0f);
|
||||||
|
|
||||||
float calcBPM(const DivGroovePattern& speeds, float hz, int vN, int vD);
|
float calcBPM(const DivGroovePattern& speeds, float hz, int vN, int vD);
|
||||||
|
|
||||||
void patternRow(int i, bool isPlaying, float lineHeight, int chans, int ord, const DivPattern** patCache, bool inhibitSel);
|
void patternRow(int i, bool isPlaying, float lineHeight, int chans, int ord, const DivPattern** patCache, bool inhibitSel);
|
||||||
|
|
|
@ -715,7 +715,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Edit mode: Select");
|
ImGui::SetTooltip("Edit mode: Select");
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
pushToggleColors(sampleDragMode);
|
pushToggleColors(sampleDragMode);
|
||||||
if (ImGui::Button(ICON_FA_PENCIL "##SDraw")) {
|
if (ImGui::Button(ICON_FA_PENCIL "##SDraw")) {
|
||||||
sampleDragMode=true;
|
sampleDragMode=true;
|
||||||
|
@ -725,9 +725,9 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
ImGui::SetTooltip("Edit mode: Draw");
|
ImGui::SetTooltip("Edit mode: Draw");
|
||||||
}
|
}
|
||||||
ImGui::BeginDisabled(sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT);
|
ImGui::BeginDisabled(sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT);
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
ImGui::Button(ICON_FA_ARROWS_H "##SResize");
|
ImGui::Button(ICON_FA_ARROWS_H "##SResize");
|
||||||
if (ImGui::IsItemClicked()) {
|
if (ImGui::IsItemClicked()) {
|
||||||
resizeSize=sample->samples;
|
resizeSize=sample->samples;
|
||||||
|
@ -762,7 +762,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
} else {
|
} else {
|
||||||
resizeSize=sample->samples;
|
resizeSize=sample->samples;
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
ImGui::Button(ICON_FA_EXPAND "##SResample");
|
ImGui::Button(ICON_FA_EXPAND "##SResample");
|
||||||
if (ImGui::IsItemClicked()) {
|
if (ImGui::IsItemClicked()) {
|
||||||
resampleTarget=targetRate;
|
resampleTarget=targetRate;
|
||||||
|
@ -819,14 +819,14 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
if (ImGui::Button(ICON_FA_UNDO "##SUndo")) {
|
if (ImGui::Button(ICON_FA_UNDO "##SUndo")) {
|
||||||
doUndoSample();
|
doUndoSample();
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Undo");
|
ImGui::SetTooltip("Undo");
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
if (ImGui::Button(ICON_FA_REPEAT "##SRedo")) {
|
if (ImGui::Button(ICON_FA_REPEAT "##SRedo")) {
|
||||||
doRedoSample();
|
doRedoSample();
|
||||||
}
|
}
|
||||||
|
@ -835,7 +835,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
ImGui::Button(ICON_FA_VOLUME_UP "##SAmplify");
|
ImGui::Button(ICON_FA_VOLUME_UP "##SAmplify");
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Amplify");
|
ImGui::SetTooltip("Amplify");
|
||||||
|
@ -883,28 +883,28 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
if (ImGui::Button(ICON_FA_ARROWS_V "##SNormalize")) {
|
if (ImGui::Button(ICON_FA_ARROWS_V "##SNormalize")) {
|
||||||
doAction(GUI_ACTION_SAMPLE_NORMALIZE);
|
doAction(GUI_ACTION_SAMPLE_NORMALIZE);
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Normalize");
|
ImGui::SetTooltip("Normalize");
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
if (ImGui::Button(ICON_FA_ARROW_UP "##SFadeIn")) {
|
if (ImGui::Button(ICON_FA_ARROW_UP "##SFadeIn")) {
|
||||||
doAction(GUI_ACTION_SAMPLE_FADE_IN);
|
doAction(GUI_ACTION_SAMPLE_FADE_IN);
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Fade in");
|
ImGui::SetTooltip("Fade in");
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
if (ImGui::Button(ICON_FA_ARROW_DOWN "##SFadeOut")) {
|
if (ImGui::Button(ICON_FA_ARROW_DOWN "##SFadeOut")) {
|
||||||
doAction(GUI_ACTION_SAMPLE_FADE_OUT);
|
doAction(GUI_ACTION_SAMPLE_FADE_OUT);
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Fade out");
|
ImGui::SetTooltip("Fade out");
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
ImGui::Button(ICON_FA_ADJUST "##SInsertSilence");
|
ImGui::Button(ICON_FA_ADJUST "##SInsertSilence");
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Insert silence");
|
ImGui::SetTooltip("Insert silence");
|
||||||
|
@ -935,21 +935,21 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
if (ImGui::Button(ICON_FA_ERASER "##SSilence")) {
|
if (ImGui::Button(ICON_FA_ERASER "##SSilence")) {
|
||||||
doAction(GUI_ACTION_SAMPLE_SILENCE);
|
doAction(GUI_ACTION_SAMPLE_SILENCE);
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Apply silence");
|
ImGui::SetTooltip("Apply silence");
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
if (ImGui::Button(ICON_FA_TIMES "##SDelete")) {
|
if (ImGui::Button(ICON_FA_TIMES "##SDelete")) {
|
||||||
doAction(GUI_ACTION_SAMPLE_DELETE);
|
doAction(GUI_ACTION_SAMPLE_DELETE);
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Delete");
|
ImGui::SetTooltip("Delete");
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
if (ImGui::Button(ICON_FA_CROP "##STrim")) {
|
if (ImGui::Button(ICON_FA_CROP "##STrim")) {
|
||||||
doAction(GUI_ACTION_SAMPLE_TRIM);
|
doAction(GUI_ACTION_SAMPLE_TRIM);
|
||||||
}
|
}
|
||||||
|
@ -958,28 +958,28 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
if (ImGui::Button(ICON_FA_BACKWARD "##SReverse")) {
|
if (ImGui::Button(ICON_FA_BACKWARD "##SReverse")) {
|
||||||
doAction(GUI_ACTION_SAMPLE_REVERSE);
|
doAction(GUI_ACTION_SAMPLE_REVERSE);
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Reverse");
|
ImGui::SetTooltip("Reverse");
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
if (ImGui::Button(ICON_FA_SORT_AMOUNT_ASC "##SInvert")) {
|
if (ImGui::Button(ICON_FA_SORT_AMOUNT_ASC "##SInvert")) {
|
||||||
doAction(GUI_ACTION_SAMPLE_INVERT);
|
doAction(GUI_ACTION_SAMPLE_INVERT);
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Invert");
|
ImGui::SetTooltip("Invert");
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
if (ImGui::Button(ICON_FA_LEVEL_DOWN "##SSign")) {
|
if (ImGui::Button(ICON_FA_LEVEL_DOWN "##SSign")) {
|
||||||
doAction(GUI_ACTION_SAMPLE_SIGN);
|
doAction(GUI_ACTION_SAMPLE_SIGN);
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Signed/unsigned exchange");
|
ImGui::SetTooltip("Signed/unsigned exchange");
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
ImGui::Button(ICON_FA_INDUSTRY "##SFilter");
|
ImGui::Button(ICON_FA_INDUSTRY "##SFilter");
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Apply filter");
|
ImGui::SetTooltip("Apply filter");
|
||||||
|
@ -1095,21 +1095,21 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
ImGui::EndDisabled();
|
ImGui::EndDisabled();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
if (ImGui::Button(ICON_FA_PLAY "##PreviewSample")) {
|
if (ImGui::Button(ICON_FA_PLAY "##PreviewSample")) {
|
||||||
e->previewSample(curSample);
|
e->previewSample(curSample);
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Preview sample");
|
ImGui::SetTooltip("Preview sample");
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
if (ImGui::Button(ICON_FA_STOP "##StopSample")) {
|
if (ImGui::Button(ICON_FA_STOP "##StopSample")) {
|
||||||
e->stopSamplePreview();
|
e->stopSamplePreview();
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Stop sample preview");
|
ImGui::SetTooltip("Stop sample preview");
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
sameLineMaybe();
|
||||||
if (ImGui::Button(ICON_FA_UPLOAD "##MakeIns")) {
|
if (ImGui::Button(ICON_FA_UPLOAD "##MakeIns")) {
|
||||||
doAction(GUI_ACTION_SAMPLE_MAKE_INS);
|
doAction(GUI_ACTION_SAMPLE_MAKE_INS);
|
||||||
}
|
}
|
||||||
|
@ -1117,7 +1117,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
ImGui::SetTooltip("Create instrument from sample");
|
ImGui::SetTooltip("Create instrument from sample");
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
sameLineMaybe(ImGui::CalcTextSize("Zoom").x+150.0f*dpiScale+ImGui::CalcTextSize("100%").x);
|
||||||
double zoomPercent=100.0/sampleZoom;
|
double zoomPercent=100.0/sampleZoom;
|
||||||
bool checkZoomLimit=false;
|
bool checkZoomLimit=false;
|
||||||
ImGui::Text("Zoom");
|
ImGui::Text("Zoom");
|
||||||
|
|
Loading…
Reference in New Issue