aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCastagnaIT <gottardo.stefano.83@gmail.com>2022-01-10 13:02:44 +0100
committerCastagnaIT <gottardo.stefano.83@gmail.com>2022-01-10 13:02:44 +0100
commit4723c5e8d26979eb784aa2414f117e84d2845b5a (patch)
treeba8fa60fe79fc447534a0e251fce1748a60f3a09
parent5ed7fd5bb403a7a72219f010fc641a8c614930d1 (diff)
[WindowScreenCalibration] Improvements to screen calibration window
-rw-r--r--addons/resource.language.en_gb/resources/strings.po41
-rw-r--r--addons/skin.estouchy/media/calibrate_reset.pngbin0 -> 1367 bytes
-rw-r--r--addons/skin.estouchy/media/calibrate_subtitles.pngbin258 -> 250 bytes
-rw-r--r--addons/skin.estouchy/xml/Font.xml12
-rw-r--r--addons/skin.estouchy/xml/SettingsScreenCalibration.xml75
-rw-r--r--addons/skin.estuary/media/calibrate/cal_sub.pngbin329 -> 246 bytes
-rw-r--r--addons/skin.estuary/media/calibrate/reset.pngbin0 -> 1339 bytes
-rw-r--r--addons/skin.estuary/xml/Font.xml23
-rw-r--r--addons/skin.estuary/xml/SettingsScreenCalibration.xml58
-rw-r--r--xbmc/guilib/GUIWindow.cpp9
-rw-r--r--xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp252
-rw-r--r--xbmc/settings/windows/GUIWindowSettingsScreenCalibration.h7
12 files changed, 370 insertions, 107 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po
index ce040da7e0..db3d0905ca 100644
--- a/addons/resource.language.en_gb/resources/strings.po
+++ b/addons/resource.language.en_gb/resources/strings.po
@@ -979,10 +979,12 @@ msgctxt "#213"
msgid "Calibrate user interface..."
msgstr ""
+#. To open window screen calibration and as window title
#: system/settings/settings.xml
#: xbmc/video/dialogs/GUIDialogVideoSettings.cpp
+#: skins/xml/SettingsScreenCalibration.xml
msgctxt "#214"
-msgid "Video calibration..."
+msgid "Video calibration"
msgstr ""
msgctxt "#215"
@@ -1275,32 +1277,46 @@ msgctxt "#271"
msgid "Top 100"
msgstr ""
+#. Window screen calibration: calibration from the rectangle box
+#: xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
msgctxt "#272"
-msgid "Top-Left overscan compensation"
+msgid "Pixel ratio adjustment"
msgstr ""
+#. Window screen calibration: calibration by using the rectangle box
+#: xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
msgctxt "#273"
-msgid "Bottom-Right overscan compensation"
+msgid "Adjust the rectangle so it is perfectly square"
msgstr ""
+#. Window screen calibration: calibration from the top-left angle
+#: xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
msgctxt "#274"
-msgid "Subtitle positioning"
+msgid "Top-Left overscan compensation"
msgstr ""
+#. Window screen calibration: calibration from the bottom-right angle
+#: xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
msgctxt "#275"
-msgid "Pixel ratio adjustment"
+msgid "Bottom-Right overscan compensation"
msgstr ""
+#. Window screen calibration: calibration by using the top-left or bottom-right arrows
+#: xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
msgctxt "#276"
msgid "Adjust the arrow to change the amount of overscan"
msgstr ""
+#. Window screen calibration: calibration of subtitle bar
+#: xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
msgctxt "#277"
-msgid "Adjust the bar to change the subtitles position"
+msgid "Subtitle positioning"
msgstr ""
+#. Window screen calibration: calibration by using the subtitle bar
+#: xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
msgctxt "#278"
-msgid "Adjust the rectangle so it is perfectly square"
+msgid "Adjust the bar to change the subtitles position"
msgstr ""
msgctxt "#279"
@@ -6588,6 +6604,7 @@ msgid "Video encoder:"
msgstr ""
#: xbmc/windows/GUIWindowSystemInfo.cpp
+#: xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
msgctxt "#13287"
msgid "Screen resolution:"
msgstr ""
@@ -13043,16 +13060,22 @@ msgctxt "#20324"
msgid "Play part..."
msgstr ""
+#. Window screen calibration: as title to reset calibration settings
+#: xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
msgctxt "#20325"
msgid "Calibration reset"
msgstr ""
+#. Window screen calibration: ask to reset calibration settings
+#: xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
msgctxt "#20326"
-msgid "This will reset the calibration values for {0:s}"
+msgid "Do you want reset the calibration to their defaults for \"{0:s}\" resolution?"
msgstr ""
+#. Window screen calibration: the current calibration value
+#: xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
msgctxt "#20327"
-msgid "to its default values."
+msgid "Current value: {}"
msgstr ""
msgctxt "#20328"
diff --git a/addons/skin.estouchy/media/calibrate_reset.png b/addons/skin.estouchy/media/calibrate_reset.png
new file mode 100644
index 0000000000..40b920a998
--- /dev/null
+++ b/addons/skin.estouchy/media/calibrate_reset.png
Binary files differ
diff --git a/addons/skin.estouchy/media/calibrate_subtitles.png b/addons/skin.estouchy/media/calibrate_subtitles.png
index 85e549e66d..2f83a72965 100644
--- a/addons/skin.estouchy/media/calibrate_subtitles.png
+++ b/addons/skin.estouchy/media/calibrate_subtitles.png
Binary files differ
diff --git a/addons/skin.estouchy/xml/Font.xml b/addons/skin.estouchy/xml/Font.xml
index 193a9bdded..8379936bd2 100644
--- a/addons/skin.estouchy/xml/Font.xml
+++ b/addons/skin.estouchy/xml/Font.xml
@@ -92,6 +92,12 @@
<style>bold</style>
</font>
<font>
+ <name>font38_title</name>
+ <filename>NotoSans-Regular.ttf</filename>
+ <size>38</size>
+ <style>bold</style>
+ </font>
+ <font>
<name>font70_title</name>
<filename>NotoSans-Regular.ttf</filename>
<size>70</size>
@@ -202,6 +208,12 @@
<style>bold</style>
</font>
<font>
+ <name>font38_title</name>
+ <filename>arial.ttf</filename>
+ <size>38</size>
+ <style>bold</style>
+ </font>
+ <font>
<name>font70_title</name>
<filename>Arial.ttf</filename>
<size>70</size>
diff --git a/addons/skin.estouchy/xml/SettingsScreenCalibration.xml b/addons/skin.estouchy/xml/SettingsScreenCalibration.xml
index 61d56a1781..cae08c39d8 100644
--- a/addons/skin.estouchy/xml/SettingsScreenCalibration.xml
+++ b/addons/skin.estouchy/xml/SettingsScreenCalibration.xml
@@ -33,7 +33,7 @@
<font></font>
<onclick>Back</onclick>
<texturefocus>DialogCloseButton-focus.png</texturefocus>
- <texturenofocus>DialogCloseButton.png</texturenofocus>
+ <texturenofocus colordiffuse="grey3">DialogCloseButton.png</texturenofocus>
<onleft>1</onleft>
<onright>1</onright>
<onup>1</onup>
@@ -46,7 +46,7 @@
<width>128</width>
<height>128</height>
<texturefocus>calibrate_top.png</texturefocus>
- <texturenofocus></texturenofocus>
+ <texturenofocus colordiffuse="grey3">calibrate_top.png</texturenofocus>
</control>
<control type="mover" id="9">
<description>right bottom mover</description>
@@ -55,16 +55,7 @@
<width>128</width>
<height>128</height>
<texturefocus>calibrate_bottom.png</texturefocus>
- <texturenofocus></texturenofocus>
- </control>
- <control type="mover" id="10">
- <description>subtitle position mover</description>
- <posx>200</posx>
- <posy>500</posy>
- <width>512</width>
- <height>128</height>
- <texturefocus>calibrate_subtitles.png</texturefocus>
- <texturenofocus></texturenofocus>
+ <texturenofocus colordiffuse="grey3">calibrate_bottom.png</texturenofocus>
</control>
<control type="resize" id="11">
<description>pixel aspect ratio box</description>
@@ -73,29 +64,65 @@
<width>500</width>
<height>500</height>
<texturefocus>calibrate_aspect.png</texturefocus>
- <texturenofocus></texturenofocus>
+ <texturenofocus colordiffuse="grey3">calibrate_aspect.png</texturenofocus>
+ </control>
+ <control type="mover" id="10">
+ <description>subtitle position mover</description>
+ <posx>200</posx>
+ <posy>500</posy>
+ <width>380</width>
+ <height>90</height>
+ <!-- NOTE: The image must have 40px of trasparent on top and bottom the bar -->
+ <texturefocus>calibrate_subtitles.png</texturefocus>
+ <texturenofocus colordiffuse="grey3">calibrate_subtitles.png</texturenofocus>
+ </control>
+ <control type="mover" id="12">
+ <description>reset calibration</description>
+ <posx>0</posx>
+ <posy>900</posy>
+ <width>100</width>
+ <height>100</height>
+ <texturefocus>calibrate_reset.png</texturefocus>
+ <texturenofocus colordiffuse="grey3">calibrate_reset.png</texturenofocus>
</control>
<control type="group">
- <posx>20</posx>
- <posy>80</posy>
- <include>16x9_xPos_Relocation</include>
+ <posx>0</posx>
+ <posy>10</posy>
+ <control type="label">
+ <description>window title</description>
+ <posx>0</posx>
+ <posy>0</posy>
+ <width>100%</width>
+ <label>$LOCALIZE[214]</label>
+ <align>center</align>
+ <font>font38_title</font>
+ </control>
<control type="label" id="2">
- <description>coordinates label</description>
+ <description>resolution info</description>
<posx>0</posx>
- <posy>10</posy>
- <width>1280</width>
+ <posy>50</posy>
+ <width>100%</width>
<label></label>
<align>center</align>
- <font>font24_title</font>
+ <font>font22</font>
</control>
<control type="label" id="3">
- <description>help information</description>
+ <description>control description and help</description>
+ <posx>0</posx>
+ <posy>90</posy>
+ <width>100%</width>
+ <label></label>
+ <align>center</align>
+ <font>font30</font>
+ </control>
+ <control type="label" id="4">
+ <description>calibration value</description>
<posx>0</posx>
- <posy>40</posy>
- <width>1280</width>
+ <posy>180</posy>
+ <width>100%</width>
<label></label>
<align>center</align>
- <font>font24_title</font>
+ <font>font25</font>
</control>
</control>
</controls>
diff --git a/addons/skin.estuary/media/calibrate/cal_sub.png b/addons/skin.estuary/media/calibrate/cal_sub.png
index fb08fc6916..89c3b1d91c 100644
--- a/addons/skin.estuary/media/calibrate/cal_sub.png
+++ b/addons/skin.estuary/media/calibrate/cal_sub.png
Binary files differ
diff --git a/addons/skin.estuary/media/calibrate/reset.png b/addons/skin.estuary/media/calibrate/reset.png
new file mode 100644
index 0000000000..9f5ca01d21
--- /dev/null
+++ b/addons/skin.estuary/media/calibrate/reset.png
Binary files differ
diff --git a/addons/skin.estuary/xml/Font.xml b/addons/skin.estuary/xml/Font.xml
index 8ff2aacc63..f34236eaed 100644
--- a/addons/skin.estuary/xml/Font.xml
+++ b/addons/skin.estuary/xml/Font.xml
@@ -54,6 +54,12 @@
<linespacing>0.8</linespacing>
</font>
<font>
+ <name>font32</name>
+ <filename>NotoSans-Regular.ttf</filename>
+ <size>32</size>
+ <style>lighten</style>
+ </font>
+ <font>
<name>font37</name>
<filename>NotoSans-Regular.ttf</filename>
<size>37</size>
@@ -114,6 +120,12 @@
<style>bold</style>
</font>
<font>
+ <name>font40_title</name>
+ <filename>NotoSans-Regular.ttf</filename>
+ <size>40</size>
+ <style>bold</style>
+ </font>
+ <font>
<name>font45_title</name>
<filename>NotoSans-Regular.ttf</filename>
<size>45</size>
@@ -190,6 +202,11 @@
<linespacing>0.8</linespacing>
</font>
<font>
+ <name>font32</name>
+ <filename>arial.ttf</filename>
+ <size>32</size>
+ </font>
+ <font>
<name>font37</name>
<filename>arial.ttf</filename>
<size>37</size>
@@ -249,6 +266,12 @@
<style>bold</style>
</font>
<font>
+ <name>font40_title</name>
+ <filename>arial.ttf</filename>
+ <size>40</size>
+ <style>bold</style>
+ </font>
+ <font>
<name>font45_title</name>
<filename>arial.ttf</filename>
<size>45</size>
diff --git a/addons/skin.estuary/xml/SettingsScreenCalibration.xml b/addons/skin.estuary/xml/SettingsScreenCalibration.xml
index eece4ac4a5..f7f661b203 100644
--- a/addons/skin.estuary/xml/SettingsScreenCalibration.xml
+++ b/addons/skin.estuary/xml/SettingsScreenCalibration.xml
@@ -21,15 +21,6 @@
<texturefocus colordiffuse="button_focus">calibrate/cal_br.png</texturefocus>
<texturenofocus>calibrate/cal_br.png</texturenofocus>
</control>
- <control type="mover" id="10">
- <description>subtitle position mover</description>
- <left>200</left>
- <top>500</top>
- <width>384</width>
- <height>128</height>
- <texturefocus colordiffuse="button_focus">calibrate/cal_sub.png</texturefocus>
- <texturenofocus>calibrate/cal_sub.png</texturenofocus>
- </control>
<control type="resize" id="11">
<description>pixel aspect ratio</description>
<left>0</left>
@@ -39,25 +30,64 @@
<texturefocus colordiffuse="button_focus">calibrate/cal_ratio.png</texturefocus>
<texturenofocus>calibrate/cal_ratio.png</texturenofocus>
</control>
+ <control type="mover" id="10">
+ <description>subtitle position mover</description>
+ <left>200</left>
+ <top>500</top>
+ <width>380</width>
+ <height>90</height>
+ <!-- NOTE: The image must have 40px of trasparent on top and bottom the bar -->
+ <texturefocus colordiffuse="button_focus">calibrate/cal_sub.png</texturefocus>
+ <texturenofocus>calibrate/cal_sub.png</texturenofocus>
+ </control>
+ <control type="mover" id="12">
+ <description>reset calibration</description>
+ <left>0</left>
+ <top>900</top>
+ <width>100</width>
+ <height>100</height>
+ <texturefocus colordiffuse="button_focus">calibrate/reset.png</texturefocus>
+ <texturenofocus>calibrate/reset.png</texturenofocus>
+ </control>
+ <control type="label">
+ <description>window title</description>
+ <left>0</left>
+ <top>10</top>
+ <width>100%</width>
+ <align>center</align>
+ <label>$LOCALIZE[214]</label>
+ <font>font40_title</font>
+ <shadowcolor>FF000000</shadowcolor>
+ </control>
<control type="label" id="2">
- <description>coordinates label</description>
+ <description>resolution info</description>
<left>0</left>
- <top>150</top>
+ <top>60</top>
<width>100%</width>
<align>center</align>
<label></label>
- <font>font37</font>
+ <font>font27</font>
<shadowcolor>FF000000</shadowcolor>
</control>
<control type="label" id="3">
- <description>help information</description>
+ <description>control description and help</description>
<left>0</left>
- <top>210</top>
+ <top>110</top>
<width>100%</width>
<align>center</align>
<label></label>
<font>font37</font>
<shadowcolor>FF000000</shadowcolor>
</control>
+ <control type="label" id="4">
+ <description>calibration value</description>
+ <left>0</left>
+ <top>210</top>
+ <width>100%</width>
+ <align>center</align>
+ <label></label>
+ <font>font32</font>
+ <shadowcolor>FF000000</shadowcolor>
+ </control>
</controls>
</window>
diff --git a/xbmc/guilib/GUIWindow.cpp b/xbmc/guilib/GUIWindow.cpp
index b50b633e11..04d2749958 100644
--- a/xbmc/guilib/GUIWindow.cpp
+++ b/xbmc/guilib/GUIWindow.cpp
@@ -618,6 +618,15 @@ bool CGUIWindow::OnMessage(CGUIMessage& message)
if (HasID(message.GetSenderId()))
{
m_focusedControl = message.GetControlId();
+ // We ensure that all others childrens have focus disabled,
+ // this can happen when one control overlap the other one in the same
+ // coordinates with similar sizes and the mouse pointer is over them
+ // in this case only the control in the highest layer will have the focus
+ for (CGUIControl* control : m_children)
+ {
+ if (control->GetID() != m_focusedControl)
+ control->SetFocus(false);
+ }
return true;
}
break;
diff --git a/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp b/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
index 6c0e2a162c..ffdffe7614 100644
--- a/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
+++ b/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.cpp
@@ -28,14 +28,26 @@
#include <string>
#include <utility>
-#define CONTROL_LABEL_ROW1 2
-#define CONTROL_LABEL_ROW2 3
-#define CONTROL_TOP_LEFT 8
-#define CONTROL_BOTTOM_RIGHT 9
-#define CONTROL_SUBTITLES 10
-#define CONTROL_PIXEL_RATIO 11
-#define CONTROL_VIDEO 20
-#define CONTROL_NONE 0
+namespace
+{
+constexpr int CONTROL_LABEL_RES = 2;
+constexpr int CONTROL_LABEL_DESCRIPTION = 3;
+constexpr int CONTROL_LABEL_VALUE = 4;
+constexpr int CONTROL_TOP_LEFT = 8;
+constexpr int CONTROL_BOTTOM_RIGHT = 9;
+constexpr int CONTROL_SUBTITLES = 10;
+constexpr int CONTROL_PIXEL_RATIO = 11;
+constexpr int CONTROL_RESET = 12;
+constexpr int CONTROL_VIDEO = 20;
+constexpr int CONTROL_NONE = 0;
+
+constexpr int DEFAULT_GUI_HEIGHT = 1080;
+constexpr int DEFAULT_GUI_WIDTH = 1920;
+
+// Fixed transparent space of the subtitle bar (on top + below) for touch screen
+// must match with the space of the skin bar image
+constexpr int CONTROL_SUBTITLES_SPACE = 80;
+} // unnamed namespace
CGUIWindowSettingsScreenCalibration::CGUIWindowSettingsScreenCalibration(void)
: CGUIWindow(WINDOW_SCREEN_CALIBRATION, "SettingsScreenCalibration.xml")
@@ -49,6 +61,30 @@ CGUIWindowSettingsScreenCalibration::CGUIWindowSettingsScreenCalibration(void)
CGUIWindowSettingsScreenCalibration::~CGUIWindowSettingsScreenCalibration(void) = default;
+void CGUIWindowSettingsScreenCalibration::ResetCalibration()
+{
+ // We ask to reset the calibration
+ // Reset will be applied to: windowed mode or per fullscreen resolution
+ CGUIDialogYesNo* pDialog =
+ CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogYesNo>(WINDOW_DIALOG_YES_NO);
+ pDialog->SetHeading(CVariant{20325});
+ std::string strText = StringUtils::Format(
+ g_localizeStrings.Get(20326),
+ CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(m_Res[m_iCurRes]).strMode);
+ pDialog->SetText(CVariant{std::move(strText)});
+ pDialog->SetChoice(0, CVariant{222});
+ pDialog->SetChoice(1, CVariant{186});
+ pDialog->Open();
+ if (pDialog->IsConfirmed())
+ {
+ CServiceBroker::GetWinSystem()->GetGfxContext().ResetScreenParameters(m_Res[m_iCurRes]);
+ ResetControls();
+ // Send GUI_MSG_WINDOW_RESIZE to rescale font size/aspect for label controls
+ CServiceBroker::GetGUI()->GetWindowManager().SendMessage(
+ GUI_MSG_NOTIFY_ALL, WINDOW_SCREEN_CALIBRATION, 0, GUI_MSG_WINDOW_RESIZE);
+ }
+}
+
bool CGUIWindowSettingsScreenCalibration::OnAction(const CAction &action)
{
switch (action.GetID())
@@ -62,21 +98,7 @@ bool CGUIWindowSettingsScreenCalibration::OnAction(const CAction &action)
case ACTION_CALIBRATE_RESET:
{
- CGUIDialogYesNo* pDialog = CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogYesNo>(WINDOW_DIALOG_YES_NO);
- pDialog->SetHeading(CVariant{20325});
- std::string strText = StringUtils::Format(
- g_localizeStrings.Get(20326),
- CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(m_Res[m_iCurRes]).strMode);
- pDialog->SetLine(0, CVariant{std::move(strText)});
- pDialog->SetLine(1, CVariant{20327});
- pDialog->SetChoice(0, CVariant{222});
- pDialog->SetChoice(1, CVariant{186});
- pDialog->Open();
- if (pDialog->IsConfirmed())
- {
- CServiceBroker::GetWinSystem()->GetGfxContext().ResetScreenParameters(m_Res[m_iCurRes]);
- ResetControls();
- }
+ ResetCalibration();
return true;
}
break;
@@ -87,9 +109,13 @@ bool CGUIWindowSettingsScreenCalibration::OnAction(const CAction &action)
m_iCurRes = (m_iCurRes+1) % m_Res.size();
CServiceBroker::GetWinSystem()->GetGfxContext().SetVideoResolution(m_Res[m_iCurRes], false);
ResetControls();
+ // Send GUI_MSG_WINDOW_RESIZE to rescale font size/aspect for label controls
+ CServiceBroker::GetGUI()->GetWindowManager().SendMessage(
+ GUI_MSG_NOTIFY_ALL, WINDOW_SCREEN_CALIBRATION, 0, GUI_MSG_WINDOW_RESIZE);
return true;
}
break;
+
// ignore all gesture meta actions
case ACTION_GESTURE_BEGIN:
case ACTION_GESTURE_END:
@@ -99,6 +125,15 @@ bool CGUIWindowSettingsScreenCalibration::OnAction(const CAction &action)
case ACTION_GESTURE_ROTATE:
case ACTION_GESTURE_ZOOM:
return true;
+
+ case ACTION_MOUSE_LEFT_CLICK:
+ case ACTION_TOUCH_TAP:
+ if (GetFocusedControlID() == CONTROL_RESET)
+ {
+ ResetCalibration();
+ return true;
+ }
+ break;
}
// if we see a mouse move event without dx and dy (amount2 and amount3) these
@@ -134,7 +169,8 @@ bool CGUIWindowSettingsScreenCalibration::OnMessage(CGUIMessage& message)
CServiceBroker::GetWinSystem()->GetGfxContext().SetCalibrating(false);
// reset our screen resolution to what it was initially
CServiceBroker::GetWinSystem()->GetGfxContext().SetVideoResolution(CDisplaySettings::GetInstance().GetCurrentResolution(), false);
- CServiceBroker::GetGUI()->GetWindowManager().SendMessage(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_WINDOW_RESIZE);
+ CServiceBroker::GetGUI()->GetWindowManager().SendMessage(
+ GUI_MSG_NOTIFY_ALL, WINDOW_SCREEN_CALIBRATION, 0, GUI_MSG_WINDOW_RESIZE);
}
break;
@@ -143,6 +179,17 @@ bool CGUIWindowSettingsScreenCalibration::OnMessage(CGUIMessage& message)
CGUIWindow::OnMessage(message);
CServiceBroker::GetWinSystem()->GetGfxContext().SetCalibrating(true);
+ // Get the default XML size values of controls,
+ // we will use these values to scale controls when the resolution change
+ for (int id = CONTROL_TOP_LEFT; id <= CONTROL_RESET; id++)
+ {
+ CGUIControl* control = GetControl(id);
+ if (control)
+ {
+ m_controlsSize.emplace(id, std::make_pair(control->GetHeight(), control->GetWidth()));
+ }
+ }
+
// Get the allowable resolutions that we can calibrate...
m_Res.clear();
if (g_application.GetAppPlayer().IsPlayingVideo())
@@ -170,13 +217,14 @@ bool CGUIWindowSettingsScreenCalibration::OnMessage(CGUIMessage& message)
break;
case GUI_MSG_CLICKED:
{
- // clicked - change the control...
+ // On click event select the next control
NextControl();
}
break;
case GUI_MSG_NOTIFY_ALL:
{
- if (message.GetParam1() == GUI_MSG_WINDOW_RESIZE && IsActive())
+ if (message.GetParam1() == GUI_MSG_WINDOW_RESIZE &&
+ message.GetSenderId() != WINDOW_SCREEN_CALIBRATION && IsActive())
{
m_Res.clear();
CServiceBroker::GetWinSystem()->GetGfxContext().GetAllowedResolutions(m_Res);
@@ -230,9 +278,15 @@ void CGUIWindowSettingsScreenCalibration::NextControl()
pControl->SetVisible(false);
pControl->SetFocus(false);
}
+ // If the current control is the reset button
+ // ask to reset the calibration settings
+ if (m_iControl == CONTROL_RESET)
+ {
+ ResetCalibration();
+ }
// switch to the next control
m_iControl++;
- if (m_iControl > CONTROL_PIXEL_RATIO)
+ if (m_iControl > CONTROL_RESET)
m_iControl = CONTROL_TOP_LEFT;
// enable the new control
EnableControl(m_iControl);
@@ -244,6 +298,7 @@ void CGUIWindowSettingsScreenCalibration::EnableControl(int iControl)
SET_CONTROL_VISIBLE(CONTROL_BOTTOM_RIGHT);
SET_CONTROL_VISIBLE(CONTROL_SUBTITLES);
SET_CONTROL_VISIBLE(CONTROL_PIXEL_RATIO);
+ SET_CONTROL_VISIBLE(CONTROL_RESET);
SET_CONTROL_FOCUS(iControl, 0);
}
@@ -262,6 +317,9 @@ void CGUIWindowSettingsScreenCalibration::ResetControls()
-info.iHeight / 4,
info.iWidth / 4,
info.iHeight / 4);
+ auto& size = m_controlsSize[CONTROL_TOP_LEFT];
+ pControl->SetHeight(size.first / DEFAULT_GUI_HEIGHT * info.iHeight);
+ pControl->SetWidth(size.second / DEFAULT_GUI_WIDTH * info.iWidth);
pControl->SetPosition((float)info.Overscan.left,
(float)info.Overscan.top);
pControl->SetLocation(info.Overscan.left,
@@ -274,6 +332,9 @@ void CGUIWindowSettingsScreenCalibration::ResetControls()
info.iHeight*3 / 4,
info.iWidth*5 / 4,
info.iHeight*5 / 4);
+ auto& size = m_controlsSize[CONTROL_BOTTOM_RIGHT];
+ pControl->SetHeight(size.first / DEFAULT_GUI_HEIGHT * info.iHeight);
+ pControl->SetWidth(size.second / DEFAULT_GUI_WIDTH * info.iWidth);
pControl->SetPosition((float)info.Overscan.right - (int)pControl->GetWidth(),
(float)info.Overscan.bottom - (int)pControl->GetHeight());
pControl->SetLocation(info.Overscan.right,
@@ -283,12 +344,21 @@ void CGUIWindowSettingsScreenCalibration::ResetControls()
pControl = dynamic_cast<CGUIMoverControl*>(GetControl(CONTROL_SUBTITLES));
if (pControl)
{
- pControl->SetLimits(0, 0, 0, info.iHeight);
+ auto& size = m_controlsSize[CONTROL_SUBTITLES];
+ float scaledHeight = size.first / DEFAULT_GUI_HEIGHT * info.iHeight;
+ float scaledSpace =
+ static_cast<float>(CONTROL_SUBTITLES_SPACE) / DEFAULT_GUI_HEIGHT * info.iHeight;
+ m_subtitlesHalfSpace = static_cast<int>(scaledSpace / 2);
+ int barHeight = static_cast<int>(scaledHeight - scaledSpace);
+ pControl->SetLimits(0, m_subtitlesHalfSpace + barHeight, 0,
+ info.iHeight + m_subtitlesHalfSpace);
+ pControl->SetHeight(scaledHeight);
+ pControl->SetWidth(size.second / DEFAULT_GUI_WIDTH * info.iWidth);
pControl->SetPosition((info.iWidth - pControl->GetWidth()) * 0.5f,
- info.iSubtitles - pControl->GetHeight());
- pControl->SetLocation(0, info.iSubtitles, false);
+ info.iSubtitles - pControl->GetHeight() + m_subtitlesHalfSpace);
+ pControl->SetLocation(0, info.iSubtitles + m_subtitlesHalfSpace, false);
}
- // lastly the pixel ratio control...
+ // The pixel ratio control
CGUIResizeControl *pResize = dynamic_cast<CGUIResizeControl*>(GetControl(CONTROL_PIXEL_RATIO));
if (pResize)
{
@@ -299,14 +369,28 @@ void CGUIWindowSettingsScreenCalibration::ResetControls()
pResize->SetPosition((info.iWidth - pResize->GetWidth()) / 2,
(info.iHeight - pResize->GetHeight()) / 2);
}
+ // The calibration reset
+ pControl = dynamic_cast<CGUIMoverControl*>(GetControl(CONTROL_RESET));
+ if (pControl)
+ {
+ auto& size = m_controlsSize[CONTROL_RESET];
+ pControl->SetHeight(size.first / DEFAULT_GUI_HEIGHT * info.iHeight);
+ pControl->SetWidth(size.second / DEFAULT_GUI_WIDTH * info.iWidth);
+ float posX = 0;
+ float posY = info.iHeight - pControl->GetHeight();
+ pControl->SetLimits(posX, posY, posX, posY);
+ pControl->SetPosition(posX, posY);
+ pControl->SetLocation(posX, posY, false);
+ }
// Enable the default control
EnableControl(m_iControl);
}
void CGUIWindowSettingsScreenCalibration::UpdateFromControl(int iControl)
{
- std::string strStatus;
RESOLUTION_INFO info = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(m_Res[m_iCurRes]);
+ std::string labelDescription;
+ std::string labelValue;
if (iControl == CONTROL_PIXEL_RATIO)
{
@@ -319,62 +403,110 @@ void CGUIWindowSettingsScreenCalibration::UpdateFromControl(int iControl)
// recenter our control...
pControl->SetPosition((info.iWidth - pControl->GetWidth()) / 2,
(info.iHeight - pControl->GetHeight()) / 2);
- strStatus = StringUtils::Format("{} ({:5.3f})", g_localizeStrings.Get(275), info.fPixelRatio);
- SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 278);
+ labelDescription = StringUtils::Format("[B]{}[/B][CR]{}", g_localizeStrings.Get(272),
+ g_localizeStrings.Get(273));
+ labelValue = StringUtils::Format("{:5.3f}", info.fPixelRatio);
+ labelValue = StringUtils::Format(g_localizeStrings.Get(20327), labelValue);
}
}
else
{
- const CGUIMoverControl *pControl = dynamic_cast<const CGUIMoverControl*>(GetControl(iControl));
+ CGUIMoverControl* pControl = dynamic_cast<CGUIMoverControl*>(GetControl(iControl));
if (pControl)
{
switch (iControl)
{
- case CONTROL_TOP_LEFT:
+ case CONTROL_TOP_LEFT:
{
info.Overscan.left = pControl->GetXLocation();
info.Overscan.top = pControl->GetYLocation();
- strStatus = StringUtils::Format("{} ({},{})", g_localizeStrings.Get(272),
- pControl->GetXLocation(), pControl->GetYLocation());
- SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 276);
+ labelDescription = StringUtils::Format("[B]{}[/B][CR]{}", g_localizeStrings.Get(274),
+ g_localizeStrings.Get(276));
+ labelValue =
+ StringUtils::Format("{}, {}", pControl->GetXLocation(), pControl->GetYLocation());
+ labelValue = StringUtils::Format(g_localizeStrings.Get(20327), labelValue);
+ // Update reset control position
+ CGUIMoverControl* pControl = dynamic_cast<CGUIMoverControl*>(GetControl(CONTROL_RESET));
+ if (pControl)
+ {
+ float posX = info.Overscan.left;
+ float posY = info.Overscan.bottom - pControl->GetHeight();
+ pControl->SetLimits(posX, posY, posX, posY);
+ pControl->SetPosition(posX, posY);
+ pControl->SetLocation(posX, posY, false);
+ }
}
break;
- case CONTROL_BOTTOM_RIGHT:
+ case CONTROL_BOTTOM_RIGHT:
{
info.Overscan.right = pControl->GetXLocation();
info.Overscan.bottom = pControl->GetYLocation();
int iXOff1 = info.iWidth - pControl->GetXLocation();
int iYOff1 = info.iHeight - pControl->GetYLocation();
- strStatus = StringUtils::Format("{} ({},{})", g_localizeStrings.Get(273), iXOff1, iYOff1);
- SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 276);
+ labelDescription = StringUtils::Format("[B]{}[/B][CR]{}", g_localizeStrings.Get(275),
+ g_localizeStrings.Get(276));
+ labelValue = StringUtils::Format("{}, {}", iXOff1, iYOff1);
+ labelValue = StringUtils::Format(g_localizeStrings.Get(20327), labelValue);
+ // Keep the subtitle bar within the overscan boundary
+ pControl = dynamic_cast<CGUIMoverControl*>(GetControl(CONTROL_SUBTITLES));
+ if (info.Overscan.bottom < info.iSubtitles)
+ {
+ info.iSubtitles = info.Overscan.bottom;
+ pControl->SetPosition((info.iWidth - pControl->GetWidth()) * 0.5f,
+ info.iSubtitles - pControl->GetHeight() + m_subtitlesHalfSpace);
+ pControl->SetLocation(0, info.iSubtitles + m_subtitlesHalfSpace, false);
+ }
+ // Update reset control position
+ pControl = dynamic_cast<CGUIMoverControl*>(GetControl(CONTROL_RESET));
+ if (pControl)
+ {
+ float posX = info.Overscan.left;
+ float posY = info.Overscan.bottom - pControl->GetHeight();
+ pControl->SetLimits(posX, posY, posX, posY);
+ pControl->SetPosition(posX, posY);
+ pControl->SetLocation(posX, posY, false);
+ }
+ }
+ break;
+
+ case CONTROL_SUBTITLES:
+ {
+ info.iSubtitles = pControl->GetYLocation() - m_subtitlesHalfSpace;
+ labelDescription = StringUtils::Format("[B]{}[/B][CR]{}", g_localizeStrings.Get(277),
+ g_localizeStrings.Get(278));
+ labelValue = StringUtils::Format(g_localizeStrings.Get(20327), info.iSubtitles);
}
break;
- case CONTROL_SUBTITLES:
+ case CONTROL_RESET:
{
- info.iSubtitles = pControl->GetYLocation();
- strStatus =
- StringUtils::Format("{} ({})", g_localizeStrings.Get(274), pControl->GetYLocation());
- SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, 277);
+ labelDescription = g_localizeStrings.Get(20325);
}
break;
}
}
}
+ SET_CONTROL_LABEL(CONTROL_LABEL_DESCRIPTION, labelDescription);
+ SET_CONTROL_LABEL(CONTROL_LABEL_VALUE, labelValue);
+
CServiceBroker::GetWinSystem()->GetGfxContext().SetResInfo(m_Res[m_iCurRes], info);
- // set the label control correctly
- std::string strText;
+ // Set resolution info text
+ std::string resInfo;
if (CServiceBroker::GetWinSystem()->IsFullScreen())
- strText = StringUtils::Format("{}x{}@{:.2f} - {} | {}", info.iScreenWidth, info.iScreenHeight,
- info.fRefreshRate, g_localizeStrings.Get(244), strStatus);
+ {
+ resInfo =
+ StringUtils::Format("{} {}x{}@{:.2f} - {}", g_localizeStrings.Get(13287), info.iScreenWidth,
+ info.iScreenHeight, info.fRefreshRate, g_localizeStrings.Get(244));
+ }
else
- strText = StringUtils::Format("{}x{} - {} | {}", info.iScreenWidth, info.iScreenHeight,
- g_localizeStrings.Get(242), strStatus);
-
- SET_CONTROL_LABEL(CONTROL_LABEL_ROW1, strText);
+ {
+ resInfo = StringUtils::Format("{} {}x{} - {}", g_localizeStrings.Get(13287), info.iScreenWidth,
+ info.iScreenHeight, g_localizeStrings.Get(242));
+ }
+ SET_CONTROL_LABEL(CONTROL_LABEL_RES, resInfo);
}
void CGUIWindowSettingsScreenCalibration::FrameMove()
@@ -386,8 +518,9 @@ void CGUIWindowSettingsScreenCalibration::FrameMove()
}
else
{
- SET_CONTROL_LABEL(CONTROL_LABEL_ROW1, "");
- SET_CONTROL_LABEL(CONTROL_LABEL_ROW2, "");
+ SET_CONTROL_LABEL(CONTROL_LABEL_DESCRIPTION, "");
+ SET_CONTROL_LABEL(CONTROL_LABEL_VALUE, "");
+ SET_CONTROL_LABEL(CONTROL_LABEL_RES, "");
}
CGUIWindow::FrameMove();
}
@@ -396,9 +529,8 @@ void CGUIWindowSettingsScreenCalibration::DoProcess(unsigned int currentTime, CD
{
MarkDirtyRegion();
- for (int i = CONTROL_TOP_LEFT; i <= CONTROL_PIXEL_RATIO; i++)
+ for (int i = CONTROL_TOP_LEFT; i <= CONTROL_RESET; i++)
SET_CONTROL_HIDDEN(i);
-
m_needsScaling = true;
CGUIWindow::DoProcess(currentTime, dirtyregions);
m_needsScaling = false;
@@ -407,7 +539,7 @@ void CGUIWindowSettingsScreenCalibration::DoProcess(unsigned int currentTime, CD
CServiceBroker::GetWinSystem()->GetGfxContext().AddGUITransform();
// process the movers etc.
- for (int i = CONTROL_TOP_LEFT; i <= CONTROL_PIXEL_RATIO; i++)
+ for (int i = CONTROL_TOP_LEFT; i <= CONTROL_RESET; i++)
{
SET_CONTROL_VISIBLE(i);
CGUIControl *control = GetControl(i);
diff --git a/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.h b/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.h
index 6f702c2fd2..5b74fce5a1 100644
--- a/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.h
+++ b/xbmc/settings/windows/GUIWindowSettingsScreenCalibration.h
@@ -10,6 +10,8 @@
#include "guilib/GUIWindow.h"
+#include <map>
+#include <utility>
#include <vector>
class CGUIWindowSettingsScreenCalibration : public CGUIWindow
@@ -31,8 +33,13 @@ protected:
void ResetControls();
void EnableControl(int iControl);
void UpdateFromControl(int iControl);
+ void ResetCalibration();
unsigned int m_iCurRes;
std::vector<RESOLUTION> m_Res;
int m_iControl;
float m_fPixelRatioBoxHeight;
+
+private:
+ std::map<int, std::pair<float, float>> m_controlsSize;
+ int m_subtitlesHalfSpace{0};
};