aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--language/English/strings.xml1
-rw-r--r--xbmc/GUISettings.cpp4
-rw-r--r--xbmc/GUISettings.h6
-rw-r--r--xbmc/GUIWindowSettingsCategory.cpp132
-rw-r--r--xbmc/GUIWindowSettingsCategory.h3
5 files changed, 125 insertions, 21 deletions
diff --git a/language/English/strings.xml b/language/English/strings.xml
index f75b8679cd..acf10065d3 100644
--- a/language/English/strings.xml
+++ b/language/English/strings.xml
@@ -190,6 +190,7 @@
<string id="237">Minification</string>
<string id="238">Magnification</string>
<string id="239">Clear playlist on finish</string>
+ <string id="240">Display Mode</string>
<string id="247">Scripts</string>
<string id="248">Language</string>
diff --git a/xbmc/GUISettings.cpp b/xbmc/GUISettings.cpp
index a20acc8bcc..a8eb5eef2b 100644
--- a/xbmc/GUISettings.cpp
+++ b/xbmc/GUISettings.cpp
@@ -361,7 +361,9 @@ void CGUISettings::Initialize()
// System settings
AddGroup(4, 13000);
CSettingsCategory* vs = AddCategory(4, "videoscreen", 21373);
-#if defined(_WIN32) || defined (__APPLE__)
+ // this setting would ideally not be saved, as its value is systematically derived from videoscreen.screenmode.
+ AddInt(vs, "videoscreen.screen", 240, 0, -1, 1, g_Windowing.GetNumScreens(), SPIN_CONTROL_TEXT);
+#if defined (__APPLE__)
AddString(vs, "videoscreen.screenmode", 131, "DESKTOP", SPIN_CONTROL_TEXT);
#else
AddString(vs, "videoscreen.screenmode", 169, "DESKTOP", SPIN_CONTROL_TEXT);
diff --git a/xbmc/GUISettings.h b/xbmc/GUISettings.h
index b992de53cf..51ae44d5d9 100644
--- a/xbmc/GUISettings.h
+++ b/xbmc/GUISettings.h
@@ -178,6 +178,12 @@ enum PowerState
POWERSTATE_ASK
};
+typedef int DisplayMode;
+#define DM_WINDOWED -1
+#define DM_FULLSCREEN1 0
+#define DM_FULLSCREEN2 1
+// etc.
+
// replay gain settings struct for quick access by the player multiple
// times per second (saves doing settings lookup)
struct ReplayGainSettings
diff --git a/xbmc/GUIWindowSettingsCategory.cpp b/xbmc/GUIWindowSettingsCategory.cpp
index d5ef17fe3a..2ad8c5b116 100644
--- a/xbmc/GUIWindowSettingsCategory.cpp
+++ b/xbmc/GUIWindowSettingsCategory.cpp
@@ -479,6 +479,10 @@ void CGUIWindowSettingsCategory::CreateSettings()
pControl->SetValue(myTimezoneIndex);
}
#endif
+ else if (strSetting.Equals("videoscreen.screen"))
+ {
+ FillInScreens(strSetting, g_guiSettings.GetResolution());
+ }
else if (strSetting.Equals("videoscreen.screenmode"))
{
FillInResolutions(pSetting);
@@ -613,6 +617,12 @@ void CGUIWindowSettingsCategory::UpdateSettings()
}
}
#endif
+ else if (strSetting.Equals("videoscreen.screenmode"))
+ {
+ CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
+ if (pControl)
+ pControl->SetEnabled(g_settings.m_ResInfo[g_guiSettings.GetResolution()].bFullScreen);
+ }
else if (strSetting.Equals("videoscreen.fakefullscreen"))
{
CGUIControl *pControl = (CGUIControl *)GetControl(pSettingControl->GetID());
@@ -1437,23 +1447,44 @@ void CGUIWindowSettingsCategory::OnSettingChanged(CBaseSettingControl *pSettingC
{
g_Mouse.SetEnabled(g_guiSettings.GetBool("input.enablemouse"));
}
+ else if (strSetting.Equals("videoscreen.screen"))
+ {
+ DisplayMode mode = g_guiSettings.GetInt("videoscreen.screen");
+
+ // Cascade
+ FillInResolutionsInternal("videoscreen.screenmode", mode);
+
+ // Auto-select the windowed or desktop resolution of the screen
+ int autoresolution = RES_DESKTOP;
+ if (mode == DM_WINDOWED)
+ {
+ autoresolution = RES_WINDOW;
+ }
+ else
+ {
+ for (int idx=0; idx < g_Windowing.GetNumScreens(); idx++)
+ if (g_settings.m_ResInfo[RES_DESKTOP + idx].iScreen == mode)
+ {
+ autoresolution = RES_DESKTOP + idx;
+ break;
+ }
+ }
+
+ // force the resolution and the settings changed event
+ CBaseSettingControl *control = GetSetting("videoscreen.screenmode");
+ CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(control->GetID());
+ pControl->SetValue(autoresolution);
+
+ OnResolutionChanged((RESOLUTION)autoresolution);
+ }
else if (strSetting.Equals("videoscreen.screenmode"))
{ // new resolution choosen... - update if necessary
int iControlID = pSettingControl->GetID();
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControlID);
g_windowManager.SendMessage(msg);
RESOLUTION nextRes = (RESOLUTION)msg.GetParam1();
- RESOLUTION lastRes = g_graphicsContext.GetVideoResolution();
- g_guiSettings.SetResolution(nextRes);
- g_graphicsContext.SetVideoResolution(nextRes);
- bool cancelled = false;
- if (!CGUIDialogYesNo::ShowAndGetInput(13110, 13111, 20022, 20022, -1, -1, cancelled, 10000))
- {
- g_guiSettings.SetResolution(lastRes);
- g_graphicsContext.SetVideoResolution(lastRes);
- CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(pSettingControl->GetID());
- pControl->SetValue(g_guiSettings.GetResolution());
- }
+
+ OnResolutionChanged(nextRes);
}
else if (strSetting.Equals("videoscreen.vsync"))
{
@@ -2246,24 +2277,85 @@ void CGUIWindowSettingsCategory::FillInCharSets(CSetting *pSetting)
pControl->SetValue(iCurrentCharset);
}
+DisplayMode CGUIWindowSettingsCategory::FillInScreens(CStdString strSetting, RESOLUTION res)
+{
+ CBaseSettingControl *control = GetSetting(strSetting);
+ control->SetDelayed();
+ CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(control->GetID());
+ pControl->Clear();
+
+ CStdString strScreen;
+ pControl->AddLabel(g_settings.m_ResInfo[RES_WINDOW].strMode, -1);
+
+ for (int idx = 0; idx < g_Windowing.GetNumScreens(); idx++)
+ {
+ //TODO: add a string for translation
+ strScreen.Format("%s #%d", "Full Screen", g_settings.m_ResInfo[RES_DESKTOP + idx].iScreen + 1);
+ pControl->AddLabel(strScreen, g_settings.m_ResInfo[RES_DESKTOP + idx].iScreen);
+ }
+
+ DisplayMode mode;
+
+ if (res == RES_WINDOW)
+ mode = DM_WINDOWED;
+ else
+ mode = g_settings.m_ResInfo[res].iScreen;
+
+ pControl->SetValue(mode);
+ g_guiSettings.SetInt("videoscreen.screen", mode);
+ return mode;
+}
+
void CGUIWindowSettingsCategory::FillInResolutions(CSetting *pSetting)
{
- CSettingString *pSettingString = (CSettingString*)pSetting;
+ FillInResolutionsInternal(pSetting->GetSetting(), g_guiSettings.GetInt("videoscreen.screen"));
CBaseSettingControl *control = GetSetting(pSetting->GetSetting());
+ CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(control->GetID());
+ pControl->SetValue(CGUISettings::GetResFromString(((CSettingString*) pSetting)->GetData()));
+}
+
+void CGUIWindowSettingsCategory::FillInResolutionsInternal(CStdString strSetting, DisplayMode mode)
+{
+ CBaseSettingControl *control = GetSetting(strSetting);
control->SetDelayed();
CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(control->GetID());
pControl->Clear();
- pControl->AddLabel(g_settings.m_ResInfo[RES_WINDOW].strMode, RES_WINDOW);
- pControl->AddLabel(g_settings.m_ResInfo[RES_DESKTOP].strMode, RES_DESKTOP);
- size_t maxRes = g_settings.m_ResInfo.size();
- if (g_Windowing.GetNumScreens())
- maxRes = std::min(maxRes, (size_t)RES_DESKTOP + g_Windowing.GetNumScreens());
- for (size_t i = RES_CUSTOM ; i < maxRes; i++)
+ if (mode == DM_WINDOWED)
{
- pControl->AddLabel(g_settings.m_ResInfo[i].strMode, i);
+ pControl->AddLabel(g_settings.m_ResInfo[RES_WINDOW].strMode, RES_WINDOW);
}
- pControl->SetValue(CGUISettings::GetResFromString(pSettingString->GetData()));
+ else
+ {
+ for (unsigned int idx = RES_DESKTOP; idx < g_settings.m_ResInfo.size(); idx++)
+ if (g_settings.m_ResInfo[idx].iScreen == mode)
+ {
+ CStdString strRes;
+ strRes.Format("%dx%d", g_settings.m_ResInfo[idx].iWidth, g_settings.m_ResInfo[idx].iHeight);
+ if (g_settings.m_ResInfo[idx].fRefreshRate > 0)
+ strRes.Format("%s @ %.2f%s", strRes, g_settings.m_ResInfo[idx].fRefreshRate, g_settings.m_ResInfo[idx].dwFlags & D3DPRESENTFLAG_INTERLACED ? "i" : "");
+ pControl->AddLabel(strRes, idx);
+ }
+ }
+}
+
+void CGUIWindowSettingsCategory::OnResolutionChanged(RESOLUTION nextRes)
+{
+ RESOLUTION lastRes = g_graphicsContext.GetVideoResolution();
+ g_guiSettings.SetResolution(nextRes);
+ g_graphicsContext.SetVideoResolution(nextRes);
+ bool cancelled = false;
+ if (!CGUIDialogYesNo::ShowAndGetInput(13110, 13111, 20022, 20022, -1, -1, cancelled, 10000))
+ {
+ g_guiSettings.SetResolution(lastRes);
+ g_graphicsContext.SetVideoResolution(lastRes);
+
+ DisplayMode mode = FillInScreens("videoscreen.screen", lastRes);
+ FillInResolutionsInternal("videoscreen.screenmode", mode);
+ CBaseSettingControl *control = GetSetting("videoscreen.screenmode");
+ CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(control->GetID());
+ pControl->SetValue(g_guiSettings.GetResolution());
+ }
}
void CGUIWindowSettingsCategory::FillInLanguages(CSetting *pSetting)
diff --git a/xbmc/GUIWindowSettingsCategory.h b/xbmc/GUIWindowSettingsCategory.h
index f5f2a76685..456ade51f6 100644
--- a/xbmc/GUIWindowSettingsCategory.h
+++ b/xbmc/GUIWindowSettingsCategory.h
@@ -48,7 +48,10 @@ protected:
void FillInSkinFonts(CSetting *pSetting);
void FillInSoundSkins(CSetting *pSetting);
void FillInLanguages(CSetting *pSetting);
+ DisplayMode FillInScreens(CStdString strSetting, RESOLUTION res);
void FillInResolutions(CSetting *pSetting);
+ void FillInResolutionsInternal(CStdString strSetting, DisplayMode mode);
+ void OnResolutionChanged(RESOLUTION resolution);
void FillInRegions(CSetting *pSetting);
void FillInStartupWindow(CSetting *pSetting);
void FillInViewModes(CSetting *pSetting, int windowID);