From 44e6abd331fa34b1c981516e9898a56fd2a7daef Mon Sep 17 00:00:00 2001
From: Ludovic Apvrille <ludovic.apvrille@telecom-paristech.fr>
Date: Tue, 6 Jan 2009 09:54:02 +0000
Subject: [PATCH] Bug on commentary analysis in TML specification : solved
 //This line, and those below, will be ignored--

M    src/myutil/Conversion.java
M    src/TMLTranslator.java
M    src/tmltranslator/TMLTextSpecification.java
M    src/ui/req/Requirement.java
---
 src/TMLTranslator.java                      | 11 +++++++++--
 src/myutil/Conversion.java                  |  3 ++-
 src/tmltranslator/TMLTextSpecification.java |  2 ++
 src/ui/req/Requirement.java                 | 11 +++++++++--
 4 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/TMLTranslator.java b/src/TMLTranslator.java
index 734e86ddab..9694e6201f 100755
--- a/src/TMLTranslator.java
+++ b/src/TMLTranslator.java
@@ -81,7 +81,7 @@ public class TMLTranslator  {
 		System.out.println("TMLTranslator is released under a CECILL License. See http://www.cecill.info/index.en.html");
 		System.out.println("For more information on TURTLE related technologies, please consult http://labsoc.comelec.enst.fr/turtle/");
 		
-		System.out.println("Enjoy!\n");
+		System.out.println("Enjoy!!!\n");
 	}
 	
 	public static void printUsage() {
@@ -180,7 +180,7 @@ public class TMLTranslator  {
 		//System.out.println("load");
 		TMLMappingTextSpecification spec = new TMLMappingTextSpecification(title);
 		ret = spec.makeTMLMapping(inputData, path);
-		//System.out.println("load ended");
+		System.out.println("load ended");
 		ArrayList<TMLError> warnings;
 		
 		if (!ret) {
@@ -192,7 +192,13 @@ public class TMLTranslator  {
 			tmap = spec.getTMLMapping(); 
 			tmlm = tmap.getTMLModeling();
 			
+			//System.out.println("\n\n*** TML Modeling *** \n");
+			//TMLTextSpecification textspec = new TMLTextSpecification("toto");
+			//String s = textspec.toTextFormat(tmlm);
+			//System.out.println(s);
+			
 			// Checking syntax
+			System.out.println("--- Checking syntax of the whole specification (TML, TARCHI, TMAP)---");
 			TMLSyntaxChecking syntax = new TMLSyntaxChecking(tmap);
 			ret = checkSyntax(syntax);
 			
@@ -334,6 +340,7 @@ public class TMLTranslator  {
 	}
 	
 	public static boolean convertToSystemC2() {
+		//System.out.println("Converting to SystemC2 ... yo!");
 		tmltranslator.tomappingsystemc2.TML2MappingSystemC map;
 		if (tmap == null) {
 			map = new tmltranslator.tomappingsystemc2.TML2MappingSystemC(tmlm);
diff --git a/src/myutil/Conversion.java b/src/myutil/Conversion.java
index 78e0b11e40..be656a54d7 100755
--- a/src/myutil/Conversion.java
+++ b/src/myutil/Conversion.java
@@ -455,7 +455,6 @@ public class Conversion {
 			index ++;
 			
 			if(c == '\"') {
-				
 				if (isEscaped) {
 					isEscaped = false;
 				} else {
@@ -514,6 +513,8 @@ public class Conversion {
 					index = 0;
 					isSlashed = false;
 				}
+			} else {
+				isSlashed = false;
 			}
 			
 		}
diff --git a/src/tmltranslator/TMLTextSpecification.java b/src/tmltranslator/TMLTextSpecification.java
index e6935cd900..e3e8af975c 100755
--- a/src/tmltranslator/TMLTextSpecification.java
+++ b/src/tmltranslator/TMLTextSpecification.java
@@ -975,6 +975,8 @@ public class TMLTextSpecification {
 			random.setMinValue(_split[3]);
 			random.setMaxValue(_split[4]);
 			
+			System.out.println("RANDOM min=" + random.getMinValue() + " max=" + random.getMaxValue());
+			
 			task.getActivityDiagram().addElement(random);
 			tmlae.addNext(random);
 			tmlae = random;
diff --git a/src/ui/req/Requirement.java b/src/ui/req/Requirement.java
index 8f746e5709..9d3396aed1 100755
--- a/src/ui/req/Requirement.java
+++ b/src/ui/req/Requirement.java
@@ -568,6 +568,11 @@ public class Requirement extends TGCScalableWithInternalComponent implements Wit
 			return;
 		}
 		
+		Font f = graphics.getFont();
+		Font f0 = f.deriveFont((float)currentFontSize);
+		Font f1 = f0.deriveFont(Font.BOLD);
+		Font f2 = f.deriveFont((float)(currentFontSize - 2));
+		
 		// Must find for both modes which width is desirable
 		String s0, s1;
 		if (formal) {
@@ -578,12 +583,14 @@ public class Requirement extends TGCScalableWithInternalComponent implements Wit
 			s1 = "Text=";
 		}
 		
+		graphics.setFont(f2);
 		int w0 = graphics.getFontMetrics().stringWidth(s0);
+		graphics.setFont(f1);
 		int w1 = graphics.getFontMetrics().stringWidth(value);
 		int w2 = Math.max(w0, w1) + (2 * iconSize);
-		int w3, w4 = w2;
-		
 		
+		graphics.setFont(f0);
+		int w3, w4 = w2;
 		int i;
 		
 		if(texts.length == 1) {
-- 
GitLab