// September 2015 // Levee Patroller / Dijk Patrouille // This source file is (c) by Deltares. This source file is open source but only available to select users. Do not redistribute without written permission of Stichting Deltares, Delft, The Netherlands. // This header has been automatically generated. //============================================================================= // // ------------------------------------------------------------ // © 2006, Geodelft // // Date Id Modification // 2006-10-07 The Created this header // 2006-10-08 The Implemented Dutch translations // 2007-06-15 Zmr Implemented detail settings // 2008-02-12 wsl Corrected English texts //============================================================================= class Tab_VideoSettings extends GUITabPanel; #exec OBJ LOAD FILE=GUIContent.utx #exec OBJ LOAD FILE=GeoDelft.utx var localized string NL_ResolutionCaption, EN_ResolutionCaption, NL_ResolutionHint, EN_ResolutionHint, NL_ColorDepthCaption, EN_ColorDepthCaption, NL_FullScreenCaption, EN_FullScreenCaption, NL_FullScreenHint, EN_FullScreenHint, NL_ApplyCaption, EN_ApplyCaption, NL_ApplyHint, EN_ApplyHint, NL_DetailCaption, NL_DetailHint, EN_DetailCaption, EN_DetailHint; var bool ShowSShot; var GeoPlayerController GeoPC; struct DisplayMode { var int Width, Height; }; var float ButtonHGap, SButtonSize, ButtonVGapLarge, ButtonVGapSmall, moComboBoxHSize; var DisplayMode DisplayModes[8]; var String EN_DetailMode[3], NL_DetailMode[3]; //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function UpdateLanguage() { local int i; if (GeoPC.Dutch) { moCheckBox(Controls[1]).MyLabel.Caption = NL_FullScreenCaption; moCheckBox(Controls[1]).MyCheckBox.Hint = NL_FullScreenHint; GUIButton(Controls[2]).Caption = NL_ApplyCaption; GUIButton(Controls[2]).Hint = NL_ApplyHint; moComboBox(Controls[3]).MyLabel.Caption = NL_DetailCaption; moComboBox(Controls[3]).MyComboBox.SetHint(NL_DetailHint); for(i = 0;i<3;i++) { moComboBox(Controls[3]).AddItem(NL_DetailMode[i]); } // this is the first one on screen; this seems to make sure it gets focus (turns yellow) moComboBox(Controls[0]).MyLabel.Caption = NL_ResolutionCaption; moComboBox(Controls[0]).MyComboBox.SetHint(NL_ResolutionHint); } else { moCheckBox(Controls[1]).MyLabel.Caption = EN_FullScreenCaption; moCheckBox(Controls[1]).MyCheckBox.Hint = EN_FullScreenHint; GUIButton(Controls[2]).Caption = EN_ApplyCaption; GUIButton(Controls[2]).Hint = EN_ApplyHint; moComboBox(Controls[3]).MyLabel.Caption = EN_DetailCaption; moComboBox(Controls[3]).MyComboBox.SetHint(EN_DetailHint); for(i = 0;i<3;i++) { moComboBox(Controls[3]).AddItem(EN_DetailMode[i]); } // this is the first one on screen; this seems to make sure it gets focus (turns yellow) moComboBox(Controls[0]).MyLabel.Caption = EN_ResolutionCaption; moComboBox(Controls[0]).MyComboBox.SetHint(EN_ResolutionHint); } } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function InitComponent(GUIController MyController, GUIComponent MyOwner) { local int i; Super.Initcomponent(MyController, MyOwner); GeoPC = GeoPlayerController(PlayerOwner()); for (i=0;i 0) moComboBox(Controls[0]).RemoveItem(0,moComboBox(Controls[0]).ItemCount()); // Don't let user create non-fullscreen window bigger than highest // supported resolution, or MacOS X client crashes. --ryan. if(!moCheckBox(Controls[1]).IsChecked()) // Controls[2] == fs toggle. { log("TabVideoSettingsChechSupportedResolutions2"); HighestRes = 0; for(Index = 0;Index < ArrayCount(DisplayModes);Index++) { log("TabVideoSettingsChechSupportedResolutions3"); if (PlayerOwner().ConsoleCommand( "SupportedResolution"$ " WIDTH="$DisplayModes[Index].Width$ " HEIGHT="$DisplayModes[Index].Height$ " BITDEPTH="$BitDepth) == "1") { log("TabVideoSettingsChechSupportedResolutions4 index:"@Index); HighestRes = Index; // biggest resolution hardware supports. }else { log("SupportedResolution"$ " WIDTH="$DisplayModes[Index].Width$ " HEIGHT="$DisplayModes[Index].Height$ " BITDEPTH="$BitDepth); } } for(Index = 0;Index <= HighestRes;Index++) { log("TabVideoSettingsChechSupportedResolutions5"); moComboBox(Controls[0]).AddItem(DisplayModes[Index].Width$"x"$DisplayModes[Index].Height); } } else // Set dropdown for fullscreen modes... { log("TabVideoSettingsChechSupportedResolutions6"); for(Index = 0;Index < ArrayCount(DisplayModes);Index++) { log("TabVideoSettingsChechSupportedResolutions7"); if (PlayerOwner().ConsoleCommand( "SupportedResolution"$ " WIDTH="$DisplayModes[Index].Width$ " HEIGHT="$DisplayModes[Index].Height$ " BITDEPTH="$BitDepth) == "1") { moComboBox(Controls[0]).AddItem(DisplayModes[Index].Width$"x"$DisplayModes[Index].Height); log("TabVideoSettingsChechSupportedResolutions8"); } } } log("TabVideoSettingsChechSupportedResolutions9"); moComboBox(Controls[0]).SetText(CurrentSelection); } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function CheckDetailSettings() { if(GeoPC.DetailSetting == "Low") { moComboBox(Controls[3]).SetText(moComboBox(Controls[3]).GetItem(0)); }else if(GeoPC.DetailSetting == "Medium") { moComboBox(Controls[3]).SetText(moComboBox(Controls[3]).GetItem(1)); }else { // GeoPC.DetailSettings are High or not set moComboBox(Controls[3]).SetText(moComboBox(Controls[3]).GetItem(2)); } } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function Refresh() { InternalOnLoadINI(Controls[0],""); InternalOnLoadINI(Controls[1],""); InternalOnLoadINI(Controls[2],""); } //============================================================================= // Date Id Modification // 2007-06-15 The Created this header //============================================================================= event Opened(GUIComponent Sender) { Super.Opened(Sender); refresh(); moComboBox(Controls[0]).MyLabel.SetFocus(None); } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function InternalOnLoadINI(GUIComponent Sender, string s) { local string temp; if (Sender==Controls[0]) { // Resolution if(Controller.GameResolution != "") moComboBox(Controls[0]).SetText(Controller.GameResolution); else moComboBox(Controls[0]).SetText(Controller.GetCurrentRes()); } else if (Sender==Controls[1]) { Temp = Sender.PlayerOwner().ConsoleCommand("ISFULLSCREEN"); moCheckBox(Sender).Checked(bool(Temp)); CheckSupportedResolutions(); } else if (Sender == Controls[2]) { CheckDetailSettings(); } } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= //function string InternalOnSaveINI(GUIComponent Sender); // Do the actual work here //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function InternalOnChange(GUIComponent Sender) { if (!Controller.bCurMenuInitialized) return; if (Sender==Controls[0] || Sender==Controls[1] || Sender == Controls[3]) { Controls[2].bVisible=true; if(Sender != Controls[0]) CheckSupportedResolutions(); } } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header // 2008-01-16 Jln Function first checks if a previous VideoChangeOK is already open, if so, replaces it. //============================================================================= function bool ApplyChanges(GUIComponent Sender) { local int i; local bool found; local GUIPage page; local string DesiredRes,DesiredDetail; DesiredRes = moComboBox(Controls[0]).MyComboBox.Edit.GetText(); DesiredRes=DesiredRes$"x32"; if(moComboBox(Controls[3]).GetIndex()==0) { DesiredDetail="Low"; } else if(moComboBox(Controls[3]).GetIndex()==1) { DesiredDetail="Medium" ; } else if(moComboBox(Controls[3]).GetIndex()==2) { DesiredDetail="High"; } if (moCheckBox(Controls[1]).IsChecked()) DesiredRes=DesiredRes$"f"; else DesiredRes=DesiredRes$"w"; Controls[2].bVisible=false; /// Replace any videochangeok windows which MIGHT already be visible. found = false; for (i = 0; i < Controller.MenuStack.Length; i++ ) { if (Controller.MenuStack[i].class == class'GeoInterface.VideoChangeOK') { found = true; page = Controller.MenuStack[i]; } } /// The menu was found before: if (found == true) { /// Focus confirmation menu again page.SetFocus(none); /// Replace menu: if ( Controller.ReplaceMenu("GeoInterface.VideoChangeOK") ) VideoChangeOK(Controller.TopPage()).Execute(DesiredRes,DesiredDetail); } else { if ( Controller.OpenMenu("GeoInterface.VideoChangeOK") ) VideoChangeOK(Controller.TopPage()).Execute(DesiredRes,DesiredDetail); } return true; } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= function bool SetRadioButtons(GUIComponent Sender) { if(Sender == moCheckBox(Controls[1]).MyCheckBox || Sender == moCheckBox(Controls[1]).MyLabel) { moCheckBox(Controls[1]).Checked(!moCheckBox(Controls[1]).bChecked); } return true; } //============================================================================= // Date Id Modification // 2006-10-07 The Created this header //============================================================================= defaultproperties { Begin Object class=moComboBox Name=VideoResolution Caption="Resolution" INIOption="@INTERNAL" INIDefault="640x480" //OnLoadINI=InternalOnLoadINI //OnSaveINI=InternalOnSaveINI Hint="Select the video resolution at which you wish to use." //bReadOnly=true CaptionWidth=0.45 bReadOnly=true TabOrder=0 End Object Controls(0)=moComboBox'VideoResolution' Begin Object class=moCheckBox Name=VideoFullScreen Caption="Full Screen" INIOption="@Internal" INIDefault="True" //OnLoadINI=InternalOnLoadINI //OnSaveINI=InternalOnSaveINI Hint="Check this box to run full screen." bSquare=true ComponentJustification=TXTA_Left CaptionWidth=0.8 TabOrder=1 End Object Controls(1)=moCheckBox'VideoFullScreen' Begin Object class=GUIButton Name=VideoApply Caption="Apply Changes" Hint="Apply all changes to your video settings." bVisible=true OnClick=ApplyChanges TabOrder=3 End Object Controls(2)=GUIButton'VideoApply' Begin Object class=moComboBox Name=DetailSettings Caption="Resolution" INIOption="@INTERNAL" INIDefault="640x480" //OnLoadINI=InternalOnLoadINI //OnSaveINI=InternalOnSaveINI Hint="Select the video resolution at which you wish to use." bReadOnly=true CaptionWidth=0.45 TabOrder=2 End Object Controls(3)=moComboBox'DetailSettings' ButtonHGap=0.03 SButtonSize=0.05 ButtonVGapLarge=0.027 ButtonVGapSmall=0.018 moComboBoxHSize=0.4 WinTop=0.15 WinLeft=0 WinWidth=1 WinHeight=0.74 bAcceptsInput=false // DisplayModes(0)=(Width=320,Height=240) // DisplayModes(1)=(Width=512,Height=384) // DisplayModes(2)=(Width=640,Height=480) // DisplayModes(3)=(Width=800,Height=600) // DisplayModes(4)=(Width=1024,Height=640) DisplayModes(0)=(Width=1024,Height=768) DisplayModes(1)=(Width=1152,Height=864) DisplayModes(2)=(Width=1280,Height=800) DisplayModes(3)=(Width=1280,Height=960) DisplayModes(4)=(Width=1280,Height=1024) DisplayModes(5)=(Width=1600,Height=1200) DisplayModes(6)=(Width=1680,Height=1050) DisplayModes(7)=(Width=1920,Height=1200) EN_DetailMode(0) = "Low" EN_DetailMode(1) = "Medium" EN_DetailMode(2) = "High" NL_DetailMode(0) = "Laag" NL_DetailMode(1) = "Gemiddeld" NL_DetailMode(2) = "Hoog" NL_ResolutionCaption = "Resolutie" NL_ResolutionHint = "Selecteer de videoresolutie die je wilt gebruiken." NL_FullScreenCaption = "Volledig scherm" NL_FullScreenHint = "Vink dit aan om in volledig scherm te spelen." NL_ApplyCaption = "Toepassen" NL_ApplyHint = "Pas alle video-instellingen toe." NL_DetailCaption = "Detail-instellingen" NL_DetailHint = "Hogere video-instellingen zijn mooier, maar laten het spel minder soepel lopen." EN_ResolutionCaption = "Resolution" EN_ResolutionHint = "Select the video resolution you wish to use." EN_FullScreenCaption = "Full Screen" EN_FullScreenHint = "Check this box to run the game full screen." EN_ApplyCaption = "Apply Changes" EN_ApplyHint = "Apply all changes to your video settings." EN_DetailCaption = "Detail Settings" EN_DetailHint = "Higher is more beautiful, but lower makes the game run smoother." }