~ubuntu-branches/ubuntu/quantal/texmacs/quantal

« back to all changes in this revision

Viewing changes to src/Edit/Interface/edit_graphics.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Atsuhito KOHDA, Kamaraju Kusumanchi, kohda
  • Date: 2008-04-06 15:11:41 UTC
  • mfrom: (1.1.7 upstream) (4.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080406151141-w0sg20jnv86mlt6f
Tags: 1:1.0.6.14-1
[Kamaraju Kusumanchi <kamaraju@gmail.com>]
* New upstream release
* 01_american.dpatch is updated
* Since thread support in guile-1.8 is now disabled, the segmentation faults
  should not arise anymore. More info at #439923. (Closes: #450499, #458685)
[kohda]
* This version fixed menu problem.  (Closes: #447083)
* Reverted orig.tar.gz to the upstream tarball.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
  path p   = path_up (tp);
38
38
  bool flag= false;
39
39
  tree st  = et;
40
 
  while (!nil (p)) {
 
40
  while (!is_nil (p)) {
41
41
    if (is_func (st, GRAPHICS)) flag= true;
42
42
    if (b && is_func (st, TEXT_AT )) flag= false;
43
43
    st= st[p->item];
54
54
bool
55
55
edit_graphics_rep::over_graphics (SI x, SI y) {
56
56
  frame f= find_frame ();
57
 
  if (!nil (f)) {
 
57
  if (!is_nil (f)) {
58
58
    point lim1, lim2;
59
59
    find_limits (lim1, lim2);
60
60
    point p = adjust (f [point (x, y)]);
72
72
  path p   = path_up (tp);
73
73
  tree st  = et;
74
74
  tree res = tree ();
75
 
  while (!nil (p)) {
 
75
  while (!is_nil (p)) {
76
76
    if (is_func (st, GRAPHICS)) res= st;
77
77
    st= st[p->item];
78
78
    p = p->next;
120
120
  find_limits (lim1, lim2);
121
121
  if (lim1 == point ()) return false;
122
122
  frame f= find_frame ();
123
 
  if (nil (f)) return false;
 
123
  if (is_nil (f)) return false;
124
124
  point p1= f (point (lim1[0], lim1[1]));
125
125
  point p2= f (point (lim2[0], lim2[1]));
126
126
  x1= (SI) p1[0]; y1= (SI) p1[1];
132
132
edit_graphics_rep::adjust (point p) {
133
133
  frame f= find_frame ();
134
134
  grid g= find_grid ();
135
 
  if (!nil (g) && !nil (gr0) && g!=gr0) {
 
135
  if (!is_nil (g) && !is_nil (gr0) && g!=gr0) {
136
136
    graphical_select (p[0], p[1]);
137
137
    g= gr0;
138
138
  }
139
 
  if (nil (g))
 
139
  if (is_nil (g))
140
140
    return p;
141
141
  else {
142
142
    point res;
143
143
    gr_selections sels= gs;
144
144
    frame f2= find_frame (true);
145
 
    if (!nil (f2)) {
 
145
    if (!is_nil (f2)) {
146
146
      point fp= f2 (p);
147
147
      int i;
148
148
      if ((tree)g == "empty_grid") {
162
162
        }
163
163
      }
164
164
      else
165
 
      if (!nil (f)) { 
 
165
      if (!is_nil (f)) { 
166
166
        res= f2 (g->find_point_around (p, 10*get_pixel_size (), f));
167
167
        for (i=0; i<N(pts); i++) {
168
168
          point sp= pts[i];
199
199
tree
200
200
edit_graphics_rep::graphical_select (double x, double y) { 
201
201
  frame f= find_frame ();
202
 
  if (nil (f)) return tuple ();
 
202
  if (is_nil (f)) return tuple ();
203
203
  gr_selections sels;
204
204
  point p0 = point (x, y);
205
205
  point p = f (p0);
211
211
  gr0= empty_grid ();
212
212
  grid g= find_grid ();
213
213
  frame f2= find_frame (true);
214
 
  if (!nil (g) && !nil (f2)) {
 
214
  if (!is_nil (g) && !is_nil (f2)) {
215
215
    gr0= g;
216
216
    p = f2 (point (x, y));
217
217
    int i, j, n= N(sels);
228
228
        if (i<j) {
229
229
          curve c1= sels[i]->c;
230
230
          curve c2= sels[j]->c;
231
 
          if (!nil (c1) && !nil (c2))
 
231
          if (!is_nil (c1) && !is_nil (c2))
232
232
            ci= ci << intersection (c1, c2, p, eps);
233
233
        }
234
234
    }
237
237
    for (i=0; i<N(gc); i++) {
238
238
      curve c= f2 (gc[i]->c);
239
239
      for (j=0; j<n; j++)
240
 
        if (!nil (sels[j]->c))
 
240
        if (!is_nil (sels[j]->c))
241
241
          cgi= cgi << intersection (c, sels[j]->c, p, eps);
242
242
    }
243
243
  }
249
249
  double x1, double y1, double x2, double y2)
250
250
251
251
  frame f= find_frame ();
252
 
  if (nil (f)) return tuple ();
 
252
  if (is_nil (f)) return tuple ();
253
253
  gr_selections sels;
254
254
  point p1 = f (point (x1, y1)), p2= f (point (x2, y2));
255
255
  sels= eb->graphical_select ((SI)p1[0], (SI)p1[1], (SI)p2[0], (SI)p2[1]);
270
270
  //tree old_fr= env->local_begin (GR_FRAME, (tree) find_frame ());  
271
271
  frame f_env= env->fr;
272
272
  env->fr= find_frame ();
273
 
  if (!nil (env->fr)) {
 
273
  if (!is_nil (env->fr)) {
274
274
    int i,n=0;
275
275
    go_box= typeset_as_concat (env, t, path (0));
276
276
    for (i=0; i<N(go_box); i++)
296
296
void
297
297
edit_graphics_rep::invalidate_graphical_object () {
298
298
  SI gx1, gy1, gx2, gy2;
299
 
  if (find_graphical_region (gx1, gy1, gx2, gy2) && !nil (go_box)) {
 
299
  if (find_graphical_region (gx1, gy1, gx2, gy2) && !is_nil (go_box)) {
300
300
    int i;
301
301
    rectangles rs;
302
302
    rectangle gr (gx1, gy1, gx2, gy2);
310
310
}
311
311
 
312
312
void
313
 
edit_graphics_rep::draw_graphical_object (ps_device dev) {
314
 
  if (nil (go_box)) set_graphical_object (graphical_object);
315
 
  if (nil (go_box)) return;
 
313
edit_graphics_rep::draw_graphical_object (renderer ren) {
 
314
  if (is_nil (go_box)) set_graphical_object (graphical_object);
 
315
  if (is_nil (go_box)) return;
316
316
  SI ox1, oy1, ox2, oy2;
317
 
  dev->get_clipping (ox1, oy1, ox2, oy2);
 
317
  ren->get_clipping (ox1, oy1, ox2, oy2);
318
318
  SI gx1, gy1, gx2, gy2;
319
319
  if (find_graphical_region (gx1, gy1, gx2, gy2))
320
 
    dev->extra_clipping (gx1, gy1, gx2, gy2);
 
320
    ren->extra_clipping (gx1, gy1, gx2, gy2);
321
321
  int i;
322
322
  for (i=0; i<go_box->subnr(); i++) {
323
323
    box b= go_box->subbox (i);
324
324
    if ((tree)b=="point" || (tree)b=="curve")
325
 
      b->display (dev);
 
325
      b->display (ren);
326
326
    else {
327
327
      rectangles rs;
328
 
      b->redraw (dev, path (), rs);
 
328
      b->redraw (ren, path (), rs);
329
329
    }
330
330
  }
331
 
  dev->set_clipping (ox1, oy1, ox2, oy2);
 
331
  ren->set_clipping (ox1, oy1, ox2, oy2);
332
332
}
333
333
 
334
334
bool
335
 
edit_graphics_rep::mouse_graphics (string type, SI x, SI y, time_t t) {
 
335
edit_graphics_rep::mouse_graphics (string type, SI x, SI y, int m, time_t t) {
336
336
  (void) t;
337
337
  // apply_changes (); // FIXME: remove after review of synchronization
338
338
  frame f= find_frame ();
339
 
  if (!nil (f)) {
 
339
  if (!is_nil (f)) {
340
340
    if (!over_graphics (x, y)) return false;
341
341
    if (type == "move" || type == "dragging")
342
 
      if (dis->check_event (MOTION_EVENT))
 
342
      if (check_event (MOTION_EVENT))
343
343
        return true;
344
344
    point p = f [point (x, y)];
345
345
    graphical_select (p[0], p[1]); // init the caching for adjust().
349
349
    string sx= as_string (p[0]);
350
350
    string sy= as_string (p[1]);
351
351
    invalidate_graphical_object ();
352
 
    if (type == "move"            ) call ("graphics-move-point"      , sx, sy);
353
 
    if (type == "release-left"    ) call ("graphics-insert-point"    , sx, sy);
354
 
    if (type == "release-middle"  ) call ("graphics-remove-point"    , sx, sy);
355
 
    if (type == "release-right"   ) call ("graphics-last-point"      , sx, sy);
356
 
    if (type == "start-drag"      ) call ("graphics-start-drag"      , sx, sy);
357
 
    if (type == "dragging"        ) call ("graphics-dragging"        , sx, sy);
358
 
    if (type == "end-drag"        ) call ("graphics-end-drag"        , sx, sy);
359
 
    if (type == "start-right-drag") call ("graphics-start-right-drag", sx, sy);
360
 
    if (type == "right-dragging"  ) call ("graphics-right-dragging"  , sx, sy);
361
 
    if (type == "end-right-drag"  ) call ("graphics-end-right-drag"  , sx, sy);
 
352
    call ("set-keyboard-modifiers", object (m));
 
353
    if (type == "move")
 
354
      call ("graphics-move-point", sx, sy);
 
355
    else if (type == "release-left")
 
356
      call ("graphics-insert-point", sx, sy);
 
357
    else if (type == "release-middle")
 
358
      call ("graphics-remove-point", sx, sy);
 
359
    else if (type == "release-right")
 
360
      call ("graphics-last-point", sx, sy);
 
361
    else if (type == "start-drag")
 
362
      call ("graphics-start-drag", sx, sy);
 
363
    else if (type == "dragging")
 
364
      call ("graphics-dragging", sx, sy);
 
365
    else if (type == "end-drag")
 
366
      call ("graphics-end-drag", sx, sy);
 
367
    else if (type == "start-right-drag")
 
368
      call ("graphics-start-right-drag", sx, sy);
 
369
    else if (type == "right-dragging")
 
370
      call ("graphics-right-dragging", sx, sy);
 
371
    else if (type == "end-right-drag")
 
372
      call ("graphics-end-right-drag", sx, sy);
362
373
    invalidate_graphical_object ();
363
374
    notify_change (THE_CURSOR);
364
375
    return true;