Revision 9a3b7d13

View differences:

ide/org.omnetpp.sequencechart/src/org/omnetpp/sequencechart/widgets/SequenceChart.java
3236 3236
		int currentLineWidth = 0;
3237 3237
		boolean changedLineStyleForCriticalPath = false;
3238 3238

  
3239
		if (sequenceChartFacade.IMessageDependency_isReuse(messageDependencyPtr) && !showOtherMessageReuses)
3239
		if (sequenceChartFacade.IMessageDependency_isReuse(messageDependencyPtr) && !showOtherMessageReuses) {
3240 3240
			return false;
3241
		}
3242

  
3241 3243

  
3242
		if (sequenceChartFacade.IMessageDependency_isSelfMessageReuse(messageDependencyPtr) && !showSelfMessageReuses)
3243
		    return false;
3244
		if (sequenceChartFacade.IMessageDependency_isSelfMessageReuse(messageDependencyPtr) && !showSelfMessageReuses) {
3245
			return false;
3246
		}
3244 3247

  
3245 3248
		// events may be omitted from the log
3246
		if (causeEventPtr == 0 || consequenceEventPtr == 0)
3249
		if (causeEventPtr == 0 || consequenceEventPtr == 0) {
3247 3250
			return false;
3251
		}
3248 3252

  
3249 3253
		// cache message dependency state
3250 3254
		long beginSendEntryPtr = sequenceChartFacade.IMessageDependency_getBeginSendEntry(messageDependencyPtr);
......
3317 3321
        }
3318 3322

  
3319 3323
        // at least one of the events must be in range or we don't draw anything
3320
        if (x1 == invalid && x2 == invalid)
3321
            return false;
3324
        if (x1 == invalid && x2 == invalid) {
3325
			return false;
3326
        }
3322 3327

  
3323 3328
		// line color and style depends on message kind
3324 3329
		if (graphics != null) {
......
3333 3338
		}
3334 3339

  
3335 3340
		// change line style if critical path should be visualized
3336
		if (showCriticalPath && graphics != null) {
3341
		if (showCriticalPath && graphics != null && (showMessageSends || showSelfMessages)) {
3337 3342
			boolean causeOnPath = sequenceChartFacade.isOnCriticalPath(sequenceChartFacade.IEvent_getEvent(causeEventPtr));
3338 3343
			boolean consequenceOnPath = sequenceChartFacade.isOnCriticalPath(sequenceChartFacade.IEvent_getEvent(consequenceEventPtr));
3339 3344
			if (causeOnPath && consequenceOnPath) {
......
3349 3354
		// test if self-message
3350 3355
        if (y1 == y2) {
3351 3356
            // FIXME: this filters out non self messages too, e.g. filtered and returns to same module
3352
		    if (!showSelfMessages)
3357
		    if (!showSelfMessages) {
3358
				resetGraphicsFromCriticalPath(graphics, changedLineStyleForCriticalPath, currentLineWidth, currentForegroundColor);
3353 3359
		        return false;
3360
		    }
3354 3361

  
3355 3362
		    long eventNumberDelta = messageId + consequenceEventNumber - causeEventNumber;
3356 3363
			int numberOfPossibleEllipseHeights = Math.max(1, (int)Math.round((getAxisSpacing() - fontHeight) / (fontHeight + 10)));
......
3370 3377
					if (showMessageNames)
3371 3378
						drawMessageDependencyLabel(graphics, messageDependencyPtr, x1, y1, 2, -fontHeight);
3372 3379
				}
3373
				else
3380
				else {
3381
					resetGraphicsFromCriticalPath(graphics, changedLineStyleForCriticalPath, currentLineWidth, currentForegroundColor);
3374 3382
					return lineContainsPoint(x1, y1, x2, y2, fitX, fitY, tolerance);
3383
				}
3375 3384
			}
3376 3385
			else {
3377 3386
				boolean showArrowHeads = this.showArrowHeads;
......
3394 3403
						if (isFilteredMessageDependency)
3395 3404
							drawFilteredMessageDependencySign(graphics, x1, ym, x2, ym);
3396 3405
					}
3397
					else
3406
					else {
3407
						resetGraphicsFromCriticalPath(graphics, changedLineStyleForCriticalPath, currentLineWidth, currentForegroundColor);
3398 3408
						return lineContainsPoint(x1, ym, xm, ym, fitX, fitY, tolerance) ||
3399 3409
						   halfEllipseContainsPoint(1, x1, x2, y1, halfEllipseHeight, fitX, fitY, tolerance);
3410
					}
3411
						
3400 3412
				}
3401 3413
				// consequence is too far away
3402 3414
				else if (x2 == invalid) {
......
3420 3432

  
3421 3433
						showArrowHeads = false;
3422 3434
					}
3423
					else
3435
					else {
3436
						resetGraphicsFromCriticalPath(graphics, changedLineStyleForCriticalPath, currentLineWidth, currentForegroundColor);
3424 3437
						return lineContainsPoint(xm, ym, x2, ym, fitX, fitY, tolerance) ||
3425 3438
						   halfEllipseContainsPoint(0, x1, x2, y1, halfEllipseHeight, fitX, fitY, tolerance);
3439
					}
3440
						
3426 3441
				}
3427 3442
				// both events are close enough
3428 3443
				else {
......
3436 3451
						if (isFilteredMessageDependency)
3437 3452
							drawFilteredMessageDependencySign(graphics, x1, ym, x2, ym);
3438 3453
					}
3439
					else
3454
					else {
3455
						resetGraphicsFromCriticalPath(graphics, changedLineStyleForCriticalPath, currentLineWidth, currentForegroundColor);
3440 3456
						return halfEllipseContainsPoint(-1, x1, x2, y1, halfEllipseHeight, fitX, fitY, tolerance);
3457
					}
3441 3458
				}
3442 3459

  
3443 3460
				if (showArrowHeads) {
......
3469 3486
			}
3470 3487
		}
3471 3488
		else {
3472
            if (!showMessageSends)
3473
                return false;
3489
            if (!showMessageSends) {
3490
				resetGraphicsFromCriticalPath(graphics, changedLineStyleForCriticalPath, currentLineWidth, currentForegroundColor);
3491
				return false;
3492
            }
3474 3493

  
3475 3494
            int y = (y2 + y1) / 2;
3476 3495
			Color arrowHeadFillColor = null;
......
3545 3564
				}
3546 3565
			}
3547 3566

  
3548
			if (graphics == null)
3567
			if (graphics == null) {
3568
				resetGraphicsFromCriticalPath(graphics, changedLineStyleForCriticalPath, currentLineWidth, currentForegroundColor);
3549 3569
				return lineContainsPoint(x1, y1, x2, y2, fitX, fitY, tolerance);
3570
			}
3571
				
3550 3572

  
3551 3573
			if (graphics != null && isFilteredMessageDependency)
3552 3574
				drawFilteredMessageDependencySign(graphics, x1, y1, x2, y2);
......
3570 3592
		// when fitting we should have already returned
3571 3593
		Assert.isTrue(graphics != null);
3572 3594
		
3595
		resetGraphicsFromCriticalPath(graphics, changedLineStyleForCriticalPath, currentLineWidth, currentForegroundColor);
3596
		
3597
		return false;
3598
	}
3599
	
3600
	/*
3601
	 * Resets the graphic line style. Only called from within drawOrFitMessageDependency
3602
	 */
3603
	private void resetGraphicsFromCriticalPath(Graphics graphics, boolean changedLineStyleForCriticalPath, int currentLineWidth, Color currentForegroundColor) {
3573 3604
		// reset line style
3574 3605
		if (changedLineStyleForCriticalPath && graphics != null) {
3575 3606
			graphics.setLineWidth(currentLineWidth);
3576 3607
			graphics.setForegroundColor(currentForegroundColor);
3577 3608
		}
3578
		
3579
		return false;
3580 3609
	}
3581 3610

  
3582 3611
	/**

Also available in: Unified diff