From 3c8160f1e3a6c4287b6c35550b7465ed4818c564 Mon Sep 17 00:00:00 2001
From: Thomas Goyne <plorkyeran@aegisub.org>
Date: Sat, 21 Dec 2013 08:24:59 -0800
Subject: [PATCH] Preserve the detached video dialog size when changing tools

The relayout to handle the changed subtoolbar size was fitting the
dialog to the size of the video, which was rather undesirable.
---
 aegisub/src/video_display.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/aegisub/src/video_display.cpp b/aegisub/src/video_display.cpp
index 002ba3f69..bf9f93316 100644
--- a/aegisub/src/video_display.cpp
+++ b/aegisub/src/video_display.cpp
@@ -414,7 +414,13 @@ void VideoDisplay::SetTool(std::unique_ptr<VisualToolBase> new_tool) {
 	tool->SetToolbar(toolBar);
 
 	// Update size as the new typesetting tool may have changed the subtoolbar size
-	UpdateSize();
+	if (!freeSize)
+		UpdateSize();
+	else {
+		// UpdateSize fits the window to the video, which we don't want to do
+		GetGrandParent()->Layout();
+		tool->SetDisplayArea(viewport_left, viewport_top, viewport_width, viewport_height);
+	}
 }
 
 bool VideoDisplay::ToolIsType(std::type_info const& type) const {
-- 
GitLab