~ubuntu-branches/ubuntu/wily/grass/wily

« back to all changes in this revision

Viewing changes to lib/display/ident_win.c

Tags: 7.0.0~rc1+ds1-1~exp1
* New upstream release candidate.
* Repack upstream tarball, remove precompiled Python objects.
* Add upstream metadata.
* Update gbp.conf and Vcs-Git URL to use the experimental branch.
* Update watch file for GRASS 7.0.
* Drop build dependencies for Tcl/Tk, add build dependencies:
  python-numpy, libnetcdf-dev, netcdf-bin, libblas-dev, liblapack-dev
* Update Vcs-Browser URL to use cgit instead of gitweb.
* Update paths to use grass70.
* Add configure options: --with-netcdf, --with-blas, --with-lapack,
  remove --with-tcltk-includes.
* Update patches for GRASS 7.
* Update copyright file, changes:
  - Update copyright years
  - Group files by license
  - Remove unused license sections
* Add patches for various typos.
* Fix desktop file with patch instead of d/rules.
* Use minimal dh rules.
* Bump Standards-Version to 3.9.6, no changes.
* Use dpkg-maintscript-helper to replace directories with symlinks.
  (closes: #776349)
* Update my email to use @debian.org address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <string.h>
2
 
#include <grass/raster.h>
3
 
#include <grass/display.h>
4
 
 
5
 
int ident_win(char *cur_pad)
6
 
{
7
 
    char **list;
8
 
    char **pads;
9
 
    int count;
10
 
    int closest;
11
 
    int npads;
12
 
    int p;
13
 
    int stat;
14
 
    int x, y, t, b, l, r;
15
 
    int button;
16
 
    int gotone;
17
 
 
18
 
    /* Get list of pads (windows) */
19
 
    R_pad_list(&pads, &npads);
20
 
 
21
 
    button = 1;
22
 
 
23
 
    x = (R_screen_rite() + R_screen_left()) / 2;
24
 
    y = (R_screen_top() + R_screen_bot()) / 2;
25
 
 
26
 
    while (button == 1) {
27
 
        closest = 9999999;
28
 
        gotone = 0;
29
 
 
30
 
        R_get_location_with_pointer(&x, &y, &button);
31
 
        for (p = 0; p < npads; p++) {
32
 
            if (!strlen(pads[p]))
33
 
                continue;
34
 
 
35
 
            stat = R_pad_select(pads[p]);
36
 
            if (stat) {
37
 
                R_pad_perror("ERROR", stat);
38
 
                continue;
39
 
            }
40
 
 
41
 
            /* Check each window's "d_win" */
42
 
            stat = R_pad_get_item("d_win", &list, &count);
43
 
            if (stat) {
44
 
                R_pad_perror("ERROR", stat);
45
 
                continue;
46
 
            }
47
 
            sscanf(list[0], "%d %d %d %d", &t, &b, &l, &r);
48
 
            R_pad_freelist(list, count);
49
 
 
50
 
            /* If chosen point is outside pad window, continue */
51
 
            if (x < l || x > r || y < t || y > b)
52
 
                continue;
53
 
 
54
 
            /* If right edge closer than closest, the save pad name */
55
 
            if ((r - x) >= 0 && (r - x) < closest) {
56
 
                closest = r - x;
57
 
                gotone = 1;
58
 
                strcpy(cur_pad, pads[p]);
59
 
            }
60
 
        }
61
 
 
62
 
        if (gotone)
63
 
            D_set_cur_wind(cur_pad);
64
 
    }
65
 
    return (button);
66
 
}