summaryrefslogtreecommitdiff
path: root/src/touchmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-01 01:41:48 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-01 01:42:56 +0300
commit6915c38ca9c35bfb9a5ea05fe957463d644a75de (patch)
tree9f7473433b42078dcb2d22b9a04dac1b014c89d0 /src/touchmanager.cpp
parent251c9cccce6252238797bc4ac782175dd0aeb42e (diff)
downloadmv-6915c38ca9c35bfb9a5ea05fe957463d644a75de.tar.gz
mv-6915c38ca9c35bfb9a5ea05fe957463d644a75de.tar.bz2
mv-6915c38ca9c35bfb9a5ea05fe957463d644a75de.tar.xz
mv-6915c38ca9c35bfb9a5ea05fe957463d644a75de.zip
Add on screen buttons layout 3x3, 4x2, 4x3
Diffstat (limited to 'src/touchmanager.cpp')
-rw-r--r--src/touchmanager.cpp152
1 files changed, 124 insertions, 28 deletions
diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp
index 19dca23f9..ad958ba82 100644
--- a/src/touchmanager.cpp
+++ b/src/touchmanager.cpp
@@ -374,35 +374,131 @@ void TouchManager::loadButtons()
const int x = skin->getOption("x", 10);
const int y = skin->getOption("y", 10);
const int pad = skin->getPadding();
- const int pad2 = 2 * pad;
- const int skipWidth = pad2 + sz + x;
- const int skipHeight = pad2 + sz + y;
+ const int pad2 = 2 * pad + sz;
+ const int skipWidth = pad2 + x;
+ const int skipHeight = pad2 + y;
- // 2x1
- if (mButtonsFormat == 0)
+ switch (mButtonsFormat)
{
- loadTouchItem(&mButtons[1], "dbutton.xml", "dbutton_image.xml",
- x, y, sz, sz, RIGHT, "screenActionButton1", "");
-
- loadTouchItem(&mButtons[0], "dbutton.xml", "dbutton_image.xml",
- skipWidth, y, sz, sz, RIGHT, "screenActionButton0", "");
- }
- // 2x2
- else if (mButtonsFormat == 1)
- {
- loadTouchItem(&mButtons[3], "dbutton.xml", "dbutton_image.xml",
- x, y, sz, sz, RIGHT, "screenActionButton3", "");
-
- loadTouchItem(&mButtons[2], "dbutton.xml", "dbutton_image.xml",
- skipWidth, y, sz, sz, RIGHT, "screenActionButton2", "");
-
- loadTouchItem(&mButtons[1], "dbutton.xml", "dbutton_image.xml",
- x, skipHeight, sz, sz, RIGHT, "screenActionButton1", "");
-
- loadTouchItem(&mButtons[0], "dbutton.xml", "dbutton_image.xml",
- skipWidth, skipHeight, sz, sz, RIGHT,
- "screenActionButton0", "");
- }
+ // 2x1
+ case 0:
+ {
+ loadTouchItem(&mButtons[1], "dbutton.xml", "dbutton_image.xml",
+ x, y, sz, sz, RIGHT, "screenActionButton1", "");
+ loadTouchItem(&mButtons[0], "dbutton.xml", "dbutton_image.xml",
+ skipWidth, y, sz, sz, RIGHT, "screenActionButton0", "");
+ break;
+ }
+ // 2x2
+ case 1:
+ {
+ loadTouchItem(&mButtons[3], "dbutton.xml", "dbutton_image.xml",
+ x, y, sz, sz, RIGHT, "screenActionButton3", "");
+ loadTouchItem(&mButtons[2], "dbutton.xml", "dbutton_image.xml",
+ skipWidth, y, sz, sz, RIGHT, "screenActionButton2", "");
+ loadTouchItem(&mButtons[1], "dbutton.xml", "dbutton_image.xml",
+ x, skipHeight, sz, sz, RIGHT, "screenActionButton1", "");
+ loadTouchItem(&mButtons[0], "dbutton.xml", "dbutton_image.xml",
+ skipWidth, skipHeight, sz, sz, RIGHT,
+ "screenActionButton0", "");
+ break;
+ }
+ // 3x3
+ case 2:
+ {
+ const int pad4 = pad2 * 2;
+ const int skipWidth2 = pad4 + x;
+ const int skipHeight2 = pad4 + y;
+ loadTouchItem(&mButtons[8], "dbutton.xml", "dbutton_image.xml",
+ x, y, sz, sz, RIGHT, "screenActionButton8", "");
+ loadTouchItem(&mButtons[7], "dbutton.xml", "dbutton_image.xml",
+ skipWidth, y, sz, sz, RIGHT, "screenActionButton7", "");
+ loadTouchItem(&mButtons[6], "dbutton.xml", "dbutton_image.xml",
+ skipWidth2, y, sz, sz, RIGHT, "screenActionButton6", "");
+ loadTouchItem(&mButtons[5], "dbutton.xml", "dbutton_image.xml",
+ x, skipHeight, sz, sz, RIGHT, "screenActionButton5", "");
+ loadTouchItem(&mButtons[4], "dbutton.xml", "dbutton_image.xml",
+ skipWidth, skipHeight, sz, sz, RIGHT,
+ "screenActionButton4", "");
+ loadTouchItem(&mButtons[3], "dbutton.xml", "dbutton_image.xml",
+ skipWidth2, skipHeight, sz, sz, RIGHT,
+ "screenActionButton3", "");
+ loadTouchItem(&mButtons[2], "dbutton.xml", "dbutton_image.xml",
+ x, skipHeight2, sz, sz, RIGHT, "screenActionButton2", "");
+ loadTouchItem(&mButtons[1], "dbutton.xml", "dbutton_image.xml",
+ skipWidth, skipHeight2, sz, sz, RIGHT,
+ "screenActionButton1", "");
+ loadTouchItem(&mButtons[0], "dbutton.xml", "dbutton_image.xml",
+ skipWidth2, skipHeight2, sz, sz, RIGHT,
+ "screenActionButton0", "");
+ break;
+ }
+ // 4x2
+ case 3:
+ {
+ const int skipWidth2 = pad2 * 2 + x;
+ const int skipWidth3 = pad2 * 3 + x;
+ loadTouchItem(&mButtons[7], "dbutton.xml", "dbutton_image.xml",
+ x, y, sz, sz, RIGHT, "screenActionButton7", "");
+ loadTouchItem(&mButtons[6], "dbutton.xml", "dbutton_image.xml",
+ skipWidth, y, sz, sz, RIGHT, "screenActionButton6", "");
+ loadTouchItem(&mButtons[5], "dbutton.xml", "dbutton_image.xml",
+ skipWidth2, y, sz, sz, RIGHT, "screenActionButton5", "");
+ loadTouchItem(&mButtons[4], "dbutton.xml", "dbutton_image.xml",
+ skipWidth3, y, sz, sz, RIGHT, "screenActionButton4", "");
+ loadTouchItem(&mButtons[3], "dbutton.xml", "dbutton_image.xml",
+ x, skipHeight, sz, sz, RIGHT, "screenActionButton3", "");
+ loadTouchItem(&mButtons[2], "dbutton.xml", "dbutton_image.xml",
+ skipWidth, skipHeight, sz, sz, RIGHT,
+ "screenActionButton2", "");
+ loadTouchItem(&mButtons[1], "dbutton.xml", "dbutton_image.xml",
+ skipWidth2, skipHeight, sz, sz, RIGHT,
+ "screenActionButton1", "");
+ loadTouchItem(&mButtons[0], "dbutton.xml", "dbutton_image.xml",
+ skipWidth3, skipHeight, sz, sz, RIGHT,
+ "screenActionButton0", "");
+ break;
+ }
+ // 4x3
+ case 4:
+ {
+ const int skipWidth2 = pad2 * 2 + x;
+ const int skipWidth3 = pad2 * 3 + x;
+ const int skipHeight2 = pad2 * 2 + y;
+ loadTouchItem(&mButtons[11], "dbutton.xml",
+ "dbutton_image.xml", x, y, sz, sz, RIGHT,
+ "screenActionButton11", "");
+ loadTouchItem(&mButtons[10], "dbutton.xml", "dbutton_image.xml",
+ skipWidth, y, sz, sz, RIGHT, "screenActionButton10", "");
+ loadTouchItem(&mButtons[9], "dbutton.xml", "dbutton_image.xml",
+ skipWidth2, y, sz, sz, RIGHT, "screenActionButton9", "");
+ loadTouchItem(&mButtons[8], "dbutton.xml", "dbutton_image.xml",
+ skipWidth3, y, sz, sz, RIGHT, "screenActionButton8", "");
+ loadTouchItem(&mButtons[7], "dbutton.xml", "dbutton_image.xml",
+ x, skipHeight, sz, sz, RIGHT, "screenActionButton7", "");
+ loadTouchItem(&mButtons[6], "dbutton.xml", "dbutton_image.xml",
+ skipWidth, skipHeight, sz, sz, RIGHT,
+ "screenActionButton6", "");
+ loadTouchItem(&mButtons[5], "dbutton.xml", "dbutton_image.xml",
+ skipWidth2, skipHeight, sz, sz, RIGHT,
+ "screenActionButton5", "");
+ loadTouchItem(&mButtons[4], "dbutton.xml", "dbutton_image.xml",
+ skipWidth3, skipHeight, sz, sz, RIGHT,
+ "screenActionButton4", "");
+ loadTouchItem(&mButtons[3], "dbutton.xml", "dbutton_image.xml",
+ x, skipHeight2, sz, sz, RIGHT, "screenActionButton3", "");
+ loadTouchItem(&mButtons[2], "dbutton.xml", "dbutton_image.xml",
+ skipWidth, skipHeight2, sz, sz, RIGHT,
+ "screenActionButton2", "");
+ loadTouchItem(&mButtons[1], "dbutton.xml", "dbutton_image.xml",
+ skipWidth2, skipHeight2, sz, sz, RIGHT,
+ "screenActionButton1", "");
+ loadTouchItem(&mButtons[0], "dbutton.xml", "dbutton_image.xml",
+ skipWidth3, skipHeight2, sz, sz, RIGHT,
+ "screenActionButton0", "");
+ break;
+ }
+ };
theme->unload(skin);
}
}
@@ -482,7 +578,7 @@ void TouchManager::optionChanged(const std::string &value)
if (mButtonsFormat == config.getIntValue("screenButtonsFormat"))
return;
mButtonsFormat = config.getIntValue("screenButtonsFormat");
- if (mButtonsFormat)
+ if (mShowButtons)
{
for (int f = 0; f < buttonsCount; f ++)
unloadTouchItem(&mButtons[f]);