mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-21 07:09:59 +01:00
Bug Fix Text source
This commit is contained in:
@@ -1873,8 +1873,12 @@ void ImGuiVisitor::visit(TextSource &s)
|
||||
botom = ImGui::GetCursorPos();
|
||||
// Action on the filename
|
||||
ImGui::SetCursorPos(ImVec2(top.x, botom.y - ImGui::GetFrameHeight()));
|
||||
if (ImGuiToolkit::IconButton(3, 5, "Open"))
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_EDIT, "Open in editor"))
|
||||
SystemToolkit::open(_contents.c_str());
|
||||
ImGui::SetCursorPos(
|
||||
ImVec2(top.x + 0.95 * ImGui::GetFrameHeight(), botom.y - ImGui::GetFrameHeight()));
|
||||
if (ImGuiToolkit::IconButton(ICON_FA_REDO_ALT, "Reload"))
|
||||
tc->reopen();
|
||||
}
|
||||
// general case of free text : text editor
|
||||
else {
|
||||
|
||||
@@ -16,10 +16,6 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
**/
|
||||
#include <string>
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <future>
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/pbutils/pbutils.h>
|
||||
@@ -77,7 +73,7 @@ bool TextContents::SubtitleDiscoverer(const std::string &path)
|
||||
|
||||
TextContents::TextContents()
|
||||
: Stream(), src_(nullptr), txt_(nullptr),
|
||||
fontdesc_("arial 24"), color_(0xffffffff), outline_(2), outline_color_(4278190080),
|
||||
fontdesc_(""), color_(0xffffffff), outline_(2), outline_color_(4278190080),
|
||||
halignment_(1), valignment_(2), xalignment_(0.f), yalignment_(0.f)
|
||||
{
|
||||
}
|
||||
@@ -146,6 +142,7 @@ void TextContents::execute_open()
|
||||
txt_ = gst_bin_get_by_name(GST_BIN(pipeline_), "txt");
|
||||
|
||||
if (txt_) {
|
||||
// if there is a src in the pipeline, it should be a file
|
||||
if (src_) {
|
||||
// set the location of the file
|
||||
g_object_set(G_OBJECT(src_), "location", text_.c_str(), NULL);
|
||||
@@ -155,6 +152,13 @@ void TextContents::execute_open()
|
||||
g_object_set(G_OBJECT(txt_), "text", text_.c_str(), NULL);
|
||||
}
|
||||
|
||||
// Auto default font
|
||||
if (fontdesc_.empty()) {
|
||||
fontdesc_ = "sans ";
|
||||
fontdesc_ += std::to_string( height_ / 10 );
|
||||
}
|
||||
|
||||
// set text properties
|
||||
g_object_set(G_OBJECT(txt_),
|
||||
"font-desc",
|
||||
fontdesc_.c_str(),
|
||||
@@ -281,10 +285,8 @@ void TextContents::setOutline(uint o)
|
||||
// apply if ready
|
||||
if (txt_) {
|
||||
g_object_set(G_OBJECT(txt_),
|
||||
"draw-outline",
|
||||
outline_ > 0,
|
||||
"draw-shadow",
|
||||
outline_ > 1,
|
||||
"draw-outline", outline_ > 0,
|
||||
"draw-shadow", outline_ > 1,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1547,7 +1547,7 @@ enum SourceToolbarFlags_
|
||||
|
||||
void UserInterface::RenderSourceToolbar(bool *p_open, int* p_border, int *p_mode) {
|
||||
|
||||
if (!p_open || !p_border || !p_mode)
|
||||
if (!p_open || !p_border || !p_mode || !Mixer::manager().session()->ready())
|
||||
return;
|
||||
|
||||
Source *s = Mixer::manager().currentSource();
|
||||
@@ -3873,12 +3873,12 @@ void Navigator::RenderNewPannel(const ImVec2 &iconsize)
|
||||
ImGui::TextDisabled("Explore online");
|
||||
if (ImGui::Selectable(ICON_FA_EXTERNAL_LINK_ALT " Pango syntax"))
|
||||
SystemToolkit::open("https://docs.gtk.org/Pango/pango_markup.html");
|
||||
if (ImGui::Selectable(ICON_FA_EXTERNAL_LINK_ALT " SubRip files"))
|
||||
if (ImGui::Selectable(ICON_FA_EXTERNAL_LINK_ALT " SubRip file format"))
|
||||
SystemToolkit::open("https://en.wikipedia.org/wiki/SubRip");
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
ImGui::SameLine(0, IMGUI_SAME_LINE);
|
||||
ImGuiToolkit::Indication("More text layout options are available after source creation.", ICON_FA_INFO_CIRCLE);
|
||||
ImGuiToolkit::Indication("Format and layout options will be available after source creation.", ICON_FA_INFO_CIRCLE);
|
||||
ImGui::SetCursorPos(pos_bot);
|
||||
|
||||
// resolution
|
||||
|
||||
Reference in New Issue
Block a user