357 ! |
359 ! |
358 |
360 |
359 drop:anObjectOrCollection at:aPoint |
361 drop:anObjectOrCollection at:aPoint |
360 |spec newSel oldSel dragOffset| |
362 |spec newSel oldSel dragOffset| |
361 |
363 |
362 (oldSel := selection) isCollection ifTrue:[ |
364 self selection notNil ifTrue:[ |
363 oldSel := selection copy |
365 oldSel := self singleSelection. |
|
366 |
|
367 (self canPasteInto:oldSel) ifFalse:[ |
|
368 oldSel := nil. |
|
369 self setSelection:nil withRedraw:true |
|
370 ] |
364 ]. |
371 ]. |
365 spec := (anObjectOrCollection at:1) theObject. |
372 spec := (anObjectOrCollection at:1) theObject. |
366 dragOffset := DragAndDropManager dragOffsetQuerySignal raise. |
373 dragOffset := DragAndDropManager dragOffsetQuerySignal raise. |
367 newSel := self pasteSpecifications:spec keepLayout:false at:aPoint - dragOffset. |
374 newSel := self pasteSpecifications:spec keepLayout:false at:aPoint - dragOffset. |
368 |
375 |
369 oldSel isNil ifTrue:[self select:newSel] |
376 oldSel isNil ifTrue:[self select:newSel] |
370 ifFalse:[self select:oldSel] |
377 ifFalse:[self select:oldSel] |
371 |
|
372 "Modified: 11.8.1997 / 16:41:52 / cg" |
|
373 ! ! |
378 ! ! |
374 |
379 |
375 !UIPainterView methodsFor:'generating output'! |
380 !UIPainterView methodsFor:'generating output'! |
376 |
381 |
377 generateActionMethodFor:aspect spec:protoSpec inClass:targetClass |
382 generateActionMethodFor:aspect spec:protoSpec inClass:targetClass |
378 |args showIt| |
383 |selector args showIt code alreadyInSuperclass| |
379 |
384 |
380 (aspect asSymbol numArgs) == 1 ifFalse:[ |
385 selector := aspect asSymbol. |
381 args := '\'. |
386 |
|
387 alreadyInSuperclass := targetClass superclass canUnderstand:selector. |
|
388 |
|
389 (selector numArgs) == 1 ifFalse:[ |
|
390 args := ''. |
382 showIt := ' ...''.\'. |
391 showIt := ' ...''.\'. |
383 ] ifTrue:[ |
392 ] ifTrue:[ |
384 args := 'anArgument\'. |
393 args := 'anArgument'. |
385 showIt := ''' , anArgument printString , '' ...''.\'. |
394 showIt := ''' , anArgument printString , '' ...''.\'. |
386 ]. |
395 ]. |
387 |
396 |
388 ^ ('!!' , targetClass name , ' methodsFor:''actions''!!\\' , |
397 code := '!!' , targetClass name , ' methodsFor:''actions''!!\\' , |
389 aspect , args , |
398 aspect , args , '\' , |
390 ' "automatically generated by UIPainter ..."\' , |
399 ' "automatically generated by UIPainter ..."\' , |
391 '\' , |
400 '\' . |
392 ' "action to be added ..."\' , |
401 |
393 ' Transcript showCR:self class name , '': action for ' , aspect , showIt , |
402 alreadyInSuperclass ifTrue:[ |
394 '!! !!\\') withCRs |
403 code := code , |
|
404 ' "action for ' , aspect , ' is already provided in a superclass."\' , |
|
405 ' "It may be redefined here ..."\\'. |
|
406 ] ifFalse:[ |
|
407 code := code , |
|
408 ' "action to be added ..."\\'. |
|
409 ]. |
|
410 |
|
411 code := code , |
|
412 ' Transcript showCR:self class name, '': '. |
|
413 alreadyInSuperclass ifTrue:[ |
|
414 code := code , 'inherited '. |
|
415 ]. |
|
416 code := code , 'action for ' , aspect , showIt. |
|
417 |
|
418 alreadyInSuperclass ifTrue:[ |
|
419 code := code , |
|
420 ' super ' , aspect , args , '.\'. |
|
421 ]. |
|
422 |
|
423 code := code , |
|
424 '!! !!\\'. |
|
425 ^ code withCRs |
|
426 |
|
427 "Modified: 19.8.1997 / 12:03:20 / cg" |
395 ! |
428 ! |
396 |
429 |
397 generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass |
430 generateAspectMethodFor:aspect spec:protoSpec inClass:targetClass |
398 |modelClass| |
431 |modelClass| |
399 |
432 |