aboutsummaryrefslogtreecommitdiff
path: root/src/Screen.cc
diff options
context:
space:
mode:
authorLajos Koszti <ajnasz@ajnasz.hu>2012-04-06 12:10:24 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2012-04-06 12:11:16 (GMT)
commit7b6dc2ad72a4c4ecd20eddbfb6f1b4c3bd2a7024 (patch)
treec2a8f4aa658783c6454b7643ce2717acaa744101 /src/Screen.cc
parent5d56046b68635cea2c187e59a9d8c514e2d6bdb2 (diff)
downloadfluxbox_paul-7b6dc2ad72a4c4ecd20eddbfb6f1b4c3bd2a7024.zip
fluxbox_paul-7b6dc2ad72a4c4ecd20eddbfb6f1b4c3bd2a7024.tar.bz2
Allow percentage values for some Window commands
Diffstat (limited to 'src/Screen.cc')
-rw-r--r--src/Screen.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index 4ea7afb..6757af0 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -1485,6 +1485,55 @@ void BScreen::addManagedResource(FbTk::Resource_base *resource) {
1485 m_managed_resources.push_back(resource); 1485 m_managed_resources.push_back(resource);
1486} 1486}
1487 1487
1488int BScreen::getGap(int head, const char type) {
1489 return type == 'w' ? getXGap(head) : getYGap(head);
1490}
1491
1492int BScreen::calRelativeSize(int head, int i, char type) {
1493 // return floor(i * getGap(head, type) / 100 + 0.5);
1494 return FbTk::RelCalcHelper::calPercentageValueOf(i, getGap(head, type));
1495}
1496int BScreen::calRelativeWidth(int head, int i) {
1497 return calRelativeSize(head, i, 'w');
1498}
1499int BScreen::calRelativeHeight(int head, int i) {
1500 return calRelativeSize(head, i, 'h');
1501}
1502
1503int BScreen::calRelativePosition(int head, int i, char type) {
1504 int max = type == 'w' ? maxLeft(head) : maxTop(head);
1505 // return floor((i - min) / getGap(head, type) * 100 + 0.5);
1506 return FbTk::RelCalcHelper::calPercentageOf((i - max), getGap(head, type));
1507}
1508// returns a pixel, which is relative to the width of the screen
1509// screen starts from 0, 1000 px width, if i is 10 then it should return 100
1510int BScreen::calRelativePositionWidth(int head, int i) {
1511 return calRelativePosition(head, i, 'w');
1512}
1513// returns a pixel, which is relative to the height of th escreen
1514// screen starts from 0, 1000 px height, if i is 10 then it should return 100
1515int BScreen::calRelativePositionHeight(int head, int i) {
1516 return calRelativePosition(head, i, 'h');
1517}
1518
1519int BScreen::calRelativeDimension(int head, int i, char type) {
1520 // return floor(i / getGap(head, type) * 100 + 0.5);
1521 return FbTk::RelCalcHelper::calPercentageOf(i, getGap(head, type));
1522 }
1523int BScreen::calRelativeDimensionWidth(int head, int i) {
1524 return calRelativeDimension(head, i, 'w');
1525}
1526int BScreen::calRelativeDimensionHeight(int head, int i) {
1527 return calRelativeDimension(head, i, 'h');
1528}
1529
1530float BScreen::getXGap(int head) {
1531 return maxRight(head) - maxLeft(head);
1532}
1533float BScreen::getYGap(int head) {
1534 return maxBottom(head) - maxTop(head);
1535}
1536
1488void BScreen::setupConfigmenu(FbTk::Menu &menu) { 1537void BScreen::setupConfigmenu(FbTk::Menu &menu) {
1489 _FB_USES_NLS; 1538 _FB_USES_NLS;
1490 1539