~ubuntu-branches/ubuntu/vivid/grass/vivid-proposed

« back to all changes in this revision

Viewing changes to lib/display/get_win.c

  • Committer: Package Import Robot
  • Author(s): Bas Couwenberg
  • Date: 2015-02-20 23:12:08 UTC
  • mfrom: (8.2.6 experimental)
  • Revision ID: package-import@ubuntu.com-20150220231208-1u6qvqm84v430b10
Tags: 7.0.0-1~exp1
* New upstream release.
* Update python-ctypes-ternary.patch to use if/else instead of and/or.
* Drop check4dev patch, rely on upstream check.
* Add build dependency on libpq-dev to grass-dev for libpq-fe.h.
* Drop patches applied upstream, refresh remaining patches.
* Update symlinks for images switched from jpg to png.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <stdio.h>
2
 
#include <grass/raster.h>
3
 
 
4
 
int get_win_w_mouse(float *top, float *bottom, float *left, float *right)
5
 
{
6
 
    int button;
7
 
    int st, sb, sl, sr;
8
 
    int t, b, l, r;
9
 
 
10
 
    st = R_screen_top();
11
 
    sb = R_screen_bot();
12
 
    sl = R_screen_left();
13
 
    sr = R_screen_rite();
14
 
 
15
 
    fprintf(stderr, "\nButtons:\n");
16
 
    fprintf(stderr, "Left:   Establish a corner\n");
17
 
    fprintf(stderr, "Right:  Accept window\n");
18
 
 
19
 
    l = sl;
20
 
    b = sb;
21
 
    r = l + 10;
22
 
    t = b - 10;
23
 
 
24
 
    do {
25
 
        R_get_location_with_box(l, b, &r, &t, &button);
26
 
        if (button == 1) {
27
 
            l = r;
28
 
            b = t;
29
 
        }
30
 
    } while (button != 3);
31
 
 
32
 
    if (l > r) {
33
 
        button = l;
34
 
        l = r;
35
 
        r = button;
36
 
    }
37
 
 
38
 
    if (t > b) {
39
 
        button = t;
40
 
        t = b;
41
 
        b = button;
42
 
    }
43
 
    *bottom = 100. - 100. * (b - st) / (sb - st);
44
 
    *top = 100. - 100. * (t - st) / (sb - st);
45
 
    *left = 100. * (l - sl) / (sr - sl);
46
 
    *right = 100. * (r - sl) / (sr - sl);
47
 
 
48
 
    return 0;
49
 
}