GUI: add frame shading setting
This commit is contained in:
parent
8dde6a604e
commit
3932a82d14
|
@ -1075,6 +1075,7 @@ ImGuiStyle::ImGuiStyle()
|
|||
PopupBorderSize = 1.0f; // Thickness of border around popup or tooltip windows. Generally set to 0.0f or 1.0f. Other values not well tested.
|
||||
FramePadding = ImVec2(4,3); // Padding within a framed rectangle (used by most widgets)
|
||||
FrameRounding = 0.0f; // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).
|
||||
FrameShading = 0.0f; // Gradient intensity of frame
|
||||
FrameBorderSize = 0.0f; // Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested.
|
||||
ItemSpacing = ImVec2(8,4); // Horizontal and vertical spacing between widgets/lines
|
||||
ItemInnerSpacing = ImVec2(4,4); // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
||||
|
@ -2881,6 +2882,7 @@ static const ImGuiStyleVarInfo GStyleVarInfo[] =
|
|||
{ ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, PopupBorderSize) }, // ImGuiStyleVar_PopupBorderSize
|
||||
{ ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, FramePadding) }, // ImGuiStyleVar_FramePadding
|
||||
{ ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, FrameRounding) }, // ImGuiStyleVar_FrameRounding
|
||||
{ ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, FrameShading) }, // ImGuiStyleVar_FrameShading
|
||||
{ ImGuiDataType_Float, 1, (ImU32)IM_OFFSETOF(ImGuiStyle, FrameBorderSize) }, // ImGuiStyleVar_FrameBorderSize
|
||||
{ ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemSpacing) }, // ImGuiStyleVar_ItemSpacing
|
||||
{ ImGuiDataType_Float, 2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemInnerSpacing) }, // ImGuiStyleVar_ItemInnerSpacing
|
||||
|
@ -3205,7 +3207,14 @@ void ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border,
|
|||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
window->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding);
|
||||
if (g.Style.FrameShading>0.0f) {
|
||||
ImVec4 fill_colPre=ImGui::ColorConvertU32ToFloat4(fill_col);
|
||||
fill_colPre.w*=1.0f-g.Style.FrameShading;
|
||||
ImU32 fill_col1=ImGui::ColorConvertFloat4ToU32(fill_colPre);
|
||||
window->DrawList->AddRectFilledMultiColor(p_min, p_max, fill_col, fill_col, fill_col1, fill_col1, rounding);
|
||||
} else {
|
||||
window->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding);
|
||||
}
|
||||
const float border_size = g.Style.FrameBorderSize;
|
||||
if (border && border_size > 0.0f)
|
||||
{
|
||||
|
|
|
@ -1681,6 +1681,7 @@ enum ImGuiStyleVar_
|
|||
ImGuiStyleVar_PopupBorderSize, // float PopupBorderSize
|
||||
ImGuiStyleVar_FramePadding, // ImVec2 FramePadding
|
||||
ImGuiStyleVar_FrameRounding, // float FrameRounding
|
||||
ImGuiStyleVar_FrameShading, // float FrameShading
|
||||
ImGuiStyleVar_FrameBorderSize, // float FrameBorderSize
|
||||
ImGuiStyleVar_ItemSpacing, // ImVec2 ItemSpacing
|
||||
ImGuiStyleVar_ItemInnerSpacing, // ImVec2 ItemInnerSpacing
|
||||
|
@ -1927,6 +1928,7 @@ struct ImGuiStyle
|
|||
float PopupBorderSize; // Thickness of border around popup/tooltip windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).
|
||||
ImVec2 FramePadding; // Padding within a framed rectangle (used by most widgets).
|
||||
float FrameRounding; // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets).
|
||||
float FrameShading;
|
||||
float FrameBorderSize; // Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly).
|
||||
ImVec2 ItemSpacing; // Horizontal and vertical spacing between widgets/lines.
|
||||
ImVec2 ItemInnerSpacing; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label).
|
||||
|
|
|
@ -897,6 +897,7 @@ class FurnaceGUI {
|
|||
float dpiScale;
|
||||
int viewPrevPattern;
|
||||
int guiColorsBase;
|
||||
int guiColorsShading;
|
||||
int avoidRaisingPattern;
|
||||
int insFocusesPattern;
|
||||
int stepOnInsert;
|
||||
|
@ -990,6 +991,7 @@ class FurnaceGUI {
|
|||
dpiScale(0.0f),
|
||||
viewPrevPattern(1),
|
||||
guiColorsBase(0),
|
||||
guiColorsShading(0),
|
||||
avoidRaisingPattern(0),
|
||||
insFocusesPattern(1),
|
||||
stepOnInsert(0),
|
||||
|
|
|
@ -553,6 +553,7 @@ void FurnaceGUI::drawPattern() {
|
|||
// オップナー2608 i owe you one more for this horrible code
|
||||
// previous pattern
|
||||
ImGui::BeginDisabled();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameShading,0.0f);
|
||||
if (settings.viewPrevPattern) {
|
||||
if ((ord-1)>=0) for (int i=0; i<chans; i++) {
|
||||
patCache[i]=e->curPat[i].getPattern(e->curOrders->ord[i][ord-1],true);
|
||||
|
@ -590,6 +591,7 @@ void FurnaceGUI::drawPattern() {
|
|||
}
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
ImGui::PopStyleVar();
|
||||
oldRow=curRow;
|
||||
if (demandScrollX) {
|
||||
int totalDemand=demandX-ImGui::GetScrollX();
|
||||
|
|
|
@ -1247,9 +1247,16 @@ void FurnaceGUI::drawSettings() {
|
|||
ImGui::Text("Color scheme type:");
|
||||
if (ImGui::RadioButton("Dark##gcb0",settings.guiColorsBase==0)) {
|
||||
settings.guiColorsBase=0;
|
||||
applyUISettings(false);
|
||||
}
|
||||
if (ImGui::RadioButton("Light##gcb1",settings.guiColorsBase==1)) {
|
||||
settings.guiColorsBase=1;
|
||||
applyUISettings(false);
|
||||
}
|
||||
if (ImGui::SliderInt("Frame shading",&settings.guiColorsShading,0,100,"%d%%")) {
|
||||
if (settings.guiColorsShading<0) settings.guiColorsShading=0;
|
||||
if (settings.guiColorsShading>100) settings.guiColorsShading=100;
|
||||
applyUISettings(false);
|
||||
}
|
||||
UI_COLOR_CONFIG(GUI_COLOR_BACKGROUND,"Background");
|
||||
UI_COLOR_CONFIG(GUI_COLOR_FRAME_BACKGROUND,"Window background");
|
||||
|
@ -1915,6 +1922,7 @@ void FurnaceGUI::syncSettings() {
|
|||
settings.dpiScale=e->getConfFloat("dpiScale",0.0f);
|
||||
settings.viewPrevPattern=e->getConfInt("viewPrevPattern",1);
|
||||
settings.guiColorsBase=e->getConfInt("guiColorsBase",0);
|
||||
settings.guiColorsShading=e->getConfInt("guiColorsShading",0);
|
||||
settings.avoidRaisingPattern=e->getConfInt("avoidRaisingPattern",0);
|
||||
settings.insFocusesPattern=e->getConfInt("insFocusesPattern",1);
|
||||
settings.stepOnInsert=e->getConfInt("stepOnInsert",0);
|
||||
|
@ -1994,6 +2002,7 @@ void FurnaceGUI::syncSettings() {
|
|||
clampSetting(settings.dpiScale,0.0f,4.0f);
|
||||
clampSetting(settings.viewPrevPattern,0,1);
|
||||
clampSetting(settings.guiColorsBase,0,1);
|
||||
clampSetting(settings.guiColorsShading,0,100);
|
||||
clampSetting(settings.avoidRaisingPattern,0,1);
|
||||
clampSetting(settings.insFocusesPattern,0,1);
|
||||
clampSetting(settings.stepOnInsert,0,1);
|
||||
|
@ -2113,6 +2122,7 @@ void FurnaceGUI::commitSettings() {
|
|||
e->setConf("dpiScale",settings.dpiScale);
|
||||
e->setConf("viewPrevPattern",settings.viewPrevPattern);
|
||||
e->setConf("guiColorsBase",settings.guiColorsBase);
|
||||
e->setConf("guiColorsShading",settings.guiColorsShading);
|
||||
e->setConf("avoidRaisingPattern",settings.avoidRaisingPattern);
|
||||
e->setConf("insFocusesPattern",settings.insFocusesPattern);
|
||||
e->setConf("stepOnInsert",settings.stepOnInsert);
|
||||
|
@ -2677,6 +2687,10 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
|
|||
sty.FrameBorderSize=0.0f;
|
||||
}
|
||||
|
||||
if (settings.guiColorsShading>0) {
|
||||
sty.FrameShading=(float)settings.guiColorsShading/100.0f;
|
||||
}
|
||||
|
||||
sty.ScaleAllSizes(dpiScale);
|
||||
|
||||
ImGui::GetStyle()=sty;
|
||||
|
|
Loading…
Reference in New Issue