diff --git a/src/ImGuiVisitor.cpp b/src/ImGuiVisitor.cpp
index a232e3e..feffc08 100644
--- a/src/ImGuiVisitor.cpp
+++ b/src/ImGuiVisitor.cpp
@@ -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 {
diff --git a/src/TextSource.cpp b/src/TextSource.cpp
index f71c124..ecdb88c 100644
--- a/src/TextSource.cpp
+++ b/src/TextSource.cpp
@@ -16,10 +16,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
**/
-#include
-#include
-#include
-#include
#include
#include
@@ -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);
}
}
diff --git a/src/UserInterfaceManager.cpp b/src/UserInterfaceManager.cpp
index f9f21c6..3cd3699 100644
--- a/src/UserInterfaceManager.cpp
+++ b/src/UserInterfaceManager.cpp
@@ -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