~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/tools/gimpvectortool.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-10-06 13:30:41 UTC
  • mto: This revision was merged to the branch mainline in revision 35.
  • Revision ID: james.westby@ubuntu.com-20081006133041-3panbkcanaymfsmp
Tags: upstream-2.6.0
ImportĀ upstreamĀ versionĀ 2.6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
192
192
  gimp_tool_control_set_handle_empty_image (tool->control, TRUE);
193
193
  gimp_tool_control_set_motion_mode        (tool->control,
194
194
                                            GIMP_MOTION_MODE_COMPRESS);
 
195
  gimp_tool_control_set_precision          (tool->control,
 
196
                                            GIMP_CURSOR_PRECISION_SUBPIXEL);
195
197
  gimp_tool_control_set_cursor             (tool->control, GIMP_CURSOR_MOUSE);
196
198
  gimp_tool_control_set_tool_cursor        (tool->control,
197
199
                                            GIMP_TOOL_CURSOR_PATHS);
286
288
          gimp_vector_tool_set_vectors (vector_tool, vectors);
287
289
          gimp_image_set_active_vectors (display->image, vectors);
288
290
        }
 
291
 
289
292
      vector_tool->function = VECTORS_FINISHED;
290
293
    }
291
294
 
306
309
      gimp_vector_tool_set_vectors (vector_tool, vectors);
307
310
 
308
311
      vector_tool->function = VECTORS_CREATE_STROKE;
309
 
 
310
312
    }
311
313
 
312
314
  gimp_vectors_freeze (vector_tool->vectors);
335
337
 
336
338
  if (vector_tool->function == VECTORS_ADD_ANCHOR)
337
339
    {
 
340
      GimpCoords position = GIMP_COORDS_DEFAULT_VALUES;
 
341
 
 
342
      position.x = coords->x;
 
343
      position.y = coords->y;
 
344
 
338
345
      gimp_vector_tool_undo_push (vector_tool, _("Add Anchor"));
339
346
 
340
347
      vector_tool->undo_motion = TRUE;
341
348
 
342
349
      vector_tool->cur_anchor =
343
 
                     gimp_bezier_stroke_extend (vector_tool->sel_stroke, coords,
 
350
                     gimp_bezier_stroke_extend (vector_tool->sel_stroke,
 
351
                                                &position,
344
352
                                                vector_tool->sel_anchor,
345
353
                                                EXTEND_EDITABLE);
346
354
 
347
355
      vector_tool->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC;
348
356
 
349
 
      if (!options->polygonal)
 
357
      if (! options->polygonal)
350
358
        vector_tool->function = VECTORS_MOVE_HANDLE;
351
359
      else
352
360
        vector_tool->function = VECTORS_MOVE_ANCHOR;
 
361
 
353
362
      vector_tool->cur_stroke = vector_tool->sel_stroke;
354
363
    }
355
364
 
374
383
                                          vector_tool->cur_anchor,
375
384
                                          GIMP_ANCHOR_FEATURE_EDGE);
376
385
            }
 
386
 
377
387
          vector_tool->function = VECTORS_MOVE_ANCHOR;
378
388
        }
379
389
      else
391
401
 
392
402
      if (vector_tool->cur_anchor->type == GIMP_ANCHOR_ANCHOR)
393
403
        {
394
 
          if (!vector_tool->cur_anchor->selected)
 
404
          if (! vector_tool->cur_anchor->selected)
395
405
            {
396
406
              gimp_vectors_anchor_select (vector_tool->vectors,
397
407
                                          vector_tool->cur_stroke,
406
416
                                            GIMP_ANCHOR_CONTROL, TRUE,
407
417
                                            &vector_tool->cur_anchor,
408
418
                                            &vector_tool->cur_stroke);
409
 
          if (!vector_tool->cur_anchor)
 
419
          if (! vector_tool->cur_anchor)
410
420
            vector_tool->function = VECTORS_FINISHED;
411
421
        }
412
422
    }
418
428
    {
419
429
      gimp_vector_tool_undo_push (vector_tool, _("Drag Anchor"));
420
430
 
421
 
      if (!vector_tool->cur_anchor->selected)
 
431
      if (! vector_tool->cur_anchor->selected)
422
432
        {
423
433
          gimp_vectors_anchor_select (vector_tool->vectors,
424
434
                                      vector_tool->cur_stroke,
442
452
                                      vector_tool->cur_anchor,
443
453
                                      !vector_tool->cur_anchor->selected,
444
454
                                      FALSE);
 
455
 
445
456
          vector_tool->undo_motion = TRUE;
 
457
 
446
458
          if (vector_tool->cur_anchor->selected == FALSE)
447
459
            vector_tool->function = VECTORS_FINISHED;
448
460
        }
495
507
          gimp_vectors_stroke_remove (vector_tool->vectors,
496
508
                                      vector_tool->cur_stroke);
497
509
        }
 
510
 
498
511
      vector_tool->sel_anchor = vector_tool->cur_anchor;
499
512
      vector_tool->cur_stroke = vector_tool->sel_stroke;
500
513
 
643
656
{
644
657
  GimpVectorTool    *vector_tool = GIMP_VECTOR_TOOL (tool);
645
658
  GimpVectorOptions *options     = GIMP_VECTOR_TOOL_GET_OPTIONS (tool);
 
659
  GimpCoords         position    = GIMP_COORDS_DEFAULT_VALUES;
646
660
  GimpAnchor        *anchor;
647
661
 
648
662
  if (vector_tool->function == VECTORS_FINISHED)
649
663
    return;
650
664
 
 
665
  position.x = coords->x;
 
666
  position.y = coords->y;
 
667
 
651
668
  gimp_vectors_freeze (vector_tool->vectors);
652
669
 
653
670
  if ((vector_tool->saved_state & TOGGLE_MASK) != (state & TOGGLE_MASK))
675
692
        {
676
693
          gimp_stroke_anchor_move_absolute (vector_tool->cur_stroke,
677
694
                                            vector_tool->cur_anchor,
678
 
                                            coords, vector_tool->restriction);
 
695
                                            &position,
 
696
                                            vector_tool->restriction);
679
697
          vector_tool->undo_motion = TRUE;
680
698
        }
681
699
      break;
684
702
      if (options->polygonal)
685
703
        {
686
704
          gimp_vector_tool_move_selected_anchors (vector_tool,
687
 
                                               coords->x - vector_tool->last_x,
688
 
                                               coords->y - vector_tool->last_y);
 
705
                                                  coords->x - vector_tool->last_x,
 
706
                                                  coords->y - vector_tool->last_y);
689
707
          vector_tool->undo_motion = TRUE;
690
708
        }
691
709
      else
693
711
          gimp_stroke_point_move_absolute (vector_tool->cur_stroke,
694
712
                                           vector_tool->cur_anchor,
695
713
                                           vector_tool->cur_position,
696
 
                                           coords, vector_tool->restriction);
 
714
                                           &position,
 
715
                                           vector_tool->restriction);
697
716
          vector_tool->undo_motion = TRUE;
698
717
        }
699
718
      break;
977
996
          else
978
997
            {
979
998
              vector_tool->function = VECTORS_MOVE_HANDLE;
 
999
 
980
1000
              if (state & TOGGLE_MASK)
981
1001
                vector_tool->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC;
982
1002
              else
988
1008
          if (gimp_stroke_point_is_movable (stroke, anchor, position))
989
1009
            {
990
1010
              vector_tool->function = VECTORS_MOVE_CURVE;
 
1011
 
991
1012
              if (state & TOGGLE_MASK)
992
1013
                vector_tool->restriction = GIMP_ANCHOR_FEATURE_SYMMETRIC;
993
1014
              else
1137
1158
 
1138
1159
  if (proximity)
1139
1160
    {
1140
 
      gchar    *status = NULL;
1141
 
      gboolean  free_status = FALSE;
 
1161
      const gchar *status      = NULL;
 
1162
      gboolean     free_status = FALSE;
1142
1163
 
1143
1164
      switch (vector_tool->function)
1144
1165
        {
1145
1166
        case VECTORS_SELECT_VECTOR:
1146
1167
          status = _("Click to pick path to edit");
1147
1168
          break;
 
1169
 
1148
1170
        case VECTORS_CREATE_VECTOR:
1149
1171
          status = _("Click to create a new path");
1150
1172
          break;
 
1173
 
1151
1174
        case VECTORS_CREATE_STROKE:
1152
1175
          status = _("Click to create a new component of the path");
1153
1176
          break;
 
1177
 
1154
1178
        case VECTORS_ADD_ANCHOR:
1155
1179
          status = gimp_suggest_modifiers (_("Click or Click-Drag to create "
1156
1180
                                             "a new anchor"),
1158
1182
                                           NULL, NULL, NULL);
1159
1183
          free_status = TRUE;
1160
1184
          break;
 
1185
 
1161
1186
        case VECTORS_MOVE_ANCHOR:
1162
1187
          if (options->edit_mode != GIMP_VECTOR_MODE_EDIT)
1163
1188
            {
1170
1195
          else
1171
1196
            status = _("Click-Drag to move the anchor around");
1172
1197
          break;
 
1198
 
1173
1199
        case VECTORS_MOVE_ANCHORSET:
1174
1200
          status = _("Click-Drag to move the anchors around");
1175
1201
          break;
 
1202
 
1176
1203
        case VECTORS_MOVE_HANDLE:
1177
1204
          status = gimp_suggest_modifiers (_("Click-Drag to move the handle "
1178
1205
                                             "around"),
1180
1207
                                           NULL, NULL, NULL);
1181
1208
          free_status = TRUE;
1182
1209
          break;
 
1210
 
1183
1211
        case VECTORS_MOVE_CURVE:
1184
1212
          if (GIMP_VECTOR_TOOL_GET_OPTIONS (tool)->polygonal)
1185
1213
            status = gimp_suggest_modifiers (_("Click-Drag to move the "
1193
1221
                                             _("%s: symmetrical"), NULL, NULL);
1194
1222
          free_status = TRUE;
1195
1223
          break;
 
1224
 
1196
1225
        case VECTORS_MOVE_STROKE:
1197
1226
          status = gimp_suggest_modifiers (_("Click-Drag to move the "
1198
1227
                                             "component around"),
1200
1229
                                           NULL, NULL, NULL);
1201
1230
          free_status = TRUE;
1202
1231
          break;
 
1232
 
1203
1233
        case VECTORS_MOVE_VECTORS:
1204
1234
          status = _("Click-Drag to move the path around");
1205
1235
          break;
 
1236
 
1206
1237
        case VECTORS_INSERT_ANCHOR:
1207
1238
          status = gimp_suggest_modifiers (_("Click-Drag to insert an anchor "
1208
1239
                                             "on the path"),
1210
1241
                                           NULL, NULL, NULL);
1211
1242
          free_status = TRUE;
1212
1243
          break;
 
1244
 
1213
1245
        case VECTORS_DELETE_ANCHOR:
1214
1246
          status = _("Click to delete this anchor");
1215
1247
          break;
 
1248
 
1216
1249
        case VECTORS_CONNECT_STROKES:
1217
1250
          status = _("Click to connect this anchor "
1218
1251
                     "with the selected endpoint");
1219
1252
          break;
 
1253
 
1220
1254
        case VECTORS_DELETE_SEGMENT:
1221
1255
          status = _("Click to open up the path");
1222
1256
          break;
 
1257
 
1223
1258
        case VECTORS_CONVERT_EDGE:
1224
1259
          status = _("Click to make this node angular");
1225
1260
          break;
 
1261
 
1226
1262
        case VECTORS_FINISHED:
1227
1263
          status = NULL;
1228
1264
          break;
1232
1268
        gimp_tool_push_status (tool, display, status);
1233
1269
 
1234
1270
      if (free_status)
1235
 
        g_free (status);
 
1271
        g_free ((gchar *) status);
1236
1272
    }
1237
1273
}
1238
1274
 
1673
1709
{
1674
1710
  GimpAnchor *cur_anchor;
1675
1711
  GimpStroke *cur_stroke = NULL;
1676
 
  GList *anchors;
1677
 
  GList *list;
1678
 
  GimpCoords offset = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
 
1712
  GList      *anchors;
 
1713
  GList      *list;
 
1714
  GimpCoords  offset = { 0.0, };
1679
1715
 
1680
1716
  offset.x = x;
1681
1717
  offset.y = y;
1765
1801
  vector_tool->sel_anchor = NULL;
1766
1802
  vector_tool->sel_stroke = NULL;
1767
1803
 
1768
 
  if (!vector_tool->vectors)
 
1804
  if (! vector_tool->vectors)
1769
1805
    {
1770
1806
      vector_tool->cur_position = -1;
1771
1807
      vector_tool->cur_anchor   = NULL;
1817
1853
        }
1818
1854
    }
1819
1855
 
1820
 
  if (!cur_stroke_valid)
 
1856
  if (! cur_stroke_valid)
1821
1857
    vector_tool->cur_stroke = NULL;
1822
1858
 
1823
 
  if (!cur_anchor_valid)
 
1859
  if (! cur_anchor_valid)
1824
1860
    vector_tool->cur_anchor = NULL;
1825
1861
 
1826
1862
}