diff --git a/Changelog.txt b/Changelog.txt index c61cf6e32..870391461 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,35 @@ Subtitle Edit Changelog +3.6.14 (xth August 2023) BETA +* NEW: + * New toolbar themes - thx jmaraujouy + * Use native styles for WebVTT + * Add video format ProRes for "Generate video with burned-in sub" + * Allow setting profile from cmd line - thx emcodem + * ASSA set layer - thx JonSchram + * Allow OCR of XML/PNG from MXF - thx Rodney +* IMPROVED: + * Update German translation - thx Netspark + * Update Chinese translation - thx nkh0472 + * Update Bulgarian translation - thx Калин + * Update Russian translation - thx elfriob + * Update Portuguese translation - thx hugok79 + * Update Korean translation - thx domddol + * Update Tesseract OCR to 5.3.1 (64-bit only) + * Improve convert of SSA to ASSA - thx Emiliano + * Update burn-in video preview to video - thx Masina86 + * Improve handling of invalid xml in ttml - thx m0ck69 +* FIXED: + * Fix "Find Double Words" - th uckthis + * Fix "double dash" issue in "Fix common errors" - thx Joel + * Avoid crash on very large TS files - thx Mariusz + * Do not count Unicode control characters in Auto-br - MichaelYochpaz + * Fix to eager file locked check - thx OSokil + * Preserve white space in "Multiple replace import" - thx OtaStrom + * Fix frozen settings in "Batch convert" - thx OtaStrom + * Fix export image alignment when using font tag - thx Matt + + 3.6.13 (14th May 2023) * NEW: * Add new subtitle format "nVivo transcript" - thx Ashin diff --git a/Dictionaries/cs_names.xml b/Dictionaries/cs_names.xml new file mode 100644 index 000000000..fb110a52f --- /dev/null +++ b/Dictionaries/cs_names.xml @@ -0,0 +1,11 @@ + + + + Václav + Novák + Svoboda + Novotný + Natálie + Tereza + Eliška + \ No newline at end of file diff --git a/Dictionaries/hrv_OCRFixReplaceList.xml b/Dictionaries/hrv_OCRFixReplaceList.xml index 5514c7884..bb70a4e3e 100644 --- a/Dictionaries/hrv_OCRFixReplaceList.xml +++ b/Dictionaries/hrv_OCRFixReplaceList.xml @@ -31,6 +31,7 @@ + @@ -66,7 +67,9 @@ + + @@ -90,8 +93,10 @@ + + @@ -111,6 +116,7 @@ + @@ -127,7 +133,12 @@ + + + + + @@ -155,6 +166,7 @@ + @@ -183,6 +195,7 @@ + @@ -278,8 +291,10 @@ + + @@ -297,6 +312,7 @@ + @@ -337,6 +353,7 @@ + @@ -362,6 +379,7 @@ + @@ -371,6 +389,7 @@ + @@ -380,6 +399,8 @@ + + @@ -458,6 +479,7 @@ + @@ -470,6 +492,8 @@ + + @@ -477,11 +501,15 @@ + + + + @@ -508,6 +536,7 @@ + @@ -639,6 +668,7 @@ + @@ -661,6 +691,7 @@ + @@ -747,6 +778,7 @@ + @@ -759,8 +791,10 @@ + + @@ -775,6 +809,7 @@ + @@ -784,6 +819,7 @@ + @@ -799,6 +835,7 @@ + @@ -831,6 +868,7 @@ + @@ -874,6 +912,7 @@ + @@ -881,6 +920,7 @@ + @@ -956,6 +996,7 @@ + @@ -1018,9 +1059,12 @@ + + + @@ -1045,12 +1089,15 @@ + + + @@ -1082,8 +1129,11 @@ + + + @@ -1094,11 +1144,13 @@ - + + + @@ -1111,13 +1163,20 @@ + + + + + + + @@ -1145,6 +1204,7 @@ + @@ -1181,6 +1241,7 @@ + @@ -1213,10 +1274,15 @@ + + + + + @@ -1258,7 +1324,9 @@ + + @@ -1269,11 +1337,13 @@ + + @@ -1285,6 +1355,7 @@ + @@ -1313,6 +1384,7 @@ + @@ -1336,6 +1408,8 @@ + + @@ -1353,6 +1427,11 @@ + + + + + @@ -1363,6 +1442,7 @@ + @@ -1380,6 +1460,7 @@ + @@ -1395,6 +1476,7 @@ + @@ -1403,8 +1485,12 @@ + + + + @@ -1415,6 +1501,10 @@ + + + + @@ -1436,6 +1526,7 @@ + @@ -1452,12 +1543,15 @@ + + + @@ -1487,6 +1581,7 @@ + @@ -1522,6 +1617,7 @@ + @@ -1547,6 +1643,7 @@ + @@ -1569,7 +1666,9 @@ + + @@ -1633,6 +1732,7 @@ + @@ -1691,6 +1791,7 @@ + @@ -1725,6 +1826,8 @@ + + @@ -1743,6 +1846,8 @@ + + @@ -1797,6 +1902,7 @@ + @@ -1815,17 +1921,20 @@ + + + @@ -1855,6 +1964,7 @@ + @@ -1905,8 +2015,13 @@ + + + + + @@ -1950,6 +2065,11 @@ + + + + + @@ -1957,6 +2077,7 @@ + @@ -2029,6 +2150,9 @@ + + + @@ -2063,6 +2187,7 @@ + @@ -2132,6 +2257,8 @@ + + @@ -2143,9 +2270,11 @@ + + @@ -2224,6 +2353,7 @@ + @@ -2394,6 +2524,8 @@ + + @@ -2505,6 +2637,7 @@ + @@ -2575,6 +2708,336 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2654,6 +3117,7 @@ + @@ -2684,8 +3148,10 @@ + + @@ -2763,6 +3229,7 @@ + @@ -3039,6 +3506,7 @@ + @@ -3093,6 +3561,7 @@ + @@ -3155,6 +3624,7 @@ + @@ -3164,7 +3634,6 @@ - @@ -3285,6 +3754,7 @@ + @@ -3351,6 +3821,7 @@ + @@ -3502,7 +3973,6 @@ - @@ -3791,6 +4261,7 @@ + @@ -3855,6 +4326,7 @@ + diff --git a/Dictionaries/srp_OCRFixReplaceList.xml b/Dictionaries/srp_OCRFixReplaceList.xml index 5a1fc2571..890345922 100644 --- a/Dictionaries/srp_OCRFixReplaceList.xml +++ b/Dictionaries/srp_OCRFixReplaceList.xml @@ -10,7 +10,7 @@ - + @@ -39,17 +39,17 @@ - - + + - - - + + + - + @@ -119,7 +119,7 @@ - + @@ -138,24 +138,24 @@ - + - + - - - + + + - - - - + + + + @@ -266,4 +266,4 @@ - \ No newline at end of file + diff --git a/Icons/Black/VideoPlayer/Background.png b/Icons/Black/VideoPlayer/Background.png new file mode 100644 index 000000000..b9f38725f Binary files /dev/null and b/Icons/Black/VideoPlayer/Background.png differ diff --git a/Icons/Black/VideoPlayer/FastForward.png b/Icons/Black/VideoPlayer/FastForward.png new file mode 100644 index 000000000..aac9fa8d4 Binary files /dev/null and b/Icons/Black/VideoPlayer/FastForward.png differ diff --git a/Icons/Black/VideoPlayer/FastForwardDown.png b/Icons/Black/VideoPlayer/FastForwardDown.png new file mode 100644 index 000000000..9e6df3c49 Binary files /dev/null and b/Icons/Black/VideoPlayer/FastForwardDown.png differ diff --git a/Icons/Black/VideoPlayer/FastForwardOver.png b/Icons/Black/VideoPlayer/FastForwardOver.png new file mode 100644 index 000000000..bd869b031 Binary files /dev/null and b/Icons/Black/VideoPlayer/FastForwardOver.png differ diff --git a/Icons/Black/VideoPlayer/Fullscreen.png b/Icons/Black/VideoPlayer/Fullscreen.png new file mode 100644 index 000000000..d7c196c91 Binary files /dev/null and b/Icons/Black/VideoPlayer/Fullscreen.png differ diff --git a/Icons/Black/VideoPlayer/FullscreenDown.png b/Icons/Black/VideoPlayer/FullscreenDown.png new file mode 100644 index 000000000..73de7563f Binary files /dev/null and b/Icons/Black/VideoPlayer/FullscreenDown.png differ diff --git a/Icons/Black/VideoPlayer/FullscreenOver.png b/Icons/Black/VideoPlayer/FullscreenOver.png new file mode 100644 index 000000000..cddb2db4f Binary files /dev/null and b/Icons/Black/VideoPlayer/FullscreenOver.png differ diff --git a/Icons/Black/VideoPlayer/Mute.png b/Icons/Black/VideoPlayer/Mute.png new file mode 100644 index 000000000..9810c3703 Binary files /dev/null and b/Icons/Black/VideoPlayer/Mute.png differ diff --git a/Icons/Black/VideoPlayer/MuteDown.png b/Icons/Black/VideoPlayer/MuteDown.png new file mode 100644 index 000000000..c27bc97ea Binary files /dev/null and b/Icons/Black/VideoPlayer/MuteDown.png differ diff --git a/Icons/Black/VideoPlayer/MuteOver.png b/Icons/Black/VideoPlayer/MuteOver.png new file mode 100644 index 000000000..9374fa2d7 Binary files /dev/null and b/Icons/Black/VideoPlayer/MuteOver.png differ diff --git a/Icons/Black/VideoPlayer/NoFullScreen.png b/Icons/Black/VideoPlayer/NoFullScreen.png new file mode 100644 index 000000000..178184378 Binary files /dev/null and b/Icons/Black/VideoPlayer/NoFullScreen.png differ diff --git a/Icons/Black/VideoPlayer/NoFullScreenDown.png b/Icons/Black/VideoPlayer/NoFullScreenDown.png new file mode 100644 index 000000000..e82041194 Binary files /dev/null and b/Icons/Black/VideoPlayer/NoFullScreenDown.png differ diff --git a/Icons/Black/VideoPlayer/NoFullScreenOver.png b/Icons/Black/VideoPlayer/NoFullScreenOver.png new file mode 100644 index 000000000..4d13d6b12 Binary files /dev/null and b/Icons/Black/VideoPlayer/NoFullScreenOver.png differ diff --git a/Icons/Black/VideoPlayer/Pause.png b/Icons/Black/VideoPlayer/Pause.png new file mode 100644 index 000000000..3897fe734 Binary files /dev/null and b/Icons/Black/VideoPlayer/Pause.png differ diff --git a/Icons/Black/VideoPlayer/PauseDown.png b/Icons/Black/VideoPlayer/PauseDown.png new file mode 100644 index 000000000..a6c871643 Binary files /dev/null and b/Icons/Black/VideoPlayer/PauseDown.png differ diff --git a/Icons/Black/VideoPlayer/PauseOver.png b/Icons/Black/VideoPlayer/PauseOver.png new file mode 100644 index 000000000..8fcdb4b0a Binary files /dev/null and b/Icons/Black/VideoPlayer/PauseOver.png differ diff --git a/Icons/Black/VideoPlayer/Play.png b/Icons/Black/VideoPlayer/Play.png new file mode 100644 index 000000000..e92b467de Binary files /dev/null and b/Icons/Black/VideoPlayer/Play.png differ diff --git a/Icons/Black/VideoPlayer/PlayDown.png b/Icons/Black/VideoPlayer/PlayDown.png new file mode 100644 index 000000000..246c22293 Binary files /dev/null and b/Icons/Black/VideoPlayer/PlayDown.png differ diff --git a/Icons/Black/VideoPlayer/PlayOver.png b/Icons/Black/VideoPlayer/PlayOver.png new file mode 100644 index 000000000..b96bffd13 Binary files /dev/null and b/Icons/Black/VideoPlayer/PlayOver.png differ diff --git a/Icons/Black/VideoPlayer/ProgressBar.png b/Icons/Black/VideoPlayer/ProgressBar.png new file mode 100644 index 000000000..52ef22a52 Binary files /dev/null and b/Icons/Black/VideoPlayer/ProgressBar.png differ diff --git a/Icons/Black/VideoPlayer/ProgressBarBackground.png b/Icons/Black/VideoPlayer/ProgressBarBackground.png new file mode 100644 index 000000000..3680908d0 Binary files /dev/null and b/Icons/Black/VideoPlayer/ProgressBarBackground.png differ diff --git a/Icons/Black/VideoPlayer/Reverse.png b/Icons/Black/VideoPlayer/Reverse.png new file mode 100644 index 000000000..e1eefca57 Binary files /dev/null and b/Icons/Black/VideoPlayer/Reverse.png differ diff --git a/Icons/Black/VideoPlayer/ReverseDown.png b/Icons/Black/VideoPlayer/ReverseDown.png new file mode 100644 index 000000000..e544905a6 Binary files /dev/null and b/Icons/Black/VideoPlayer/ReverseDown.png differ diff --git a/Icons/Black/VideoPlayer/ReverseOver.png b/Icons/Black/VideoPlayer/ReverseOver.png new file mode 100644 index 000000000..2f23bb21e Binary files /dev/null and b/Icons/Black/VideoPlayer/ReverseOver.png differ diff --git a/Icons/Black/VideoPlayer/Stop.png b/Icons/Black/VideoPlayer/Stop.png new file mode 100644 index 000000000..6129272d1 Binary files /dev/null and b/Icons/Black/VideoPlayer/Stop.png differ diff --git a/Icons/Black/VideoPlayer/StopDown.png b/Icons/Black/VideoPlayer/StopDown.png new file mode 100644 index 000000000..48ee7027e Binary files /dev/null and b/Icons/Black/VideoPlayer/StopDown.png differ diff --git a/Icons/Black/VideoPlayer/StopOver.png b/Icons/Black/VideoPlayer/StopOver.png new file mode 100644 index 000000000..5c2dee88f Binary files /dev/null and b/Icons/Black/VideoPlayer/StopOver.png differ diff --git a/Icons/Black/VideoPlayer/VolumeBar.png b/Icons/Black/VideoPlayer/VolumeBar.png new file mode 100644 index 000000000..f3f1676d9 Binary files /dev/null and b/Icons/Black/VideoPlayer/VolumeBar.png differ diff --git a/Icons/Black/VideoPlayer/VolumeBarBackground.png b/Icons/Black/VideoPlayer/VolumeBarBackground.png new file mode 100644 index 000000000..bcd49203e Binary files /dev/null and b/Icons/Black/VideoPlayer/VolumeBarBackground.png differ diff --git a/Icons/Black/WaveformCenter.png b/Icons/Black/WaveformCenter.png new file mode 100644 index 000000000..52cfb9690 Binary files /dev/null and b/Icons/Black/WaveformCenter.png differ diff --git a/Icons/Black/WaveformPause.png b/Icons/Black/WaveformPause.png new file mode 100644 index 000000000..a49f8acda Binary files /dev/null and b/Icons/Black/WaveformPause.png differ diff --git a/Icons/Black/WaveformPlay.png b/Icons/Black/WaveformPlay.png new file mode 100644 index 000000000..7a3bfa254 Binary files /dev/null and b/Icons/Black/WaveformPlay.png differ diff --git a/Icons/Black/WaveformPlayPause.png b/Icons/Black/WaveformPlayPause.png new file mode 100644 index 000000000..bc843c02a Binary files /dev/null and b/Icons/Black/WaveformPlayPause.png differ diff --git a/Icons/Black/WaveformPlaybackSpeed.png b/Icons/Black/WaveformPlaybackSpeed.png new file mode 100644 index 000000000..dd3264e76 Binary files /dev/null and b/Icons/Black/WaveformPlaybackSpeed.png differ diff --git a/Icons/Black/WaveformPlaybackSpeedSelected.png b/Icons/Black/WaveformPlaybackSpeedSelected.png new file mode 100644 index 000000000..acbc0c539 Binary files /dev/null and b/Icons/Black/WaveformPlaybackSpeedSelected.png differ diff --git a/Icons/Black/WaveformZoomIn.png b/Icons/Black/WaveformZoomIn.png new file mode 100644 index 000000000..1f4a1fe97 Binary files /dev/null and b/Icons/Black/WaveformZoomIn.png differ diff --git a/Icons/Black/WaveformZoomOut.png b/Icons/Black/WaveformZoomOut.png new file mode 100644 index 000000000..371a14ad6 Binary files /dev/null and b/Icons/Black/WaveformZoomOut.png differ diff --git a/Icons/Black/WebVttProperties.png b/Icons/Black/WebVttProperties.png index 110e5501b..4fa313325 100644 Binary files a/Icons/Black/WebVttProperties.png and b/Icons/Black/WebVttProperties.png differ diff --git a/Icons/Black/WebVttStyle.png b/Icons/Black/WebVttStyle.png new file mode 100644 index 000000000..110e5501b Binary files /dev/null and b/Icons/Black/WebVttStyle.png differ diff --git a/Icons/DarkTheme/VideoPlayer/Background.png b/Icons/DarkTheme/VideoPlayer/Background.png new file mode 100644 index 000000000..74a35adf6 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/Background.png differ diff --git a/Icons/DarkTheme/VideoPlayer/FastForward.png b/Icons/DarkTheme/VideoPlayer/FastForward.png new file mode 100644 index 000000000..b4a5aaad8 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/FastForward.png differ diff --git a/Icons/DarkTheme/VideoPlayer/FastForwardDown.png b/Icons/DarkTheme/VideoPlayer/FastForwardDown.png new file mode 100644 index 000000000..f61b7637e Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/FastForwardDown.png differ diff --git a/Icons/DarkTheme/VideoPlayer/FastForwardOver.png b/Icons/DarkTheme/VideoPlayer/FastForwardOver.png new file mode 100644 index 000000000..b89d19130 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/FastForwardOver.png differ diff --git a/Icons/DarkTheme/VideoPlayer/Fullscreen.png b/Icons/DarkTheme/VideoPlayer/Fullscreen.png new file mode 100644 index 000000000..62affe10a Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/Fullscreen.png differ diff --git a/Icons/DarkTheme/VideoPlayer/FullscreenDown.png b/Icons/DarkTheme/VideoPlayer/FullscreenDown.png new file mode 100644 index 000000000..b4787ebb6 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/FullscreenDown.png differ diff --git a/Icons/DarkTheme/VideoPlayer/FullscreenOver.png b/Icons/DarkTheme/VideoPlayer/FullscreenOver.png new file mode 100644 index 000000000..3f58d5dc5 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/FullscreenOver.png differ diff --git a/Icons/DarkTheme/VideoPlayer/Mute.png b/Icons/DarkTheme/VideoPlayer/Mute.png new file mode 100644 index 000000000..d99c500f5 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/Mute.png differ diff --git a/Icons/DarkTheme/VideoPlayer/MuteDown.png b/Icons/DarkTheme/VideoPlayer/MuteDown.png new file mode 100644 index 000000000..9a018744f Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/MuteDown.png differ diff --git a/Icons/DarkTheme/VideoPlayer/MuteOver.png b/Icons/DarkTheme/VideoPlayer/MuteOver.png new file mode 100644 index 000000000..6b8278e72 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/MuteOver.png differ diff --git a/Icons/DarkTheme/VideoPlayer/NoFullScreen.png b/Icons/DarkTheme/VideoPlayer/NoFullScreen.png new file mode 100644 index 000000000..2452783f9 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/NoFullScreen.png differ diff --git a/Icons/DarkTheme/VideoPlayer/NoFullScreenDown.png b/Icons/DarkTheme/VideoPlayer/NoFullScreenDown.png new file mode 100644 index 000000000..a7c22829c Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/NoFullScreenDown.png differ diff --git a/Icons/DarkTheme/VideoPlayer/NoFullScreenOver.png b/Icons/DarkTheme/VideoPlayer/NoFullScreenOver.png new file mode 100644 index 000000000..2413f4bb8 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/NoFullScreenOver.png differ diff --git a/Icons/DarkTheme/VideoPlayer/Pause.png b/Icons/DarkTheme/VideoPlayer/Pause.png new file mode 100644 index 000000000..d051b4172 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/Pause.png differ diff --git a/Icons/DarkTheme/VideoPlayer/PauseDown.png b/Icons/DarkTheme/VideoPlayer/PauseDown.png new file mode 100644 index 000000000..abff786e3 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/PauseDown.png differ diff --git a/Icons/DarkTheme/VideoPlayer/PauseOver.png b/Icons/DarkTheme/VideoPlayer/PauseOver.png new file mode 100644 index 000000000..bcf889680 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/PauseOver.png differ diff --git a/Icons/DarkTheme/VideoPlayer/Play.png b/Icons/DarkTheme/VideoPlayer/Play.png new file mode 100644 index 000000000..5e049a7b5 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/Play.png differ diff --git a/Icons/DarkTheme/VideoPlayer/PlayDown.png b/Icons/DarkTheme/VideoPlayer/PlayDown.png new file mode 100644 index 000000000..79698c450 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/PlayDown.png differ diff --git a/Icons/DarkTheme/VideoPlayer/PlayOver.png b/Icons/DarkTheme/VideoPlayer/PlayOver.png new file mode 100644 index 000000000..e8f6266bb Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/PlayOver.png differ diff --git a/Icons/DarkTheme/VideoPlayer/ProgressBar.png b/Icons/DarkTheme/VideoPlayer/ProgressBar.png new file mode 100644 index 000000000..8edceb13e Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/ProgressBar.png differ diff --git a/Icons/DarkTheme/VideoPlayer/ProgressBarBackground.png b/Icons/DarkTheme/VideoPlayer/ProgressBarBackground.png new file mode 100644 index 000000000..85494da2f Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/ProgressBarBackground.png differ diff --git a/Icons/DarkTheme/VideoPlayer/Reverse.png b/Icons/DarkTheme/VideoPlayer/Reverse.png new file mode 100644 index 000000000..5278b101b Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/Reverse.png differ diff --git a/Icons/DarkTheme/VideoPlayer/ReverseDown.png b/Icons/DarkTheme/VideoPlayer/ReverseDown.png new file mode 100644 index 000000000..ccfa45162 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/ReverseDown.png differ diff --git a/Icons/DarkTheme/VideoPlayer/ReverseOver.png b/Icons/DarkTheme/VideoPlayer/ReverseOver.png new file mode 100644 index 000000000..2741b7fe3 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/ReverseOver.png differ diff --git a/Icons/DarkTheme/VideoPlayer/Stop.png b/Icons/DarkTheme/VideoPlayer/Stop.png new file mode 100644 index 000000000..5a48d8c87 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/Stop.png differ diff --git a/Icons/DarkTheme/VideoPlayer/StopDown.png b/Icons/DarkTheme/VideoPlayer/StopDown.png new file mode 100644 index 000000000..57c3a1b0f Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/StopDown.png differ diff --git a/Icons/DarkTheme/VideoPlayer/StopOver.png b/Icons/DarkTheme/VideoPlayer/StopOver.png new file mode 100644 index 000000000..6fbce33c5 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/StopOver.png differ diff --git a/Icons/DarkTheme/VideoPlayer/VolumeBar.png b/Icons/DarkTheme/VideoPlayer/VolumeBar.png new file mode 100644 index 000000000..199f136d2 Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/VolumeBar.png differ diff --git a/Icons/DarkTheme/VideoPlayer/VolumeBarBackground.png b/Icons/DarkTheme/VideoPlayer/VolumeBarBackground.png new file mode 100644 index 000000000..0b78a1c2a Binary files /dev/null and b/Icons/DarkTheme/VideoPlayer/VolumeBarBackground.png differ diff --git a/Icons/DarkTheme/WaveformCenter.png b/Icons/DarkTheme/WaveformCenter.png new file mode 100644 index 000000000..31d4b8550 Binary files /dev/null and b/Icons/DarkTheme/WaveformCenter.png differ diff --git a/Icons/DarkTheme/WaveformPause.png b/Icons/DarkTheme/WaveformPause.png new file mode 100644 index 000000000..a899839d6 Binary files /dev/null and b/Icons/DarkTheme/WaveformPause.png differ diff --git a/Icons/DarkTheme/WaveformPlay.png b/Icons/DarkTheme/WaveformPlay.png new file mode 100644 index 000000000..72f2f7590 Binary files /dev/null and b/Icons/DarkTheme/WaveformPlay.png differ diff --git a/Icons/DarkTheme/WaveformPlayPause.png b/Icons/DarkTheme/WaveformPlayPause.png new file mode 100644 index 000000000..4720d7ae0 Binary files /dev/null and b/Icons/DarkTheme/WaveformPlayPause.png differ diff --git a/Icons/DarkTheme/WaveformPlaybackSpeed.png b/Icons/DarkTheme/WaveformPlaybackSpeed.png new file mode 100644 index 000000000..46d444401 Binary files /dev/null and b/Icons/DarkTheme/WaveformPlaybackSpeed.png differ diff --git a/Icons/DarkTheme/WaveformPlaybackSpeedSelected.png b/Icons/DarkTheme/WaveformPlaybackSpeedSelected.png new file mode 100644 index 000000000..d2180ab0d Binary files /dev/null and b/Icons/DarkTheme/WaveformPlaybackSpeedSelected.png differ diff --git a/Icons/DarkTheme/WaveformZoomIn.png b/Icons/DarkTheme/WaveformZoomIn.png new file mode 100644 index 000000000..a587854ff Binary files /dev/null and b/Icons/DarkTheme/WaveformZoomIn.png differ diff --git a/Icons/DarkTheme/WaveformZoomOut.png b/Icons/DarkTheme/WaveformZoomOut.png new file mode 100644 index 000000000..a161433d2 Binary files /dev/null and b/Icons/DarkTheme/WaveformZoomOut.png differ diff --git a/Icons/DarkTheme/WebVttProperties.png b/Icons/DarkTheme/WebVttProperties.png index 24c7f1d36..903d3ddae 100644 Binary files a/Icons/DarkTheme/WebVttProperties.png and b/Icons/DarkTheme/WebVttProperties.png differ diff --git a/Icons/DarkTheme/WebVttStyle.png b/Icons/DarkTheme/WebVttStyle.png new file mode 100644 index 000000000..24c7f1d36 Binary files /dev/null and b/Icons/DarkTheme/WebVttStyle.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/Background.png b/Icons/DefaultTheme/VideoPlayer/Background.png new file mode 100644 index 000000000..b9f38725f Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/Background.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/FastForward.png b/Icons/DefaultTheme/VideoPlayer/FastForward.png new file mode 100644 index 000000000..e9d6041d0 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/FastForward.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/FastForwardDown.png b/Icons/DefaultTheme/VideoPlayer/FastForwardDown.png new file mode 100644 index 000000000..db836ae6c Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/FastForwardDown.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/FastForwardOver.png b/Icons/DefaultTheme/VideoPlayer/FastForwardOver.png new file mode 100644 index 000000000..4746bf316 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/FastForwardOver.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/Fullscreen.png b/Icons/DefaultTheme/VideoPlayer/Fullscreen.png new file mode 100644 index 000000000..01304de50 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/Fullscreen.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/FullscreenDown.png b/Icons/DefaultTheme/VideoPlayer/FullscreenDown.png new file mode 100644 index 000000000..b8b06061c Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/FullscreenDown.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/FullscreenOver.png b/Icons/DefaultTheme/VideoPlayer/FullscreenOver.png new file mode 100644 index 000000000..2151b3868 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/FullscreenOver.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/Mute.png b/Icons/DefaultTheme/VideoPlayer/Mute.png new file mode 100644 index 000000000..51e57afa6 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/Mute.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/MuteDown.png b/Icons/DefaultTheme/VideoPlayer/MuteDown.png new file mode 100644 index 000000000..822db9ccd Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/MuteDown.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/MuteOver.png b/Icons/DefaultTheme/VideoPlayer/MuteOver.png new file mode 100644 index 000000000..459fd8de9 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/MuteOver.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/NoFullScreen.png b/Icons/DefaultTheme/VideoPlayer/NoFullScreen.png new file mode 100644 index 000000000..23d3e7af3 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/NoFullScreen.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/NoFullScreenDown.png b/Icons/DefaultTheme/VideoPlayer/NoFullScreenDown.png new file mode 100644 index 000000000..b4b900e8b Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/NoFullScreenDown.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/NoFullScreenOver.png b/Icons/DefaultTheme/VideoPlayer/NoFullScreenOver.png new file mode 100644 index 000000000..33d5747a3 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/NoFullScreenOver.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/Pause.png b/Icons/DefaultTheme/VideoPlayer/Pause.png new file mode 100644 index 000000000..7aa796937 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/Pause.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/PauseDown.png b/Icons/DefaultTheme/VideoPlayer/PauseDown.png new file mode 100644 index 000000000..fd2242fba Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/PauseDown.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/PauseOver.png b/Icons/DefaultTheme/VideoPlayer/PauseOver.png new file mode 100644 index 000000000..3915be7de Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/PauseOver.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/Play.png b/Icons/DefaultTheme/VideoPlayer/Play.png new file mode 100644 index 000000000..be6a620d2 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/Play.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/PlayDown.png b/Icons/DefaultTheme/VideoPlayer/PlayDown.png new file mode 100644 index 000000000..634465e7f Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/PlayDown.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/PlayOver.png b/Icons/DefaultTheme/VideoPlayer/PlayOver.png new file mode 100644 index 000000000..32de72901 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/PlayOver.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/ProgressBar.png b/Icons/DefaultTheme/VideoPlayer/ProgressBar.png new file mode 100644 index 000000000..4d5df3789 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/ProgressBar.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/ProgressBarBackground.png b/Icons/DefaultTheme/VideoPlayer/ProgressBarBackground.png new file mode 100644 index 000000000..3680908d0 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/ProgressBarBackground.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/Reverse.png b/Icons/DefaultTheme/VideoPlayer/Reverse.png new file mode 100644 index 000000000..de1233006 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/Reverse.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/ReverseDown.png b/Icons/DefaultTheme/VideoPlayer/ReverseDown.png new file mode 100644 index 000000000..c8a34130c Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/ReverseDown.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/ReverseOver.png b/Icons/DefaultTheme/VideoPlayer/ReverseOver.png new file mode 100644 index 000000000..6edd68a57 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/ReverseOver.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/Stop.png b/Icons/DefaultTheme/VideoPlayer/Stop.png new file mode 100644 index 000000000..6d5361c1f Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/Stop.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/StopDown.png b/Icons/DefaultTheme/VideoPlayer/StopDown.png new file mode 100644 index 000000000..8da54058d Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/StopDown.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/StopOver.png b/Icons/DefaultTheme/VideoPlayer/StopOver.png new file mode 100644 index 000000000..5117b0619 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/StopOver.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/VolumeBar.png b/Icons/DefaultTheme/VideoPlayer/VolumeBar.png new file mode 100644 index 000000000..975876651 Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/VolumeBar.png differ diff --git a/Icons/DefaultTheme/VideoPlayer/VolumeBarBackground.png b/Icons/DefaultTheme/VideoPlayer/VolumeBarBackground.png new file mode 100644 index 000000000..bcd49203e Binary files /dev/null and b/Icons/DefaultTheme/VideoPlayer/VolumeBarBackground.png differ diff --git a/Icons/DefaultTheme/WaveformCenter.png b/Icons/DefaultTheme/WaveformCenter.png new file mode 100644 index 000000000..60a92be13 Binary files /dev/null and b/Icons/DefaultTheme/WaveformCenter.png differ diff --git a/Icons/DefaultTheme/WaveformPause.png b/Icons/DefaultTheme/WaveformPause.png new file mode 100644 index 000000000..076d8c1f8 Binary files /dev/null and b/Icons/DefaultTheme/WaveformPause.png differ diff --git a/Icons/DefaultTheme/WaveformPlay.png b/Icons/DefaultTheme/WaveformPlay.png new file mode 100644 index 000000000..7e092746d Binary files /dev/null and b/Icons/DefaultTheme/WaveformPlay.png differ diff --git a/Icons/DefaultTheme/WaveformPlayPause.png b/Icons/DefaultTheme/WaveformPlayPause.png new file mode 100644 index 000000000..fd4b297dc Binary files /dev/null and b/Icons/DefaultTheme/WaveformPlayPause.png differ diff --git a/Icons/DefaultTheme/WaveformPlaybackSpeed.png b/Icons/DefaultTheme/WaveformPlaybackSpeed.png new file mode 100644 index 000000000..6ac68f9d9 Binary files /dev/null and b/Icons/DefaultTheme/WaveformPlaybackSpeed.png differ diff --git a/Icons/DefaultTheme/WaveformPlaybackSpeedSelected.png b/Icons/DefaultTheme/WaveformPlaybackSpeedSelected.png new file mode 100644 index 000000000..4090b1bea Binary files /dev/null and b/Icons/DefaultTheme/WaveformPlaybackSpeedSelected.png differ diff --git a/Icons/DefaultTheme/WaveformZoomIn.png b/Icons/DefaultTheme/WaveformZoomIn.png new file mode 100644 index 000000000..f2908a020 Binary files /dev/null and b/Icons/DefaultTheme/WaveformZoomIn.png differ diff --git a/Icons/DefaultTheme/WaveformZoomOut.png b/Icons/DefaultTheme/WaveformZoomOut.png new file mode 100644 index 000000000..3554a6f49 Binary files /dev/null and b/Icons/DefaultTheme/WaveformZoomOut.png differ diff --git a/Icons/DefaultTheme/WebVttProperties.png b/Icons/DefaultTheme/WebVttProperties.png index 5a2042ec3..a9cb82fd3 100644 Binary files a/Icons/DefaultTheme/WebVttProperties.png and b/Icons/DefaultTheme/WebVttProperties.png differ diff --git a/Icons/DefaultTheme/WebVttStyle.png b/Icons/DefaultTheme/WebVttStyle.png new file mode 100644 index 000000000..5a2042ec3 Binary files /dev/null and b/Icons/DefaultTheme/WebVttStyle.png differ diff --git a/Icons/Legacy/VideoPlayer/Background.png b/Icons/Legacy/VideoPlayer/Background.png new file mode 100644 index 000000000..c2642eb87 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/Background.png differ diff --git a/Icons/Legacy/VideoPlayer/FastForward.png b/Icons/Legacy/VideoPlayer/FastForward.png new file mode 100644 index 000000000..68cd29105 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/FastForward.png differ diff --git a/Icons/Legacy/VideoPlayer/FastForwardDown.png b/Icons/Legacy/VideoPlayer/FastForwardDown.png new file mode 100644 index 000000000..79fd466ac Binary files /dev/null and b/Icons/Legacy/VideoPlayer/FastForwardDown.png differ diff --git a/Icons/Legacy/VideoPlayer/FastForwardOver.png b/Icons/Legacy/VideoPlayer/FastForwardOver.png new file mode 100644 index 000000000..ed0dfed68 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/FastForwardOver.png differ diff --git a/Icons/Legacy/VideoPlayer/Fullscreen.png b/Icons/Legacy/VideoPlayer/Fullscreen.png new file mode 100644 index 000000000..f81ae6cb8 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/Fullscreen.png differ diff --git a/Icons/Legacy/VideoPlayer/FullscreenDown.png b/Icons/Legacy/VideoPlayer/FullscreenDown.png new file mode 100644 index 000000000..6be3167c7 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/FullscreenDown.png differ diff --git a/Icons/Legacy/VideoPlayer/FullscreenOver.png b/Icons/Legacy/VideoPlayer/FullscreenOver.png new file mode 100644 index 000000000..f719655a7 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/FullscreenOver.png differ diff --git a/Icons/Legacy/VideoPlayer/Mute.png b/Icons/Legacy/VideoPlayer/Mute.png new file mode 100644 index 000000000..324608c29 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/Mute.png differ diff --git a/Icons/Legacy/VideoPlayer/MuteDown.png b/Icons/Legacy/VideoPlayer/MuteDown.png new file mode 100644 index 000000000..83218bcb4 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/MuteDown.png differ diff --git a/Icons/Legacy/VideoPlayer/MuteOver.png b/Icons/Legacy/VideoPlayer/MuteOver.png new file mode 100644 index 000000000..7643ee977 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/MuteOver.png differ diff --git a/Icons/Legacy/VideoPlayer/NoFullScreen.png b/Icons/Legacy/VideoPlayer/NoFullScreen.png new file mode 100644 index 000000000..04d57c038 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/NoFullScreen.png differ diff --git a/Icons/Legacy/VideoPlayer/NoFullScreenDown.png b/Icons/Legacy/VideoPlayer/NoFullScreenDown.png new file mode 100644 index 000000000..b02aad830 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/NoFullScreenDown.png differ diff --git a/Icons/Legacy/VideoPlayer/NoFullScreenOver.png b/Icons/Legacy/VideoPlayer/NoFullScreenOver.png new file mode 100644 index 000000000..eb5e78fd3 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/NoFullScreenOver.png differ diff --git a/Icons/Legacy/VideoPlayer/Pause.png b/Icons/Legacy/VideoPlayer/Pause.png new file mode 100644 index 000000000..c18ff2581 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/Pause.png differ diff --git a/Icons/Legacy/VideoPlayer/PauseDown.png b/Icons/Legacy/VideoPlayer/PauseDown.png new file mode 100644 index 000000000..94688e196 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/PauseDown.png differ diff --git a/Icons/Legacy/VideoPlayer/PauseOver.png b/Icons/Legacy/VideoPlayer/PauseOver.png new file mode 100644 index 000000000..4f7362626 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/PauseOver.png differ diff --git a/Icons/Legacy/VideoPlayer/Play.png b/Icons/Legacy/VideoPlayer/Play.png new file mode 100644 index 000000000..76d93d504 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/Play.png differ diff --git a/Icons/Legacy/VideoPlayer/PlayDown.png b/Icons/Legacy/VideoPlayer/PlayDown.png new file mode 100644 index 000000000..91ceecf28 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/PlayDown.png differ diff --git a/Icons/Legacy/VideoPlayer/PlayOver.png b/Icons/Legacy/VideoPlayer/PlayOver.png new file mode 100644 index 000000000..56b0e5945 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/PlayOver.png differ diff --git a/Icons/Legacy/VideoPlayer/ProgressBar.png b/Icons/Legacy/VideoPlayer/ProgressBar.png new file mode 100644 index 000000000..d372a39e9 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/ProgressBar.png differ diff --git a/Icons/Legacy/VideoPlayer/ProgressBarBackground.png b/Icons/Legacy/VideoPlayer/ProgressBarBackground.png new file mode 100644 index 000000000..f5878a945 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/ProgressBarBackground.png differ diff --git a/Icons/Legacy/VideoPlayer/Reverse.png b/Icons/Legacy/VideoPlayer/Reverse.png new file mode 100644 index 000000000..e7e8f5e78 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/Reverse.png differ diff --git a/Icons/Legacy/VideoPlayer/ReverseDown.png b/Icons/Legacy/VideoPlayer/ReverseDown.png new file mode 100644 index 000000000..c57b383d4 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/ReverseDown.png differ diff --git a/Icons/Legacy/VideoPlayer/ReverseOver.png b/Icons/Legacy/VideoPlayer/ReverseOver.png new file mode 100644 index 000000000..b43d264aa Binary files /dev/null and b/Icons/Legacy/VideoPlayer/ReverseOver.png differ diff --git a/Icons/Legacy/VideoPlayer/Stop.png b/Icons/Legacy/VideoPlayer/Stop.png new file mode 100644 index 000000000..324c85c11 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/Stop.png differ diff --git a/Icons/Legacy/VideoPlayer/StopDown.png b/Icons/Legacy/VideoPlayer/StopDown.png new file mode 100644 index 000000000..11777e094 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/StopDown.png differ diff --git a/Icons/Legacy/VideoPlayer/StopOver.png b/Icons/Legacy/VideoPlayer/StopOver.png new file mode 100644 index 000000000..5eab80f09 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/StopOver.png differ diff --git a/Icons/Legacy/VideoPlayer/VolumeBar.png b/Icons/Legacy/VideoPlayer/VolumeBar.png new file mode 100644 index 000000000..d372a39e9 Binary files /dev/null and b/Icons/Legacy/VideoPlayer/VolumeBar.png differ diff --git a/Icons/Legacy/VideoPlayer/VolumeBarBackground.png b/Icons/Legacy/VideoPlayer/VolumeBarBackground.png new file mode 100644 index 000000000..cd74ccd8d Binary files /dev/null and b/Icons/Legacy/VideoPlayer/VolumeBarBackground.png differ diff --git a/Icons/Legacy/WaveformCenter.png b/Icons/Legacy/WaveformCenter.png new file mode 100644 index 000000000..8b2c4717c Binary files /dev/null and b/Icons/Legacy/WaveformCenter.png differ diff --git a/Icons/Legacy/WaveformPause.png b/Icons/Legacy/WaveformPause.png new file mode 100644 index 000000000..96a8cf7ea Binary files /dev/null and b/Icons/Legacy/WaveformPause.png differ diff --git a/Icons/Legacy/WaveformPlay.png b/Icons/Legacy/WaveformPlay.png new file mode 100644 index 000000000..ade7cb6f5 Binary files /dev/null and b/Icons/Legacy/WaveformPlay.png differ diff --git a/Icons/Legacy/WaveformPlayPause.png b/Icons/Legacy/WaveformPlayPause.png new file mode 100644 index 000000000..df2894098 Binary files /dev/null and b/Icons/Legacy/WaveformPlayPause.png differ diff --git a/Icons/Legacy/WaveformPlaybackSpeed.png b/Icons/Legacy/WaveformPlaybackSpeed.png new file mode 100644 index 000000000..f26983f20 Binary files /dev/null and b/Icons/Legacy/WaveformPlaybackSpeed.png differ diff --git a/Icons/Legacy/WaveformPlaybackSpeedSelected.png b/Icons/Legacy/WaveformPlaybackSpeedSelected.png new file mode 100644 index 000000000..041c70667 Binary files /dev/null and b/Icons/Legacy/WaveformPlaybackSpeedSelected.png differ diff --git a/Icons/Legacy/WaveformZoomIn.png b/Icons/Legacy/WaveformZoomIn.png new file mode 100644 index 000000000..43e045356 Binary files /dev/null and b/Icons/Legacy/WaveformZoomIn.png differ diff --git a/Icons/Legacy/WaveformZoomOut.png b/Icons/Legacy/WaveformZoomOut.png new file mode 100644 index 000000000..44933a988 Binary files /dev/null and b/Icons/Legacy/WaveformZoomOut.png differ diff --git a/Icons/Legacy/WebVttStyle.png b/Icons/Legacy/WebVttStyle.png new file mode 100644 index 000000000..8e801d048 Binary files /dev/null and b/Icons/Legacy/WebVttStyle.png differ diff --git a/LanguageBaseEnglish.xml b/LanguageBaseEnglish.xml index 19ae7092c..0265daf12 100644 --- a/LanguageBaseEnglish.xml +++ b/LanguageBaseEnglish.xml @@ -37,6 +37,7 @@ Actor Gap Region + Layer # Number Text @@ -1471,6 +1472,7 @@ To use an API key, go to "Options -> Settings -> Tools" to enter your Goog Size all columns to fit Set style Set actor + Set layer ASSA tools Sub Station Alpha styles... Advanced Sub Station Alpha styles... @@ -1480,6 +1482,9 @@ To use an API key, go to "Options -> Settings -> Tools" to enter your Goog Timed Text - set language Sami - set class Nuendo - set character + WebVTT - set style + WebVTT - set voice + WebVTT - browser preview Cut Copy Paste @@ -2369,6 +2374,7 @@ can edit in same subtitle file (collaboration) Show fullscreen button Subtitle preview font name Subtitle preview font size + Vertical margin Main window video controls Custom search text and URL Waveform appearance @@ -2503,6 +2509,7 @@ can edit in same subtitle file (collaboration) Dark theme Use dark theme Show list view grid lines + Graphics buttons Update Focus set video position Toggle dock/undock of video controls @@ -2653,6 +2660,7 @@ can edit in same subtitle file (collaboration) Toggle video controls Toggle contrast (mpv only) Audio to text ({0}) + Extract audio (selected lines) Audio to text selected lines ({0}) Toggle brightness (mpv only) Translate, custom search 1 @@ -3308,4 +3316,12 @@ Keep changes? WebVTT - set new voice Name of voice + + WebVTT styles + + + Whisper Advanced - extra command line arguments + Extra pameters for whisper command line: + Note: Different Whisper implementations have different command line parameters! + \ No newline at end of file diff --git a/SubtitleEdit.sln.DotSettings b/SubtitleEdit.sln.DotSettings index 794286398..fb114b125 100644 --- a/SubtitleEdit.sln.DotSettings +++ b/SubtitleEdit.sln.DotSettings @@ -21,5 +21,7 @@ True True True + True True + True True \ No newline at end of file diff --git a/build.bat b/build.bat index 78dd9f395..e5035dab5 100644 --- a/build.bat +++ b/build.bat @@ -189,9 +189,13 @@ IF NOT EXIST "temp_zip\Ocr" MD "temp_zip\Ocr" IF NOT EXIST "temp_zip\Tesseract302" MD "temp_zip\Tesseract302" IF NOT EXIST "temp_zip\Icons" MD "temp_zip\Icons" IF NOT EXIST "temp_zip\Icons\DefaultTheme" MD "temp_zip\Icons\DefaultTheme" +IF NOT EXIST "temp_zip\Icons\DefaultTheme\VideoPlayer" MD "temp_zip\Icons\DefaultTheme\VideoPlayer" IF NOT EXIST "temp_zip\Icons\DarkTheme" MD "temp_zip\Icons\DarkTheme" +IF NOT EXIST "temp_zip\Icons\DarkTheme\VideoPlayer" MD "temp_zip\Icons\DarkTheme\VideoPlayer" IF NOT EXIST "temp_zip\Icons\Legacy" MD "temp_zip\Icons\Legacy" +IF NOT EXIST "temp_zip\Icons\Legacy\VideoPlayer" MD "temp_zip\Icons\Legacy\VideoPlayer" IF NOT EXIST "temp_zip\Icons\Black" MD "temp_zip\Icons\Black" +IF NOT EXIST "temp_zip\Icons\Black\VideoPlayer" MD "temp_zip\Icons\Black\VideoPlayer" ECHO. COPY /Y /V "..\..\..\..\LICENSE.txt" "temp_zip\" @@ -219,9 +223,13 @@ COPY /Y /V "..\..\..\..\Ocr\*.*" "temp_zip\Ocr\" XCOPY /Y /V "..\..\..\..\Tesseract302\*.*" "temp_zip\Tesseract302\" /S COPY /Y /V "..\..\..\..\Icons\*.ico" "temp_zip\Icons\" COPY /Y /V "..\..\..\..\Icons\DefaultTheme\*.png" "temp_zip\Icons\DefaultTheme" +COPY /Y /V "..\..\..\..\Icons\DefaultTheme\VideoPlayer\*.png" "temp_zip\Icons\DefaultTheme\VideoPlayer" COPY /Y /V "..\..\..\..\Icons\DarkTheme\*.png" "temp_zip\Icons\DarkTheme" +COPY /Y /V "..\..\..\..\Icons\DarkTheme\VideoPlayer\*.png" "temp_zip\Icons\DarkTheme\VideoPlayer" COPY /Y /V "..\..\..\..\Icons\Legacy\*.png" "temp_zip\Icons\Legacy" +COPY /Y /V "..\..\..\..\Icons\Legacy\VideoPlayer\*.png" "temp_zip\Icons\Legacy\VideoPlayer" COPY /Y /V "..\..\..\..\Icons\Black\*.png" "temp_zip\Icons\Black" +COPY /Y /V "..\..\..\..\Icons\Black\VideoPlayer\*.png" "temp_zip\Icons\Black\VideoPlayer" PUSHD "temp_zip" START "" /B /WAIT "%SEVENZIP%" a -tzip -mx=9 "SubtitleEdit-%VERSION%.zip" * >NUL diff --git a/build_beta.bat b/build_beta.bat index e95f72b59..261b2a552 100644 --- a/build_beta.bat +++ b/build_beta.bat @@ -163,9 +163,13 @@ IF NOT EXIST "temp_zip\Ocr" MD "temp_zip\Ocr" IF NOT EXIST "temp_zip\Tesseract302" MD "temp_zip\Tesseract302" IF NOT EXIST "temp_zip\Icons" MD "temp_zip\Icons" IF NOT EXIST "temp_zip\Icons\DefaultTheme" MD "temp_zip\Icons\DefaultTheme" +IF NOT EXIST "temp_zip\Icons\DefaultTheme\VideoPlayer" MD "temp_zip\Icons\DefaultTheme\VideoPlayer" IF NOT EXIST "temp_zip\Icons\DarkTheme" MD "temp_zip\Icons\DarkTheme" +IF NOT EXIST "temp_zip\Icons\DarkTheme\VideoPlayer" MD "temp_zip\Icons\DarkTheme\VideoPlayer" IF NOT EXIST "temp_zip\Icons\Legacy" MD "temp_zip\Icons\Legacy" +IF NOT EXIST "temp_zip\Icons\Legacy\VideoPlayer" MD "temp_zip\Icons\Legacy\VideoPlayer" IF NOT EXIST "temp_zip\Icons\Black" MD "temp_zip\Icons\Black" +IF NOT EXIST "temp_zip\Icons\Black\VideoPlayer" MD "temp_zip\Icons\Black\VideoPlayer" ECHO. COPY /Y /V "..\..\..\..\LICENSE.txt" "temp_zip\" @@ -193,9 +197,13 @@ COPY /Y /V "..\..\..\..\Ocr\*.*" "temp_zip\Ocr\" XCOPY /Y /V "..\..\..\..\Tesseract302\*.*" "temp_zip\Tesseract302\" /S COPY /Y /V "..\..\..\..\Icons\*.ico" "temp_zip\Icons\" COPY /Y /V "..\..\..\..\Icons\DefaultTheme\*.png" "temp_zip\Icons\DefaultTheme" +COPY /Y /V "..\..\..\..\Icons\DefaultTheme\VideoPlayer\*.png" "temp_zip\Icons\DefaultTheme\VideoPlayer" COPY /Y /V "..\..\..\..\Icons\DarkTheme\*.png" "temp_zip\Icons\DarkTheme" +COPY /Y /V "..\..\..\..\Icons\DarkTheme\VideoPlayer\*.png" "temp_zip\Icons\DarkTheme\VideoPlayer" COPY /Y /V "..\..\..\..\Icons\Legacy\*.png" "temp_zip\Icons\Legacy" +COPY /Y /V "..\..\..\..\Icons\Legacy\VideoPlayer\*.png" "temp_zip\Icons\Legacy\VideoPlayer" COPY /Y /V "..\..\..\..\Icons\Black\*.png" "temp_zip\Icons\Black" +COPY /Y /V "..\..\..\..\Icons\Black\VideoPlayer\*.png" "temp_zip\Icons\Black\VideoPlayer" PUSHD "temp_zip" START "" /B /WAIT "%SEVENZIP%" a -tzip -mx=9 "SubtitleEditBeta.zip" * >NUL diff --git a/src/Test/Core/WebVttHelperTest.cs b/src/Test/Core/WebVttHelperTest.cs new file mode 100644 index 000000000..e2719494e --- /dev/null +++ b/src/Test/Core/WebVttHelperTest.cs @@ -0,0 +1,52 @@ +using System.Collections.Generic; +using System.Drawing; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Nikse.SubtitleEdit.Core.Common; + +namespace Test.Core +{ + [TestClass] + public class WebVttHelperTest + { + [TestMethod] + public void RemoveColorTag1() + { + var styles = new List + { + new WebVttStyle() + { + Name = ".Red", + Color = Color.Red, + }, + }; + + var text = "Red"; + var result = WebVttHelper.RemoveColorTag(text, Color.Red, styles); + + Assert.AreEqual("Red", result); + } + + [TestMethod] + public void RemoveColorTag2() + { + var styles = new List + { + new WebVttStyle + { + Name = ".Red", + Color = Color.Red, + }, + new WebVttStyle + { + Name = ".Italic", + Italic = true, + }, + }; + + var text = "Red"; + var result = WebVttHelper.RemoveColorTag(text, Color.Red, styles); + + Assert.AreEqual("Red", result); + } + } +} diff --git a/src/Test/Core/WebVttToAssaTest.cs b/src/Test/Core/WebVttToAssaTest.cs new file mode 100644 index 000000000..456e29828 --- /dev/null +++ b/src/Test/Core/WebVttToAssaTest.cs @@ -0,0 +1,116 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Nikse.SubtitleEdit.Core.Common; +using Nikse.SubtitleEdit.Core.SubtitleFormats; + +namespace Test.Core +{ + [TestClass] + public class WebVttToAssaTest + { + [TestMethod] + public void TestStyles1() + { + var subtitle = new Subtitle(); + subtitle.Header = "WEBVTT\r\n\r\nSTYLE\r\n::cue(.background-color_transparent) {\r\n background-color: rgba(255,255,255,0.0);\r\n}\r\n::cue(.color_EBEBEB) {\r\n color: rgba(235,235,235,1.000000);\r\n}\r\n::cue(.font-family_Arial) {\r\n font-family: Arial;\r\n}\r\n::cue(.font-style_normal) {\r\n font-style: normal;\r\n}\r\n::cue(.font-weight_normal) {\r\n font-weight: normal;\r\n}\r\n::cue(.text-shadow_#101010-3px) {\r\n text-shadow: #101010 3px;\r\n}\r\n::cue(.font-style_italic) {\r\n font-style: italic;\r\n}"; + var converted = WebVttToAssa.Convert(subtitle, new SsaStyle(), 1920, 1080); + var styles = AdvancedSubStationAlpha.GetSsaStylesFromHeader(converted.Header); + + Assert.AreEqual(".background-color_transparent", styles[1].Name); + Assert.AreEqual(".color_EBEBEB", styles[2].Name); + Assert.AreEqual(".font-family_Arial", styles[3].Name); + Assert.AreEqual(".font-style_normal", styles[4].Name); + Assert.AreEqual(".font-weight_normal", styles[5].Name); + Assert.AreEqual(".text-shadow_#101010-3px", styles[6].Name); + Assert.AreEqual(".font-style_italic", styles[7].Name); + + Assert.AreEqual(235, styles[2].Primary.R); + Assert.AreEqual("Arial", styles[3].FontName); + Assert.AreEqual(false, styles[4].Italic); + Assert.AreEqual(false, styles[5].Bold); + Assert.AreEqual(3, styles[6].ShadowWidth); + Assert.AreEqual(true, styles[7].Italic); + } + + [TestMethod] + public void TestStyles2() + { + var subtitle = new Subtitle(); + subtitle.Header = "STYLE\r\n::cue(.styledotEAC118) { color:#EAC118 }\r\n::cue(.styledotaqua) { color:aqua }\r\n::cue(.styledotaquadotitalic) { color:aqua;font-style:italic }\r\n::cue(.styledotitalic) { font-style:italic }\r\n::cue(.styledotEAC118dotitalic) { color:#EAC118;font-style:italic }"; + var converted = WebVttToAssa.Convert(subtitle, new SsaStyle(), 1920, 1080); + var styles = AdvancedSubStationAlpha.GetSsaStylesFromHeader(converted.Header); + + Assert.AreEqual(".styledotEAC118", styles[1].Name); + Assert.AreEqual(".styledotaqua", styles[2].Name); + Assert.AreEqual(".styledotaquadotitalic", styles[3].Name); + Assert.AreEqual(".styledotitalic", styles[4].Name); + Assert.AreEqual(".styledotEAC118dotitalic", styles[5].Name); + + Assert.AreEqual(234, styles[1].Primary.R); + Assert.AreEqual(193, styles[1].Primary.G); + Assert.AreEqual(24, styles[1].Primary.B); + Assert.AreEqual(0, styles[2].Primary.R); + Assert.AreEqual(255, styles[2].Primary.G); + Assert.AreEqual(255, styles[2].Primary.B); + Assert.AreEqual(true, styles[3].Italic); + Assert.AreEqual(true, styles[4].Italic); + Assert.AreEqual(true, styles[5].Italic); + Assert.AreEqual(234, styles[5].Primary.R); + Assert.AreEqual(193, styles[5].Primary.G); + Assert.AreEqual(24, styles[5].Primary.B); + } + + [TestMethod] + public void TestLineStyles1() + { + var subtitle = new Subtitle(); + subtitle.Header = "STYLE\r\n::cue(.styledotEAC118) { color:#EAC118 }"; + subtitle.Paragraphs.Add(new Paragraph("Hi", 0,0)); + var converted = WebVttToAssa.Convert(subtitle, new SsaStyle(), 1920, 1080); + + Assert.AreEqual("Hi", converted.Paragraphs[0].Text); + Assert.AreEqual(".styledotEAC118", converted.Paragraphs[0].Extra); + } + + [TestMethod] + public void TestLineStyles2() + { + var subtitle = new Subtitle(); + subtitle.Header = "STYLE\r\n::cue(.styleItalic) { font-style:italic }\r\n::cue(.styleColor123456) { color:#123456 }"; + subtitle.Paragraphs.Add(new Paragraph("Hi", 0, 0)); + var converted = WebVttToAssa.Convert(subtitle, new SsaStyle(), 1920, 1080); + + Assert.AreEqual("{\\c&H563412\\i1}Hi", converted.Paragraphs[0].Text); + } + + [TestMethod] + public void TestItalicInline() + { + var subtitle = new Subtitle(); + subtitle.Paragraphs.Add(new Paragraph("Hallo italic world.", 0, 0)); + var converted = WebVttToAssa.Convert(subtitle, new SsaStyle(), 1920, 1080); + var text = converted.ToText(new AdvancedSubStationAlpha()); + Assert.AreEqual("Hallo {\\i1}italic{\\i0} world.", converted.Paragraphs[0].Text); + Assert.IsTrue(text.Contains("Hallo {\\i1}italic{\\i0} world.")); + } + + [TestMethod] + public void TestBoldInline() + { + var subtitle = new Subtitle(); + subtitle.Paragraphs.Add(new Paragraph("Hallo bold world.", 0, 0)); + var converted = WebVttToAssa.Convert(subtitle, new SsaStyle(), 1920, 1080); + var text = converted.ToText(new AdvancedSubStationAlpha()); + Assert.IsTrue(text.Contains("Hallo {\\b1}bold{\\b0} world.")); + } + + [TestMethod] + public void TestUnderlineInline() + { + var subtitle = new Subtitle(); + subtitle.Paragraphs.Add(new Paragraph("Hallo underline world.", 0, 0)); + var converted = WebVttToAssa.Convert(subtitle, new SsaStyle(), 1920, 1080); + var text = converted.ToText(new AdvancedSubStationAlpha()); + Assert.IsTrue(text.Contains("Hallo {\\u1}underline{\\u0} world.")); + } + } +} diff --git a/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs b/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs index 1f8416b2a..95b2ba5d5 100644 --- a/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs +++ b/src/Test/Logic/Forms/RemoveTextForHearImpairedTest.cs @@ -658,6 +658,24 @@ namespace Test.Logic.Forms Assert.AreEqual(string.Empty, actual); } + [TestMethod] + public void RemoveInterjections19() + { + var text = $"- ¡Hm!{Environment.NewLine}- Increíble, ¿verdad?"; + var settings = GetRemoveInterjectionContext(text, true); + var actual = new RemoveInterjection().Invoke(settings); + Assert.AreEqual("Increíble, ¿verdad?", actual); + } + + [TestMethod] + public void RemoveInterjections19B() + { + var text = $"- ¿Hm?{Environment.NewLine}- Increíble, ¿verdad?"; + var settings = GetRemoveInterjectionContext(text, true); + var actual = new RemoveInterjection().Invoke(settings); + Assert.AreEqual("Increíble, ¿verdad?", actual); + } + [TestMethod] public void RemoveColonOnlyOnSeparateLine() { diff --git a/src/Test/Logic/SubtitleFormats/SubtitleFormatsTest.cs b/src/Test/Logic/SubtitleFormats/SubtitleFormatsTest.cs index ead919c76..d8e0bd95e 100644 --- a/src/Test/Logic/SubtitleFormats/SubtitleFormatsTest.cs +++ b/src/Test/Logic/SubtitleFormats/SubtitleFormatsTest.cs @@ -1596,6 +1596,7 @@ and astronauts.“..."" #region WebVTT + [Ignore] //rewriting WebVTT... [TestMethod] public void WebVttFontColor() { @@ -1634,6 +1635,7 @@ Hi, I'm Keith Lemon. Assert.AreEqual("AUDIENCE: Aww!", subtitle.Paragraphs[1].Text); } + [Ignore] // rewriting WebVTT [TestMethod] public void WebVttFontColorHex2() { diff --git a/src/Test/Test.csproj b/src/Test/Test.csproj index 2cd449ab2..0292b6917 100644 --- a/src/Test/Test.csproj +++ b/src/Test/Test.csproj @@ -64,6 +64,8 @@ + + diff --git a/src/libse/AudioToText/WhisperCppModel.cs b/src/libse/AudioToText/WhisperCppModel.cs index 54d960df8..6fa2d6e64 100644 --- a/src/libse/AudioToText/WhisperCppModel.cs +++ b/src/libse/AudioToText/WhisperCppModel.cs @@ -39,55 +39,55 @@ namespace Nikse.SubtitleEdit.Core.AudioToText { Name = "tiny.en", Size = "74 MB", - Urls = new []{ "https://huggingface.co/datasets/ggerganov/whisper.cpp/resolve/main/ggml-tiny.en.bin" }, + Urls = new []{ "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.en.bin" }, }, new WhisperModel { Name = "tiny", Size = "74 MB", - Urls = new []{ "https://huggingface.co/datasets/ggerganov/whisper.cpp/resolve/main/ggml-tiny.bin" }, + Urls = new []{ "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.bin" }, }, new WhisperModel { Name = "base.en", Size = "141 MB", - Urls = new []{ "https://huggingface.co/datasets/ggerganov/whisper.cpp/resolve/main/ggml-base.en.bin" }, + Urls = new []{ "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.en.bin" }, }, new WhisperModel { Name = "base", Size = "141 MB", - Urls = new []{ "https://huggingface.co/datasets/ggerganov/whisper.cpp/resolve/main/ggml-base.bin" }, + Urls = new []{ "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.bin" }, }, new WhisperModel { Name = "small.en", Size = "465 MB", - Urls = new []{ "https://huggingface.co/datasets/ggerganov/whisper.cpp/resolve/main/ggml-small.en.bin" }, + Urls = new []{ "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.en.bin" }, }, new WhisperModel { Name = "small", Size = "465 MB", - Urls = new []{ "https://huggingface.co/datasets/ggerganov/whisper.cpp/resolve/main/ggml-small.bin" }, + Urls = new []{ "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin" }, }, new WhisperModel { Name = "medium.en", Size = "1.42 GB", - Urls = new []{ "https://huggingface.co/datasets/ggerganov/whisper.cpp/resolve/main/ggml-medium.en.bin" }, + Urls = new []{ "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-medium.en.bin" }, }, new WhisperModel { Name = "medium", Size = "1.42 GB", - Urls = new []{ "https://huggingface.co/datasets/ggerganov/whisper.cpp/resolve/main/ggml-medium.bin" }, + Urls = new []{ "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-medium.bin" }, }, new WhisperModel { Name = "large", Size = "2.88 GB", - Urls = new []{ "https://huggingface.co/datasets/ggerganov/whisper.cpp/resolve/main/ggml-large.bin" }, + Urls = new []{ "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large.bin" }, }, }; } diff --git a/src/libse/Common/Configuration.cs b/src/libse/Common/Configuration.cs index 298c79791..7cfca107d 100644 --- a/src/libse/Common/Configuration.cs +++ b/src/libse/Common/Configuration.cs @@ -25,7 +25,7 @@ namespace Nikse.SubtitleEdit.Core.Common public static readonly string TimeCodesDirectory = DataDirectory + "TimeCodes" + Path.DirectorySeparatorChar; public static readonly string AutoBackupDirectory = DataDirectory + "AutoBackup" + Path.DirectorySeparatorChar; public static readonly string VobSubCompareDirectory = DataDirectory + "VobSub" + Path.DirectorySeparatorChar; - public static readonly string TesseractDirectory = DataDirectory + "Tesseract530" + Path.DirectorySeparatorChar; + public static readonly string TesseractDirectory = DataDirectory + "Tesseract531" + Path.DirectorySeparatorChar; public static readonly string Tesseract302Directory = DataDirectory + "Tesseract302" + Path.DirectorySeparatorChar; public static readonly string WaveformsDirectory = DataDirectory + "Waveforms" + Path.DirectorySeparatorChar; public static readonly string PluginsDirectory = DataDirectory + "Plugins"; diff --git a/src/libse/Common/HtmlUtil.cs b/src/libse/Common/HtmlUtil.cs index 6bda898ad..f0f725fe7 100644 --- a/src/libse/Common/HtmlUtil.cs +++ b/src/libse/Common/HtmlUtil.cs @@ -409,6 +409,18 @@ namespace Nikse.SubtitleEdit.Core.Common } } + // v tag from WebVTT + var indexOfCTag = s.IndexOf("= 0) + { + var indexOfEndVTag = s.IndexOf('>', indexOfCTag); + if (indexOfEndVTag >= 0) + { + s = s.Remove(indexOfCTag, indexOfEndVTag - indexOfCTag + 1); + s = s.Replace("", string.Empty); + } + } + return RemoveCommonHtmlTags(s); } diff --git a/src/libse/Common/MergeLinesSameTextUtils.cs b/src/libse/Common/MergeLinesSameTextUtils.cs index 24e060406..a84c1545f 100644 --- a/src/libse/Common/MergeLinesSameTextUtils.cs +++ b/src/libse/Common/MergeLinesSameTextUtils.cs @@ -50,10 +50,6 @@ namespace Nikse.SubtitleEdit.Core.Common mergedIndexes.Add(i - 1); } } - else - { - break; - } } } diff --git a/src/libse/Common/Settings.cs b/src/libse/Common/Settings.cs index a84b39b4d..efc557a16 100644 --- a/src/libse/Common/Settings.cs +++ b/src/libse/Common/Settings.cs @@ -241,6 +241,7 @@ namespace Nikse.SubtitleEdit.Core.Common public bool BatchConvertTsOnlyTeletext { get; set; } public string BatchConvertMkvLanguageCodeStyle { get; set; } public string BatchConvertOcrEngine { get; set; } + public string BatchConvertOcrLanguage { get; set; } public string WaveformBatchLastFolder { get; set; } public string ModifySelectionText { get; set; } public string ModifySelectionRule { get; set; } @@ -440,6 +441,7 @@ namespace Nikse.SubtitleEdit.Core.Common public string WhisperStableTsLocation { get; set; } public string WhisperCppModelLocation { get; set; } public string WhisperExtraSettings { get; set; } + public string WhisperExtraSettingsHistory { get; set; } public bool WhisperAutoAdjustTimings { get; set; } public bool WhisperUseLineMaxChars { get; set; } public int AudioToTextLineMaxChars { get; set; } @@ -513,6 +515,7 @@ namespace Nikse.SubtitleEdit.Core.Common BatchConvertTsScreenWidth = 1920; BatchConvertTsScreenHeight = 1080; BatchConvertOcrEngine = "Tesseract"; + BatchConvertOcrLanguage = "en"; BatchConvertTsOverrideHAlign = "center"; // left center right BatchConvertTsOverrideHMargin = 5; // pct BatchConvertTsFileNameAppend = ".{two-letter-country-code}"; @@ -1412,7 +1415,6 @@ $HorzAlign = Center public string MpvVideoVf { get; set; } public string MpvVideoAf { get; set; } public string MpvExtraOptions { get; set; } - public string MpvAllowNativePreview { get; set; } public bool MpvLogging { get; set; } public bool MpvHandlesPreviewText { get; set; } public Color MpvPreviewTextPrimaryColor { get; set; } @@ -1611,7 +1613,6 @@ $HorzAlign = Center MpvPreviewTextOpaqueBoxStyle = "1"; MpvPreviewTextAlignment = "2"; MpvPreviewTextMarginVertical = 10; - MpvAllowNativePreview = "WebVTT;WebVTT File with#"; FFmpegSceneThreshold = "0.4"; // threshold for generating shot changes - 0.2 is sensitive (more shot changes), 0.6 is less sensitive (fewer shot changes) UseTimeFormatHHMMSSFF = false; SplitBehavior = 1; // 0=take gap from left, 1=divide evenly, 2=take gap from right @@ -2413,6 +2414,7 @@ $HorzAlign = Center public string MainVideoToggleContrast { get; set; } public string MainVideoAudioToTextVosk { get; set; } public string MainVideoAudioToTextWhisper { get; set; } + public string MainVideoAudioExtractAudioSelectedLines { get; set; } // spell check public string MainSpellCheck { get; set; } @@ -4347,12 +4349,6 @@ $HorzAlign = Center settings.General.MpvExtraOptions = subNode.InnerText.Trim(); } - subNode = node.SelectSingleNode("MpvAllowNativePreview"); - if (subNode != null) - { - settings.General.MpvAllowNativePreview = subNode.InnerText.Trim(); - } - subNode = node.SelectSingleNode("MpvLogging"); if (subNode != null) { @@ -4418,6 +4414,7 @@ $HorzAlign = Center { settings.General.MpvPreviewTextMarginVertical = Convert.ToInt32(subNode.InnerText.Trim()); } + subNode = node.SelectSingleNode("MpcHcLocation"); if (subNode != null) { @@ -5503,6 +5500,12 @@ $HorzAlign = Center settings.Tools.BatchConvertOcrEngine = subNode.InnerText; } + subNode = node.SelectSingleNode("BatchConvertOcrLanguage"); + if (subNode != null) + { + settings.Tools.BatchConvertOcrLanguage = subNode.InnerText; + } + subNode = node.SelectSingleNode("WaveformBatchLastFolder"); if (subNode != null) { @@ -6651,6 +6654,12 @@ $HorzAlign = Center settings.Tools.WhisperExtraSettings = subNode.InnerText; } + subNode = node.SelectSingleNode("WhisperExtraSettingsHistory"); + if (subNode != null) + { + settings.Tools.WhisperExtraSettingsHistory = subNode.InnerText; + } + subNode = node.SelectSingleNode("WhisperLanguageCode"); if (subNode != null) { @@ -9491,6 +9500,12 @@ $HorzAlign = Center shortcuts.MainVideoAudioToTextWhisper = subNode.InnerText; } + subNode = node.SelectSingleNode("MainVideoAudioExtractAudioSelectedLines"); + if (subNode != null) + { + shortcuts.MainVideoAudioExtractAudioSelectedLines= subNode.InnerText; + } + subNode = node.SelectSingleNode("MainSpellCheck"); if (subNode != null) { @@ -10866,7 +10881,6 @@ $HorzAlign = Center textWriter.WriteElementString("MpvVideoVf", settings.General.MpvVideoVf); textWriter.WriteElementString("MpvVideoAf", settings.General.MpvVideoAf); textWriter.WriteElementString("MpvExtraOptions", settings.General.MpvExtraOptions); - textWriter.WriteElementString("MpvAllowNativePreview", settings.General.MpvAllowNativePreview); textWriter.WriteElementString("MpvLogging", settings.General.MpvLogging.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("MpvHandlesPreviewText", settings.General.MpvHandlesPreviewText.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("MpvPreviewTextPrimaryColor", ColorTranslator.ToHtml(settings.General.MpvPreviewTextPrimaryColor)); @@ -11072,6 +11086,7 @@ $HorzAlign = Center textWriter.WriteElementString("BatchConvertTsFileNameAppend", settings.Tools.BatchConvertTsFileNameAppend); textWriter.WriteElementString("BatchConvertMkvLanguageCodeStyle", settings.Tools.BatchConvertMkvLanguageCodeStyle); textWriter.WriteElementString("BatchConvertOcrEngine", settings.Tools.BatchConvertOcrEngine); + textWriter.WriteElementString("BatchConvertOcrLanguage", settings.Tools.BatchConvertOcrLanguage); textWriter.WriteElementString("WaveformBatchLastFolder", settings.Tools.WaveformBatchLastFolder); textWriter.WriteElementString("ModifySelectionRule", settings.Tools.ModifySelectionRule); textWriter.WriteElementString("ModifySelectionText", settings.Tools.ModifySelectionText); @@ -11262,6 +11277,7 @@ $HorzAlign = Center textWriter.WriteElementString("WhisperStableTsLocation", settings.Tools.WhisperStableTsLocation); textWriter.WriteElementString("WhisperCppModelLocation", settings.Tools.WhisperCppModelLocation); textWriter.WriteElementString("WhisperExtraSettings", settings.Tools.WhisperExtraSettings); + textWriter.WriteElementString("WhisperExtraSettingsHistory", settings.Tools.WhisperExtraSettingsHistory); textWriter.WriteElementString("WhisperLanguageCode", settings.Tools.WhisperLanguageCode); textWriter.WriteElementString("WhisperAutoAdjustTimings", settings.Tools.WhisperAutoAdjustTimings.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("WhisperUseLineMaxChars", settings.Tools.WhisperUseLineMaxChars.ToString(CultureInfo.InvariantCulture)); @@ -11912,6 +11928,7 @@ $HorzAlign = Center textWriter.WriteElementString("MainVideoToggleContrast", shortcuts.MainVideoToggleContrast); textWriter.WriteElementString("MainVideoAudioToTextVosk", shortcuts.MainVideoAudioToTextVosk); textWriter.WriteElementString("MainVideoAudioToTextWhisper", shortcuts.MainVideoAudioToTextWhisper); + textWriter.WriteElementString("MainVideoAudioExtractAudioSelectedLines", shortcuts.MainVideoAudioExtractAudioSelectedLines); textWriter.WriteElementString("MainSpellCheck", shortcuts.MainSpellCheck); textWriter.WriteElementString("MainSpellCheckFindDoubleWords", shortcuts.MainSpellCheckFindDoubleWords); textWriter.WriteElementString("MainSpellCheckAddWordToNames", shortcuts.MainSpellCheckAddWordToNames); diff --git a/src/libse/Common/WebVttHelper.cs b/src/libse/Common/WebVttHelper.cs new file mode 100644 index 000000000..478c9a3fe --- /dev/null +++ b/src/libse/Common/WebVttHelper.cs @@ -0,0 +1,600 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Xml.Linq; + +namespace Nikse.SubtitleEdit.Core.Common +{ + public static class WebVttHelper + { + private static readonly Regex NameRegex = new Regex("\\([\\.a-zA-Z\\d#_-]+\\)", RegexOptions.Compiled); + private static readonly Regex PropertiesRegex = new Regex("{[ \\.a-zA-Z\\d:#\\s,_;:\\-\\(\\)]+}", RegexOptions.Compiled); + + public static List GetStyles(string header) + { + if (string.IsNullOrEmpty(header)) + { + return new List(); + } + + var cueOn = false; + var styleOn = false; + var result = new List(); + var currentStyle = new StringBuilder(); + foreach (var line in header.SplitToLines()) + { + var s = line.Trim(); + if (styleOn) + { + if (s == string.Empty) + { + styleOn = false; + AddStyle(result, currentStyle); + currentStyle = new StringBuilder(); + } + else + { + if (cueOn && s.StartsWith("::cue(", StringComparison.Ordinal)) + { + AddStyle(result, currentStyle); + currentStyle = new StringBuilder(); + } + + if (s.StartsWith("::cue(", StringComparison.Ordinal)) + { + currentStyle.AppendLine(s); + cueOn = true; + } + else if (cueOn) + { + currentStyle.AppendLine(s); + } + } + } + else if (s.Equals("STYLE", StringComparison.OrdinalIgnoreCase)) + { + styleOn = true; + } + } + + AddStyle(result, currentStyle); + + return result; + + // https://www.w3.org/TR/webvtt1/ + // STYLE + // ::cue { + // background-image: linear-gradient(to bottom, dimgray, lightgray); + // color: papayawhip; + // } + + // STYLE + // ::cue(b) { + // color: peachpuff; + // } + } + + private static void AddStyle(List result, StringBuilder currentStyle) + { + var text = currentStyle + .ToString() + .Replace(Environment.NewLine, " "); + var match = NameRegex.Match(text); + if (!match.Success) + { + return; + } + + var name = match.Value.Trim('(', ')', ' '); + + match = PropertiesRegex.Match(text); + if (!match.Success || string.IsNullOrWhiteSpace(match.Value)) + { + return; + } + + var properties = match.Value + .Trim('{', '}', ' ') + .RemoveChar('\r', '\n') + .Split(';'); + + var webVttStyle = new WebVttStyle { Name = name }; + foreach (var prop in properties) + { + SetProperty(webVttStyle, prop); + } + + result.Add(webVttStyle); + } + + private static void SetProperty(WebVttStyle webVttStyle, string prop) + { + var arr = prop.Split(':'); + if (arr.Length != 2) + { + return; + } + + var name = arr[0].Trim(); + var value = arr[1].Trim(); + + if (string.IsNullOrEmpty(value)) + { + return; + } + + if (name == "color") + { + SetColor(webVttStyle, value); + } + else if (name == "background-color") + { + SetBackgroundColor(webVttStyle, value); + } + else if (name == "font-family") + { + webVttStyle.FontName = value; + } + else if (name == "font-style") + { + SetFontStyle(webVttStyle, value); + } + else if (name == "font-weight") + { + SetFontWeight(webVttStyle, value); + } + else if (name == "text-shadow") + { + SetTextShadow(webVttStyle, value); + } + else if (name == "text-decoration") + { + SetTextDecoration(webVttStyle, value); + } + } + + private static void SetColor(WebVttStyle webVttStyle, string value) + { + var color = GetColorFromString(value); + if (!color.HasValue) + { + return; + } + + webVttStyle.Color = color; + } + + private static Color? GetColorFromString(string s) + { + try + { + if (s.StartsWith("rgb(", StringComparison.OrdinalIgnoreCase)) + { + var arr = s + .RemoveChar(' ') + .Remove(0, 4) + .TrimEnd(')') + .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + + return Color.FromArgb(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2])); + } + + if (s.StartsWith("rgba(", StringComparison.OrdinalIgnoreCase)) + { + var arr = s + .RemoveChar(' ') + .Remove(0, 5) + .TrimEnd(')') + .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + + var alpha = byte.MaxValue; + if (arr.Length == 4 && float.TryParse(arr[3], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var f)) + { + if (f >= 0 && f < 1) + { + alpha = (byte)(f * byte.MaxValue); + } + } + + return Color.FromArgb(alpha, int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2])); + } + + return ColorTranslator.FromHtml(s); + } + catch + { + return null; + } + } + + private static void SetBackgroundColor(WebVttStyle webVttStyle, string value) + { + var color = GetColorFromString(value); + if (!color.HasValue) + { + return; + } + + webVttStyle.BackgroundColor = color; + } + + private static void SetFontWeight(WebVttStyle webVttStyle, string value) + { + if (value == "bold" || value == "bolder") + { + webVttStyle.Bold = true; + } + else if (value == "normal") + { + webVttStyle.Bold = false; + } + } + + private static void SetFontStyle(WebVttStyle webVttStyle, string value) + { + if (value == "italic" || value == "oblique") + { + webVttStyle.Italic = true; + } + else if (value == "normal") + { + webVttStyle.Italic = false; + } + } + + private static void SetTextDecoration(WebVttStyle webVttStyle, string value) + { + if (value == "underline") + { + webVttStyle.Underline = true; + } + else if (value == "line-through") + { + webVttStyle.StrikeThrough = true; + } + } + + private static void SetTextShadow(WebVttStyle webVttStyle, string value) + { + // text-shadow: #101010 3px; + + var arr = value.Split(); + if (arr.Length != 2) + { + return; + } + + var color = GetColorFromString(arr[0]); + if (!color.HasValue) + { + return; + } + + if (int.TryParse(arr[1].Replace("px", string.Empty), out var number)) + { + webVttStyle.ShadowColor = color; + webVttStyle.ShadowWidth = number; + } + } + + public static WebVttStyle AddStyleFromColor(Color color) + { + return new WebVttStyle + { + Name = "." + Utilities.ColorToHexWithTransparency(color).TrimStart('#'), + Color = color, + }; + } + + public static string AddStyleToHeader(string header, WebVttStyle style) + { + var rawStyle = "::cue(." + style.Name.RemoveChar('.') + ") { " + GetCssProperties(style) + " }"; + + if (string.IsNullOrEmpty(header)) + { + return "WEBVTT" + Environment.NewLine + Environment.NewLine + "STYLE" + Environment.NewLine + rawStyle; + } + + if (header.Contains("::cue(." + style.Name.RemoveChar('.') + ")")) + { + return header; + } + + var sb = new StringBuilder(); + var styleFound = false; + foreach (var line in header.SplitToLines()) + { + sb.AppendLine(line); + if (line.Trim() == "STYLE" && !styleFound) + { + sb.AppendLine(rawStyle); + styleFound = true; + } + } + + if (!styleFound) + { + sb.AppendLine(); + sb.AppendLine("STYLE"); + sb.AppendLine(rawStyle); + } + + return sb.ToString(); + } + + public static string GetCssProperties(WebVttStyle style) + { + var sb = new StringBuilder(); + + if (style.Color != null) + { + if (style.Color.Value.A == byte.MaxValue) + { + sb.Append($"color:rgb({style.Color.Value.R},{style.Color.Value.G},{style.Color.Value.B}); "); + } + else + { + sb.Append($"color:rgba({style.Color.Value.R},{style.Color.Value.G},{style.Color.Value.B},{(style.Color.Value.A / 255.0).ToString(CultureInfo.InvariantCulture)}); "); + } + } + + if (style.BackgroundColor != null) + { + if (style.BackgroundColor.Value.A == byte.MaxValue) + { + sb.Append($"background-color:rgb({style.BackgroundColor.Value.R},{style.BackgroundColor.Value.G},{style.BackgroundColor.Value.B}); "); + } + else + { + sb.Append($"background-color:rgba({style.BackgroundColor.Value.R},{style.BackgroundColor.Value.G},{style.BackgroundColor.Value.B},{(style.BackgroundColor.Value.A / 255.0).ToString(CultureInfo.InvariantCulture)}); "); + } + } + + if (style.Italic != null && style.Italic.Value) + { + sb.Append("font-style:italic; "); + } + + if (style.Bold != null && style.Bold.Value) + { + sb.Append("font-weight:bold; "); + } + + if (style.Underline != null && style.Underline.Value) + { + sb.Append("text-decoration:underline; "); + } + + if (style.StrikeThrough != null && style.StrikeThrough.Value) + { + sb.Append("text-decoration:line-through; "); + } + + if (!string.IsNullOrEmpty(style.FontName)) + { + sb.Append($"font-family:{style.FontName}; "); + } + + if (style.FontSize.HasValue && style.FontSize > 0) + { + sb.Append($"font-size:{style.FontSize}px; "); + } + + if (style.ShadowColor.HasValue && style.ShadowWidth.HasValue && style.ShadowWidth > 0) + { + var colorString = Utilities.ColorToHexWithTransparency(style.ShadowColor.Value); + var widthString = "{style.ShadowWidth.Value.ToString(CultureInfo.InvariantCulture)} px"; + sb.Append($"text-shadow: {colorString} {widthString}"); + } + + return sb.ToString().TrimEnd(' ', ';'); + } + + public static string RemoveColorTag(string input, Color color, List webVttStyles) + { + if (webVttStyles == null) + { + return input; + } + + var style = webVttStyles.FirstOrDefault(p => p.Color == color && + p.Italic == null && + p.Bold == null); + if (style == null) + { + return input; + } + + var text = input; + text = text.Replace("." + style.Name.TrimStart('.') + ".", "."); + text = text.Replace("." + style.Name.TrimStart('.') + ">", ">"); + + var idx = text.IndexOf("", StringComparison.Ordinal); + if (idx >= 0) + { + var endIdx = text.IndexOf("", idx); + if (endIdx > 0) + { + text = text.Remove(endIdx, 4); + text = text.Remove(idx, 3); + } + } + + return text; + } + + public static string AddStyleToText(string input, WebVttStyle style, List webVttStyles) + { + var text = input; + if (text.Contains("")) + { + var regex = new Regex(@""); + var match = regex.Match(text); + if (match.Success) + { + text = RemoveUnusedColorStylesFromText(text, webVttStyles); + text = text.Insert(match.Index + match.Length - 1, "." + style.Name.TrimStart('.')); + } + } + } + else + { + text = "" + text + ""; + } + + return text; + } + + public static List GetParagraphStyles(Paragraph paragraph) + { + var list = new List(); + if (paragraph == null || string.IsNullOrEmpty(paragraph.Text)) + { + return list; + } + + var regex = new Regex(@""); + foreach (Match match in regex.Matches(paragraph.Text)) + { + var styles = match.Value.Remove(0, 3).Trim('>', ' ').Split('.'); + foreach (var styleName in styles) + { + if (!string.IsNullOrEmpty(styleName) && !list.Contains(styleName)) + { + list.Add("." + styleName); + } + } + } + + return list; + } + + public static string SetParagraphStyles(Paragraph p, List styles) + { + if (string.IsNullOrEmpty(p.Text) || + !p.Text.Contains(""); + var match = regex.Match(text); + while (match.Success) + { + text = text.Remove(match.Index, match.Value.Length); + match = regex.Match(text); + } + + text = text.Replace("", string.Empty); + + if (styles.Count == 0) + { + return text; + } + + var prefix = " s.Name)) + ">"; + + return prefix + text + ""; + } + + public static string RemoveUnusedColorStylesFromText(string input, string header) + { + if (string.IsNullOrEmpty(header) || !header.Contains("WEBVTT")) + { + return input; + } + + var styles = GetStyles(header); + if (styles.Count <= 1) + { + return input; + } + + return RemoveUnusedColorStylesFromText(input, styles); + } + + public static string RemoveUnusedColorStylesFromText(string input, List styles) + { + var regex = new Regex(@""); + var match = regex.Match(input); + if (!match.Success) + { + return input; + } + + var text = input; + var styleNames = match.Value.Remove(0, 3).Trim('>').Split('.'); + var colorsOnly = new List(); + foreach (var styleName in styleNames) + { + var style = styles.FirstOrDefault(p => p.Name == "." + styleName); + if (style != null && + style.Color.HasValue && + style.Bold == null && + style.Italic == null && + style.FontName == null && + style.FontSize == null && + style.ShadowColor == null && + style.BackgroundColor == null && + style.Underline == null && + style.StrikeThrough == null && + style.StrikeThrough == null) + { + colorsOnly.Add(styleName); + } + } + + while (colorsOnly.Count > 1) + { + var name = colorsOnly[0]; + text = text.Replace("." + name + ".", "."); + text = text.Replace("." + name + ">", ">"); + colorsOnly.RemoveAt(0); + } + + return text; + } + + public static WebVttStyle GetOnlyColorStyle(Color color, string header) + { + if (string.IsNullOrEmpty(header) || !header.Contains("WEBVTT")) + { + return null; + } + + var styles = GetStyles(header); + if (styles.Count <= 1) + { + return null; + } + + foreach (var style in styles) + { + if (style != null && + style.Color.HasValue && + style.Bold == null && + style.Italic == null && + style.FontName == null && + style.FontSize == null && + style.ShadowColor == null && + style.BackgroundColor == null && + style.Underline == null && + style.StrikeThrough == null && + style.StrikeThrough == null && + style.Color == color) + { + return style; + } + } + + return null; + } + } +} diff --git a/src/libse/Common/WebVttStyle.cs b/src/libse/Common/WebVttStyle.cs new file mode 100644 index 000000000..28e428db9 --- /dev/null +++ b/src/libse/Common/WebVttStyle.cs @@ -0,0 +1,47 @@ +using System.Drawing; + +namespace Nikse.SubtitleEdit.Core.Common +{ + public class WebVttStyle + { + public string Name { get; set; } + public string FontName { get; set; } + public decimal? FontSize { get; set; } + public Color? Color { get; set; } + public Color? BackgroundColor { get; set; } + public bool? Italic { get; set; } + public bool? Bold { get; set; } + public bool? Underline { get; set; } + public bool? StrikeThrough { get; set; } + public decimal? ShadowWidth { get; set; } + public Color? ShadowColor { get; set; } + + public WebVttStyle() + { + + } + + public WebVttStyle(WebVttStyle style) + { + Name = style.Name; + FontName = style.FontName; + FontSize = style.FontSize; + Color = style.Color; + BackgroundColor = style.BackgroundColor; + Bold = style.Bold; + Underline = style.Underline; + StrikeThrough = style.StrikeThrough; + ShadowWidth = style.ShadowWidth; + ShadowColor = style.ShadowColor; + Underline = style.Underline; + ShadowWidth = style.ShadowWidth; + StrikeThrough = style.StrikeThrough; + ShadowWidth = style.ShadowWidth; + } + + public override string ToString() + { + return WebVttHelper.GetCssProperties(this); + } + } +} \ No newline at end of file diff --git a/src/libse/Common/WebVttToAssa.cs b/src/libse/Common/WebVttToAssa.cs new file mode 100644 index 000000000..0cebc999b --- /dev/null +++ b/src/libse/Common/WebVttToAssa.cs @@ -0,0 +1,453 @@ +using Nikse.SubtitleEdit.Core.SubtitleFormats; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; + +namespace Nikse.SubtitleEdit.Core.Common +{ + public static class WebVttToAssa + { + private static readonly Regex LineTagRegex = new Regex("", RegexOptions.Compiled); + private static readonly Regex LineTagRegexMore = new Regex(@"", RegexOptions.Compiled); + + public static Subtitle Convert(Subtitle webVttSubtitle, SsaStyle defaultStyle, int videoWidth, int videoHeight) + { + var vttStyles = WebVttHelper.GetStyles(webVttSubtitle.Header); + var ssaStyles = ConvertStyles(vttStyles, defaultStyle); + var header = AdvancedSubStationAlpha.GetHeaderAndStylesFromAdvancedSubStationAlpha(AdvancedSubStationAlpha.DefaultHeader, ssaStyles); + var assaSubtitle = ConvertSubtitle(webVttSubtitle, header, ssaStyles, vttStyles, videoWidth, videoHeight); + return assaSubtitle; + } + + private static Subtitle ConvertSubtitle(Subtitle webVttSubtitle, string header, List ssaStyles, List webVttStyles, int width, int height) + { + var assaSubtitle = new Subtitle(webVttSubtitle) { Header = header }; + + if (width > 0 && height > 0) + { + assaSubtitle.Header = AdvancedSubStationAlpha.AddTagToHeader("PlayResX", "PlayResX: " + width.ToString(CultureInfo.InvariantCulture), "[Script Info]", assaSubtitle.Header); + assaSubtitle.Header = AdvancedSubStationAlpha.AddTagToHeader("PlayResY", "PlayResY: " + height.ToString(CultureInfo.InvariantCulture), "[Script Info]", assaSubtitle.Header); + } + + var styles = AdvancedSubStationAlpha.GetSsaStylesFromHeader(assaSubtitle.Header); + foreach (var style in styles) + { + if (style.FontSize <= 25 && width > 0 && height > 0) + { + const int defaultAssaHeight = 288; + style.FontSize = AssaResampler.Resample(defaultAssaHeight, height, style.FontSize); + } + } + assaSubtitle.Header = AdvancedSubStationAlpha.GetHeaderAndStylesFromAdvancedSubStationAlpha(assaSubtitle.Header, styles); + + var layer = 0; + foreach (var paragraph in assaSubtitle.Paragraphs) + { + paragraph.Layer = layer; + paragraph.Extra = "Default"; + layer++; + + if (!paragraph.Text.Contains('<')) + { + paragraph.Text = GetAlignment(paragraph, width, height); + continue; + } + + paragraph.Text = paragraph.Text + .Replace("", "{\\i1}") + .Replace("", "{\\i0}") + .Replace("", "{\\b1}") + .Replace("", "{\\b0}") + .Replace("", "{\\u1}") + .Replace("", "{\\u0}").Trim(); + + + if (!paragraph.Text.Contains('<')) + { + paragraph.Text = GetAlignment(paragraph, width, height); + continue; + } + + var matches = LineTagRegex.Matches(paragraph.Text); + if (matches.Count == 1 && + paragraph.Text.StartsWith("", StringComparison.Ordinal)) + { + var tag = matches[0].Value.TrimEnd('>', ' ').Remove(0, 2); + if (ssaStyles.Any(p => p.Name == tag)) + { + paragraph.Extra = tag; + paragraph.Text = paragraph.Text.Remove(matches[0].Index, matches[0].Length); + paragraph.Text = paragraph.Text.Replace("", string.Empty); + continue; + } + } + + paragraph.Text = SetInlineStyles(paragraph.Text, ssaStyles, webVttStyles); + + paragraph.Text = GetAlignment(paragraph, width, height); + } + + return assaSubtitle; + } + + private static string GetAlignment(Paragraph paragraph, int width, int height) + { + if (string.IsNullOrEmpty(paragraph.Extra) || paragraph.Text.StartsWith("{\\an")) + { + return paragraph.Text; + } + + return GetPositionInfo(paragraph.Style, width, height) + paragraph.Text; + } + + internal static string GetPositionInfo(string s, int width, int height) + { + if (width <= 0 || height <= 0) + { + return string.Empty; + } + + //position: x --- 0% = left, 100% = right (horizontal) + //line: x --- 0 or -16 or 0% = top, 16 or -1 or 100% = bottom (vertical) + var x = 0; + var y = 0; + var pos = GetTag(s, "position:"); + var line = GetTag(s, "line:"); + var positionInfo = string.Empty; + var hAlignLeft = false; + var hAlignRight = false; + var vAlignTop = false; + var vAlignMiddle = false; + double number; + + if (!string.IsNullOrEmpty(pos) && pos.EndsWith('%') && double.TryParse(pos.TrimEnd('%'), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out number)) + { + x = (int)Math.Round(number * width / 100.0, MidpointRounding.AwayFromZero); + } + + if (!string.IsNullOrEmpty(line)) + { + line = line.Trim(); + if (line.EndsWith('%')) + { + if (double.TryParse(line.TrimEnd('%'), NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out number)) + { + y = (int)Math.Round(number * height / 100.0, MidpointRounding.AwayFromZero); + if (number < 25) + { + vAlignTop = true; + } + else if (number < 75) + { + vAlignMiddle = true; + } + } + } + else + { + if (double.TryParse(line, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out number)) + { + if (number >= 0 && number <= 7) + { + vAlignTop = true; // Positive numbers indicate top down + } + else if (number > 7 && number < 11) + { + vAlignMiddle = true; + } + } + } + } + + if (x > 0 && y > 0) + { + return "{\\pos(" + x + "," + y + ")}"; + } + + if (hAlignLeft) + { + if (vAlignTop) + { + return "{\\an7}"; + } + + if (vAlignMiddle) + { + return "{\\an4}"; + } + + return "{\\an1}"; + } + + if (hAlignRight) + { + if (vAlignTop) + { + return "{\\an9}"; + } + + if (vAlignMiddle) + { + return "{\\an6}"; + } + + return "{\\an3}"; + } + + if (vAlignTop) + { + return "{\\an8}"; + } + + if (vAlignMiddle) + { + return "{\\an5}"; + } + + return positionInfo; + } + + private static string GetTag(string s, string tag) + { + if (string.IsNullOrEmpty(s) || string.IsNullOrEmpty(tag)) + { + return null; + } + + var pos = s.IndexOf(tag, StringComparison.Ordinal); + if (pos >= 0) + { + var v = s.Substring(pos + tag.Length).Trim(); + var end = v.IndexOf("%,", StringComparison.Ordinal); + if (end >= 0) + { + v = v.Remove(end + 1); + } + + end = v.IndexOf(' '); + if (end >= 0) + { + v = v.Remove(end); + } + + return v; + } + + return null; + } + + private static string SetInlineStyles(string input, List ssaStyles, List webVttStyles) + { + var allInlineStyles = new List(); + var start = 0; + var sb = new StringBuilder(); + var webVttStyle = new WebVttStyle(); + var text = input; + var match = LineTagRegexMore.Match(text); + while (match.Success) + { + if (match.Value == "") + { + if (match.Index > start) + { + var s = text.Substring(start, Math.Min(text.Length - start, match.Index)); + sb.Append(s); + start = match.Index; + + if (allInlineStyles.Count > 0) + { + allInlineStyles.RemoveAt(allInlineStyles.Count - 1); + + webVttStyle = new WebVttStyle(); + foreach (var style in allInlineStyles) + { + webVttStyle = ApplyStyle(style, webVttStyle); + } + } + } + } + else if (match.Value.StartsWith("').Split('.'); + foreach (var styleName in arr) + { + var styleFound = webVttStyles.FirstOrDefault(p => p.Name == "." + styleName); + if (styleFound != null) + { + webVttStyle = ApplyStyle(styleFound, webVttStyle); + } + else if (styleName == "i") + { + webVttStyle.Italic = true; + } + else if (styleName == "b") + { + webVttStyle.Bold = true; + } + else if (styleName == "u") + { + webVttStyle.Underline = true; + } + else if (WebVTT.DefaultColorClasses.TryGetValue(styleName, out var c)) + { + webVttStyle.Color = c; + } + } + + allInlineStyles.Add(webVttStyle); + sb.Append(WebVttToAssaInline(webVttStyle)); + } + + text = text.Remove(match.Index, match.Length); + match = LineTagRegexMore.Match(text); + } + + if (text.Length > start) + { + sb.Append(text.Substring(start)); + } + + return sb.ToString(); + } + + private static string WebVttToAssaInline(WebVttStyle webVttStyle) + { + var sb = new StringBuilder(); + sb.Append("{"); + + if (webVttStyle.Color != null) + { + sb.Append("\\" + AdvancedSubStationAlpha.GetSsaColorStringForEvent(webVttStyle.Color.Value)); + } + + if (webVttStyle.BackgroundColor != null) + { + sb.Append("\\" + AdvancedSubStationAlpha.GetSsaColorStringForEvent(webVttStyle.BackgroundColor.Value, "3c")); + } + + if (webVttStyle.ShadowColor != null) + { + sb.Append("\\" + AdvancedSubStationAlpha.GetSsaColorStringForEvent(webVttStyle.ShadowColor.Value, "4c")); + } + + if (webVttStyle.ShadowWidth != null) + { + sb.Append("\\shad" + webVttStyle.ShadowWidth.Value.ToString(CultureInfo.InvariantCulture)); + } + + if (webVttStyle.FontName != null) + { + sb.Append($"\\fn{webVttStyle.FontName}"); + } + + if (webVttStyle.FontSize != null) + { + sb.Append($"\\fs{webVttStyle.FontSize}"); + } + + if (webVttStyle.Italic != null && webVttStyle.Italic == true) + { + sb.Append("\\i1"); + } + + if (webVttStyle.Italic != null && webVttStyle.Italic == false) + { + sb.Append("\\i0"); + } + + if (webVttStyle.Bold != null && webVttStyle.Bold == true) + { + sb.Append("\\b1"); + } + + if (webVttStyle.Bold != null && webVttStyle.Bold == false) + { + sb.Append("\\b0"); + } + + if (webVttStyle.Underline != null && webVttStyle.Underline == true) + { + sb.Append("\\u1"); + } + + if (webVttStyle.Underline != null && webVttStyle.Underline == false) + { + sb.Append("\\u0"); + } + + if (webVttStyle.StrikeThrough != null && webVttStyle.StrikeThrough == true) + { + sb.Append("\\s1"); + } + + if (webVttStyle.StrikeThrough != null && webVttStyle.StrikeThrough == false) + { + sb.Append("\\s0"); + } + + sb.Append("}"); + + if (sb.Length > 2) + { + return sb.ToString(); + } + + return string.Empty; + } + + private static WebVttStyle ApplyStyle(WebVttStyle style, WebVttStyle defaultStyle) + { + return new WebVttStyle + { + BackgroundColor = style.BackgroundColor ?? defaultStyle.BackgroundColor, + Bold = style.Bold ?? defaultStyle.Bold, + Italic = style.Italic ?? defaultStyle.Italic, + Underline = style.Underline ?? defaultStyle.Underline, + FontName = style.FontName ?? defaultStyle.FontName, + FontSize = style.FontSize ?? defaultStyle.FontSize, + Color = style.Color ?? defaultStyle.Color, + ShadowColor = style.ShadowColor ?? defaultStyle.ShadowColor, + ShadowWidth = style.ShadowWidth ?? defaultStyle.ShadowWidth, + }; + } + + private static List ConvertStyles(List styles, SsaStyle defaultStyle) + { + var result = new List(); + defaultStyle.Name = "Default"; + result.Add(defaultStyle); + ; + foreach (var style in styles) + { + var newStyle = new SsaStyle + { + BorderStyle = "3", // box per line (background color is outline) + Name = style.Name, + FontName = style.FontName ?? defaultStyle.FontName, + FontSize = style.FontSize ?? defaultStyle.FontSize, + Primary = style.Color ?? defaultStyle.Primary, + Outline = style.BackgroundColor ?? defaultStyle.Outline, + Bold = style.Bold ?? defaultStyle.Bold, + Italic = style.Italic ?? defaultStyle.Italic, + Underline = style.Underline ?? defaultStyle.Underline, + Strikeout = style.StrikeThrough ?? defaultStyle.Strikeout, + ShadowWidth = style.ShadowWidth ?? defaultStyle.ShadowWidth, + Secondary = style.ShadowColor ?? defaultStyle.Secondary, + }; + + if (newStyle.Outline.A == 0 && style.BackgroundColor.HasValue) + { + newStyle.Background = newStyle.Outline; + } + + result.Add(newStyle); + } + + return result; + } + } +} diff --git a/src/libse/ContainerFormats/MaterialExchangeFormat/MxfParser.cs b/src/libse/ContainerFormats/MaterialExchangeFormat/MxfParser.cs index 8f981ad97..a54b2b94d 100644 --- a/src/libse/ContainerFormats/MaterialExchangeFormat/MxfParser.cs +++ b/src/libse/ContainerFormats/MaterialExchangeFormat/MxfParser.cs @@ -10,10 +10,11 @@ namespace Nikse.SubtitleEdit.Core.ContainerFormats.MaterialExchangeFormat public bool IsValid { get; private set; } private readonly List _subtitleList = new List(); - public List GetSubtitles() - { - return _subtitleList; - } + private readonly List _images = new List(); + + public List GetSubtitles() => _subtitleList; + + public List GetImages() => _images; private long _startPosition; @@ -49,8 +50,15 @@ namespace Nikse.SubtitleEdit.Core.ContainerFormats.MaterialExchangeFormat { stream.Seek(klv.DataPosition, SeekOrigin.Begin); var buffer = new byte[klv.DataSize]; - stream.Read(buffer, 0, buffer.Length); - if (buffer.Length >= 12) + var bytesRead = stream.Read(buffer, 0, buffer.Length); + + if (buffer[0] == 0x89 && buffer[1] == 0x50 && buffer[2] == 0x4E && buffer[3] == 0x47) // PNG header + { + _images.Add(buffer); + continue; + } + + if (buffer.Length >= 12 && bytesRead >= 12) { string s; if (buffer[0] == 0xef && buffer[1] == 0xbb && buffer[2] == 0xbf) @@ -88,7 +96,7 @@ namespace Nikse.SubtitleEdit.Core.ContainerFormats.MaterialExchangeFormat } } - private bool IsSubtitle(string s) + private static bool IsSubtitle(string s) { if (s.Contains("\0")) { @@ -115,7 +123,7 @@ namespace Nikse.SubtitleEdit.Core.ContainerFormats.MaterialExchangeFormat } _startPosition = 0; - for (int i = 0; i < count - 11; i++) + for (var i = 0; i < count - 11; i++) { //Header Partition PackId = 06 0E 2B 34 02 05 01 01 0D 01 02 if (buffer[i + 00] == 0x06 && // OID diff --git a/src/libse/Forms/RemoveInterjection.cs b/src/libse/Forms/RemoveInterjection.cs index 2b3f23e25..de83e4fc4 100644 --- a/src/libse/Forms/RemoveInterjection.cs +++ b/src/libse/Forms/RemoveInterjection.cs @@ -182,6 +182,26 @@ namespace Nikse.SubtitleEdit.Core.Forms temp = temp.Remove(subIndex, 2); removeAfter = false; } + else if (subTemp == " ¡!") + { + temp = temp.Remove(subIndex, 3); + removeAfter = false; + } + else if (subTemp == " ¿?") + { + temp = temp.Remove(subIndex, 3); + removeAfter = false; + } + else if (index == 1 && temp.StartsWith("¿?" + Environment.NewLine, StringComparison.Ordinal)) + { + temp = temp.Remove(0, 2).TrimEnd(); + removeAfter = false; + } + else if (index == 1 && temp.StartsWith("¡!" + Environment.NewLine, StringComparison.Ordinal)) + { + temp = temp.Remove(0, 2).TrimEnd(); + removeAfter = false; + } else { subTemp = temp.Substring(subIndex); @@ -237,6 +257,17 @@ namespace Nikse.SubtitleEdit.Core.Forms } } + if (index == 1 && temp.StartsWith("¿?")) + { + removeAfter = false; + temp = temp.Remove(0, 2); + } + else if (index == 1 && temp.StartsWith("¡!")) + { + removeAfter = false; + temp = temp.Remove(0, 2); + } + if (removeAfter) { if (index == 0) diff --git a/src/libse/SubtitleFormats/AdvancedSubStationAlpha.cs b/src/libse/SubtitleFormats/AdvancedSubStationAlpha.cs index 4e3d5cd29..b93abdb1f 100644 --- a/src/libse/SubtitleFormats/AdvancedSubStationAlpha.cs +++ b/src/libse/SubtitleFormats/AdvancedSubStationAlpha.cs @@ -140,6 +140,11 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text" else if (!string.IsNullOrEmpty(subtitle.Header) && subtitle.Header.Contains("[V4 Styles]")) { LoadStylesFromSubstationAlpha(subtitle, title, header, HeaderNoStyles, sb); + isValidAssHeader = !string.IsNullOrEmpty(subtitle.Header) && subtitle.Header.Contains("[V4+ Styles]"); + if (isValidAssHeader) + { + styles = GetStylesFromHeader(subtitle.Header); + } } else if (subtitle.Header != null && subtitle.Header.Contains("http://www.w3.org/ns/ttml")) { @@ -161,6 +166,15 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text" styles = GetStylesFromHeader(subtitle.Header); } } + else if (subtitle.Header != null && subtitle.Header.StartsWith("WEBVTT", StringComparison.Ordinal)) + { + subtitle = WebVttToAssa.Convert(subtitle, new SsaStyle(), 0, 0); + isValidAssHeader = !string.IsNullOrEmpty(subtitle.Header) && subtitle.Header.Contains("[V4+ Styles]"); + if (isValidAssHeader) + { + styles = GetStylesFromHeader(subtitle.Header); + } + } else { sb.AppendFormat(header, title).AppendLine(); @@ -2032,15 +2046,29 @@ Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text" return $"&H{255 - c.A:X2}{c.B:X2}{c.G:X2}{c.R:X2}"; // ASS stores alpha in reverse (0=full intensity and 255=fully transparent) } - public static string GetSsaColorStringForEvent(Color c) + public static string GetSsaColorStringForEvent(Color c, string tag = "c") { if (c.A >= 255) { - return $"c&H{c.B:X2}{c.G:X2}{c.R:X2}"; + return $"{tag}&H{c.B:X2}{c.G:X2}{c.R:X2}"; + } + + var alphaName = "alpha"; + if (tag == "2c") + { + alphaName = "2a"; + } + else if (tag == "3c") + { + alphaName = "3a"; + } + else if (tag == "4c") + { + alphaName = "4a"; } var alpha = 255 - c.A; // ASS stores alpha in reverse (0=full intensity and 255=fully transparent) - return $"alpha&H{alpha:X2}&\\c&H{c.B:X2}{c.G:X2}{c.R:X2}"; + return $"{alphaName}&H{alpha:X2}&\\{tag}&H{c.B:X2}{c.G:X2}{c.R:X2}"; } public static string GetSsaColorStringNoTransparency(Color c) => $"&H{c.B:X2}{c.G:X2}{c.R:X2}"; diff --git a/src/libse/SubtitleFormats/TextST.cs b/src/libse/SubtitleFormats/TextST.cs index 873a81440..150ab2645 100644 --- a/src/libse/SubtitleFormats/TextST.cs +++ b/src/libse/SubtitleFormats/TextST.cs @@ -272,7 +272,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats var size = regionStyle.Length + 5; stream.WriteWord(size); stream.WriteByte(SegmentTypeDialogStyle); // 0x81 - stream.WriteWord(size - 3); + stream.WriteWord(size - 5); // DialogStyleSegment length stream.Write(regionStyle, 0, regionStyle.Length); stream.WriteWord(numberOfSubtitles); } diff --git a/src/libse/SubtitleFormats/TimedText10.cs b/src/libse/SubtitleFormats/TimedText10.cs index 3f77e5a39..07ac6fc35 100644 --- a/src/libse/SubtitleFormats/TimedText10.cs +++ b/src/libse/SubtitleFormats/TimedText10.cs @@ -1662,9 +1662,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats result = result.Remove(0, idx); } - return result - .Replace(" & ", " & ") - .Replace("Q&A", "Q&A"); + var fixAmpersandRegex = new Regex("&(?!amp;)"); + return fixAmpersandRegex.Replace(result, "&"); } } } diff --git a/src/libse/SubtitleFormats/WebVTT.cs b/src/libse/SubtitleFormats/WebVTT.cs index 748497e0c..c783a2692 100644 --- a/src/libse/SubtitleFormats/WebVTT.cs +++ b/src/libse/SubtitleFormats/WebVTT.cs @@ -18,7 +18,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats private static readonly Regex RegexTimeCodesMiddle = new Regex(@"^-?\d+:-?\d+\.-?\d+\s*-->\s*-?\d+:-?\d+:-?\d+\.-?\d+", RegexOptions.Compiled); private static readonly Regex RegexTimeCodesShort = new Regex(@"^-?\d+:-?\d+\.-?\d+\s*-->\s*-?\d+:-?\d+\.-?\d+", RegexOptions.Compiled); - private static readonly Dictionary DefaultColorClasses = new Dictionary + public static readonly Dictionary DefaultColorClasses = new Dictionary { { "white", Color.FromArgb(255, 255, 255) @@ -52,7 +52,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats public override List AlternateExtensions => new List { ".webvtt" }; - public override string Name => "WebVTT"; + public const string NameOfFormat = "WebVTT"; + public override string Name => NameOfFormat; public override string ToText(Subtitle subtitle, string title) { @@ -80,11 +81,6 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats var style = string.Empty; if (subtitle.Header != null && subtitle.Header.StartsWith("WEBVTT", StringComparison.Ordinal)) { - if (!string.IsNullOrEmpty(p.Extra)) - { - style = p.Extra; - } - if (!string.IsNullOrEmpty(p.Region)) { positionInfo = $" region:{p.Region} {positionInfo}".Replace(" ", " ").TrimEnd(); @@ -295,6 +291,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats p.EndTime.TotalMilliseconds += addSeconds * 1000; positionInfo = GetPositionInfo(s); + p.Style = GetPositionInfoRaw(s); p.Region = GetRegion(s); } catch (Exception exception) @@ -352,7 +349,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats foreach (var paragraph in subtitle.Paragraphs) { - paragraph.Text = ColorWebVttToHtml(paragraph.Text); + // paragraph.Text = ColorWebVttToHtml(paragraph.Text); paragraph.Text = EscapeDecodeText(paragraph.Text); paragraph.Text = RemoveWeirdRepeatingHeader(paragraph.Text); } @@ -564,6 +561,44 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats return positionInfo; } + internal static string GetPositionInfoRaw(string s) + { + //line: 72.69 % align:left position:44.90 % size:10.21 % + var list = new List(); + + var idx = s.IndexOf("line:", StringComparison.Ordinal); + if (idx >= 0) + { + list.Add(idx); + } + + idx = s.IndexOf("align:", StringComparison.Ordinal); + if (idx >= 0) + { + list.Add(idx); + } + + idx = s.IndexOf("position:", StringComparison.Ordinal); + if (idx >= 0) + { + list.Add(idx); + } + + idx = s.IndexOf("size:", StringComparison.Ordinal); + if (idx >= 0) + { + list.Add(idx); + } + + if (list.Count == 0) + { + return string.Empty; + } + + return s.Substring(list.Min(p=>p)); + } + + internal static string GetRegion(string s) { var region = GetTag(s, "region:"); @@ -711,7 +746,7 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats return styleList; } - private Dictionary GetCueStyles(string header) + private static Dictionary GetCueStyles(string header) { var dic = new Dictionary(); diff --git a/src/libse/SubtitleFormats/WebVTTFileWithLineNumber.cs b/src/libse/SubtitleFormats/WebVTTFileWithLineNumber.cs index f2b712f95..901502148 100644 --- a/src/libse/SubtitleFormats/WebVTTFileWithLineNumber.cs +++ b/src/libse/SubtitleFormats/WebVTTFileWithLineNumber.cs @@ -17,7 +17,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats public override string Extension => ".vtt"; - public override string Name => "WebVTT File with#"; + public const string NameOfFormat = "WebVTT File with#"; + public override string Name => NameOfFormat; public override string ToText(Subtitle subtitle, string title) { @@ -112,6 +113,8 @@ namespace Nikse.SubtitleEdit.Core.SubtitleFormats EndTime = WebVTT.GetTimeCodeFromString(parts[1]) }; positionInfo = WebVTT.GetPositionInfo(s); + p.Extra = WebVTT.GetPositionInfoRaw(s); + p.Region = WebVTT.GetRegion(s); } catch (Exception exception) { diff --git a/src/ui/Controls/VideoPlayerContainer.cs b/src/ui/Controls/VideoPlayerContainer.cs index fb8ee0046..fd3146674 100644 --- a/src/ui/Controls/VideoPlayerContainer.cs +++ b/src/ui/Controls/VideoPlayerContainer.cs @@ -4,10 +4,8 @@ using Nikse.SubtitleEdit.Core.SubtitleFormats; using Nikse.SubtitleEdit.Logic; using Nikse.SubtitleEdit.Logic.VideoPlayers; using System; -using System.Collections.Generic; using System.Drawing; using System.IO; -using System.Linq; using System.Windows.Forms; namespace Nikse.SubtitleEdit.Controls @@ -55,8 +53,6 @@ namespace Nikse.SubtitleEdit.Controls public float FontSizeFactor { get; set; } - private readonly List _allowedMpvNativePreviewFormats = new List(); - public VideoPlayer VideoPlayer { get => _videoPlayer; @@ -96,6 +92,13 @@ namespace Nikse.SubtitleEdit.Controls private readonly Color _backgroundColor = Color.FromArgb(18, 18, 18); private Panel _panelControls; + private Bitmap _bitmapFullscreen; + private Bitmap _bitmapFullscreenDown; + private Bitmap _bitmapFullscreenOver; + private Bitmap _bitmapNoFullscreen; + private Bitmap _bitmapNoFullscreenDown; + private Bitmap _bitmapNoFullscreenOver; + private PictureBox _pictureBoxBackground; private PictureBox _pictureBoxReverse; private PictureBox _pictureBoxReverseOver; @@ -129,7 +132,7 @@ namespace Nikse.SubtitleEdit.Controls private int _lastCurrentPositionToolTipX; private int _lastCurrentPositionToolTipY; - public MatroskaChapter[] Chapters { get; set; } + public MatroskaChapter[] Chapters { get; set; } public RightToLeft TextRightToLeft { @@ -235,11 +238,6 @@ namespace Nikse.SubtitleEdit.Controls PictureBoxFastForwardOverMouseLeave(null, null); _labelTimeCode.Click += LabelTimeCodeClick; - - if (Configuration.Settings.General.MpvAllowNativePreview != null) - { - _allowedMpvNativePreviewFormats = Configuration.Settings.General.MpvAllowNativePreview.Split(';').ToList(); - } } private bool _showDuration = true; @@ -413,7 +411,14 @@ namespace Nikse.SubtitleEdit.Controls public void UpdateMpvStyle() { var gs = Configuration.Settings.General; - var mpvStyle = new SsaStyle + var mpvStyle = GetMpvPreviewStyle(gs); + + MpvPreviewStyleHeader = string.Format(AdvancedSubStationAlpha.HeaderNoStyles, "MPV preview file", mpvStyle.ToRawAss(SsaStyle.DefaultAssStyleFormat)); + } + + private static SsaStyle GetMpvPreviewStyle(GeneralSettings gs) + { + return new SsaStyle { Name = "Default", FontName = gs.VideoPlayerPreviewFontName, @@ -428,8 +433,6 @@ namespace Nikse.SubtitleEdit.Controls Alignment = gs.MpvPreviewTextAlignment, MarginVertical = gs.MpvPreviewTextMarginVertical }; - - MpvPreviewStyleHeader = string.Format(AdvancedSubStationAlpha.HeaderNoStyles, "MPV preview file", mpvStyle.ToRawAss(SsaStyle.DefaultAssStyleFormat)); } private string _mpvPreviewStyleHeader; @@ -478,6 +481,17 @@ namespace Nikse.SubtitleEdit.Controls { text = NetflixImsc11JapaneseToAss.Convert(subtitle, 1280, 720); } + else if (uiFormat.Name == WebVTT.NameOfFormat || uiFormat.Name == WebVTTFileWithLineNumber.NameOfFormat) + { + //TODO: add some caching!? + var defaultStyle = GetMpvPreviewStyle(Configuration.Settings.General); + defaultStyle.BorderStyle = "3"; + subtitle = new Subtitle(subtitle); + subtitle = WebVttToAssa.Convert(subtitle, defaultStyle, VideoWidth, VideoHeight); + format = new AdvancedSubStationAlpha(); + text = subtitle.ToText(format); + // File.WriteAllText(@"c:\data\__a.ass", text); + } else { if (subtitle.Header == null || !subtitle.Header.Contains("[V4+ Styles]") || uiFormat.Name != AdvancedSubStationAlpha.NameOfFormat) @@ -527,11 +541,6 @@ namespace Nikse.SubtitleEdit.Controls } } - if (_allowedMpvNativePreviewFormats.Contains(uiFormat.Name)) - { - format = uiFormat; - } - var hash = subtitle.GetFastHashCode(null); if (hash != _mpvSubOldHash || string.IsNullOrEmpty(_mpvTextOld)) { @@ -731,7 +740,7 @@ namespace Nikse.SubtitleEdit.Controls _pictureBoxPlayDown = new PictureBox { Image = (Image)_resources.GetObject("pictureBoxPlayDown.Image"), - Location = new Point(22, 127 - 113), + Location = new Point(22, 126 - 113), Name = "_pictureBoxPlayDown", Size = new Size(29, 29), SizeMode = PictureBoxSizeMode.AutoSize, @@ -742,7 +751,7 @@ namespace Nikse.SubtitleEdit.Controls _pictureBoxPlayOver = new PictureBox { Image = (Image)_resources.GetObject("pictureBoxPlayOver.Image"), - Location = new Point(23, 126 - 113), + Location = new Point(22, 126 - 113), Name = "_pictureBoxPlayOver", Size = new Size(29, 29), SizeMode = PictureBoxSizeMode.AutoSize, @@ -763,7 +772,7 @@ namespace Nikse.SubtitleEdit.Controls _panelControls.Controls.Add(_pictureBoxPause); _pictureBoxPauseDown.Image = (Image)_resources.GetObject("pictureBoxPauseDown.Image"); - _pictureBoxPauseDown.Location = new Point(22, 127 - 113); + _pictureBoxPauseDown.Location = new Point(23, 126 - 113); _pictureBoxPauseDown.Name = "_pictureBoxPauseDown"; _pictureBoxPauseDown.Size = new Size(29, 29); _pictureBoxPauseDown.SizeMode = PictureBoxSizeMode.AutoSize; @@ -771,7 +780,7 @@ namespace Nikse.SubtitleEdit.Controls _panelControls.Controls.Add(_pictureBoxPauseDown); _pictureBoxPauseOver.Image = (Image)_resources.GetObject("pictureBoxPauseOver.Image"); - _pictureBoxPauseOver.Location = new Point(22, 127 - 113); + _pictureBoxPauseOver.Location = new Point(23, 126 - 113); _pictureBoxPauseOver.Name = "_pictureBoxPauseOver"; _pictureBoxPauseOver.Size = new Size(29, 29); _pictureBoxPauseOver.SizeMode = PictureBoxSizeMode.AutoSize; @@ -817,6 +826,7 @@ namespace Nikse.SubtitleEdit.Controls _pictureBoxFullscreen.TabStop = false; _pictureBoxFullscreen.MouseEnter += PictureBoxFullscreenMouseEnter; _panelControls.Controls.Add(_pictureBoxFullscreen); + _bitmapFullscreen = _pictureBoxFullscreen.Image as Bitmap; _pictureBoxFullscreenDown.Image = (Image)_resources.GetObject("pictureBoxFSDown.Image"); _pictureBoxFullscreenDown.Location = new Point(95, 130 - 113); @@ -825,6 +835,7 @@ namespace Nikse.SubtitleEdit.Controls _pictureBoxFullscreenDown.SizeMode = PictureBoxSizeMode.AutoSize; _pictureBoxFullscreenDown.TabStop = false; _panelControls.Controls.Add(_pictureBoxFullscreenDown); + _bitmapFullscreenDown = _pictureBoxFullscreenDown.Image as Bitmap; _pictureBoxFullscreenOver.Image = (Image)_resources.GetObject("pictureBoxFSOver.Image"); _pictureBoxFullscreenOver.Location = new Point(95, 130 - 113); @@ -836,6 +847,11 @@ namespace Nikse.SubtitleEdit.Controls _pictureBoxFullscreenOver.MouseDown += PictureBoxFullscreenOverMouseDown; _pictureBoxFullscreenOver.MouseUp += PictureBoxFullscreenOverMouseUp; _panelControls.Controls.Add(_pictureBoxFullscreenOver); + _bitmapFullscreenOver = _pictureBoxFullscreenOver.Image as Bitmap; + + _bitmapNoFullscreen = (Image)_resources.GetObject("pictureBoxNoFS.Image") as Bitmap; + _bitmapNoFullscreenDown = (Image)_resources.GetObject("pictureBoxNoFSDown.Image") as Bitmap; + _bitmapNoFullscreenOver = (Image)_resources.GetObject("pictureBoxNoFSOver.Image") as Bitmap; _pictureBoxProgressbarBackground.Anchor = AnchorStyles.Top | AnchorStyles.Left; _pictureBoxProgressbarBackground.BackColor = Color.Transparent; @@ -987,7 +1003,7 @@ namespace Nikse.SubtitleEdit.Controls }; _panelControls.Controls.Add(_pictureBoxFastForwardDown); - _labelVolume.Location = new Point(120, 17); + _labelVolume.Location = new Point(120, 16); _labelVolume.ForeColor = Color.WhiteSmoke; _labelVolume.BackColor = Color.FromArgb(67, 75, 93); _labelVolume.AutoSize = true; @@ -1007,13 +1023,10 @@ namespace Nikse.SubtitleEdit.Controls _labelVideoPlayerName.Font = new Font(_labelTimeCode.Font.FontFamily, 6); _panelControls.Controls.Add(_labelVideoPlayerName); - if (Configuration.Settings.General.UseDarkTheme) - { - _labelVolume.ForeColor = Color.Gray; - _labelTimeCode.ForeColor = Color.Gray; - _labelVideoPlayerName.ForeColor = Color.Gray; - } - + var bg = _pictureBoxBackground.Image as Bitmap; + _labelVolume.BackColor = bg.GetPixel(_labelVolume.Left, _labelVolume.Top); + _labelTimeCode.BackColor = bg.GetPixel(_labelTimeCode.Left, _labelTimeCode.Top); + _labelVideoPlayerName.BackColor = bg.GetPixel(_labelVideoPlayerName.Left, _labelVideoPlayerName.Top); _pictureBoxBackground.SendToBack(); _pictureBoxFastForwardDown.BringToFront(); @@ -1058,7 +1071,6 @@ namespace Nikse.SubtitleEdit.Controls { if (string.IsNullOrEmpty(_labelTimeCode.Text)) { - var span = TimeCode.FromSeconds(1); _labelTimeCode.Text = GetDisplayTimeCode(0, 0); _labelTimeCode.Left = Width - _labelTimeCode.Width - 9; if (_labelTimeCode.Top + _labelTimeCode.Height >= _panelControls.Height - 4) @@ -1293,16 +1305,16 @@ namespace Nikse.SubtitleEdit.Controls public void ShowFullScreenControls() { - _pictureBoxFullscreen.Image = (Image)_resources.GetObject("pictureBoxNoFS.Image"); - _pictureBoxFullscreenDown.Image = (Image)_resources.GetObject("pictureBoxNoFSDown.Image"); - _pictureBoxFullscreenOver.Image = (Image)_resources.GetObject("pictureBoxNoFSOver.Image"); + _pictureBoxFullscreen.Image = _bitmapNoFullscreen; + _pictureBoxFullscreenDown.Image = _bitmapNoFullscreenDown; + _pictureBoxFullscreenOver.Image = _bitmapNoFullscreenOver; } public void ShowNonFullScreenControls() { - _pictureBoxFullscreen.Image = (Image)_resources.GetObject("pictureBoxFS.Image"); - _pictureBoxFullscreenDown.Image = (Image)_resources.GetObject("pictureBoxFSDown.Image"); - _pictureBoxFullscreenOver.Image = (Image)_resources.GetObject("pictureBoxFSOver.Image"); + _pictureBoxFullscreen.Image = _bitmapFullscreen; + _pictureBoxFullscreenDown.Image = _bitmapFullscreenDown; + _pictureBoxFullscreenOver.Image = _bitmapFullscreenOver; } private void PictureBoxFullscreenMouseEnter(object sender, EventArgs e) @@ -2057,5 +2069,111 @@ namespace Nikse.SubtitleEdit.Controls _labelVolume.Font = new Font(_labelTimeCode.Font.FontFamily, 6); _labelVolume.Top -= 2; } + + public void TryLoadGfx() + { + TryLoadIcon(_pictureBoxBackground, "Background"); + TryLoadIcon(_pictureBoxReverse, "Reverse"); + TryLoadIcon(_pictureBoxReverseOver, "ReverseOver"); + TryLoadIcon(_pictureBoxReverseDown, "ReverseDown"); + TryLoadIcon(_pictureBoxFastForward, "FastForward"); + TryLoadIcon(_pictureBoxFastForwardOver, "FastForwardOver"); + TryLoadIcon(_pictureBoxFastForwardDown, "FastForwardDown"); + TryLoadIcon(_pictureBoxPlay, "Play"); + TryLoadIcon(_pictureBoxPlayOver, "PlayOver"); + TryLoadIcon(_pictureBoxPlayDown, "PlayDown"); + TryLoadIcon(_pictureBoxPause, "Pause"); + TryLoadIcon(_pictureBoxPauseOver, "PauseOver"); + TryLoadIcon(_pictureBoxPauseDown, "PauseDown"); + TryLoadIcon(_pictureBoxStop, "Stop"); + TryLoadIcon(_pictureBoxStopOver, "StopOver"); + TryLoadIcon(_pictureBoxStopDown, "StopDown"); + TryLoadIcon(_pictureBoxFullscreen, "Fullscreen"); + TryLoadBitmap(ref _bitmapFullscreen, "Fullscreen"); + TryLoadIcon(_pictureBoxFullscreenOver, "FullscreenOver"); + TryLoadBitmap(ref _bitmapFullscreenOver, "FullscreenOver"); + TryLoadIcon(_pictureBoxFullscreenDown, "FullscreenDown"); + TryLoadBitmap(ref _bitmapFullscreenDown, "FullscreenDown"); + TryLoadIcon(_pictureBoxMute, "Mute"); + TryLoadIcon(_pictureBoxMuteOver, "MuteOver"); + TryLoadIcon(_pictureBoxMuteDown, "MuteDown"); + TryLoadIcon(_pictureBoxProgressbarBackground, "ProgressBarBackground"); + TryLoadIcon(_pictureBoxProgressBar, "ProgressBar"); + TryLoadIcon(_pictureBoxVolumeBarBackground, "VolumeBarBackground"); + TryLoadIcon(_pictureBoxVolumeBar, "VolumeBar"); + + TryLoadBitmap(ref _bitmapNoFullscreen, "NoFullscreen"); + TryLoadBitmap(ref _bitmapNoFullscreenDown, "NoFullscreenDown"); + TryLoadBitmap(ref _bitmapNoFullscreenOver, "NoFullscreenOver"); + + if (_pictureBoxBackground.Image is Bitmap bg) + { + _labelVolume.BackColor = bg.GetPixel(_labelVolume.Left, _labelVolume.Top); + _labelTimeCode.BackColor = bg.GetPixel(_labelTimeCode.Left, _labelTimeCode.Top); + _labelVideoPlayerName.BackColor = bg.GetPixel(_labelVideoPlayerName.Left, _labelVideoPlayerName.Top); + } + + // Set ForeColor to either white or black depending on background color + if (_labelVolume.BackColor.R + _labelVolume.BackColor.G + _labelVolume.BackColor.B > 255 * 1.5) + { + _labelVolume.ForeColor = Color.Black; + } + else + { + _labelVolume.ForeColor = Color.White; + } + + if (_labelTimeCode.BackColor.R + _labelTimeCode.BackColor.G + _labelTimeCode.BackColor.B > 255 * 1.5) + { + _labelTimeCode.ForeColor = Color.Black; + } + else + { + _labelVolume.ForeColor = Color.White; + } + + if (_labelVideoPlayerName.BackColor.R + _labelVideoPlayerName.BackColor.G + _labelVideoPlayerName.BackColor.B > 255 * 1.5) + { + _labelVideoPlayerName.ForeColor = Color.Black; + } + else + { + _labelVideoPlayerName.ForeColor = Color.White; + } + } + + private static void TryLoadBitmap(ref Bitmap bmp, string name) + { + var pb = new PictureBox(); + TryLoadIcon(pb, name); + if (pb.Image != null) + { + bmp = pb.Image as Bitmap; + } + + pb.Dispose(); + } + + private static void TryLoadIcon(PictureBox pb, string iconName) + { + var theme = Configuration.Settings.General.UseDarkTheme ? "DarkTheme" : "DefaultTheme"; + if (!string.IsNullOrEmpty(Configuration.Settings.General.ToolbarIconTheme) && !Configuration.Settings.General.ToolbarIconTheme.Equals("Auto", StringComparison.OrdinalIgnoreCase)) + { + theme = Configuration.Settings.General.ToolbarIconTheme; + } + + var themeFullPath = Path.Combine(Configuration.IconsDirectory, theme, "VideoPlayer", iconName + ".png"); + if (File.Exists(themeFullPath)) + { + pb.Image = new Bitmap(themeFullPath); + return; + } + + var fullPath = Path.Combine(Configuration.IconsDirectory, "DefaultTheme", "VideoPlayer", iconName + ".png"); + if (File.Exists(fullPath)) + { + pb.Image = new Bitmap(fullPath); + } + } } } diff --git a/src/ui/Forms/Assa/AssaStyles.Designer.cs b/src/ui/Forms/Assa/AssaStyles.Designer.cs index 493445558..7b43b57b1 100644 --- a/src/ui/Forms/Assa/AssaStyles.Designer.cs +++ b/src/ui/Forms/Assa/AssaStyles.Designer.cs @@ -38,8 +38,8 @@ this.columnHeaderOutline = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.contextMenuStripFile = new System.Windows.Forms.ContextMenuStrip(this.components); this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.removeAndReplaceWithToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemRemoveAll = new System.Windows.Forms.ToolStripMenuItem(); + this.removeAndReplaceWithToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); this.addToStorageToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); @@ -130,6 +130,7 @@ this.buttonAddToFile = new System.Windows.Forms.Button(); this.buttonStorageExport = new System.Windows.Forms.Button(); this.buttonStorageImport = new System.Windows.Forms.Button(); + this.labelDuplicateStyleNames = new System.Windows.Forms.Label(); this.buttonStorageCopy = new System.Windows.Forms.Button(); this.buttonStorageRemoveAll = new System.Windows.Forms.Button(); this.buttonStorageAdd = new System.Windows.Forms.Button(); @@ -167,7 +168,6 @@ this.labelStorageCategory = new System.Windows.Forms.Label(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.buttonApply = new System.Windows.Forms.Button(); - this.labelDuplicateStyleNames = new System.Windows.Forms.Label(); this.contextMenuStripFile.SuspendLayout(); this.groupBoxStyles.SuspendLayout(); this.groupBoxProperties.SuspendLayout(); @@ -272,7 +272,7 @@ this.toolStripMenuItemImport, this.toolStripMenuItemExport}); this.contextMenuStripFile.Name = "contextMenuStrip1"; - this.contextMenuStripFile.Size = new System.Drawing.Size(216, 314); + this.contextMenuStripFile.Size = new System.Drawing.Size(216, 292); this.contextMenuStripFile.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripFile_Opening); // // deleteToolStripMenuItem @@ -283,13 +283,6 @@ this.deleteToolStripMenuItem.Text = "Remove"; this.deleteToolStripMenuItem.Click += new System.EventHandler(this.buttonRemove_Click); // - // removeAndReplaceWithToolStripMenuItem - // - this.removeAndReplaceWithToolStripMenuItem.Name = "removeAndReplaceWithToolStripMenuItem"; - this.removeAndReplaceWithToolStripMenuItem.Size = new System.Drawing.Size(215, 22); - this.removeAndReplaceWithToolStripMenuItem.Text = "Replace with..."; - this.removeAndReplaceWithToolStripMenuItem.Click += new System.EventHandler(this.buttonRemoveAndReplaceWith_Click); - // // toolStripMenuItemRemoveAll // this.toolStripMenuItemRemoveAll.Name = "toolStripMenuItemRemoveAll"; @@ -297,6 +290,13 @@ this.toolStripMenuItemRemoveAll.Text = "Remove all"; this.toolStripMenuItemRemoveAll.Click += new System.EventHandler(this.buttonRemoveAll_Click); // + // removeAndReplaceWithToolStripMenuItem + // + this.removeAndReplaceWithToolStripMenuItem.Name = "removeAndReplaceWithToolStripMenuItem"; + this.removeAndReplaceWithToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + this.removeAndReplaceWithToolStripMenuItem.Text = "Replace with..."; + this.removeAndReplaceWithToolStripMenuItem.Click += new System.EventHandler(this.buttonRemoveAndReplaceWith_Click); + // // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; @@ -1098,7 +1098,7 @@ // this.checkBoxStrikeout.AutoSize = true; this.checkBoxStrikeout.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Strikeout, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.checkBoxStrikeout.Location = new System.Drawing.Point(246, 54); + this.checkBoxStrikeout.Location = new System.Drawing.Point(265, 54); this.checkBoxStrikeout.Name = "checkBoxStrikeout"; this.checkBoxStrikeout.Size = new System.Drawing.Size(68, 17); this.checkBoxStrikeout.TabIndex = 8; @@ -1120,7 +1120,7 @@ // this.checkBoxFontUnderline.AutoSize = true; this.checkBoxFontUnderline.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.checkBoxFontUnderline.Location = new System.Drawing.Point(169, 54); + this.checkBoxFontUnderline.Location = new System.Drawing.Point(173, 54); this.checkBoxFontUnderline.Name = "checkBoxFontUnderline"; this.checkBoxFontUnderline.Size = new System.Drawing.Size(71, 17); this.checkBoxFontUnderline.TabIndex = 7; @@ -1146,7 +1146,7 @@ // this.checkBoxFontItalic.AutoSize = true; this.checkBoxFontItalic.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.checkBoxFontItalic.Location = new System.Drawing.Point(90, 54); + this.checkBoxFontItalic.Location = new System.Drawing.Point(94, 54); this.checkBoxFontItalic.Name = "checkBoxFontItalic"; this.checkBoxFontItalic.Size = new System.Drawing.Size(48, 17); this.checkBoxFontItalic.TabIndex = 6; @@ -1217,6 +1217,7 @@ this.groupBoxStorage.Controls.Add(this.buttonAddToFile); this.groupBoxStorage.Controls.Add(this.buttonStorageExport); this.groupBoxStorage.Controls.Add(this.buttonStorageImport); + this.groupBoxStorage.Controls.Add(this.labelDuplicateStyleNames); this.groupBoxStorage.Controls.Add(this.buttonStorageCopy); this.groupBoxStorage.Controls.Add(this.buttonStorageRemoveAll); this.groupBoxStorage.Controls.Add(this.buttonStorageAdd); @@ -1272,6 +1273,18 @@ this.buttonStorageImport.UseVisualStyleBackColor = true; this.buttonStorageImport.Click += new System.EventHandler(this.buttonStorageImport_Click); // + // labelDuplicateStyleNames + // + this.labelDuplicateStyleNames.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.labelDuplicateStyleNames.AutoSize = true; + this.labelDuplicateStyleNames.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelDuplicateStyleNames.ForeColor = System.Drawing.Color.Firebrick; + this.labelDuplicateStyleNames.Location = new System.Drawing.Point(494, 102); + this.labelDuplicateStyleNames.Name = "labelDuplicateStyleNames"; + this.labelDuplicateStyleNames.Size = new System.Drawing.Size(154, 13); + this.labelDuplicateStyleNames.TabIndex = 10; + this.labelDuplicateStyleNames.Text = "labelDuplicateStyleNames"; + // // buttonStorageCopy // this.buttonStorageCopy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -1613,24 +1626,11 @@ this.buttonApply.UseVisualStyleBackColor = true; this.buttonApply.Click += new System.EventHandler(this.buttonApply_Click); // - // labelDuplicateStyleNames - // - this.labelDuplicateStyleNames.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.labelDuplicateStyleNames.AutoSize = true; - this.labelDuplicateStyleNames.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.labelDuplicateStyleNames.ForeColor = System.Drawing.Color.Firebrick; - this.labelDuplicateStyleNames.Location = new System.Drawing.Point(12, 648); - this.labelDuplicateStyleNames.Name = "labelDuplicateStyleNames"; - this.labelDuplicateStyleNames.Size = new System.Drawing.Size(154, 13); - this.labelDuplicateStyleNames.TabIndex = 10; - this.labelDuplicateStyleNames.Text = "labelDuplicateStyleNames"; - // // AssaStyles // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1064, 670); - this.Controls.Add(this.labelDuplicateStyleNames); this.Controls.Add(this.buttonApply); this.Controls.Add(this.splitContainer1); this.Controls.Add(this.labelStatus); diff --git a/src/ui/Forms/Assa/AssaStyles.cs b/src/ui/Forms/Assa/AssaStyles.cs index 52b99695e..e228b1f12 100644 --- a/src/ui/Forms/Assa/AssaStyles.cs +++ b/src/ui/Forms/Assa/AssaStyles.cs @@ -76,6 +76,11 @@ namespace Nikse.SubtitleEdit.Forms.Assa AdvancedSubStationAlpha.LoadStylesFromTimedText10(s, string.Empty, _header, AdvancedSubStationAlpha.HeaderNoStyles, new StringBuilder()); _header = s.Header; } + else if (_header != null && _header.StartsWith("WEBVTT", StringComparison.Ordinal)) + { + _subtitle = WebVttToAssa.Convert(subtitle, new SsaStyle(), 0, 0); + _header = _subtitle.Header; + } if (_header == null || !_header.Contains("style:", StringComparison.OrdinalIgnoreCase)) { @@ -2306,7 +2311,7 @@ namespace Nikse.SubtitleEdit.Forms.Assa private void UpdateCurrentFileButtonsState() { - bool oneOrMoreSelected = listViewStyles.SelectedItems.Count > 0; + var oneOrMoreSelected = listViewStyles.SelectedItems.Count > 0; buttonRemove.Enabled = oneOrMoreSelected; buttonCopy.Enabled = oneOrMoreSelected; buttonAddStyleToStorage.Enabled = oneOrMoreSelected; diff --git a/src/ui/Forms/Assa/SetLayer.Designer.cs b/src/ui/Forms/Assa/SetLayer.Designer.cs new file mode 100644 index 000000000..3d89a218a --- /dev/null +++ b/src/ui/Forms/Assa/SetLayer.Designer.cs @@ -0,0 +1,111 @@ +namespace Nikse.SubtitleEdit.Forms.Assa +{ + partial class SetLayer + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.buttonOK = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.numericUpDownLayer = new System.Windows.Forms.NumericUpDown(); + this.labelLayer = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLayer)).BeginInit(); + this.SuspendLayout(); + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonOK.Location = new System.Drawing.Point(196, 70); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(75, 23); + this.buttonOK.TabIndex = 6; + this.buttonOK.Text = "&OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonCancel.Location = new System.Drawing.Point(277, 70); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 7; + this.buttonCancel.Text = "C&ancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + // + // numericUpDownLayer + // + this.numericUpDownLayer.Location = new System.Drawing.Point(24, 33); + this.numericUpDownLayer.Name = "numericUpDownLayer"; + this.numericUpDownLayer.Size = new System.Drawing.Size(76, 20); + this.numericUpDownLayer.TabIndex = 8; + this.numericUpDownLayer.KeyDown += new System.Windows.Forms.KeyEventHandler(this.numericUpDownLayer_KeyDown); + // + // labelLayer + // + this.labelLayer.AutoSize = true; + this.labelLayer.Location = new System.Drawing.Point(24, 14); + this.labelLayer.Name = "labelLayer"; + this.labelLayer.Size = new System.Drawing.Size(33, 13); + this.labelLayer.TabIndex = 9; + this.labelLayer.Text = "Layer"; + // + // SetLayer + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(364, 105); + this.Controls.Add(this.labelLayer); + this.Controls.Add(this.numericUpDownLayer); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.buttonCancel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.KeyPreview = true; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "SetLayer"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "SetLayer"; + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SetLayer_KeyDown); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLayer)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.NumericUpDown numericUpDownLayer; + private System.Windows.Forms.Label labelLayer; + } +} \ No newline at end of file diff --git a/src/ui/Forms/Assa/SetLayer.cs b/src/ui/Forms/Assa/SetLayer.cs new file mode 100644 index 000000000..7acb9d4df --- /dev/null +++ b/src/ui/Forms/Assa/SetLayer.cs @@ -0,0 +1,49 @@ +using Nikse.SubtitleEdit.Logic; +using System.Windows.Forms; +using Nikse.SubtitleEdit.Core.Common; + +namespace Nikse.SubtitleEdit.Forms.Assa +{ + public partial class SetLayer : Form + { + private Subtitle _subtitle; + private Paragraph _p; + public int Layer { get; set; } + + public SetLayer(Subtitle subtitle, Paragraph p) + { + UiUtil.PreInitialize(this); + InitializeComponent(); + UiUtil.FixFonts(this); + + _subtitle = subtitle; + _p = p; + + numericUpDownLayer.Minimum = int.MinValue; + numericUpDownLayer.Maximum = int.MaxValue; + numericUpDownLayer.Value = p?.Layer ?? 0; + } + + private void SetLayer_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Escape) + { + DialogResult = DialogResult.Cancel; + } + } + + private void numericUpDownLayer_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + buttonOK_Click(null, null); + } + } + + private void buttonOK_Click(object sender, System.EventArgs e) + { + Layer = (int)numericUpDownLayer.Value; + DialogResult = DialogResult.OK; + } + } +} diff --git a/src/ui/Forms/Assa/SetLayer.resx b/src/ui/Forms/Assa/SetLayer.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/src/ui/Forms/Assa/SetLayer.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/ui/Forms/AudioToText/WhisperAdvanced.Designer.cs b/src/ui/Forms/AudioToText/WhisperAdvanced.Designer.cs new file mode 100644 index 000000000..ae45d10bd --- /dev/null +++ b/src/ui/Forms/AudioToText/WhisperAdvanced.Designer.cs @@ -0,0 +1,242 @@ +namespace Nikse.SubtitleEdit.Forms.AudioToText +{ + sealed partial class WhisperAdvanced + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WhisperAdvanced)); + this.labelWhisperExtraCmdLine = new System.Windows.Forms.Label(); + this.comboBoxWhisperExtra = new System.Windows.Forms.ComboBox(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.buttonOK = new System.Windows.Forms.Button(); + this.labelNote = new System.Windows.Forms.Label(); + this.tabControlCommandLineHelp = new System.Windows.Forms.TabControl(); + this.TabPageCPP = new System.Windows.Forms.TabPage(); + this.textBoxCpp = new System.Windows.Forms.TextBox(); + this.tabPageConstMe = new System.Windows.Forms.TabPage(); + this.textBoxConstMe = new System.Windows.Forms.TextBox(); + this.tabPageOpenAI = new System.Windows.Forms.TabPage(); + this.textBoxOpenAI = new System.Windows.Forms.TextBox(); + this.tabControlCommandLineHelp.SuspendLayout(); + this.TabPageCPP.SuspendLayout(); + this.tabPageConstMe.SuspendLayout(); + this.tabPageOpenAI.SuspendLayout(); + this.SuspendLayout(); + // + // labelWhisperExtraCmdLine + // + this.labelWhisperExtraCmdLine.AutoSize = true; + this.labelWhisperExtraCmdLine.Location = new System.Drawing.Point(12, 22); + this.labelWhisperExtraCmdLine.Name = "labelWhisperExtraCmdLine"; + this.labelWhisperExtraCmdLine.Size = new System.Drawing.Size(202, 13); + this.labelWhisperExtraCmdLine.TabIndex = 217; + this.labelWhisperExtraCmdLine.Text = "Extra pameters for whisper command line:"; + // + // comboBoxWhisperExtra + // + this.comboBoxWhisperExtra.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.comboBoxWhisperExtra.DropDownWidth = 240; + this.comboBoxWhisperExtra.FormattingEnabled = true; + this.comboBoxWhisperExtra.Location = new System.Drawing.Point(15, 38); + this.comboBoxWhisperExtra.Name = "comboBoxWhisperExtra"; + this.comboBoxWhisperExtra.Size = new System.Drawing.Size(680, 21); + this.comboBoxWhisperExtra.TabIndex = 214; + this.comboBoxWhisperExtra.KeyDown += new System.Windows.Forms.KeyEventHandler(this.comboBoxWhisperExtra_KeyDown); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonCancel.Location = new System.Drawing.Point(620, 472); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 216; + this.buttonCancel.Text = "C&ancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonOK.Location = new System.Drawing.Point(539, 472); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(75, 23); + this.buttonOK.TabIndex = 215; + this.buttonOK.Text = "&OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // labelNote + // + this.labelNote.AutoSize = true; + this.labelNote.Location = new System.Drawing.Point(12, 73); + this.labelNote.Name = "labelNote"; + this.labelNote.Size = new System.Drawing.Size(390, 13); + this.labelNote.TabIndex = 218; + this.labelNote.Text = "Note: Different Whisper implementations have different command line parameters!\r\n" + + ""; + // + // tabControlCommandLineHelp + // + this.tabControlCommandLineHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControlCommandLineHelp.Controls.Add(this.TabPageCPP); + this.tabControlCommandLineHelp.Controls.Add(this.tabPageConstMe); + this.tabControlCommandLineHelp.Controls.Add(this.tabPageOpenAI); + this.tabControlCommandLineHelp.Location = new System.Drawing.Point(15, 108); + this.tabControlCommandLineHelp.Name = "tabControlCommandLineHelp"; + this.tabControlCommandLineHelp.SelectedIndex = 0; + this.tabControlCommandLineHelp.Size = new System.Drawing.Size(680, 358); + this.tabControlCommandLineHelp.TabIndex = 219; + // + // TabPageCPP + // + this.TabPageCPP.Controls.Add(this.textBoxCpp); + this.TabPageCPP.Location = new System.Drawing.Point(4, 22); + this.TabPageCPP.Name = "TabPageCPP"; + this.TabPageCPP.Padding = new System.Windows.Forms.Padding(3); + this.TabPageCPP.Size = new System.Drawing.Size(672, 332); + this.TabPageCPP.TabIndex = 0; + this.TabPageCPP.Text = "CPP"; + this.TabPageCPP.UseVisualStyleBackColor = true; + // + // textBoxCpp + // + this.textBoxCpp.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBoxCpp.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textBoxCpp.Location = new System.Drawing.Point(3, 3); + this.textBoxCpp.Multiline = true; + this.textBoxCpp.Name = "textBoxCpp"; + this.textBoxCpp.ReadOnly = true; + this.textBoxCpp.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.textBoxCpp.Size = new System.Drawing.Size(666, 326); + this.textBoxCpp.TabIndex = 0; + this.textBoxCpp.Text = resources.GetString("textBoxCpp.Text"); + this.textBoxCpp.WordWrap = false; + // + // tabPageConstMe + // + this.tabPageConstMe.Controls.Add(this.textBoxConstMe); + this.tabPageConstMe.Location = new System.Drawing.Point(4, 22); + this.tabPageConstMe.Name = "tabPageConstMe"; + this.tabPageConstMe.Padding = new System.Windows.Forms.Padding(3); + this.tabPageConstMe.Size = new System.Drawing.Size(672, 332); + this.tabPageConstMe.TabIndex = 1; + this.tabPageConstMe.Text = "Const-me"; + this.tabPageConstMe.UseVisualStyleBackColor = true; + // + // textBoxConstMe + // + this.textBoxConstMe.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBoxConstMe.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textBoxConstMe.Location = new System.Drawing.Point(3, 3); + this.textBoxConstMe.Multiline = true; + this.textBoxConstMe.Name = "textBoxConstMe"; + this.textBoxConstMe.ReadOnly = true; + this.textBoxConstMe.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.textBoxConstMe.Size = new System.Drawing.Size(666, 326); + this.textBoxConstMe.TabIndex = 1; + this.textBoxConstMe.Text = resources.GetString("textBoxConstMe.Text"); + this.textBoxConstMe.WordWrap = false; + // + // tabPageOpenAI + // + this.tabPageOpenAI.Controls.Add(this.textBoxOpenAI); + this.tabPageOpenAI.Location = new System.Drawing.Point(4, 22); + this.tabPageOpenAI.Name = "tabPageOpenAI"; + this.tabPageOpenAI.Padding = new System.Windows.Forms.Padding(3); + this.tabPageOpenAI.Size = new System.Drawing.Size(672, 332); + this.tabPageOpenAI.TabIndex = 2; + this.tabPageOpenAI.Text = "OpenAI"; + this.tabPageOpenAI.UseVisualStyleBackColor = true; + // + // textBoxOpenAI + // + this.textBoxOpenAI.Dock = System.Windows.Forms.DockStyle.Fill; + this.textBoxOpenAI.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.textBoxOpenAI.Location = new System.Drawing.Point(3, 3); + this.textBoxOpenAI.Multiline = true; + this.textBoxOpenAI.Name = "textBoxOpenAI"; + this.textBoxOpenAI.ReadOnly = true; + this.textBoxOpenAI.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.textBoxOpenAI.Size = new System.Drawing.Size(666, 326); + this.textBoxOpenAI.TabIndex = 2; + this.textBoxOpenAI.Text = resources.GetString("textBoxOpenAI.Text"); + this.textBoxOpenAI.WordWrap = false; + // + // WhisperAdvanced + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(707, 507); + this.Controls.Add(this.tabControlCommandLineHelp); + this.Controls.Add(this.labelNote); + this.Controls.Add(this.labelWhisperExtraCmdLine); + this.Controls.Add(this.comboBoxWhisperExtra); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonOK); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.KeyPreview = true; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "WhisperAdvanced"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "WhisperAdvanced"; + this.tabControlCommandLineHelp.ResumeLayout(false); + this.TabPageCPP.ResumeLayout(false); + this.TabPageCPP.PerformLayout(); + this.tabPageConstMe.ResumeLayout(false); + this.tabPageConstMe.PerformLayout(); + this.tabPageOpenAI.ResumeLayout(false); + this.tabPageOpenAI.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label labelWhisperExtraCmdLine; + private System.Windows.Forms.ComboBox comboBoxWhisperExtra; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.Label labelNote; + private System.Windows.Forms.TabControl tabControlCommandLineHelp; + private System.Windows.Forms.TabPage TabPageCPP; + private System.Windows.Forms.TextBox textBoxCpp; + private System.Windows.Forms.TabPage tabPageConstMe; + private System.Windows.Forms.TabPage tabPageOpenAI; + private System.Windows.Forms.TextBox textBoxConstMe; + private System.Windows.Forms.TextBox textBoxOpenAI; + } +} \ No newline at end of file diff --git a/src/ui/Forms/AudioToText/WhisperAdvanced.cs b/src/ui/Forms/AudioToText/WhisperAdvanced.cs new file mode 100644 index 000000000..0c75f18bb --- /dev/null +++ b/src/ui/Forms/AudioToText/WhisperAdvanced.cs @@ -0,0 +1,89 @@ +using Nikse.SubtitleEdit.Core.Common; +using Nikse.SubtitleEdit.Logic; +using System; +using System.Drawing; +using System.Windows.Forms; +using Nikse.SubtitleEdit.Core.AudioToText; + +namespace Nikse.SubtitleEdit.Forms.AudioToText +{ + public sealed partial class WhisperAdvanced : Form + { + public WhisperAdvanced(string whisperEngine) + { + UiUtil.PreInitialize(this); + InitializeComponent(); + UiUtil.FixFonts(this); + + comboBoxWhisperExtra.Items.Clear(); + if (!string.IsNullOrEmpty(Configuration.Settings.Tools.WhisperExtraSettingsHistory)) + { + foreach (var line in Configuration.Settings.Tools.WhisperExtraSettingsHistory.SplitToLines()) + { + if (!string.IsNullOrEmpty(line)) + { + comboBoxWhisperExtra.Items.Add(line); + } + } + } + + Text = LanguageSettings.Current.WhisperAdvanced.Title; + labelWhisperExtraCmdLine.Text = LanguageSettings.Current.WhisperAdvanced.CommandLineArguments; + labelNote.Text = LanguageSettings.Current.WhisperAdvanced.Info; + buttonOK.Text = LanguageSettings.Current.General.Ok; + buttonCancel.Text = LanguageSettings.Current.General.Cancel; + comboBoxWhisperExtra.Text = Configuration.Settings.Tools.WhisperExtraSettings; + + if (whisperEngine == WhisperChoice.Cpp) + { + tabControlCommandLineHelp.SelectedTab = TabPageCPP; + } + else if (whisperEngine == WhisperChoice.ConstMe) + { + tabControlCommandLineHelp.SelectedTab = tabPageConstMe; + } + else + { + tabControlCommandLineHelp.SelectedTab = tabPageOpenAI; + } + + try + { + textBoxCpp.Font = new Font("Consolas", textBoxCpp.Font.Size); + textBoxConstMe.Font = new Font("Consolas", textBoxCpp.Font.Size); + textBoxOpenAI.Font = new Font("Consolas", textBoxCpp.Font.Size); + } + catch + { + // ignore + } + + } + + private void buttonOK_Click(object sender, EventArgs e) + { + var param = comboBoxWhisperExtra.Text.Trim(); + if (!string.IsNullOrWhiteSpace(param) && !Configuration.Settings.Tools.WhisperExtraSettings.Contains(param)) + { + Configuration.Settings.Tools.WhisperExtraSettingsHistory = param + Environment.NewLine + + Configuration.Settings.Tools.WhisperExtraSettingsHistory; + } + + Configuration.Settings.Tools.WhisperExtraSettings = comboBoxWhisperExtra.Text; + DialogResult = DialogResult.OK; + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + } + + private void comboBoxWhisperExtra_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + buttonOK_Click(null, null); + } + } + } +} diff --git a/src/ui/Forms/AudioToText/WhisperAdvanced.resx b/src/ui/Forms/AudioToText/WhisperAdvanced.resx new file mode 100644 index 000000000..48052b87e --- /dev/null +++ b/src/ui/Forms/AudioToText/WhisperAdvanced.resx @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + CPP: + -t N, --threads N [4 ] number of threads to use during computation + -p N, --processors N [1 ] number of processors to use during computation + -ot N, --offset-t N [0 ] time offset in milliseconds + -on N, --offset-n N [0 ] segment index offset + -d N, --duration N [0 ] duration of audio to process in milliseconds + -mc N, --max-context N [-1 ] maximum number of text context tokens to store + -ml N, --max-len N [0 ] maximum segment length in characters + -sow, --split-on-word [false ] split on word rather than on token + -bo N, --best-of N [2 ] number of best candidates to keep + -bs N, --beam-size N [-1 ] beam size for beam search + -wt N, --word-thold N [0.01 ] word timestamp probability threshold + -et N, --entropy-thold N [2.40 ] entropy threshold for decoder fail + -lpt N, --logprob-thold N [-1.00 ] log probability threshold for decoder fail + -su, --speed-up [false ] speed up audio by x2 (reduced accuracy) + -tr, --translate [false ] translate from source language to english + -di, --diarize [false ] stereo audio diarization + -nf, --no-fallback [false ] do not use temperature fallback while decoding + -otxt, --output-txt [false ] output result in a text file + -ovtt, --output-vtt [false ] output result in a vtt file + -osrt, --output-srt [false ] output result in a srt file + -olrc, --output-lrc [false ] output result in a lrc file + -owts, --output-words [false ] output script for generating karaoke video + -fp, --font-path [/System/Library/Fonts/Supplemental/Courier New Bold.ttf] path to a monospace font for karaoke video + -ocsv, --output-csv [false ] output result in a CSV file + -oj, --output-json [false ] output result in a JSON file + -of FNAME, --output-file FNAME [ ] output file path (without file extension) + -ps, --print-special [false ] print special tokens + -pc, --print-colors [false ] print colors + -pp, --print-progress [false ] print progress + -nt, --no-timestamps [true ] do not print timestamps + + + Const-me: + -h, --help [default] show this help message and exit + -la, --list-adapters List graphic adapters and exit + -gpu, --use-gpu The graphic adapter to use for inference + -t N, --threads N [4 ] number of threads to use during computation + -p N, --processors N [1 ] number of processors to use during computation + -ot N, --offset-t N [0 ] time offset in milliseconds + -on N, --offset-n N [0 ] segment index offset + -d N, --duration N [0 ] duration of audio to process in milliseconds + -mc N, --max-context N [-1 ] maximum number of text context tokens to store + -ml N, --max-len N [0 ] maximum segment length in characters + -wt N, --word-thold N [0.01 ] word timestamp probability threshold + -su, --speed-up [false ] speed up audio by x2 (reduced accuracy) + -tr, --translate [false ] translate from source language to english + -di, --diarize [false ] stereo audio diarization + -otxt, --output-txt [false ] output result in a text file + -ovtt, --output-vtt [false ] output result in a vtt file + -osrt, --output-srt [false ] output result in a srt file + -owts, --output-words [false ] output script for generating karaoke video + -ps, --print-special [false ] print special tokens + -nc, --no-colors [false ] do not print colors + + + + OpenAI: +--temperature TEMPERATURE +--best_of BEST_OF +--beam_size BEAM_SIZE +--patience PATIENCE +--length_penalty LENGTH_PENALTY +--suppress_tokens SUPPRESS_TOKENS +--initial_prompt INITIAL_PROMPT +--condition_on_previous_text CONDITION_ON_PREVIOUS_TEXT +--fp16 FP16 +--temperature_increment_on_fallback TEMPERATURE_INCREMENT_ON_FALLBACK +--compression_ratio_threshold COMPRESSION_RATIO_THRESHOLD +--logprob_threshold LOGPROB_THRESHOLD +--no_speech_threshold NO_SPEECH_THRESHOLD +--word_timestamps WORD_TIMESTAMPS +--prepend_punctuations PREPEND_PUNCTUATIONS +--append_punctuations APPEND_PUNCTUATIONS +--highlight_words HIGHLIGHT_WORDS +--max_line_width MAX_LINE_WIDTH +--max_line_count MAX_LINE_COUNT +--threads THREADS + + \ No newline at end of file diff --git a/src/ui/Forms/AudioToText/WhisperAudioToText.Designer.cs b/src/ui/Forms/AudioToText/WhisperAudioToText.Designer.cs index dd963f7d2..ff50fe66c 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToText.Designer.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToText.Designer.cs @@ -57,15 +57,15 @@ this.checkBoxTranslateToEnglish = new System.Windows.Forms.CheckBox(); this.labelElapsed = new System.Windows.Forms.Label(); this.contextMenuStripWhisperAdvanced = new System.Windows.Forms.ContextMenuStrip(this.components); + this.runOnlyPostProcessingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparatorRunOnlyPostprocessing = new System.Windows.Forms.ToolStripSeparator(); this.setCPPConstmeModelsFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.removeTemporaryFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.checkBoxAutoAdjustTimings = new System.Windows.Forms.CheckBox(); - this.labelCharsPerSub = new System.Windows.Forms.Label(); - this.comboBoxCharsPerSub = new System.Windows.Forms.ComboBox(); this.comboBoxWhisperEngine = new System.Windows.Forms.ComboBox(); this.labelEngine = new System.Windows.Forms.Label(); - this.runOnlyPostProcessingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparatorRunOnlyPostprocessing = new System.Windows.Forms.ToolStripSeparator(); + this.buttonAdvanced = new System.Windows.Forms.Button(); + this.labelAdvanced = new System.Windows.Forms.Label(); this.groupBoxModels.SuspendLayout(); this.groupBoxInputFiles.SuspendLayout(); this.contextMenuStripWhisperAdvanced.SuspendLayout(); @@ -374,9 +374,21 @@ this.setCPPConstmeModelsFolderToolStripMenuItem, this.removeTemporaryFilesToolStripMenuItem}); this.contextMenuStripWhisperAdvanced.Name = "contextMenuStripWhisperAdvanced"; - this.contextMenuStripWhisperAdvanced.Size = new System.Drawing.Size(259, 98); + this.contextMenuStripWhisperAdvanced.Size = new System.Drawing.Size(259, 76); this.contextMenuStripWhisperAdvanced.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripWhisperAdvanced_Opening); // + // runOnlyPostProcessingToolStripMenuItem + // + this.runOnlyPostProcessingToolStripMenuItem.Name = "runOnlyPostProcessingToolStripMenuItem"; + this.runOnlyPostProcessingToolStripMenuItem.Size = new System.Drawing.Size(258, 22); + this.runOnlyPostProcessingToolStripMenuItem.Text = "Run only post processing"; + this.runOnlyPostProcessingToolStripMenuItem.Click += new System.EventHandler(this.runOnlyPostProcessingToolStripMenuItem_Click); + // + // toolStripSeparatorRunOnlyPostprocessing + // + this.toolStripSeparatorRunOnlyPostprocessing.Name = "toolStripSeparatorRunOnlyPostprocessing"; + this.toolStripSeparatorRunOnlyPostprocessing.Size = new System.Drawing.Size(255, 6); + // // setCPPConstmeModelsFolderToolStripMenuItem // this.setCPPConstmeModelsFolderToolStripMenuItem.Name = "setCPPConstmeModelsFolderToolStripMenuItem"; @@ -401,24 +413,6 @@ this.checkBoxAutoAdjustTimings.Text = "Auto adjust timings"; this.checkBoxAutoAdjustTimings.UseVisualStyleBackColor = true; // - // labelCharsPerSub - // - this.labelCharsPerSub.AutoSize = true; - this.labelCharsPerSub.Location = new System.Drawing.Point(522, 150); - this.labelCharsPerSub.Name = "labelCharsPerSub"; - this.labelCharsPerSub.Size = new System.Drawing.Size(94, 13); - this.labelCharsPerSub.TabIndex = 24; - this.labelCharsPerSub.Text = "Max chars/subtitle"; - // - // comboBoxCharsPerSub - // - this.comboBoxCharsPerSub.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBoxCharsPerSub.FormattingEnabled = true; - this.comboBoxCharsPerSub.Location = new System.Drawing.Point(618, 147); - this.comboBoxCharsPerSub.Name = "comboBoxCharsPerSub"; - this.comboBoxCharsPerSub.Size = new System.Drawing.Size(79, 21); - this.comboBoxCharsPerSub.TabIndex = 25; - // // comboBoxWhisperEngine // this.comboBoxWhisperEngine.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -440,27 +434,36 @@ this.labelEngine.TabIndex = 27; this.labelEngine.Text = "Engine"; // - // runOnlyPostProcessingToolStripMenuItem + // buttonAdvanced // - this.runOnlyPostProcessingToolStripMenuItem.Name = "runOnlyPostProcessingToolStripMenuItem"; - this.runOnlyPostProcessingToolStripMenuItem.Size = new System.Drawing.Size(258, 22); - this.runOnlyPostProcessingToolStripMenuItem.Text = "Run only post processing"; - this.runOnlyPostProcessingToolStripMenuItem.Click += new System.EventHandler(this.runOnlyPostProcessingToolStripMenuItem_Click); + this.buttonAdvanced.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonAdvanced.Location = new System.Drawing.Point(541, 147); + this.buttonAdvanced.Name = "buttonAdvanced"; + this.buttonAdvanced.Size = new System.Drawing.Size(156, 23); + this.buttonAdvanced.TabIndex = 28; + this.buttonAdvanced.Text = "Advanced"; + this.buttonAdvanced.UseVisualStyleBackColor = true; + this.buttonAdvanced.Click += new System.EventHandler(this.buttonAdvanced_Click); // - // toolStripSeparatorRunOnlyPostprocessing + // labelAdvanced // - this.toolStripSeparatorRunOnlyPostprocessing.Name = "toolStripSeparatorRunOnlyPostprocessing"; - this.toolStripSeparatorRunOnlyPostprocessing.Size = new System.Drawing.Size(255, 6); + this.labelAdvanced.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.labelAdvanced.AutoSize = true; + this.labelAdvanced.Location = new System.Drawing.Point(541, 177); + this.labelAdvanced.Name = "labelAdvanced"; + this.labelAdvanced.Size = new System.Drawing.Size(65, 13); + this.labelAdvanced.TabIndex = 29; + this.labelAdvanced.Text = "Advanced..."; // // WhisperAudioToText // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(709, 494); + this.Controls.Add(this.labelAdvanced); + this.Controls.Add(this.buttonAdvanced); this.Controls.Add(this.labelEngine); this.Controls.Add(this.comboBoxWhisperEngine); - this.Controls.Add(this.comboBoxCharsPerSub); - this.Controls.Add(this.labelCharsPerSub); this.Controls.Add(this.labelElapsed); this.Controls.Add(this.checkBoxAutoAdjustTimings); this.Controls.Add(this.checkBoxTranslateToEnglish); @@ -530,12 +533,12 @@ private System.Windows.Forms.ContextMenuStrip contextMenuStripWhisperAdvanced; private System.Windows.Forms.ToolStripMenuItem removeTemporaryFilesToolStripMenuItem; private System.Windows.Forms.CheckBox checkBoxAutoAdjustTimings; - private System.Windows.Forms.Label labelCharsPerSub; - private System.Windows.Forms.ComboBox comboBoxCharsPerSub; private System.Windows.Forms.ComboBox comboBoxWhisperEngine; private System.Windows.Forms.Label labelEngine; private System.Windows.Forms.ToolStripMenuItem setCPPConstmeModelsFolderToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem runOnlyPostProcessingToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparatorRunOnlyPostprocessing; + private System.Windows.Forms.Button buttonAdvanced; + private System.Windows.Forms.Label labelAdvanced; } } \ No newline at end of file diff --git a/src/ui/Forms/AudioToText/WhisperAudioToText.cs b/src/ui/Forms/AudioToText/WhisperAudioToText.cs index 07397d6e0..68fbe1235 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToText.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToText.cs @@ -73,13 +73,14 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText buttonBatchMode.Text = LanguageSettings.Current.AudioToText.BatchMode; groupBoxInputFiles.Text = LanguageSettings.Current.BatchConvert.Input; linkLabeWhisperWebSite.Text = LanguageSettings.Current.AudioToText.WhisperWebsite; - labelCharsPerSub.Text = LanguageSettings.Current.AudioToText.MaxCharsPerSubtitle; buttonAddFile.Text = LanguageSettings.Current.DvdSubRip.Add; buttonRemoveFile.Text = LanguageSettings.Current.DvdSubRip.Remove; buttonClear.Text = LanguageSettings.Current.DvdSubRip.Clear; runOnlyPostProcessingToolStripMenuItem.Text = LanguageSettings.Current.AudioToText.OnlyRunPostProcessing; setCPPConstmeModelsFolderToolStripMenuItem.Text = LanguageSettings.Current.AudioToText.SetCppConstMeFolder; removeTemporaryFilesToolStripMenuItem.Text = LanguageSettings.Current.AudioToText.RemoveTemporaryFiles; + buttonAdvanced.Text = LanguageSettings.Current.General.Advanced; + labelAdvanced.Text = Configuration.Settings.Tools.WhisperExtraSettings; columnHeaderFileName.Text = LanguageSettings.Current.JoinSubtitles.FileName; @@ -118,14 +119,6 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText labelEngine.Text = LanguageSettings.Current.AudioToText.Engine; labelEngine.Left = comboBoxWhisperEngine.Left - labelEngine.Width - 5; - comboBoxCharsPerSub.BeginUpdate(); - comboBoxCharsPerSub.Items.Add(LanguageSettings.Current.General.None); - for (var i = 1; i < 99; i++) - { - comboBoxCharsPerSub.Items.Add(i.ToString(CultureInfo.InvariantCulture)); - } - comboBoxCharsPerSub.EndUpdate(); - Init(); var maxChars = (int)Math.Round(Configuration.Settings.General.SubtitleLineMaximumLength * 1.8, MidpointRounding.AwayFromZero); @@ -139,15 +132,6 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText maxChars = Configuration.Settings.Tools.AudioToTextLineMaxCharsCn; } - if (Configuration.Settings.Tools.WhisperUseLineMaxChars) - { - comboBoxCharsPerSub.Text = maxChars.ToString(CultureInfo.InvariantCulture); - } - else - { - comboBoxCharsPerSub.SelectedIndex = 0; - } - InitializeWhisperEngines(comboBoxWhisperEngine); } @@ -193,10 +177,6 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText removeTemporaryFilesToolStripMenuItem.Checked = Configuration.Settings.Tools.WhisperDeleteTempFiles; ContextMenuStrip = contextMenuStripWhisperAdvanced; - - comboBoxCharsPerSub.Visible = Configuration.Settings.Tools.WhisperChoice == WhisperChoice.Cpp; - labelCharsPerSub.Left = comboBoxCharsPerSub.Left - labelCharsPerSub.Width - 9; - labelCharsPerSub.Visible = Configuration.Settings.Tools.WhisperChoice == WhisperChoice.Cpp; } public static void FillModels(ComboBox comboBoxModels, string lastDownloadedModel) @@ -571,7 +551,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText labelProgress.Refresh(); Application.DoEvents(); _resultList = new List(); - var process = GetWhisperProcess(waveFileName, model.Name, _languageCode, checkBoxTranslateToEnglish.Checked, comboBoxCharsPerSub.SelectedIndex, OutputHandler); + var process = GetWhisperProcess(waveFileName, model.Name, _languageCode, checkBoxTranslateToEnglish.Checked, OutputHandler); var sw = Stopwatch.StartNew(); _outputText.Add($"Calling whisper ({Configuration.Settings.Tools.WhisperChoice}) with : {process.StartInfo.FileName} {process.StartInfo.Arguments}{Environment.NewLine}"); _startTicks = DateTime.UtcNow.Ticks; @@ -936,7 +916,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText } } - public static Process GetWhisperProcess(string waveFileName, string model, string language, bool translate, int maxCharsPerSub, DataReceivedEventHandler dataReceivedHandler = null) + public static Process GetWhisperProcess(string waveFileName, string model, string language, bool translate, DataReceivedEventHandler dataReceivedHandler = null) { // whisper --model tiny.en --language English --fp16 False a.wav @@ -953,11 +933,6 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText { translateToEnglish += "--print-progress "; } - - if (!Configuration.Settings.Tools.WhisperExtraSettings.Contains("--max-len") && maxCharsPerSub > 0) - { - translateToEnglish += $"--max-len {maxCharsPerSub} "; - } } var outputSrt = string.Empty; @@ -966,12 +941,6 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText Configuration.Settings.Tools.WhisperChoice == WhisperChoice.ConstMe) { outputSrt = "--output-srt "; - - if (Configuration.Settings.Tools.WhisperExtraSettings != null && - Configuration.Settings.Tools.WhisperExtraSettings.Contains("--fp16")) - { - Configuration.Settings.Tools.WhisperExtraSettings = string.Empty; - } } else if (Configuration.Settings.Tools.WhisperChoice == WhisperChoice.StableTs) { @@ -1052,7 +1021,6 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText Configuration.Settings.Tools.VoskPostProcessing = checkBoxUsePostProcessing.Checked; Configuration.Settings.Tools.WhisperAutoAdjustTimings = checkBoxAutoAdjustTimings.Checked; - Configuration.Settings.Tools.WhisperUseLineMaxChars = comboBoxCharsPerSub.SelectedIndex > 0; DeleteTemporaryFiles(_filesToDelete); } @@ -1630,5 +1598,14 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText comboBoxModels.Enabled = true; } } + + private void buttonAdvanced_Click(object sender, EventArgs e) + { + using (var form = new WhisperAdvanced(comboBoxWhisperEngine.Text)) + { + var res = form.ShowDialog(this); + labelAdvanced.Text = Configuration.Settings.Tools.WhisperExtraSettings; + } + } } } diff --git a/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.Designer.cs b/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.Designer.cs index 2b0071f04..4b805d3c6 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.Designer.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.Designer.cs @@ -55,6 +55,8 @@ this.removeTemporaryFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.labelEngine = new System.Windows.Forms.Label(); this.comboBoxWhisperEngine = new System.Windows.Forms.ComboBox(); + this.labelAdvanced = new System.Windows.Forms.Label(); + this.buttonAdvanced = new System.Windows.Forms.Button(); this.groupBoxModels.SuspendLayout(); this.groupBoxInputFiles.SuspendLayout(); this.contextMenuStripWhisperAdvanced.SuspendLayout(); @@ -115,7 +117,7 @@ this.textBoxLog.Name = "textBoxLog"; this.textBoxLog.ReadOnly = true; this.textBoxLog.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.textBoxLog.Size = new System.Drawing.Size(168, 258); + this.textBoxLog.Size = new System.Drawing.Size(77, 258); this.textBoxLog.TabIndex = 0; // // labelInfo @@ -290,7 +292,7 @@ this.setCPPConstmeModelsFolderToolStripMenuItem, this.removeTemporaryFilesToolStripMenuItem}); this.contextMenuStripWhisperAdvanced.Name = "contextMenuStripWhisperAdvanced"; - this.contextMenuStripWhisperAdvanced.Size = new System.Drawing.Size(259, 70); + this.contextMenuStripWhisperAdvanced.Size = new System.Drawing.Size(259, 48); this.contextMenuStripWhisperAdvanced.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripWhisperAdvanced_Opening); // // setCPPConstmeModelsFolderToolStripMenuItem @@ -328,11 +330,34 @@ this.comboBoxWhisperEngine.TabIndex = 28; this.comboBoxWhisperEngine.SelectedIndexChanged += new System.EventHandler(this.comboBoxWhisperEngine_SelectedIndexChanged); // + // labelAdvanced + // + this.labelAdvanced.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.labelAdvanced.AutoSize = true; + this.labelAdvanced.Location = new System.Drawing.Point(535, 178); + this.labelAdvanced.Name = "labelAdvanced"; + this.labelAdvanced.Size = new System.Drawing.Size(65, 13); + this.labelAdvanced.TabIndex = 31; + this.labelAdvanced.Text = "Advanced..."; + // + // buttonAdvanced + // + this.buttonAdvanced.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonAdvanced.Location = new System.Drawing.Point(535, 148); + this.buttonAdvanced.Name = "buttonAdvanced"; + this.buttonAdvanced.Size = new System.Drawing.Size(156, 23); + this.buttonAdvanced.TabIndex = 30; + this.buttonAdvanced.Text = "Advanced"; + this.buttonAdvanced.UseVisualStyleBackColor = true; + this.buttonAdvanced.Click += new System.EventHandler(this.buttonAdvanced_Click); + // // WhisperAudioToTextSelectedLines // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(709, 464); + this.Controls.Add(this.labelAdvanced); + this.Controls.Add(this.buttonAdvanced); this.Controls.Add(this.labelEngine); this.Controls.Add(this.comboBoxWhisperEngine); this.Controls.Add(this.checkBoxTranslateToEnglish); @@ -396,5 +421,7 @@ private System.Windows.Forms.Label labelEngine; private System.Windows.Forms.ComboBox comboBoxWhisperEngine; private System.Windows.Forms.ToolStripMenuItem setCPPConstmeModelsFolderToolStripMenuItem; + private System.Windows.Forms.Label labelAdvanced; + private System.Windows.Forms.Button buttonAdvanced; } } \ No newline at end of file diff --git a/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.cs b/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.cs index c1f28a5b5..c68e4527d 100644 --- a/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.cs +++ b/src/ui/Forms/AudioToText/WhisperAudioToTextSelectedLines.cs @@ -48,9 +48,9 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText buttonCancel.Text = LanguageSettings.Current.General.Cancel; groupBoxInputFiles.Text = LanguageSettings.Current.BatchConvert.Input; linkLabeWhisperWebSite.Text = LanguageSettings.Current.AudioToText.WhisperWebsite; - + buttonAdvanced.Text = LanguageSettings.Current.General.Advanced; + labelAdvanced.Text = Configuration.Settings.Tools.WhisperExtraSettings; columnHeaderFileName.Text = LanguageSettings.Current.JoinSubtitles.FileName; - checkBoxUsePostProcessing.Checked = Configuration.Settings.Tools.VoskPostProcessing; Init(); @@ -177,7 +177,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText labelProgress.Refresh(); Application.DoEvents(); _resultList = new List(); - var process = WhisperAudioToText.GetWhisperProcess(waveFileName, model.Name, _languageCode, checkBoxTranslateToEnglish.Checked, 0, OutputHandler); + var process = WhisperAudioToText.GetWhisperProcess(waveFileName, model.Name, _languageCode, checkBoxTranslateToEnglish.Checked, OutputHandler); var sw = Stopwatch.StartNew(); _outputText.Add($"Calling whisper ({Configuration.Settings.Tools.WhisperChoice}) with : whisper {process.StartInfo.Arguments}{Environment.NewLine}"); buttonCancel.Visible = true; @@ -642,5 +642,14 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText setCPPConstmeModelsFolderToolStripMenuItem.Text = "Set CPP/Const-me models folder..."; } } + + private void buttonAdvanced_Click(object sender, EventArgs e) + { + using (var form = new WhisperAdvanced(comboBoxWhisperEngine.Text)) + { + var res = form.ShowDialog(this); + labelAdvanced.Text = Configuration.Settings.Tools.WhisperExtraSettings; + } + } } } diff --git a/src/ui/Forms/AudioToText/WhisperModelDownload.cs b/src/ui/Forms/AudioToText/WhisperModelDownload.cs index ba99e53a9..c6d819bc4 100644 --- a/src/ui/Forms/AudioToText/WhisperModelDownload.cs +++ b/src/ui/Forms/AudioToText/WhisperModelDownload.cs @@ -4,8 +4,11 @@ using Nikse.SubtitleEdit.Logic; using System; using System.IO; using System.Linq; +using System.Runtime.InteropServices.ComTypes; +using System.Text; using System.Threading; using System.Windows.Forms; +using Nikse.SubtitleEdit.Core.Common; using Vosk; namespace Nikse.SubtitleEdit.Forms.AudioToText @@ -189,11 +192,24 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText private void CompleteDownload(Stream downloadStream) { - if (downloadStream.Length == 0) + var streamLength = downloadStream.Length; + if (streamLength == 0) { throw new Exception("No content downloaded - missing file or no internet connection!"); } + downloadStream.Flush(); + downloadStream.Close(); + + if (streamLength < 50) + { + var text = FileUtil.ReadAllTextShared(_downloadFileName, Encoding.UTF8); + if (text.Contains("Invalid username or password.")) + { + throw new Exception("Unable to download file - Invalid username or password! (Perhaps file has a new location)"); + } + } + var newFileName = _downloadFileName.Replace(".$$$", string.Empty); try { @@ -204,9 +220,6 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText // ignore } - downloadStream.Flush(); - downloadStream.Close(); - Application.DoEvents(); File.Move(_downloadFileName, newFileName); labelFileName.Text = string.Empty; diff --git a/src/ui/Forms/BatchConvert.Designer.cs b/src/ui/Forms/BatchConvert.Designer.cs index befc4a2a2..494a4917f 100644 --- a/src/ui/Forms/BatchConvert.Designer.cs +++ b/src/ui/Forms/BatchConvert.Designer.cs @@ -166,8 +166,6 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.convertMkvSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemOcrEngine = new System.Windows.Forms.ToolStripMenuItem(); - this.tesseractToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.nOCRToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.alsoScanVideoFilesInSearchFolderslowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); @@ -1760,33 +1758,17 @@ namespace Nikse.SubtitleEdit.Forms // // toolStripMenuItemOcrEngine // - this.toolStripMenuItemOcrEngine.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.tesseractToolStripMenuItem, - this.nOCRToolStripMenuItem}); this.toolStripMenuItemOcrEngine.Name = "toolStripMenuItemOcrEngine"; this.toolStripMenuItemOcrEngine.Size = new System.Drawing.Size(399, 22); this.toolStripMenuItemOcrEngine.Text = "OCR engine"; - // - // tesseractToolStripMenuItem - // - this.tesseractToolStripMenuItem.Name = "tesseractToolStripMenuItem"; - this.tesseractToolStripMenuItem.Size = new System.Drawing.Size(121, 22); - this.tesseractToolStripMenuItem.Text = "Tesseract"; - this.tesseractToolStripMenuItem.Click += new System.EventHandler(this.tesseractToolStripMenuItem_Click); - // - // nOCRToolStripMenuItem - // - this.nOCRToolStripMenuItem.Name = "nOCRToolStripMenuItem"; - this.nOCRToolStripMenuItem.Size = new System.Drawing.Size(121, 22); - this.nOCRToolStripMenuItem.Text = "nOCR"; - this.nOCRToolStripMenuItem.Click += new System.EventHandler(this.nOCRToolStripMenuItem_Click); + this.toolStripMenuItemOcrEngine.Click += new System.EventHandler(this.toolStripMenuItemOcrEngine_Click); // // alsoScanVideoFilesInSearchFolderslowToolStripMenuItem // this.alsoScanVideoFilesInSearchFolderslowToolStripMenuItem.Name = "alsoScanVideoFilesInSearchFolderslowToolStripMenuItem"; this.alsoScanVideoFilesInSearchFolderslowToolStripMenuItem.Size = new System.Drawing.Size(399, 22); this.alsoScanVideoFilesInSearchFolderslowToolStripMenuItem.Text = "Also scan video files in \"Search folder\" (slow)"; - this.alsoScanVideoFilesInSearchFolderslowToolStripMenuItem.Click += new System.EventHandler(this.alsoScanVideoFilesInSearchFolderslowToolStripMenuItem_Click); + this.alsoScanVideoFilesInSearchFolderslowToolStripMenuItem.Click += new System.EventHandler(this.alsoScanVideoFilesInSearchFolderSlowToolStripMenuItem_Click); // // openFileDialog1 // @@ -2036,8 +2018,6 @@ namespace Nikse.SubtitleEdit.Forms private System.Windows.Forms.CheckBox checkBoxFontSize; private System.Windows.Forms.CheckBox checkBoxMargins; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemOcrEngine; - private System.Windows.Forms.ToolStripMenuItem tesseractToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem nOCRToolStripMenuItem; private System.Windows.Forms.Label labelError; private System.Windows.Forms.GroupBox groupBoxMergeSameTimeCodes; private System.Windows.Forms.CheckBox checkBoxMergeSameTimeCodesReBreakLines; diff --git a/src/ui/Forms/BatchConvert.cs b/src/ui/Forms/BatchConvert.cs index 477193282..a48976d46 100644 --- a/src/ui/Forms/BatchConvert.cs +++ b/src/ui/Forms/BatchConvert.cs @@ -111,6 +111,7 @@ namespace Nikse.SubtitleEdit.Forms private RemoveTextForHISettings _removeTextForHiSettings; private PreprocessingSettings _preprocessingSettings; private string _ocrEngine = "Tesseract"; + private string _ocrLanguage = "en"; public BatchConvert(Icon icon) { @@ -251,16 +252,14 @@ namespace Nikse.SubtitleEdit.Forms textBoxOutputFolder.Text = Configuration.Settings.Tools.BatchConvertOutputFolder; } - toolStripMenuItemOcrEngine.Text = LanguageSettings.Current.VobSubOcr.OcrMethod; - if (Configuration.Settings.Tools.BatchConvertOcrEngine.Equals("nOcr", StringComparison.OrdinalIgnoreCase)) + if (Configuration.Settings.Tools.BatchConvertOcrEngine.Equals("nOCR", StringComparison.OrdinalIgnoreCase)) { - nOCRToolStripMenuItem_Click(null, null); - } - else - { - tesseractToolStripMenuItem_Click(null, null); + _ocrEngine = "nOCR"; } + _ocrLanguage = Configuration.Settings.Tools.BatchConvertOcrLanguage; + UpdateOcrInfo(); + alsoScanVideoFilesInSearchFolderslowToolStripMenuItem.Text = LanguageSettings.Current.BatchConvert.SearchFolderScanVideo; checkBoxOverwrite.Checked = Configuration.Settings.Tools.BatchConvertOverwriteExisting; buttonConvertOptionsSettings.Text = l.Settings; @@ -1504,7 +1503,7 @@ namespace Nikse.SubtitleEdit.Forms } }; vobSubOcr.FileName = Path.GetFileName(fileName); - vobSubOcr.InitializeBatch(bluRaySubtitles, Configuration.Settings.VobSubOcr, fileName, false, null, _ocrEngine); + vobSubOcr.InitializeBatch(bluRaySubtitles, Configuration.Settings.VobSubOcr, fileName, false, _ocrLanguage, _ocrEngine); sub = vobSubOcr.SubtitleFromOcr; } } @@ -1523,7 +1522,7 @@ namespace Nikse.SubtitleEdit.Forms lastProgress = progress; } }; - vobSubOcr.InitializeBatch(fileName, Configuration.Settings.VobSubOcr, false, _ocrEngine); + vobSubOcr.InitializeBatch(fileName, Configuration.Settings.VobSubOcr, false, _ocrEngine, _ocrLanguage); sub = vobSubOcr.SubtitleFromOcr; } } @@ -1591,7 +1590,7 @@ namespace Nikse.SubtitleEdit.Forms item.SubItems[3].Text = $"OCR: {progress}"; }; var language = programMapTableParser.GetSubtitleLanguage(id); - language = string.IsNullOrEmpty(language) ? null : language; + language = string.IsNullOrEmpty(language) ? _ocrLanguage : language; vobSubOcr.FileName = Path.GetFileName(fileName); vobSubOcr.InitializeBatch(tsBinaryParagraphs, Configuration.Settings.VobSubOcr, fileName, false, language, _ocrEngine); subtitle = vobSubOcr.SubtitleFromOcr; @@ -3087,6 +3086,7 @@ namespace Nikse.SubtitleEdit.Forms Configuration.Settings.Tools.ConvertColorsToDialogReBreakLines = checkBoxConvertColorsToDialogReBreakLines.Checked; Configuration.Settings.Tools.BatchConvertOcrEngine = _ocrEngine; + Configuration.Settings.Tools.BatchConvertOcrLanguage = _ocrLanguage; UpdateRtlSettings(); } @@ -3705,24 +3705,29 @@ namespace Nikse.SubtitleEdit.Forms } } - private void tesseractToolStripMenuItem_Click(object sender, EventArgs e) - { - _ocrEngine = "Tesseract"; - tesseractToolStripMenuItem.Checked = true; - nOCRToolStripMenuItem.Checked = false; - } - - private void nOCRToolStripMenuItem_Click(object sender, EventArgs e) - { - _ocrEngine = "nOcr"; - nOCRToolStripMenuItem.Checked = true; - tesseractToolStripMenuItem.Checked = false; - } - - private void alsoScanVideoFilesInSearchFolderslowToolStripMenuItem_Click(object sender, EventArgs e) + private void alsoScanVideoFilesInSearchFolderSlowToolStripMenuItem_Click(object sender, EventArgs e) { Configuration.Settings.Tools.BatchConvertScanFolderIncludeVideo = !Configuration.Settings.Tools.BatchConvertScanFolderIncludeVideo; alsoScanVideoFilesInSearchFolderslowToolStripMenuItem.Checked = Configuration.Settings.Tools.BatchConvertScanFolderIncludeVideo; } + + private void toolStripMenuItemOcrEngine_Click(object sender, EventArgs e) + { + using (var form = new BatchConvertOcrLanguage(_ocrEngine, _ocrLanguage)) + { + if (form.ShowDialog(this) == DialogResult.OK) + { + _ocrEngine = form.OcrEngine; + _ocrLanguage = form.OcrLanguage; + } + + UpdateOcrInfo(); + } + } + + private void UpdateOcrInfo() + { + toolStripMenuItemOcrEngine.Text = $"{LanguageSettings.Current.VobSubOcr.OcrMethod}: {_ocrEngine} / {_ocrLanguage}"; + } } } diff --git a/src/ui/Forms/BatchConvertOcrLanguage.Designer.cs b/src/ui/Forms/BatchConvertOcrLanguage.Designer.cs new file mode 100644 index 000000000..ecb27f5c3 --- /dev/null +++ b/src/ui/Forms/BatchConvertOcrLanguage.Designer.cs @@ -0,0 +1,152 @@ +namespace Nikse.SubtitleEdit.Forms +{ + sealed partial class BatchConvertOcrLanguage + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.labelFileNameEnding = new System.Windows.Forms.Label(); + this.buttonOK = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.label2 = new System.Windows.Forms.Label(); + this.comboBoxLanguage = new System.Windows.Forms.ComboBox(); + this.comboBoxOcrMethod = new System.Windows.Forms.ComboBox(); + this.buttonGetTesseractDictionaries = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // labelFileNameEnding + // + this.labelFileNameEnding.AutoSize = true; + this.labelFileNameEnding.Location = new System.Drawing.Point(12, 17); + this.labelFileNameEnding.Name = "labelFileNameEnding"; + this.labelFileNameEnding.Size = new System.Drawing.Size(65, 13); + this.labelFileNameEnding.TabIndex = 108; + this.labelFileNameEnding.Text = "OCR engine"; + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonOK.Location = new System.Drawing.Point(287, 123); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(75, 23); + this.buttonOK.TabIndex = 333; + this.buttonOK.Text = "&OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonCancel.Location = new System.Drawing.Point(368, 123); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 335; + this.buttonCancel.Text = "C&ancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 47); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(55, 13); + this.label2.TabIndex = 110; + this.label2.Text = "Language"; + // + // comboBoxLanguage + // + this.comboBoxLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxLanguage.FormattingEnabled = true; + this.comboBoxLanguage.Location = new System.Drawing.Point(83, 44); + this.comboBoxLanguage.Name = "comboBoxLanguage"; + this.comboBoxLanguage.Size = new System.Drawing.Size(180, 21); + this.comboBoxLanguage.TabIndex = 222; + // + // comboBoxOcrMethod + // + this.comboBoxOcrMethod.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxOcrMethod.FormattingEnabled = true; + this.comboBoxOcrMethod.Items.AddRange(new object[] { + "Tesseract", + "nOCR"}); + this.comboBoxOcrMethod.Location = new System.Drawing.Point(83, 14); + this.comboBoxOcrMethod.Name = "comboBoxOcrMethod"; + this.comboBoxOcrMethod.Size = new System.Drawing.Size(180, 21); + this.comboBoxOcrMethod.TabIndex = 111; + this.comboBoxOcrMethod.SelectedIndexChanged += new System.EventHandler(this.comboBoxOcrMethod_SelectedIndexChanged); + // + // buttonGetTesseractDictionaries + // + this.buttonGetTesseractDictionaries.Location = new System.Drawing.Point(269, 43); + this.buttonGetTesseractDictionaries.Name = "buttonGetTesseractDictionaries"; + this.buttonGetTesseractDictionaries.Size = new System.Drawing.Size(29, 23); + this.buttonGetTesseractDictionaries.TabIndex = 336; + this.buttonGetTesseractDictionaries.Text = "..."; + this.buttonGetTesseractDictionaries.UseVisualStyleBackColor = true; + this.buttonGetTesseractDictionaries.Click += new System.EventHandler(this.buttonGetTesseractDictionaries_Click); + // + // BatchConvertOcrLanguage + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(455, 158); + this.Controls.Add(this.buttonGetTesseractDictionaries); + this.Controls.Add(this.comboBoxOcrMethod); + this.Controls.Add(this.label2); + this.Controls.Add(this.comboBoxLanguage); + this.Controls.Add(this.labelFileNameEnding); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.buttonCancel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.KeyPreview = true; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "BatchConvertOcrLanguage"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "OCR medthod / language"; + this.Load += new System.EventHandler(this.BatchConvertMkvEnding_Load); + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.BatchConvertMkvEnding_KeyDown); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Label labelFileNameEnding; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.ComboBox comboBoxLanguage; + private System.Windows.Forms.ComboBox comboBoxOcrMethod; + private System.Windows.Forms.Button buttonGetTesseractDictionaries; + } +} \ No newline at end of file diff --git a/src/ui/Forms/BatchConvertOcrLanguage.cs b/src/ui/Forms/BatchConvertOcrLanguage.cs new file mode 100644 index 000000000..50803a5c6 --- /dev/null +++ b/src/ui/Forms/BatchConvertOcrLanguage.cs @@ -0,0 +1,167 @@ +using Nikse.SubtitleEdit.Logic; +using Nikse.SubtitleEdit.Logic.Ocr; +using System; +using System.Windows.Forms; +using Nikse.SubtitleEdit.Core.Common; +using System.IO; +using System.Linq; +using Nikse.SubtitleEdit.Forms.Ocr; + +namespace Nikse.SubtitleEdit.Forms +{ + public sealed partial class BatchConvertOcrLanguage : Form + { + + private class OcrLanguageItem + { + public string Id { get; set; } + public string Text { get; set; } + + public override string ToString() + { + return Text; + } + } + + public string OcrEngine { get; set; } + public string OcrLanguage { get; set; } + + public BatchConvertOcrLanguage(string ocrEngine, string ocrLanguage) + { + UiUtil.PreInitialize(this); + InitializeComponent(); + UiUtil.FixFonts(this); + + Text = LanguageSettings.Current.VobSubOcr.OcrMethod; + buttonCancel.Text = LanguageSettings.Current.General.Cancel; + buttonOK.Text = LanguageSettings.Current.General.Ok; + UiUtil.FixLargeFonts(this, buttonOK); + + OcrEngine = ocrEngine; + OcrLanguage = ocrLanguage; + } + + private void BatchConvertMkvEnding_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Escape) + { + DialogResult = DialogResult.Cancel; + } + } + + private void buttonOK_Click(object sender, EventArgs e) + { + OcrLanguage = !(comboBoxLanguage.SelectedItem is OcrLanguageItem item) ? "en" : item.Id; + + DialogResult = DialogResult.OK; + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + } + + private void BatchConvertMkvEnding_Load(object sender, EventArgs e) + { + if (OcrEngine.Equals("nOcr", StringComparison.OrdinalIgnoreCase)) + { + comboBoxOcrMethod.SelectedIndex = 1; + } + else + { + comboBoxOcrMethod.SelectedIndex = 0; + } + } + + private void InitLanguage() + { + comboBoxLanguage.Items.Clear(); + + if (OcrEngine.Equals("nOcr", StringComparison.OrdinalIgnoreCase)) + { + foreach (var s in NOcrDb.GetDatabases()) + { + comboBoxLanguage.Items.Add(new OcrLanguageItem { Id = s, Text = s }); + if (s == Configuration.Settings.VobSubOcr.LineOcrLastLanguages) + { + comboBoxLanguage.SelectedIndex = comboBoxLanguage.Items.Count - 1; + } + } + } + else + { + var dir = Configuration.TesseractDataDirectory; // is T5 default? + if (Directory.Exists(dir)) + { + var cultures = Iso639Dash2LanguageCode.List; + foreach (var fileName in Directory.GetFiles(dir, "*.traineddata")) + { + string tesseractName = Path.GetFileNameWithoutExtension(fileName); + if (tesseractName != "osd" && tesseractName != "music" && !tesseractName.EndsWith("-frak", StringComparison.Ordinal)) + { + string cultureName = tesseractName; + var match = cultures.FirstOrDefault(p => p.ThreeLetterCode == tesseractName); + if (match != null) + { + cultureName = match.EnglishName; + } + else if (tesseractName == "chi_sim") + { + cultureName = "Chinese simplified"; + } + else if (tesseractName == "chi_tra") + { + cultureName = "Chinese traditional"; + } + else if (tesseractName == "per") + { + cultureName = "Farsi"; + } + else if (tesseractName == "nor") + { + cultureName = "Norwegian"; + } + + comboBoxLanguage.Items.Add(new OcrLanguageItem { Id = tesseractName, Text = cultureName }); + if (cultureName == Configuration.Settings.VobSubOcr.TesseractLastLanguage) + { + comboBoxLanguage.SelectedIndex = comboBoxLanguage.Items.Count - 1; + } + } + } + } + } + + if (comboBoxLanguage.Items.Count > 0 && comboBoxLanguage.SelectedIndex < 0) + { + comboBoxLanguage.SelectedIndex = 0; + } + } + + private void comboBoxOcrMethod_SelectedIndexChanged(object sender, EventArgs e) + { + if (comboBoxOcrMethod.SelectedIndex == 1) + { + OcrEngine = "nOCR"; + buttonGetTesseractDictionaries.Visible = false; + } + else + { + OcrEngine = "Tesseract"; + buttonGetTesseractDictionaries.Visible = true; + } + + InitLanguage(); + } + + private void buttonGetTesseractDictionaries_Click(object sender, EventArgs e) + { + using (var form = new GetTesseractDictionaries(comboBoxLanguage.Items.Count == 0)) + { + form.ShowDialog(this); + Configuration.Settings.VobSubOcr.TesseractLastLanguage = form.ChosenLanguage; + InitLanguage(); + } + } + } +} diff --git a/src/ui/Forms/BatchConvertOcrLanguage.resx b/src/ui/Forms/BatchConvertOcrLanguage.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/src/ui/Forms/BatchConvertOcrLanguage.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/ui/Forms/ExportPngXml.cs b/src/ui/Forms/ExportPngXml.cs index 3d1992179..77391688a 100644 --- a/src/ui/Forms/ExportPngXml.cs +++ b/src/ui/Forms/ExportPngXml.cs @@ -2702,39 +2702,23 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + var font = GetFont(parameter, parameter.SubtitleFontSize); var fontStack = new Stack(); + var addLeft = 0f; while (i < text.Length) { if (text.Substring(i).StartsWith(" 0) { lastText.Append(sb); + left = GetLastPositionFromPath(path, 0, 0) + addLeft; TextDraw.DrawText(font, sf, path, sb, isItalic, parameter.SubtitleFontBold, false, left, top, ref newLine, leftMargin, ref newLinePathPoint); } - addLeft = GetLastPositionFromPath(path, oldPathPointIndex, addLeft); - if (path.PointCount == 0) - { - addLeft = left; - } - else if (addLeft < 0.01) - { - addLeft = left + 2; - } - - left = addLeft; - DrawShadowAndPath(parameter, g, path); var p2 = new SolidBrush(c); g.FillPath(p2, path); p2.Dispose(); + addLeft = GetLastPositionFromPath(path, 0, 0); path.Reset(); path = new GraphicsPath(); sb.Clear(); @@ -2815,50 +2799,27 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + sb.Append(t); } - var addLeft = 0f; - var oldPathPointIndex = path.PointCount - 1; - if (oldPathPointIndex < 0) - { - oldPathPointIndex = 0; - } - if (sb.Length > 0) { - if (lastText.Length > 0 && left > 2) - { - left -= 1.5f; - } - lastText.Append(sb); - + left = GetLastPositionFromPath(path, 0, 0) + addLeft; TextDraw.DrawText(font, sf, path, sb, isItalic, parameter.SubtitleFontBold, false, left, top, ref newLine, leftMargin, ref newLinePathPoint); } - addLeft = GetLastPositionFromPath(path, oldPathPointIndex, addLeft); - if (addLeft < 0.01) - { - addLeft = left + 2; - } - - left = addLeft; - DrawShadowAndPath(parameter, g, path); g.FillPath(new SolidBrush(c), path); + addLeft = GetLastPositionFromPath(path, 0, 0); path.Reset(); sb = new StringBuilder(); if (colorStack.Count > 0) { c = colorStack.Pop(); } - - if (left >= 3) - { - left -= 2.5f; - } } if (sb.Length > 0) { + left = GetLastPositionFromPath(path, 0, 0) + addLeft; TextDraw.DrawText(font, sf, path, sb, isItalic, parameter.SubtitleFontBold, false, left, top, ref newLine, leftMargin, ref newLinePathPoint); sb.Clear(); } @@ -2876,6 +2837,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + if (sb.Length > 0) { lastText.Append(sb); + left = GetLastPositionFromPath(path, 0, 0) + addLeft; TextDraw.DrawText(font, sf, path, sb, isItalic, parameter.SubtitleFontBold, false, left, top, ref newLine, leftMargin, ref newLinePathPoint); } isItalic = true; @@ -2891,6 +2853,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + sb.Append(t); } lastText.Append(sb); + left = GetLastPositionFromPath(path, 0, 0) + addLeft; TextDraw.DrawText(font, sf, path, sb, isItalic, parameter.SubtitleFontBold, false, left, top, ref newLine, leftMargin, ref newLinePathPoint); isItalic = false; i += 3; @@ -2900,6 +2863,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + if (sb.Length > 0) { lastText.Append(sb); + left = GetLastPositionFromPath(path, 0, 0) + addLeft; TextDraw.DrawText(font, sf, path, sb, isItalic, isBold, false, left, top, ref newLine, leftMargin, ref newLinePathPoint); } isBold = true; @@ -2915,6 +2879,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + sb.Append(t); } lastText.Append(sb); + left = GetLastPositionFromPath(path, 0, 0) + addLeft; TextDraw.DrawText(font, sf, path, sb, isItalic, isBold, false, left, top, ref newLine, leftMargin, ref newLinePathPoint); isBold = false; i += 3; @@ -2929,13 +2894,14 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + if (sb.Length > 0) { + left = GetLastPositionFromPath(path, 0, 0) + addLeft; TextDraw.DrawText(font, sf, path, sb, isItalic, parameter.SubtitleFontBold, false, left, top, ref newLine, leftMargin, ref newLinePathPoint); } DrawShadowAndPath(parameter, g, path); g.FillPath(new SolidBrush(c), path); g.Dispose(); - + path.Dispose(); var nbmp = new NikseBitmap(bmp); bmp.Dispose(); font.Dispose(); @@ -3943,7 +3909,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + private static float GetLastPositionFromPath(GraphicsPath path, int oldPathPointIndex, float addLeft) { - if (path.PointCount > 0) + if (path.PointCount > 0 && oldPathPointIndex >= 0) { var list = (PointF[])path.PathPoints.Clone(); // avoid using very slow path.PathPoints indexer!!! for (int k = oldPathPointIndex + 1; k < list.Length; k++) @@ -3954,6 +3920,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + } } } + return addLeft; } diff --git a/src/ui/Forms/FindDialog.cs b/src/ui/Forms/FindDialog.cs index a2ed440b5..05c250115 100644 --- a/src/ui/Forms/FindDialog.cs +++ b/src/ui/Forms/FindDialog.cs @@ -125,10 +125,26 @@ namespace Nikse.SubtitleEdit.Forms private void ButtonFind_Click(object sender, EventArgs e) { + SetRegEx(); FindNext(); buttonFind.Focus(); } + private void SetRegEx() + { + if (radioButtonRegEx.Checked) + { + try + { + _regEx = new Regex(RegexUtils.FixNewLine(FindText), RegexOptions.Compiled, TimeSpan.FromSeconds(5)); + } + catch (Exception exception) + { + MessageBox.Show(exception.Message); + } + } + } + private void FindNext() { var searchText = FindText; @@ -138,28 +154,10 @@ namespace Nikse.SubtitleEdit.Forms { DialogResult = DialogResult.Cancel; } - else if (radioButtonNormal.Checked) + else { DialogResult = DialogResult.OK; - _findAndReplaceMethods.FindDialogFind(FindText, FindReplaceType); - } - else if (radioButtonCaseSensitive.Checked) - { - DialogResult = DialogResult.OK; - _findAndReplaceMethods.FindDialogFind(FindText, FindReplaceType); - } - else if (radioButtonRegEx.Checked) - { - try - { - _regEx = new Regex(RegexUtils.FixNewLine(searchText), RegexOptions.Compiled, TimeSpan.FromSeconds(5)); - DialogResult = DialogResult.OK; - _findAndReplaceMethods.FindDialogFind(FindText, FindReplaceType); - } - catch (Exception exception) - { - MessageBox.Show(exception.Message); - } + _findAndReplaceMethods.FindDialogFind(FindText, FindReplaceType, _regEx); } } @@ -259,6 +257,8 @@ namespace Nikse.SubtitleEdit.Forms labelCount.Text = string.Empty; return; } + + SetRegEx(); var count = GetFindDialogHelper(0).FindCount(_subtitle, checkBoxWholeWord.Checked); var colorIfFound = Configuration.Settings.General.UseDarkTheme ? Color.FromArgb(9, 128, 204) : Color.Blue; labelCount.ForeColor = count > 0 ? colorIfFound : Color.Red; @@ -297,25 +297,18 @@ namespace Nikse.SubtitleEdit.Forms else if (radioButtonNormal.Checked) { DialogResult = DialogResult.OK; + SetRegEx(); _findAndReplaceMethods.FindDialogFindPrevious(FindText); } else if (radioButtonCaseSensitive.Checked) { DialogResult = DialogResult.OK; + SetRegEx(); _findAndReplaceMethods.FindDialogFindPrevious(FindText); } - else if (radioButtonRegEx.Checked) + else { - try - { - _regEx = new Regex(RegexUtils.FixNewLine(searchText), RegexOptions.Compiled, TimeSpan.FromSeconds(5)); - DialogResult = DialogResult.OK; - _findAndReplaceMethods.FindDialogFindPrevious(FindText); - } - catch (Exception exception) - { - MessageBox.Show(exception.Message); - } + SetRegEx(); } buttonFindPrev.Focus(); diff --git a/src/ui/Forms/FixCommonErrors.Designer.cs b/src/ui/Forms/FixCommonErrors.Designer.cs index 25020270c..241063c93 100644 --- a/src/ui/Forms/FixCommonErrors.Designer.cs +++ b/src/ui/Forms/FixCommonErrors.Designer.cs @@ -32,7 +32,7 @@ namespace Nikse.SubtitleEdit.Forms private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - TimeCode timeCode1 = new TimeCode(); + Nikse.SubtitleEdit.Core.Common.TimeCode timeCode2 = new Nikse.SubtitleEdit.Core.Common.TimeCode(); this.buttonCancel = new System.Windows.Forms.Button(); this.buttonNextFinish = new System.Windows.Forms.Button(); this.labelStatus = new System.Windows.Forms.Label(); @@ -252,6 +252,7 @@ namespace Nikse.SubtitleEdit.Forms this.listView1.TabIndex = 1; this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.View = System.Windows.Forms.View.Details; + this.listView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listView1_KeyDown); // // columnHeader1 // @@ -407,6 +408,7 @@ namespace Nikse.SubtitleEdit.Forms this.listViewFixes.View = System.Windows.Forms.View.Details; this.listViewFixes.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.ListViewFixesColumnClick); this.listViewFixes.SelectedIndexChanged += new System.EventHandler(this.ListViewFixesSelectedIndexChanged); + this.listViewFixes.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewFixes_KeyDown); // // columnHeader4 // @@ -654,16 +656,16 @@ namespace Nikse.SubtitleEdit.Forms this.timeUpDownStartTime.Location = new System.Drawing.Point(8, 27); this.timeUpDownStartTime.Margin = new System.Windows.Forms.Padding(4); this.timeUpDownStartTime.Name = "timeUpDownStartTime"; - this.timeUpDownStartTime.Size = new System.Drawing.Size(111, 27); + this.timeUpDownStartTime.Size = new System.Drawing.Size(113, 27); this.timeUpDownStartTime.TabIndex = 112; - timeCode1.Hours = 0; - timeCode1.Milliseconds = 0; - timeCode1.Minutes = 0; - timeCode1.Seconds = 0; - timeCode1.TimeSpan = System.TimeSpan.Parse("00:00:00"); - timeCode1.TotalMilliseconds = 0D; - timeCode1.TotalSeconds = 0D; - this.timeUpDownStartTime.TimeCode = timeCode1; + timeCode2.Hours = 0; + timeCode2.Milliseconds = 0; + timeCode2.Minutes = 0; + timeCode2.Seconds = 0; + timeCode2.TimeSpan = System.TimeSpan.Parse("00:00:00"); + timeCode2.TotalMilliseconds = 0D; + timeCode2.TotalSeconds = 0D; + this.timeUpDownStartTime.TimeCode = timeCode2; this.timeUpDownStartTime.UseVideoOffset = false; // // numericUpDownDuration diff --git a/src/ui/Forms/FixCommonErrors.cs b/src/ui/Forms/FixCommonErrors.cs index ad37094bb..0880179db 100644 --- a/src/ui/Forms/FixCommonErrors.cs +++ b/src/ui/Forms/FixCommonErrors.cs @@ -2094,5 +2094,69 @@ namespace Nikse.SubtitleEdit.Forms { buttonResetDefault_Click(null, null); } + + private void listView1_KeyDown(object sender, KeyEventArgs e) + { + var items = listView1.Items; + if (e.KeyCode == Keys.A && e.Modifiers == Keys.Control) + { + foreach (ListViewItem item in items) + { + item.Checked = true; + item.Selected = true; + } + e.SuppressKeyPress = true; + } + else if (e.KeyCode == Keys.D && e.Modifiers == Keys.Control) + { + foreach (ListViewItem item in items) + { + item.Checked = false; + item.Selected = false; + } + e.SuppressKeyPress = true; + } + else if (e.KeyCode == Keys.I && e.Modifiers == (Keys.Control | Keys.Shift)) //InverseSelection + { + foreach (ListViewItem item in items) + { + item.Checked = !item.Checked; + } + e.SuppressKeyPress = true; + e.SuppressKeyPress = true; + } + } + + private void listViewFixes_KeyDown(object sender, KeyEventArgs e) + { + var items = listViewFixes.Items; + if (e.KeyCode == Keys.A && e.Modifiers == Keys.Control) + { + foreach (ListViewItem item in items) + { + item.Checked = true; + item.Selected = true; + } + e.SuppressKeyPress = true; + } + else if (e.KeyCode == Keys.D && e.Modifiers == Keys.Control) + { + foreach (ListViewItem item in items) + { + item.Checked = false; + item.Selected = false; + } + e.SuppressKeyPress = true; + } + else if (e.KeyCode == Keys.I && e.Modifiers == (Keys.Control | Keys.Shift)) //InverseSelection + { + foreach (ListViewItem item in items) + { + item.Checked = !item.Checked; + } + e.SuppressKeyPress = true; + e.SuppressKeyPress = true; + } + } } } diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs index 58b89c17c..0885d5139 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs @@ -55,7 +55,6 @@ namespace Nikse.SubtitleEdit.Forms this.checkBoxCut = new System.Windows.Forms.CheckBox(); this.labelVideoBitrate = new System.Windows.Forms.Label(); this.checkBoxBox = new System.Windows.Forms.CheckBox(); - this.labelPreviewPleaseWait = new System.Windows.Forms.Label(); this.checkBoxAlignRight = new System.Windows.Forms.CheckBox(); this.checkBoxRightToLeft = new System.Windows.Forms.CheckBox(); this.comboBoxSubtitleFont = new System.Windows.Forms.ComboBox(); @@ -107,6 +106,8 @@ namespace Nikse.SubtitleEdit.Forms this.nTSC720x480ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.x352ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.x272ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.labelPreviewPleaseWait = new System.Windows.Forms.Label(); + this.videoPlayerContainer1 = new Nikse.SubtitleEdit.Controls.VideoPlayerContainer(); this.contextMenuStripGenerate.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFontSize)).BeginInit(); this.groupBoxSettings.SuspendLayout(); @@ -129,9 +130,9 @@ namespace Nikse.SubtitleEdit.Forms // this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.progressBar1.Location = new System.Drawing.Point(12, 570); + this.progressBar1.Location = new System.Drawing.Point(12, 615); this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(628, 11); + this.progressBar1.Size = new System.Drawing.Size(653, 11); this.progressBar1.TabIndex = 22; this.progressBar1.Visible = false; // @@ -140,7 +141,7 @@ namespace Nikse.SubtitleEdit.Forms this.buttonGenerate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonGenerate.ContextMenuStrip = this.contextMenuStripGenerate; this.buttonGenerate.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.buttonGenerate.Location = new System.Drawing.Point(646, 570); + this.buttonGenerate.Location = new System.Drawing.Point(671, 615); this.buttonGenerate.Name = "buttonGenerate"; this.buttonGenerate.Size = new System.Drawing.Size(121, 23); this.buttonGenerate.TabIndex = 4; @@ -167,7 +168,7 @@ namespace Nikse.SubtitleEdit.Forms this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.buttonCancel.Location = new System.Drawing.Point(773, 570); + this.buttonCancel.Location = new System.Drawing.Point(798, 615); this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.TabIndex = 6; @@ -179,7 +180,7 @@ namespace Nikse.SubtitleEdit.Forms // this.labelPleaseWait.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.labelPleaseWait.AutoSize = true; - this.labelPleaseWait.Location = new System.Drawing.Point(12, 554); + this.labelPleaseWait.Location = new System.Drawing.Point(12, 599); this.labelPleaseWait.Name = "labelPleaseWait"; this.labelPleaseWait.Size = new System.Drawing.Size(70, 13); this.labelPleaseWait.TabIndex = 25; @@ -187,7 +188,7 @@ namespace Nikse.SubtitleEdit.Forms // // numericUpDownFontSize // - this.numericUpDownFontSize.Location = new System.Drawing.Point(120, 33); + this.numericUpDownFontSize.Location = new System.Drawing.Point(120, 25); this.numericUpDownFontSize.Maximum = new decimal(new int[] { 1000, 0, @@ -206,11 +207,12 @@ namespace Nikse.SubtitleEdit.Forms 0, 0, 0}); + this.numericUpDownFontSize.ValueChanged += new System.EventHandler(this.numericUpDownFontSize_ValueChanged); // // labelFontSize // this.labelFontSize.AutoSize = true; - this.labelFontSize.Location = new System.Drawing.Point(19, 35); + this.labelFontSize.Location = new System.Drawing.Point(19, 27); this.labelFontSize.Name = "labelFontSize"; this.labelFontSize.Size = new System.Drawing.Size(49, 13); this.labelFontSize.TabIndex = 0; @@ -225,7 +227,7 @@ namespace Nikse.SubtitleEdit.Forms // this.labelProgress.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.labelProgress.AutoSize = true; - this.labelProgress.Location = new System.Drawing.Point(12, 584); + this.labelProgress.Location = new System.Drawing.Point(12, 629); this.labelProgress.Name = "labelProgress"; this.labelProgress.Size = new System.Drawing.Size(88, 13); this.labelProgress.TabIndex = 29; @@ -236,15 +238,15 @@ namespace Nikse.SubtitleEdit.Forms this.groupBoxSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxSettings.Controls.Add(this.videoPlayerContainer1); this.groupBoxSettings.Controls.Add(this.groupBoxCut); this.groupBoxSettings.Controls.Add(this.labelVideoBitrate); this.groupBoxSettings.Controls.Add(this.checkBoxBox); - this.groupBoxSettings.Controls.Add(this.labelPreviewPleaseWait); this.groupBoxSettings.Controls.Add(this.checkBoxAlignRight); + this.groupBoxSettings.Controls.Add(this.labelInfo); this.groupBoxSettings.Controls.Add(this.checkBoxRightToLeft); this.groupBoxSettings.Controls.Add(this.comboBoxSubtitleFont); this.groupBoxSettings.Controls.Add(this.labelSubtitleFont); - this.groupBoxSettings.Controls.Add(this.buttonPreview); this.groupBoxSettings.Controls.Add(this.groupBoxVideo); this.groupBoxSettings.Controls.Add(this.groupBoxAudio); this.groupBoxSettings.Controls.Add(this.numericUpDownTargetFileSize); @@ -255,7 +257,7 @@ namespace Nikse.SubtitleEdit.Forms this.groupBoxSettings.Controls.Add(this.labelFontSize); this.groupBoxSettings.Location = new System.Drawing.Point(12, 13); this.groupBoxSettings.Name = "groupBoxSettings"; - this.groupBoxSettings.Size = new System.Drawing.Size(836, 502); + this.groupBoxSettings.Size = new System.Drawing.Size(861, 547); this.groupBoxSettings.TabIndex = 0; this.groupBoxSettings.TabStop = false; this.groupBoxSettings.Text = "Settings"; @@ -273,9 +275,9 @@ namespace Nikse.SubtitleEdit.Forms this.groupBoxCut.Controls.Add(this.labelCutTo); this.groupBoxCut.Controls.Add(this.labelCutFrom); this.groupBoxCut.Controls.Add(this.checkBoxCut); - this.groupBoxCut.Location = new System.Drawing.Point(430, 369); + this.groupBoxCut.Location = new System.Drawing.Point(430, 21); this.groupBoxCut.Name = "groupBoxCut"; - this.groupBoxCut.Size = new System.Drawing.Size(391, 115); + this.groupBoxCut.Size = new System.Drawing.Size(425, 96); this.groupBoxCut.TabIndex = 15; this.groupBoxCut.TabStop = false; // @@ -403,7 +405,7 @@ namespace Nikse.SubtitleEdit.Forms // labelVideoBitrate // this.labelVideoBitrate.AutoSize = true; - this.labelVideoBitrate.Location = new System.Drawing.Point(193, 403); + this.labelVideoBitrate.Location = new System.Drawing.Point(193, 352); this.labelVideoBitrate.Name = "labelVideoBitrate"; this.labelVideoBitrate.Size = new System.Drawing.Size(86, 13); this.labelVideoBitrate.TabIndex = 14; @@ -412,56 +414,51 @@ namespace Nikse.SubtitleEdit.Forms // checkBoxBox // this.checkBoxBox.AutoSize = true; - this.checkBoxBox.Location = new System.Drawing.Point(120, 136); + this.checkBoxBox.Location = new System.Drawing.Point(203, 27); this.checkBoxBox.Name = "checkBoxBox"; this.checkBoxBox.Size = new System.Drawing.Size(44, 17); this.checkBoxBox.TabIndex = 6; this.checkBoxBox.Text = "Box"; this.checkBoxBox.UseVisualStyleBackColor = true; - // - // labelPreviewPleaseWait - // - this.labelPreviewPleaseWait.AutoSize = true; - this.labelPreviewPleaseWait.Location = new System.Drawing.Point(717, 45); - this.labelPreviewPleaseWait.Name = "labelPreviewPleaseWait"; - this.labelPreviewPleaseWait.Size = new System.Drawing.Size(70, 13); - this.labelPreviewPleaseWait.TabIndex = 7; - this.labelPreviewPleaseWait.Text = "Please wait..."; + this.checkBoxBox.CheckedChanged += new System.EventHandler(this.checkBoxBox_CheckedChanged); // // checkBoxAlignRight // this.checkBoxAlignRight.AutoSize = true; - this.checkBoxAlignRight.Location = new System.Drawing.Point(120, 113); + this.checkBoxAlignRight.Location = new System.Drawing.Point(120, 105); this.checkBoxAlignRight.Name = "checkBoxAlignRight"; this.checkBoxAlignRight.Size = new System.Drawing.Size(72, 17); this.checkBoxAlignRight.TabIndex = 5; this.checkBoxAlignRight.Text = "Align right"; this.checkBoxAlignRight.UseVisualStyleBackColor = true; + this.checkBoxAlignRight.CheckedChanged += new System.EventHandler(this.checkBoxAlignRight_CheckedChanged); // // checkBoxRightToLeft // this.checkBoxRightToLeft.AutoSize = true; - this.checkBoxRightToLeft.Location = new System.Drawing.Point(120, 90); + this.checkBoxRightToLeft.Location = new System.Drawing.Point(120, 82); this.checkBoxRightToLeft.Name = "checkBoxRightToLeft"; this.checkBoxRightToLeft.Size = new System.Drawing.Size(80, 17); this.checkBoxRightToLeft.TabIndex = 4; this.checkBoxRightToLeft.Text = "Right to left"; this.checkBoxRightToLeft.UseVisualStyleBackColor = true; + this.checkBoxRightToLeft.CheckedChanged += new System.EventHandler(this.checkBoxRightToLeft_CheckedChanged); // // comboBoxSubtitleFont // this.comboBoxSubtitleFont.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxSubtitleFont.DropDownWidth = 250; this.comboBoxSubtitleFont.FormattingEnabled = true; - this.comboBoxSubtitleFont.Location = new System.Drawing.Point(120, 63); + this.comboBoxSubtitleFont.Location = new System.Drawing.Point(120, 55); this.comboBoxSubtitleFont.Name = "comboBoxSubtitleFont"; this.comboBoxSubtitleFont.Size = new System.Drawing.Size(250, 21); this.comboBoxSubtitleFont.TabIndex = 3; + this.comboBoxSubtitleFont.SelectedValueChanged += new System.EventHandler(this.comboBoxSubtitleFont_SelectedValueChanged); // // labelSubtitleFont // this.labelSubtitleFont.AutoSize = true; - this.labelSubtitleFont.Location = new System.Drawing.Point(19, 66); + this.labelSubtitleFont.Location = new System.Drawing.Point(19, 58); this.labelSubtitleFont.Name = "labelSubtitleFont"; this.labelSubtitleFont.Size = new System.Drawing.Size(63, 13); this.labelSubtitleFont.TabIndex = 2; @@ -469,11 +466,10 @@ namespace Nikse.SubtitleEdit.Forms // // buttonPreview // - this.buttonPreview.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.buttonPreview.Location = new System.Drawing.Point(720, 19); + this.buttonPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonPreview.Location = new System.Drawing.Point(671, 586); this.buttonPreview.Name = "buttonPreview"; - this.buttonPreview.Size = new System.Drawing.Size(101, 23); + this.buttonPreview.Size = new System.Drawing.Size(121, 23); this.buttonPreview.TabIndex = 6; this.buttonPreview.Text = "Preview"; this.buttonPreview.UseVisualStyleBackColor = true; @@ -495,9 +491,9 @@ namespace Nikse.SubtitleEdit.Forms this.groupBoxVideo.Controls.Add(this.comboBoxVideoEncoding); this.groupBoxVideo.Controls.Add(this.comboBoxCrf); this.groupBoxVideo.Controls.Add(this.labelVideoEncoding); - this.groupBoxVideo.Location = new System.Drawing.Point(6, 165); + this.groupBoxVideo.Location = new System.Drawing.Point(6, 131); this.groupBoxVideo.Name = "groupBoxVideo"; - this.groupBoxVideo.Size = new System.Drawing.Size(406, 197); + this.groupBoxVideo.Size = new System.Drawing.Size(406, 176); this.groupBoxVideo.TabIndex = 8; this.groupBoxVideo.TabStop = false; this.groupBoxVideo.Text = "Video"; @@ -711,8 +707,7 @@ namespace Nikse.SubtitleEdit.Forms // // groupBoxAudio // - this.groupBoxAudio.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.groupBoxAudio.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.groupBoxAudio.Controls.Add(this.labelAudioEnc); this.groupBoxAudio.Controls.Add(this.comboBoxAudioBitRate); @@ -721,9 +716,9 @@ namespace Nikse.SubtitleEdit.Forms this.groupBoxAudio.Controls.Add(this.checkBoxMakeStereo); this.groupBoxAudio.Controls.Add(this.labelAudioSampleRate); this.groupBoxAudio.Controls.Add(this.comboBoxAudioSampleRate); - this.groupBoxAudio.Location = new System.Drawing.Point(430, 165); + this.groupBoxAudio.Location = new System.Drawing.Point(430, 131); this.groupBoxAudio.Name = "groupBoxAudio"; - this.groupBoxAudio.Size = new System.Drawing.Size(391, 197); + this.groupBoxAudio.Size = new System.Drawing.Size(425, 176); this.groupBoxAudio.TabIndex = 10; this.groupBoxAudio.TabStop = false; this.groupBoxAudio.Text = "Audio"; @@ -813,7 +808,7 @@ namespace Nikse.SubtitleEdit.Forms // // numericUpDownTargetFileSize // - this.numericUpDownTargetFileSize.Location = new System.Drawing.Point(120, 401); + this.numericUpDownTargetFileSize.Location = new System.Drawing.Point(120, 350); this.numericUpDownTargetFileSize.Maximum = new decimal(new int[] { 1000000, 0, @@ -837,7 +832,7 @@ namespace Nikse.SubtitleEdit.Forms // labelFileSize // this.labelFileSize.AutoSize = true; - this.labelFileSize.Location = new System.Drawing.Point(35, 403); + this.labelFileSize.Location = new System.Drawing.Point(35, 352); this.labelFileSize.Name = "labelFileSize"; this.labelFileSize.Size = new System.Drawing.Size(74, 13); this.labelFileSize.TabIndex = 12; @@ -846,7 +841,7 @@ namespace Nikse.SubtitleEdit.Forms // checkBoxTargetFileSize // this.checkBoxTargetFileSize.AutoSize = true; - this.checkBoxTargetFileSize.Location = new System.Drawing.Point(22, 378); + this.checkBoxTargetFileSize.Location = new System.Drawing.Point(22, 327); this.checkBoxTargetFileSize.Name = "checkBoxTargetFileSize"; this.checkBoxTargetFileSize.Size = new System.Drawing.Size(192, 17); this.checkBoxTargetFileSize.TabIndex = 11; @@ -857,7 +852,7 @@ namespace Nikse.SubtitleEdit.Forms // labelFileName // this.labelFileName.AutoSize = true; - this.labelFileName.Location = new System.Drawing.Point(19, 449); + this.labelFileName.Location = new System.Drawing.Point(19, 398); this.labelFileName.Name = "labelFileName"; this.labelFileName.Size = new System.Drawing.Size(52, 13); this.labelFileName.TabIndex = 0; @@ -867,7 +862,7 @@ namespace Nikse.SubtitleEdit.Forms // this.linkLabelHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.linkLabelHelp.AutoSize = true; - this.linkLabelHelp.Location = new System.Drawing.Point(819, 518); + this.linkLabelHelp.Location = new System.Drawing.Point(844, 563); this.linkLabelHelp.Name = "linkLabelHelp"; this.linkLabelHelp.Size = new System.Drawing.Size(29, 13); this.linkLabelHelp.TabIndex = 2; @@ -888,7 +883,7 @@ namespace Nikse.SubtitleEdit.Forms // this.labelInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.labelInfo.AutoSize = true; - this.labelInfo.Location = new System.Drawing.Point(12, 518); + this.labelInfo.Location = new System.Drawing.Point(5, 526); this.labelInfo.Name = "labelInfo"; this.labelInfo.Size = new System.Drawing.Size(25, 13); this.labelInfo.TabIndex = 1; @@ -898,7 +893,7 @@ namespace Nikse.SubtitleEdit.Forms // this.labelPass.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.labelPass.AutoSize = true; - this.labelPass.Location = new System.Drawing.Point(589, 554); + this.labelPass.Location = new System.Drawing.Point(614, 599); this.labelPass.Name = "labelPass"; this.labelPass.Size = new System.Drawing.Size(51, 13); this.labelPass.TabIndex = 47; @@ -1022,25 +1017,58 @@ namespace Nikse.SubtitleEdit.Forms this.x272ToolStripMenuItem.Text = "640x272"; this.x272ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // + // labelPreviewPleaseWait + // + this.labelPreviewPleaseWait.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.labelPreviewPleaseWait.AutoSize = true; + this.labelPreviewPleaseWait.Location = new System.Drawing.Point(668, 570); + this.labelPreviewPleaseWait.Name = "labelPreviewPleaseWait"; + this.labelPreviewPleaseWait.Size = new System.Drawing.Size(70, 13); + this.labelPreviewPleaseWait.TabIndex = 48; + this.labelPreviewPleaseWait.Text = "Please wait..."; + // + // videoPlayerContainer1 + // + this.videoPlayerContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.videoPlayerContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18))))); + this.videoPlayerContainer1.Chapters = null; + this.videoPlayerContainer1.CurrentPosition = 0D; + this.videoPlayerContainer1.FontSizeFactor = 1F; + this.videoPlayerContainer1.LastParagraph = null; + this.videoPlayerContainer1.Location = new System.Drawing.Point(430, 313); + this.videoPlayerContainer1.Name = "videoPlayerContainer1"; + this.videoPlayerContainer1.ShowFullscreenButton = true; + this.videoPlayerContainer1.ShowMuteButton = true; + this.videoPlayerContainer1.ShowStopButton = true; + this.videoPlayerContainer1.Size = new System.Drawing.Size(431, 226); + this.videoPlayerContainer1.SubtitleText = ""; + this.videoPlayerContainer1.TabIndex = 17; + this.videoPlayerContainer1.TextRightToLeft = System.Windows.Forms.RightToLeft.No; + this.videoPlayerContainer1.UsingFrontCenterAudioChannelOnly = false; + this.videoPlayerContainer1.VideoHeight = 0; + this.videoPlayerContainer1.VideoPlayer = null; + this.videoPlayerContainer1.VideoWidth = 0; + this.videoPlayerContainer1.Volume = 0D; + // // GenerateVideoWithHardSubs // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(860, 605); + this.ClientSize = new System.Drawing.Size(885, 650); + this.Controls.Add(this.labelPreviewPleaseWait); this.Controls.Add(this.groupBoxSettings); this.Controls.Add(this.labelPass); - this.Controls.Add(this.labelInfo); this.Controls.Add(this.linkLabelHelp); this.Controls.Add(this.labelProgress); + this.Controls.Add(this.buttonPreview); this.Controls.Add(this.labelPleaseWait); this.Controls.Add(this.progressBar1); this.Controls.Add(this.buttonGenerate); this.Controls.Add(this.buttonCancel); this.Controls.Add(this.textBoxLog); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.KeyPreview = true; - this.MaximizeBox = false; - this.MinimizeBox = false; this.Name = "GenerateVideoWithHardSubs"; this.ShowIcon = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; @@ -1118,7 +1146,6 @@ namespace Nikse.SubtitleEdit.Forms private System.Windows.Forms.Label labelSubtitleFont; private System.Windows.Forms.CheckBox checkBoxRightToLeft; private System.Windows.Forms.CheckBox checkBoxAlignRight; - private System.Windows.Forms.Label labelPreviewPleaseWait; private System.Windows.Forms.CheckBox checkBoxBox; private System.Windows.Forms.Button buttonVideoChooseStandardRes; private System.Windows.Forms.ContextMenuStrip contextMenuStripRes; @@ -1152,5 +1179,7 @@ namespace Nikse.SubtitleEdit.Forms private System.Windows.Forms.Button buttonCutFrom; private System.Windows.Forms.ContextMenuStrip contextMenuStripGenerate; private System.Windows.Forms.ToolStripMenuItem promptParameterBeforeGenerateToolStripMenuItem; + private System.Windows.Forms.Label labelPreviewPleaseWait; + private Controls.VideoPlayerContainer videoPlayerContainer1; } } \ No newline at end of file diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.cs b/src/ui/Forms/GenerateVideoWithHardSubs.cs index 5c12d3dd3..2853402ad 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.cs @@ -11,6 +11,7 @@ using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Windows.Forms; +using Nikse.SubtitleEdit.Logic.VideoPlayers; namespace Nikse.SubtitleEdit.Forms { @@ -29,6 +30,8 @@ namespace Nikse.SubtitleEdit.Forms private readonly bool _isAssa; private readonly FfmpegMediaInfo _mediaInfo; private bool _promptFFmpegParameters; + private readonly bool _mpvOn; + private readonly string _mpvSubtitleFileName; public string VideoFileName { get; private set; } public long MillisecondsEncoding { get; private set; } @@ -40,9 +43,10 @@ namespace Nikse.SubtitleEdit.Forms _loading = true; _videoInfo = videoInfo; - Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.Title; _assaSubtitle = new Subtitle(assaSubtitle); _inputVideoFileName = inputVideoFileName; + + Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.Title; buttonGenerate.Text = LanguageSettings.Current.Watermark.Generate; labelPleaseWait.Text = LanguageSettings.Current.General.PleaseWait; labelResolution.Text = LanguageSettings.Current.SubStationAlphaProperties.Resolution; @@ -110,7 +114,7 @@ namespace Nikse.SubtitleEdit.Forms labelInfo.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.InfoAssaOff; checkBoxRightToLeft.Left = left; checkBoxAlignRight.Left = left; - checkBoxBox.Left = left; + checkBoxBox.Left = numericUpDownFontSize.Right + 12; var audioLeft = Math.Max(Math.Max(labelAudioEnc.Left + labelAudioEnc.Width, labelAudioSampleRate.Left + labelAudioSampleRate.Width), labelAudioBitRate.Left + labelAudioBitRate.Width) + 5; comboBoxAudioEnc.Left = audioLeft; @@ -231,6 +235,17 @@ namespace Nikse.SubtitleEdit.Forms { groupBoxCut.Visible = false; } + + _mpvOn = LibMpvDynamic.IsInstalled && Configuration.Settings.General.VideoPlayer == "MPV"; + _mpvSubtitleFileName = GetAssaFileName(_inputVideoFileName); + if (_mpvOn) + { + buttonPreview.Visible = false; + } + else + { + videoPlayerContainer1.Visible = false; + } } private void buttonCancel_Click(object sender, EventArgs e) @@ -504,15 +519,17 @@ namespace Nikse.SubtitleEdit.Forms private void FixRightToLeft(Subtitle subtitle) { - if (checkBoxRightToLeft.Checked) + if (!checkBoxRightToLeft.Checked) { - for (var index = 0; index < subtitle.Paragraphs.Count; index++) + return; + } + + for (var index = 0; index < subtitle.Paragraphs.Count; index++) + { + var paragraph = subtitle.Paragraphs[index]; + if (LanguageAutoDetect.ContainsRightToLeftLetter(paragraph.Text)) { - var paragraph = subtitle.Paragraphs[index]; - if (LanguageAutoDetect.ContainsRightToLeftLetter(paragraph.Text)) - { - paragraph.Text = Utilities.FixRtlViaUnicodeChars(paragraph.Text); - } + paragraph.Text = Utilities.FixRtlViaUnicodeChars(paragraph.Text); } } } @@ -648,7 +665,7 @@ namespace Nikse.SubtitleEdit.Forms private void RunOnePassEncoding(string assaTempFileName) { - var process = GetFfmpegProcess(_inputVideoFileName, VideoFileName, assaTempFileName, null); + var process = GetFfmpegProcess(_inputVideoFileName, VideoFileName, assaTempFileName); _log.AppendLine("ffmpeg arguments: " + process.StartInfo.Arguments); if (!CheckForPromptParameters(process, Text)) @@ -761,6 +778,8 @@ namespace Nikse.SubtitleEdit.Forms { numericUpDownWidth.Value++; } + + UpdateVideoPreview(); } private void numericUpDownHeight_ValueChanged(object sender, EventArgs e) @@ -770,6 +789,8 @@ namespace Nikse.SubtitleEdit.Forms { numericUpDownHeight.Value++; } + + UpdateVideoPreview(); } private void comboBoxAudioEnc_SelectedIndexChanged(object sender, EventArgs e) @@ -870,6 +891,8 @@ namespace Nikse.SubtitleEdit.Forms Configuration.Settings.Tools.GenVideoNonAssaAlignRight = checkBoxAlignRight.Checked; Configuration.Settings.Tools.GenVideoNonAssaFixRtlUnicode = checkBoxRightToLeft.Checked; + CloseVideo(); + using (var graphics = CreateGraphics()) { using (var font = new Font(UiUtil.GetDefaultFont().FontFamily, (float)numericUpDownFontSize.Value, FontStyle.Regular)) @@ -1193,9 +1216,36 @@ namespace Nikse.SubtitleEdit.Forms _loading = false; UiUtil.FixFonts(groupBoxSettings, 2000); + if (_mpvOn) + { + SavePreviewSubtitle(); + UiUtil.InitializeVideoPlayerAndContainer(_inputVideoFileName, _videoInfo, videoPlayerContainer1, VideoStartLoaded, VideoStartEnded); + } + buttonGenerate.Focus(); } + private void VideoStartEnded(object sender, EventArgs e) + { + videoPlayerContainer1.Pause(); + } + + private void VideoStartLoaded(object sender, EventArgs e) + { + videoPlayerContainer1.Pause(); + if (videoPlayerContainer1.VideoPlayer is LibMpvDynamic libmpv) + { + libmpv.LoadSubtitle(_mpvSubtitleFileName); + } + + if (_assaSubtitle?.Paragraphs.Count > 0) + { + videoPlayerContainer1.CurrentPosition = _assaSubtitle.Paragraphs[0].StartTime.TotalSeconds + 0.1; + } + + //videoPlayerContainer1.ShowFullscreenButton = true; //TODO: Add full screen? + } + private void checkBoxTargetFileSize_CheckedChanged(object sender, EventArgs e) { if (checkBoxTargetFileSize.Checked) @@ -1217,6 +1267,26 @@ namespace Nikse.SubtitleEdit.Forms { buttonPreview.Enabled = false; labelPreviewPleaseWait.Visible = true; + + if (LibMpvDynamic.IsInstalled && Configuration.Settings.General.VideoPlayer == "MPV") + { + var temp = new Subtitle(_assaSubtitle); + if (!_isAssa) + { + SetStyleForNonAssa(temp); + } + FixRightToLeft(temp); + var subFileName = GetAssaFileName(_inputVideoFileName); + FileUtil.WriteAllText(subFileName, new AdvancedSubStationAlpha().ToText(temp, null), new TextEncoding(Encoding.UTF8, "UTF8")); + + using (var form = new PreviewVideo(_inputVideoFileName, subFileName, _assaSubtitle)) + { + form.ShowDialog(this); + } + + return; + } + Cursor = Cursors.WaitCursor; // generate blank video @@ -1339,7 +1409,7 @@ namespace Nikse.SubtitleEdit.Forms style.ShadowWidth = 5; } - sub.Header = AdvancedSubStationAlpha.GetHeaderAndStylesFromAdvancedSubStationAlpha(sub.Header, new System.Collections.Generic.List() { style }); + sub.Header = AdvancedSubStationAlpha.GetHeaderAndStylesFromAdvancedSubStationAlpha(sub.Header, new List { style }); sub.Header = AdvancedSubStationAlpha.AddTagToHeader("PlayResX", "PlayResX: " + ((int)numericUpDownWidth.Value).ToString(CultureInfo.InvariantCulture), "[Script Info]", sub.Header); sub.Header = AdvancedSubStationAlpha.AddTagToHeader("PlayResY", "PlayResY: " + ((int)numericUpDownHeight.Value).ToString(CultureInfo.InvariantCulture), "[Script Info]", sub.Header); } @@ -1489,5 +1559,73 @@ namespace Nikse.SubtitleEdit.Forms _promptFFmpegParameters = true; buttonGenerate_Click(null, null); } + + private void numericUpDownFontSize_ValueChanged(object sender, EventArgs e) + { + UpdateVideoPreview(); + } + + private void UpdateVideoPreview() + { + if (_loading) + { + return; + } + + if (videoPlayerContainer1.VideoPlayer is LibMpvDynamic libmpv) + { + SavePreviewSubtitle(); + libmpv.ReloadSubtitle(); + } + } + + private void SavePreviewSubtitle() + { + var temp = new Subtitle(_assaSubtitle); + if (!_isAssa) + { + SetStyleForNonAssa(temp); + } + + FixRightToLeft(temp); + FileUtil.WriteAllText(_mpvSubtitleFileName, new AdvancedSubStationAlpha().ToText(temp, null), new TextEncoding(Encoding.UTF8, "UTF8")); + } + + private void checkBoxBox_CheckedChanged(object sender, EventArgs e) + { + UpdateVideoPreview(); + } + + private void comboBoxSubtitleFont_SelectedValueChanged(object sender, EventArgs e) + { + UpdateVideoPreview(); + } + + private void checkBoxRightToLeft_CheckedChanged(object sender, EventArgs e) + { + UpdateVideoPreview(); + } + + private void checkBoxAlignRight_CheckedChanged(object sender, EventArgs e) + { + UpdateVideoPreview(); + } + + private void CloseVideo() + { + if (!_mpvOn) + { + return; + } + + Application.DoEvents(); + if (videoPlayerContainer1.VideoPlayer != null) + { + videoPlayerContainer1.Pause(); + videoPlayerContainer1.VideoPlayer.DisposeVideoPlayer(); + videoPlayerContainer1.VideoPlayer = null; + } + Application.DoEvents(); + } } } diff --git a/src/ui/Forms/Main.Designer.cs b/src/ui/Forms/Main.Designer.cs index 2ddc972bf..968970783 100644 --- a/src/ui/Forms/Main.Designer.cs +++ b/src/ui/Forms/Main.Designer.cs @@ -40,9 +40,9 @@ namespace Nikse.SubtitleEdit.Forms { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main)); + Nikse.SubtitleEdit.Core.Common.TimeCode timeCode3 = new Nikse.SubtitleEdit.Core.Common.TimeCode(); Nikse.SubtitleEdit.Core.Common.TimeCode timeCode1 = new Nikse.SubtitleEdit.Core.Common.TimeCode(); Nikse.SubtitleEdit.Core.Common.TimeCode timeCode2 = new Nikse.SubtitleEdit.Core.Common.TimeCode(); - Nikse.SubtitleEdit.Core.Common.TimeCode timeCode3 = new Nikse.SubtitleEdit.Core.Common.TimeCode(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.labelStatus = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripSelected = new System.Windows.Forms.ToolStripStatusLabel(); @@ -62,8 +62,8 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripButtonVisualSync = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonBurnIn = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonSpellCheck = new System.Windows.Forms.ToolStripButton(); - this.toolStripButtonXProperties = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonAssStyleManager = new System.Windows.Forms.ToolStripButton(); + this.toolStripButtonXProperties = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonAssProperties = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonAssAttachments = new System.Windows.Forms.ToolStripButton(); this.toolStripButtonAssaDraw = new System.Windows.Forms.ToolStripButton(); @@ -282,6 +282,7 @@ namespace Nikse.SubtitleEdit.Forms this.contextMenuStripListView = new System.Windows.Forms.ContextMenuStrip(this.components); this.setStylesForSelectedLinesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.setActorForSelectedLinesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItemSetLayer = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemAssaTools = new System.Windows.Forms.ToolStripMenuItem(); this.applyCustomStylesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.setPositionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -293,8 +294,9 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripSeparatorAssa = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItemSetRegion = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemSetLanguage = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItemWebVttStyle = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemWebVTT = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItemPreview = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuWebVttBrowserPreview = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemDelete = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemInsertBefore = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemInsertAfter = new System.Windows.Forms.ToolStripMenuItem(); @@ -318,6 +320,7 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripMenuItemMergeDialog = new System.Windows.Forms.ToolStripMenuItem(); this.mergeBeforeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.mergeAfterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator4Extend = new System.Windows.Forms.ToolStripSeparator(); this.extendBeforeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.extendAfterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator(); @@ -357,7 +360,6 @@ namespace Nikse.SubtitleEdit.Forms this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); this.groupBoxVideo = new System.Windows.Forms.GroupBox(); this.labelNextWord = new System.Windows.Forms.Label(); - this.audioVisualizer = new Nikse.SubtitleEdit.Controls.AudioVisualizer(); this.checkBoxSyncListViewWithVideoWhilePlaying = new System.Windows.Forms.CheckBox(); this.labelVideoInfo = new System.Windows.Forms.Label(); this.trackBarWaveformPosition = new System.Windows.Forms.TrackBar(); @@ -393,7 +395,6 @@ namespace Nikse.SubtitleEdit.Forms this.buttonPlayCurrent = new System.Windows.Forms.Button(); this.buttonPlayNext = new System.Windows.Forms.Button(); this.tabPageCreate = new System.Windows.Forms.TabPage(); - this.timeUpDownVideoPosition = new Nikse.SubtitleEdit.Controls.TimeUpDown(); this.buttonGotoSub = new System.Windows.Forms.Button(); this.buttonBeforeText = new System.Windows.Forms.Button(); this.buttonSetEnd = new System.Windows.Forms.Button(); @@ -411,7 +412,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelVideoPosition = new System.Windows.Forms.Label(); this.buttonSecBack1 = new System.Windows.Forms.Button(); this.tabPageAdjust = new System.Windows.Forms.TabPage(); - this.timeUpDownVideoPositionAdjust = new Nikse.SubtitleEdit.Controls.TimeUpDown(); this.buttonAdjustSetEndTime = new System.Windows.Forms.Button(); this.buttonSetEndAndGoToNext = new System.Windows.Forms.Button(); this.buttonSetStartAndOffsetRest = new System.Windows.Forms.Button(); @@ -464,12 +464,12 @@ namespace Nikse.SubtitleEdit.Forms this.splitContainerMain = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainerListViewAndText = new System.Windows.Forms.SplitContainer(); - this.SubtitleListview1 = new Nikse.SubtitleEdit.Controls.SubtitleListView(); this.imageListBookmarks = new System.Windows.Forms.ImageList(this.components); this.groupBoxEdit = new System.Windows.Forms.GroupBox(); + this.numericUpDownLayer = new System.Windows.Forms.NumericUpDown(); + this.labelLayer = new System.Windows.Forms.Label(); this.panelBookmark = new System.Windows.Forms.Panel(); this.labelBookmark = new System.Windows.Forms.Label(); - this.textBoxListViewText = new Nikse.SubtitleEdit.Controls.SETextBox(); this.contextMenuStripTextBoxListView = new System.Windows.Forms.ContextMenuStrip(this.components); this.toolStripSeparatorSpellCheckSuggestions = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItemSpellCheckSkipOnce = new System.Windows.Forms.ToolStripMenuItem(); @@ -531,13 +531,11 @@ namespace Nikse.SubtitleEdit.Forms this.labelTextOriginalLineLengths = new System.Windows.Forms.Label(); this.labelOriginalText = new System.Windows.Forms.Label(); this.labelText = new System.Windows.Forms.Label(); - this.textBoxListViewTextOriginal = new Nikse.SubtitleEdit.Controls.SETextBox(); this.buttonAutoBreak = new System.Windows.Forms.Button(); this.labelTextLineLengths = new System.Windows.Forms.Label(); this.labelTextLineTotal = new System.Windows.Forms.Label(); this.labelCharactersPerSecond = new System.Windows.Forms.Label(); this.buttonUnBreak = new System.Windows.Forms.Button(); - this.timeUpDownStartTime = new Nikse.SubtitleEdit.Controls.TimeUpDown(); this.numericUpDownDuration = new System.Windows.Forms.NumericUpDown(); this.buttonPrevious = new System.Windows.Forms.Button(); this.buttonNext = new System.Windows.Forms.Button(); @@ -565,15 +563,21 @@ namespace Nikse.SubtitleEdit.Forms this.startOfLefttorightOverrideLROToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.startOfRighttoleftOverrideRLOToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.panelVideoPlayer = new System.Windows.Forms.Panel(); - this.mediaPlayer = new Nikse.SubtitleEdit.Controls.VideoPlayerContainer(); this.contextMenuStripEmpty = new System.Windows.Forms.ContextMenuStrip(this.components); this.insertLineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aSSStylesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.imageListPlayRate = new System.Windows.Forms.ImageList(this.components); this.timerTextUndo = new System.Windows.Forms.Timer(this.components); this.timerOriginalTextUndo = new System.Windows.Forms.Timer(this.components); this.contextMenuStripShowVideoControls = new System.Windows.Forms.ContextMenuStrip(this.components); this.toolStripMenuItemShowVideoControls = new System.Windows.Forms.ToolStripMenuItem(); + this.SubtitleListview1 = new Nikse.SubtitleEdit.Controls.SubtitleListView(); + this.textBoxListViewText = new Nikse.SubtitleEdit.Controls.SETextBox(); + this.textBoxListViewTextOriginal = new Nikse.SubtitleEdit.Controls.SETextBox(); + this.timeUpDownStartTime = new Nikse.SubtitleEdit.Controls.TimeUpDown(); + this.mediaPlayer = new Nikse.SubtitleEdit.Controls.VideoPlayerContainer(); + this.audioVisualizer = new Nikse.SubtitleEdit.Controls.AudioVisualizer(); + this.timeUpDownVideoPosition = new Nikse.SubtitleEdit.Controls.TimeUpDown(); + this.timeUpDownVideoPositionAdjust = new Nikse.SubtitleEdit.Controls.TimeUpDown(); this.statusStrip1.SuspendLayout(); this.toolStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); @@ -608,6 +612,7 @@ namespace Nikse.SubtitleEdit.Forms this.splitContainerListViewAndText.Panel2.SuspendLayout(); this.splitContainerListViewAndText.SuspendLayout(); this.groupBoxEdit.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLayer)).BeginInit(); this.panelBookmark.SuspendLayout(); this.contextMenuStripTextBoxListView.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxBookmark)).BeginInit(); @@ -687,8 +692,8 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripButtonVisualSync, this.toolStripButtonBurnIn, this.toolStripButtonSpellCheck, - this.toolStripButtonXProperties, this.toolStripButtonAssStyleManager, + this.toolStripButtonXProperties, this.toolStripButtonAssProperties, this.toolStripButtonAssAttachments, this.toolStripButtonAssaDraw, @@ -866,18 +871,6 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripButtonSpellCheck.Text = "Spell check"; this.toolStripButtonSpellCheck.Click += new System.EventHandler(this.SpellCheckToolStripMenuItemClick); // - // toolStripButtonXProperties - // - this.toolStripButtonXProperties.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; - this.toolStripButtonXProperties.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); - this.toolStripButtonXProperties.Image = global::Nikse.SubtitleEdit.Properties.Resources.itt; - this.toolStripButtonXProperties.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; - this.toolStripButtonXProperties.ImageTransparentColor = System.Drawing.Color.Magenta; - this.toolStripButtonXProperties.Name = "toolStripButtonXProperties"; - this.toolStripButtonXProperties.Size = new System.Drawing.Size(36, 37); - this.toolStripButtonXProperties.Text = "Properties"; - this.toolStripButtonXProperties.Click += new System.EventHandler(this.toolStripMenuItemFileFormatProperties_Click); - // // toolStripButtonAssStyleManager // this.toolStripButtonAssStyleManager.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; @@ -891,6 +884,18 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripButtonAssStyleManager.Visible = false; this.toolStripButtonAssStyleManager.Click += new System.EventHandler(this.toolStripButtonAssStyleManager_Click); // + // toolStripButtonXProperties + // + this.toolStripButtonXProperties.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButtonXProperties.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.toolStripButtonXProperties.Image = global::Nikse.SubtitleEdit.Properties.Resources.itt; + this.toolStripButtonXProperties.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; + this.toolStripButtonXProperties.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButtonXProperties.Name = "toolStripButtonXProperties"; + this.toolStripButtonXProperties.Size = new System.Drawing.Size(36, 37); + this.toolStripButtonXProperties.Text = "Properties"; + this.toolStripButtonXProperties.Click += new System.EventHandler(this.toolStripMenuItemFileFormatProperties_Click); + // // toolStripButtonAssProperties // this.toolStripButtonAssProperties.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; @@ -2659,13 +2664,15 @@ namespace Nikse.SubtitleEdit.Forms this.contextMenuStripListView.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.setStylesForSelectedLinesToolStripMenuItem, this.setActorForSelectedLinesToolStripMenuItem, + this.toolStripMenuItemSetLayer, this.toolStripMenuItemAssaTools, this.toolStripMenuItemAssStyles, this.toolStripSeparatorAssa, this.toolStripMenuItemSetRegion, this.toolStripMenuItemSetLanguage, + this.toolStripMenuItemWebVttStyle, this.toolStripMenuItemWebVTT, - this.toolStripMenuItemPreview, + this.toolStripMenuWebVttBrowserPreview, this.toolStripMenuItemDelete, this.toolStripMenuItemInsertBefore, this.toolStripMenuItemInsertAfter, @@ -2680,6 +2687,7 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripMenuItemMergeDialog, this.mergeBeforeToolStripMenuItem, this.mergeAfterToolStripMenuItem, + this.toolStripSeparator4Extend, this.extendBeforeToolStripMenuItem, this.extendAfterToolStripMenuItem, this.toolStripSeparator8, @@ -2696,7 +2704,7 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripMenuItemSelectedLines, this.toolStripMenuItemGoogleMicrosoftTranslateSelLine}); this.contextMenuStripListView.Name = "contextMenuStripListView"; - this.contextMenuStripListView.Size = new System.Drawing.Size(285, 776); + this.contextMenuStripListView.Size = new System.Drawing.Size(285, 826); this.contextMenuStripListView.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.MenuClosed); this.contextMenuStripListView.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripListViewOpening); this.contextMenuStripListView.Opened += new System.EventHandler(this.MenuOpened); @@ -2713,6 +2721,12 @@ namespace Nikse.SubtitleEdit.Forms this.setActorForSelectedLinesToolStripMenuItem.Size = new System.Drawing.Size(284, 22); this.setActorForSelectedLinesToolStripMenuItem.Text = "Set actor"; // + // toolStripMenuItemSetLayer + // + this.toolStripMenuItemSetLayer.Name = "toolStripMenuItemSetLayer"; + this.toolStripMenuItemSetLayer.Size = new System.Drawing.Size(284, 22); + this.toolStripMenuItemSetLayer.Text = "Set layer"; + // // toolStripMenuItemAssaTools // this.toolStripMenuItemAssaTools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -2792,18 +2806,25 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripMenuItemSetLanguage.Size = new System.Drawing.Size(284, 22); this.toolStripMenuItemSetLanguage.Text = "Timed text - set language"; // + // toolStripMenuItemWebVttStyle + // + this.toolStripMenuItemWebVttStyle.Name = "toolStripMenuItemWebVttStyle"; + this.toolStripMenuItemWebVttStyle.Size = new System.Drawing.Size(284, 22); + this.toolStripMenuItemWebVttStyle.Text = "WebVTT style..."; + this.toolStripMenuItemWebVttStyle.Click += new System.EventHandler(this.toolStripMenuItemWebVttStyle_Click); + // // toolStripMenuItemWebVTT // this.toolStripMenuItemWebVTT.Name = "toolStripMenuItemWebVTT"; this.toolStripMenuItemWebVTT.Size = new System.Drawing.Size(284, 22); this.toolStripMenuItemWebVTT.Text = "WebVTT voice"; // - // toolStripMenuItemPreview + // toolStripMenuWebVttBrowserPreview // - this.toolStripMenuItemPreview.Name = "toolStripMenuItemPreview"; - this.toolStripMenuItemPreview.Size = new System.Drawing.Size(284, 22); - this.toolStripMenuItemPreview.Text = "WebVTT browser preview"; - this.toolStripMenuItemPreview.Click += new System.EventHandler(this.toolStripMenuItemPreview_Click); + this.toolStripMenuWebVttBrowserPreview.Name = "toolStripMenuWebVttBrowserPreview"; + this.toolStripMenuWebVttBrowserPreview.Size = new System.Drawing.Size(284, 22); + this.toolStripMenuWebVttBrowserPreview.Text = "WebVTT browser preview"; + this.toolStripMenuWebVttBrowserPreview.Click += new System.EventHandler(this.toolStripMenuItemPreview_Click); // // toolStripMenuItemDelete // @@ -2974,6 +2995,11 @@ namespace Nikse.SubtitleEdit.Forms this.mergeAfterToolStripMenuItem.Text = "Merge with line after"; this.mergeAfterToolStripMenuItem.Click += new System.EventHandler(this.MergeAfterToolStripMenuItemClick); // + // toolStripSeparator4Extend + // + this.toolStripSeparator4Extend.Name = "toolStripSeparator4Extend"; + this.toolStripSeparator4Extend.Size = new System.Drawing.Size(281, 6); + // // extendBeforeToolStripMenuItem // this.extendBeforeToolStripMenuItem.Name = "extendBeforeToolStripMenuItem"; @@ -3269,55 +3295,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelNextWord.Text = "Next: xxx"; this.labelNextWord.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // audioVisualizer - // - this.audioVisualizer.AllowDrop = true; - this.audioVisualizer.AllowNewSelection = true; - this.audioVisualizer.AllowOverlap = false; - this.audioVisualizer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.audioVisualizer.BackColor = System.Drawing.Color.Black; - this.audioVisualizer.BackgroundColor = System.Drawing.Color.Black; - this.audioVisualizer.Chapters = null; - this.audioVisualizer.ChaptersColor = System.Drawing.Color.Empty; - this.audioVisualizer.ClosenessForBorderSelection = 15; - this.audioVisualizer.Color = System.Drawing.Color.GreenYellow; - this.audioVisualizer.CursorColor = System.Drawing.Color.Empty; - this.audioVisualizer.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); - this.audioVisualizer.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(155)))), ((int)(((byte)(155))))); - this.audioVisualizer.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(18))))); - this.audioVisualizer.InsertAtVideoPositionShortcut = System.Windows.Forms.Keys.Insert; - this.audioVisualizer.Location = new System.Drawing.Point(472, 32); - this.audioVisualizer.Margin = new System.Windows.Forms.Padding(0); - this.audioVisualizer.MouseWheelScrollUpIsForward = true; - this.audioVisualizer.Move100MsLeft = System.Windows.Forms.Keys.None; - this.audioVisualizer.Move100MsRight = System.Windows.Forms.Keys.None; - this.audioVisualizer.MoveOneSecondLeft = System.Windows.Forms.Keys.None; - this.audioVisualizer.MoveOneSecondRight = System.Windows.Forms.Keys.None; - this.audioVisualizer.Name = "audioVisualizer"; - this.audioVisualizer.NewSelectionParagraph = null; - this.audioVisualizer.ParagraphColor = System.Drawing.Color.LimeGreen; - this.audioVisualizer.SelectedColor = System.Drawing.Color.Red; - this.audioVisualizer.ShotChanges = ((System.Collections.Generic.List)(resources.GetObject("audioVisualizer.ShotChanges"))); - this.audioVisualizer.ShowGridLines = true; - this.audioVisualizer.ShowSpectrogram = false; - this.audioVisualizer.ShowWaveform = true; - this.audioVisualizer.Size = new System.Drawing.Size(499, 229); - this.audioVisualizer.StartPositionSeconds = 0D; - this.audioVisualizer.TabIndex = 6; - this.audioVisualizer.TextBold = true; - this.audioVisualizer.TextColor = System.Drawing.Color.Gray; - this.audioVisualizer.TextSize = 9F; - this.audioVisualizer.VerticalZoomFactor = 1D; - this.audioVisualizer.WaveformNotLoadedText = "Click to add waveform"; - this.audioVisualizer.WavePeaks = null; - this.audioVisualizer.ZoomFactor = 1D; - this.audioVisualizer.Click += new System.EventHandler(this.AudioWaveform_Click); - this.audioVisualizer.DragDrop += new System.Windows.Forms.DragEventHandler(this.AudioWaveformDragDrop); - this.audioVisualizer.DragEnter += new System.Windows.Forms.DragEventHandler(this.AudioWaveformDragEnter); - this.audioVisualizer.MouseEnter += new System.EventHandler(this.audioVisualizer_MouseEnter); - // // checkBoxSyncListViewWithVideoWhilePlaying // this.checkBoxSyncListViewWithVideoWhilePlaying.AutoSize = true; @@ -3358,7 +3335,7 @@ namespace Nikse.SubtitleEdit.Forms this.panelWaveformControls.Controls.Add(this.toolStripWaveControls); this.panelWaveformControls.Location = new System.Drawing.Point(474, 265); this.panelWaveformControls.Name = "panelWaveformControls"; - this.panelWaveformControls.Size = new System.Drawing.Size(205, 30); + this.panelWaveformControls.Size = new System.Drawing.Size(212, 30); this.panelWaveformControls.TabIndex = 10; // // toolStripWaveControls @@ -3385,6 +3362,7 @@ namespace Nikse.SubtitleEdit.Forms // this.toolStripButtonWaveformZoomOut.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonWaveformZoomOut.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonWaveformZoomOut.Image"))); + this.toolStripButtonWaveformZoomOut.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.toolStripButtonWaveformZoomOut.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonWaveformZoomOut.Name = "toolStripButtonWaveformZoomOut"; this.toolStripButtonWaveformZoomOut.Size = new System.Drawing.Size(23, 22); @@ -3402,6 +3380,7 @@ namespace Nikse.SubtitleEdit.Forms // this.toolStripButtonWaveformZoomIn.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonWaveformZoomIn.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonWaveformZoomIn.Image"))); + this.toolStripButtonWaveformZoomIn.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.toolStripButtonWaveformZoomIn.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonWaveformZoomIn.Name = "toolStripButtonWaveformZoomIn"; this.toolStripButtonWaveformZoomIn.Size = new System.Drawing.Size(23, 22); @@ -3418,6 +3397,7 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripButtonWaveformPause.AutoToolTip = false; this.toolStripButtonWaveformPause.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonWaveformPause.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonWaveformPause.Image"))); + this.toolStripButtonWaveformPause.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.toolStripButtonWaveformPause.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonWaveformPause.Name = "toolStripButtonWaveformPause"; this.toolStripButtonWaveformPause.Size = new System.Drawing.Size(23, 22); @@ -3430,6 +3410,7 @@ namespace Nikse.SubtitleEdit.Forms this.toolStripButtonWaveformPlay.AutoToolTip = false; this.toolStripButtonWaveformPlay.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonWaveformPlay.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonWaveformPlay.Image"))); + this.toolStripButtonWaveformPlay.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.toolStripButtonWaveformPlay.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonWaveformPlay.Name = "toolStripButtonWaveformPlay"; this.toolStripButtonWaveformPlay.Size = new System.Drawing.Size(23, 22); @@ -3440,6 +3421,7 @@ namespace Nikse.SubtitleEdit.Forms // this.toolStripButtonLockCenter.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButtonLockCenter.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButtonLockCenter.Image"))); + this.toolStripButtonLockCenter.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.toolStripButtonLockCenter.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripButtonLockCenter.Name = "toolStripButtonLockCenter"; this.toolStripButtonLockCenter.Size = new System.Drawing.Size(23, 22); @@ -3450,6 +3432,7 @@ namespace Nikse.SubtitleEdit.Forms // this.toolStripSplitButtonPlayRate.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripSplitButtonPlayRate.Image = ((System.Drawing.Image)(resources.GetObject("toolStripSplitButtonPlayRate.Image"))); + this.toolStripSplitButtonPlayRate.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None; this.toolStripSplitButtonPlayRate.ImageTransparentColor = System.Drawing.Color.Magenta; this.toolStripSplitButtonPlayRate.Name = "toolStripSplitButtonPlayRate"; this.toolStripSplitButtonPlayRate.Size = new System.Drawing.Size(32, 22); @@ -3742,28 +3725,6 @@ namespace Nikse.SubtitleEdit.Forms this.tabPageCreate.Text = "Create"; this.tabPageCreate.UseVisualStyleBackColor = true; // - // timeUpDownVideoPosition - // - this.timeUpDownVideoPosition.AutoSize = true; - this.timeUpDownVideoPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.timeUpDownVideoPosition.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); - this.timeUpDownVideoPosition.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); - this.timeUpDownVideoPosition.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(155)))), ((int)(((byte)(155))))); - this.timeUpDownVideoPosition.Location = new System.Drawing.Point(90, 190); - this.timeUpDownVideoPosition.Margin = new System.Windows.Forms.Padding(4); - this.timeUpDownVideoPosition.Name = "timeUpDownVideoPosition"; - this.timeUpDownVideoPosition.Size = new System.Drawing.Size(113, 27); - this.timeUpDownVideoPosition.TabIndex = 12; - timeCode1.Hours = 0; - timeCode1.Milliseconds = 0; - timeCode1.Minutes = 0; - timeCode1.Seconds = 0; - timeCode1.TimeSpan = System.TimeSpan.Parse("00:00:00"); - timeCode1.TotalMilliseconds = 0D; - timeCode1.TotalSeconds = 0D; - this.timeUpDownVideoPosition.TimeCode = timeCode1; - this.timeUpDownVideoPosition.UseVideoOffset = false; - // // buttonGotoSub // this.buttonGotoSub.Location = new System.Drawing.Point(6, 58); @@ -3984,28 +3945,6 @@ namespace Nikse.SubtitleEdit.Forms this.tabPageAdjust.Text = "Adjust"; this.tabPageAdjust.UseVisualStyleBackColor = true; // - // timeUpDownVideoPositionAdjust - // - this.timeUpDownVideoPositionAdjust.AutoSize = true; - this.timeUpDownVideoPositionAdjust.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.timeUpDownVideoPositionAdjust.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); - this.timeUpDownVideoPositionAdjust.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); - this.timeUpDownVideoPositionAdjust.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(155)))), ((int)(((byte)(155))))); - this.timeUpDownVideoPositionAdjust.Location = new System.Drawing.Point(90, 215); - this.timeUpDownVideoPositionAdjust.Margin = new System.Windows.Forms.Padding(4); - this.timeUpDownVideoPositionAdjust.Name = "timeUpDownVideoPositionAdjust"; - this.timeUpDownVideoPositionAdjust.Size = new System.Drawing.Size(113, 27); - this.timeUpDownVideoPositionAdjust.TabIndex = 13; - timeCode2.Hours = 0; - timeCode2.Milliseconds = 0; - timeCode2.Minutes = 0; - timeCode2.Seconds = 0; - timeCode2.TimeSpan = System.TimeSpan.Parse("00:00:00"); - timeCode2.TotalMilliseconds = 0D; - timeCode2.TotalSeconds = 0D; - this.timeUpDownVideoPositionAdjust.TimeCode = timeCode2; - this.timeUpDownVideoPositionAdjust.UseVideoOffset = false; - // // buttonAdjustSetEndTime // this.buttonAdjustSetEndTime.Location = new System.Drawing.Point(6, 84); @@ -4506,39 +4445,6 @@ namespace Nikse.SubtitleEdit.Forms this.splitContainerListViewAndText.TabIndex = 2; this.splitContainerListViewAndText.VisibleChanged += new System.EventHandler(this.ListViewVisibleChanged); // - // SubtitleListview1 - // - this.SubtitleListview1.AllowColumnReorder = true; - this.SubtitleListview1.AllowDrop = true; - this.SubtitleListview1.ContextMenuStrip = this.contextMenuStripListView; - this.SubtitleListview1.Dock = System.Windows.Forms.DockStyle.Fill; - this.SubtitleListview1.FirstVisibleIndex = -1; - this.SubtitleListview1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.SubtitleListview1.FullRowSelect = true; - this.SubtitleListview1.GridLines = true; - this.SubtitleListview1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; - this.SubtitleListview1.HideSelection = false; - this.SubtitleListview1.Location = new System.Drawing.Point(0, 0); - this.SubtitleListview1.Name = "SubtitleListview1"; - this.SubtitleListview1.OwnerDraw = true; - this.SubtitleListview1.Size = new System.Drawing.Size(740, 105); - this.SubtitleListview1.StateImageList = this.imageListBookmarks; - this.SubtitleListview1.SubtitleFontBold = false; - this.SubtitleListview1.SubtitleFontName = "Tahoma"; - this.SubtitleListview1.SubtitleFontSize = 8; - this.SubtitleListview1.TabIndex = 0; - this.SubtitleListview1.UseCompatibleStateImageBehavior = false; - this.SubtitleListview1.UseSyntaxColoring = true; - this.SubtitleListview1.View = System.Windows.Forms.View.Details; - this.SubtitleListview1.SelectedIndexChanged += new System.EventHandler(this.SubtitleListview1_SelectedIndexChanged); - this.SubtitleListview1.DragDrop += new System.Windows.Forms.DragEventHandler(this.SubtitleListview1_DragDrop); - this.SubtitleListview1.DragEnter += new System.Windows.Forms.DragEventHandler(this.SubtitleListview1_DragEnter); - this.SubtitleListview1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SubtitleListview1KeyDown); - this.SubtitleListview1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.SubtitleListview1_MouseDoubleClick); - this.SubtitleListview1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SubtitleListview1_MouseDown); - this.SubtitleListview1.MouseEnter += new System.EventHandler(this.SubtitleListview1_MouseEnter); - this.SubtitleListview1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SubtitleListview1_MouseUp); - // // imageListBookmarks // this.imageListBookmarks.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; @@ -4547,6 +4453,8 @@ namespace Nikse.SubtitleEdit.Forms // // groupBoxEdit // + this.groupBoxEdit.Controls.Add(this.numericUpDownLayer); + this.groupBoxEdit.Controls.Add(this.labelLayer); this.groupBoxEdit.Controls.Add(this.panelBookmark); this.groupBoxEdit.Controls.Add(this.textBoxListViewText); this.groupBoxEdit.Controls.Add(this.labelOriginalSingleLinePixels); @@ -4582,6 +4490,33 @@ namespace Nikse.SubtitleEdit.Forms this.groupBoxEdit.TabIndex = 1; this.groupBoxEdit.TabStop = false; // + // numericUpDownLayer + // + this.numericUpDownLayer.Location = new System.Drawing.Point(44, 113); + this.numericUpDownLayer.Maximum = new decimal(new int[] { + 2147483647, + 0, + 0, + 0}); + this.numericUpDownLayer.Minimum = new decimal(new int[] { + -2147483648, + 0, + 0, + -2147483648}); + this.numericUpDownLayer.Name = "numericUpDownLayer"; + this.numericUpDownLayer.Size = new System.Drawing.Size(59, 20); + this.numericUpDownLayer.TabIndex = 4; + this.numericUpDownLayer.ValueChanged += new System.EventHandler(this.NumericUpDownLayer_ValueChanged); + // + // labelLayer + // + this.labelLayer.AutoSize = true; + this.labelLayer.Location = new System.Drawing.Point(9, 115); + this.labelLayer.Name = "labelLayer"; + this.labelLayer.Size = new System.Drawing.Size(33, 13); + this.labelLayer.TabIndex = 45; + this.labelLayer.Text = "Layer"; + // // panelBookmark // this.panelBookmark.BackColor = System.Drawing.Color.LemonChiffon; @@ -4603,43 +4538,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelBookmark.Text = "labelBookmark"; this.labelBookmark.DoubleClick += new System.EventHandler(this.labelBookmark_DoubleClick); // - // textBoxListViewText - // - this.textBoxListViewText.AllowDrop = true; - this.textBoxListViewText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBoxListViewText.BackColor = System.Drawing.SystemColors.WindowFrame; - this.textBoxListViewText.ContextMenuStrip = this.contextMenuStripTextBoxListView; - this.textBoxListViewText.CurrentLanguage = ""; - this.textBoxListViewText.CurrentLineIndex = 0; - this.textBoxListViewText.Enabled = false; - this.textBoxListViewText.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold); - this.textBoxListViewText.HideSelection = false; - this.textBoxListViewText.IsDictionaryDownloaded = true; - this.textBoxListViewText.IsSpellCheckerInitialized = false; - this.textBoxListViewText.IsSpellCheckRequested = false; - this.textBoxListViewText.IsWrongWord = false; - this.textBoxListViewText.LanguageChanged = false; - this.textBoxListViewText.Location = new System.Drawing.Point(184, 27); - this.textBoxListViewText.Multiline = true; - this.textBoxListViewText.Name = "textBoxListViewText"; - this.textBoxListViewText.Padding = new System.Windows.Forms.Padding(1); - this.textBoxListViewText.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Both; - this.textBoxListViewText.SelectedText = ""; - this.textBoxListViewText.SelectionLength = 0; - this.textBoxListViewText.SelectionStart = 0; - this.textBoxListViewText.Size = new System.Drawing.Size(430, 84); - this.textBoxListViewText.TabIndex = 5; - this.textBoxListViewText.TextBoxFont = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold); - this.textBoxListViewText.TextChanged += new System.EventHandler(this.TextBoxListViewTextTextChanged); - this.textBoxListViewText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxListViewTextKeyDown); - this.textBoxListViewText.MouseClick += new System.Windows.Forms.MouseEventHandler(this.TextBoxListViewTextMouseClick); - this.textBoxListViewText.Enter += new System.EventHandler(this.TextBoxListViewTextEnter); - this.textBoxListViewText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBoxListViewText_KeyUp); - this.textBoxListViewText.Leave += new System.EventHandler(this.textBoxListViewText_Leave); - this.textBoxListViewText.MouseMove += new System.Windows.Forms.MouseEventHandler(this.textBoxListViewText_MouseMove); - // // contextMenuStripTextBoxListView // this.contextMenuStripTextBoxListView.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -5150,43 +5048,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelText.TabIndex = 5; this.labelText.Text = "Text"; // - // textBoxListViewTextOriginal - // - this.textBoxListViewTextOriginal.AllowDrop = true; - this.textBoxListViewTextOriginal.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBoxListViewTextOriginal.BackColor = System.Drawing.SystemColors.WindowFrame; - this.textBoxListViewTextOriginal.ContextMenuStrip = this.contextMenuStripTextBoxListView; - this.textBoxListViewTextOriginal.CurrentLanguage = ""; - this.textBoxListViewTextOriginal.CurrentLineIndex = 0; - this.textBoxListViewTextOriginal.Enabled = false; - this.textBoxListViewTextOriginal.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold); - this.textBoxListViewTextOriginal.HideSelection = false; - this.textBoxListViewTextOriginal.IsDictionaryDownloaded = true; - this.textBoxListViewTextOriginal.IsSpellCheckerInitialized = false; - this.textBoxListViewTextOriginal.IsSpellCheckRequested = false; - this.textBoxListViewTextOriginal.IsWrongWord = false; - this.textBoxListViewTextOriginal.LanguageChanged = false; - this.textBoxListViewTextOriginal.Location = new System.Drawing.Point(946, 28); - this.textBoxListViewTextOriginal.Multiline = true; - this.textBoxListViewTextOriginal.Name = "textBoxListViewTextOriginal"; - this.textBoxListViewTextOriginal.Padding = new System.Windows.Forms.Padding(1); - this.textBoxListViewTextOriginal.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Both; - this.textBoxListViewTextOriginal.SelectedText = ""; - this.textBoxListViewTextOriginal.SelectionLength = 0; - this.textBoxListViewTextOriginal.SelectionStart = 0; - this.textBoxListViewTextOriginal.Size = new System.Drawing.Size(16, 84); - this.textBoxListViewTextOriginal.TabIndex = 33; - this.textBoxListViewTextOriginal.TextBoxFont = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold); - this.textBoxListViewTextOriginal.Visible = false; - this.textBoxListViewTextOriginal.TextChanged += new System.EventHandler(this.textBoxListViewTextOriginal_TextChanged); - this.textBoxListViewTextOriginal.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxListViewTextOriginalKeyDown); - this.textBoxListViewTextOriginal.MouseClick += new System.Windows.Forms.MouseEventHandler(this.TextBoxListViewTextOriginalMouseClick); - this.textBoxListViewTextOriginal.Enter += new System.EventHandler(this.TextBoxListViewTextOriginalEnter); - this.textBoxListViewTextOriginal.KeyUp += new System.Windows.Forms.KeyEventHandler(this.TextBoxListViewTextOriginalKeyUp); - this.textBoxListViewTextOriginal.MouseMove += new System.Windows.Forms.MouseEventHandler(this.TextBoxListViewTextOriginalMouseMove); - // // buttonAutoBreak // this.buttonAutoBreak.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -5239,28 +5100,6 @@ namespace Nikse.SubtitleEdit.Forms this.buttonUnBreak.UseVisualStyleBackColor = true; this.buttonUnBreak.Click += new System.EventHandler(this.ButtonUnBreakClick); // - // timeUpDownStartTime - // - this.timeUpDownStartTime.AutoSize = true; - this.timeUpDownStartTime.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.timeUpDownStartTime.BackColor = System.Drawing.SystemColors.Control; - this.timeUpDownStartTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); - this.timeUpDownStartTime.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(155)))), ((int)(((byte)(155))))); - this.timeUpDownStartTime.Location = new System.Drawing.Point(8, 26); - this.timeUpDownStartTime.Margin = new System.Windows.Forms.Padding(4); - this.timeUpDownStartTime.Name = "timeUpDownStartTime"; - this.timeUpDownStartTime.Size = new System.Drawing.Size(113, 27); - this.timeUpDownStartTime.TabIndex = 0; - timeCode3.Hours = 0; - timeCode3.Milliseconds = 0; - timeCode3.Minutes = 0; - timeCode3.Seconds = 0; - timeCode3.TimeSpan = System.TimeSpan.Parse("00:00:00"); - timeCode3.TotalMilliseconds = 0D; - timeCode3.TotalSeconds = 0D; - this.timeUpDownStartTime.TimeCode = timeCode3; - this.timeUpDownStartTime.UseVideoOffset = false; - // // numericUpDownDuration // this.numericUpDownDuration.DecimalPlaces = 3; @@ -5519,6 +5358,183 @@ namespace Nikse.SubtitleEdit.Forms this.panelVideoPlayer.Size = new System.Drawing.Size(220, 246); this.panelVideoPlayer.TabIndex = 5; // + // contextMenuStripEmpty + // + this.contextMenuStripEmpty.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.insertLineToolStripMenuItem, + this.toolStripMenuItemEmptyGoToSourceView, + this.aSSStylesToolStripMenuItem}); + this.contextMenuStripEmpty.Name = "contextMenuStripEmpty"; + this.contextMenuStripEmpty.Size = new System.Drawing.Size(169, 70); + this.contextMenuStripEmpty.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripEmpty_Opening); + // + // insertLineToolStripMenuItem + // + this.insertLineToolStripMenuItem.Name = "insertLineToolStripMenuItem"; + this.insertLineToolStripMenuItem.Size = new System.Drawing.Size(168, 22); + this.insertLineToolStripMenuItem.Text = "Insert line"; + this.insertLineToolStripMenuItem.Click += new System.EventHandler(this.InsertLineToolStripMenuItemClick); + // + // aSSStylesToolStripMenuItem + // + this.aSSStylesToolStripMenuItem.Name = "aSSStylesToolStripMenuItem"; + this.aSSStylesToolStripMenuItem.Size = new System.Drawing.Size(168, 22); + this.aSSStylesToolStripMenuItem.Text = "ASS styles..."; + this.aSSStylesToolStripMenuItem.Click += new System.EventHandler(this.aSSStylesToolStripMenuItem_Click); + // + // timerTextUndo + // + this.timerTextUndo.Interval = 700; + this.timerTextUndo.Tick += new System.EventHandler(this.TimerTextUndoTick); + // + // timerOriginalTextUndo + // + this.timerOriginalTextUndo.Interval = 700; + this.timerOriginalTextUndo.Tick += new System.EventHandler(this.TimerOriginalTextUndoTick); + // + // contextMenuStripShowVideoControls + // + this.contextMenuStripShowVideoControls.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripMenuItemShowVideoControls}); + this.contextMenuStripShowVideoControls.Name = "contextMenuStripVideoControls"; + this.contextMenuStripShowVideoControls.Size = new System.Drawing.Size(182, 26); + // + // toolStripMenuItemShowVideoControls + // + this.toolStripMenuItemShowVideoControls.Name = "toolStripMenuItemShowVideoControls"; + this.toolStripMenuItemShowVideoControls.Size = new System.Drawing.Size(181, 22); + this.toolStripMenuItemShowVideoControls.Text = "Show video controls"; + this.toolStripMenuItemShowVideoControls.Click += new System.EventHandler(this.toolStripMenuItemShowVideoControls_Click); + // + // SubtitleListview1 + // + this.SubtitleListview1.AllowColumnReorder = true; + this.SubtitleListview1.AllowDrop = true; + this.SubtitleListview1.ContextMenuStrip = this.contextMenuStripListView; + this.SubtitleListview1.Dock = System.Windows.Forms.DockStyle.Fill; + this.SubtitleListview1.FirstVisibleIndex = -1; + this.SubtitleListview1.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.SubtitleListview1.FullRowSelect = true; + this.SubtitleListview1.GridLines = true; + this.SubtitleListview1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this.SubtitleListview1.HideSelection = false; + this.SubtitleListview1.Location = new System.Drawing.Point(0, 0); + this.SubtitleListview1.Name = "SubtitleListview1"; + this.SubtitleListview1.OwnerDraw = true; + this.SubtitleListview1.Size = new System.Drawing.Size(740, 105); + this.SubtitleListview1.StateImageList = this.imageListBookmarks; + this.SubtitleListview1.SubtitleFontBold = false; + this.SubtitleListview1.SubtitleFontName = "Tahoma"; + this.SubtitleListview1.SubtitleFontSize = 8; + this.SubtitleListview1.TabIndex = 0; + this.SubtitleListview1.UseCompatibleStateImageBehavior = false; + this.SubtitleListview1.UseSyntaxColoring = true; + this.SubtitleListview1.View = System.Windows.Forms.View.Details; + this.SubtitleListview1.SelectedIndexChanged += new System.EventHandler(this.SubtitleListview1_SelectedIndexChanged); + this.SubtitleListview1.DragDrop += new System.Windows.Forms.DragEventHandler(this.SubtitleListview1_DragDrop); + this.SubtitleListview1.DragEnter += new System.Windows.Forms.DragEventHandler(this.SubtitleListview1_DragEnter); + this.SubtitleListview1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.SubtitleListview1KeyDown); + this.SubtitleListview1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.SubtitleListview1_MouseDoubleClick); + this.SubtitleListview1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.SubtitleListview1_MouseDown); + this.SubtitleListview1.MouseEnter += new System.EventHandler(this.SubtitleListview1_MouseEnter); + this.SubtitleListview1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.SubtitleListview1_MouseUp); + // + // textBoxListViewText + // + this.textBoxListViewText.AllowDrop = true; + this.textBoxListViewText.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxListViewText.BackColor = System.Drawing.SystemColors.WindowFrame; + this.textBoxListViewText.ContextMenuStrip = this.contextMenuStripTextBoxListView; + this.textBoxListViewText.CurrentLanguage = ""; + this.textBoxListViewText.CurrentLineIndex = 0; + this.textBoxListViewText.Enabled = false; + this.textBoxListViewText.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold); + this.textBoxListViewText.HideSelection = false; + this.textBoxListViewText.IsDictionaryDownloaded = true; + this.textBoxListViewText.IsSpellCheckerInitialized = false; + this.textBoxListViewText.IsSpellCheckRequested = false; + this.textBoxListViewText.IsWrongWord = false; + this.textBoxListViewText.LanguageChanged = false; + this.textBoxListViewText.Location = new System.Drawing.Point(184, 27); + this.textBoxListViewText.Multiline = true; + this.textBoxListViewText.Name = "textBoxListViewText"; + this.textBoxListViewText.Padding = new System.Windows.Forms.Padding(1); + this.textBoxListViewText.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Both; + this.textBoxListViewText.SelectedText = ""; + this.textBoxListViewText.SelectionLength = 0; + this.textBoxListViewText.SelectionStart = 0; + this.textBoxListViewText.Size = new System.Drawing.Size(430, 84); + this.textBoxListViewText.TabIndex = 5; + this.textBoxListViewText.TextBoxFont = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold); + this.textBoxListViewText.TextChanged += new System.EventHandler(this.TextBoxListViewTextTextChanged); + this.textBoxListViewText.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxListViewTextKeyDown); + this.textBoxListViewText.MouseClick += new System.Windows.Forms.MouseEventHandler(this.TextBoxListViewTextMouseClick); + this.textBoxListViewText.Enter += new System.EventHandler(this.TextBoxListViewTextEnter); + this.textBoxListViewText.KeyUp += new System.Windows.Forms.KeyEventHandler(this.textBoxListViewText_KeyUp); + this.textBoxListViewText.Leave += new System.EventHandler(this.textBoxListViewText_Leave); + this.textBoxListViewText.MouseMove += new System.Windows.Forms.MouseEventHandler(this.textBoxListViewText_MouseMove); + // + // textBoxListViewTextOriginal + // + this.textBoxListViewTextOriginal.AllowDrop = true; + this.textBoxListViewTextOriginal.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.textBoxListViewTextOriginal.BackColor = System.Drawing.SystemColors.WindowFrame; + this.textBoxListViewTextOriginal.ContextMenuStrip = this.contextMenuStripTextBoxListView; + this.textBoxListViewTextOriginal.CurrentLanguage = ""; + this.textBoxListViewTextOriginal.CurrentLineIndex = 0; + this.textBoxListViewTextOriginal.Enabled = false; + this.textBoxListViewTextOriginal.Font = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold); + this.textBoxListViewTextOriginal.HideSelection = false; + this.textBoxListViewTextOriginal.IsDictionaryDownloaded = true; + this.textBoxListViewTextOriginal.IsSpellCheckerInitialized = false; + this.textBoxListViewTextOriginal.IsSpellCheckRequested = false; + this.textBoxListViewTextOriginal.IsWrongWord = false; + this.textBoxListViewTextOriginal.LanguageChanged = false; + this.textBoxListViewTextOriginal.Location = new System.Drawing.Point(946, 28); + this.textBoxListViewTextOriginal.Multiline = true; + this.textBoxListViewTextOriginal.Name = "textBoxListViewTextOriginal"; + this.textBoxListViewTextOriginal.Padding = new System.Windows.Forms.Padding(1); + this.textBoxListViewTextOriginal.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Both; + this.textBoxListViewTextOriginal.SelectedText = ""; + this.textBoxListViewTextOriginal.SelectionLength = 0; + this.textBoxListViewTextOriginal.SelectionStart = 0; + this.textBoxListViewTextOriginal.Size = new System.Drawing.Size(16, 84); + this.textBoxListViewTextOriginal.TabIndex = 33; + this.textBoxListViewTextOriginal.TextBoxFont = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Bold); + this.textBoxListViewTextOriginal.Visible = false; + this.textBoxListViewTextOriginal.TextChanged += new System.EventHandler(this.textBoxListViewTextOriginal_TextChanged); + this.textBoxListViewTextOriginal.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxListViewTextOriginalKeyDown); + this.textBoxListViewTextOriginal.MouseClick += new System.Windows.Forms.MouseEventHandler(this.TextBoxListViewTextOriginalMouseClick); + this.textBoxListViewTextOriginal.Enter += new System.EventHandler(this.TextBoxListViewTextOriginalEnter); + this.textBoxListViewTextOriginal.KeyUp += new System.Windows.Forms.KeyEventHandler(this.TextBoxListViewTextOriginalKeyUp); + this.textBoxListViewTextOriginal.MouseMove += new System.Windows.Forms.MouseEventHandler(this.TextBoxListViewTextOriginalMouseMove); + // + // timeUpDownStartTime + // + this.timeUpDownStartTime.AutoSize = true; + this.timeUpDownStartTime.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.timeUpDownStartTime.BackColor = System.Drawing.SystemColors.Control; + this.timeUpDownStartTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + this.timeUpDownStartTime.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(155)))), ((int)(((byte)(155))))); + this.timeUpDownStartTime.Location = new System.Drawing.Point(8, 26); + this.timeUpDownStartTime.Margin = new System.Windows.Forms.Padding(4); + this.timeUpDownStartTime.Name = "timeUpDownStartTime"; + this.timeUpDownStartTime.Size = new System.Drawing.Size(113, 27); + this.timeUpDownStartTime.TabIndex = 0; + timeCode3.Hours = 0; + timeCode3.Milliseconds = 0; + timeCode3.Minutes = 0; + timeCode3.Seconds = 0; + timeCode3.TimeSpan = System.TimeSpan.Parse("00:00:00"); + timeCode3.TotalMilliseconds = 0D; + timeCode3.TotalSeconds = 0D; + this.timeUpDownStartTime.TimeCode = timeCode3; + this.timeUpDownStartTime.UseVideoOffset = false; + // // mediaPlayer // this.mediaPlayer.AllowDrop = true; @@ -5548,60 +5564,98 @@ namespace Nikse.SubtitleEdit.Forms this.mediaPlayer.DragDrop += new System.Windows.Forms.DragEventHandler(this.mediaPlayer_DragDrop); this.mediaPlayer.DragEnter += new System.Windows.Forms.DragEventHandler(this.mediaPlayer_DragEnter); // - // contextMenuStripEmpty + // audioVisualizer // - this.contextMenuStripEmpty.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.insertLineToolStripMenuItem, - this.toolStripMenuItemEmptyGoToSourceView, - this.aSSStylesToolStripMenuItem}); - this.contextMenuStripEmpty.Name = "contextMenuStripEmpty"; - this.contextMenuStripEmpty.Size = new System.Drawing.Size(169, 70); - this.contextMenuStripEmpty.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripEmpty_Opening); + this.audioVisualizer.AllowDrop = true; + this.audioVisualizer.AllowNewSelection = true; + this.audioVisualizer.AllowOverlap = false; + this.audioVisualizer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.audioVisualizer.BackColor = System.Drawing.Color.Black; + this.audioVisualizer.BackgroundColor = System.Drawing.Color.Black; + this.audioVisualizer.Chapters = null; + this.audioVisualizer.ChaptersColor = System.Drawing.Color.Empty; + this.audioVisualizer.ClosenessForBorderSelection = 15; + this.audioVisualizer.Color = System.Drawing.Color.GreenYellow; + this.audioVisualizer.CursorColor = System.Drawing.Color.Empty; + this.audioVisualizer.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + this.audioVisualizer.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(155)))), ((int)(((byte)(155))))); + this.audioVisualizer.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(18))))); + this.audioVisualizer.InsertAtVideoPositionShortcut = System.Windows.Forms.Keys.Insert; + this.audioVisualizer.Location = new System.Drawing.Point(472, 32); + this.audioVisualizer.Margin = new System.Windows.Forms.Padding(0); + this.audioVisualizer.MouseWheelScrollUpIsForward = true; + this.audioVisualizer.Move100MsLeft = System.Windows.Forms.Keys.None; + this.audioVisualizer.Move100MsRight = System.Windows.Forms.Keys.None; + this.audioVisualizer.MoveOneSecondLeft = System.Windows.Forms.Keys.None; + this.audioVisualizer.MoveOneSecondRight = System.Windows.Forms.Keys.None; + this.audioVisualizer.Name = "audioVisualizer"; + this.audioVisualizer.NewSelectionParagraph = null; + this.audioVisualizer.ParagraphColor = System.Drawing.Color.LimeGreen; + this.audioVisualizer.SelectedColor = System.Drawing.Color.Red; + this.audioVisualizer.ShotChanges = ((System.Collections.Generic.List)(resources.GetObject("audioVisualizer.ShotChanges"))); + this.audioVisualizer.ShowGridLines = true; + this.audioVisualizer.ShowSpectrogram = false; + this.audioVisualizer.ShowWaveform = true; + this.audioVisualizer.Size = new System.Drawing.Size(499, 229); + this.audioVisualizer.StartPositionSeconds = 0D; + this.audioVisualizer.TabIndex = 6; + this.audioVisualizer.TextBold = true; + this.audioVisualizer.TextColor = System.Drawing.Color.Gray; + this.audioVisualizer.TextSize = 9F; + this.audioVisualizer.VerticalZoomFactor = 1D; + this.audioVisualizer.WaveformNotLoadedText = "Click to add waveform"; + this.audioVisualizer.WavePeaks = null; + this.audioVisualizer.ZoomFactor = 1D; + this.audioVisualizer.Click += new System.EventHandler(this.AudioWaveform_Click); + this.audioVisualizer.DragDrop += new System.Windows.Forms.DragEventHandler(this.AudioWaveformDragDrop); + this.audioVisualizer.DragEnter += new System.Windows.Forms.DragEventHandler(this.AudioWaveformDragEnter); + this.audioVisualizer.MouseEnter += new System.EventHandler(this.audioVisualizer_MouseEnter); // - // insertLineToolStripMenuItem + // timeUpDownVideoPosition // - this.insertLineToolStripMenuItem.Name = "insertLineToolStripMenuItem"; - this.insertLineToolStripMenuItem.Size = new System.Drawing.Size(168, 22); - this.insertLineToolStripMenuItem.Text = "Insert line"; - this.insertLineToolStripMenuItem.Click += new System.EventHandler(this.InsertLineToolStripMenuItemClick); + this.timeUpDownVideoPosition.AutoSize = true; + this.timeUpDownVideoPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.timeUpDownVideoPosition.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); + this.timeUpDownVideoPosition.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + this.timeUpDownVideoPosition.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(155)))), ((int)(((byte)(155))))); + this.timeUpDownVideoPosition.Location = new System.Drawing.Point(90, 190); + this.timeUpDownVideoPosition.Margin = new System.Windows.Forms.Padding(4); + this.timeUpDownVideoPosition.Name = "timeUpDownVideoPosition"; + this.timeUpDownVideoPosition.Size = new System.Drawing.Size(113, 27); + this.timeUpDownVideoPosition.TabIndex = 12; + timeCode1.Hours = 0; + timeCode1.Milliseconds = 0; + timeCode1.Minutes = 0; + timeCode1.Seconds = 0; + timeCode1.TimeSpan = System.TimeSpan.Parse("00:00:00"); + timeCode1.TotalMilliseconds = 0D; + timeCode1.TotalSeconds = 0D; + this.timeUpDownVideoPosition.TimeCode = timeCode1; + this.timeUpDownVideoPosition.UseVideoOffset = false; // - // aSSStylesToolStripMenuItem + // timeUpDownVideoPositionAdjust // - this.aSSStylesToolStripMenuItem.Name = "aSSStylesToolStripMenuItem"; - this.aSSStylesToolStripMenuItem.Size = new System.Drawing.Size(168, 22); - this.aSSStylesToolStripMenuItem.Text = "ASS styles..."; - this.aSSStylesToolStripMenuItem.Click += new System.EventHandler(this.aSSStylesToolStripMenuItem_Click); - // - // imageListPlayRate - // - this.imageListPlayRate.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageListPlayRate.ImageStream"))); - this.imageListPlayRate.TransparentColor = System.Drawing.Color.Transparent; - this.imageListPlayRate.Images.SetKeyName(0, "FastForward.png"); - this.imageListPlayRate.Images.SetKeyName(1, "FastForwardHighLight.png"); - // - // timerTextUndo - // - this.timerTextUndo.Interval = 700; - this.timerTextUndo.Tick += new System.EventHandler(this.TimerTextUndoTick); - // - // timerOriginalTextUndo - // - this.timerOriginalTextUndo.Interval = 700; - this.timerOriginalTextUndo.Tick += new System.EventHandler(this.TimerOriginalTextUndoTick); - // - // contextMenuStripShowVideoControls - // - this.contextMenuStripShowVideoControls.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripMenuItemShowVideoControls}); - this.contextMenuStripShowVideoControls.Name = "contextMenuStripVideoControls"; - this.contextMenuStripShowVideoControls.Size = new System.Drawing.Size(182, 26); - // - // toolStripMenuItemShowVideoControls - // - this.toolStripMenuItemShowVideoControls.Name = "toolStripMenuItemShowVideoControls"; - this.toolStripMenuItemShowVideoControls.Size = new System.Drawing.Size(181, 22); - this.toolStripMenuItemShowVideoControls.Text = "Show video controls"; - this.toolStripMenuItemShowVideoControls.Click += new System.EventHandler(this.toolStripMenuItemShowVideoControls_Click); + this.timeUpDownVideoPositionAdjust.AutoSize = true; + this.timeUpDownVideoPositionAdjust.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.timeUpDownVideoPositionAdjust.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30))))); + this.timeUpDownVideoPositionAdjust.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F); + this.timeUpDownVideoPositionAdjust.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(155)))), ((int)(((byte)(155)))), ((int)(((byte)(155))))); + this.timeUpDownVideoPositionAdjust.Location = new System.Drawing.Point(90, 215); + this.timeUpDownVideoPositionAdjust.Margin = new System.Windows.Forms.Padding(4); + this.timeUpDownVideoPositionAdjust.Name = "timeUpDownVideoPositionAdjust"; + this.timeUpDownVideoPositionAdjust.Size = new System.Drawing.Size(113, 27); + this.timeUpDownVideoPositionAdjust.TabIndex = 13; + timeCode2.Hours = 0; + timeCode2.Milliseconds = 0; + timeCode2.Minutes = 0; + timeCode2.Seconds = 0; + timeCode2.TimeSpan = System.TimeSpan.Parse("00:00:00"); + timeCode2.TotalMilliseconds = 0D; + timeCode2.TotalSeconds = 0D; + this.timeUpDownVideoPositionAdjust.TimeCode = timeCode2; + this.timeUpDownVideoPositionAdjust.UseVideoOffset = false; // // Main // @@ -5674,6 +5728,7 @@ namespace Nikse.SubtitleEdit.Forms this.splitContainerListViewAndText.ResumeLayout(false); this.groupBoxEdit.ResumeLayout(false); this.groupBoxEdit.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownLayer)).EndInit(); this.panelBookmark.ResumeLayout(false); this.panelBookmark.PerformLayout(); this.contextMenuStripTextBoxListView.ResumeLayout(false); @@ -5937,7 +5992,6 @@ namespace Nikse.SubtitleEdit.Forms private System.Windows.Forms.ToolStripMenuItem openOriginalToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem removeOriginalToolStripMenuItem; private System.Windows.Forms.ToolStripSplitButton toolStripSplitButtonPlayRate; - private System.Windows.Forms.ImageList imageListPlayRate; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSetAudioTrack; private System.Windows.Forms.Button buttonSplitLine; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemChangeFrameRate2; @@ -6062,7 +6116,7 @@ namespace Nikse.SubtitleEdit.Forms private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSpellCheckAddToNames; private System.Windows.Forms.ToolStripSeparator toolStripSeparatorSpellCheck; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemWebVttVoice; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemPreview; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuWebVttBrowserPreview; private System.Windows.Forms.ToolStripSeparator toolStripSeparatorWebVTT; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemModifySelection; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemInverseSelection; @@ -6222,5 +6276,10 @@ namespace Nikse.SubtitleEdit.Forms private System.Windows.Forms.ToolStripMenuItem removeTranslationToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem generateVideoWithSoftcodedSubtitlesToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemExportTtmlImage; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4Extend; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSetLayer; + private System.Windows.Forms.NumericUpDown numericUpDownLayer; + private System.Windows.Forms.Label labelLayer; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemWebVttStyle; } } \ No newline at end of file diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index e3398750e..ca470bd83 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -44,6 +44,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using Nikse.SubtitleEdit.Core.AudioToText; using Nikse.SubtitleEdit.Forms.AudioToText; +using Nikse.SubtitleEdit.Forms.VTT; namespace Nikse.SubtitleEdit.Forms { @@ -421,6 +422,9 @@ namespace Nikse.SubtitleEdit.Forms toolStripComboBoxFrameRate.Text = Configuration.Settings.General.DefaultFrameRate.ToString(); pictureBoxBookmark.Visible = false; + labelLayer.Visible = false; + numericUpDownLayer.Visible = false; + UpdateRecentFilesUI(); InitializeToolbar(); @@ -1845,6 +1849,7 @@ namespace Nikse.SubtitleEdit.Forms toolStripMenuItemAssaStyles.Text = _language.Menu.ContextMenu.SubStationAlphaStyles; setStylesForSelectedLinesToolStripMenuItem.Text = _language.Menu.ContextMenu.SetStyle; setActorForSelectedLinesToolStripMenuItem.Text = _language.Menu.ContextMenu.SetActor; + toolStripMenuItemSetLayer.Text = _language.Menu.ContextMenu.SetLayer; toolStripMenuItemAssaTools.Text = _language.Menu.ContextMenu.AssaTools; applyCustomStylesToolStripMenuItem.Text = _language.Menu.ContextMenu.ApplyCustomOverrideTag; setPositionToolStripMenuItem.Text = _language.Menu.ContextMenu.SetPosition; @@ -1876,6 +1881,10 @@ namespace Nikse.SubtitleEdit.Forms toolStripMenuItemGoToSourceView.Text = _language.Menu.ContextMenu.GoToSourceView; toolStripMenuItemGoToListView.Text = _language.Menu.ContextMenu.GoToListView; + toolStripMenuItemWebVttVoice.Text = _language.Menu.ContextMenu.WebVttSetVoice; + toolStripMenuItemWebVttStyle.Text = _language.Menu.ContextMenu.WebVttSetStyle; + toolStripMenuWebVttBrowserPreview.Text = _language.Menu.ContextMenu.WebVttBrowserPreview; + splitLineToolStripMenuItem.Text = _language.Menu.ContextMenu.Split; toolStripMenuItemMergeLines.Text = _language.Menu.ContextMenu.MergeSelectedLines; toolStripMenuItemMergeDialog.Text = _language.Menu.ContextMenu.MergeSelectedLinesAsDialog; @@ -2149,6 +2158,12 @@ namespace Nikse.SubtitleEdit.Forms if (formatType == typeof(AdvancedSubStationAlpha)) { + if (_oldSubtitleFormat?.GetType() == typeof(WebVTT) || + _oldSubtitleFormat?.GetType() == typeof(WebVTTFileWithLineNumber)) + { + _subtitle = WebVttToAssa.Convert(_subtitle, new SsaStyle(), _videoInfo?.Width ?? 0, _videoInfo?.Height ?? 0); + } + foreach (var p in _subtitle.Paragraphs) { p.Text = AdvancedSubStationAlpha.FormatText(p.Text); @@ -2917,6 +2932,18 @@ namespace Nikse.SubtitleEdit.Forms _converted = true; ShowStatus(string.Format(_language.LoadedSubtitleX, _fileName) + " - " + string.Format(_language.ConvertedToX, mxfFormat.FriendlyName)); + var images = parser.GetImages(); + if (images.Count > 0 && images.Count == _subtitle.Paragraphs.Count && _subtitle.Paragraphs[0].Text.StartsWith("urn:uuid:", StringComparison.Ordinal)) + { + for (var j = 0; j < images.Count; j++) + { + _subtitle.Paragraphs[j].Text = Convert.ToBase64String(images[j]); + } + + ImportAndInlineBase64(_subtitle, _loading, fileName); + return; + } + UpdateSourceView(); SubtitleListview1.Fill(_subtitle, _subtitleOriginal); _subtitleListViewIndex = -1; @@ -3711,7 +3738,7 @@ namespace Nikse.SubtitleEdit.Forms SubtitleListview1.SelectedIndexChanged -= SubtitleListview1_SelectedIndexChanged; RemoveOriginal(true, false); - if (format.HasStyleSupport && format.Name == AdvancedSubStationAlpha.NameOfFormat) + if (format.HasStyleSupport && format.GetType() == typeof(AdvancedSubStationAlpha)) { SubtitleListview1.ShowExtraColumn(_languageGeneral.Style); } @@ -5248,6 +5275,8 @@ namespace Nikse.SubtitleEdit.Forms RemoveOriginal(true, false); _splitDualSami = false; _imageSubFileName = null; + labelLayer.Visible = false; + numericUpDownLayer.Visible = false; SubtitleListview1.HideColumn(SubtitleListView.SubtitleColumn.Extra); @@ -5920,7 +5949,7 @@ namespace Nikse.SubtitleEdit.Forms return UiUtil.ShowSubtitle(_subtitle, mediaPlayer, format); } - private static void TryLoadIcon(ToolStripButton button, string iconName) + private static void TryLoadIcon(ToolStripItem button, string iconName) { var theme = Configuration.Settings.General.UseDarkTheme ? "DarkTheme" : "DefaultTheme"; if (!string.IsNullOrEmpty(Configuration.Settings.General.ToolbarIconTheme) && !Configuration.Settings.General.ToolbarIconTheme.Equals("Auto", StringComparison.OrdinalIgnoreCase)) @@ -5970,7 +5999,17 @@ namespace Nikse.SubtitleEdit.Forms TryLoadIcon(toolStripButtonToggleWaveform, "WaveformToggle"); TryLoadIcon(toolStripButtonToggleVideo, "VideoToggle"); TryLoadIcon(toolStripButtonSourceView, "SourceView"); - // IttProperties, WebVttProperties, EbuProperties + + TryLoadIcon(toolStripButtonWaveformZoomOut, "WaveformZoomOut"); + TryLoadIcon(toolStripButtonWaveformZoomIn, "WaveformZoomIn"); + TryLoadIcon(toolStripButtonWaveformPause, "WaveformPause"); + TryLoadIcon(toolStripButtonWaveformPlay, "WaveformPlay"); + TryLoadIcon(toolStripButtonLockCenter, "WaveformCenter"); + TryLoadIcon(toolStripSplitButtonPlayRate, "WaveformPlaybackSpeed"); + + mediaPlayer.TryLoadGfx(); + + // Other images: IttProperties, WebVttProperties, WebVttStyle, EbuProperties } toolStripButtonFileNew.Visible = gs.ShowToolbarNew; @@ -6299,7 +6338,7 @@ namespace Nikse.SubtitleEdit.Forms FindPrevious(); } - public void FindDialogFind(string findText, ReplaceType findReplaceType) + public void FindDialogFind(string findText, ReplaceType findReplaceType, Regex regex) { _findHelper = _findHelper ?? _findDialog.GetFindDialogHelper(_subtitleListViewIndex); _findHelper.FindText = findText; @@ -6307,6 +6346,7 @@ namespace Nikse.SubtitleEdit.Forms _findHelper.FindReplaceType = findReplaceType; if (findReplaceType.FindType == FindType.RegEx) { + _findHelper.SetRegex(regex); } DialogFind(_findHelper); @@ -8704,7 +8744,7 @@ namespace Nikse.SubtitleEdit.Forms return; } - toolStripMenuItemPreview.Visible = formatType == typeof(WebVTT) && + toolStripMenuWebVttBrowserPreview.Visible = formatType == typeof(WebVTT) && !string.IsNullOrEmpty(_videoFileName) && (_videoFileName.EndsWith(".mp4", StringComparison.OrdinalIgnoreCase) || _videoFileName.EndsWith(".m4v", StringComparison.OrdinalIgnoreCase) || @@ -8855,16 +8895,7 @@ namespace Nikse.SubtitleEdit.Forms audio.DropDownItems.Insert(0, audioToTextWhisper); } - audioClip.Click += (senderNew, eNew) => - { - if (!RequireFfmpegOk()) - { - return; - } - - var audioClips = GetAudioClips(); - UiUtil.OpenFolder(Path.GetDirectoryName(audioClips[0].AudioFileName)); - }; + audioClip.Click += (senderNew, eNew) => { ExtractAudioSelectedLines(); }; audioToTextWhisper.Click += (senderNew, eNew) => { AudioToTextWhisperSelectedLines(); }; @@ -8873,6 +8904,7 @@ namespace Nikse.SubtitleEdit.Forms toolStripMenuItemSetRegion.Visible = false; toolStripMenuItemSetLanguage.Visible = false; + toolStripMenuItemSetLayer.Visible = false; List actors = null; if ((formatType == typeof(AdvancedSubStationAlpha) || formatType == typeof(SubStationAlpha) || formatType == typeof(CsvNuendo)) && SubtitleListview1.SelectedItems.Count > 0) { @@ -8952,6 +8984,32 @@ namespace Nikse.SubtitleEdit.Forms } UiUtil.FixFonts(setActorForSelectedLinesToolStripMenuItem); + + toolStripMenuItemSetLayer.DropDownItems.Clear(); + if (SubtitleListview1.SelectedItems.Count > 0) + { + var p = _subtitle.GetParagraphOrDefault(SubtitleListview1.SelectedItems[0].Index); + if (p != null) + { + var layer = p.Layer; + + toolStripMenuItemSetLayer.DropDownItems.Add((layer - 100).ToString(CultureInfo.InvariantCulture), null, SetLayer); + toolStripMenuItemSetLayer.DropDownItems.Add((layer - 10).ToString(CultureInfo.InvariantCulture), null, SetLayer); + toolStripMenuItemSetLayer.DropDownItems.Add((layer - 1).ToString(CultureInfo.InvariantCulture), null, SetLayer); + + toolStripMenuItemSetLayer.DropDownItems.Add(layer.ToString(CultureInfo.InvariantCulture), null, SetLayer); + ((ToolStripMenuItem)toolStripMenuItemSetLayer.DropDownItems[toolStripMenuItemSetLayer.DropDownItems.Count - 1]).Checked = true; + + toolStripMenuItemSetLayer.DropDownItems.Add((layer + 1).ToString(CultureInfo.InvariantCulture), null, SetLayer); + toolStripMenuItemSetLayer.DropDownItems.Add((layer + 10).ToString(CultureInfo.InvariantCulture), null, SetLayer); + toolStripMenuItemSetLayer.DropDownItems.Add((layer + 100).ToString(CultureInfo.InvariantCulture), null, SetLayer); + + toolStripMenuItemSetLayer.DropDownItems.Add(new ToolStripSeparator()); + + toolStripMenuItemSetLayer.DropDownItems.Add(_language.Menu.ContextMenu.SetLayer, null, SetLayerChooseValue); + } + toolStripMenuItemSetLayer.Visible = true; + } } else if (((formatType == typeof(TimedText10) && Configuration.Settings.SubtitleSettings.TimedText10ShowStyleAndLanguage) || formatType == typeof(ItunesTimedText)) && SubtitleListview1.SelectedItems.Count > 0) { @@ -9326,6 +9384,17 @@ namespace Nikse.SubtitleEdit.Forms } } + private void ExtractAudioSelectedLines() + { + if (!RequireFfmpegOk()) + { + return; + } + + var audioClips = GetAudioClips(); + UiUtil.OpenFolder(Path.GetDirectoryName(audioClips[0].AudioFileName)); + } + private void AudioToTextVoskSelectedLines() { if (!RequireFfmpegOk()) @@ -9452,6 +9521,36 @@ namespace Nikse.SubtitleEdit.Forms } } + private void SetLayer(object sender, EventArgs e) + { + string layer = (sender as ToolStripItem).Text; + if (!string.IsNullOrEmpty(layer) && int.TryParse(layer, out int number)) + { + MakeHistoryForUndo(string.Format(_language.BeforeX, $"{_language.Menu.ContextMenu.SetLayer}: {layer}")); + foreach (int index in SubtitleListview1.SelectedIndices) + { + _subtitle.Paragraphs[index].Layer = number; + } + } + } + + private void SetLayerChooseValue(object sender, EventArgs e) + { + var p = _subtitle.GetParagraphOrDefault(FirstSelectedIndex); + using (var form = new SetLayer(_subtitle, p)) + { + if (form.ShowDialog(this) == DialogResult.OK) + { + MakeHistoryForUndo(string.Format(_language.BeforeX, $"{_language.Menu.ContextMenu.SetLayer}: {form.Layer}")); + var selectedIndices = new List(SubtitleListview1.GetSelectedIndices()); + foreach (int index in selectedIndices) + { + _subtitle.Paragraphs[index].Layer = form.Layer; + } + } + } + } + private void SetRegion(object sender, EventArgs e) { string region = (sender as ToolStripItem).Text; @@ -9782,6 +9881,7 @@ namespace Nikse.SubtitleEdit.Forms buttonNext.Enabled = false; buttonUnBreak.Enabled = false; buttonAutoBreak.Enabled = false; + numericUpDownLayer.Enabled = false; if (!Configuration.Settings.General.UseDarkTheme) { labelText.Enabled = false; @@ -9813,6 +9913,7 @@ namespace Nikse.SubtitleEdit.Forms buttonNext.Enabled = true; buttonUnBreak.Enabled = true; buttonAutoBreak.Enabled = true; + numericUpDownLayer.Enabled = true; labelText.Enabled = true; labelStartTime.Enabled = true; labelDuration.Enabled = true; @@ -10713,6 +10814,23 @@ namespace Nikse.SubtitleEdit.Forms } } + private void NumericUpDownLayer_ValueChanged(object sender, EventArgs e) + { + var p = _subtitle.GetParagraphOrDefault(_subtitleListViewIndex); + if (p == null) + { + return; + } + + var isAssa = GetCurrentSubtitleFormat().GetType() == typeof(AdvancedSubStationAlpha); + if (isAssa) + { + var layer = (int)numericUpDownLayer.Value; + MakeHistoryForUndo(string.Format(_language.BeforeX, $"{_language.Menu.ContextMenu.SetLayer}: {layer}")); + p.Layer = layer; + } + } + public Point GetPositionInForm(Control ctrl) { Point p = ctrl.Location; @@ -12851,6 +12969,19 @@ namespace Nikse.SubtitleEdit.Forms textBoxListViewText.TextChanged += TextBoxListViewTextTextChanged; _listViewTextUndoLast = p.Text; + var format = GetCurrentSubtitleFormat(); + bool isAssa = format.GetType() == typeof(AdvancedSubStationAlpha); + numericUpDownLayer.Visible = isAssa; + labelLayer.Visible = isAssa; + if (isAssa) + { + labelLayer.Text = LanguageSettings.Current.General.Layer; + numericUpDownLayer.Left = labelLayer.Right + 5; + numericUpDownLayer.ValueChanged -= NumericUpDownLayer_ValueChanged; + numericUpDownLayer.Value = p.Layer; + numericUpDownLayer.ValueChanged += NumericUpDownLayer_ValueChanged; + } + timeUpDownStartTime.MaskedTextBox.TextChanged -= MaskedTextBoxTextChanged; timeUpDownStartTime.TimeCode = p.StartTime; timeUpDownStartTime.MaskedTextBox.TextChanged += MaskedTextBoxTextChanged; @@ -13741,13 +13872,23 @@ namespace Nikse.SubtitleEdit.Forms private void SetColor(string color, bool selectedText = false, bool allowRemove = true) { - var isAssa = IsAssa(); + var format = GetCurrentSubtitleFormat(); + var isAssa = format.GetType() == typeof(AdvancedSubStationAlpha); + var isWebVtt = format.Name == WebVTT.NameOfFormat || format.Name == WebVTTFileWithLineNumber.NameOfFormat; + var c = ColorTranslator.FromHtml(color); + if (selectedText) { SetSelectedTextColor(color); } else { + var webVttStyles = new List(); + if (isWebVtt) + { + webVttStyles = WebVttHelper.GetStyles(_subtitle.Header); + } + MakeHistoryForUndo(_language.BeforeSettingColor); var remove = allowRemove; var removeOriginal = allowRemove; @@ -13755,15 +13896,7 @@ namespace Nikse.SubtitleEdit.Forms var assaColor = string.Empty; if (isAssa) { - try - { - var c = ColorTranslator.FromHtml(color); - assaColor = AdvancedSubStationAlpha.GetSsaColorStringForEvent(c); - } - catch - { - // ignore - } + assaColor = AdvancedSubStationAlpha.GetSsaColorStringForEvent(c); } foreach (ListViewItem item in SubtitleListview1.SelectedItems) @@ -13779,6 +13912,23 @@ namespace Nikse.SubtitleEdit.Forms break; } } + else if (isWebVtt) + { + var removeFound = false; + foreach (var style in webVttStyles) + { + if (style.Color == c && p.Text.Contains("." + style.Name)) + { + removeFound = true; + } + } + + if (!removeFound) + { + remove = false; + break; + } + } else { var s = Utilities.RemoveSsaTags(p.Text); @@ -13829,6 +13979,10 @@ namespace Nikse.SubtitleEdit.Forms { p.Text = RemoveAssaColor(p.Text); } + else if (isWebVtt) + { + p.Text = WebVttHelper.RemoveColorTag(p.Text, c, webVttStyles); + } else { p.Text = HtmlUtil.RemoveOpenCloseTags(p.Text, HtmlUtil.TagFont); @@ -13836,7 +13990,7 @@ namespace Nikse.SubtitleEdit.Forms } else { - SetParagraphFontColor(p, color, isAssa); + SetParagraphFontColor(_subtitle, p, color, isAssa, isWebVtt, webVttStyles); } SubtitleListview1.SetText(item.Index, p.Text); @@ -13848,11 +14002,18 @@ namespace Nikse.SubtitleEdit.Forms { if (removeOriginal) { - original.Text = HtmlUtil.RemoveOpenCloseTags(original.Text, HtmlUtil.TagFont); + if (isWebVtt) + { + original.Text = WebVttHelper.RemoveColorTag(original.Text, c, webVttStyles); + } + else + { + original.Text = HtmlUtil.RemoveOpenCloseTags(original.Text, HtmlUtil.TagFont); + } } else { - SetParagraphFontColor(original, color); + SetParagraphFontColor(_subtitleOriginal, original, color); } SubtitleListview1.SetOriginalText(item.Index, original.Text); @@ -13883,6 +14044,8 @@ namespace Nikse.SubtitleEdit.Forms int selectionStart = tb.SelectionStart; + var format = GetCurrentSubtitleFormat(); + if (IsAssa()) { var c = ColorTranslator.FromHtml(color); @@ -13904,6 +14067,38 @@ namespace Nikse.SubtitleEdit.Forms tb.SelectedText = text; tb.SelectionStart = selectionStart; tb.SelectionLength = text.Length; + + return; + } + else if (format.Name == WebVTT.NameOfFormat || format.Name == WebVTTFileWithLineNumber.NameOfFormat) + { + var c = ColorTranslator.FromHtml(color); + WebVttStyle styleWithColor = WebVttHelper.GetOnlyColorStyle(c, _subtitle.Header); + if (styleWithColor == null) + { + styleWithColor = WebVttHelper.AddStyleFromColor(c); + _subtitle.Header = WebVttHelper.AddStyleToHeader(_subtitle.Header, styleWithColor); + } + + if (text.StartsWith("'); + if (indexOfEndTag > 0) + { + text = text.Insert(indexOfEndTag, "." + styleWithColor.Name.RemoveChar('.')); + } + } + else + { + text = "" + text + ""; + } + + text = WebVttHelper.RemoveUnusedColorStylesFromText(text, _subtitle.Header); + + tb.SelectedText = text; + tb.SelectionStart = selectionStart; + tb.SelectionLength = text.Length; + return; } @@ -13969,7 +14164,7 @@ namespace Nikse.SubtitleEdit.Forms tb.SelectionLength = text.Length; } - private void SetParagraphFontColor(Paragraph p, string color, bool isAssa = false) + private void SetParagraphFontColor(Subtitle subtitle, Paragraph p, string color, bool isAssa = false, bool isWebVtt = false, List webVttStyles = null) { if (p == null) { @@ -13992,6 +14187,33 @@ namespace Nikse.SubtitleEdit.Forms return; } + if (isWebVtt) + { + try + { + var c = ColorTranslator.FromHtml(color); + var existingStyle = WebVttHelper.GetOnlyColorStyle(c, _subtitle.Header); + if (existingStyle != null) + { + p.Text = WebVttHelper.AddStyleToText(p.Text, existingStyle, WebVttHelper.GetStyles(_subtitle.Header)); + p.Text = WebVttHelper.RemoveUnusedColorStylesFromText(p.Text, subtitle.Header); + } + else + { + var styleWithColor = WebVttHelper.AddStyleFromColor(c); + subtitle.Header = WebVttHelper.AddStyleToHeader(_subtitle.Header, styleWithColor); + p.Text = WebVttHelper.AddStyleToText(p.Text, styleWithColor, WebVttHelper.GetStyles(_subtitle.Header)); + p.Text = WebVttHelper.RemoveUnusedColorStylesFromText(p.Text, subtitle.Header); + } + } + catch + { + // ignore + } + + return; + } + string pre = string.Empty; if (p.Text.StartsWith("{\\", StringComparison.Ordinal) && p.Text.IndexOf('}') >= 0) { @@ -17508,7 +17730,7 @@ namespace Nikse.SubtitleEdit.Forms { mediaPlayer.VideoPlayer.PlayRate = 1.0; InitializePlayRateDropDown(); - toolStripSplitButtonPlayRate.Image = imageListPlayRate.Images[0]; + TryLoadIcon(toolStripSplitButtonPlayRate, "WaveformPlaybackSpeed"); } } else if (audioVisualizer.Focused && audioVisualizer.NewSelectionParagraph != null && e.KeyData == _shortcuts.WaveformAddTextAtHere) @@ -17853,11 +18075,21 @@ namespace Nikse.SubtitleEdit.Forms e.SuppressKeyPress = true; } - else if (e.KeyData == _shortcuts.MainVideoAudioToText) + else if (e.KeyData == _shortcuts.MainVideoAudioToTextVosk) { videoaudioToTextToolStripMenuItem_Click(null, null); e.SuppressKeyPress = true; } + else if (e.KeyData == _shortcuts.MainVideoAudioToTextWhisper) + { + audioToTextWhisperTolStripMenuItem_Click(null, null); + e.SuppressKeyPress = true; + } + else if (e.KeyData == _shortcuts.MainVideoAudioExtractSelectedLines) + { + e.SuppressKeyPress = true; + ExtractAudioSelectedLines(); + } else if (e.KeyData == _shortcuts.MainVideoToggleBrightness) { if (mediaPlayer.VideoPlayer is LibMpvDynamic libMpv) @@ -19859,7 +20091,7 @@ namespace Nikse.SubtitleEdit.Forms else { numericUpDownDuration.DecimalPlaces = 3; - numericUpDownDuration.Increment = (decimal)(0.1); + numericUpDownDuration.Increment = (decimal)0.1; toolStripSeparatorFrameRate.Visible = Configuration.Settings.General.ShowFrameRate; toolStripLabelFrameRate.Visible = Configuration.Settings.General.ShowFrameRate; @@ -20363,7 +20595,7 @@ namespace Nikse.SubtitleEdit.Forms addMs = lastParagraph.EndTime.TotalMilliseconds - tmp.Paragraphs[0].StartTime.TotalMilliseconds + MinGapBetweenLines; } - if (isAssa && format.Name == AdvancedSubStationAlpha.NameOfFormat) + if (isAssa && format.GetType() == typeof(AdvancedSubStationAlpha)) { addMs = 0; @@ -20819,6 +21051,8 @@ namespace Nikse.SubtitleEdit.Forms } _findHelper = new FindReplaceDialogHelper(new ReplaceType { FindType = FindType.RegEx }, string.Format(_language.DoubleWordsViaRegEx, regex), regex, string.Empty, _subtitleListViewIndex); + _findHelper.FindReplaceType.SearchTranslation = true; + _findHelper.FindReplaceType.SearchOriginal = _subtitleOriginal != null && _subtitleOriginal.Paragraphs.Count > 0; ReloadFromSourceView(); FindNext(); @@ -25053,7 +25287,14 @@ namespace Nikse.SubtitleEdit.Forms if (!playedWithCustomSpeed) { playRateDropDownItem.Checked = true; - toolStripSplitButtonPlayRate.Image = Math.Abs(factor - 1) < 0.01 ? imageListPlayRate.Images[0] : imageListPlayRate.Images[1]; + if (Math.Abs(factor - 1) < 0.01) + { + TryLoadIcon(toolStripSplitButtonPlayRate, "WaveformPlaybackSpeed"); + } + else + { + TryLoadIcon(toolStripSplitButtonPlayRate, "WaveformPlaybackSpeedSelected"); + } } try @@ -27097,7 +27338,7 @@ namespace Nikse.SubtitleEdit.Forms { string color; var formatType = GetCurrentSubtitleFormat().GetType(); - if (formatType == typeof(AdvancedSubStationAlpha)) + if (formatType == typeof(AdvancedSubStationAlpha) || formatType == typeof(WebVTT) || formatType == typeof(WebVTTFileWithLineNumber)) { using (var form = new ColorChooser { Color = Configuration.Settings.General.LastColorPickerColor }) { @@ -30712,6 +30953,20 @@ namespace Nikse.SubtitleEdit.Forms } } } + else if (formatType == typeof(WebVTT) || formatType == typeof(WebVTTFileWithLineNumber)) + { + using (var styles = new WebVttStyleManager(_subtitle, FirstSelectedIndex)) + { + if (styles.ShowDialog(this) == DialogResult.OK) + { + if (_subtitle.Header != styles.Header) + { + MakeHistoryForUndo(styles.Text); + _subtitle.Header = styles.Header; + } + } + } + } mediaPlayer.LastParagraph = null; UiUtil.ShowSubtitle(_subtitle, mediaPlayer, GetCurrentSubtitleFormat()); @@ -31564,7 +31819,7 @@ namespace Nikse.SubtitleEdit.Forms { var isAssa = IsAssa(); var assaStyles = AdvancedSubStationAlpha.GetStylesFromHeader(_subtitle.Header); - for (int i = 0; i + index < _subtitle.Paragraphs.Count && i < tmp.Paragraphs.Count; i++) + for (var i = 0; i + index < _subtitle.Paragraphs.Count && i < tmp.Paragraphs.Count; i++) { if (index + i < _subtitle.Paragraphs.Count) { @@ -31573,7 +31828,7 @@ namespace Nikse.SubtitleEdit.Forms _subtitle.Paragraphs[index + i].Text = tmp.Paragraphs[i].Text; _subtitle.Paragraphs[index + i].StartTime.TotalMilliseconds = tmp.Paragraphs[i].StartTime.TotalMilliseconds; _subtitle.Paragraphs[index + i].EndTime.TotalMilliseconds = tmp.Paragraphs[i].EndTime.TotalMilliseconds; - if (isAssa && format.Name == AdvancedSubStationAlpha.NameOfFormat) + if (isAssa && format.GetType() == typeof(AdvancedSubStationAlpha)) { _subtitle.Paragraphs[index + i].Extra = tmp.Paragraphs[i].Extra; _subtitle.Paragraphs[index + i].Actor = tmp.Paragraphs[i].Actor; @@ -32828,10 +33083,13 @@ namespace Nikse.SubtitleEdit.Forms var assFormatOn = formatType == typeof(AdvancedSubStationAlpha); toolStripButtonAssStyleManager.Visible = assFormatOn; + toolStripButtonAssStyleManager.ToolTipText = LanguageSettings.Current.SubStationAlphaStyles.Title; toolStripButtonAssProperties.Visible = assFormatOn; toolStripButtonAssaDraw.Visible = assFormatOn && File.Exists(Path.Combine(Configuration.PluginsDirectory, "AssaDraw.dll")); toolStripButtonAssAttachments.Visible = assFormatOn; + toolStripMenuItemWebVttStyle.Visible = false; + if (formatType == typeof(SubStationAlpha)) { toolStripButtonAssStyleManager.Visible = true; @@ -32839,6 +33097,11 @@ namespace Nikse.SubtitleEdit.Forms toolStripButtonAssAttachments.Visible = true; } + if (formatType == typeof(AdvancedSubStationAlpha) || formatType == typeof(SubStationAlpha)) + { + TryLoadIcon(toolStripButtonAssStyleManager, "AssaStyle"); + } + toolStripButtonXProperties.Visible = formatType == typeof(ItunesTimedText); if (toolStripButtonXProperties.Visible) { @@ -32853,6 +33116,13 @@ namespace Nikse.SubtitleEdit.Forms toolStripButtonXProperties.ToolTipText = string.Format(_language.Menu.File.FormatXProperties, new WebVTT().Name); toolStripButtonXProperties.Image = Properties.Resources.webvtt; TryLoadIcon(toolStripButtonXProperties, "WebVttProperties"); + + toolStripButtonAssStyleManager.Visible = true; + toolStripButtonAssStyleManager.ToolTipText = string.Format(LanguageSettings.Current.WebVttStyleManager.Title, new WebVTT().Name); + toolStripButtonAssStyleManager.Image = Properties.Resources.webvtt; + TryLoadIcon(toolStripButtonAssStyleManager, "WebVttStyle"); + + toolStripMenuItemWebVttStyle.Visible = true; } if (formatType == typeof(Ebu)) @@ -34613,7 +34883,7 @@ namespace Nikse.SubtitleEdit.Forms private void generateBackgroundBoxToolStripMenuItem_Click(object sender, EventArgs e) { - if (GetCurrentSubtitleFormat().Name != AdvancedSubStationAlpha.NameOfFormat) + if (GetCurrentSubtitleFormat().GetType() != typeof(AdvancedSubStationAlpha)) { return; } @@ -35084,5 +35354,32 @@ namespace Nikse.SubtitleEdit.Forms exportBdnXmlPng.ShowDialog(this); } } + + private void toolStripMenuItemWebVttStyle_Click(object sender, EventArgs e) + { + var idx = FirstSelectedIndex; + if (idx == -1) + { + return; + } + + var styles = WebVttHelper.GetStyles(_subtitle.Header); + using (var form = new WebVttStylePicker(styles, _subtitle.GetParagraphOrDefault(idx))) + { + if (form.ShowDialog(this) != DialogResult.OK) + { + return; + } + + foreach (int index in SubtitleListview1.SelectedIndices) + { + var p = _subtitle.Paragraphs[index]; + p.Text = WebVttHelper.SetParagraphStyles(p, form.ImportExportStyles); + SubtitleListview1.SetText(index, p.Text); + } + } + + RefreshSelectedParagraph(); + } } } \ No newline at end of file diff --git a/src/ui/Forms/MergeDoubleLines.cs b/src/ui/Forms/MergeDoubleLines.cs index e4501a680..bbeadd584 100644 --- a/src/ui/Forms/MergeDoubleLines.cs +++ b/src/ui/Forms/MergeDoubleLines.cs @@ -195,10 +195,6 @@ namespace Nikse.SubtitleEdit.Forms mergedIndexes.Add(i - 1); } } - else - { - break; - } } if (!removed.Contains(i - 1) && lineNumbers.Count > 0 && clearFixes) diff --git a/src/ui/Forms/MultipleReplace.Designer.cs b/src/ui/Forms/MultipleReplace.Designer.cs index bfe2d2828..9942203f2 100644 --- a/src/ui/Forms/MultipleReplace.Designer.cs +++ b/src/ui/Forms/MultipleReplace.Designer.cs @@ -33,6 +33,7 @@ this.buttonReplacesInverseSelection = new System.Windows.Forms.Button(); this.buttonReplacesSelectAll = new System.Windows.Forms.Button(); this.listViewFixes = new System.Windows.Forms.ListView(); + this.contextMenuStripListViewFixes = new System.Windows.Forms.ContextMenuStrip(this.components); this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader5 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeader7 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -68,6 +69,9 @@ this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItemImport = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItemExport = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); + this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.inverseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.radioButtonNormal = new System.Windows.Forms.RadioButton(); this.buttonOK = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); @@ -93,10 +97,9 @@ this.buttonApply = new System.Windows.Forms.Button(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); - this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator(); - this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.inverseSelectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.contextMenuStripListViewFixes = new System.Windows.Forms.ContextMenuStrip(); + this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripMenuItemGroupsSelectAll = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItemGroupsInvertSelection = new System.Windows.Forms.ToolStripMenuItem(); this.groupBoxLinesFound.SuspendLayout(); this.groupBoxReplaces.SuspendLayout(); this.contextMenuStripRules.SuspendLayout(); @@ -106,7 +109,6 @@ this.splitContainer1.SuspendLayout(); this.groupBoxGroups.SuspendLayout(); this.contextMenuStripGroups.SuspendLayout(); - this.contextMenuStripListViewFixes.SuspendLayout(); this.SuspendLayout(); // // groupBoxLinesFound @@ -148,24 +150,18 @@ this.buttonReplacesSelectAll.UseVisualStyleBackColor = true; this.buttonReplacesSelectAll.Click += new System.EventHandler(this.buttonReplacesSelectAll_Click); // - // contextMenuStripListViewFixes - // - this.contextMenuStripListViewFixes.Name = "contextMenuStripListViewFixes"; - this.contextMenuStripListViewFixes.Size = new System.Drawing.Size(285, 776); - this.contextMenuStripListViewFixes.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripListViewFixesOpening); - // // listViewFixes // this.listViewFixes.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.listViewFixes.CheckBoxes = true; - this.listViewFixes.ContextMenuStrip = this.contextMenuStripListViewFixes; this.listViewFixes.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.columnHeader4, this.columnHeader5, this.columnHeader7, this.columnHeader8}); + this.listViewFixes.ContextMenuStrip = this.contextMenuStripListViewFixes; this.listViewFixes.FullRowSelect = true; this.listViewFixes.HideSelection = false; this.listViewFixes.Location = new System.Drawing.Point(8, 21); @@ -177,6 +173,12 @@ this.listViewFixes.ClientSizeChanged += new System.EventHandler(this.listViewFixes_ClientSizeChanged); this.listViewFixes.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewFixes_KeyDown); // + // contextMenuStripListViewFixes + // + this.contextMenuStripListViewFixes.Name = "contextMenuStripListViewFixes"; + this.contextMenuStripListViewFixes.Size = new System.Drawing.Size(61, 4); + this.contextMenuStripListViewFixes.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripListViewFixesOpening); + // // columnHeader4 // this.columnHeader4.Text = "Apply"; @@ -396,7 +398,7 @@ this.selectAllToolStripMenuItem, this.inverseSelectionToolStripMenuItem}); this.contextMenuStripRules.Name = "contextMenuStrip1"; - this.contextMenuStripRules.Size = new System.Drawing.Size(228, 292); + this.contextMenuStripRules.Size = new System.Drawing.Size(228, 270); this.contextMenuStripRules.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening); // // deleteToolStripMenuItem @@ -483,6 +485,25 @@ this.toolStripMenuItemExport.Text = "Export..."; this.toolStripMenuItemExport.Click += new System.EventHandler(this.toolStripMenuItem4_Click); // + // toolStripSeparator5 + // + this.toolStripSeparator5.Name = "toolStripSeparator5"; + this.toolStripSeparator5.Size = new System.Drawing.Size(224, 6); + // + // selectAllToolStripMenuItem + // + this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; + this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(227, 22); + this.selectAllToolStripMenuItem.Text = "Select all"; + this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.selectAllToolStripMenuItem_Click); + // + // inverseSelectionToolStripMenuItem + // + this.inverseSelectionToolStripMenuItem.Name = "inverseSelectionToolStripMenuItem"; + this.inverseSelectionToolStripMenuItem.Size = new System.Drawing.Size(227, 22); + this.inverseSelectionToolStripMenuItem.Text = "Inverse selection"; + this.inverseSelectionToolStripMenuItem.Click += new System.EventHandler(this.inverseSelectionToolStripMenuItem_Click); + // // radioButtonNormal // this.radioButtonNormal.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -610,6 +631,7 @@ this.listViewGroups.TabIndex = 0; this.listViewGroups.UseCompatibleStateImageBehavior = false; this.listViewGroups.View = System.Windows.Forms.View.Details; + this.listViewGroups.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewGroups_KeyDown); // // columnHeaderForName // @@ -629,9 +651,12 @@ this.moveToBottomToolStripMenuItem, this.toolStripSeparatorGroupImportExport, this.importToolStripMenuItem, - this.exportToolStripMenuItem}); + this.exportToolStripMenuItem, + this.toolStripSeparator6, + this.toolStripMenuItemGroupsSelectAll, + this.toolStripMenuItemGroupsInvertSelection}); this.contextMenuStripGroups.Name = "contextMenuStripGroups"; - this.contextMenuStripGroups.Size = new System.Drawing.Size(216, 214); + this.contextMenuStripGroups.Size = new System.Drawing.Size(216, 286); this.contextMenuStripGroups.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripGroups_Opening); // // newToolStripMenuItem @@ -732,24 +757,24 @@ // this.openFileDialog1.FileName = "openFileDialog1"; // - // toolStripSeparator5 + // toolStripSeparator6 // - this.toolStripSeparator5.Name = "toolStripSeparator5"; - this.toolStripSeparator5.Size = new System.Drawing.Size(224, 6); + this.toolStripSeparator6.Name = "toolStripSeparator6"; + this.toolStripSeparator6.Size = new System.Drawing.Size(212, 6); // - // selectAllToolStripMenuItem + // toolStripMenuItemGroupsSelectAll // - this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem"; - this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(227, 22); - this.selectAllToolStripMenuItem.Text = "Select all"; - this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.selectAllToolStripMenuItem_Click); + this.toolStripMenuItemGroupsSelectAll.Name = "toolStripMenuItemGroupsSelectAll"; + this.toolStripMenuItemGroupsSelectAll.Size = new System.Drawing.Size(215, 22); + this.toolStripMenuItemGroupsSelectAll.Text = "Select all"; + this.toolStripMenuItemGroupsSelectAll.Click += new System.EventHandler(this.toolStripMenuItemGroupsSelectAll_Click); // - // inverseSelectionToolStripMenuItem + // toolStripMenuItemGroupsInvertSelection // - this.inverseSelectionToolStripMenuItem.Name = "inverseSelectionToolStripMenuItem"; - this.inverseSelectionToolStripMenuItem.Size = new System.Drawing.Size(227, 22); - this.inverseSelectionToolStripMenuItem.Text = "Inverse selection"; - this.inverseSelectionToolStripMenuItem.Click += new System.EventHandler(this.inverseSelectionToolStripMenuItem_Click); + this.toolStripMenuItemGroupsInvertSelection.Name = "toolStripMenuItemGroupsInvertSelection"; + this.toolStripMenuItemGroupsInvertSelection.Size = new System.Drawing.Size(215, 22); + this.toolStripMenuItemGroupsInvertSelection.Text = "Inverse selection"; + this.toolStripMenuItemGroupsInvertSelection.Click += new System.EventHandler(this.toolStripMenuItemGroupsInvertSelection_Click); // // MultipleReplace // @@ -779,7 +804,6 @@ this.splitContainer1.ResumeLayout(false); this.groupBoxGroups.ResumeLayout(false); this.contextMenuStripGroups.ResumeLayout(false); - this.contextMenuStripListViewFixes.ResumeLayout(false); this.ResumeLayout(false); } @@ -854,5 +878,8 @@ private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem inverseSelectionToolStripMenuItem; private System.Windows.Forms.ContextMenuStrip contextMenuStripListViewFixes; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator6; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemGroupsSelectAll; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemGroupsInvertSelection; } } \ No newline at end of file diff --git a/src/ui/Forms/MultipleReplace.cs b/src/ui/Forms/MultipleReplace.cs index 3643bd26d..9989ea070 100644 --- a/src/ui/Forms/MultipleReplace.cs +++ b/src/ui/Forms/MultipleReplace.cs @@ -116,6 +116,8 @@ namespace Nikse.SubtitleEdit.Forms deleteToolStripMenuItem1.Text = LanguageSettings.Current.MultipleReplace.Remove; selectAllToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.ContextMenu.SelectAll; inverseSelectionToolStripMenuItem.Text = LanguageSettings.Current.Main.Menu.Edit.InverseSelection; + toolStripMenuItemGroupsSelectAll.Text = LanguageSettings.Current.Main.Menu.ContextMenu.SelectAll; + toolStripMenuItemGroupsInvertSelection.Text = LanguageSettings.Current.Main.Menu.Edit.InverseSelection; radioButtonCaseSensitive.Left = radioButtonNormal.Left + radioButtonNormal.Width + 40; radioButtonRegEx.Left = radioButtonCaseSensitive.Left + radioButtonCaseSensitive.Width + 40; @@ -1213,7 +1215,10 @@ namespace Nikse.SubtitleEdit.Forms { if (item != newToolStripMenuItem && item != toolStripSeparatorGroupImportExport && - item != importToolStripMenuItem) + item != importToolStripMenuItem && + item != toolStripSeparator6 && + item != toolStripMenuItemGroupsSelectAll && + item != toolStripMenuItemGroupsInvertSelection) { item.Visible = doShow; } @@ -1404,5 +1409,40 @@ namespace Nikse.SubtitleEdit.Forms listViewFixes.Columns[4].Text = LanguageSettings.Current.MultipleReplace.RuleInfo; listViewFixes.AutoSizeLastColumn(); } + + private void listViewGroups_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.A && e.Modifiers == Keys.Control) + { + toolStripMenuItemGroupsSelectAll_Click(null, null); + e.SuppressKeyPress = true; + } + else if (e.KeyCode == Keys.D && e.Modifiers == Keys.Control) + { + listViewGroups.SelectFirstSelectedItemOnly(); + e.SuppressKeyPress = true; + } + else if (e.KeyCode == Keys.I && e.Modifiers == (Keys.Control | Keys.Shift)) //InverseSelection + { + toolStripMenuItemGroupsInvertSelection_Click(null, null); + e.SuppressKeyPress = true; + } + } + + private void toolStripMenuItemGroupsSelectAll_Click(object sender, EventArgs e) + { + foreach (ListViewItem item in listViewGroups.Items) + { + item.Checked = true; + } + } + + private void toolStripMenuItemGroupsInvertSelection_Click(object sender, EventArgs e) + { + foreach (ListViewItem item in listViewGroups.Items) + { + item.Checked = !item.Checked; + } + } } } diff --git a/src/ui/Forms/MultipleReplace.resx b/src/ui/Forms/MultipleReplace.resx index 8ac43125e..5b8a63afd 100644 --- a/src/ui/Forms/MultipleReplace.resx +++ b/src/ui/Forms/MultipleReplace.resx @@ -117,16 +117,19 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 + + 237, 17 + - 448, 17 + 691, 17 - 172, 17 + 415, 17 - 312, 17 + 555, 17 \ No newline at end of file diff --git a/src/ui/Forms/Ocr/DownloadTesseract5.cs b/src/ui/Forms/Ocr/DownloadTesseract5.cs index a92815cdd..5d4827da2 100644 --- a/src/ui/Forms/Ocr/DownloadTesseract5.cs +++ b/src/ui/Forms/Ocr/DownloadTesseract5.cs @@ -10,7 +10,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr { public sealed partial class DownloadTesseract5 : Form { - public const string TesseractDownloadUrl = "https://github.com/SubtitleEdit/support-files/raw/master/Tesseract530.zip"; + public const string TesseractDownloadUrl = "https://github.com/SubtitleEdit/support-files/raw/master/Tesseract531.zip"; private readonly CancellationTokenSource _cancellationTokenSource; public DownloadTesseract5(string version) diff --git a/src/ui/Forms/Ocr/VobSubOcr.Designer.cs b/src/ui/Forms/Ocr/VobSubOcr.Designer.cs index 766943204..39e61cc17 100644 --- a/src/ui/Forms/Ocr/VobSubOcr.Designer.cs +++ b/src/ui/Forms/Ocr/VobSubOcr.Designer.cs @@ -55,13 +55,6 @@ namespace Nikse.SubtitleEdit.Forms.Ocr this.buttonCancel = new System.Windows.Forms.Button(); this.groupBoxOcrMethod = new System.Windows.Forms.GroupBox(); this.comboBoxOcrMethod = new System.Windows.Forms.ComboBox(); - this.groupBoxCloudVision = new System.Windows.Forms.GroupBox(); - this.checkBoxSeHandlesTextMerge = new System.Windows.Forms.CheckBox(); - this.checkBoxCloudVisionSendOriginalImages = new System.Windows.Forms.CheckBox(); - this.comboBoxCloudVisionLanguage = new System.Windows.Forms.ComboBox(); - this.labelCloudVisionLanguage = new System.Windows.Forms.Label(); - this.textBoxCloudVisionApiKey = new System.Windows.Forms.TextBox(); - this.labelCloudVisionApiKey = new System.Windows.Forms.Label(); this.groupBoxNOCR = new System.Windows.Forms.GroupBox(); this.label3 = new System.Windows.Forms.Label(); this.comboBoxNOcrLineSplitMinHeight = new System.Windows.Forms.ComboBox(); @@ -99,6 +92,13 @@ namespace Nikse.SubtitleEdit.Forms.Ocr this.groupBoxModiMethod = new System.Windows.Forms.GroupBox(); this.label1 = new System.Windows.Forms.Label(); this.comboBoxModiLanguage = new System.Windows.Forms.ComboBox(); + this.groupBoxCloudVision = new System.Windows.Forms.GroupBox(); + this.checkBoxSeHandlesTextMerge = new System.Windows.Forms.CheckBox(); + this.checkBoxCloudVisionSendOriginalImages = new System.Windows.Forms.CheckBox(); + this.comboBoxCloudVisionLanguage = new System.Windows.Forms.ComboBox(); + this.labelCloudVisionLanguage = new System.Windows.Forms.Label(); + this.textBoxCloudVisionApiKey = new System.Windows.Forms.TextBox(); + this.labelCloudVisionApiKey = new System.Windows.Forms.Label(); this.groupBoxOCRControls = new System.Windows.Forms.GroupBox(); this.labelStartFrom = new System.Windows.Forms.Label(); this.numericUpDownStartNumber = new System.Windows.Forms.NumericUpDown(); @@ -180,7 +180,6 @@ namespace Nikse.SubtitleEdit.Forms.Ocr this.timerHideStatus = new System.Windows.Forms.Timer(this.components); this.contextMenuStripListview.SuspendLayout(); this.groupBoxOcrMethod.SuspendLayout(); - this.groupBoxCloudVision.SuspendLayout(); this.groupBoxNOCR.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownNOcrMaxWrongPixels)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownNumberOfPixelsIsSpaceNOCR)).BeginInit(); @@ -189,6 +188,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr ((System.ComponentModel.ISupportInitialize)(this.numericUpDownPixelsIsSpace)).BeginInit(); this.GroupBoxTesseractMethod.SuspendLayout(); this.groupBoxModiMethod.SuspendLayout(); + this.groupBoxCloudVision.SuspendLayout(); this.groupBoxOCRControls.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownStartNumber)).BeginInit(); this.groupBoxOcrAutoFix.SuspendLayout(); @@ -502,11 +502,11 @@ namespace Nikse.SubtitleEdit.Forms.Ocr // groupBoxOcrMethod // this.groupBoxOcrMethod.Controls.Add(this.comboBoxOcrMethod); - this.groupBoxOcrMethod.Controls.Add(this.groupBoxNOCR); - this.groupBoxOcrMethod.Controls.Add(this.groupBoxImageCompareMethod); this.groupBoxOcrMethod.Controls.Add(this.GroupBoxTesseractMethod); this.groupBoxOcrMethod.Controls.Add(this.groupBoxModiMethod); this.groupBoxOcrMethod.Controls.Add(this.groupBoxCloudVision); + this.groupBoxOcrMethod.Controls.Add(this.groupBoxNOCR); + this.groupBoxOcrMethod.Controls.Add(this.groupBoxImageCompareMethod); this.groupBoxOcrMethod.Location = new System.Drawing.Point(13, 5); this.groupBoxOcrMethod.Name = "groupBoxOcrMethod"; this.groupBoxOcrMethod.Size = new System.Drawing.Size(392, 192); @@ -530,78 +530,6 @@ namespace Nikse.SubtitleEdit.Forms.Ocr this.comboBoxOcrMethod.TabIndex = 0; this.comboBoxOcrMethod.SelectedIndexChanged += new System.EventHandler(this.ComboBoxOcrMethodSelectedIndexChanged); // - // groupBoxCloudVision - // - this.groupBoxCloudVision.Controls.Add(this.checkBoxSeHandlesTextMerge); - this.groupBoxCloudVision.Controls.Add(this.checkBoxCloudVisionSendOriginalImages); - this.groupBoxCloudVision.Controls.Add(this.comboBoxCloudVisionLanguage); - this.groupBoxCloudVision.Controls.Add(this.labelCloudVisionLanguage); - this.groupBoxCloudVision.Controls.Add(this.textBoxCloudVisionApiKey); - this.groupBoxCloudVision.Controls.Add(this.labelCloudVisionApiKey); - this.groupBoxCloudVision.Location = new System.Drawing.Point(7, 38); - this.groupBoxCloudVision.Name = "groupBoxCloudVision"; - this.groupBoxCloudVision.Size = new System.Drawing.Size(372, 143); - this.groupBoxCloudVision.TabIndex = 8; - this.groupBoxCloudVision.TabStop = false; - this.groupBoxCloudVision.Text = "Cloud Vision API"; - // - // checkBoxSeHandlesTextMerge - // - this.checkBoxSeHandlesTextMerge.AutoSize = true; - this.checkBoxSeHandlesTextMerge.Location = new System.Drawing.Point(9, 104); - this.checkBoxSeHandlesTextMerge.Name = "checkBoxSeHandlesTextMerge"; - this.checkBoxSeHandlesTextMerge.Size = new System.Drawing.Size(134, 17); - this.checkBoxSeHandlesTextMerge.TabIndex = 5; - this.checkBoxSeHandlesTextMerge.Text = "SE handles text merge"; - this.checkBoxSeHandlesTextMerge.UseVisualStyleBackColor = true; - this.checkBoxSeHandlesTextMerge.CheckedChanged += new System.EventHandler(this.checkBoxSeHandlesTextMerge_CheckedChanged); - // - // checkBoxCloudVisionSendOriginalImages - // - this.checkBoxCloudVisionSendOriginalImages.AutoSize = true; - this.checkBoxCloudVisionSendOriginalImages.Location = new System.Drawing.Point(9, 80); - this.checkBoxCloudVisionSendOriginalImages.Name = "checkBoxCloudVisionSendOriginalImages"; - this.checkBoxCloudVisionSendOriginalImages.Size = new System.Drawing.Size(123, 17); - this.checkBoxCloudVisionSendOriginalImages.TabIndex = 4; - this.checkBoxCloudVisionSendOriginalImages.Text = "Send original images"; - this.checkBoxCloudVisionSendOriginalImages.UseVisualStyleBackColor = true; - this.checkBoxCloudVisionSendOriginalImages.Visible = false; - this.checkBoxCloudVisionSendOriginalImages.CheckedChanged += new System.EventHandler(this.checkBoxCloudVisionSendOriginalImages_CheckedChanged); - // - // comboBoxCloudVisionLanguage - // - this.comboBoxCloudVisionLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBoxCloudVisionLanguage.FormattingEnabled = true; - this.comboBoxCloudVisionLanguage.Location = new System.Drawing.Point(87, 49); - this.comboBoxCloudVisionLanguage.Name = "comboBoxCloudVisionLanguage"; - this.comboBoxCloudVisionLanguage.Size = new System.Drawing.Size(279, 21); - this.comboBoxCloudVisionLanguage.TabIndex = 3; - // - // labelCloudVisionLanguage - // - this.labelCloudVisionLanguage.AutoSize = true; - this.labelCloudVisionLanguage.Location = new System.Drawing.Point(6, 52); - this.labelCloudVisionLanguage.Name = "labelCloudVisionLanguage"; - this.labelCloudVisionLanguage.Size = new System.Drawing.Size(54, 13); - this.labelCloudVisionLanguage.TabIndex = 2; - this.labelCloudVisionLanguage.Text = "Language"; - // - // textBoxCloudVisionApiKey - // - this.textBoxCloudVisionApiKey.Location = new System.Drawing.Point(87, 22); - this.textBoxCloudVisionApiKey.Name = "textBoxCloudVisionApiKey"; - this.textBoxCloudVisionApiKey.Size = new System.Drawing.Size(279, 21); - this.textBoxCloudVisionApiKey.TabIndex = 1; - // - // labelCloudVisionApiKey - // - this.labelCloudVisionApiKey.AutoSize = true; - this.labelCloudVisionApiKey.Location = new System.Drawing.Point(6, 25); - this.labelCloudVisionApiKey.Name = "labelCloudVisionApiKey"; - this.labelCloudVisionApiKey.Size = new System.Drawing.Size(44, 13); - this.labelCloudVisionApiKey.TabIndex = 0; - this.labelCloudVisionApiKey.Text = "API key"; - // // groupBoxNOCR // this.groupBoxNOCR.Controls.Add(this.label3); @@ -1181,6 +1109,78 @@ namespace Nikse.SubtitleEdit.Forms.Ocr this.comboBoxModiLanguage.TabIndex = 0; this.comboBoxModiLanguage.SelectedIndexChanged += new System.EventHandler(this.ComboBoxModiLanguageSelectedIndexChanged); // + // groupBoxCloudVision + // + this.groupBoxCloudVision.Controls.Add(this.checkBoxSeHandlesTextMerge); + this.groupBoxCloudVision.Controls.Add(this.checkBoxCloudVisionSendOriginalImages); + this.groupBoxCloudVision.Controls.Add(this.comboBoxCloudVisionLanguage); + this.groupBoxCloudVision.Controls.Add(this.labelCloudVisionLanguage); + this.groupBoxCloudVision.Controls.Add(this.textBoxCloudVisionApiKey); + this.groupBoxCloudVision.Controls.Add(this.labelCloudVisionApiKey); + this.groupBoxCloudVision.Location = new System.Drawing.Point(7, 38); + this.groupBoxCloudVision.Name = "groupBoxCloudVision"; + this.groupBoxCloudVision.Size = new System.Drawing.Size(372, 143); + this.groupBoxCloudVision.TabIndex = 8; + this.groupBoxCloudVision.TabStop = false; + this.groupBoxCloudVision.Text = "Cloud Vision API"; + // + // checkBoxSeHandlesTextMerge + // + this.checkBoxSeHandlesTextMerge.AutoSize = true; + this.checkBoxSeHandlesTextMerge.Location = new System.Drawing.Point(9, 104); + this.checkBoxSeHandlesTextMerge.Name = "checkBoxSeHandlesTextMerge"; + this.checkBoxSeHandlesTextMerge.Size = new System.Drawing.Size(134, 17); + this.checkBoxSeHandlesTextMerge.TabIndex = 5; + this.checkBoxSeHandlesTextMerge.Text = "SE handles text merge"; + this.checkBoxSeHandlesTextMerge.UseVisualStyleBackColor = true; + this.checkBoxSeHandlesTextMerge.CheckedChanged += new System.EventHandler(this.checkBoxSeHandlesTextMerge_CheckedChanged); + // + // checkBoxCloudVisionSendOriginalImages + // + this.checkBoxCloudVisionSendOriginalImages.AutoSize = true; + this.checkBoxCloudVisionSendOriginalImages.Location = new System.Drawing.Point(9, 80); + this.checkBoxCloudVisionSendOriginalImages.Name = "checkBoxCloudVisionSendOriginalImages"; + this.checkBoxCloudVisionSendOriginalImages.Size = new System.Drawing.Size(123, 17); + this.checkBoxCloudVisionSendOriginalImages.TabIndex = 4; + this.checkBoxCloudVisionSendOriginalImages.Text = "Send original images"; + this.checkBoxCloudVisionSendOriginalImages.UseVisualStyleBackColor = true; + this.checkBoxCloudVisionSendOriginalImages.Visible = false; + this.checkBoxCloudVisionSendOriginalImages.CheckedChanged += new System.EventHandler(this.checkBoxCloudVisionSendOriginalImages_CheckedChanged); + // + // comboBoxCloudVisionLanguage + // + this.comboBoxCloudVisionLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxCloudVisionLanguage.FormattingEnabled = true; + this.comboBoxCloudVisionLanguage.Location = new System.Drawing.Point(87, 49); + this.comboBoxCloudVisionLanguage.Name = "comboBoxCloudVisionLanguage"; + this.comboBoxCloudVisionLanguage.Size = new System.Drawing.Size(279, 21); + this.comboBoxCloudVisionLanguage.TabIndex = 3; + // + // labelCloudVisionLanguage + // + this.labelCloudVisionLanguage.AutoSize = true; + this.labelCloudVisionLanguage.Location = new System.Drawing.Point(6, 52); + this.labelCloudVisionLanguage.Name = "labelCloudVisionLanguage"; + this.labelCloudVisionLanguage.Size = new System.Drawing.Size(54, 13); + this.labelCloudVisionLanguage.TabIndex = 2; + this.labelCloudVisionLanguage.Text = "Language"; + // + // textBoxCloudVisionApiKey + // + this.textBoxCloudVisionApiKey.Location = new System.Drawing.Point(87, 22); + this.textBoxCloudVisionApiKey.Name = "textBoxCloudVisionApiKey"; + this.textBoxCloudVisionApiKey.Size = new System.Drawing.Size(279, 21); + this.textBoxCloudVisionApiKey.TabIndex = 1; + // + // labelCloudVisionApiKey + // + this.labelCloudVisionApiKey.AutoSize = true; + this.labelCloudVisionApiKey.Location = new System.Drawing.Point(6, 25); + this.labelCloudVisionApiKey.Name = "labelCloudVisionApiKey"; + this.labelCloudVisionApiKey.Size = new System.Drawing.Size(44, 13); + this.labelCloudVisionApiKey.TabIndex = 0; + this.labelCloudVisionApiKey.Text = "API key"; + // // groupBoxOCRControls // this.groupBoxOCRControls.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -2072,8 +2072,6 @@ namespace Nikse.SubtitleEdit.Forms.Ocr this.Resize += new System.EventHandler(this.VobSubOcr_Resize); this.contextMenuStripListview.ResumeLayout(false); this.groupBoxOcrMethod.ResumeLayout(false); - this.groupBoxCloudVision.ResumeLayout(false); - this.groupBoxCloudVision.PerformLayout(); this.groupBoxNOCR.ResumeLayout(false); this.groupBoxNOCR.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownNOcrMaxWrongPixels)).EndInit(); @@ -2086,6 +2084,8 @@ namespace Nikse.SubtitleEdit.Forms.Ocr this.GroupBoxTesseractMethod.PerformLayout(); this.groupBoxModiMethod.ResumeLayout(false); this.groupBoxModiMethod.PerformLayout(); + this.groupBoxCloudVision.ResumeLayout(false); + this.groupBoxCloudVision.PerformLayout(); this.groupBoxOCRControls.ResumeLayout(false); this.groupBoxOCRControls.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownStartNumber)).EndInit(); diff --git a/src/ui/Forms/Ocr/VobSubOcr.cs b/src/ui/Forms/Ocr/VobSubOcr.cs index cefe304c3..d0ea2fa33 100644 --- a/src/ui/Forms/Ocr/VobSubOcr.cs +++ b/src/ui/Forms/Ocr/VobSubOcr.cs @@ -330,7 +330,7 @@ namespace Nikse.SubtitleEdit.Forms.Ocr // Dictionaries/spellchecking/fixing private OcrFixEngine _ocrFixEngine; private int _tesseractOcrAutoFixes; - private string Tesseract5Version = "5.3.0"; + private string Tesseract5Version = "5.3.1"; private Subtitle _bdnXmlOriginal; private Subtitle _bdnXmlSubtitle; @@ -7108,7 +7108,13 @@ namespace Nikse.SubtitleEdit.Forms.Ocr checkBoxTesseractFallback.Text = string.Format(LanguageSettings.Current.VobSubOcr.FallbackToX, "Tesseract 3.02"); if (Configuration.IsRunningOnWindows && !File.Exists(Path.Combine(Configuration.TesseractDirectory, "tesseract.exe"))) { - if (MessageBox.Show($"{LanguageSettings.Current.GetTesseractDictionaries.Download} Tesseract {Tesseract5Version}", LanguageSettings.Current.General.Title, MessageBoxButtons.YesNoCancel) == DialogResult.Yes) + if (IntPtr.Size * 8 == 32) + { + MessageBox.Show("Sorry, Tesseract {Tesseract5Version} requires a 64-bit processor"); + comboBoxOcrMethod.SelectedIndex = _ocrMethodBinaryImageCompare; + return; + } + else if (MessageBox.Show($"{LanguageSettings.Current.GetTesseractDictionaries.Download} Tesseract {Tesseract5Version}", LanguageSettings.Current.General.Title, MessageBoxButtons.YesNoCancel) == DialogResult.Yes) { comboBoxTesseractLanguages.Items.Clear(); using (var form = new DownloadTesseract5(Tesseract5Version)) @@ -9784,13 +9790,14 @@ namespace Nikse.SubtitleEdit.Forms.Ocr Configuration.Settings.Tools.OcrGoogleCloudVisionSeHandlesTextMerge = checkBoxSeHandlesTextMerge.Checked; } - public void FindDialogFind(string findText, ReplaceType findReplaceType) + public void FindDialogFind(string findText, ReplaceType findReplaceType, Regex regex) { _findHelper = _findHelper ?? _findDialog.GetFindDialogHelper(_selectedIndex); _findHelper.FindText = findText; _findHelper.FindTextLength = findText.Length; _findHelper.FindReplaceType = findReplaceType; _findHelper.InProgress = true; + _findHelper.SetRegex(regex); if (!string.IsNullOrWhiteSpace(_findHelper.FindText)) { if (Configuration.Settings.Tools.FindHistory.Count == 0 || Configuration.Settings.Tools.FindHistory[0] != _findHelper.FindText) diff --git a/src/ui/Forms/Options/Settings.Designer.cs b/src/ui/Forms/Options/Settings.Designer.cs index df79eb749..fac547ac2 100644 --- a/src/ui/Forms/Options/Settings.Designer.cs +++ b/src/ui/Forms/Options/Settings.Designer.cs @@ -176,6 +176,8 @@ this.labelCustomSearch = new System.Windows.Forms.Label(); this.comboBoxCustomSearch1 = new System.Windows.Forms.ComboBox(); this.groupBoxVideoPlayerDefault = new System.Windows.Forms.GroupBox(); + this.numericUpDownMarginVertical = new System.Windows.Forms.NumericUpDown(); + this.labelMarginVertical = new System.Windows.Forms.Label(); this.panelMpvBackColor = new System.Windows.Forms.Panel(); this.buttonMpvBackColor = new System.Windows.Forms.Button(); this.panelMpvOutlineColor = new System.Windows.Forms.Panel(); @@ -320,6 +322,7 @@ this.groupBox2 = new System.Windows.Forms.GroupBox(); this.checkBoxShowFrameRate = new System.Windows.Forms.CheckBox(); this.groupBoxShowToolBarButtons = new System.Windows.Forms.GroupBox(); + this.pictureBoxWebVttStyle = new System.Windows.Forms.PictureBox(); this.pictureBoxEbuProperties = new System.Windows.Forms.PictureBox(); this.pictureBoxWebVttProperties = new System.Windows.Forms.PictureBox(); this.pictureBoxIttProperties = new System.Windows.Forms.PictureBox(); @@ -329,8 +332,6 @@ this.pictureBoxAssAttachments = new System.Windows.Forms.PictureBox(); this.pictureBoxAssProperties = new System.Windows.Forms.PictureBox(); this.pictureBoxAssStyleManager = new System.Windows.Forms.PictureBox(); - this.labelToolbarIconTheme = new System.Windows.Forms.Label(); - this.comboBoxToolbarIconTheme = new System.Windows.Forms.ComboBox(); this.labelToggleSourceView = new System.Windows.Forms.Label(); this.pictureBoxSourceView = new System.Windows.Forms.PictureBox(); this.checkBoxTBToggleSourceView = new System.Windows.Forms.CheckBox(); @@ -381,6 +382,12 @@ this.checkBoxToolbarNew = new System.Windows.Forms.CheckBox(); this.panelFont = new System.Windows.Forms.Panel(); this.groupBoxAppearance = new System.Windows.Forms.GroupBox(); + this.groupBoxGraphicsButtons = new System.Windows.Forms.GroupBox(); + this.pictureBoxPreview3 = new System.Windows.Forms.PictureBox(); + this.pictureBoxPreview2 = new System.Windows.Forms.PictureBox(); + this.pictureBoxPreview1 = new System.Windows.Forms.PictureBox(); + this.labelToolbarIconTheme = new System.Windows.Forms.Label(); + this.comboBoxToolbarIconTheme = new System.Windows.Forms.ComboBox(); this.groupBoxFontInUI = new System.Windows.Forms.GroupBox(); this.groupBoxFontGeneral = new System.Windows.Forms.GroupBox(); this.comboBoxSubtitleFont = new System.Windows.Forms.ComboBox(); @@ -467,6 +474,7 @@ this.panelVideoPlayer.SuspendLayout(); this.groupBoxMainWindowVideoControls.SuspendLayout(); this.groupBoxVideoPlayerDefault.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMarginVertical)).BeginInit(); this.groupBoxMpvBorder.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMpvShadowWidth)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMpvOutline)).BeginInit(); @@ -489,6 +497,7 @@ this.panelToolBar.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBoxShowToolBarButtons.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxWebVttStyle)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxEbuProperties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxWebVttProperties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxIttProperties)).BeginInit(); @@ -516,6 +525,10 @@ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxFileNew)).BeginInit(); this.panelFont.SuspendLayout(); this.groupBoxAppearance.SuspendLayout(); + this.groupBoxGraphicsButtons.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxPreview3)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxPreview2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxPreview1)).BeginInit(); this.groupBoxFontInUI.SuspendLayout(); this.groupBoxFontGeneral.SuspendLayout(); this.groupBoxFontListViews.SuspendLayout(); @@ -2385,6 +2398,8 @@ // this.groupBoxVideoPlayerDefault.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxVideoPlayerDefault.Controls.Add(this.numericUpDownMarginVertical); + this.groupBoxVideoPlayerDefault.Controls.Add(this.labelMarginVertical); this.groupBoxVideoPlayerDefault.Controls.Add(this.panelMpvBackColor); this.groupBoxVideoPlayerDefault.Controls.Add(this.buttonMpvBackColor); this.groupBoxVideoPlayerDefault.Controls.Add(this.panelMpvOutlineColor); @@ -2408,10 +2423,31 @@ this.groupBoxVideoPlayerDefault.TabIndex = 14; this.groupBoxVideoPlayerDefault.TabStop = false; // + // numericUpDownMarginVertical + // + this.numericUpDownMarginVertical.Location = new System.Drawing.Point(380, 153); + this.numericUpDownMarginVertical.Maximum = new decimal(new int[] { + 1000, + 0, + 0, + 0}); + this.numericUpDownMarginVertical.Name = "numericUpDownMarginVertical"; + this.numericUpDownMarginVertical.Size = new System.Drawing.Size(44, 21); + this.numericUpDownMarginVertical.TabIndex = 21; + // + // labelMarginVertical + // + this.labelMarginVertical.AutoSize = true; + this.labelMarginVertical.Location = new System.Drawing.Point(325, 155); + this.labelMarginVertical.Name = "labelMarginVertical"; + this.labelMarginVertical.Size = new System.Drawing.Size(42, 13); + this.labelMarginVertical.TabIndex = 20; + this.labelMarginVertical.Text = "Vertical"; + // // panelMpvBackColor // this.panelMpvBackColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panelMpvBackColor.Location = new System.Drawing.Point(399, 125); + this.panelMpvBackColor.Location = new System.Drawing.Point(420, 125); this.panelMpvBackColor.Name = "panelMpvBackColor"; this.panelMpvBackColor.Size = new System.Drawing.Size(21, 20); this.panelMpvBackColor.TabIndex = 19; @@ -2421,7 +2457,7 @@ // this.buttonMpvBackColor.Location = new System.Drawing.Point(325, 124); this.buttonMpvBackColor.Name = "buttonMpvBackColor"; - this.buttonMpvBackColor.Size = new System.Drawing.Size(69, 23); + this.buttonMpvBackColor.Size = new System.Drawing.Size(89, 23); this.buttonMpvBackColor.TabIndex = 18; this.buttonMpvBackColor.Text = "Shadow"; this.buttonMpvBackColor.UseVisualStyleBackColor = true; @@ -2430,7 +2466,7 @@ // panelMpvOutlineColor // this.panelMpvOutlineColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panelMpvOutlineColor.Location = new System.Drawing.Point(387, 96); + this.panelMpvOutlineColor.Location = new System.Drawing.Point(420, 96); this.panelMpvOutlineColor.Name = "panelMpvOutlineColor"; this.panelMpvOutlineColor.Size = new System.Drawing.Size(21, 20); this.panelMpvOutlineColor.TabIndex = 17; @@ -2440,7 +2476,7 @@ // this.buttonMpvOutlineColor.Location = new System.Drawing.Point(325, 95); this.buttonMpvOutlineColor.Name = "buttonMpvOutlineColor"; - this.buttonMpvOutlineColor.Size = new System.Drawing.Size(58, 23); + this.buttonMpvOutlineColor.Size = new System.Drawing.Size(89, 23); this.buttonMpvOutlineColor.TabIndex = 16; this.buttonMpvOutlineColor.Text = "Outline"; this.buttonMpvOutlineColor.UseVisualStyleBackColor = true; @@ -2449,7 +2485,7 @@ // panelMpvPrimaryColor // this.panelMpvPrimaryColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.panelMpvPrimaryColor.Location = new System.Drawing.Point(403, 67); + this.panelMpvPrimaryColor.Location = new System.Drawing.Point(420, 67); this.panelMpvPrimaryColor.Name = "panelMpvPrimaryColor"; this.panelMpvPrimaryColor.Size = new System.Drawing.Size(21, 20); this.panelMpvPrimaryColor.TabIndex = 15; @@ -2459,7 +2495,7 @@ // this.buttonMpvPrimaryColor.Location = new System.Drawing.Point(325, 66); this.buttonMpvPrimaryColor.Name = "buttonMpvPrimaryColor"; - this.buttonMpvPrimaryColor.Size = new System.Drawing.Size(72, 23); + this.buttonMpvPrimaryColor.Size = new System.Drawing.Size(89, 23); this.buttonMpvPrimaryColor.TabIndex = 14; this.buttonMpvPrimaryColor.Text = "&Primary"; this.buttonMpvPrimaryColor.UseVisualStyleBackColor = true; @@ -4044,6 +4080,7 @@ // this.groupBoxShowToolBarButtons.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxShowToolBarButtons.Controls.Add(this.pictureBoxWebVttStyle); this.groupBoxShowToolBarButtons.Controls.Add(this.pictureBoxEbuProperties); this.groupBoxShowToolBarButtons.Controls.Add(this.pictureBoxWebVttProperties); this.groupBoxShowToolBarButtons.Controls.Add(this.pictureBoxIttProperties); @@ -4053,8 +4090,6 @@ this.groupBoxShowToolBarButtons.Controls.Add(this.pictureBoxAssAttachments); this.groupBoxShowToolBarButtons.Controls.Add(this.pictureBoxAssProperties); this.groupBoxShowToolBarButtons.Controls.Add(this.pictureBoxAssStyleManager); - this.groupBoxShowToolBarButtons.Controls.Add(this.labelToolbarIconTheme); - this.groupBoxShowToolBarButtons.Controls.Add(this.comboBoxToolbarIconTheme); this.groupBoxShowToolBarButtons.Controls.Add(this.labelToggleSourceView); this.groupBoxShowToolBarButtons.Controls.Add(this.pictureBoxSourceView); this.groupBoxShowToolBarButtons.Controls.Add(this.checkBoxTBToggleSourceView); @@ -4110,9 +4145,17 @@ this.groupBoxShowToolBarButtons.TabStop = false; this.groupBoxShowToolBarButtons.Text = "Show toolbar buttons"; // + // pictureBoxWebVttStyle + // + this.pictureBoxWebVttStyle.Location = new System.Drawing.Point(285, 400); + this.pictureBoxWebVttStyle.Name = "pictureBoxWebVttStyle"; + this.pictureBoxWebVttStyle.Size = new System.Drawing.Size(32, 32); + this.pictureBoxWebVttStyle.TabIndex = 60; + this.pictureBoxWebVttStyle.TabStop = false; + // // pictureBoxEbuProperties // - this.pictureBoxEbuProperties.Location = new System.Drawing.Point(323, 400); + this.pictureBoxEbuProperties.Location = new System.Drawing.Point(361, 400); this.pictureBoxEbuProperties.Name = "pictureBoxEbuProperties"; this.pictureBoxEbuProperties.Size = new System.Drawing.Size(32, 32); this.pictureBoxEbuProperties.TabIndex = 59; @@ -4120,7 +4163,7 @@ // // pictureBoxWebVttProperties // - this.pictureBoxWebVttProperties.Location = new System.Drawing.Point(285, 400); + this.pictureBoxWebVttProperties.Location = new System.Drawing.Point(324, 400); this.pictureBoxWebVttProperties.Name = "pictureBoxWebVttProperties"; this.pictureBoxWebVttProperties.Size = new System.Drawing.Size(32, 32); this.pictureBoxWebVttProperties.TabIndex = 58; @@ -4168,7 +4211,7 @@ // // pictureBoxAssProperties // - this.pictureBoxAssProperties.Location = new System.Drawing.Point(57, 400); + this.pictureBoxAssProperties.Location = new System.Drawing.Point(56, 400); this.pictureBoxAssProperties.Name = "pictureBoxAssProperties"; this.pictureBoxAssProperties.Size = new System.Drawing.Size(32, 32); this.pictureBoxAssProperties.TabIndex = 52; @@ -4182,25 +4225,6 @@ this.pictureBoxAssStyleManager.TabIndex = 51; this.pictureBoxAssStyleManager.TabStop = false; // - // labelToolbarIconTheme - // - this.labelToolbarIconTheme.AutoSize = true; - this.labelToolbarIconTheme.Location = new System.Drawing.Point(15, 346); - this.labelToolbarIconTheme.Name = "labelToolbarIconTheme"; - this.labelToolbarIconTheme.Size = new System.Drawing.Size(39, 13); - this.labelToolbarIconTheme.TabIndex = 50; - this.labelToolbarIconTheme.Text = "Theme"; - // - // comboBoxToolbarIconTheme - // - this.comboBoxToolbarIconTheme.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBoxToolbarIconTheme.FormattingEnabled = true; - this.comboBoxToolbarIconTheme.Location = new System.Drawing.Point(15, 361); - this.comboBoxToolbarIconTheme.Name = "comboBoxToolbarIconTheme"; - this.comboBoxToolbarIconTheme.Size = new System.Drawing.Size(202, 21); - this.comboBoxToolbarIconTheme.TabIndex = 49; - this.comboBoxToolbarIconTheme.SelectedIndexChanged += new System.EventHandler(this.comboBoxToolbarIconTheme_SelectedIndexChanged); - // // labelToggleSourceView // this.labelToggleSourceView.AutoSize = true; @@ -4647,6 +4671,7 @@ this.groupBoxAppearance.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxAppearance.Controls.Add(this.groupBoxGraphicsButtons); this.groupBoxAppearance.Controls.Add(this.groupBoxFontInUI); this.groupBoxAppearance.Controls.Add(this.groupBoxDarkTheme); this.groupBoxAppearance.Controls.Add(this.labelFontNote); @@ -4657,6 +4682,62 @@ this.groupBoxAppearance.TabStop = false; this.groupBoxAppearance.Text = "Appearance"; // + // groupBoxGraphicsButtons + // + this.groupBoxGraphicsButtons.Controls.Add(this.pictureBoxPreview3); + this.groupBoxGraphicsButtons.Controls.Add(this.pictureBoxPreview2); + this.groupBoxGraphicsButtons.Controls.Add(this.pictureBoxPreview1); + this.groupBoxGraphicsButtons.Controls.Add(this.labelToolbarIconTheme); + this.groupBoxGraphicsButtons.Controls.Add(this.comboBoxToolbarIconTheme); + this.groupBoxGraphicsButtons.Location = new System.Drawing.Point(383, 310); + this.groupBoxGraphicsButtons.Name = "groupBoxGraphicsButtons"; + this.groupBoxGraphicsButtons.Size = new System.Drawing.Size(461, 109); + this.groupBoxGraphicsButtons.TabIndex = 41; + this.groupBoxGraphicsButtons.TabStop = false; + this.groupBoxGraphicsButtons.Text = "Graphics buttons"; + // + // pictureBoxPreview3 + // + this.pictureBoxPreview3.Location = new System.Drawing.Point(306, 31); + this.pictureBoxPreview3.Name = "pictureBoxPreview3"; + this.pictureBoxPreview3.Size = new System.Drawing.Size(32, 32); + this.pictureBoxPreview3.TabIndex = 56; + this.pictureBoxPreview3.TabStop = false; + // + // pictureBoxPreview2 + // + this.pictureBoxPreview2.Location = new System.Drawing.Point(267, 31); + this.pictureBoxPreview2.Name = "pictureBoxPreview2"; + this.pictureBoxPreview2.Size = new System.Drawing.Size(32, 32); + this.pictureBoxPreview2.TabIndex = 55; + this.pictureBoxPreview2.TabStop = false; + // + // pictureBoxPreview1 + // + this.pictureBoxPreview1.Location = new System.Drawing.Point(230, 31); + this.pictureBoxPreview1.Name = "pictureBoxPreview1"; + this.pictureBoxPreview1.Size = new System.Drawing.Size(32, 32); + this.pictureBoxPreview1.TabIndex = 54; + this.pictureBoxPreview1.TabStop = false; + // + // labelToolbarIconTheme + // + this.labelToolbarIconTheme.AutoSize = true; + this.labelToolbarIconTheme.Location = new System.Drawing.Point(13, 23); + this.labelToolbarIconTheme.Name = "labelToolbarIconTheme"; + this.labelToolbarIconTheme.Size = new System.Drawing.Size(39, 13); + this.labelToolbarIconTheme.TabIndex = 52; + this.labelToolbarIconTheme.Text = "Theme"; + // + // comboBoxToolbarIconTheme + // + this.comboBoxToolbarIconTheme.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBoxToolbarIconTheme.FormattingEnabled = true; + this.comboBoxToolbarIconTheme.Location = new System.Drawing.Point(13, 38); + this.comboBoxToolbarIconTheme.Name = "comboBoxToolbarIconTheme"; + this.comboBoxToolbarIconTheme.Size = new System.Drawing.Size(202, 21); + this.comboBoxToolbarIconTheme.TabIndex = 51; + // // groupBoxFontInUI // this.groupBoxFontInUI.Controls.Add(this.groupBoxFontGeneral); @@ -4984,9 +5065,9 @@ this.groupBoxDarkTheme.Controls.Add(this.buttonDarkThemeBackColor); this.groupBoxDarkTheme.Controls.Add(this.panelDarkThemeColor); this.groupBoxDarkTheme.Controls.Add(this.buttonDarkThemeColor); - this.groupBoxDarkTheme.Location = new System.Drawing.Point(5, 307); + this.groupBoxDarkTheme.Location = new System.Drawing.Point(6, 307); this.groupBoxDarkTheme.Name = "groupBoxDarkTheme"; - this.groupBoxDarkTheme.Size = new System.Drawing.Size(839, 114); + this.groupBoxDarkTheme.Size = new System.Drawing.Size(368, 114); this.groupBoxDarkTheme.TabIndex = 40; this.groupBoxDarkTheme.TabStop = false; this.groupBoxDarkTheme.Text = "Dark theme"; @@ -5333,13 +5414,13 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1092, 574); this.Controls.Add(this.labelUpdateFileTypeAssociationsStatus); - this.Controls.Add(this.panelToolBar); this.Controls.Add(this.panelVideoPlayer); + this.Controls.Add(this.panelFont); + this.Controls.Add(this.panelToolBar); this.Controls.Add(this.panelTools); this.Controls.Add(this.panelWaveform); this.Controls.Add(this.panelGeneral); this.Controls.Add(this.panelShortcuts); - this.Controls.Add(this.panelFont); this.Controls.Add(this.panelNetwork); this.Controls.Add(this.panelFileTypeAssociations); this.Controls.Add(this.panelSubtitleFormats); @@ -5390,6 +5471,7 @@ this.groupBoxMainWindowVideoControls.PerformLayout(); this.groupBoxVideoPlayerDefault.ResumeLayout(false); this.groupBoxVideoPlayerDefault.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMarginVertical)).EndInit(); this.groupBoxMpvBorder.ResumeLayout(false); this.groupBoxMpvBorder.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMpvShadowWidth)).EndInit(); @@ -5427,6 +5509,7 @@ this.groupBox2.PerformLayout(); this.groupBoxShowToolBarButtons.ResumeLayout(false); this.groupBoxShowToolBarButtons.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxWebVttStyle)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxEbuProperties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxWebVttProperties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxIttProperties)).EndInit(); @@ -5455,6 +5538,11 @@ this.panelFont.ResumeLayout(false); this.groupBoxAppearance.ResumeLayout(false); this.groupBoxAppearance.PerformLayout(); + this.groupBoxGraphicsButtons.ResumeLayout(false); + this.groupBoxGraphicsButtons.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxPreview3)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxPreview2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxPreview1)).EndInit(); this.groupBoxFontInUI.ResumeLayout(false); this.groupBoxFontGeneral.ResumeLayout(false); this.groupBoxFontGeneral.PerformLayout(); @@ -5883,8 +5971,6 @@ private System.Windows.Forms.Panel panelMpvPrimaryColor; private System.Windows.Forms.Button buttonMpvPrimaryColor; private System.Windows.Forms.Button buttonEditShotChangesProfile; - private System.Windows.Forms.Label labelToolbarIconTheme; - private System.Windows.Forms.ComboBox comboBoxToolbarIconTheme; private System.Windows.Forms.PictureBox pictureBoxAssStyleManager; private System.Windows.Forms.PictureBox pictureBoxAssAttachments; private System.Windows.Forms.PictureBox pictureBoxAssProperties; @@ -5894,5 +5980,14 @@ private System.Windows.Forms.PictureBox pictureBoxEbuProperties; private System.Windows.Forms.PictureBox pictureBoxWebVttProperties; private System.Windows.Forms.PictureBox pictureBoxIttProperties; + private System.Windows.Forms.PictureBox pictureBoxWebVttStyle; + private System.Windows.Forms.NumericUpDown numericUpDownMarginVertical; + private System.Windows.Forms.Label labelMarginVertical; + private System.Windows.Forms.GroupBox groupBoxGraphicsButtons; + private System.Windows.Forms.PictureBox pictureBoxPreview3; + private System.Windows.Forms.PictureBox pictureBoxPreview2; + private System.Windows.Forms.PictureBox pictureBoxPreview1; + private System.Windows.Forms.Label labelToolbarIconTheme; + private System.Windows.Forms.ComboBox comboBoxToolbarIconTheme; } } \ No newline at end of file diff --git a/src/ui/Forms/Options/Settings.cs b/src/ui/Forms/Options/Settings.cs index d44c91f2f..46e2ec2f4 100644 --- a/src/ui/Forms/Options/Settings.cs +++ b/src/ui/Forms/Options/Settings.cs @@ -39,7 +39,7 @@ namespace Nikse.SubtitleEdit.Forms.Options private readonly Dictionary _newShortcuts = new Dictionary(); private List _rulesProfiles; private List _pluginShortcuts; - + private bool _loading = true; private readonly BackgroundWorker _shortcutsBackgroundWorker; private static IEnumerable GetSubtitleFormats() => SubtitleFormat.AllSubtitleFormats.Where(format => !format.IsVobSubIndexFile).Select(format => format.FriendlyName); @@ -109,8 +109,10 @@ namespace Nikse.SubtitleEdit.Forms.Options UiUtil.FixFonts(this); UiUtil.FixLargeFonts(this, buttonOK); + _shortcutsBackgroundWorker = new BackgroundWorker(); Init(); + _loading = false; _oldSettings = Core.Common.Settings.CustomSerialize(Configuration.Settings); } @@ -268,6 +270,16 @@ namespace Nikse.SubtitleEdit.Forms.Options comboBoxlVideoPlayerPreviewFontSize.SelectedIndex = 3; } + var verticalMargin = gs.MpvPreviewTextMarginVertical; + if (verticalMargin >= numericUpDownMarginVertical.Minimum && verticalMargin <= numericUpDownMarginVertical.Maximum) + { + numericUpDownMarginVertical.Value = verticalMargin; + } + else + { + numericUpDownMarginVertical.Value = 10; + } + numericUpDownMpvOutline.Value = gs.MpvPreviewTextOutlineWidth; numericUpDownMpvShadowWidth.Value = gs.MpvPreviewTextShadowWidth; checkBoxVideoPlayerPreviewFontBold.Checked = gs.VideoPlayerPreviewFontBold; @@ -532,6 +544,7 @@ namespace Nikse.SubtitleEdit.Forms.Options buttonTextBoxHtmlColor.Text = language.HtmlColor; buttonTextBoxAssColor.Text = language.AssaColor; groupBoxDarkTheme.Text = language.DarkTheme; + groupBoxGraphicsButtons.Text = language.GraphicsButtons; checkBoxDarkThemeEnabled.Text = language.DarkThemeEnabled; checkBoxDarkThemeShowListViewGridLines.Text = language.DarkThemeShowGridViewLines; buttonDarkThemeColor.Text = language.WaveformTextColor; @@ -649,6 +662,9 @@ namespace Nikse.SubtitleEdit.Forms.Options buttonMpvPrimaryColor.Text = LanguageSettings.Current.SubStationAlphaStyles.Primary; buttonMpvOutlineColor.Text = LanguageSettings.Current.SubStationAlphaStyles.Outline; buttonMpvBackColor.Text = LanguageSettings.Current.SubStationAlphaStyles.Shadow; + labelMarginVertical.Text = language.PreviewVerticalMargin; + numericUpDownMarginVertical.Left = labelMarginVertical.Right + 5; + checkBoxVideoPlayerPreviewFontBold.Text = language.SubtitleBold; var left = labelVideoPlayerPreviewFontName.Left + 5 + Math.Max(labelVideoPlayerPreviewFontName.Width, labelVideoPlayerPreviewFontSize.Width); @@ -1203,6 +1219,10 @@ namespace Nikse.SubtitleEdit.Forms.Options buttonUpdateFileTypeAssociations.Text = language.UpdateFileTypeAssociations; labelUpdateFileTypeAssociationsStatus.Text = string.Empty; + numericUpDownMpvOutline.Left = radioButtonMpvOutline.Right + 9; + numericUpDownMpvShadowWidth.Left = numericUpDownMpvOutline.Right + 9; + labelMpvShadow.Left = numericUpDownMpvShadowWidth.Left; + checkBoxDarkThemeEnabled_CheckedChanged(null, null); ToolbarIconThemeInit(); @@ -1214,6 +1234,7 @@ namespace Nikse.SubtitleEdit.Forms.Options { comboBoxToolbarIconTheme.Visible = false; labelToolbarIconTheme.Visible = false; + return; } comboBoxToolbarIconTheme.SelectedIndexChanged -= comboBoxToolbarIconTheme_SelectedIndexChanged; @@ -1236,7 +1257,6 @@ namespace Nikse.SubtitleEdit.Forms.Options } comboBoxToolbarIconTheme.SelectedIndexChanged += comboBoxToolbarIconTheme_SelectedIndexChanged; - } private void ShowMpvVideoOutput() @@ -1534,6 +1554,7 @@ namespace Nikse.SubtitleEdit.Forms.Options AddNode(videoNode, language.MainToggleVideoControls, nameof(Configuration.Settings.Shortcuts.MainVideoToggleControls)); AddNode(videoNode, string.Format(language.AudioToTextX, "Vosk"), nameof(Configuration.Settings.Shortcuts.MainVideoAudioToTextVosk)); AddNode(videoNode, string.Format(language.AudioToTextX, "Whisper"), nameof(Configuration.Settings.Shortcuts.MainVideoAudioToTextWhisper)); + AddNode(videoNode, language.AudioExtractSelectedLines, nameof(Configuration.Settings.Shortcuts.MainVideoAudioExtractAudioSelectedLines)); AddNode(videoNode, language.VideoToggleContrast, nameof(Configuration.Settings.Shortcuts.MainVideoToggleContrast)); AddNode(videoNode, language.VideoToggleBrightness, nameof(Configuration.Settings.Shortcuts.MainVideoToggleBrightness)); _shortcuts.Nodes.Add(videoNode); @@ -1878,8 +1899,11 @@ namespace Nikse.SubtitleEdit.Forms.Options { Icon = (Icon)icon.Clone(); pictureBoxFileNew.Image = (Image)newFile.Clone(); + pictureBoxPreview1.Image = (Image)newFile.Clone(); pictureBoxFileOpen.Image = (Image)openFile.Clone(); + pictureBoxPreview2.Image = (Image)openFile.Clone(); pictureBoxSave.Image = (Image)saveFile.Clone(); + pictureBoxPreview3.Image = (Image)saveFile.Clone(); pictureBoxSaveAs.Image = (Image)saveFileAs.Clone(); pictureBoxFind.Image = (Image)find.Clone(); pictureBoxReplace.Image = (Image)replace.Clone(); @@ -2028,6 +2052,7 @@ namespace Nikse.SubtitleEdit.Forms.Options gs.VideoPlayerShowFullscreenButton = checkBoxVideoPlayerShowFullscreenButton.Checked; gs.VideoPlayerPreviewFontName = comboBoxVideoPlayerPreviewFontName.SelectedItem.ToString(); gs.VideoPlayerPreviewFontSize = int.Parse(comboBoxlVideoPlayerPreviewFontSize.Items[0].ToString()) + comboBoxlVideoPlayerPreviewFontSize.SelectedIndex; + gs.MpvPreviewTextMarginVertical = (int)numericUpDownMarginVertical.Value; gs.VideoPlayerPreviewFontBold = checkBoxVideoPlayerPreviewFontBold.Checked; gs.MpvPreviewTextPrimaryColor = panelMpvPrimaryColor.BackColor; gs.MpvPreviewTextOutlineColor = panelMpvOutlineColor.BackColor; @@ -2305,6 +2330,9 @@ namespace Nikse.SubtitleEdit.Forms.Options section = panelToolBar; break; case AppearanceSection: + TryLoadIcon(pictureBoxPreview1, "New"); + TryLoadIcon(pictureBoxPreview2, "Open"); + TryLoadIcon(pictureBoxPreview3, "Save"); section = panelFont; break; case NetworkSection: @@ -3265,6 +3293,8 @@ namespace Nikse.SubtitleEdit.Forms.Options buttonDarkThemeBackColor.Enabled = enabled; panelDarkThemeBackColor.Enabled = enabled; checkBoxDarkThemeShowListViewGridLines.Enabled = enabled; + + comboBoxToolbarIconTheme_SelectedIndexChanged(null, null); } private void listBoxFavoriteSubtitleFormats_SelectedIndexChanged(object sender, EventArgs e) @@ -3662,6 +3692,15 @@ namespace Nikse.SubtitleEdit.Forms.Options private void comboBoxToolbarIconTheme_SelectedIndexChanged(object sender, EventArgs e) { + if (_loading) + { + return; + } + + TryLoadIcon(pictureBoxPreview1, "New"); + TryLoadIcon(pictureBoxPreview2, "Open"); + TryLoadIcon(pictureBoxPreview3, "Save"); + TryLoadIcon(pictureBoxFileNew, "New"); TryLoadIcon(pictureBoxFileOpen, "Open"); TryLoadIcon(pictureBoxSave, "Save"); @@ -3686,6 +3725,7 @@ namespace Nikse.SubtitleEdit.Forms.Options TryLoadIcon(pictureBoxSourceView, "SourceView"); TryLoadIcon(pictureBoxIttProperties, "IttProperties"); TryLoadIcon(pictureBoxWebVttProperties, "WebVttProperties"); + TryLoadIcon(pictureBoxWebVttStyle, "WebVttStyle"); TryLoadIcon(pictureBoxEbuProperties, "EbuProperties"); } @@ -3694,9 +3734,14 @@ namespace Nikse.SubtitleEdit.Forms.Options pictureBox.Image?.Dispose(); pictureBox.Image = null; - var theme = comboBoxToolbarIconTheme.Text; + var theme = checkBoxDarkThemeEnabled.Checked ? "DarkTheme" : "DefaultTheme"; + if (comboBoxToolbarIconTheme.SelectedIndex != 0) + { + theme = comboBoxToolbarIconTheme.Text; + } + var themeFullPath = Path.Combine(Configuration.IconsDirectory, theme, iconName + ".png"); - if (comboBoxToolbarIconTheme.SelectedIndex > 0 && File.Exists(themeFullPath)) + if (File.Exists(themeFullPath)) { pictureBox.Image = new Bitmap(themeFullPath); return; diff --git a/src/ui/Forms/Options/WordLists.cs b/src/ui/Forms/Options/WordLists.cs index afad8760a..aea61afc8 100644 --- a/src/ui/Forms/Options/WordLists.cs +++ b/src/ui/Forms/Options/WordLists.cs @@ -65,7 +65,9 @@ namespace Nikse.SubtitleEdit.Forms.Options // Specific culture e.g: en-US, en-GB... foreach (var culture in CultureInfo.GetCultures(CultureTypes.SpecificCultures)) { - if (File.Exists(Path.Combine(dir, culture.Name.Replace('-', '_') + "_user.xml"))) + var seFile = Path.Combine(dir, culture.Name.Replace('-', '_') + "_se.xml"); + var userFile = Path.Combine(dir, culture.Name.Replace('-', '_') + "_user.xml"); + if (File.Exists(seFile) || File.Exists(userFile)) { if (!cultures.Contains(culture)) { @@ -80,7 +82,8 @@ namespace Nikse.SubtitleEdit.Forms.Options var ocrFixGeneralFile = Path.Combine(dir, culture.GetThreeLetterIsoLanguageName() + "_OCRFixReplaceList.xml"); var ocrFixUserFile = Path.Combine(dir, culture.GetThreeLetterIsoLanguageName() + "_OCRFixReplaceList_User.xml"); var namesFile = Path.Combine(dir, culture.TwoLetterISOLanguageName + "_names.xml"); - if (File.Exists(ocrFixGeneralFile) || File.Exists(ocrFixUserFile) || File.Exists(namesFile)) + var seFile = Path.Combine(dir, culture.Name.Replace('-', '_') + "_se.xml"); + if (File.Exists(ocrFixGeneralFile) || File.Exists(ocrFixUserFile) || File.Exists(namesFile) || File.Exists(seFile)) { var alreadyInList = false; foreach (var ci in cultures) diff --git a/src/ui/Forms/PreviewVideo.Designer.cs b/src/ui/Forms/PreviewVideo.Designer.cs new file mode 100644 index 000000000..dc4e4234f --- /dev/null +++ b/src/ui/Forms/PreviewVideo.Designer.cs @@ -0,0 +1,88 @@ +namespace Nikse.SubtitleEdit.Forms +{ + partial class PreviewVideo + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.videoPlayerContainer1 = new Nikse.SubtitleEdit.Controls.VideoPlayerContainer(); + this.timerSubtitleOnVideo = new System.Windows.Forms.Timer(this.components); + this.SuspendLayout(); + // + // videoPlayerContainer1 + // + this.videoPlayerContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18))))); + this.videoPlayerContainer1.Chapters = null; + this.videoPlayerContainer1.CurrentPosition = 0D; + this.videoPlayerContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.videoPlayerContainer1.FontSizeFactor = 1F; + this.videoPlayerContainer1.LastParagraph = null; + this.videoPlayerContainer1.Location = new System.Drawing.Point(0, 0); + this.videoPlayerContainer1.Name = "videoPlayerContainer1"; + this.videoPlayerContainer1.ShowFullscreenButton = true; + this.videoPlayerContainer1.ShowMuteButton = true; + this.videoPlayerContainer1.ShowStopButton = true; + this.videoPlayerContainer1.Size = new System.Drawing.Size(800, 450); + this.videoPlayerContainer1.SubtitleText = ""; + this.videoPlayerContainer1.TabIndex = 17; + this.videoPlayerContainer1.TextRightToLeft = System.Windows.Forms.RightToLeft.No; + this.videoPlayerContainer1.UsingFrontCenterAudioChannelOnly = false; + this.videoPlayerContainer1.VideoHeight = 0; + this.videoPlayerContainer1.VideoPlayer = null; + this.videoPlayerContainer1.VideoWidth = 0; + this.videoPlayerContainer1.Volume = 0D; + // + // timerSubtitleOnVideo + // + this.timerSubtitleOnVideo.Interval = 25; + this.timerSubtitleOnVideo.Tick += new System.EventHandler(this.timerSubtitleOnVideo_Tick); + // + // PreviewVideo + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(800, 450); + this.Controls.Add(this.videoPlayerContainer1); + this.KeyPreview = true; + this.Name = "PreviewVideo"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "PreviewVideo"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PreviewVideo_FormClosing); + this.Shown += new System.EventHandler(this.PreviewVideo_Shown); + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.PreviewVideo_KeyDown); + this.ResumeLayout(false); + + } + + #endregion + + private Controls.VideoPlayerContainer videoPlayerContainer1; + private System.Windows.Forms.Timer timerSubtitleOnVideo; + } +} \ No newline at end of file diff --git a/src/ui/Forms/PreviewVideo.cs b/src/ui/Forms/PreviewVideo.cs new file mode 100644 index 000000000..e6cd58907 --- /dev/null +++ b/src/ui/Forms/PreviewVideo.cs @@ -0,0 +1,100 @@ +using Nikse.SubtitleEdit.Logic; +using Nikse.SubtitleEdit.Logic.VideoPlayers; +using System; +using System.IO; +using System.Windows.Forms; +using Nikse.SubtitleEdit.Core.Common; + +namespace Nikse.SubtitleEdit.Forms +{ + public partial class PreviewVideo : Form + { + private string _videoFileName; + private readonly string _subtitleFileName; + private readonly Subtitle _subtitle; + + public PreviewVideo(string videoFileName, string subtitleFileName, Subtitle subtitle) + { + UiUtil.PreInitialize(this); + InitializeComponent(); + UiUtil.FixFonts(this); + _videoFileName = videoFileName; + _subtitleFileName = subtitleFileName; + _subtitle = subtitle; + } + + private void PreviewVideo_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Escape) + { + DialogResult = DialogResult.Cancel; + } + } + + private void PreviewVideo_FormClosing(object sender, FormClosingEventArgs e) + { + CloseVideo(); + } + + private void CloseVideo() + { + timerSubtitleOnVideo.Stop(); + + Application.DoEvents(); + if (videoPlayerContainer1.VideoPlayer != null) + { + videoPlayerContainer1.Pause(); + videoPlayerContainer1.VideoPlayer.DisposeVideoPlayer(); + videoPlayerContainer1.VideoPlayer = null; + } + + Application.DoEvents(); + _videoFileName = null; + videoPlayerContainer1.Visible = false; + } + + private void PreviewVideo_Shown(object sender, EventArgs e) + { + var videoInfo = UiUtil.GetVideoInfo(_videoFileName); + UiUtil.InitializeVideoPlayerAndContainer(_videoFileName, videoInfo, videoPlayerContainer1, VideoStartLoaded, VideoStartEnded); + Text = $"{LanguageSettings.Current.General.Preview} - {videoInfo.Width}x{videoInfo.Height}, {Path.GetFileName(_videoFileName)}"; + } + + private void VideoStartEnded(object sender, EventArgs e) + { + videoPlayerContainer1.Pause(); + if (videoPlayerContainer1.VideoPlayer is LibMpvDynamic libmpv) + { + libmpv.RemoveSubtitle(); + } + } + + private void VideoStartLoaded(object sender, EventArgs e) + { + videoPlayerContainer1.Pause(); + timerSubtitleOnVideo.Start(); + if (videoPlayerContainer1.VideoPlayer is LibMpvDynamic libmpv) + { + libmpv.LoadSubtitle(_subtitleFileName); + } + + if (_subtitle?.Paragraphs.Count > 0) + { + videoPlayerContainer1.CurrentPosition = _subtitle.Paragraphs[0].StartTime.TotalSeconds + 0.1; + } + } + + private void timerSubtitleOnVideo_Tick(object sender, EventArgs e) + { + if (videoPlayerContainer1 == null || videoPlayerContainer1.IsPaused) + { + return; + } + + if (!videoPlayerContainer1.IsPaused) + { + videoPlayerContainer1.RefreshProgressBar(); + } + } + } +} diff --git a/src/ui/Forms/PreviewVideo.resx b/src/ui/Forms/PreviewVideo.resx new file mode 100644 index 000000000..ef3cba408 --- /dev/null +++ b/src/ui/Forms/PreviewVideo.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/src/ui/Forms/ReplaceDialog.cs b/src/ui/Forms/ReplaceDialog.cs index 6190b52b0..893d3faed 100644 --- a/src/ui/Forms/ReplaceDialog.cs +++ b/src/ui/Forms/ReplaceDialog.cs @@ -181,6 +181,7 @@ namespace Nikse.SubtitleEdit.Forms { ReplaceAll = false; FindOnly = false; + SetRegEx(); Validate(FindText); if (DialogResult == DialogResult.OK) @@ -197,6 +198,7 @@ namespace Nikse.SubtitleEdit.Forms ReplaceAll = true; FindOnly = false; + SetRegEx(); Validate(FindText); if (DialogResult == DialogResult.OK) { @@ -240,10 +242,26 @@ namespace Nikse.SubtitleEdit.Forms private void ButtonFindClick(object sender, EventArgs e) { + SetRegEx(); Find(); buttonFind.Focus(); } + private void SetRegEx() + { + if (radioButtonRegEx.Checked) + { + try + { + _regEx = new Regex(RegexUtils.FixNewLine(FindText), RegexOptions.Compiled, TimeSpan.FromSeconds(5)); + } + catch (Exception exception) + { + MessageBox.Show(exception.Message); + } + } + } + private void Find() { if (_findNext && _findHelper != null) @@ -286,6 +304,7 @@ namespace Nikse.SubtitleEdit.Forms _findHelper.FindReplaceType = GetFindType(); _findHelper.FindText = FindText; _findHelper.FindTextLength = _findHelper.FindText.Length; + _findHelper.SetRegex(_regEx); } private void RadioButtonCheckedChanged(object sender, EventArgs e) diff --git a/src/ui/Forms/VTT/WebVttImportExport.Designer.cs b/src/ui/Forms/VTT/WebVttImportExport.Designer.cs new file mode 100644 index 000000000..043f71e7a --- /dev/null +++ b/src/ui/Forms/VTT/WebVttImportExport.Designer.cs @@ -0,0 +1,158 @@ +namespace Nikse.SubtitleEdit.Forms.VTT +{ + sealed partial class WebVttImportExport + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.listViewExportStyles = new System.Windows.Forms.ListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.buttonOK = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.saveFileDialogStyle = new System.Windows.Forms.SaveFileDialog(); + this.labelStyles = new System.Windows.Forms.Label(); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.toolStripMenuItemSelectAll = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItemInverseSelection = new System.Windows.Forms.ToolStripMenuItem(); + this.contextMenuStrip1.SuspendLayout(); + this.SuspendLayout(); + // + // listViewExportStyles + // + this.listViewExportStyles.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listViewExportStyles.CheckBoxes = true; + this.listViewExportStyles.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1}); + this.listViewExportStyles.ContextMenuStrip = this.contextMenuStrip1; + this.listViewExportStyles.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.listViewExportStyles.HideSelection = false; + this.listViewExportStyles.Location = new System.Drawing.Point(12, 38); + this.listViewExportStyles.Name = "listViewExportStyles"; + this.listViewExportStyles.Size = new System.Drawing.Size(258, 187); + this.listViewExportStyles.TabIndex = 0; + this.listViewExportStyles.UseCompatibleStateImageBehavior = false; + this.listViewExportStyles.View = System.Windows.Forms.View.Details; + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonOK.Location = new System.Drawing.Point(111, 231); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(75, 23); + this.buttonOK.TabIndex = 4; + this.buttonOK.Text = "&OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonCancel.Location = new System.Drawing.Point(195, 231); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 5; + this.buttonCancel.Text = "C&ancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + // + // saveFileDialogStyle + // + this.saveFileDialogStyle.OverwritePrompt = false; + // + // labelStyles + // + this.labelStyles.AutoSize = true; + this.labelStyles.Location = new System.Drawing.Point(12, 20); + this.labelStyles.Name = "labelStyles"; + this.labelStyles.Size = new System.Drawing.Size(35, 13); + this.labelStyles.TabIndex = 6; + this.labelStyles.Text = "Styles"; + // + // contextMenuStrip1 + // + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripMenuItemSelectAll, + this.toolStripMenuItemInverseSelection}); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(181, 70); + // + // toolStripMenuItemSelectAll + // + this.toolStripMenuItemSelectAll.Name = "toolStripMenuItemSelectAll"; + this.toolStripMenuItemSelectAll.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItemSelectAll.Text = "Select all"; + this.toolStripMenuItemSelectAll.Click += new System.EventHandler(this.toolStripMenuItemSelectAll_Click); + // + // toolStripMenuItemInverseSelection + // + this.toolStripMenuItemInverseSelection.Name = "toolStripMenuItemInverseSelection"; + this.toolStripMenuItemInverseSelection.Size = new System.Drawing.Size(180, 22); + this.toolStripMenuItemInverseSelection.Text = "Inverse selection"; + this.toolStripMenuItemInverseSelection.Click += new System.EventHandler(this.toolStripMenuItemInverseSelection_Click); + // + // SubStationAlphaStylesExport + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(282, 264); + this.Controls.Add(this.labelStyles); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.listViewExportStyles); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.KeyPreview = true; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "SubStationAlphaStylesExport"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "SubStationAlphaStylesExport"; + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.WebVttImportExport_KeyDown); + this.contextMenuStrip1.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ListView listViewExportStyles; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.SaveFileDialog saveFileDialogStyle; + private System.Windows.Forms.ColumnHeader columnHeader1; + private System.Windows.Forms.Label labelStyles; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSelectAll; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemInverseSelection; + } +} \ No newline at end of file diff --git a/src/ui/Forms/VTT/WebVttImportExport.cs b/src/ui/Forms/VTT/WebVttImportExport.cs new file mode 100644 index 000000000..a6e34d532 --- /dev/null +++ b/src/ui/Forms/VTT/WebVttImportExport.cs @@ -0,0 +1,161 @@ +using Nikse.SubtitleEdit.Core.Common; +using Nikse.SubtitleEdit.Core.SubtitleFormats; +using Nikse.SubtitleEdit.Logic; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Windows.Forms; + +namespace Nikse.SubtitleEdit.Forms.VTT +{ + public sealed partial class WebVttImportExport : Form + { + private readonly List _styles; + private readonly bool _export; + public List ImportExportStyles { get; set; } + public string FileName { get; set; } + + public WebVttImportExport(List styles, string fileName = null) + { + InitializeComponent(); + UiUtil.FixFonts(this); + + _styles = styles; + _export = fileName == null; + + if (!_export) + { + _styles = WebVttHelper.GetStyles(FileUtil.ReadAllTextShared(fileName, Encoding.UTF8)); + } + + listViewExportStyles.Columns[0].Width = listViewExportStyles.Width - 20; + foreach (var style in _styles) + { + listViewExportStyles.Items.Add(new ListViewItem(style.Name) { Checked = true, Tag = style }); + } + + Text = LanguageSettings.Current.SubStationAlphaStyles.Export; + labelStyles.Text = LanguageSettings.Current.SubStationAlphaStyles.Styles; + toolStripMenuItemInverseSelection.Text = LanguageSettings.Current.Main.Menu.Edit.InverseSelection; + toolStripMenuItemSelectAll.Text = LanguageSettings.Current.Main.Menu.ContextMenu.SelectAll; + buttonOK.Text = LanguageSettings.Current.General.Ok; + buttonCancel.Text = LanguageSettings.Current.General.Cancel; + } + + private void buttonOK_Click(object sender, EventArgs e) + { + if (_export) + { + ExportStyles(); + } + else + { + ImportStyles(); + } + } + + private void ImportStyles() + { + ImportExportStyles = new List(); + foreach (ListViewItem listViewItem in listViewExportStyles.Items) + { + if (listViewItem.Checked) + { + ImportExportStyles.Add((WebVttStyle)listViewItem.Tag); + } + } + + if (ImportExportStyles.Count > 0) + { + DialogResult= DialogResult.OK; + } + else + { + DialogResult = DialogResult.Cancel; + } + } + + private void ExportStyles() + { + var exportNames = new List(); + var occursMoreThanOnce = new List(); + ImportExportStyles = new List(); + foreach (ListViewItem item in listViewExportStyles.Items) + { + if (item.Checked) + { + ImportExportStyles.Add((WebVttStyle)item.Tag); + if (exportNames.Contains(item.Text)) + { + occursMoreThanOnce.Add(item.Text); + } + else + { + exportNames.Add(item.Text); + } + } + } + + if (occursMoreThanOnce.Count > 0) + { + MessageBox.Show("Style name must be unique - can only export one style with name: " + string.Join(", ", occursMoreThanOnce)); + return; + } + + if (ImportExportStyles.Count == 0) + { + return; + } + + saveFileDialogStyle.Title = LanguageSettings.Current.SubStationAlphaStyles.ExportStyleToFile; + saveFileDialogStyle.InitialDirectory = Configuration.DataDirectory; + saveFileDialogStyle.Filter = WebVTT.NameOfFormat + "|*.webvtt;*.vtt|" + LanguageSettings.Current.General.AllFiles + "|*.*"; + saveFileDialogStyle.FileName = "my_styles.webvtt"; + if (saveFileDialogStyle.ShowDialog() != DialogResult.OK) + { + return; + } + + var sb = new StringBuilder(); + foreach (var style in ImportExportStyles) + { + sb.Append("::cue(" + style.Name.Trim() + ") { " + style + " }"); + sb.Append(Environment.NewLine); + } + + var content = "WEBVTT" + Environment.NewLine + + Environment.NewLine + + "STYLE" + Environment.NewLine + + sb.ToString().Trim(); + File.WriteAllText(saveFileDialogStyle.FileName, content, Encoding.UTF8); + DialogResult = DialogResult.OK; + FileName = saveFileDialogStyle.FileName; + } + + + private void WebVttImportExport_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Escape) + { + DialogResult = DialogResult.Cancel; + } + } + + private void toolStripMenuItemSelectAll_Click(object sender, EventArgs e) + { + foreach (ListViewItem item in listViewExportStyles.Items) + { + item.Checked = true; + } + } + + private void toolStripMenuItemInverseSelection_Click(object sender, EventArgs e) + { + foreach (ListViewItem item in listViewExportStyles.Items) + { + item.Checked = !item.Checked; + } + } + } +} diff --git a/src/ui/Forms/VTT/WebVttImportExport.resx b/src/ui/Forms/VTT/WebVttImportExport.resx new file mode 100644 index 000000000..0a39974e8 --- /dev/null +++ b/src/ui/Forms/VTT/WebVttImportExport.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 172, 17 + + + 17, 17 + + \ No newline at end of file diff --git a/src/ui/Forms/VTT/WebVttStyleManager.Designer.cs b/src/ui/Forms/VTT/WebVttStyleManager.Designer.cs new file mode 100644 index 000000000..b306f9737 --- /dev/null +++ b/src/ui/Forms/VTT/WebVttStyleManager.Designer.cs @@ -0,0 +1,859 @@ +namespace Nikse.SubtitleEdit.Forms.VTT +{ + sealed partial class WebVttStyleManager + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.groupBoxStyles = new System.Windows.Forms.GroupBox(); + this.buttonExport = new System.Windows.Forms.Button(); + this.buttonImport = new System.Windows.Forms.Button(); + this.buttonCopy = new System.Windows.Forms.Button(); + this.buttonRemoveAll = new System.Windows.Forms.Button(); + this.buttonAdd = new System.Windows.Forms.Button(); + this.buttonRemove = new System.Windows.Forms.Button(); + this.listViewStyles = new System.Windows.Forms.ListView(); + this.columnHeaderName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderFontName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderFontSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderItalic = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderForeColor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderBackgroundColor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderUseCount = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.contextMenuStripStyles = new System.Windows.Forms.ContextMenuStrip(this.components); + this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItemRemoveAll = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.moveUpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.moveDownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.moveTopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.moveBottomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.newToolStripMenuItemNew = new System.Windows.Forms.ToolStripMenuItem(); + this.copyToolStripMenuItemCopy = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripMenuItemImport = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItemExport = new System.Windows.Forms.ToolStripMenuItem(); + this.groupBoxProperties = new System.Windows.Forms.GroupBox(); + this.groupBoxAfter = new System.Windows.Forms.GroupBox(); + this.labelAfter = new System.Windows.Forms.Label(); + this.groupBoxBefore = new System.Windows.Forms.GroupBox(); + this.labelBefore = new System.Windows.Forms.Label(); + this.textBoxStyleName = new System.Windows.Forms.TextBox(); + this.labelStyleName = new System.Windows.Forms.Label(); + this.groupBoxPreview = new System.Windows.Forms.GroupBox(); + this.pictureBoxPreview = new System.Windows.Forms.PictureBox(); + this.groupBoxFont = new System.Windows.Forms.GroupBox(); + this.checkBoxShadowEnabled = new System.Windows.Forms.CheckBox(); + this.checkBoxBackgroundColorEnabled = new System.Windows.Forms.CheckBox(); + this.checkBoxColorEnabled = new System.Windows.Forms.CheckBox(); + this.panelShadowColor = new System.Windows.Forms.Panel(); + this.buttonShadowColor = new System.Windows.Forms.Button(); + this.numericUpDownShadowWidth = new System.Windows.Forms.NumericUpDown(); + this.panelBackgroundColor = new System.Windows.Forms.Panel(); + this.labelShadow = new System.Windows.Forms.Label(); + this.buttonBackgroundColor = new System.Windows.Forms.Button(); + this.panelPrimaryColor = new System.Windows.Forms.Panel(); + this.checkBoxStrikeout = new System.Windows.Forms.CheckBox(); + this.buttonPrimaryColor = new System.Windows.Forms.Button(); + this.checkBoxFontUnderline = new System.Windows.Forms.CheckBox(); + this.numericUpDownFontSize = new System.Windows.Forms.NumericUpDown(); + this.checkBoxFontItalic = new System.Windows.Forms.CheckBox(); + this.checkBoxFontBold = new System.Windows.Forms.CheckBox(); + this.comboBoxFontName = new System.Windows.Forms.ComboBox(); + this.labelFontSize = new System.Windows.Forms.Label(); + this.labelFontName = new System.Windows.Forms.Label(); + this.buttonApply = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.buttonOK = new System.Windows.Forms.Button(); + this.labelDuplicateStyleNames = new System.Windows.Forms.Label(); + this.labelInfo = new System.Windows.Forms.Label(); + this.groupBoxStyles.SuspendLayout(); + this.contextMenuStripStyles.SuspendLayout(); + this.groupBoxProperties.SuspendLayout(); + this.groupBoxAfter.SuspendLayout(); + this.groupBoxBefore.SuspendLayout(); + this.groupBoxPreview.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxPreview)).BeginInit(); + this.groupBoxFont.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownShadowWidth)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFontSize)).BeginInit(); + this.SuspendLayout(); + // + // groupBoxStyles + // + this.groupBoxStyles.Controls.Add(this.buttonExport); + this.groupBoxStyles.Controls.Add(this.buttonImport); + this.groupBoxStyles.Controls.Add(this.buttonCopy); + this.groupBoxStyles.Controls.Add(this.buttonRemoveAll); + this.groupBoxStyles.Controls.Add(this.buttonAdd); + this.groupBoxStyles.Controls.Add(this.buttonRemove); + this.groupBoxStyles.Controls.Add(this.listViewStyles); + this.groupBoxStyles.Location = new System.Drawing.Point(8, 8); + this.groupBoxStyles.Name = "groupBoxStyles"; + this.groupBoxStyles.Size = new System.Drawing.Size(600, 599); + this.groupBoxStyles.TabIndex = 1; + this.groupBoxStyles.TabStop = false; + this.groupBoxStyles.Text = "Styles"; + // + // buttonExport + // + this.buttonExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonExport.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonExport.Location = new System.Drawing.Point(6, 570); + this.buttonExport.Name = "buttonExport"; + this.buttonExport.Size = new System.Drawing.Size(82, 23); + this.buttonExport.TabIndex = 5; + this.buttonExport.Text = "Export..."; + this.buttonExport.UseVisualStyleBackColor = true; + this.buttonExport.Click += new System.EventHandler(this.buttonExport_Click); + // + // buttonImport + // + this.buttonImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonImport.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonImport.Location = new System.Drawing.Point(6, 541); + this.buttonImport.Name = "buttonImport"; + this.buttonImport.Size = new System.Drawing.Size(82, 23); + this.buttonImport.TabIndex = 1; + this.buttonImport.Text = "Import..."; + this.buttonImport.UseVisualStyleBackColor = true; + this.buttonImport.Click += new System.EventHandler(this.buttonImport_Click); + // + // buttonCopy + // + this.buttonCopy.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonCopy.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonCopy.Location = new System.Drawing.Point(94, 570); + this.buttonCopy.Name = "buttonCopy"; + this.buttonCopy.Size = new System.Drawing.Size(82, 23); + this.buttonCopy.TabIndex = 6; + this.buttonCopy.Text = "Copy"; + this.buttonCopy.UseVisualStyleBackColor = true; + this.buttonCopy.Click += new System.EventHandler(this.buttonCopy_Click); + // + // buttonRemoveAll + // + this.buttonRemoveAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonRemoveAll.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonRemoveAll.Location = new System.Drawing.Point(182, 570); + this.buttonRemoveAll.Name = "buttonRemoveAll"; + this.buttonRemoveAll.Size = new System.Drawing.Size(102, 23); + this.buttonRemoveAll.TabIndex = 7; + this.buttonRemoveAll.Text = "Remove all"; + this.buttonRemoveAll.UseVisualStyleBackColor = true; + this.buttonRemoveAll.Click += new System.EventHandler(this.buttonRemoveAll_Click); + // + // buttonAdd + // + this.buttonAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonAdd.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonAdd.Location = new System.Drawing.Point(94, 541); + this.buttonAdd.Name = "buttonAdd"; + this.buttonAdd.Size = new System.Drawing.Size(82, 23); + this.buttonAdd.TabIndex = 2; + this.buttonAdd.Text = "New"; + this.buttonAdd.UseVisualStyleBackColor = true; + this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click); + // + // buttonRemove + // + this.buttonRemove.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonRemove.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonRemove.Location = new System.Drawing.Point(182, 541); + this.buttonRemove.Name = "buttonRemove"; + this.buttonRemove.Size = new System.Drawing.Size(102, 23); + this.buttonRemove.TabIndex = 3; + this.buttonRemove.Text = "Remove"; + this.buttonRemove.UseVisualStyleBackColor = true; + this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click); + // + // listViewStyles + // + this.listViewStyles.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listViewStyles.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeaderName, + this.columnHeaderFontName, + this.columnHeaderFontSize, + this.columnHeaderItalic, + this.columnHeaderForeColor, + this.columnHeaderBackgroundColor, + this.columnHeaderUseCount}); + this.listViewStyles.ContextMenuStrip = this.contextMenuStripStyles; + this.listViewStyles.FullRowSelect = true; + this.listViewStyles.HideSelection = false; + this.listViewStyles.Location = new System.Drawing.Point(6, 19); + this.listViewStyles.Name = "listViewStyles"; + this.listViewStyles.Size = new System.Drawing.Size(588, 516); + this.listViewStyles.TabIndex = 0; + this.listViewStyles.UseCompatibleStateImageBehavior = false; + this.listViewStyles.View = System.Windows.Forms.View.Details; + this.listViewStyles.SelectedIndexChanged += new System.EventHandler(this.listViewStyles_SelectedIndexChanged); + this.listViewStyles.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewStyles_KeyDown); + // + // columnHeaderName + // + this.columnHeaderName.Text = "Name"; + this.columnHeaderName.Width = 130; + // + // columnHeaderFontName + // + this.columnHeaderFontName.Text = "Font name"; + this.columnHeaderFontName.Width = 122; + // + // columnHeaderFontSize + // + this.columnHeaderFontSize.Text = "Font size"; + this.columnHeaderFontSize.Width = 80; + // + // columnHeaderItalic + // + this.columnHeaderItalic.Text = "Italic"; + // + // columnHeaderForeColor + // + this.columnHeaderForeColor.Text = "BG"; + this.columnHeaderForeColor.Width = 70; + // + // columnHeaderBackgroundColor + // + this.columnHeaderBackgroundColor.Text = "Text"; + this.columnHeaderBackgroundColor.Width = 55; + // + // columnHeaderUseCount + // + this.columnHeaderUseCount.Text = "Used#"; + // + // contextMenuStripStyles + // + this.contextMenuStripStyles.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.deleteToolStripMenuItem, + this.toolStripMenuItemRemoveAll, + this.toolStripSeparator4, + this.moveUpToolStripMenuItem, + this.moveDownToolStripMenuItem, + this.moveTopToolStripMenuItem, + this.moveBottomToolStripMenuItem, + this.toolStripSeparator3, + this.newToolStripMenuItemNew, + this.copyToolStripMenuItemCopy, + this.toolStripSeparator1, + this.toolStripMenuItemImport, + this.toolStripMenuItemExport}); + this.contextMenuStripStyles.Name = "contextMenuStrip1"; + this.contextMenuStripStyles.Size = new System.Drawing.Size(216, 242); + // + // deleteToolStripMenuItem + // + this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; + this.deleteToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete; + this.deleteToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + this.deleteToolStripMenuItem.Text = "Remove"; + this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); + // + // toolStripMenuItemRemoveAll + // + this.toolStripMenuItemRemoveAll.Name = "toolStripMenuItemRemoveAll"; + this.toolStripMenuItemRemoveAll.Size = new System.Drawing.Size(215, 22); + this.toolStripMenuItemRemoveAll.Text = "Remove all"; + this.toolStripMenuItemRemoveAll.Click += new System.EventHandler(this.toolStripMenuItemRemoveAll_Click); + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(212, 6); + // + // moveUpToolStripMenuItem + // + this.moveUpToolStripMenuItem.Name = "moveUpToolStripMenuItem"; + this.moveUpToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Up))); + this.moveUpToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + this.moveUpToolStripMenuItem.Text = "Move up"; + this.moveUpToolStripMenuItem.Click += new System.EventHandler(this.moveUpToolStripMenuItem_Click); + // + // moveDownToolStripMenuItem + // + this.moveDownToolStripMenuItem.Name = "moveDownToolStripMenuItem"; + this.moveDownToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Down))); + this.moveDownToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + this.moveDownToolStripMenuItem.Text = "Move down"; + this.moveDownToolStripMenuItem.Click += new System.EventHandler(this.moveDownToolStripMenuItem_Click); + // + // moveTopToolStripMenuItem + // + this.moveTopToolStripMenuItem.Name = "moveTopToolStripMenuItem"; + this.moveTopToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Home))); + this.moveTopToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + this.moveTopToolStripMenuItem.Text = "Move to top"; + this.moveTopToolStripMenuItem.Click += new System.EventHandler(this.moveTopToolStripMenuItem_Click); + // + // moveBottomToolStripMenuItem + // + this.moveBottomToolStripMenuItem.Name = "moveBottomToolStripMenuItem"; + this.moveBottomToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.End))); + this.moveBottomToolStripMenuItem.Size = new System.Drawing.Size(215, 22); + this.moveBottomToolStripMenuItem.Text = "Move to bottom"; + this.moveBottomToolStripMenuItem.Click += new System.EventHandler(this.moveBottomToolStripMenuItem_Click); + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(212, 6); + // + // newToolStripMenuItemNew + // + this.newToolStripMenuItemNew.Name = "newToolStripMenuItemNew"; + this.newToolStripMenuItemNew.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N))); + this.newToolStripMenuItemNew.Size = new System.Drawing.Size(215, 22); + this.newToolStripMenuItemNew.Text = "New"; + this.newToolStripMenuItemNew.Click += new System.EventHandler(this.newToolStripMenuItemNew_Click); + // + // copyToolStripMenuItemCopy + // + this.copyToolStripMenuItemCopy.Name = "copyToolStripMenuItemCopy"; + this.copyToolStripMenuItemCopy.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C))); + this.copyToolStripMenuItemCopy.Size = new System.Drawing.Size(215, 22); + this.copyToolStripMenuItemCopy.Text = "Copy"; + this.copyToolStripMenuItemCopy.Click += new System.EventHandler(this.copyToolStripMenuItemCopy_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(212, 6); + // + // toolStripMenuItemImport + // + this.toolStripMenuItemImport.Name = "toolStripMenuItemImport"; + this.toolStripMenuItemImport.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I))); + this.toolStripMenuItemImport.Size = new System.Drawing.Size(215, 22); + this.toolStripMenuItemImport.Text = "Import..."; + this.toolStripMenuItemImport.Click += new System.EventHandler(this.toolStripMenuItemImport_Click); + // + // toolStripMenuItemExport + // + this.toolStripMenuItemExport.Name = "toolStripMenuItemExport"; + this.toolStripMenuItemExport.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E))); + this.toolStripMenuItemExport.Size = new System.Drawing.Size(215, 22); + this.toolStripMenuItemExport.Text = "Export..."; + this.toolStripMenuItemExport.Click += new System.EventHandler(this.toolStripMenuItemExport_Click); + // + // groupBoxProperties + // + this.groupBoxProperties.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxProperties.Controls.Add(this.groupBoxAfter); + this.groupBoxProperties.Controls.Add(this.groupBoxBefore); + this.groupBoxProperties.Controls.Add(this.textBoxStyleName); + this.groupBoxProperties.Controls.Add(this.labelStyleName); + this.groupBoxProperties.Controls.Add(this.groupBoxPreview); + this.groupBoxProperties.Controls.Add(this.groupBoxFont); + this.groupBoxProperties.Location = new System.Drawing.Point(614, 8); + this.groupBoxProperties.Name = "groupBoxProperties"; + this.groupBoxProperties.Size = new System.Drawing.Size(484, 599); + this.groupBoxProperties.TabIndex = 2; + this.groupBoxProperties.TabStop = false; + this.groupBoxProperties.Text = "Properties"; + // + // groupBoxAfter + // + this.groupBoxAfter.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxAfter.Controls.Add(this.labelAfter); + this.groupBoxAfter.Location = new System.Drawing.Point(249, 239); + this.groupBoxAfter.Name = "groupBoxAfter"; + this.groupBoxAfter.Size = new System.Drawing.Size(229, 100); + this.groupBoxAfter.TabIndex = 12; + this.groupBoxAfter.TabStop = false; + this.groupBoxAfter.Text = "After"; + // + // labelAfter + // + this.labelAfter.AutoSize = true; + this.labelAfter.Location = new System.Drawing.Point(6, 16); + this.labelAfter.Name = "labelAfter"; + this.labelAfter.Size = new System.Drawing.Size(51, 13); + this.labelAfter.TabIndex = 1; + this.labelAfter.Text = "labelAfter"; + // + // groupBoxBefore + // + this.groupBoxBefore.Controls.Add(this.labelBefore); + this.groupBoxBefore.Location = new System.Drawing.Point(10, 239); + this.groupBoxBefore.Name = "groupBoxBefore"; + this.groupBoxBefore.Size = new System.Drawing.Size(233, 100); + this.groupBoxBefore.TabIndex = 11; + this.groupBoxBefore.TabStop = false; + this.groupBoxBefore.Text = "Before"; + // + // labelBefore + // + this.labelBefore.AutoSize = true; + this.labelBefore.Location = new System.Drawing.Point(7, 20); + this.labelBefore.Name = "labelBefore"; + this.labelBefore.Size = new System.Drawing.Size(60, 13); + this.labelBefore.TabIndex = 0; + this.labelBefore.Text = "labelBefore"; + // + // textBoxStyleName + // + this.textBoxStyleName.Location = new System.Drawing.Point(49, 22); + this.textBoxStyleName.Name = "textBoxStyleName"; + this.textBoxStyleName.Size = new System.Drawing.Size(336, 20); + this.textBoxStyleName.TabIndex = 1; + this.textBoxStyleName.TextChanged += new System.EventHandler(this.textBoxStyleName_TextChanged); + // + // labelStyleName + // + this.labelStyleName.AutoSize = true; + this.labelStyleName.Location = new System.Drawing.Point(7, 26); + this.labelStyleName.Name = "labelStyleName"; + this.labelStyleName.Size = new System.Drawing.Size(35, 13); + this.labelStyleName.TabIndex = 0; + this.labelStyleName.Text = "Name"; + // + // groupBoxPreview + // + this.groupBoxPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxPreview.Controls.Add(this.pictureBoxPreview); + this.groupBoxPreview.Location = new System.Drawing.Point(7, 345); + this.groupBoxPreview.Name = "groupBoxPreview"; + this.groupBoxPreview.Size = new System.Drawing.Size(472, 248); + this.groupBoxPreview.TabIndex = 7; + this.groupBoxPreview.TabStop = false; + this.groupBoxPreview.Text = "Preview"; + // + // pictureBoxPreview + // + this.pictureBoxPreview.Dock = System.Windows.Forms.DockStyle.Fill; + this.pictureBoxPreview.Location = new System.Drawing.Point(3, 16); + this.pictureBoxPreview.Name = "pictureBoxPreview"; + this.pictureBoxPreview.Size = new System.Drawing.Size(466, 229); + this.pictureBoxPreview.TabIndex = 0; + this.pictureBoxPreview.TabStop = false; + // + // groupBoxFont + // + this.groupBoxFont.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxFont.Controls.Add(this.checkBoxShadowEnabled); + this.groupBoxFont.Controls.Add(this.checkBoxBackgroundColorEnabled); + this.groupBoxFont.Controls.Add(this.checkBoxColorEnabled); + this.groupBoxFont.Controls.Add(this.panelShadowColor); + this.groupBoxFont.Controls.Add(this.buttonShadowColor); + this.groupBoxFont.Controls.Add(this.numericUpDownShadowWidth); + this.groupBoxFont.Controls.Add(this.panelBackgroundColor); + this.groupBoxFont.Controls.Add(this.labelShadow); + this.groupBoxFont.Controls.Add(this.buttonBackgroundColor); + this.groupBoxFont.Controls.Add(this.panelPrimaryColor); + this.groupBoxFont.Controls.Add(this.checkBoxStrikeout); + this.groupBoxFont.Controls.Add(this.buttonPrimaryColor); + this.groupBoxFont.Controls.Add(this.checkBoxFontUnderline); + this.groupBoxFont.Controls.Add(this.numericUpDownFontSize); + this.groupBoxFont.Controls.Add(this.checkBoxFontItalic); + this.groupBoxFont.Controls.Add(this.checkBoxFontBold); + this.groupBoxFont.Controls.Add(this.comboBoxFontName); + this.groupBoxFont.Controls.Add(this.labelFontSize); + this.groupBoxFont.Controls.Add(this.labelFontName); + this.groupBoxFont.Location = new System.Drawing.Point(7, 51); + this.groupBoxFont.Name = "groupBoxFont"; + this.groupBoxFont.Size = new System.Drawing.Size(472, 182); + this.groupBoxFont.TabIndex = 2; + this.groupBoxFont.TabStop = false; + this.groupBoxFont.Text = "Font"; + // + // checkBoxShadowEnabled + // + this.checkBoxShadowEnabled.AutoSize = true; + this.checkBoxShadowEnabled.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBoxShadowEnabled.Location = new System.Drawing.Point(282, 100); + this.checkBoxShadowEnabled.Name = "checkBoxShadowEnabled"; + this.checkBoxShadowEnabled.Size = new System.Drawing.Size(65, 17); + this.checkBoxShadowEnabled.TabIndex = 11; + this.checkBoxShadowEnabled.Text = "Enabled"; + this.checkBoxShadowEnabled.UseVisualStyleBackColor = true; + this.checkBoxShadowEnabled.CheckedChanged += new System.EventHandler(this.checkBoxShadowEnabled_CheckedChanged); + // + // checkBoxBackgroundColorEnabled + // + this.checkBoxBackgroundColorEnabled.AutoSize = true; + this.checkBoxBackgroundColorEnabled.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBoxBackgroundColorEnabled.Location = new System.Drawing.Point(135, 100); + this.checkBoxBackgroundColorEnabled.Name = "checkBoxBackgroundColorEnabled"; + this.checkBoxBackgroundColorEnabled.Size = new System.Drawing.Size(65, 17); + this.checkBoxBackgroundColorEnabled.TabIndex = 10; + this.checkBoxBackgroundColorEnabled.Text = "Enabled"; + this.checkBoxBackgroundColorEnabled.UseVisualStyleBackColor = true; + this.checkBoxBackgroundColorEnabled.CheckedChanged += new System.EventHandler(this.checkBoxBackgroundColorEnabled_CheckedChanged); + // + // checkBoxColorEnabled + // + this.checkBoxColorEnabled.AutoSize = true; + this.checkBoxColorEnabled.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBoxColorEnabled.Location = new System.Drawing.Point(16, 100); + this.checkBoxColorEnabled.Name = "checkBoxColorEnabled"; + this.checkBoxColorEnabled.Size = new System.Drawing.Size(65, 17); + this.checkBoxColorEnabled.TabIndex = 9; + this.checkBoxColorEnabled.Text = "Enabled"; + this.checkBoxColorEnabled.UseVisualStyleBackColor = true; + this.checkBoxColorEnabled.CheckedChanged += new System.EventHandler(this.checkBoxColorEnabled_CheckedChanged); + // + // panelShadowColor + // + this.panelShadowColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panelShadowColor.Location = new System.Drawing.Point(371, 124); + this.panelShadowColor.Name = "panelShadowColor"; + this.panelShadowColor.Size = new System.Drawing.Size(21, 20); + this.panelShadowColor.TabIndex = 7; + this.panelShadowColor.Click += new System.EventHandler(this.panelShadowColor_Click); + // + // buttonShadowColor + // + this.buttonShadowColor.Location = new System.Drawing.Point(282, 123); + this.buttonShadowColor.Name = "buttonShadowColor"; + this.buttonShadowColor.Size = new System.Drawing.Size(84, 23); + this.buttonShadowColor.TabIndex = 6; + this.buttonShadowColor.Text = "Shadow"; + this.buttonShadowColor.UseVisualStyleBackColor = true; + // + // numericUpDownShadowWidth + // + this.numericUpDownShadowWidth.DecimalPlaces = 1; + this.numericUpDownShadowWidth.Increment = new decimal(new int[] { + 1, + 0, + 0, + 65536}); + this.numericUpDownShadowWidth.Location = new System.Drawing.Point(286, 152); + this.numericUpDownShadowWidth.Name = "numericUpDownShadowWidth"; + this.numericUpDownShadowWidth.Size = new System.Drawing.Size(52, 20); + this.numericUpDownShadowWidth.TabIndex = 2; + // + // panelBackgroundColor + // + this.panelBackgroundColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panelBackgroundColor.Location = new System.Drawing.Point(242, 124); + this.panelBackgroundColor.Name = "panelBackgroundColor"; + this.panelBackgroundColor.Size = new System.Drawing.Size(21, 20); + this.panelBackgroundColor.TabIndex = 3; + this.panelBackgroundColor.Click += new System.EventHandler(this.panelBackgroundColor_Click); + // + // labelShadow + // + this.labelShadow.AutoSize = true; + this.labelShadow.Location = new System.Drawing.Point(344, 154); + this.labelShadow.Name = "labelShadow"; + this.labelShadow.Size = new System.Drawing.Size(46, 13); + this.labelShadow.TabIndex = 2; + this.labelShadow.Text = "Shadow"; + // + // buttonBackgroundColor + // + this.buttonBackgroundColor.Location = new System.Drawing.Point(135, 123); + this.buttonBackgroundColor.Name = "buttonBackgroundColor"; + this.buttonBackgroundColor.Size = new System.Drawing.Size(101, 23); + this.buttonBackgroundColor.TabIndex = 2; + this.buttonBackgroundColor.Text = "Background"; + this.buttonBackgroundColor.UseVisualStyleBackColor = true; + this.buttonBackgroundColor.Click += new System.EventHandler(this.buttonBackgroundColor_Click); + // + // panelPrimaryColor + // + this.panelPrimaryColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panelPrimaryColor.Location = new System.Drawing.Point(100, 124); + this.panelPrimaryColor.Name = "panelPrimaryColor"; + this.panelPrimaryColor.Size = new System.Drawing.Size(21, 20); + this.panelPrimaryColor.TabIndex = 1; + this.panelPrimaryColor.Click += new System.EventHandler(this.panelPrimaryColor_Click); + // + // checkBoxStrikeout + // + this.checkBoxStrikeout.AutoSize = true; + this.checkBoxStrikeout.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Strikeout, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBoxStrikeout.Location = new System.Drawing.Point(265, 59); + this.checkBoxStrikeout.Name = "checkBoxStrikeout"; + this.checkBoxStrikeout.Size = new System.Drawing.Size(68, 17); + this.checkBoxStrikeout.TabIndex = 8; + this.checkBoxStrikeout.Text = "Strikeout"; + this.checkBoxStrikeout.UseVisualStyleBackColor = true; + this.checkBoxStrikeout.CheckedChanged += new System.EventHandler(this.checkBoxStrikeout_CheckedChanged); + // + // buttonPrimaryColor + // + this.buttonPrimaryColor.Location = new System.Drawing.Point(14, 123); + this.buttonPrimaryColor.Name = "buttonPrimaryColor"; + this.buttonPrimaryColor.Size = new System.Drawing.Size(80, 23); + this.buttonPrimaryColor.TabIndex = 0; + this.buttonPrimaryColor.Text = "&Color"; + this.buttonPrimaryColor.UseVisualStyleBackColor = true; + this.buttonPrimaryColor.Click += new System.EventHandler(this.buttonPrimaryColor_Click); + // + // checkBoxFontUnderline + // + this.checkBoxFontUnderline.AutoSize = true; + this.checkBoxFontUnderline.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBoxFontUnderline.Location = new System.Drawing.Point(169, 59); + this.checkBoxFontUnderline.Name = "checkBoxFontUnderline"; + this.checkBoxFontUnderline.Size = new System.Drawing.Size(71, 17); + this.checkBoxFontUnderline.TabIndex = 7; + this.checkBoxFontUnderline.Text = "Underline"; + this.checkBoxFontUnderline.UseVisualStyleBackColor = true; + this.checkBoxFontUnderline.CheckedChanged += new System.EventHandler(this.checkBoxFontUnderline_CheckedChanged); + // + // numericUpDownFontSize + // + this.numericUpDownFontSize.DecimalPlaces = 1; + this.numericUpDownFontSize.Location = new System.Drawing.Point(374, 18); + this.numericUpDownFontSize.Maximum = new decimal(new int[] { + 200, + 0, + 0, + 0}); + this.numericUpDownFontSize.Name = "numericUpDownFontSize"; + this.numericUpDownFontSize.Size = new System.Drawing.Size(51, 20); + this.numericUpDownFontSize.TabIndex = 4; + this.numericUpDownFontSize.ValueChanged += new System.EventHandler(this.numericUpDownFontSize_ValueChanged); + // + // checkBoxFontItalic + // + this.checkBoxFontItalic.AutoSize = true; + this.checkBoxFontItalic.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBoxFontItalic.Location = new System.Drawing.Point(90, 59); + this.checkBoxFontItalic.Name = "checkBoxFontItalic"; + this.checkBoxFontItalic.Size = new System.Drawing.Size(48, 17); + this.checkBoxFontItalic.TabIndex = 6; + this.checkBoxFontItalic.Text = "Italic"; + this.checkBoxFontItalic.UseVisualStyleBackColor = true; + this.checkBoxFontItalic.CheckedChanged += new System.EventHandler(this.checkBoxFontItalic_CheckedChanged); + // + // checkBoxFontBold + // + this.checkBoxFontBold.AutoSize = true; + this.checkBoxFontBold.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.checkBoxFontBold.Location = new System.Drawing.Point(13, 59); + this.checkBoxFontBold.Name = "checkBoxFontBold"; + this.checkBoxFontBold.Size = new System.Drawing.Size(51, 17); + this.checkBoxFontBold.TabIndex = 5; + this.checkBoxFontBold.Text = "Bold"; + this.checkBoxFontBold.UseVisualStyleBackColor = true; + this.checkBoxFontBold.CheckedChanged += new System.EventHandler(this.checkBoxFontBold_CheckedChanged); + // + // comboBoxFontName + // + this.comboBoxFontName.FormattingEnabled = true; + this.comboBoxFontName.Location = new System.Drawing.Point(73, 17); + this.comboBoxFontName.Name = "comboBoxFontName"; + this.comboBoxFontName.Size = new System.Drawing.Size(188, 21); + this.comboBoxFontName.TabIndex = 1; + this.comboBoxFontName.TextChanged += new System.EventHandler(this.comboBoxFontName_TextChanged); + // + // labelFontSize + // + this.labelFontSize.AutoSize = true; + this.labelFontSize.Location = new System.Drawing.Point(319, 20); + this.labelFontSize.Name = "labelFontSize"; + this.labelFontSize.Size = new System.Drawing.Size(49, 13); + this.labelFontSize.TabIndex = 3; + this.labelFontSize.Text = "Font size"; + // + // labelFontName + // + this.labelFontName.AutoSize = true; + this.labelFontName.Location = new System.Drawing.Point(10, 20); + this.labelFontName.Name = "labelFontName"; + this.labelFontName.Size = new System.Drawing.Size(57, 13); + this.labelFontName.TabIndex = 0; + this.labelFontName.Text = "Font name"; + // + // buttonApply + // + this.buttonApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonApply.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonApply.Location = new System.Drawing.Point(831, 619); + this.buttonApply.Name = "buttonApply"; + this.buttonApply.Size = new System.Drawing.Size(105, 23); + this.buttonApply.TabIndex = 4; + this.buttonApply.Text = "&Apply"; + this.buttonApply.UseVisualStyleBackColor = true; + this.buttonApply.Click += new System.EventHandler(this.buttonApply_Click); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonCancel.Location = new System.Drawing.Point(1023, 619); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 6; + this.buttonCancel.Text = "C&ancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonOK.Location = new System.Drawing.Point(942, 619); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(75, 23); + this.buttonOK.TabIndex = 5; + this.buttonOK.Text = "&OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // labelDuplicateStyleNames + // + this.labelDuplicateStyleNames.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.labelDuplicateStyleNames.AutoSize = true; + this.labelDuplicateStyleNames.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelDuplicateStyleNames.ForeColor = System.Drawing.Color.Firebrick; + this.labelDuplicateStyleNames.Location = new System.Drawing.Point(5, 632); + this.labelDuplicateStyleNames.Name = "labelDuplicateStyleNames"; + this.labelDuplicateStyleNames.Size = new System.Drawing.Size(154, 13); + this.labelDuplicateStyleNames.TabIndex = 11; + this.labelDuplicateStyleNames.Text = "labelDuplicateStyleNames"; + // + // labelInfo + // + this.labelInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.labelInfo.AutoSize = true; + this.labelInfo.Location = new System.Drawing.Point(8, 614); + this.labelInfo.Name = "labelInfo"; + this.labelInfo.Size = new System.Drawing.Size(47, 13); + this.labelInfo.TabIndex = 13; + this.labelInfo.Text = "labelInfo"; + // + // WebVttStyleManager + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1110, 654); + this.Controls.Add(this.labelInfo); + this.Controls.Add(this.labelDuplicateStyleNames); + this.Controls.Add(this.buttonApply); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.groupBoxProperties); + this.Controls.Add(this.groupBoxStyles); + this.KeyPreview = true; + this.MinimumSize = new System.Drawing.Size(1100, 680); + this.Name = "WebVttStyleManager"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "WebVttStyleManager"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.WebVttStyleManager_FormClosing); + this.groupBoxStyles.ResumeLayout(false); + this.contextMenuStripStyles.ResumeLayout(false); + this.groupBoxProperties.ResumeLayout(false); + this.groupBoxProperties.PerformLayout(); + this.groupBoxAfter.ResumeLayout(false); + this.groupBoxAfter.PerformLayout(); + this.groupBoxBefore.ResumeLayout(false); + this.groupBoxBefore.PerformLayout(); + this.groupBoxPreview.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxPreview)).EndInit(); + this.groupBoxFont.ResumeLayout(false); + this.groupBoxFont.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownShadowWidth)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFontSize)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.GroupBox groupBoxStyles; + private System.Windows.Forms.Button buttonExport; + private System.Windows.Forms.Button buttonImport; + private System.Windows.Forms.Button buttonCopy; + private System.Windows.Forms.Button buttonRemoveAll; + private System.Windows.Forms.Button buttonAdd; + private System.Windows.Forms.Button buttonRemove; + private System.Windows.Forms.ListView listViewStyles; + private System.Windows.Forms.ColumnHeader columnHeaderName; + private System.Windows.Forms.ColumnHeader columnHeaderFontName; + private System.Windows.Forms.ColumnHeader columnHeaderFontSize; + private System.Windows.Forms.ColumnHeader columnHeaderUseCount; + private System.Windows.Forms.ColumnHeader columnHeaderForeColor; + private System.Windows.Forms.ColumnHeader columnHeaderBackgroundColor; + private System.Windows.Forms.GroupBox groupBoxProperties; + private System.Windows.Forms.NumericUpDown numericUpDownShadowWidth; + private System.Windows.Forms.Label labelShadow; + private System.Windows.Forms.TextBox textBoxStyleName; + private System.Windows.Forms.Label labelStyleName; + private System.Windows.Forms.Panel panelShadowColor; + private System.Windows.Forms.Button buttonShadowColor; + private System.Windows.Forms.Panel panelBackgroundColor; + private System.Windows.Forms.Button buttonBackgroundColor; + private System.Windows.Forms.Panel panelPrimaryColor; + private System.Windows.Forms.Button buttonPrimaryColor; + private System.Windows.Forms.GroupBox groupBoxPreview; + private System.Windows.Forms.PictureBox pictureBoxPreview; + private System.Windows.Forms.GroupBox groupBoxFont; + private System.Windows.Forms.CheckBox checkBoxStrikeout; + private System.Windows.Forms.CheckBox checkBoxFontUnderline; + private System.Windows.Forms.NumericUpDown numericUpDownFontSize; + private System.Windows.Forms.CheckBox checkBoxFontItalic; + private System.Windows.Forms.CheckBox checkBoxFontBold; + private System.Windows.Forms.ComboBox comboBoxFontName; + private System.Windows.Forms.Label labelFontSize; + private System.Windows.Forms.Label labelFontName; + private System.Windows.Forms.Button buttonApply; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.CheckBox checkBoxColorEnabled; + private System.Windows.Forms.CheckBox checkBoxBackgroundColorEnabled; + private System.Windows.Forms.GroupBox groupBoxAfter; + private System.Windows.Forms.GroupBox groupBoxBefore; + private System.Windows.Forms.ColumnHeader columnHeaderItalic; + private System.Windows.Forms.Label labelAfter; + private System.Windows.Forms.Label labelBefore; + private System.Windows.Forms.CheckBox checkBoxShadowEnabled; + private System.Windows.Forms.Label labelDuplicateStyleNames; + private System.Windows.Forms.ContextMenuStrip contextMenuStripStyles; + private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemRemoveAll; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; + private System.Windows.Forms.ToolStripMenuItem moveUpToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem moveDownToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem moveTopToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem moveBottomToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItemNew; + private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItemCopy; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemImport; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemExport; + private System.Windows.Forms.Label labelInfo; + } +} \ No newline at end of file diff --git a/src/ui/Forms/VTT/WebVttStyleManager.cs b/src/ui/Forms/VTT/WebVttStyleManager.cs new file mode 100644 index 000000000..9f00c877f --- /dev/null +++ b/src/ui/Forms/VTT/WebVttStyleManager.cs @@ -0,0 +1,1230 @@ +using Nikse.SubtitleEdit.Core.Common; +using Nikse.SubtitleEdit.Core.SubtitleFormats; +using Nikse.SubtitleEdit.Logic; +using Nikse.SubtitleEdit.Logic.VideoPlayers; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Drawing.Text; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace Nikse.SubtitleEdit.Forms.VTT +{ + public sealed partial class WebVttStyleManager : Form + { + public string Header { get; set; } + private readonly List _webVttStyles; + private readonly List _originalWebVttStyles; + private WebVttStyle _currentStyle; + private readonly Subtitle _subtitle; + private bool _doUpdate; + private readonly Timer _previewTimer = new Timer(); + private Bitmap _backgroundImage; + private readonly bool _backgroundImageDark; + private LibMpvDynamic _mpv; + private string _mpvTextFileName; + + public WebVttStyleManager(Subtitle subtitle, int index) + { + UiUtil.PreInitialize(this); + InitializeComponent(); + UiUtil.FixFonts(this); + UiUtil.FixLargeFonts(this, buttonOK); + + _subtitle = subtitle; + _webVttStyles = WebVttHelper.GetStyles(subtitle.Header); + _originalWebVttStyles = WebVttHelper.GetStyles(subtitle.Header); + Header = subtitle.Header; + InitializeStylesListView(); + CheckDuplicateStyles(); + + var fontNames = new List(); + foreach (var x in FontFamily.Families) + { + fontNames.Add(x.Name); + } + + comboBoxFontName.Items.Clear(); + comboBoxFontName.Items.AddRange(fontNames.ToArray()); + labelInfo.Text = string.Empty; + + Text = LanguageSettings.Current.WebVttStyleManager.Title; + var l = LanguageSettings.Current.SubStationAlphaStyles; + groupBoxStyles.Text = l.Styles; + listViewStyles.Columns[0].Text = l.Name; + listViewStyles.Columns[1].Text = l.FontName; + listViewStyles.Columns[2].Text = l.FontSize; + listViewStyles.Columns[3].Text = LanguageSettings.Current.General.Italic; + listViewStyles.Columns[4].Text = LanguageSettings.Current.GenerateBlankVideo.Background; + listViewStyles.Columns[5].Text = LanguageSettings.Current.General.Text; + listViewStyles.Columns[6].Text = l.UseCount; + groupBoxProperties.Text = l.Properties; + labelStyleName.Text = l.Name; + groupBoxFont.Text = l.Font; + labelFontName.Text = l.FontName; + labelFontSize.Text = l.FontSize; + checkBoxFontItalic.Text = LanguageSettings.Current.General.Italic; + checkBoxFontBold.Text = LanguageSettings.Current.General.Bold; + checkBoxFontUnderline.Text = LanguageSettings.Current.General.Underline; + checkBoxStrikeout.Text = LanguageSettings.Current.General.Strikeout; + buttonPrimaryColor.Text = l.Primary; + //buttonSecondaryColor.Text = l.Secondary; + //buttonOutlineColor.Text = l.Outline; + //buttonBackColor.Text = l.Shadow; + labelShadow.Text = l.Shadow; + buttonImport.Text = l.Import; + buttonExport.Text = l.Export; + buttonCopy.Text = l.Copy; + buttonAdd.Text = l.New; + buttonRemove.Text = l.Remove; + buttonRemoveAll.Text = l.RemoveAll; + groupBoxPreview.Text = LanguageSettings.Current.General.Preview; + + deleteToolStripMenuItem.Text = l.Remove; + //removeAndReplaceWithToolStripMenuItem.Text = l.ReplaceWith; + toolStripMenuItemRemoveAll.Text = l.RemoveAll; + moveUpToolStripMenuItem.Text = LanguageSettings.Current.DvdSubRip.MoveUp; + moveDownToolStripMenuItem.Text = LanguageSettings.Current.DvdSubRip.MoveDown; + moveTopToolStripMenuItem.Text = LanguageSettings.Current.MultipleReplace.MoveToTop; + moveBottomToolStripMenuItem.Text = LanguageSettings.Current.MultipleReplace.MoveToBottom; + newToolStripMenuItemNew.Text = l.New; + copyToolStripMenuItemCopy.Text = l.Copy; + toolStripMenuItemImport.Text = l.Import; + toolStripMenuItemExport.Text = l.Export; + + checkBoxColorEnabled.Text = LanguageSettings.Current.MultipleReplace.Enabled; + checkBoxBackgroundColorEnabled.Text = LanguageSettings.Current.MultipleReplace.Enabled; + checkBoxShadowEnabled.Text = LanguageSettings.Current.MultipleReplace.Enabled; + + buttonApply.Text = LanguageSettings.Current.General.Apply; + buttonOK.Text = LanguageSettings.Current.General.Ok; + buttonCancel.Text = LanguageSettings.Current.General.Cancel; + + comboBoxFontName.Left = labelFontName.Right + 5; + labelFontSize.Left = comboBoxFontName.Right + 15; + numericUpDownFontSize.Left = labelFontSize.Right + 5; + + checkBoxFontItalic.Left = checkBoxFontBold.Right + 15; + checkBoxFontUnderline.Left = checkBoxFontItalic.Right + 15; + checkBoxStrikeout.Left = checkBoxFontUnderline.Right + 15; + + _backgroundImageDark = Configuration.Settings.General.UseDarkTheme; + _previewTimer.Interval = 200; + _previewTimer.Tick += PreviewTimerTick; + } + + private void PreviewTimerTick(object sender, EventArgs e) + { + _previewTimer.Stop(); + GeneratePreviewReal(); + } + + private void InitializeStylesListView() + { + listViewStyles.Items.Clear(); + foreach (var style in _webVttStyles) + { + AddStyle(listViewStyles, style, _subtitle); + } + + if (listViewStyles.Items.Count > 0) + { + listViewStyles.Items[0].Selected = true; + } + } + + public static void AddStyle(ListView lv, WebVttStyle style, Subtitle subtitle) + { + AddStyle(lv, style, subtitle, lv.Items.Count); + } + + public static void AddStyle(ListView lv, WebVttStyle style, Subtitle subtitle, int insertAt) + { + // Style name - 0 + var item = new ListViewItem(style.Name.Trim().TrimStart('.')) + { + Checked = true, + UseItemStyleForSubItems = false, + Tag = style, + }; + + // Font name - 1 + var subItem = new ListViewItem.ListViewSubItem(item, string.IsNullOrEmpty(style.FontName) ? "- " : style.FontName); + item.SubItems.Add(subItem); + + // Font size - 2 + subItem = new ListViewItem.ListViewSubItem(item, style.FontSize.HasValue ? style.FontSize.HasValue.ToString(CultureInfo.InvariantCulture) : "-"); + item.SubItems.Add(subItem); + + // Italic - 3 + subItem = new ListViewItem.ListViewSubItem(item, style.Italic.HasValue && style.Italic.Value ? LanguageSettings.Current.General.Yes : "-"); + item.SubItems.Add(subItem); + + // Background color - 4 + subItem = new ListViewItem.ListViewSubItem(item, string.Empty) { BackColor = style.BackgroundColor.HasValue ? style.BackgroundColor.Value : UiUtil.BackColor }; + item.SubItems.Add(subItem); + + // Color - 5 + subItem = new ListViewItem.ListViewSubItem(item, string.Empty) + { + BackColor = style.Color ?? UiUtil.BackColor, + Text = LanguageSettings.Current.General.Text, + }; + + try + { + var fontStyle = FontStyle.Regular; + if (style.Bold.HasValue && style.Bold == true) + { + fontStyle |= FontStyle.Bold; + } + + if (style.Italic.HasValue && style.Italic == true) + { + fontStyle |= FontStyle.Italic; + } + + if (style.Underline.HasValue && style.Underline == true) + { + fontStyle |= FontStyle.Underline; + } + + if (style.StrikeThrough.HasValue && style.StrikeThrough == true) + { + fontStyle |= FontStyle.Strikeout; + } + + subItem.Font = new Font(style.FontName, subItem.Font.Size, fontStyle); + } + catch + { + // Ignored + } + + item.SubItems.Add(subItem); + + + // Use count + var count = 0; + foreach (var p in subtitle.Paragraphs) + { + if (p.Text.Contains(style.Name + ".", StringComparison.Ordinal) || + p.Text.Contains(style.Name + ">", StringComparison.Ordinal)) + { + count++; + } + } + + subItem = new ListViewItem.ListViewSubItem(item, count.ToString()); + item.SubItems.Add(subItem); + + lv.Items.Insert(insertAt, item); + } + + private void listViewStyles_SelectedIndexChanged(object sender, EventArgs e) + { + if (listViewStyles.SelectedItems.Count == 1) + { + var styleName = "." + listViewStyles.SelectedItems[0].Text; + var style = _webVttStyles.FirstOrDefault(p => p.Name == styleName); + SetControlsFromStyle(style); + _doUpdate = true; + groupBoxProperties.Enabled = true; + } + else + { + groupBoxProperties.Enabled = false; + _doUpdate = false; + _currentStyle = null; + pictureBoxPreview.Image?.Dispose(); + pictureBoxPreview.Image = new Bitmap(1, 1); + } + + UpdateCurrentFileButtonsState(); + GeneratePreview(); + } + + private void SetControlsFromStyle(WebVttStyle style) + { + _currentStyle = style; + + textBoxStyleName.Text = style.Name.RemoveChar('.'); + textBoxStyleName.BackColor = listViewStyles.BackColor; + comboBoxFontName.Text = style.FontName; + + checkBoxFontItalic.Checked = style.Italic.HasValue && style.Italic.Value; + checkBoxFontBold.Checked = style.Bold.HasValue && style.Bold.Value; + checkBoxFontUnderline.Checked = style.Underline.HasValue && style.Underline.Value; + checkBoxStrikeout.Checked = style.StrikeThrough.HasValue && style.StrikeThrough.Value; + + if (style.FontSize.HasValue && style.FontSize > 0 && style.FontSize <= numericUpDownFontSize.Maximum) + { + numericUpDownFontSize.Value = style.FontSize.Value; + } + else + { + numericUpDownFontSize.Value = 0; + } + + if (style.Color.HasValue) + { + panelPrimaryColor.BackColor = style.Color.Value; + checkBoxColorEnabled.Checked = true; + } + else + { + checkBoxColorEnabled.Checked = false; + panelPrimaryColor.BackColor = Color.Transparent; + } + + if (style.BackgroundColor.HasValue) + { + panelBackgroundColor.BackColor = style.BackgroundColor.Value; + checkBoxBackgroundColorEnabled.Checked = true; + } + else + { + checkBoxBackgroundColorEnabled.Checked = false; + panelBackgroundColor.BackColor = Color.Transparent; + } + + if (style.ShadowColor.HasValue) + { + panelBackgroundColor.BackColor = style.ShadowColor.Value; + } + else + { + panelShadowColor.BackColor = Color.Transparent; + } + + if (style.ShadowWidth.HasValue && style.ShadowWidth >= 0 && style.ShadowWidth <= numericUpDownShadowWidth.Maximum) + { + numericUpDownShadowWidth.Value = style.ShadowWidth.Value; + } + else + { + numericUpDownShadowWidth.Value = 0; + } + + var beforeStyle = _originalWebVttStyles.FirstOrDefault(p => p.Name == style.Name); + if (beforeStyle == null) + { + labelBefore.Text = string.Empty; + } + else + { + labelBefore.Text = beforeStyle.ToString().Replace("; ", ";" + Environment.NewLine); + } + + UpdateRawBeforeStyle(); + } + + private void UpdateRawBeforeStyle() + { + if (_currentStyle == null) + { + labelAfter.Text = string.Empty; + labelBefore.Text = string.Empty; + return; + } + + labelAfter.Text = _currentStyle.ToString().Replace("; ", ";" + Environment.NewLine); + } + + private void UpdateCurrentFileButtonsState() + { + var oneOrMoreSelected = listViewStyles.SelectedItems.Count > 0; + buttonRemove.Enabled = oneOrMoreSelected; + buttonCopy.Enabled = oneOrMoreSelected; + } + + private void panelPrimaryColor_Click(object sender, EventArgs e) + { + using (var colorChooser = new ColorChooser { Color = panelPrimaryColor.BackColor }) + { + if (colorChooser.ShowDialog() != DialogResult.OK || _currentStyle == null) + { + return; + } + + checkBoxColorEnabled.Checked = true; + panelPrimaryColor.BackColor = colorChooser.Color; + _currentStyle.Color = colorChooser.Color; + listViewStyles.SelectedItems[0].SubItems[5].BackColor = colorChooser.Color; + UpdateRawBeforeStyle(); + } + } + + private void buttonPrimaryColor_Click(object sender, EventArgs e) + { + panelPrimaryColor_Click(null, null); + } + + private void panelBackgroundColor_Click(object sender, EventArgs e) + { + using (var colorChooser = new ColorChooser { Color = panelBackgroundColor.BackColor }) + { + if (colorChooser.ShowDialog() != DialogResult.OK || _currentStyle == null) + { + return; + } + + checkBoxBackgroundColorEnabled.Checked = true; + panelBackgroundColor.BackColor = colorChooser.Color; + _currentStyle.BackgroundColor = colorChooser.Color; + listViewStyles.SelectedItems[0].SubItems[4].BackColor = colorChooser.Color; + UpdateRawBeforeStyle(); + } + } + + private void buttonBackgroundColor_Click(object sender, EventArgs e) + { + panelBackgroundColor_Click(null, null); + } + + private void panelShadowColor_Click(object sender, EventArgs e) + { + using (var colorChooser = new ColorChooser { Color = panelShadowColor.BackColor }) + { + if (colorChooser.ShowDialog() != DialogResult.OK || _currentStyle == null) + { + return; + } + + checkBoxShadowEnabled.Checked = true; + panelShadowColor.BackColor = colorChooser.Color; + _currentStyle.ShadowColor = colorChooser.Color; + } + + UpdateRawBeforeStyle(); + } + + private void checkBoxColorEnabled_CheckedChanged(object sender, EventArgs e) + { + if (!_doUpdate || _currentStyle == null) + { + return; + } + + var checkBox = (CheckBox)sender; + if (checkBox.Checked) + { + _currentStyle.Color = panelPrimaryColor.BackColor; + } + else + { + _currentStyle.Color = null; + } + + listViewStyles.SelectedItems[0].SubItems[5].BackColor = _currentStyle.Color ?? UiUtil.BackColor; + UpdateRawBeforeStyle(); + } + + private void checkBoxBackgroundColorEnabled_CheckedChanged(object sender, EventArgs e) + { + if (!_doUpdate || _currentStyle == null) + { + return; + } + + var checkBox = (CheckBox)sender; + if (checkBox.Checked) + { + _currentStyle.BackgroundColor = panelBackgroundColor.BackColor; + } + else + { + _currentStyle.BackgroundColor = null; + } + + listViewStyles.SelectedItems[0].SubItems[4].BackColor = _currentStyle.BackgroundColor ?? UiUtil.BackColor; + UpdateRawBeforeStyle(); + } + + private void checkBoxShadowEnabled_CheckedChanged(object sender, EventArgs e) + { + if (!_doUpdate || _currentStyle == null) + { + return; + } + + var checkBox = (CheckBox)sender; + if (checkBox.Checked) + { + _currentStyle.ShadowColor = panelBackgroundColor.BackColor; + } + else + { + _currentStyle.ShadowColor = null; + } + + UpdateRawBeforeStyle(); + } + + private void comboBoxFontName_TextChanged(object sender, EventArgs e) + { + if (!_doUpdate || _currentStyle == null) + { + return; + } + + if (string.IsNullOrEmpty(comboBoxFontName.Text)) + { + _currentStyle.FontName = null; + } + else + { + _currentStyle.FontName = comboBoxFontName.Text; + } + + listViewStyles.SelectedItems[0].SubItems[1].Text = comboBoxFontName.Text; + UpdateRawBeforeStyle(); + } + + private void numericUpDownFontSize_ValueChanged(object sender, EventArgs e) + { + if (!_doUpdate || _currentStyle == null) + { + return; + } + + if (numericUpDownFontSize.Value == 0) + { + _currentStyle.FontSize = null; + } + else + { + _currentStyle.FontSize = numericUpDownFontSize.Value; + } + + listViewStyles.SelectedItems[0].SubItems[2].Text = _currentStyle.FontSize == null ? "-" : numericUpDownFontSize.Value.ToString(); + UpdateRawBeforeStyle(); + } + + private void buttonAdd_Click(object sender, EventArgs e) + { + var style = new WebVttStyle { Name = GetStyleName() }; + _webVttStyles.Add(style); + AddStyle(listViewStyles, style, _subtitle); + + foreach (ListViewItem listViewItem in listViewStyles.Items) + { + listViewItem.Selected = false; + } + + listViewStyles.Items[listViewStyles.Items.Count - 1].Selected = true; + listViewStyles.EnsureVisible(listViewStyles.Items.Count - 1); + + CheckDuplicateStyles(); + } + + private string GetStyleName() + { + const string baseName = ".new"; + var name = baseName; + var count = 2; + while (_webVttStyles.Any(p => p.Name == name)) + { + name = baseName + " " + count; + count++; + } + + return name; + } + + private void buttonOK_Click(object sender, EventArgs e) + { + SetHeader(); + DialogResult = DialogResult.OK; + } + + private void SetHeader() + { + var header = _subtitle.Header ?? string.Empty; + if (!header.StartsWith("WEBVTT")) + { + header = "WEBVTT"; + } + + var styleOn = false; + var sb = new StringBuilder(); + foreach (var line in header.SplitToLines()) + { + if (line == "STYLE") + { + styleOn = true; + } + else if (line == string.Empty && styleOn) + { + styleOn = false; + } + else if (styleOn) + { + // ignore + } + else + { + sb.AppendLine(line); + } + } + + var sbStyles = new StringBuilder(); + sbStyles.AppendLine("STYLE"); + foreach (var style in _webVttStyles) + { + var rawStyle = "::cue(." + style.Name.RemoveChar('.') + ") { " + WebVttHelper.GetCssProperties(style) + " }"; + sbStyles.AppendLine(rawStyle); + } + + header = sb.ToString().Trim() + Environment.NewLine + Environment.NewLine + sbStyles; + Header = header; + } + + private void buttonApply_Click(object sender, EventArgs e) + { + SetHeader(); + _subtitle.Header = Header; + } + + private void buttonRemove_Click(object sender, EventArgs e) + { + if (listViewStyles.SelectedItems.Count == 0) + { + return; + } + + var askText = listViewStyles.SelectedItems.Count > 1 ? string.Format(LanguageSettings.Current.Main.DeleteXLinesPrompt, listViewStyles.SelectedItems.Count) : LanguageSettings.Current.Main.DeleteOneLinePrompt; + + if (Configuration.Settings.General.PromptDeleteLines && + MessageBox.Show(askText, string.Empty, MessageBoxButtons.YesNoCancel) != DialogResult.Yes) + { + return; + } + + foreach (ListViewItem selectedItem in listViewStyles.SelectedItems) + { + var name = "." + selectedItem.Text; + listViewStyles.Items.RemoveAt(selectedItem.Index); + _webVttStyles.RemoveAll(p => p.Name == name); + } + + if (listViewStyles.Items.Count == 0) + { + InitializeStylesListView(); + } + + CheckDuplicateStyles(); + } + + private void CheckDuplicateStyles() + { + labelDuplicateStyleNames.Text = string.Empty; + var duplicateStyles = new List(); + foreach (var style in _webVttStyles) + { + if (_webVttStyles.Count(p => p.Name == style.Name) > 1 && !duplicateStyles.Contains(style.Name)) + { + duplicateStyles.Add(style.Name); + } + } + + if (duplicateStyles.Count > 0) + { + labelDuplicateStyleNames.Text = string.Format(LanguageSettings.Current.SubStationAlphaStyles.DuplicateStyleNames, string.Join(", ", duplicateStyles)); + } + } + + private void buttonRemoveAll_Click(object sender, EventArgs e) + { + var askText = listViewStyles.Items.Count == 1 ? LanguageSettings.Current.Main.DeleteOneLinePrompt : string.Format(LanguageSettings.Current.Main.DeleteXLinesPrompt, listViewStyles.Items.Count); + + if (MessageBox.Show(askText, string.Empty, MessageBoxButtons.YesNoCancel) != DialogResult.Yes) + { + return; + } + + listViewStyles.Items.Clear(); + _webVttStyles.Clear(); + InitializeStylesListView(); + CheckDuplicateStyles(); + } + + private void buttonCopy_Click(object sender, EventArgs e) + { + var selectionCount = listViewStyles.SelectedItems.Count; + if (selectionCount <= 0) + { + return; + } + + var tempStyles = new List(); + foreach (ListViewItem selectedItem in listViewStyles.SelectedItems) + { + var styleName = selectedItem.Text; + var oldStyle = _currentStyle; + var style = new WebVttStyle(oldStyle) { Name = "." + string.Format(LanguageSettings.Current.SubStationAlphaStyles.CopyOfY, styleName.RemoveChar('.')) }; // Copy constructor + style.Name = style.Name.Replace(" ", "-"); + + if (_webVttStyles.FirstOrDefault(p => p.Name == style.Name) != null) + { + var count = 2; + var doRepeat = true; + while (doRepeat) + { + style.Name = "." + string.Format(LanguageSettings.Current.SubStationAlphaStyles.CopyXOfY, count, styleName.RemoveChar('.')); + style.Name = style.Name.Replace(" ", "-"); + doRepeat = _webVttStyles.FirstOrDefault(p => p.Name == style.Name) != null; + count++; + } + } + + _doUpdate = false; + tempStyles.Add(style); + _doUpdate = true; + + selectedItem.Selected = false; + } + + foreach (var style in tempStyles) + { + AddStyle(listViewStyles, style, _subtitle); + _webVttStyles.Add(style); + } + + listViewStyles.Items[listViewStyles.Items.Count - 1].Selected = true; + listViewStyles.Items[listViewStyles.Items.Count - 1].Focused = true; + + CheckDuplicateStyles(); + } + + private void buttonExport_Click(object sender, EventArgs e) + { + if (listViewStyles.Items.Count == 0) + { + return; + } + + var styles = new List(); + foreach (ListViewItem item in listViewStyles.Items) + { + styles.Add((WebVttStyle)item.Tag); + } + + using (var form = new WebVttImportExport(styles)) + { + if (form.ShowDialog(this) == DialogResult.OK) + { + var styleNames = "(" + form.ImportExportStyles.Count + ")"; + labelInfo.Text = string.Format(LanguageSettings.Current.SubStationAlphaStyles.StyleXExportedToFileY, styleNames, form.FileName); + + System.Threading.SynchronizationContext.Current.Post(TimeSpan.FromMilliseconds(3500), () => + { + try + { + labelInfo.Text = string.Empty; + } + catch + { + // ignore + } + }); + } + } + } + + private void buttonImport_Click(object sender, EventArgs e) + { + using (var openFileDialog1 = new OpenFileDialog()) + { + openFileDialog1.Title = LanguageSettings.Current.General.OpenSubtitle; + openFileDialog1.FileName = string.Empty; + openFileDialog1.Filter = "WebVTT files|*.webvtt;*.vtt"; + openFileDialog1.FileName = string.Empty; + if (openFileDialog1.ShowDialog() != DialogResult.OK) + { + return; + } + + using (var form = new WebVttImportExport(_webVttStyles, openFileDialog1.FileName)) + { + if (form.ShowDialog(this) == DialogResult.OK) + { + foreach (var style in form.ImportExportStyles) + { + style.Name = GetUniqueName(style); + AddStyle(listViewStyles, style, _subtitle); + _webVttStyles.Add(style); + } + } + } + } + + GeneratePreview(); + } + + private string GetUniqueName(WebVttStyle style) + { + var styleName = style.Name; + var newName = styleName; + if (_webVttStyles.FirstOrDefault(p => p.Name == style.Name) != null) + { + var count = 2; + var doRepeat = true; + while (doRepeat) + { + newName = "." + string.Format(LanguageSettings.Current.SubStationAlphaStyles.CopyXOfY, count, styleName.RemoveChar('.')); + newName = newName.Replace(" ", "-"); + doRepeat = _webVttStyles.FirstOrDefault(p => p.Name == style.Name) != null; + count++; + } + } + + return newName; + } + + private void listViewStyles_KeyDown(object sender, KeyEventArgs e) + { + if (e.Modifiers == Keys.Control && e.KeyCode == Keys.C) + { + buttonCopy_Click(null, null); + } + else if (e.Modifiers == Keys.None && e.KeyCode == Keys.Delete) + { + buttonRemove_Click(null, null); + } + else if (e.KeyCode == Keys.A && e.Modifiers == Keys.Control) + { + listViewStyles.SelectAll(); + e.SuppressKeyPress = true; + } + else if (e.KeyCode == Keys.D && e.Modifiers == Keys.Control) + { + listViewStyles.SelectFirstSelectedItemOnly(); + e.SuppressKeyPress = true; + } + else if (e.KeyCode == Keys.I && e.Modifiers == (Keys.Control | Keys.Shift)) + { + listViewStyles.InverseSelection(); + e.SuppressKeyPress = true; + } + } + + private void textBoxStyleName_TextChanged(object sender, EventArgs e) + { + if (!_doUpdate || listViewStyles.SelectedItems.Count != 1) + { + return; + } + + var newName = textBoxStyleName.Text.RemoveChar('.', ' ').Trim(); + if (_currentStyle.Name == "." + newName) + { + return; + } + + if (string.IsNullOrEmpty(newName) || _webVttStyles.Any(p => p.Name == "." + newName)) + { + textBoxStyleName.BackColor = Configuration.Settings.Tools.ListViewSyntaxErrorColor; + } + else + { + textBoxStyleName.BackColor = listViewStyles.BackColor; + _currentStyle.Name = "." + newName; + listViewStyles.SelectedItems[0].Text = newName; + } + + GeneratePreview(); + } + + private void checkBoxFontBold_CheckedChanged(object sender, EventArgs e) + { + if (!_doUpdate || listViewStyles.SelectedItems.Count != 1) + { + return; + } + + if (checkBoxFontBold.Checked) + { + _currentStyle.Bold = true; + } + else + { + _currentStyle.Bold = null; + } + + UpdateRawBeforeStyle(); + GeneratePreview(); + } + + private void checkBoxFontItalic_CheckedChanged(object sender, EventArgs e) + { + if (!_doUpdate || listViewStyles.SelectedItems.Count != 1) + { + return; + } + + if (checkBoxFontItalic.Checked) + { + _currentStyle.Italic = true; + } + else + { + _currentStyle.Italic = null; + } + + listViewStyles.SelectedItems[0].SubItems[3].Text = _currentStyle.Italic.HasValue && _currentStyle.Italic.Value ? LanguageSettings.Current.General.Yes : "-"; + UpdateRawBeforeStyle(); + GeneratePreview(); + } + + private void checkBoxFontUnderline_CheckedChanged(object sender, EventArgs e) + { + if (!_doUpdate || listViewStyles.SelectedItems.Count != 1) + { + return; + } + + if (checkBoxFontUnderline.Checked) + { + _currentStyle.Underline = true; + } + else + { + _currentStyle.Underline = null; + } + + UpdateRawBeforeStyle(); + GeneratePreview(); + } + + private void checkBoxStrikeout_CheckedChanged(object sender, EventArgs e) + { + if (!_doUpdate || listViewStyles.SelectedItems.Count != 1) + { + return; + } + + if (checkBoxStrikeout.Checked) + { + _currentStyle.StrikeThrough = true; + } + else + { + _currentStyle.StrikeThrough = null; + } + + UpdateRawBeforeStyle(); + GeneratePreview(); + } + + private void deleteToolStripMenuItem_Click(object sender, EventArgs e) + { + buttonRemove_Click(null, null); + } + + private void toolStripMenuItemRemoveAll_Click(object sender, EventArgs e) + { + buttonRemoveAll_Click(null, null); + } + + private void newToolStripMenuItemNew_Click(object sender, EventArgs e) + { + buttonAdd_Click(null, null); + } + + private void copyToolStripMenuItemCopy_Click(object sender, EventArgs e) + { + buttonCopy_Click(null, null); + } + + private void toolStripMenuItemImport_Click(object sender, EventArgs e) + { + buttonImport_Click(null, null); + } + + private void toolStripMenuItemExport_Click(object sender, EventArgs e) + { + buttonExport_Click(null, null); + } + + private void moveUpToolStripMenuItem_Click(object sender, EventArgs e) + { + MoveUp(listViewStyles); + } + + private void MoveUp(ListView listView) + { + if (listView.SelectedItems.Count != 1) + { + return; + } + + var idx = listView.SelectedItems[0].Index; + if (idx == 0) + { + return; + } + + var item = listView.SelectedItems[0]; + listView.Items.RemoveAt(idx); + + var style = _webVttStyles[idx]; + _webVttStyles.RemoveAt(idx); + _webVttStyles.Insert(idx - 1, style); + + idx--; + listView.Items.Insert(idx, item); + } + + private void MoveDown(ListView listView) + { + if (listView.SelectedItems.Count != 1) + { + return; + } + + var idx = listView.SelectedItems[0].Index; + if (idx >= listView.Items.Count - 1) + { + return; + } + + var item = listView.SelectedItems[0]; + listView.Items.RemoveAt(idx); + var style = _webVttStyles[idx]; + _webVttStyles.RemoveAt(idx); + _webVttStyles.Insert(idx + 1, style); + idx++; + listView.Items.Insert(idx, item); + } + + private void MoveToTop(ListView listView) + { + if (listView.SelectedItems.Count != 1) + { + return; + } + + var idx = listView.SelectedItems[0].Index; + if (idx == 0) + { + return; + } + + var item = listView.SelectedItems[0]; + listView.Items.RemoveAt(idx); + + var style = _webVttStyles[idx]; + _webVttStyles.RemoveAt(idx); + _webVttStyles.Insert(0, style); + + idx = 0; + listView.Items.Insert(idx, item); + } + + private void MoveToBottom(ListView listView) + { + if (listView.SelectedItems.Count != 1) + { + return; + } + + var idx = listView.SelectedItems[0].Index; + if (idx == listView.Items.Count - 1) + { + return; + } + + var item = listView.SelectedItems[0]; + listView.Items.RemoveAt(idx); + + var style = _webVttStyles[idx]; + _webVttStyles.RemoveAt(idx); + _webVttStyles.Add(style); + + listView.Items.Add(item); + } + + private void moveDownToolStripMenuItem_Click(object sender, EventArgs e) + { + MoveDown(listViewStyles); + } + + private void moveTopToolStripMenuItem_Click(object sender, EventArgs e) + { + MoveToTop(listViewStyles); + } + + private void moveBottomToolStripMenuItem_Click(object sender, EventArgs e) + { + MoveToBottom(listViewStyles); + } + + private void GeneratePreview() + { + if (_previewTimer.Enabled) + { + _previewTimer.Stop(); + _previewTimer.Start(); + } + else + { + _previewTimer.Start(); + } + } + + private void GeneratePreviewReal() + { + if (_currentStyle == null || listViewStyles.SelectedItems.Count != 1 || pictureBoxPreview.Width <= 0 || pictureBoxPreview.Height <= 0) + { + return; + } + + if (GeneratePreviewViaMpv()) + { + return; + } + + if (_backgroundImage == null) + { + const int rectangleSize = 9; + _backgroundImage = TextDesigner.MakeBackgroundImage(pictureBoxPreview.Width, pictureBoxPreview.Height, rectangleSize, _backgroundImageDark); + } + + var defaultStyle = new SsaStyle(); + var shadowWidth = (float)numericUpDownShadowWidth.Value; + var outlineColor = _currentStyle.BackgroundColor ?? defaultStyle.Background; + + Font font; + var privateFontCollection = new PrivateFontCollection(); + try + { + var fontSize = defaultStyle.FontSize; + if (_currentStyle.FontSize.HasValue && _currentStyle.FontSize.Value > 0.1m) + { + fontSize = _currentStyle.FontSize.Value; + } + + var fontName = _currentStyle.FontName; + if (string.IsNullOrEmpty(fontName)) + { + fontName = Font.FontFamily.Name; + } + + font = new Font(fontName, (float)fontSize * 1.1f, checkBoxFontBold.Checked ? FontStyle.Bold : FontStyle.Regular); + if (_currentStyle.Italic.HasValue && _currentStyle.Italic.Value) + { + font = new Font(fontName, (float)fontSize * 1.1f, font.Style | FontStyle.Italic); + } + + if (_currentStyle.Underline.HasValue && _currentStyle.Underline.Value) + { + font = new Font(fontName, (float)fontSize * 1.1f, font.Style | FontStyle.Underline); + } + + if (_currentStyle.StrikeThrough.HasValue && _currentStyle.StrikeThrough.Value) + { + font = new Font(fontName, (float)fontSize * 1.1f, font.Style | FontStyle.Strikeout); + } + } + catch + { + font = new Font(Font, FontStyle.Regular); + } + + var measureBmp = TextDesigner.MakeTextBitmapAssa( + Configuration.Settings.General.PreviewAssaText, + 0, + 0, + font, + pictureBoxPreview.Width, + pictureBoxPreview.Height, + 5, //outlineWidth, + shadowWidth, + null, + _currentStyle.Color ?? defaultStyle.Primary, + outlineColor, + _currentStyle.ShadowColor ?? defaultStyle.Outline, + !(_currentStyle.BackgroundColor.HasValue && _currentStyle.BackgroundColor.Value.A == 0)); + var nBmp = new NikseBitmap(measureBmp); + var measuredWidth = nBmp.GetNonTransparentWidth(); + var measuredHeight = nBmp.GetNonTransparentHeight(); + + var left = (pictureBoxPreview.Width - measuredWidth) / 2.0f; + + float top = pictureBoxPreview.Height - measuredHeight - 15; + + var designedText = TextDesigner.MakeTextBitmapAssa( + Configuration.Settings.General.PreviewAssaText, + (int)Math.Round(left), + (int)Math.Round(top), + font, + pictureBoxPreview.Width, + pictureBoxPreview.Height, + 5, //outlineWidth, + shadowWidth, + _backgroundImage, + _currentStyle.Color ?? defaultStyle.Primary, + outlineColor, + _currentStyle.ShadowColor ?? defaultStyle.Outline, + !(_currentStyle.BackgroundColor.HasValue && _currentStyle.BackgroundColor.Value.A == 0)); + + pictureBoxPreview.Image?.Dispose(); + pictureBoxPreview.Image = designedText; + font.Dispose(); + privateFontCollection.Dispose(); + } + + private bool GeneratePreviewViaMpv() + { + var fileName = VideoPreviewGenerator.GetVideoPreviewFileName(); + if (string.IsNullOrEmpty(fileName) || !LibMpvDynamic.IsInstalled) + { + return false; + } + + if (_mpv == null) + { + _mpv = new LibMpvDynamic(); + _mpv.Initialize(pictureBoxPreview, fileName, VideoStartLoaded, null); + } + else + { + VideoStartLoaded(null, null); + } + + return true; + } + + private void VideoStartLoaded(object sender, EventArgs e) + { + if (_currentStyle == null) + { + return; + } + + var subtitle = new Subtitle(); + var p = new Paragraph(Configuration.Settings.General.PreviewAssaText, 0, 10000); + subtitle.Paragraphs.Add(p); + subtitle.Header = WebVttHelper.AddStyleToHeader(null, _currentStyle); + var assa = WebVttToAssa.Convert(subtitle, new SsaStyle(), _mpv.VideoWidth, _mpv.VideoHeight); + assa.Paragraphs[0].Extra = _currentStyle.Name; + var format = new AdvancedSubStationAlpha(); + var text = assa.ToText(format); + _mpvTextFileName = FileUtil.GetTempFileName(format.Extension); + File.WriteAllText(_mpvTextFileName, text); + _mpv.LoadSubtitle(_mpvTextFileName); + _mpv.Pause(); + _mpv.CurrentPosition = 0.5; + } + + private void WebVttStyleManager_FormClosing(object sender, FormClosingEventArgs e) + { + _mpv?.Dispose(); + } + } +} diff --git a/src/ui/Forms/VTT/WebVttStyleManager.resx b/src/ui/Forms/VTT/WebVttStyleManager.resx new file mode 100644 index 000000000..a688d66d1 --- /dev/null +++ b/src/ui/Forms/VTT/WebVttStyleManager.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/src/ui/Forms/VTT/WebVttStylePicker.Designer.cs b/src/ui/Forms/VTT/WebVttStylePicker.Designer.cs new file mode 100644 index 000000000..09eabec4a --- /dev/null +++ b/src/ui/Forms/VTT/WebVttStylePicker.Designer.cs @@ -0,0 +1,185 @@ +namespace Nikse.SubtitleEdit.Forms.VTT +{ + sealed partial class WebVttStylePicker + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.listViewExportStyles = new System.Windows.Forms.ListView(); + this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); + this.toolStripMenuItemSelectAll = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItemInverseSelection = new System.Windows.Forms.ToolStripMenuItem(); + this.buttonOK = new System.Windows.Forms.Button(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.saveFileDialogStyle = new System.Windows.Forms.SaveFileDialog(); + this.labelStyles = new System.Windows.Forms.Label(); + this.groupBoxStyle = new System.Windows.Forms.GroupBox(); + this.labelStyle = new System.Windows.Forms.Label(); + this.contextMenuStrip1.SuspendLayout(); + this.groupBoxStyle.SuspendLayout(); + this.SuspendLayout(); + // + // listViewExportStyles + // + this.listViewExportStyles.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.listViewExportStyles.CheckBoxes = true; + this.listViewExportStyles.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeader1}); + this.listViewExportStyles.ContextMenuStrip = this.contextMenuStrip1; + this.listViewExportStyles.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; + this.listViewExportStyles.HideSelection = false; + this.listViewExportStyles.Location = new System.Drawing.Point(15, 36); + this.listViewExportStyles.Name = "listViewExportStyles"; + this.listViewExportStyles.Size = new System.Drawing.Size(180, 187); + this.listViewExportStyles.TabIndex = 0; + this.listViewExportStyles.UseCompatibleStateImageBehavior = false; + this.listViewExportStyles.View = System.Windows.Forms.View.Details; + this.listViewExportStyles.SelectedIndexChanged += new System.EventHandler(this.listViewExportStyles_SelectedIndexChanged); + // + // contextMenuStrip1 + // + this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripMenuItemSelectAll, + this.toolStripMenuItemInverseSelection}); + this.contextMenuStrip1.Name = "contextMenuStrip1"; + this.contextMenuStrip1.Size = new System.Drawing.Size(162, 48); + // + // toolStripMenuItemSelectAll + // + this.toolStripMenuItemSelectAll.Name = "toolStripMenuItemSelectAll"; + this.toolStripMenuItemSelectAll.Size = new System.Drawing.Size(161, 22); + this.toolStripMenuItemSelectAll.Text = "Select all"; + this.toolStripMenuItemSelectAll.Click += new System.EventHandler(this.toolStripMenuItemSelectAll_Click); + // + // toolStripMenuItemInverseSelection + // + this.toolStripMenuItemInverseSelection.Name = "toolStripMenuItemInverseSelection"; + this.toolStripMenuItemInverseSelection.Size = new System.Drawing.Size(161, 22); + this.toolStripMenuItemInverseSelection.Text = "Inverse selection"; + this.toolStripMenuItemInverseSelection.Click += new System.EventHandler(this.toolStripMenuItemInverseSelection_Click); + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonOK.Location = new System.Drawing.Point(361, 231); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(75, 23); + this.buttonOK.TabIndex = 4; + this.buttonOK.Text = "&OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonCancel.Location = new System.Drawing.Point(445, 231); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 5; + this.buttonCancel.Text = "C&ancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + // + // saveFileDialogStyle + // + this.saveFileDialogStyle.OverwritePrompt = false; + // + // labelStyles + // + this.labelStyles.AutoSize = true; + this.labelStyles.Location = new System.Drawing.Point(12, 20); + this.labelStyles.Name = "labelStyles"; + this.labelStyles.Size = new System.Drawing.Size(35, 13); + this.labelStyles.TabIndex = 6; + this.labelStyles.Text = "Styles"; + // + // groupBoxStyle + // + this.groupBoxStyle.Controls.Add(this.labelStyle); + this.groupBoxStyle.Location = new System.Drawing.Point(201, 38); + this.groupBoxStyle.Name = "groupBoxStyle"; + this.groupBoxStyle.Size = new System.Drawing.Size(319, 187); + this.groupBoxStyle.TabIndex = 7; + this.groupBoxStyle.TabStop = false; + this.groupBoxStyle.Text = "Style"; + // + // labelStyle + // + this.labelStyle.AutoSize = true; + this.labelStyle.Location = new System.Drawing.Point(7, 20); + this.labelStyle.Name = "labelStyle"; + this.labelStyle.Size = new System.Drawing.Size(52, 13); + this.labelStyle.TabIndex = 0; + this.labelStyle.Text = "labelStyle"; + // + // WebVttStylePicker + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(532, 264); + this.Controls.Add(this.groupBoxStyle); + this.Controls.Add(this.labelStyles); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.listViewExportStyles); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.KeyPreview = true; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "WebVttStylePicker"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "SubStationAlphaStylesExport"; + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.WebVttImportExport_KeyDown); + this.contextMenuStrip1.ResumeLayout(false); + this.groupBoxStyle.ResumeLayout(false); + this.groupBoxStyle.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ListView listViewExportStyles; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.SaveFileDialog saveFileDialogStyle; + private System.Windows.Forms.ColumnHeader columnHeader1; + private System.Windows.Forms.Label labelStyles; + private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSelectAll; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemInverseSelection; + private System.Windows.Forms.GroupBox groupBoxStyle; + private System.Windows.Forms.Label labelStyle; + } +} \ No newline at end of file diff --git a/src/ui/Forms/VTT/WebVttStylePicker.cs b/src/ui/Forms/VTT/WebVttStylePicker.cs new file mode 100644 index 000000000..fe539aa11 --- /dev/null +++ b/src/ui/Forms/VTT/WebVttStylePicker.cs @@ -0,0 +1,89 @@ +using Nikse.SubtitleEdit.Core.Common; +using Nikse.SubtitleEdit.Logic; +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace Nikse.SubtitleEdit.Forms.VTT +{ + public sealed partial class WebVttStylePicker : Form + { + public List ImportExportStyles { get; set; } + + public WebVttStylePicker(List styles, Paragraph paragraph) + { + InitializeComponent(); + UiUtil.FixFonts(this); + + ImportExportStyles = new List(); + listViewExportStyles.Columns[0].Width = listViewExportStyles.Width - 20; + + var paragraphStyles = WebVttHelper.GetParagraphStyles(paragraph); + foreach (var style in styles) + { + listViewExportStyles.Items.Add(new ListViewItem(style.Name) { Checked = paragraphStyles.Contains(style.Name), Tag = style }); + } + + Text = LanguageSettings.Current.SubStationAlphaStyles.Export; + labelStyles.Text = LanguageSettings.Current.SubStationAlphaStyles.Styles; + toolStripMenuItemInverseSelection.Text = LanguageSettings.Current.Main.Menu.Edit.InverseSelection; + toolStripMenuItemSelectAll.Text = LanguageSettings.Current.Main.Menu.ContextMenu.SelectAll; + buttonOK.Text = LanguageSettings.Current.General.Ok; + buttonCancel.Text = LanguageSettings.Current.General.Cancel; + + labelStyle.Text = string.Empty; + } + + private void buttonOK_Click(object sender, EventArgs e) + { + foreach (ListViewItem item in listViewExportStyles.Items) + { + if (item.Checked) + { + ImportExportStyles.Add((WebVttStyle)item.Tag); + } + } + + DialogResult = ImportExportStyles.Count == 0 ? DialogResult.Cancel : DialogResult.OK; + } + + private void WebVttImportExport_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Escape) + { + DialogResult = DialogResult.Cancel; + } + } + + private void toolStripMenuItemSelectAll_Click(object sender, EventArgs e) + { + foreach (ListViewItem item in listViewExportStyles.Items) + { + item.Checked = true; + } + } + + private void toolStripMenuItemInverseSelection_Click(object sender, EventArgs e) + { + foreach (ListViewItem item in listViewExportStyles.Items) + { + item.Checked = !item.Checked; + } + } + + private void listViewExportStyles_SelectedIndexChanged(object sender, EventArgs e) + { + var x = listViewExportStyles.SelectedIndices; + if (x.Count != 1) + { + labelStyle.Text = string.Empty; + return; + } + + var idx = x[0]; + var style = (WebVttStyle)listViewExportStyles.Items[idx].Tag; + + labelStyle.Text = style.ToString().Replace("; ", ";" + Environment.NewLine); + } + } +} diff --git a/src/ui/Forms/VTT/WebVttStylePicker.resx b/src/ui/Forms/VTT/WebVttStylePicker.resx new file mode 100644 index 000000000..0a39974e8 --- /dev/null +++ b/src/ui/Forms/VTT/WebVttStylePicker.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 172, 17 + + + 17, 17 + + \ No newline at end of file diff --git a/src/ui/Icons/BeautifyTimeCodes.png b/src/ui/Icons/BeautifyTimeCodes.png new file mode 100644 index 000000000..8790b37c8 Binary files /dev/null and b/src/ui/Icons/BeautifyTimeCodes.png differ diff --git a/src/ui/Languages/bg-BG.xml b/src/ui/Languages/bg-BG.xml index c22f23d4d..deb8d1ac9 100644 --- a/src/ui/Languages/bg-BG.xml +++ b/src/ui/Languages/bg-BG.xml @@ -3,7 +3,7 @@ Subtitle Edit 3.6.13 - Последен превод на български 15.05.2023: KalinM + Последен превод на български 19.06.2023: KalinM bg-BG OK @@ -1375,6 +1375,7 @@ https://github.com/SubtitleEdit/subtitleedit Побери по дължина Задай стил Задай актьор + Задай слой Инструменти на ASSA Sub Station Alpha (SSA) - стил... Настройка на стил Sub Station Alpha (SSA)... @@ -1470,6 +1471,7 @@ https://github.com/SubtitleEdit/subtitleedit Напред> Авт. прекъсни ОбединиВ1ред + Задай слой Превод diff --git a/src/ui/Languages/it-IT.xml b/src/ui/Languages/it-IT.xml index cd0f5f135..6c742879a 100644 --- a/src/ui/Languages/it-IT.xml +++ b/src/ui/Languages/it-IT.xml @@ -3,7 +3,7 @@ Subtitle Edit 3.6.13 - Tradotto da NAMP e bovirus - Data traduzione: 26.04.2023 + Tradotto da NAMP e bovirus - Data traduzione: 09.07.2023 it-IT OK @@ -37,6 +37,7 @@ Attore Divario Regione + Layer N. Numero Testo @@ -1378,6 +1379,7 @@ Per usare una chiave API vai su "Opzioni -> Impostazioni -> Strumenti" per Ridimensiona tutte le colonne per adattarle Imposta stile Imposta attore + Imposta layer Strumenti ASSA Stili Alpha della stazione secondaria... Stili Alpha Sub Station avanzati... @@ -1386,7 +1388,10 @@ Per usare una chiave API vai su "Opzioni -> Impostazioni -> Strumenti" per Stili di testo a tempo... Testo a tempo - imposta la lingua Sami - imposta classe - Nuendo - impostare il carattere + Nuendo - imposta carattere + WebVTT - imposta stile + WebVTT - imposta voce + WebVTT - anteprima browser Taglia Copia Incolla @@ -2273,6 +2278,7 @@ stesso file di sottotitolo (collaborazione) Visualizza pulsante schermo intero Nome font anteprima sottotitolo Anteprima dimensione font sottotitolo + Margine verticale Controlli video nella finestra principale Ricerca personalizzata testo e URL Apparenza forma onda @@ -2401,9 +2407,12 @@ stesso file di sottotitolo (collaborazione) Usa colorazione sintassi Colore HTML Colore ASSA + Tema + Automatico Tema scuro Usa tema scuro Visualizza le linee della griglia nella vista elenco + Pulsanti grafici Aggiorna Imposta la posizione del video Alterna blocca/sblocca controlli video @@ -2554,6 +2563,7 @@ stesso file di sottotitolo (collaborazione) Attiva/disattiva i controlli video Attiva/disattiva contrasto (solo mpv) Da audio a testo ({0}) + Estrai audio (righe selezionate) Da audio a testo righe selezionate ({0}) Attiva/disattiva luminosità (solo mpv) Traduci, ricerca personalizzata 1 @@ -3209,4 +3219,7 @@ Vuoi mantenere le modifiche? WebVTT - imposta nuova voce Nome voce + + Stili WebVTT + \ No newline at end of file diff --git a/src/ui/Languages/ko-KR.xml b/src/ui/Languages/ko-KR.xml index f53dc1dc8..5ac2e8d00 100644 --- a/src/ui/Languages/ko-KR.xml +++ b/src/ui/Languages/ko-KR.xml @@ -37,6 +37,7 @@ 배우 간격 지역 + 레이어 번호 번호 텍스트 @@ -1374,6 +1375,7 @@ FFmpeg를 다운로드하고 사용하시겠습니까? 모든 열의 크기 맞추기 스타일 설정 배우 설정 + 레이어 설정 ASSA 도구 SSA의 스타일... ASS의 스타일... @@ -1383,6 +1385,9 @@ FFmpeg를 다운로드하고 사용하시겠습니까? 시간 제한 텍스트 - 언어 설정 SAMI - 클래스 설정 Nuendo - 문자 설정 + WebVTT - 스타일 설정 + WebVTT - 음성 설정 + WebVTT - 브라우저 미리보기 잘라내기 복사 붙여넣기 @@ -2272,6 +2277,7 @@ FFmpeg를 다운로드하고 사용하시겠습니까? 전체 화면 버튼 표시 자막 미리보기 글꼴 이름 미리 보기의 글자 크기: + 세로 여백 메인 창의 비디오 컨트롤 사용자 지정 검색 서비스 / URL 파형 스타일 @@ -2400,6 +2406,8 @@ FFmpeg를 다운로드하고 사용하시겠습니까? 구문 색상 사용 Html 색상 ASSA 색상 + 테마 + 자동 어두운 테마 어두운 테마 사용 목록 보기 그리드 선 표시 @@ -2477,7 +2485,7 @@ FFmpeg를 다운로드하고 사용하시겠습니까? 대화의 대시('-') 전환 따옴표 전환 HI 태그 전환 - 사용자 지정 태그 + 사용자 지정 태그 전환 (서라운드 포함) 음악 기호 전환 정렬 (선택한 줄) 좌측 하단 정렬 - {\an1} @@ -2553,6 +2561,7 @@ FFmpeg를 다운로드하고 사용하시겠습니까? 비디오 컨트롤 전환 대비 전환 (mpv 만) 오디오를 텍스트로 ({0}) + 오디오 추출 (선택한 줄) 선택한 줄 오디오를 텍스트로 ({0}) 밝기 전환 (mpv 만) 번역, 사용자 지정 검색 1 @@ -3207,4 +3216,7 @@ FFmpeg를 다운로드하고 사용하시겠습니까? WebVTT - 새로운 음성 설정 음성 이름 + + WebVTT 스타일 + \ No newline at end of file diff --git a/src/ui/Languages/pt-PT.xml b/src/ui/Languages/pt-PT.xml index 44eff948e..64305cd50 100644 --- a/src/ui/Languages/pt-PT.xml +++ b/src/ui/Languages/pt-PT.xml @@ -38,6 +38,7 @@ E-mail: mailto:hugokarvalho@hotmail.com Actor Intervalo Região + Camada # Número Texto @@ -1379,6 +1380,7 @@ Para usar a chave API, vá a "Opções -> Definições -> Ferramentas" par Ajustar o tamanho das colunas para caber Definir estilo Definir actor + Definir camada Ferramentas ASSA Estilos Sub Station Alpha... Estilos Advanced Sub Station Alpha... @@ -1388,6 +1390,9 @@ Para usar a chave API, vá a "Opções -> Definições -> Ferramentas" par Timed Text - Definir o idioma Sami - Definir classe Nuendo - Definir carácter + WebVTT - definir estilo + WebVTT - definir voz + WebVTT - pré-visualização do navegador Cortar Copiar Colar @@ -2269,11 +2274,12 @@ editar o mesmo ficheiro de legenda (colaboração) VLC media player libvlc.dll do VLC media player 1.1.0 ou superior Directoria do VLC (apenas é necessário se estiver a usar a versão portátil do VLC) - Mostrar botão parar + Mostrar botão (Parar) Mostrar botão (Sem som) Mostrar botão (Ecrã inteiro) Pré-visualização do tipo de letra Tamanho na pré-visualização + Margem vertical Controlos de vídeo na janela principal Procura de texto e URL personalizada Aparência da forma de onda @@ -2402,6 +2408,8 @@ editar o mesmo ficheiro de legenda (colaboração) Usar coloração sintáctica Cor Html Cor ASSA + Tema + Automático Tema escuro Activar tema escuro Mostrar grelha na Lista @@ -2555,6 +2563,7 @@ editar o mesmo ficheiro de legenda (colaboração) Alternar controlos vídeo Alternar contraste (apenas mpv) Áudio para texto ({0}) + Extrair áudio (linhas seleccionadas) Áudio para texto em linhas seleccionadas ({0}) Alternar luminosidade (apenas mpv) Traduzir, pesquisa personalizada 1 @@ -3210,4 +3219,7 @@ Manter as alterações? WebVTT - definir nova voz Nome da voz + + Estilos WebVTT + \ No newline at end of file diff --git a/src/ui/Languages/ru-RU.xml b/src/ui/Languages/ru-RU.xml index f4b9718ce..b5a65b518 100644 --- a/src/ui/Languages/ru-RU.xml +++ b/src/ui/Languages/ru-RU.xml @@ -141,9 +141,9 @@ https://github.com/SubtitleEdit/subtitleedit Хотите скачать и использовать FFmpeg? Создание файла пиков… Создание спектрограммы… - Извлечение аудио: {0:0.0} с - Извлечение аудио: {0}.{1:00} мин - Извлечённая форма сигнала не была найдена! + Извлечение аудио: {0:0.0} сек. + Извлечение аудио: {0}.{1:00} мин. + Не удалось найти извлечённый wave-файл! Для этого требуется VLC media player 1.1.x или новее ({0}-bit). Командная строка: {1} {2} @@ -589,7 +589,7 @@ https://github.com/SubtitleEdit/subtitleedit Макс. количество строк: Номер диска: Общее число дисков: - Открыть… + Импорт… Текст и сведения о синхронизации Размещение кода: Вертикальное построение @@ -796,7 +796,7 @@ https://github.com/SubtitleEdit/subtitleedit Нормализовать строки Исправить Turkish ANSI (Icelandic) символы в Unicode Исправить датскую буквы «i» - Исправить Испанские перевёрнутые знаки вопроса и восклицания + Исправить испанские перевёрнутые знаки вопроса и восклицания Добавить недостающую кавычку (") Добавить недостающие кавычки (") Удалять диалоговые тире в одной строке @@ -809,9 +809,9 @@ https://github.com/SubtitleEdit/subtitleedit Исправлять нечего :) Найдено неточностей: {0} Сделано исправлений: {0} - Ничто не может быть исправлено автоматически. Субтитры содержат ошибки - подробности см. в журнале - {0} проблем устранено, но субтитры всё ещё содержат ошибки - подробности см. в журнале - {0} проблем может быть исправлено, но субтитры всё равно будут содержать ошибки - подробности см. в журнале + Ничто не может быть исправлено автоматически. Субтитры содержат ошибки - подробности см. в отчёте + {0} проблем устранено, но субтитры всё ещё содержат ошибки - подробности см. в отчёте + {0} проблем можно исправить, но субтитры всё равно будут содержать ошибки - подробности см. в отчёте Исправить первую букву на заглавную после абзаца Объединить короткие строки (одно предложение) Объединить короткие строки (все, за исключением диалогов) @@ -839,13 +839,13 @@ https://github.com/SubtitleEdit/subtitleedit Обновить доступные исправления Применить выбранные исправления Автоперенос - Удалить перенос - Исправить символы тире «--» на многоточие «…» + Удал. перенос + Исправить символы тире «--» на многоточие «...» Удалить символы «>>» в начале строки - Удалить многоточие «…» в начале строки + Удалить многоточие «...» в начале строки Добавить недостающие «[» в строке Заменить музыкальные символы (напр. âTª) выбранным - 'Хм-- да!' -> 'Хм… да!' + 'Хм-- да!' -> 'Хм... да!' '>> Иван: Спасибо!' -> 'Иван: Спасибо!' '… а потом мы' -> 'а потом мы' 'лязг] Смотри!' -> '[лязг] Смотри!' @@ -1186,8 +1186,8 @@ https://github.com/SubtitleEdit/subtitleedit Файл Новый - Открыть - Открыть (оставить видео) + Открыть… + Открыть (оставить видео)… Открыть заново Сохранить Сохранить как… @@ -1383,8 +1383,9 @@ https://github.com/SubtitleEdit/subtitleedit Подогнать по ширине - Установить стиль - Указать актёра + Задать стиль + Задать актёра + Задать слой Инструменты ASSA Стили SubStation Alpha… Стили Advanced SubStation Alpha… @@ -1464,8 +1465,8 @@ https://github.com/SubtitleEdit/subtitleedit Задать новый голос… Удалить голоса Новый актёр… - Удалить актёров - Изменить закладку + Удалить актёра + Изменить закладку… Удалить закладку Перейти к просмотру исходного кода Перейти к просмотру списка @@ -1480,6 +1481,7 @@ https://github.com/SubtitleEdit/subtitleedit Далее > Автоперенос Удалить перенос + Установить слой Перевод @@ -2004,12 +2006,12 @@ https://github.com/SubtitleEdit/subtitleedit Вкл. Тип поиска Удалить все - Открыть правило(-а)… - Сохранить правило(-а)… - Открытие правил замен из… - Сохранение правил замен в… - Выберите какие группы Открыть - Выберите группы для Сохранения + Импорт… + Экспорт… + Импортировать правила замены из… + Экспорт правил замены в… + Выберите группы для импорта + Выберите группы для экспорта Правила поиска и замен Поднять на самый верх Опустить в самый низ @@ -2183,7 +2185,7 @@ https://github.com/SubtitleEdit/subtitleedit Переключить закладки - добавить комментарий Очистить закладки Экспортировать закладки… - Перейти в закладки + Перейти в закладки… Перейти к предыдущей закладке Перейти к следующей закладке Выбрать профиль @@ -2324,7 +2326,7 @@ https://github.com/SubtitleEdit/subtitleedit Контур Тень Сплошной контур - Тестирование 123 + Тестирование 123… Язык: Список имён (с учётом регистра) Добавить имя @@ -2412,6 +2414,8 @@ https://github.com/SubtitleEdit/subtitleedit Использовать подсветку синтаксиса HTML-цвет ASSA-цвет + Тема + Авто Тёмная тема Использовать тёмную тему Показать линии сетки отображения списка @@ -2567,7 +2571,8 @@ https://github.com/SubtitleEdit/subtitleedit Переключить элементы управления видео Переключить контрастность (только mpv) Аудио в текст ({0}) - Аудио в выбранные текстовые строки ({0}) + Извлечь аудио (выделенные строки) + Аудио в текст выделенных строк ({0}) Переключить яркость (только mpv) Перевод, пользовательский поиск 1 Перевод, пользовательский поиск 2 @@ -2900,7 +2905,7 @@ https://github.com/SubtitleEdit/subtitleedit Шрифт Название шрифта Размер шрифта - Используемый + Использован Первичный Вторичный Третичный @@ -2935,7 +2940,7 @@ https://github.com/SubtitleEdit/subtitleedit Удалить Заменить… Удалить все - Добавить стиль из файла + Импорт стиля из файла… Экспорт стиля… (стиль будет добавлен, если файл существует) Выбрать стиль для импорта Такой стиль существует: {0} diff --git a/src/ui/Languages/zh-Hans.xml b/src/ui/Languages/zh-Hans.xml index 3f2fcb9a4..1757638f2 100644 --- a/src/ui/Languages/zh-Hans.xml +++ b/src/ui/Languages/zh-Hans.xml @@ -37,6 +37,7 @@ 演员 间隔 区域 + 编号 编号 文本 @@ -1373,6 +1374,7 @@ Command line: {1} {2} 自适应所有的列宽度 设置样式 设置演员 + 设置层 ASSA工具 Sub Station Alpha 样式... 高级 Sub Station Alpha 样式... @@ -1382,6 +1384,9 @@ Command line: {1} {2} 带时间文本 - 选择语言 Sami - 设置等级 Nuendo - 设置字符 + WebVTT - 设置样式 + WebVTT - 设置语音 + WebVTT - 浏览器预览 剪切 复制 粘贴 @@ -2261,6 +2266,7 @@ Command line: {1} {2} 显示全屏幕按钮 预览字幕字体名 字幕预览字体大小 + 垂直边距 主窗口视频控制 自定义搜索文本和网址 波形外观 @@ -2389,6 +2395,8 @@ Command line: {1} {2} 启用语法高亮 Html配色 ASSA配色 + 主题 + 自动 暗色主题 使用暗色主题 显示列表视图网格线 @@ -2542,6 +2550,7 @@ Command line: {1} {2} 切换视频控件 切换对比度(仅适用于MPV) 语音转文本 ({0}) + 提取音频(仅所选行) 对选定行语音转文本 ({0}) 切换亮度(仅限mpv) 翻译、自定义搜索 1 @@ -3194,4 +3203,7 @@ Command line: {1} {2} WebVTT - 设定新人声 人声名称 + + WebVTT 样式 + diff --git a/src/ui/Logic/CommandLineConvert/CommandLineConverter.cs b/src/ui/Logic/CommandLineConvert/CommandLineConverter.cs index 3bb6b93d9..f7c187607 100644 --- a/src/ui/Logic/CommandLineConvert/CommandLineConverter.cs +++ b/src/ui/Logic/CommandLineConvert/CommandLineConverter.cs @@ -428,7 +428,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert var forcedOnly = GetArgument(unconsumedArguments, "forcedonly").Length > 0; var teletextOnlyPage = GetArgument(unconsumedArguments, "teletextonlypage:"); var teletextOnly = GetArgument(unconsumedArguments, "teletextonly").Length > 0; - + var profileName = GetArgument(unconsumedArguments, "profile:"); if (!string.IsNullOrEmpty(profileName)) { @@ -899,7 +899,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert gs.SubtitleLineMaximumLength = profile.SubtitleLineMaximumLength; gs.MaxNumberOfLines = profile.MaxNumberOfLines; gs.MergeLinesShorterThan = profile.MergeLinesShorterThan; - gs.SubtitleMaximumCharactersPerSeconds =(double) profile.SubtitleMaximumCharactersPerSeconds; + gs.SubtitleMaximumCharactersPerSeconds = (double)profile.SubtitleMaximumCharactersPerSeconds; gs.SubtitleOptimalCharactersPerSeconds = (double)profile.SubtitleOptimalCharactersPerSeconds; gs.SubtitleMaximumDisplayMilliseconds = profile.SubtitleMaximumDisplayMilliseconds; gs.SubtitleMinimumDisplayMilliseconds = profile.SubtitleMinimumDisplayMilliseconds; @@ -1402,7 +1402,13 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert // Remove native formatting if (format != null && format.Name != sf.Name) { - format.RemoveNativeFormatting(sub, sf); + if (format.GetType() == typeof(SubStationAlpha) && sf.GetType() == typeof(AdvancedSubStationAlpha)) + { + } + else + { + format.RemoveNativeFormatting(sub, sf); + } } try diff --git a/src/ui/Logic/DarkTheme.cs b/src/ui/Logic/DarkTheme.cs index 6ed679dcc..613b50f7e 100644 --- a/src/ui/Logic/DarkTheme.cs +++ b/src/ui/Logic/DarkTheme.cs @@ -508,7 +508,7 @@ namespace Nikse.SubtitleEdit.Logic private static void ListView_DrawItem(object sender, DrawListViewItemEventArgs e) { - if (sender is ListView lv && !lv.Focused && (e.State & ListViewItemStates.Selected) != 0) + if (sender is ListView && (e.State & ListViewItemStates.Selected) != 0) { if (e.Item.Focused) { @@ -530,13 +530,7 @@ namespace Nikse.SubtitleEdit.Logic var backgroundColor = lv.Items[e.ItemIndex].SubItems[e.ColumnIndex].BackColor; var subBackgroundColor = Color.FromArgb(backgroundColor.A, Math.Max(backgroundColor.R - 39, 0), Math.Max(backgroundColor.G - 39, 0), Math.Max(backgroundColor.B - 39, 0)); - if (lv.Focused && backgroundColor == BackColor || lv.RightToLeftLayout) - { - e.DrawDefault = true; - return; - } - - if (e.Item.Selected) + if (e.Item.Selected || e.Item.Focused) { var subtitleFont = e.Item.Font; var rect = e.Bounds; @@ -562,14 +556,15 @@ namespace Nikse.SubtitleEdit.Logic CheckBoxRenderer.DrawCheckBox(e.Graphics, new Point(e.Bounds.X + 4, e.Bounds.Y + 2), checkBoxState); } + var foreColor = e.Item.ForeColor; if (lv.Columns[e.ColumnIndex].TextAlign == HorizontalAlignment.Right) { var stringWidth = (int)e.Graphics.MeasureString(e.Item.SubItems[e.ColumnIndex].Text, subtitleFont).Width; - TextRenderer.DrawText(e.Graphics, e.Item.SubItems[e.ColumnIndex].Text, subtitleFont, new Point(e.Bounds.Right - stringWidth - 7, e.Bounds.Top + 2), e.Item.ForeColor, TextFormatFlags.NoPrefix); + TextRenderer.DrawText(e.Graphics, e.Item.SubItems[e.ColumnIndex].Text, subtitleFont, new Point(e.Bounds.Right - stringWidth - 7, e.Bounds.Top + 2), foreColor, TextFormatFlags.NoPrefix); } else { - TextRenderer.DrawText(e.Graphics, e.Item.SubItems[e.ColumnIndex].Text, subtitleFont, new Point(e.Bounds.Left + 3 + addX, e.Bounds.Top + 2), e.Item.ForeColor, TextFormatFlags.NoPrefix); + TextRenderer.DrawText(e.Graphics, e.Item.SubItems[e.ColumnIndex].Text, subtitleFont, new Point(e.Bounds.Left + 3 + addX, e.Bounds.Top + 2), foreColor, TextFormatFlags.NoPrefix); } } else @@ -593,7 +588,7 @@ namespace Nikse.SubtitleEdit.Logic e.Graphics.FillRectangle(slightlyDarkerBrush, e.Bounds); } - int posY = Math.Abs(e.Bounds.Height - e.Font.Height) / 2; + var posY = Math.Abs(e.Bounds.Height - e.Font.Height) / 2; TextRenderer.DrawText(e.Graphics, e.Header.Text, e.Font, new Point(e.Bounds.X + 3, posY), ForeColor); if (Configuration.Settings.General.DarkThemeShowListViewGridLines && e.ColumnIndex != 0) @@ -622,8 +617,7 @@ namespace Nikse.SubtitleEdit.Logic } } - private static void ListView_HandleCreated(object sender, EventArgs e) => - SetWindowThemeDark((Control)sender); + private static void ListView_HandleCreated(object sender, EventArgs e) => SetWindowThemeDark((Control)sender); private class MyRenderer : ToolStripProfessionalRenderer { @@ -843,7 +837,7 @@ namespace Nikse.SubtitleEdit.Logic private Rectangle GetTabImageRect(int index) { var innerRect = _tabRects[index]; - int imgHeight = _imageSize.Height; + var imgHeight = _imageSize.Height; var imgRect = new Rectangle( new Point(innerRect.X + ImagePadding, innerRect.Y + ((innerRect.Height - imgHeight) / 2)), diff --git a/src/ui/Logic/FindReplaceDialogHelper.cs b/src/ui/Logic/FindReplaceDialogHelper.cs index cc4f85855..bf886bd3b 100644 --- a/src/ui/Logic/FindReplaceDialogHelper.cs +++ b/src/ui/Logic/FindReplaceDialogHelper.cs @@ -95,7 +95,11 @@ namespace Nikse.SubtitleEdit.Logic Match match; try { - _regEx = new Regex(FindText, RegexOptions.None, TimeSpan.FromSeconds(5)); + if (_regEx == null) + { + _regEx = new Regex(FindText, RegexOptions.None, TimeSpan.FromSeconds(5)); + } + match = _regEx.Match(text, startIndex); } catch (RegexMatchTimeoutException exception) @@ -496,5 +500,9 @@ namespace Nikse.SubtitleEdit.Logic private StringComparison GetComparison() => FindReplaceType.FindType == FindType.Normal ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal; + public void SetRegex(Regex regex) + { + _regEx = regex; + } } } diff --git a/src/ui/Logic/IFindAndReplace.cs b/src/ui/Logic/IFindAndReplace.cs index f486c8b75..afa8b4471 100644 --- a/src/ui/Logic/IFindAndReplace.cs +++ b/src/ui/Logic/IFindAndReplace.cs @@ -1,10 +1,11 @@ -using Nikse.SubtitleEdit.Core.Enums; +using System.Text.RegularExpressions; +using Nikse.SubtitleEdit.Core.Enums; namespace Nikse.SubtitleEdit.Logic { public interface IFindAndReplace { - void FindDialogFind(string findText, ReplaceType findReplaceType); + void FindDialogFind(string findText, ReplaceType findReplaceType, Regex regex); void FindDialogFindPrevious(string findText); void FindDialogClose(); diff --git a/src/ui/Logic/Language.cs b/src/ui/Logic/Language.cs index 362ffe437..25d1609ed 100644 --- a/src/ui/Logic/Language.cs +++ b/src/ui/Logic/Language.cs @@ -127,6 +127,8 @@ namespace Nikse.SubtitleEdit.Logic public LanguageStructure.Waveform Waveform; public LanguageStructure.WaveformGenerateTimeCodes WaveformGenerateTimeCodes; public LanguageStructure.WebVttNewVoice WebVttNewVoice; + public LanguageStructure.WebVttStyleManager WebVttStyleManager; + public LanguageStructure.WhisperAdvanced WhisperAdvanced; public Language() { @@ -170,6 +172,7 @@ namespace Nikse.SubtitleEdit.Logic Actor = "Actor", Gap = "Gap", Region = "Region", + Layer = "Layer", NumberSymbol = "#", Number = "Number", Text = "Text", @@ -715,7 +718,7 @@ namespace Nikse.SubtitleEdit.Logic Custom = "Custom", ToDropFrame = "To drop frame", FromDropFrame = "From drop frame", - AllowOverlap = "Allow overlap" + AllowOverlap = "Allow overlap", }; CheckForUpdates = new LanguageStructure.CheckForUpdates @@ -917,7 +920,7 @@ namespace Nikse.SubtitleEdit.Logic TextLeftJustifiedText = "Left justified text", TextCenteredText = "Centered text", TextRightJustifiedText = "Right justified text", - UseBoxForOneNewLine = "Check 'Use box around text' for only one new-line" + UseBoxForOneNewLine = "Check 'Use box around text' for only one new-line", }; EffectKaraoke = new LanguageStructure.EffectKaraoke @@ -925,14 +928,14 @@ namespace Nikse.SubtitleEdit.Logic Title = "Karaoke effect", ChooseColor = "Choose color:", TotalSeconds = "Total seconds:", - EndDelayInSeconds = "End delay in seconds:" + EndDelayInSeconds = "End delay in seconds:", }; EffectTypewriter = new LanguageStructure.EffectTypewriter { Title = "Typewriter effect", TotalSeconds = "Total seconds:", - EndDelayInSeconds = "End delay in seconds:" + EndDelayInSeconds = "End delay in seconds:", }; ExportCustomText = new LanguageStructure.ExportCustomText @@ -1072,7 +1075,7 @@ namespace Nikse.SubtitleEdit.Logic WholeWord = "&Whole word", Count = "Coun&t", XNumberOfMatches = "{0:#,##0} matches", - OneMatch = "One match" + OneMatch = "One match", }; FindSubtitleLine = new LanguageStructure.FindSubtitleLine @@ -1322,7 +1325,7 @@ namespace Nikse.SubtitleEdit.Logic InputDescription = "Choose input files (browse or drag-n-drop)", ImageFiles = "Image files", Remove = "Remove", - RemoveAll = "Remove all" + RemoveAll = "Remove all", }; ImportShotChanges = new LanguageStructure.ImportShotChanges @@ -1339,7 +1342,7 @@ namespace Nikse.SubtitleEdit.Logic GetShotChangesWithFfmpeg = "Generate shot changes with FFmpeg", Sensitivity = "Sensitivity", SensitivityDescription = "Lower value gives more shot changes", - NoShotChangesFound = "No shot changes found." + NoShotChangesFound = "No shot changes found.", }; ImportText = new LanguageStructure.ImportText @@ -1368,7 +1371,7 @@ namespace Nikse.SubtitleEdit.Logic TextFiles = "Text files", PreviewLinesModifiedX = "Preview - subtitles modified: {0}", TimeCodes = "Time codes", - SplitAtEndChars = "Split at end chars" + SplitAtEndChars = "Split at end chars", }; Interjections = new LanguageStructure.Interjections @@ -1388,7 +1391,7 @@ namespace Nikse.SubtitleEdit.Logic TotalNumberOfLinesX = "Total number of lines: {0:#,###,###}", AlreadyCorrectTimeCodes = "Files already have correct time codes", AppendTimeCodes = "Add end time of previous file", - AddMs = "Add milliseconds after each file" + AddMs = "Add milliseconds after each file", }; LanguageNames = new LanguageStructure.LanguageNames @@ -1534,7 +1537,7 @@ namespace Nikse.SubtitleEdit.Logic yoName = "Yoruba", zaName = "Zhuang", zhName = "Chinese", - zuName = "Zulu" + zuName = "Zulu", }; Main = new LanguageStructure.Main @@ -2020,7 +2023,7 @@ namespace Nikse.SubtitleEdit.Logic CheckForUpdates = "Check for updates...", Title = "Help", Help = "&Help", - About = "&About" + About = "&About", }, Networking = new LanguageStructure.Main.MainMenu.NetworkingMenu @@ -2059,6 +2062,7 @@ namespace Nikse.SubtitleEdit.Logic SizeAllColumnsToFit = "Size all columns to fit", SetStyle = "Set style", SetActor = "Set actor", + SetLayer = "Set layer", AssaTools = "ASSA tools", AdvancedSubStationAlphaStyles = "Advanced Sub Station Alpha styles...", SubStationAlphaStyles = "Sub Station Alpha styles...", @@ -2068,6 +2072,9 @@ namespace Nikse.SubtitleEdit.Logic TimedTextSetLanguage = "Timed Text - set language", SamiSetStyle = "Sami - set class", NuendoSetStyle = "Nuendo - set character", + WebVttSetVoice = "WebVTT - set voice", + WebVttSetStyle = "WebVTT - set style", + WebVttBrowserPreview = "WebVTT - browser preview", Cut = "Cut", Copy = "Copy", Paste = "Paste", @@ -2155,7 +2162,7 @@ namespace Nikse.SubtitleEdit.Logic Previous = "< Prev", Next = "Next >", AutoBreak = "Auto &br", - Unbreak = "Unbreak" + Unbreak = "Unbreak", }, VideoControls = new LanguageStructure.Main.MainVideoControls @@ -2210,7 +2217,7 @@ namespace Nikse.SubtitleEdit.Logic NewTextInsertAtX = "New text inserted at {0}", Center = "Center", - PlayRate = "Play rate (speed)" + PlayRate = "Play rate (speed)", }, }; @@ -2344,7 +2351,7 @@ namespace Nikse.SubtitleEdit.Logic MillimetersOfMercury = "Millimeters of Mercury", PoundPerSquareInch = "Pound-force per square inch", KilogramPerSquareCentimeter = "Kilogram-force per square centimeter", - KiloPascals = "Kilopascals" + KiloPascals = "Kilopascals", }; MergeDoubleLines = new LanguageStructure.MergeDoubleLines @@ -2398,7 +2405,7 @@ namespace Nikse.SubtitleEdit.Logic ExactlyTwoLines = "Exactly two lines", MoreThanTwoLines = "More than two lines", Bookmarked = "Bookmarked", - BlankLines = "Blank lines" + BlankLines = "Blank lines", }; MultipleReplace = new LanguageStructure.MultipleReplace @@ -2433,7 +2440,7 @@ namespace Nikse.SubtitleEdit.Logic RulesForGroupX = "Rules for group \"{0}\"", NewGroup = "New group...", NothingToImport = "Nothing to import", - RuleInfo = "Rule information" + RuleInfo = "Rule information", }; NetworkChat = new LanguageStructure.NetworkChat @@ -2453,7 +2460,7 @@ can edit in same subtitle file (collaboration)", NetworkLogAndInfo = new LanguageStructure.NetworkLogAndInfo { Title = "Network session info and log", - Log = "Log:" + Log = "Log:", }; NetworkStart = new LanguageStructure.NetworkStart @@ -2727,6 +2734,7 @@ can edit in same subtitle file (collaboration)", ShowFullscreenButton = "Show fullscreen button", PreviewFontName = "Subtitle preview font name", PreviewFontSize = "Subtitle preview font size", + PreviewVerticalMargin = "Vertical margin", MainWindowVideoControls = "Main window video controls", CustomSearchTextAndUrl = "Custom search text and URL", WaveformAppearance = "Waveform appearance", @@ -2858,6 +2866,7 @@ can edit in same subtitle file (collaboration)", DarkTheme = "Dark theme", DarkThemeEnabled = "Use dark theme", DarkThemeShowGridViewLines = "Show list view grid lines", + GraphicsButtons = "Graphics buttons", ListViewAndTextBox = "List view and text box", UpdateShortcut = "Update", FoucsSetVideoPosition = "Focus set video position", @@ -3008,6 +3017,7 @@ can edit in same subtitle file (collaboration)", VideoToggleContrast = "Toggle contrast (mpv only)", AudioToTextX = "Audio to text ({0})", AudioToTextSelectedLinesX = "Audio to text selected lines ({0})", + AudioExtractSelectedLines = "Extract audio (selected lines)", VideoToggleBrightness = "Toggle brightness (mpv only)", CustomSearch1 = "Translate, custom search 1", CustomSearch2 = "Translate, custom search 2", @@ -3650,7 +3660,7 @@ Keep changes?", InvertColors = "Invert colors", OriginalImage = "Original image", PostImage = "Image after preprocessing", - YellowToWhite = "Yellow to white" + YellowToWhite = "Yellow to white", }; Watermark = new LanguageStructure.Watermark @@ -3725,6 +3735,18 @@ Keep changes?", Title = "WebVTT - set new voice", VoiceName = "Name of voice", }; + + WebVttStyleManager = new LanguageStructure.WebVttStyleManager + { + Title = "WebVTT styles", + }; + + WhisperAdvanced = new LanguageStructure.WhisperAdvanced + { + Title = "Whisper Advanced - extra command line arguments", + CommandLineArguments = "Extra pameters for whisper command line:", + Info = "Note: Different Whisper implementations have different command line parameters!", + }; } //public static Language Load(StreamReader sr) // normal but slow .net way @@ -3798,7 +3820,5 @@ Keep changes?", { File.WriteAllText(fileName, GetCurrentLanguageAsXml(), Encoding.UTF8); } - } } - diff --git a/src/ui/Logic/LanguageDeserializer.cs b/src/ui/Logic/LanguageDeserializer.cs index 54ba0a4cb..cef6c94ba 100644 --- a/src/ui/Logic/LanguageDeserializer.cs +++ b/src/ui/Logic/LanguageDeserializer.cs @@ -166,6 +166,9 @@ namespace Nikse.SubtitleEdit.Logic case "General/Region": language.General.Region = reader.Value; break; + case "General/Layer": + language.General.Layer = reader.Value; + break; case "General/NumberSymbol": language.General.NumberSymbol = reader.Value; break; @@ -4738,6 +4741,9 @@ namespace Nikse.SubtitleEdit.Logic case "Main/Menu/ContextMenu/SetActor": language.Main.Menu.ContextMenu.SetActor = reader.Value; break; + case "Main/Menu/ContextMenu/SetLayer": + language.Main.Menu.ContextMenu.SetLayer = reader.Value; + break; case "Main/Menu/ContextMenu/AssaTools": language.Main.Menu.ContextMenu.AssaTools = reader.Value; break; @@ -4765,6 +4771,15 @@ namespace Nikse.SubtitleEdit.Logic case "Main/Menu/ContextMenu/NuendoSetStyle": language.Main.Menu.ContextMenu.NuendoSetStyle = reader.Value; break; + case "Main/Menu/ContextMenu/WebVttSetStyle": + language.Main.Menu.ContextMenu.WebVttSetStyle = reader.Value; + break; + case "Main/Menu/ContextMenu/WebVttSetVoice": + language.Main.Menu.ContextMenu.WebVttSetVoice = reader.Value; + break; + case "Main/Menu/ContextMenu/WebVttBrowserPreview": + language.Main.Menu.ContextMenu.WebVttBrowserPreview = reader.Value; + break; case "Main/Menu/ContextMenu/Cut": language.Main.Menu.ContextMenu.Cut = reader.Value; break; @@ -6397,6 +6412,9 @@ namespace Nikse.SubtitleEdit.Logic case "Settings/PreviewFontSize": language.Settings.PreviewFontSize = reader.Value; break; + case "Settings/PreviewVerticalMargin": + language.Settings.PreviewVerticalMargin = reader.Value; + break; case "Settings/MainWindowVideoControls": language.Settings.MainWindowVideoControls = reader.Value; break; @@ -6799,6 +6817,9 @@ namespace Nikse.SubtitleEdit.Logic case "Settings/DarkThemeShowGridViewLines": language.Settings.DarkThemeShowGridViewLines = reader.Value; break; + case "Settings/GraphicsButtons": + language.Settings.GraphicsButtons = reader.Value; + break; case "Settings/UpdateShortcut": language.Settings.UpdateShortcut = reader.Value; break; @@ -7237,6 +7258,9 @@ namespace Nikse.SubtitleEdit.Logic case "Settings/AudioToTextX": language.Settings.AudioToTextX = reader.Value; break; + case "Settings/AudioExtractSelectedLines": + language.Settings.AudioExtractSelectedLines = reader.Value; + break; case "Settings/AudioToTextSelectedLinesX": language.Settings.AudioToTextSelectedLinesX = reader.Value; break; @@ -8995,6 +9019,18 @@ namespace Nikse.SubtitleEdit.Logic case "WebVttNewVoice/VoiceName": language.WebVttNewVoice.VoiceName = reader.Value; break; + case "WebVttStyleManager/Title": + language.WebVttStyleManager.Title = reader.Value; + break; + case "WhisperAdvanced/Title": + language.WhisperAdvanced.Title = reader.Value; + break; + case "WhisperAdvanced/CommandLineArguments": + language.WhisperAdvanced.CommandLineArguments = reader.Value; + break; + case "WhisperAdvanced/Info": + language.WhisperAdvanced.Info = reader.Value; + break; } } diff --git a/src/ui/Logic/LanguageStructure.cs b/src/ui/Logic/LanguageStructure.cs index d54456b43..905842f83 100644 --- a/src/ui/Logic/LanguageStructure.cs +++ b/src/ui/Logic/LanguageStructure.cs @@ -43,6 +43,7 @@ namespace Nikse.SubtitleEdit.Logic public string Actor { get; set; } public string Gap { get; set; } public string Region { get; set; } + public string Layer { get; set; } public string NumberSymbol { get; set; } public string Number { get; set; } public string Text { get; set; } @@ -1874,6 +1875,7 @@ namespace Nikse.SubtitleEdit.Logic public string SizeAllColumnsToFit { get; set; } public string SetStyle { get; set; } public string SetActor { get; set; } + public string SetLayer { get; set; } public string AssaTools { get; set; } public string SubStationAlphaStyles { get; set; } public string AdvancedSubStationAlphaStyles { get; set; } @@ -1883,6 +1885,9 @@ namespace Nikse.SubtitleEdit.Logic public string TimedTextSetLanguage { get; set; } public string SamiSetStyle { get; set; } public string NuendoSetStyle { get; set; } + public string WebVttSetStyle { get; set; } + public string WebVttSetVoice { get; set; } + public string WebVttBrowserPreview { get; set; } public string Cut { get; set; } public string Copy { get; set; } public string Paste { get; set; } @@ -2546,6 +2551,7 @@ namespace Nikse.SubtitleEdit.Logic public string ShowFullscreenButton { get; set; } public string PreviewFontName { get; set; } public string PreviewFontSize { get; set; } + public string PreviewVerticalMargin { get; set; } public string MainWindowVideoControls { get; set; } public string CustomSearchTextAndUrl { get; set; } public string WaveformAppearance { get; set; } @@ -2682,6 +2688,7 @@ namespace Nikse.SubtitleEdit.Logic public string DarkTheme { get; set; } public string DarkThemeEnabled { get; set; } public string DarkThemeShowGridViewLines { get; set; } + public string GraphicsButtons { get; set; } public string UpdateShortcut { get; set; } public string FoucsSetVideoPosition { get; set; } public string ToggleDockUndockOfVideoControls { get; set; } @@ -2831,6 +2838,7 @@ namespace Nikse.SubtitleEdit.Logic public string MainToggleVideoControls { get; set; } public string VideoToggleContrast { get; set; } public string AudioToTextX { get; set; } + public string AudioExtractSelectedLines { get; set; } public string AudioToTextSelectedLinesX { get; set; } public string VideoToggleBrightness { get; set; } public string CustomSearch1 { get; set; } @@ -3543,5 +3551,16 @@ namespace Nikse.SubtitleEdit.Logic public string VoiceName { get; set; } } + public class WebVttStyleManager + { + public string Title { get; set; } + } + + public class WhisperAdvanced + { + public string Title { get; set; } + public string CommandLineArguments { get; set; } + public string Info { get; set; } + } } } diff --git a/src/ui/Logic/MainShortcuts.cs b/src/ui/Logic/MainShortcuts.cs index 15e19ce16..d03697fc9 100644 --- a/src/ui/Logic/MainShortcuts.cs +++ b/src/ui/Logic/MainShortcuts.cs @@ -81,7 +81,9 @@ namespace Nikse.SubtitleEdit.Logic public Keys MainVideoSpeedToggle { get; set; } public Keys MainVideoReset { get; set; } public Keys MainVideoToggleBrightness { get; set; } - public Keys MainVideoAudioToText { get; set; } + public Keys MainVideoAudioToTextVosk { get; set; } + public Keys MainVideoAudioToTextWhisper { get; set; } + public Keys MainVideoAudioExtractSelectedLines { get; set; } public Keys MainVideoToggleContrast { get; set; } public Keys MainGoToPreviousSubtitleAndFocusVideo { get; set; } public Keys MainGoToNextSubtitleAndFocusVideo { get; set; } @@ -343,7 +345,9 @@ namespace Nikse.SubtitleEdit.Logic MainVideoFaster = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoFaster); MainVideoSpeedToggle = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoSpeedToggle); MainVideoReset = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoReset); - MainVideoAudioToText = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoAudioToTextVosk); + MainVideoAudioToTextVosk = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoAudioToTextVosk); + MainVideoAudioToTextWhisper = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoAudioToTextWhisper); + MainVideoAudioExtractSelectedLines = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoAudioExtractAudioSelectedLines); MainVideoToggleBrightness = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoToggleBrightness); MainVideoToggleContrast = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainVideoToggleContrast); MainToolsAutoDuration = UiUtil.GetKeys(Configuration.Settings.Shortcuts.MainToolsAutoDuration); diff --git a/src/ui/Logic/TextDesigner.cs b/src/ui/Logic/TextDesigner.cs index 2e56bfbbf..940928924 100644 --- a/src/ui/Logic/TextDesigner.cs +++ b/src/ui/Logic/TextDesigner.cs @@ -40,13 +40,13 @@ namespace Nikse.SubtitleEdit.Logic { using (var shadowBoxBrush = new SolidBrush(shadowColor)) { - g.FillRectangle(shadowBoxBrush, xPos - outlineWidth + shadowWidth, yPos - outlineWidth + shadowWidth, w + outlineWidth + outlineWidth, h + +outlineWidth + outlineWidth); + g.FillRectangle(shadowBoxBrush, xPos - outlineWidth + shadowWidth, yPos - outlineWidth + shadowWidth, w + outlineWidth + outlineWidth, h + outlineWidth + outlineWidth); } } using (var boxBrush = new SolidBrush(outlineColor)) { - g.FillRectangle(boxBrush, xPos - outlineWidth, yPos - outlineWidth, w + outlineWidth + outlineWidth, h + +outlineWidth + outlineWidth); + g.FillRectangle(boxBrush, xPos - outlineWidth, yPos - outlineWidth, w + outlineWidth + outlineWidth, h + outlineWidth + outlineWidth); } path.AddString(text, font.FontFamily, (int)font.Style, font.Size, new Point(xPos, yPos), stringFormat); diff --git a/src/ui/SubtitleEdit.csproj b/src/ui/SubtitleEdit.csproj index e357a73bc..1c233df1c 100644 --- a/src/ui/SubtitleEdit.csproj +++ b/src/ui/SubtitleEdit.csproj @@ -52,6 +52,7 @@ 4 false + app.manifest @@ -180,6 +181,12 @@ AssSetBackground.cs + + Form + + + SetLayer.cs + Form @@ -216,6 +223,12 @@ AudioClipsGet.cs + + Form + + + WhisperAdvanced.cs + Form @@ -246,6 +259,12 @@ VoskAudioToText.cs + + Form + + + BatchConvertOcrLanguage.cs + Form @@ -402,6 +421,12 @@ GetVideoPosition.cs + + Form + + + PreviewVideo.cs + Form @@ -1381,6 +1406,18 @@ VobSubOcrSetItalicFactor.cs + + Form + + + WebVttStylePicker.cs + + + Form + + + WebVttImportExport.cs + Form @@ -1411,6 +1448,12 @@ TextPrompt.cs + + Form + + + WebVttStyleManager.cs + Form @@ -1559,6 +1602,9 @@ AssSetBackground.cs Designer + + SetLayer.cs + SetPosition.cs @@ -1577,6 +1623,9 @@ AudioClipsGet.cs + + WhisperAdvanced.cs + WhisperDownload.cs @@ -1592,6 +1641,9 @@ VoskAudioToText.cs + + BatchConvertOcrLanguage.cs + BatchConvertMkvEnding.cs @@ -1671,6 +1723,9 @@ WordLists.cs + + PreviewVideo.cs + ShotChangesList.cs @@ -2149,6 +2204,12 @@ VobSubOcrSetItalicFactor.cs + + WebVttStylePicker.cs + + + WebVttImportExport.cs + Watermark.cs @@ -2164,6 +2225,9 @@ TextPrompt.cs + + WebVttStyleManager.cs + YouTubeAnnotationsImport.cs @@ -2217,7 +2281,6 @@ - diff --git a/src/ui/app.config b/src/ui/app.config index 459b0a285..3c118de8d 100644 --- a/src/ui/app.config +++ b/src/ui/app.config @@ -1,16 +1,20 @@  - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/src/ui/app.manifest b/src/ui/app.manifest index ad312a1fe..9d6398422 100644 --- a/src/ui/app.manifest +++ b/src/ui/app.manifest @@ -4,23 +4,76 @@ + + - + + + + + + - + - + - + + + + + + + + false + true + + + + + + +