diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..cefb299 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "files.associations": { + "xstring": "cpp", + "string": "cpp" + } +} \ No newline at end of file diff --git a/include/libmpv.h b/include/libmpv.h index 72bd8d5..4d5a712 100644 --- a/include/libmpv.h +++ b/include/libmpv.h @@ -77,6 +77,7 @@ class libMpv{ void setSubDelay(double value,bool osd); void setSubPos(int value,bool osd); void setSubFontSize(int value,bool osd); + void setSubBorderSize(int value,bool osd); void setSubFontColor(std::string hexcolor); void setDeinterlace(int value); diff --git a/source/UI/playerWindows.cpp b/source/UI/playerWindows.cpp index 473a903..af5a100 100644 --- a/source/UI/playerWindows.cpp +++ b/source/UI/playerWindows.cpp @@ -20,6 +20,7 @@ namespace playerWindows{ static int drag_gamma = 0; static int drag_hue = 0; static int rotateidx = 0; + static int ignorestyleidx = 0; static int shaderidx = 0; @@ -30,7 +31,8 @@ namespace playerWindows{ static int drag_subpos = 100; static float drag_subdelay = 0.0f; static int drag_subfontsize = 55; - + static int drag_subfontbordersize = 3; + static int slider_eq[6] = {0,0,0,0,0,0}; static char slider_hz[][8] = {"20-200","200-800","800-2K","2K-4K","4K-8K","20K"}; static float slider_supereq[18] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; @@ -566,6 +568,35 @@ namespace playerWindows{ if (ImGui::Begin("Right Menu Sub", nullptr, ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoScrollbar)) { ImGui::PushItemWidth(200-10); auto windowWidth = ImGui::GetWindowSize().x; + //ignore styles + ImGui::SetCursorPosX((windowWidth - ImGui::CalcTextSize("Embedded Styles", NULL, true).x) * 0.5f); + ImGui::PushItemWidth(200-10); + ImGui::Text("Embedded Styles"); + std::vector stylemenu = {"Activated","Deactivated"}; + if (ImGui::BeginCombo("Embedded Styles", stylemenu[ignorestyleidx].c_str(), 0)) + { + for (int n = 0; n < stylemenu.size(); n++) + { + const bool is_selected = (ignorestyleidx == n); + if (ImGui::Selectable(stylemenu[n].c_str(), is_selected)){ + if(n == 0){ + ignorestyleidx = 0; + mpv_command_string(libmpv->getHandle(),"set sub-ass yes ; no-osd seek -1"); + } + if(n == 1){ + ignorestyleidx = 1; + mpv_command_string(libmpv->getHandle(),"set sub-ass no ; no-osd seek -1"); + } + } + + + if (is_selected) + ImGui::SetItemDefaultFocus(); + } + ImGui::EndCombo(); + ImGui::PopItemWidth(); + } + //end ignore styles ImGui::SetCursorPosX((windowWidth - ImGui::CalcTextSize("Audio Delay", NULL, true).x) * 0.5f); ImGui::Text("Sub Delay"); if(ImGui::DragFloat("Sub Delay", &drag_subdelay, 0.100f, -5.0f, 5.0f, "%.3f", ImGuiSliderFlags_NoInput)){ @@ -582,7 +613,13 @@ namespace playerWindows{ if(ImGui::DragInt("Sub Font Size", &drag_subfontsize, 0.5f, 1, 120, "%d", ImGuiSliderFlags_NoInput)){ libmpv->setSubFontSize(drag_subfontsize,item.playershowcontrols); } - + //bordersize + ImGui::SetCursorPosX((windowWidth - ImGui::CalcTextSize("Sub Border Size", NULL, true).x) * 0.5f); + ImGui::Text("Sub Border Size"); + if(ImGui::DragInt("Sub Border Size", &drag_subfontbordersize, 0.5f, 0, 8, "%d", ImGuiSliderFlags_NoInput)){ + libmpv->setSubBorderSize(drag_subfontbordersize,item.playershowcontrols); + } + //endbordersize ImGui::Text("Sub Font Color"); float * subcolor = configini->getSubFontColor(true); if(ImGui::ColorButton("##subfontcolor", ImVec4(subcolor[0],subcolor[1],subcolor[2],subcolor[3]), ImGuiColorEditFlags_NoAlpha| ImGuiColorEditFlags_NoPicker|ImGuiColorEditFlags_InputRGB , ImVec2(190, 40))){ @@ -595,6 +632,7 @@ namespace playerWindows{ drag_subpos = 100; drag_subdelay = 0.0f; drag_subfontsize = configini->getSubFontSize(false); + drag_subfontbordersize = 3; libmpv->setSubPos(drag_subpos,false); libmpv->setSubDelay(drag_subdelay,false); libmpv->setSubFontSize(drag_subfontsize,false); diff --git a/source/libmpv.cpp b/source/libmpv.cpp index 717faa4..0618c2d 100644 --- a/source/libmpv.cpp +++ b/source/libmpv.cpp @@ -555,6 +555,16 @@ void libMpv::setSubFontSize(int value,bool osd){ } } +void libMpv::setSubBorderSize(int value,bool osd){ + if(osd){ + std::string cmd = "set sub-border-size " + std::to_string(value); + mpv_command_string(handle, cmd.c_str()); + }else{ + std::string cmd = "no-osd set sub-border-size " + std::to_string(value); + mpv_command_string(handle, cmd.c_str()); + } +} + void libMpv::setSubFontColor(std::string hexcolor){ std::string cmd = "no-osd set sub-color '" + hexcolor + std::string("'"); mpv_command_string(handle, cmd.c_str());