comparison lwlib/xlwgauge.c @ 3968:16b17fd1dc93

[xemacs-hg @ 2007-05-20 15:56:30 by stephent] Fix type declarations in progress gauge widget. <873b1r8owl.fsf@uwakimon.sk.tsukuba.ac.jp>
author stephent
date Sun, 20 May 2007 15:56:36 +0000
parents 174eb4da74fb
children 383ab474a241
comparison
equal deleted inserted replaced
3967:e6ca8521a705 3968:16b17fd1dc93
130 static void AutoScale (GaugeWidget); 130 static void AutoScale (GaugeWidget);
131 static void EnableUpdate (GaugeWidget); 131 static void EnableUpdate (GaugeWidget);
132 static void DisableUpdate (GaugeWidget); 132 static void DisableUpdate (GaugeWidget);
133 133
134 static void GaugeGetValue (XtPointer, XtIntervalId *); 134 static void GaugeGetValue (XtPointer, XtIntervalId *);
135 static void GaugeMercury (Display *, Window, GC, GaugeWidget, Cardinal, Cardinal); 135 static void GaugeMercury (Display *, Window, GC, GaugeWidget, int, int);
136 136
137 static Boolean GaugeConvert (Widget, Atom *, Atom *, Atom *, 137 static Boolean GaugeConvert (Widget, Atom *, Atom *, Atom *,
138 XtPointer *, unsigned long *, int *); 138 XtPointer *, unsigned long *, int *);
139 static void GaugeLoseSel (Widget, Atom *); 139 static void GaugeLoseSel (Widget, Atom *);
140 static void GaugeDoneSel (Widget, Atom *, Atom *); 140 static void GaugeDoneSel (Widget, Atom *, Atom *);
815 /* Change gauge value. Only undraw or draw what needs to be 815 /* Change gauge value. Only undraw or draw what needs to be
816 * changed. 816 * changed.
817 */ 817 */
818 818
819 void 819 void
820 XawGaugeSetValue (Widget w, 820 XawGaugeSetValue (Widget w, int value)
821 Cardinal value)
822 { 821 {
823 GaugeWidget gw = (GaugeWidget)w ; 822 GaugeWidget gw = (GaugeWidget)w ;
824 int oldvalue ; 823 int oldvalue ;
825 GC gc ; 824 GC gc ;
826 825
848 gc = XtIsSensitive(w) ? gw->label.normal_GC : gw->label.gray_GC ; 847 gc = XtIsSensitive(w) ? gw->label.normal_GC : gw->label.gray_GC ;
849 GaugeMercury(XtDisplay(w), XtWindow(w), gc, gw, oldvalue,value) ; 848 GaugeMercury(XtDisplay(w), XtWindow(w), gc, gw, oldvalue,value) ;
850 } 849 }
851 850
852 851
853 Cardinal 852 int
854 XawGaugeGetValue (Widget w) 853 XawGaugeGetValue (Widget w)
855 { 854 {
856 GaugeWidget gw = (GaugeWidget)w ; 855 GaugeWidget gw = (GaugeWidget)w ;
857 return gw->gauge.value ; 856 return gw->gauge.value ;
858 } 857 }
871 static void 870 static void
872 GaugeMercury (Display *dpy, 871 GaugeMercury (Display *dpy,
873 Window win, 872 Window win,
874 GC gc, 873 GC gc,
875 GaugeWidget gw, 874 GaugeWidget gw,
876 Cardinal val0, 875 int val0,
877 Cardinal val1) 876 int val1)
878 { 877 {
879 int v0 = gw->gauge.v0 ; 878 int v0 = gw->gauge.v0 ;
880 int v1 = gw->gauge.v1 ; 879 int v1 = gw->gauge.v1 ;
881 int vd = v1 - v0 ; 880 int vd = v1 - v0 ;
882 Dimension len ; /* length (width or height) of gauge */ 881 Dimension len ; /* length (width or height) of gauge */
891 e0 = gw->gauge.margin0 ; /* left (top) end */ 890 e0 = gw->gauge.margin0 ; /* left (top) end */
892 e1 = len - gw->gauge.margin1 -1 ; /* right (bottom) end */ 891 e1 = len - gw->gauge.margin1 -1 ; /* right (bottom) end */
893 892
894 if( vd <= 0 ) vd = 1 ; 893 if( vd <= 0 ) vd = 1 ;
895 894
896 if( (int) val0 < v0 ) val0 = v0 ; 895 if( val0 < v0 ) val0 = v0 ;
897 else if( (int) val0 > v1 ) val0 = v1 ; 896 else if( val0 > v1 ) val0 = v1 ;
898 if( (int) val1 < v0 ) val1 = v0 ; 897 if( val1 < v0 ) val1 = v0 ;
899 else if( (int) val1 > v1 ) val1 = v1 ; 898 else if( val1 > v1 ) val1 = v1 ;
900 899
901 p0 = (val0-v0)*(e1-e0-1)/vd ; 900 p0 = (val0-v0)*(e1-e0-1)/vd ;
902 p1 = (val1-v0)*(e1-e0-1)/vd ; 901 p1 = (val1-v0)*(e1-e0-1)/vd ;
903 902
904 if( p1 == p0 ) 903 if( p1 == p0 )
1106 static void 1105 static void
1107 GaugeGetValue (XtPointer clientData, 1106 GaugeGetValue (XtPointer clientData,
1108 XtIntervalId *UNUSED (intervalId)) 1107 XtIntervalId *UNUSED (intervalId))
1109 { 1108 {
1110 GaugeWidget gw = (GaugeWidget)clientData ; 1109 GaugeWidget gw = (GaugeWidget)clientData ;
1111 Cardinal value ; 1110 int value ;
1112 1111
1113 if( gw->gauge.update > 0 ) 1112 if( gw->gauge.update > 0 )
1114 EnableUpdate(gw) ; 1113 EnableUpdate(gw) ;
1115 1114
1116 if( gw->gauge.getValue != NULL ) 1115 if( gw->gauge.getValue != NULL )