mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-02 09:17:26 +00:00
parent
76554cb8a2
commit
e7375fd733
7 changed files with 78 additions and 23 deletions
4
extern/imgui_patched/imgui.cpp
vendored
4
extern/imgui_patched/imgui.cpp
vendored
|
@ -1305,6 +1305,10 @@ ImGuiIO::ImGuiIO()
|
||||||
// Inertial scrolling options (when ImGuiConfigFlags_InertialScrollEnable is set)
|
// Inertial scrolling options (when ImGuiConfigFlags_InertialScrollEnable is set)
|
||||||
ConfigInertialScrollToleranceSqr = 36.0f;
|
ConfigInertialScrollToleranceSqr = 36.0f;
|
||||||
|
|
||||||
|
// ScrollText options
|
||||||
|
ScrollTextSpeed = 100.0f;
|
||||||
|
ScrollTextSpacing = 8.0f;
|
||||||
|
|
||||||
// Miscellaneous options
|
// Miscellaneous options
|
||||||
MouseDrawCursor = false;
|
MouseDrawCursor = false;
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
7
extern/imgui_patched/imgui.h
vendored
7
extern/imgui_patched/imgui.h
vendored
|
@ -510,6 +510,9 @@ namespace ImGui
|
||||||
IMGUI_API void BulletTextV(const char* fmt, va_list args) IM_FMTLIST(1);
|
IMGUI_API void BulletTextV(const char* fmt, va_list args) IM_FMTLIST(1);
|
||||||
IMGUI_API void SeparatorText(const char* label); // currently: formatted text with an horizontal line
|
IMGUI_API void SeparatorText(const char* label); // currently: formatted text with an horizontal line
|
||||||
|
|
||||||
|
// Widgets: ScrollText (tildearrow)
|
||||||
|
IMGUI_API void ScrollText(ImGuiID id, const char* text, const ImVec2& pos, ImVec2 size=ImVec2(0,0), bool alwaysScroll=false);
|
||||||
|
|
||||||
// Widgets: Main
|
// Widgets: Main
|
||||||
// - Most widgets return true when the value has been changed or when pressed/selected
|
// - Most widgets return true when the value has been changed or when pressed/selected
|
||||||
// - You may also use one of the many IsItemXXX functions (e.g. IsItemActive, IsItemHovered, etc.) to query widget state.
|
// - You may also use one of the many IsItemXXX functions (e.g. IsItemActive, IsItemHovered, etc.) to query widget state.
|
||||||
|
@ -2093,6 +2096,10 @@ struct ImGuiIO
|
||||||
// Inertial scrolling options (when ImGuiConfigFlags_InertialScrollEnable is set)
|
// Inertial scrolling options (when ImGuiConfigFlags_InertialScrollEnable is set)
|
||||||
float ConfigInertialScrollToleranceSqr;// = 36.0f // After a point moves past this distance, inertial scroll begins
|
float ConfigInertialScrollToleranceSqr;// = 36.0f // After a point moves past this distance, inertial scroll begins
|
||||||
|
|
||||||
|
// ScrollText options
|
||||||
|
float ScrollTextSpeed; // = 100.0f;
|
||||||
|
float ScrollTextSpacing; // = 8.0f;
|
||||||
|
|
||||||
// Miscellaneous options
|
// Miscellaneous options
|
||||||
bool MouseDrawCursor; // = false // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by backend implementations.
|
bool MouseDrawCursor; // = false // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). Cannot be easily renamed to 'io.ConfigXXX' because this is frequently used by backend implementations.
|
||||||
bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl.
|
bool ConfigMacOSXBehaviors; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl.
|
||||||
|
|
58
extern/imgui_patched/imgui_widgets.cpp
vendored
58
extern/imgui_patched/imgui_widgets.cpp
vendored
|
@ -527,6 +527,59 @@ void ImGui::BulletTextV(const char* fmt, va_list args)
|
||||||
RenderText(bb.Min + ImVec2(g.FontSize + style.FramePadding.x * 2, 0.0f), text_begin, text_end, false);
|
RenderText(bb.Min + ImVec2(g.FontSize + style.FramePadding.x * 2, 0.0f), text_begin, text_end, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// [SECTION] Widgets: ScrollText (tildearrow)
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
// - ScrollText()
|
||||||
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void ImGui::ScrollText(ImGuiID id, const char* text, const ImVec2& pos, ImVec2 size, bool alwaysScroll) {
|
||||||
|
ImGuiContext& g = *GImGui;
|
||||||
|
ImGuiWindow* window=g.CurrentWindow;
|
||||||
|
ImDrawList* dl=window->DrawList;
|
||||||
|
ImGuiStorage* storage=GetStateStorage();
|
||||||
|
|
||||||
|
ImVec2 textSize=ImGui::CalcTextSize(text);
|
||||||
|
bool mustNotScroll=false;
|
||||||
|
|
||||||
|
if (size.x==0) {
|
||||||
|
size.x=((window->DC.CurrentColumns || g.CurrentTable) ? window->WorkRect.Max : window->ContentRegionRect.Max).x-pos.x;
|
||||||
|
if (textSize.x<size.x) {
|
||||||
|
size.x=textSize.x;
|
||||||
|
mustNotScroll=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (size.y==0) {
|
||||||
|
size.y=ImGui::GetFontSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
ImVec2 minArea=pos;
|
||||||
|
ImVec2 maxArea=ImVec2(
|
||||||
|
minArea.x+size.x,
|
||||||
|
minArea.y+size.y
|
||||||
|
);
|
||||||
|
ImRect rect=ImRect(minArea,maxArea);
|
||||||
|
bool hovered=ImGui::IsMouseHoveringRect(rect.Min,rect.Max);
|
||||||
|
float textPos=storage->GetFloat(id,0.0f);
|
||||||
|
|
||||||
|
dl->PushClipRect(minArea,maxArea,true);
|
||||||
|
if (hovered || alwaysScroll) {
|
||||||
|
minArea.x-=textPos;
|
||||||
|
}
|
||||||
|
dl->AddText(minArea,ImGui::GetColorU32(ImGuiCol_Text),text);
|
||||||
|
if ((hovered || alwaysScroll) && !mustNotScroll) {
|
||||||
|
textPos+=ImGui::GetIO().DeltaTime*g.IO.ScrollTextSpeed;
|
||||||
|
if (textPos>textSize.x) {
|
||||||
|
textPos-=textSize.x+size.x+g.IO.ScrollTextSpacing;
|
||||||
|
}
|
||||||
|
g.IO.IsSomethingHappening=true;
|
||||||
|
} else {
|
||||||
|
textPos=0.0;
|
||||||
|
}
|
||||||
|
storage->SetFloat(id,textPos);
|
||||||
|
dl->PopClipRect();
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// [SECTION] Widgets: Main
|
// [SECTION] Widgets: Main
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
@ -1283,8 +1336,9 @@ bool ImGui::Checkbox(const char* label, bool* v)
|
||||||
ImVec2 label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y);
|
ImVec2 label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y);
|
||||||
if (g.LogEnabled)
|
if (g.LogEnabled)
|
||||||
LogRenderedText(&label_pos, mixed_value ? "[~]" : *v ? "[x]" : "[ ]");
|
LogRenderedText(&label_pos, mixed_value ? "[~]" : *v ? "[x]" : "[ ]");
|
||||||
if (label_size.x > 0.0f)
|
if (label_size.x > 0.0f) {
|
||||||
RenderText(label_pos, label);
|
ScrollText(id, label, label_pos, ImVec2(0,0), hovered);
|
||||||
|
}
|
||||||
|
|
||||||
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
|
IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0));
|
||||||
return pressed;
|
return pressed;
|
||||||
|
|
|
@ -347,6 +347,15 @@ void FurnaceGUI::drawDebug() {
|
||||||
}
|
}
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
|
if (ImGui::TreeNode("Scroll Text Test")) {
|
||||||
|
/*
|
||||||
|
ImGui::ScrollText(ImGui::GetID("scrolltest1"),"Lorem ipsum, quia dolor sit, amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt, ut labore et dolore magnam aliquam quaerat voluptatem. ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur?");
|
||||||
|
ImGui::ScrollText(ImGui::GetID("scrolltest2"),"quis autem vel eum iure reprehenderit");
|
||||||
|
ImGui::ScrollText(ImGui::GetID("scrolltest3"),"qui in ea voluptate velit esse",ImVec2(100.0f*dpiScale,0),true);
|
||||||
|
ImGui::ScrollText(ImGui::GetID("scrolltest4"),"quam nihil molestiae consequatur, vel illum, qui dolorem eum fugiat, quo voluptas nulla pariatur?",ImVec2(0,0),true);
|
||||||
|
*/
|
||||||
|
ImGui::TreePop();
|
||||||
|
}
|
||||||
if (ImGui::TreeNode("Pitch Table Calculator")) {
|
if (ImGui::TreeNode("Pitch Table Calculator")) {
|
||||||
ImGui::InputDouble("Clock",&ptcClock);
|
ImGui::InputDouble("Clock",&ptcClock);
|
||||||
ImGui::InputDouble("Divider/FreqBase",&ptcDivider);
|
ImGui::InputDouble("Divider/FreqBase",&ptcDivider);
|
||||||
|
|
|
@ -548,24 +548,6 @@ void FurnaceGUI::sameLineMaybe(float width) {
|
||||||
if (ImGui::GetContentRegionAvail().x<width) ImGui::NewLine();
|
if (ImGui::GetContentRegionAvail().x<width) ImGui::NewLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::ScrollText(ImGuiID id, const char* text, const ImVec2& size, bool alwaysScroll) {
|
|
||||||
ImDrawList* dl=ImGui::GetWindowDrawList();
|
|
||||||
ImGuiWindow* window=ImGui::GetCurrentWindow();
|
|
||||||
|
|
||||||
ImVec2 minArea=window->DC.CursorPos;
|
|
||||||
ImVec2 maxArea=ImVec2(
|
|
||||||
minArea.x+size.x,
|
|
||||||
minArea.y+size.y
|
|
||||||
);
|
|
||||||
ImRect rect=ImRect(minArea,maxArea);
|
|
||||||
ImGuiStyle& style=ImGui::GetStyle();
|
|
||||||
ImGui::ItemSize(size,style.FramePadding.y);
|
|
||||||
if (ImGui::ItemAdd(rect,id)) {
|
|
||||||
// TODO
|
|
||||||
dl->AddText(minArea,ImGui::GetColorU32(ImGuiCol_Text),text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* FurnaceGUI::getSystemName(DivSystem which) {
|
const char* FurnaceGUI::getSystemName(DivSystem which) {
|
||||||
/*
|
/*
|
||||||
if (settings.chipNames) {
|
if (settings.chipNames) {
|
||||||
|
|
|
@ -2792,9 +2792,6 @@ class FurnaceGUI {
|
||||||
// inverted checkbox
|
// inverted checkbox
|
||||||
bool InvCheckbox(const char* label, bool* value);
|
bool InvCheckbox(const char* label, bool* value);
|
||||||
|
|
||||||
// scrolling text
|
|
||||||
void ScrollText(ImGuiID id, const char* text, const ImVec2& size=ImVec2(0,0), bool alwaysScroll=false);
|
|
||||||
|
|
||||||
// mixer stuff
|
// mixer stuff
|
||||||
ImVec2 calcPortSetSize(String label, int ins, int outs);
|
ImVec2 calcPortSetSize(String label, int ins, int outs);
|
||||||
bool portSet(String label, unsigned int portSetID, int ins, int outs, int activeIns, int activeOuts, int& clickedPort, std::map<unsigned int,ImVec2>& portPos);
|
bool portSet(String label, unsigned int portSetID, int ins, int outs, int activeIns, int activeOuts, int& clickedPort, std::map<unsigned int,ImVec2>& portPos);
|
||||||
|
|
|
@ -6497,6 +6497,8 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
|
||||||
ImGui::GetIO().ConfigWindowsMoveFromTitleBarOnly=settings.moveWindowTitle;
|
ImGui::GetIO().ConfigWindowsMoveFromTitleBarOnly=settings.moveWindowTitle;
|
||||||
ImGui::GetIO().ConfigInertialScrollToleranceSqr=pow(dpiScale*4.0f,2.0f);
|
ImGui::GetIO().ConfigInertialScrollToleranceSqr=pow(dpiScale*4.0f,2.0f);
|
||||||
ImGui::GetIO().MouseDoubleClickTime=settings.doubleClickTime;
|
ImGui::GetIO().MouseDoubleClickTime=settings.doubleClickTime;
|
||||||
|
ImGui::GetIO().ScrollTextSpacing=8.0*dpiScale;
|
||||||
|
ImGui::GetIO().ScrollTextSpeed=60.0*dpiScale;
|
||||||
|
|
||||||
for (int i=0; i<256; i++) {
|
for (int i=0; i<256; i++) {
|
||||||
ImVec4& base=uiColors[GUI_COLOR_PATTERN_EFFECT_PITCH];
|
ImVec4& base=uiColors[GUI_COLOR_PATTERN_EFFECT_PITCH];
|
||||||
|
|
Loading…
Reference in a new issue