Minor gfx theme adjustments

This commit is contained in:
niksedk 2023-07-06 18:25:19 +02:00
parent 35dd2e4b6a
commit 7f284bce27
2 changed files with 44 additions and 21 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -1071,7 +1071,6 @@ namespace Nikse.SubtitleEdit.Controls
{ {
if (string.IsNullOrEmpty(_labelTimeCode.Text)) if (string.IsNullOrEmpty(_labelTimeCode.Text))
{ {
var span = TimeCode.FromSeconds(1);
_labelTimeCode.Text = GetDisplayTimeCode(0, 0); _labelTimeCode.Text = GetDisplayTimeCode(0, 0);
_labelTimeCode.Left = Width - _labelTimeCode.Width - 9; _labelTimeCode.Left = Width - _labelTimeCode.Width - 9;
if (_labelTimeCode.Top + _labelTimeCode.Height >= _panelControls.Height - 4) if (_labelTimeCode.Top + _labelTimeCode.Height >= _panelControls.Height - 4)
@ -1306,16 +1305,16 @@ namespace Nikse.SubtitleEdit.Controls
public void ShowFullScreenControls() public void ShowFullScreenControls()
{ {
_pictureBoxFullscreen.Image = (Image)_bitmapNoFullscreen; _pictureBoxFullscreen.Image = _bitmapNoFullscreen;
_pictureBoxFullscreenDown.Image = (Image)_bitmapNoFullscreenDown; _pictureBoxFullscreenDown.Image = _bitmapNoFullscreenDown;
_pictureBoxFullscreenOver.Image = (Image)_bitmapNoFullscreenOver; _pictureBoxFullscreenOver.Image = _bitmapNoFullscreenOver;
} }
public void ShowNonFullScreenControls() public void ShowNonFullScreenControls()
{ {
_pictureBoxFullscreen.Image = (Image)_bitmapFullscreen; _pictureBoxFullscreen.Image = _bitmapFullscreen;
_pictureBoxFullscreenDown.Image = (Image)_bitmapFullscreenDown; _pictureBoxFullscreenDown.Image = _bitmapFullscreenDown;
_pictureBoxFullscreenOver.Image = (Image)_bitmapFullscreenOver; _pictureBoxFullscreenOver.Image = _bitmapFullscreenOver;
} }
private void PictureBoxFullscreenMouseEnter(object sender, EventArgs e) private void PictureBoxFullscreenMouseEnter(object sender, EventArgs e)
@ -2090,8 +2089,11 @@ namespace Nikse.SubtitleEdit.Controls
TryLoadIcon(_pictureBoxStopOver, "StopOver"); TryLoadIcon(_pictureBoxStopOver, "StopOver");
TryLoadIcon(_pictureBoxStopDown, "StopDown"); TryLoadIcon(_pictureBoxStopDown, "StopDown");
TryLoadIcon(_pictureBoxFullscreen, "Fullscreen"); TryLoadIcon(_pictureBoxFullscreen, "Fullscreen");
TryLoadBitmap(ref _bitmapFullscreen, "Fullscreen");
TryLoadIcon(_pictureBoxFullscreenOver, "FullscreenOver"); TryLoadIcon(_pictureBoxFullscreenOver, "FullscreenOver");
TryLoadBitmap(ref _bitmapFullscreenOver, "FullscreenOver");
TryLoadIcon(_pictureBoxFullscreenDown, "FullscreenDown"); TryLoadIcon(_pictureBoxFullscreenDown, "FullscreenDown");
TryLoadBitmap(ref _bitmapFullscreenDown, "FullscreenDown");
TryLoadIcon(_pictureBoxMute, "Mute"); TryLoadIcon(_pictureBoxMute, "Mute");
TryLoadIcon(_pictureBoxMuteOver, "MuteOver"); TryLoadIcon(_pictureBoxMuteOver, "MuteOver");
TryLoadIcon(_pictureBoxMuteDown, "MuteDown"); TryLoadIcon(_pictureBoxMuteDown, "MuteDown");
@ -2100,26 +2102,47 @@ namespace Nikse.SubtitleEdit.Controls
TryLoadIcon(_pictureBoxVolumeBarBackground, "VolumeBarBackground"); TryLoadIcon(_pictureBoxVolumeBarBackground, "VolumeBarBackground");
TryLoadIcon(_pictureBoxVolumeBar, "VolumeBar"); TryLoadIcon(_pictureBoxVolumeBar, "VolumeBar");
TryLoadBitmap(ref _bitmapFullscreen, "Fullscreen");
TryLoadBitmap(ref _bitmapFullscreenDown, "FullscreenDown");
TryLoadBitmap(ref _bitmapFullscreenOver, "FullscreenOver");
TryLoadBitmap(ref _bitmapNoFullscreen, "NoFullscreen"); TryLoadBitmap(ref _bitmapNoFullscreen, "NoFullscreen");
TryLoadBitmap(ref _bitmapNoFullscreenDown, "NoFullscreenDown"); TryLoadBitmap(ref _bitmapNoFullscreenDown, "NoFullscreenDown");
TryLoadBitmap(ref _bitmapNoFullscreenOver, "NoFullscreenOver"); TryLoadBitmap(ref _bitmapNoFullscreenOver, "NoFullscreenOver");
var bg = (_pictureBoxBackground.Image as Bitmap); if (_pictureBoxBackground.Image is Bitmap bg)
{
_labelVolume.BackColor = bg.GetPixel(_labelVolume.Left, _labelVolume.Top); _labelVolume.BackColor = bg.GetPixel(_labelVolume.Left, _labelVolume.Top);
_labelTimeCode.BackColor = bg.GetPixel(_labelTimeCode.Left, _labelTimeCode.Top); _labelTimeCode.BackColor = bg.GetPixel(_labelTimeCode.Left, _labelTimeCode.Top);
_labelVideoPlayerName.BackColor = bg.GetPixel(_labelVideoPlayerName.Left, _labelVideoPlayerName.Top); _labelVideoPlayerName.BackColor = bg.GetPixel(_labelVideoPlayerName.Left, _labelVideoPlayerName.Top);
//TODO: Auto set fore color depending on bg color
// _labelVolume.ForeColor = Color.Gray;
// _labelTimeCode.ForeColor = Color.Gray;
// _labelVideoPlayerName.ForeColor = Color.Gray;
} }
private void TryLoadBitmap(ref Bitmap bmp, string name) // 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(); var pb = new PictureBox();
TryLoadIcon(pb, name); TryLoadIcon(pb, name);