~ubuntu-branches/ubuntu/saucy/nwchem/saucy

« back to all changes in this revision

Viewing changes to src/tools/ga-4-3/global/X/xregion_scrollbars.c

  • Committer: Package Import Robot
  • Author(s): Michael Banck, Michael Banck, Daniel Leidert
  • Date: 2012-02-09 20:02:41 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120209200241-jgk03qfsphal4ug2
Tags: 6.1-1
* New upstream release.

[ Michael Banck ]
* debian/patches/02_makefile_flags.patch: Updated.
* debian/patches/02_makefile_flags.patch: Use internal blas and lapack code.
* debian/patches/02_makefile_flags.patch: Define GCC4 for LINUX and LINUX64
  (Closes: #632611 and LP: #791308).
* debian/control (Build-Depends): Added openssh-client.
* debian/rules (USE_SCALAPACK, SCALAPACK): Removed variables (Closes:
  #654658).
* debian/rules (LIBDIR, USE_MPIF4, ARMCI_NETWORK): New variables.
* debian/TODO: New file.
* debian/control (Build-Depends): Removed libblas-dev, liblapack-dev and
  libscalapack-mpi-dev.
* debian/patches/04_show_testsuite_diff_output.patch: New patch, shows the
  diff output for failed tests.
* debian/patches/series: Adjusted.
* debian/testsuite: Optionally run all tests if "all" is passed as option.
* debian/rules: Run debian/testsuite with "all" if DEB_BUILD_OPTIONS
  contains "checkall".

[ Daniel Leidert ]
* debian/control: Used wrap-and-sort. Added Vcs-Svn and Vcs-Browser fields.
  (Priority): Moved to extra according to policy section 2.5.
  (Standards-Version): Bumped to 3.9.2.
  (Description): Fixed a typo.
* debian/watch: Added.
* debian/patches/03_hurd-i386_define_path_max.patch: Added.
  - Define MAX_PATH if not defines to fix FTBFS on hurd.
* debian/patches/series: Adjusted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "xregion.h"
 
2
#include <math.h>
 
3
 
 
4
#define GA_ABS(x) (((x) < 0 )? -(x) : (x))
 
5
 
 
6
void DisplayIntervalValue()
 
7
{
 
8
  (void) sprintf(interval_string, "%4d ms", interval);
 
9
  XtSetArg(arg[0], XtNlabel, interval_string);
 
10
  XtSetValues(interval_widget,arg,1);
 
11
}
 
12
 
 
13
void DisplaySlowdownValue()
 
14
{
 
15
  (void) sprintf(slowdown_string, "%5.1f times", slowdown);
 
16
  XtSetArg(arg[0], XtNlabel, slowdown_string);
 
17
  XtSetValues(slowdown_widget,arg,1);
 
18
}
 
19
 
 
20
/**/
 
21
/* JJU: void ScrollProc(Widget scrollbar, caddr_t data, caddr_t position) */
 
22
void ScrollProc(Widget scrollbar, XtPointer data, XtPointer position)
 
23
/*
 
24
  Called when the left or right buttons are used to step the
 
25
  scrollbar left or right. We have the responsibility of
 
26
  moving the scrollbar.
 
27
*/
 
28
{
 
29
  Dimension length;
 
30
  float fraction;
 
31
  float shown;
 
32
 
 
33
  /* Get the scrollbar length and move the scroll bar */
 
34
 
 
35
  XtSetArg(arg[0], XtNlength, &length);
 
36
  XtGetValues(scrollbar, arg, 1);
 
37
  fraction = ((int) position)/ (double) length;
 
38
 
 
39
  interval = fraction*0.05*interval_max;   
 
40
  interval = GA_MIN(interval, interval_max);
 
41
  interval = GA_MAX(interval, 1);
 
42
 
 
43
  fraction = (float) interval/ (float) interval_max;
 
44
  shown = -1.0;
 
45
 
 
46
  DisplayIntervalValue();
 
47
  XawScrollbarSetThumb(scrollbar, fraction, shown);
 
48
}
 
49
 
 
50
/***** slowdown **********/
 
51
/* JJU: void ScrollProc2(Widget scrollbar, caddr_t data, caddr_t position) */
 
52
void ScrollProc2(Widget scrollbar, XtPointer data, XtPointer position)
 
53
/*
 
54
  Called when the left or right buttons are used to step the
 
55
  scrollbar left or right. We have the responsibility of
 
56
  moving the scrollbar.
 
57
*/
 
58
{
 
59
  Dimension length;
 
60
  double fraction;
 
61
  float shown;
 
62
 
 
63
  /* Get the scrollbar length and move the scroll bar */
 
64
 
 
65
  XtSetArg(arg[0], XtNlength, &length);
 
66
  XtGetValues(scrollbar, arg, 1);
 
67
 
 
68
  fraction -= ((int) position)/ (double) length;
 
69
 
 
70
  slowdown = fraction*0.2*slowdown_max;   
 
71
 
 
72
 
 
73
  /* need to add small number to avoid domain error in log(0) */
 
74
 
 
75
  slowdown = GA_MIN(slowdown,slowdown_max);
 
76
  slowdown = GA_MAX(slowdown, slowdown_min);
 
77
 
 
78
 
 
79
  /* scale current time according to the slowdown factor */
 
80
#ifdef DEBUG
 
81
  printf("before scaling %lu ( %ld %ld factor=%f) ",cur_time,
 
82
          slowdown,oldslowdown,(1.0*slowdown)/oldslowdown);
 
83
#endif /* DEBUG */
 
84
  cur_time = cur_time*slowdown/oldslowdown;
 
85
 
 
86
#ifdef DEBUG
 
87
    printf("and after %lu\n ",cur_time);
 
88
#endif /* DEBUG */
 
89
  oldslowdown = slowdown;
 
90
 
 
91
  fraction = (float) slowdown/ (float) slowdown_max;
 
92
 
 
93
  shown = -1.0;
 
94
 
 
95
  DisplaySlowdownValue();
 
96
  XawScrollbarSetThumb(scrollbar, (float)fraction, shown);
 
97
}
 
98
 
 
99
 
 
100
/**/
 
101
/* JJU: void JumpProc(Widget scrollbar, caddr_t data, caddr_t fraction_ptr) */
 
102
void JumpProc(Widget scrollbar, XtPointer data, XtPointer fraction_ptr) 
 
103
/*
 
104
  Called when the middle button is used to drag to 
 
105
  the scrollbar. The scrollbar is moved for us.
 
106
*/
 
107
{
 
108
  float fraction = *(float *) fraction_ptr;
 
109
 
 
110
  interval = fraction*interval_max;
 
111
  interval = GA_MIN(interval, interval_max);
 
112
  interval = GA_MAX(interval, 1);
 
113
 
 
114
  DisplayIntervalValue();
 
115
}
 
116
 
 
117
/**** slowdown ****/
 
118
/* JJU: void JumpProc2(Widget scrollbar, caddr_t data, caddr_t fraction_ptr) */
 
119
void JumpProc2(Widget scrollbar, XtPointer data, XtPointer fraction_ptr)
 
120
/*
 
121
  Called when the middle button is used to drag to 
 
122
  the scrollbar. The scrollbar is moved for us.
 
123
*/
 
124
{
 
125
  double exp_fraction;
 
126
  float fraction = *(float *) fraction_ptr;
 
127
 
 
128
 
 
129
  exp_fraction = pow(POW_BASE,(double)fraction);
 
130
 
 
131
  exp_fraction = (exp_fraction-1.)/ (pow(POW_BASE,1.) -1.);
 
132
 
 
133
  slowdown = exp_fraction*(slowdown_max-slowdown_min) + slowdown_min;
 
134
  slowdown = GA_MIN(slowdown,slowdown_max);
 
135
  slowdown = GA_MAX(slowdown, slowdown_min);
 
136
 
 
137
 
 
138
  /* scale current time according to the slowdown factor */
 
139
#ifdef DEBUG
 
140
  printf("before scaling %lu ( %ld %ld factor=%f) ",cur_time,
 
141
          slowdown,oldslowdown,(1.0*slowdown)/oldslowdown);
 
142
#endif /* DEBUG */
 
143
  cur_time = cur_time*slowdown/oldslowdown;
 
144
 
 
145
#ifdef DEBUG
 
146
  printf("and after %lu\n ",cur_time);
 
147
#endif /* DEBUG */
 
148
  oldslowdown = slowdown;
 
149
 
 
150
  DisplaySlowdownValue();
 
151
}