[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[bos-dev] [PATCH] a bit more clever ``Video modes'' menu
- To: bos-dev@xxxxxxxx
- Subject: [bos-dev] [PATCH] a bit more clever ``Video modes'' menu
- From: Ivan Shmakov <oneingray@xxxxxxxxx>
- Date: Thu, 18 Jun 2009 11:47:26 +0700
- Cc: Ivan Shmakov <oneingray@xxxxxxxxx>
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: bos-dev-outgoing@xxxxxxxx
- Delivered-to: bos-dev@xxxxxxxx
- Delivery-date: Thu, 18 Jun 2009 00:47:50 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:subject:cc:to:date :message-id:user-agent:mime-version:content-type; bh=lSdJrWU9j98p3NkmRIXhkCwJyF6iCbyH9EluvGQV0jo=; b=DIpVt8weSI6zq7gCBorCWJM2VMT2tr+i/vaU+lCIecLHBsFmiirsL1EvGdBWei8I4n 4WazBG8DgPb5OID4l3p0HXxrS1QkeZphYJzWYuLvrEZlGJq/NpFjFD7lMsF0FQCfikWs xjD2xstX3D/QaORhotzyWOtOuYqSma5cUi/jY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:subject:cc:to:date:message-id:user-agent:mime-version :content-type; b=UDTHNt06XnZNcXyAyaa9dvlQqH1t1UJNID6Nw2KQP5rZaJr5X9km821XKqgzJv2eLj owTLBlOiLQZFnIERuzLLoTgqi98y87JSIdDJVrqN7MRMZiG2xeDGJjiG2cA14pMJxOQw Mlz+vfoMvvFkBz/1W7ZMn5PEA/Q2YI5KOiyGQ=
- Reply-to: bos-dev@xxxxxxxx
- Sender: owner-bos-dev@xxxxxxxx
- User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)
Please consider the following patch.
scripts/menus/options.lua (BuildVideoOptionsMenu): Rolled much of the
video modes selection code into a loop over a table; added `1280x1024'
and `1920x1080' modes to the list.
--- scripts/menus/options.lua (revision 9593)
+++ scripts/menus/options.lua (working copy)
@@ -179,49 +179,43 @@
local x2 = (Video.Width / 3) * 2 - 100
local offy = (Video.Height - 352) / 2
- b = menu:addRadioButton("640 x 480", "video", x1, offy + 36 * 1.5,
- function() SetVideoSize(640, 480) menu:stop(1) end)
- if Video.Width == 640 then
- b:setMarked(true)
- end
- b = menu:addRadioButton("800 x 600", "video", x1, offy + 36 * 2.5,
- function() SetVideoSize(800, 600) menu:stop(1) end)
- if Video.Width == 800 then
- b:setMarked(true)
- end
- b = menu:addRadioButton("1024 x 768", "video", x1, offy + 36 * 3.5,
- function() SetVideoSize(1024, 768) menu:stop(1) end)
- if Video.Width == 1024 then
- b:setMarked(true)
- end
- b = menu:addRadioButton("1600 x 1200", "video", x1, offy + 36 * 4.5,
- function() SetVideoSize(1600, 1200) menu:stop(1) end)
- if Video.Width == 1600 then
- b:setMarked(true)
- end
+ local modes = {
+ -- 4:3, 5:4 aspect ratio modes
+ { 640, 480 },
+ { 800, 600 },
+ { 1024, 768 },
+ { 1280, 1024 },
+ { 1600, 1200 },
+ -- 16:9, 8:5 (widescreen) aspect ratio modes
+ { 1280, 720 },
+ { 1440, 900 },
+ { 1680, 1050 },
+ { 1920, 1080 },
+ { 1920, 1200 }
+ }
- b = menu:addRadioButton("1280 x 720", "video", x2, offy + 36 * 1.5,
- function() SetVideoSize(1280, 720) menu:stop(1) end)
- if Video.Width == 1280 then
- b:setMarked(true)
+ local modes2 = math.ceil (#modes / 2);
+ local offybot = offy + 36 * modes2;
+
+ for i, size in ipairs (modes) do
+ local sx, sy = size[1], size[2];
+ local t = sx .. " x " .. sy;
+ local f = function ()
+ SetVideoSize (sx, sy);
+ menu:stop (1);
+ end;
+ local x;
+ if (i <= modes2) then x = x1; else x = x2; end;
+ local y1 = offy + 36 * (i + .5);
+ if (i <= modes2) then y = y1; else y = y1 - 36 * modes2; end;
+ local b = menu:addRadioButton (t, "video", x, y, f);
+
+ if (Video.Width == sx and Video.Height == sy) then
+ b:setMarked (true);
+ end
end
- b = menu:addRadioButton("1440 x 900", "video", x2, offy + 36 * 2.5,
- function() SetVideoSize(1440, 900) menu:stop(1) end)
- if Video.Width == 1440 then
- b:setMarked(true)
- end
- b = menu:addRadioButton("1680 x 1050", "video", x2, offy + 36 * 3.5,
- function() SetVideoSize(1680, 1050) menu:stop(1) end)
- if Video.Width == 1680 then
- b:setMarked(true)
- end
- b = menu:addRadioButton("1920 x 1200", "video", x2, offy + 36 * 4.5,
- function() SetVideoSize(1920, 1200) menu:stop(1) end)
- if Video.Width == 1920 then
- b:setMarked(true)
- end
- fullScreen = menu:addCheckBox(_("Fullscreen"), x1, offy + 36 * 5.5,
+ fullScreen = menu:addCheckBox(_("Fullscreen"), x1, offybot + 36 * 1.5,
function()
ToggleFullScreen()
preferences.VideoFullScreen = Video.FullScreen
@@ -229,7 +223,7 @@
end)
fullScreen:setMarked(Video.FullScreen)
- useopengl = menu:addCheckBox(_("Use OpenGL (restart required)"), x1, offy + 36 * 6.5,
+ useopengl = menu:addCheckBox(_("Use OpenGL (restart required)"), x1, offybot + 36 * 2.5,
function()
preferences.UseOpenGL = useopengl:isMarked()
SavePreferences()
--
FSF associate member #7257