Changeset 17466
- Timestamp:
- Apr 21, 2008, 11:11:43 AM (18 years ago)
- Location:
- trunk/Ohana/src/kapa2
- Files:
-
- 7 edited
-
include/prototypes.h (modified) (4 diffs)
-
src/DrawFrame.c (modified) (5 diffs)
-
src/DrawLabels.c (modified) (1 diff)
-
src/LoadLabels.c (modified) (1 diff)
-
src/LoadObject.c (modified) (1 diff)
-
src/PSFrame.c (modified) (5 diffs)
-
src/bDrawFrame.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/include/prototypes.h
r16810 r17466 29 29 int DrawObjects PROTO((KapaGraphWidget *graph)); 30 30 void DrawLabels PROTO((KapaGraphWidget *graph)); 31 void EraseLabels PROTO((KapaGraphWidget *graph)); 32 void DrawLabelsRaw PROTO((Graphic *graphic, KapaGraphWidget *graph, int color)); 31 33 void DrawTextlines PROTO((KapaGraphWidget *graph)); 32 34 void DrawConnect PROTO((KapaGraphWidget *graph, Gobjects *objects)); … … 36 38 void DrawXErrors PROTO((KapaGraphWidget *graph, Gobjects *objects)); 37 39 void DrawYErrors PROTO((KapaGraphWidget *graph, Gobjects *objects)); 38 void DrawTick PROTO((int fx, int fy, int dfx, int dfy, int P, double min, double max, double value, int mode, int naxis));40 void DrawTick PROTO((int fx, int fy, int dfx, int dfy, int P, double min, double max, double value, int IsLabel, int IsMajor, int naxis)); 39 41 void AxisTickScale PROTO((Axis *axis, double *major, double *minor)); 40 42 … … 108 110 void PSXErrors PROTO((KapaGraphWidget *graph, Gobjects *objects, FILE *f)); 109 111 void PSYErrors PROTO((KapaGraphWidget *graph, Gobjects *objects, FILE *f)); 110 void PSTick PROTO((FILE *f, double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int mode, int naxis));112 void PSTick PROTO((FILE *f, double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int IsLabel, int IsMajor, int naxis)); 111 113 void ClipLinePS PROTO((double x0, double y0, double x1, double y1, double X0, double Y1, double X1, double Y0, FILE *f)); 112 114 int PSimage PROTO((KapaImageWidget *image, FILE *f)); … … 127 129 void bDrawXErrors PROTO((KapaGraphWidget *graph, Gobjects *object)); 128 130 void bDrawYErrors PROTO((KapaGraphWidget *graph, Gobjects *object)); 129 void bDrawTick PROTO((double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int mode, int naxis));131 void bDrawTick PROTO((double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int IsLabel, int IsMajor, int naxis)); 130 132 void bDrawClipLine PROTO((double x0, double y0, double x1, double y1, double X0, double Y1, double X1, double Y0)); 131 133 bDrawBuffer *bDrawIt PROTO(()); -
trunk/Ohana/src/kapa2/src/DrawFrame.c
r15635 r17466 7 7 void DrawFrame (KapaGraphWidget *graph) { 8 8 9 int i, fx, fy, dfx, dfy, P, IsLabel ;9 int i, fx, fy, dfx, dfy, P, IsLabel, IsMajor; 10 10 double range, major, minor, first, next; 11 11 … … 49 49 } 50 50 for (next = first; ((range > 0) && (next <= graph[0].axis[i].max)) || ((range < 0) && (next >= graph[0].axis[i].max));) { 51 Is Label= FALSE;52 if ((fabs((int)(next/major) - (next/major)) < 0.5*(minor/major)) ||53 (fabs ((int)((next + 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)) ||54 (fabs ((int)((next - 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)))55 IsLabel = graph[0].axis[i].islabel;56 DrawTick (fx, fy, dfx, dfy, P, graph[0].axis[i].min, graph[0].axis[i].max, next, IsLabel, i);51 IsMajor = FALSE; 52 IsMajor |= (fabs((int)(next/major) - (next/major)) < 0.5*(minor/major)); 53 IsMajor |= (fabs((int)((next + 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)); 54 IsMajor |= (fabs ((int)((next - 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)); 55 IsLabel = (IsMajor && graph[0].axis[i].islabel); 56 DrawTick (fx, fy, dfx, dfy, P, graph[0].axis[i].min, graph[0].axis[i].max, next, IsLabel, IsMajor, i); 57 57 if (range > 0) 58 58 next += minor; … … 66 66 void DrawTick (int fx, int fy, int dfx, int dfy, 67 67 int P, double min, double max, 68 double value, int mode, int naxis) {68 double value, int IsLabel, int IsMajor, int naxis) { 69 69 70 70 int x, y, dx, dy, pos, dir, fontsize; … … 72 72 char string[64], *fontname; 73 73 74 if ( mode) {74 if (IsMajor) { 75 75 size = MAX (0.02, 7.0 / P); 76 76 } else { … … 95 95 # endif 96 96 97 if ( mode == 1) {97 if (IsLabel) { 98 98 fontname = GetRotFont (&fontsize); 99 99 pos = 0; -
trunk/Ohana/src/kapa2/src/DrawLabels.c
r13320 r17466 1 1 # include "Ximage.h" 2 2 3 void EraseLabels (KapaGraphWidget *graph) { 4 5 Graphic *graphic; 6 graphic = GetGraphic(); 7 8 DrawLabelsRaw (graphic, graph, graphic->back); 9 } 10 3 11 void DrawLabels (KapaGraphWidget *graph) { 4 12 13 Graphic *graphic; 14 graphic = GetGraphic(); 15 16 DrawLabelsRaw (graphic, graph, graphic->fore); 17 } 18 19 void DrawLabelsRaw (Graphic *graphic, KapaGraphWidget *graph, int color) { 20 5 21 int i, pos, x, y, size; 6 22 double angle; 7 23 char *fontname; 8 Graphic *graphic;9 10 graphic = GetGraphic();11 24 12 25 pos = 0; 13 26 fontname = GetRotFont (&size); 14 XSetForeground (graphic->display, graphic->gc, graphic->fore);15 DrawRotTextInit (graphic->display, graphic->window, graphic->gc, graphic->fore, graphic->back);27 XSetForeground (graphic->display, graphic->gc, color); 28 DrawRotTextInit (graphic->display, graphic->window, graphic->gc, color, graphic->back); 16 29 17 30 /* each label is drawn independently */ -
trunk/Ohana/src/kapa2/src/LoadLabels.c
r13479 r17466 18 18 label = KiiRecvData (sock); 19 19 20 if (USE_XWINDOW) EraseLabels (graph); 20 21 bzero (graph[0].label[mode].text, LABEL_MAXLEN); 21 22 -
trunk/Ohana/src/kapa2/src/LoadObject.c
r14590 r17466 123 123 } 124 124 if (Nbytes_send != Npts_send*sizeof(float)) { 125 fprintf (stderr, "Kapa Communication error: unexpected data size %d vs % ld\n", Nbytes_send, Npts_send*sizeof(float));125 fprintf (stderr, "Kapa Communication error: unexpected data size %d vs %d\n", Nbytes_send, Npts_send*sizeof(float)); 126 126 } 127 127 -
trunk/Ohana/src/kapa2/src/PSFrame.c
r15542 r17466 4 4 int PSFrame (KapaGraphWidget *graph, FILE *f) { 5 5 6 int i, P, IsLabel, fontsize;6 int i, P, IsLabel, IsMajor, fontsize; 7 7 double fx, fy, dfx, dfy, range, major, minor, first, next; 8 8 char *fontname; … … 38 38 } 39 39 for (next = first; ((range > 0) && (next <= graph[0].axis[i].max)) || ((range < 0) && (next >= graph[0].axis[i].max));) { 40 Is Label= FALSE;41 if ((fabs((int)(next/major) - (next/major)) < 0.5*(minor/major)) ||42 (fabs ((int)((next + 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)) ||43 (fabs ((int)((next - 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)))44 IsLabel = graph[0].axis[i].islabel;45 PSTick (f, fx, fy, dfx, dfy, P, graph[0].axis[i].min, graph[0].axis[i].max, next, IsLabel, i);40 IsMajor = FALSE; 41 IsMajor |= (fabs((int)(next/major) - (next/major)) < 0.5*(minor/major)); 42 IsMajor |= (fabs ((int)((next + 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)); 43 IsMajor |= (fabs ((int)((next - 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)); 44 IsLabel = (IsMajor && graph[0].axis[i].islabel); 45 PSTick (f, fx, fy, dfx, dfy, P, graph[0].axis[i].min, graph[0].axis[i].max, next, IsLabel, IsMajor, i); 46 46 if (range > 0) 47 47 next += minor; … … 54 54 } 55 55 56 void PSTick (FILE *f, double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int mode, int naxis) {56 void PSTick (FILE *f, double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int IsLabel, int IsMajor, int naxis) { 57 57 58 58 int pos, dir, fontsize; … … 62 62 pos = size = 0; 63 63 64 if (mode == 1) { size = MAX (0.02, 7.0 / P); } 65 if (mode == 0) { size = MAX (0.01, 4.0 / P); } 64 if (IsMajor) { 65 size = MAX (0.02, 7.0 / P); 66 } else { 67 size = MAX (0.01, 4.0 / P); 68 } 66 69 67 70 n = P / sqrt ((double)(dfx*dfx + dfy*dfy)); … … 76 79 DrawLine (x, y, dx, dy); 77 80 78 if ( mode == 1) {81 if (IsLabel) { 79 82 fontname = GetRotFont (&fontsize); 80 83 -
trunk/Ohana/src/kapa2/src/bDrawFrame.c
r15542 r17466 3 3 int bDrawFrame (KapaGraphWidget *graph) { 4 4 5 int i, P, IsLabel, fontsize;5 int i, P, IsLabel, IsMajor, fontsize; 6 6 double fx, fy, dfx, dfy, range, major, minor, first, next; 7 7 char *fontname; … … 36 36 } 37 37 for (next = first; ((range > 0) && (next <= graph[0].axis[i].max)) || ((range < 0) && (next >= graph[0].axis[i].max));) { 38 Is Label= FALSE;39 if ((fabs((int)(next/major) - (next/major)) < 0.5*(minor/major)) ||40 (fabs ((int)((next + 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)) ||41 (fabs ((int)((next - 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)))42 IsLabel = graph[0].axis[i].islabel;43 bDrawTick (fx, fy, dfx, dfy, P, graph[0].axis[i].min, graph[0].axis[i].max, next, IsLabel, i);38 IsMajor = FALSE; 39 IsMajor |= (fabs((int)(next/major) - (next/major)) < 0.5*(minor/major)); 40 IsMajor |= (fabs ((int)((next + 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)); 41 IsMajor |= (fabs ((int)((next - 0.5*minor)/major) - (next/major)) < 0.5*(minor/major)); 42 IsLabel = (IsMajor && graph[0].axis[i].islabel); 43 bDrawTick (fx, fy, dfx, dfy, P, graph[0].axis[i].min, graph[0].axis[i].max, next, IsLabel, IsMajor, i); 44 44 if (range > 0) 45 45 next += minor; … … 52 52 } 53 53 54 void bDrawTick (double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int mode, int naxis) {54 void bDrawTick (double fx, double fy, double dfx, double dfy, int P, double min, double max, double value, int IsLabel, int IsMajor, int naxis) { 55 55 56 56 int pos, dir, fontsize; … … 60 60 pos = size = 0; 61 61 62 if (mode == 1) { size = MAX (0.02, 7.0 / P); } 63 if (mode == 0) { size = MAX (0.01, 4.0 / P); } 62 if (IsMajor) { 63 size = MAX (0.02, 7.0 / P); 64 } else { 65 size = MAX (0.01, 4.0 / P); 66 } 64 67 65 68 n = P / sqrt ((double)(dfx*dfx + dfy*dfy)); … … 74 77 bDrawLine (x, y, x+dx, y+dy); 75 78 76 if ( mode == 1) {79 if (IsLabel) { 77 80 fontname = GetRotFont (&fontsize); 78 81
Note:
See TracChangeset
for help on using the changeset viewer.
