~ubuntu-branches/ubuntu/raring/xfig/raring

« back to all changes in this revision

Viewing changes to e_align.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2007-05-20 23:33:59 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070520233359-4ejk0ave70m2ihlz
Tags: 1:3.2.5-rel-1ubuntu1
* Merge from Debian unstable. Remaining Ubuntu change:
  - .desktop added.
* Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include "w_msgpanel.h"
30
30
#include "w_setup.h"
31
31
 
 
32
#include "u_bound.h"
 
33
#include "u_markers.h"
 
34
#include "u_translate.h"
 
35
#include "w_cursor.h"
 
36
 
32
37
static int      llx, lly, urx, ury;
33
38
static int      xcmin, ycmin, xcmax, ycmax;
34
39
static int      dx, dy;
35
40
 
36
 
static Boolean  pos_arc();
37
 
static Boolean  pos_ellipse();
38
 
static Boolean  pos_line();
39
 
static Boolean  pos_spline();
40
 
static Boolean  pos_text();
41
 
static Boolean  pos_compound();
42
 
 
43
 
static void     init_align();
44
 
static void     init_align_canvas();
45
 
static void     align_arc();
46
 
static void     align_ellipse();
47
 
static void     align_line();
48
 
static void     align_spline();
49
 
static void     align_text();
50
 
static void     align_compound();
51
 
static void     get_dx_dy();
52
 
static void     distribute_horizontally();
53
 
static void     distribute_vertically();
 
41
static Boolean  pos_arc(F_arc *a, int *min, int *size, int dir);
 
42
static Boolean  pos_ellipse(F_ellipse *e, int *min, int *size, int dir);
 
43
static Boolean  pos_line(F_line *l, int *min, int *size, int dir);
 
44
static Boolean  pos_spline(F_spline *s, int *min, int *size, int dir);
 
45
static Boolean  pos_text(F_text *t, int *min, int *size, int dir);
 
46
static Boolean  pos_compound(F_compound *c, int *min, int *size, int dir);
 
47
 
 
48
static void     init_align(F_line *p, int type, int x, int y, int px, int py);
 
49
static void     init_align_canvas(int x, int y, unsigned int shift);
 
50
static void     align_arc(void);
 
51
static void     align_ellipse(void);
 
52
static void     align_line(void);
 
53
static void     align_spline(void);
 
54
static void     align_text(void);
 
55
static void     align_compound(void);
 
56
static void     get_dx_dy(void);
 
57
static void     distribute_horizontally(void);
 
58
static void     distribute_vertically(void);
 
59
 
 
60
 
54
61
 
55
62
void
56
 
align_selected()
 
63
align_selected(void)
57
64
{
58
65
    set_mousefun("align compound", "align canvas", "", LOC_OBJ, "", LOC_OBJ);
59
66
    canvas_kbd_proc = null_proc;
70
77
/* align objects to the whole canvas */
71
78
 
72
79
static void
73
 
init_align_canvas(x, y, shift)
74
 
    int             x, y;
75
 
    unsigned int    shift;      /* Shift Key Status from XEvent */
 
80
init_align_canvas(int x, int y, unsigned int shift)
 
81
                         
 
82
                                /* Shift Key Status from XEvent */
76
83
{
77
84
    int             ux;
78
85
 
124
131
}
125
132
 
126
133
static void
127
 
init_align(p, type, x, y, px, py)
128
 
    F_line         *p;
129
 
    int             type;
130
 
    int             x, y;
131
 
    int             px, py;
 
134
init_align(F_line *p, int type, int x, int y, int px, int py)
132
135
{
133
136
    if (type != O_COMPOUND)
134
137
        return;
169
172
}
170
173
 
171
174
static void
172
 
align_ellipse()
 
175
align_ellipse(void)
173
176
{
174
177
    F_ellipse      *e;
175
178
 
183
186
}
184
187
 
185
188
static void
186
 
align_arc()
 
189
align_arc(void)
187
190
{
188
191
    F_arc          *a;
189
192
 
197
200
}
198
201
 
199
202
static void
200
 
align_line()
 
203
align_line(void)
201
204
{
202
205
    F_line         *l;
203
206
 
211
214
}
212
215
 
213
216
static void
214
 
align_spline()
 
217
align_spline(void)
215
218
{
216
219
    F_spline       *s;
217
220
 
225
228
}
226
229
 
227
230
static void
228
 
align_compound()
 
231
align_compound(void)
229
232
{
230
233
    F_compound     *c;
231
234
 
239
242
}
240
243
 
241
244
static void
242
 
align_text()
 
245
align_text(void)
243
246
{
244
247
    F_text         *t;
245
248
    int             dum;
255
258
}
256
259
 
257
260
static void
258
 
get_dx_dy()
 
261
get_dx_dy(void)
259
262
{
260
263
    switch (cur_valign) {
261
264
        case ALIGN_NONE:
309
312
 * If dir == 0, handle horizontal, otherwise vertical.
310
313
 */
311
314
static Boolean
312
 
pos_arc (a, min, size, dir)
313
 
  F_arc *a;
314
 
  int *min, *size, dir;
 
315
pos_arc (F_arc *a, int *min, int *size, int dir)
315
316
{
316
317
  int center;
317
318
 
348
349
 * If dir == 0, handle horizontal, otherwise vertical.
349
350
 */
350
351
static Boolean
351
 
pos_ellipse (e, min, size, dir)
352
 
  F_ellipse *e;
353
 
  int *min, *size, dir;
 
352
pos_ellipse (F_ellipse *e, int *min, int *size, int dir)
354
353
{
355
354
  int center;
356
355
 
387
386
 * If dir == 0, handle horizontal, otherwise vertical.
388
387
 */
389
388
static Boolean
390
 
pos_line (l, min, size, dir)
391
 
  F_line *l;
392
 
  int *min, *size, dir;
 
389
pos_line (F_line *l, int *min, int *size, int dir)
393
390
{
394
391
  int center;
395
392
 
426
423
 * If dir == 0, handle horizontal, otherwise vertical.
427
424
 */
428
425
static Boolean
429
 
pos_spline (s, min, size, dir)
430
 
  F_spline *s;
431
 
  int *min, *size, dir;
 
426
pos_spline (F_spline *s, int *min, int *size, int dir)
432
427
{
433
428
  int center;
434
429
 
465
460
 * If dir == 0, handle horizontal, otherwise vertical.
466
461
 */
467
462
static Boolean
468
 
pos_text (t, min, size, dir)
469
 
  F_text *t;
470
 
  int *min, *size, dir;
 
463
pos_text (F_text *t, int *min, int *size, int dir)
471
464
{
472
465
  int center, dum;
473
466
 
504
497
 * If dir == 0, handle horizontal, otherwise vertical.
505
498
 */
506
499
static Boolean
507
 
pos_compound (c, min, size, dir)
508
 
  F_compound *c;
509
 
  int *min, *size, dir;
 
500
pos_compound (F_compound *c, int *min, int *size, int dir)
510
501
{
511
502
  int center;
512
503
 
557
548
 * dir = 0 for horizontal, 1 for vertical.
558
549
 */
559
550
static int
560
 
init_distrib_centres (min, max, dir)
561
 
  int *min, *max, dir;
 
551
init_distrib_centres (int *min, int *max, int dir)
562
552
{
563
553
  F_ellipse     *e;
564
554
  F_arc         *a;
649
639
 * dir = 0 for horizontal, 1 for vertical.
650
640
 */
651
641
static int
652
 
init_distrib_edges (min, max, sum, dir)
653
 
  int *min, *max, *sum, dir;
 
642
init_distrib_edges (int *min, int *max, int *sum, int dir)
654
643
{
655
644
  F_ellipse     *e;
656
645
  F_arc         *a;
761
750
 
762
751
 
763
752
static void
764
 
adjust_object_pos (obj_ptr, obj_type, delta_x, delta_y)
765
 
  F_line           *obj_ptr;
766
 
  int              obj_type;
767
 
  int              delta_x, delta_y;
 
753
adjust_object_pos (F_line *obj_ptr, int obj_type, int delta_x, int delta_y)
768
754
{
769
755
  F_ellipse        *e;
770
756
  F_arc            *a;
812
798
} /* adjust_object_pos */
813
799
 
814
800
static void
815
 
distribute_horizontally()
 
801
distribute_horizontally(void)
816
802
{
817
803
  int            num_objects = 0;
818
804
  F_ellipse     *e;
837
823
    num_objects = init_distrib_edges (&min_x, &max_x, &sum_obj_width, 0);
838
824
    req_pos = min_x;
839
825
  }
840
 
  if (num_objects <= 2)
 
826
  if (num_objects <= 1)
841
827
    return;
842
828
 
843
829
  /* Determine the amount of space between objects (centres or edges) */
889
875
} /* distribute_horizontally */
890
876
 
891
877
static void
892
 
distribute_vertically()
 
878
distribute_vertically(void)
893
879
{
894
880
  int            num_objects = 0;
895
881
  F_ellipse     *e;
914
900
    num_objects = init_distrib_edges (&min_y, &max_y, &sum_obj_height, 1);
915
901
    req_pos = min_y;
916
902
  }
917
 
  if (num_objects <= 2)
 
903
  if (num_objects <= 1)
918
904
    return;
919
905
 
920
906
  /* Determine the amount of space between objects (centres or edges) */