[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tm-cvs-commit] moberhuber org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas StyleMap.java

Update of /cvsroot/tools/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas
In directory dev1:/tmp/cvs-serv30868/src/org/eclipse/tm/internal/terminal/textcanvas

Modified Files:
      Tag: R3_2_maintenance
	StyleMap.java 
Log Message:
Bug 335411 - Backport [terminal] Terminal colors don't match expectations

Index: StyleMap.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/StyleMap.java,v
retrieving revision 1.14
retrieving revision 1.14.4.1
diff -C2 -d -r1.14 -r1.14.4.1
*** StyleMap.java	18 Feb 2009 18:11:09 -0000	1.14
--- StyleMap.java	26 Jan 2011 02:29:25 -0000	1.14.4.1
***************
*** 1,4 ****
  /*******************************************************************************
!  * Copyright (c) 2007, 2009 Wind River Systems, Inc. and others.
   * All rights reserved. This program and the accompanying materials
   * are made available under the terms of the Eclipse Public License v1.0
--- 1,4 ----
  /*******************************************************************************
!  * Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
   * All rights reserved. This program and the accompanying materials
   * are made available under the terms of the Eclipse Public License v1.0
***************
*** 12,15 ****
--- 12,16 ----
   * Michael Scharf (Wind River) - [206328] Terminal does not draw correctly with proportional fonts
   * Martin Oberhuber (Wind River) - [247700] Terminal uses ugly fonts in JEE package
+  * Martin Oberhuber (Wind River) - [335358] Fix Terminal color definition
   *******************************************************************************/
  package org.eclipse.tm.internal.terminal.textcanvas;
***************
*** 47,50 ****
--- 48,52 ----
  	Map fColorMapForeground=new HashMap();
  	Map fColorMapBackground=new HashMap();
+ 	Map fColorMapIntense=new HashMap();
  	Map fFontMap=new HashMap();
  	private Point fCharSize;
***************
*** 61,64 ****
--- 63,67 ----
  		initForegroundColors();
  		initBackgroundColors();
+ 		initIntenseColors();
  	}
  	private void initForegroundColors() {
***************
*** 66,82 ****
  			setColor(fColorMapForeground, WHITE, 0, 0, 0);
  			setColor(fColorMapForeground, WHITE_FOREGROUND, 50, 50, 50);
! 			setColor(fColorMapForeground, BLACK, 255, 255, 255);
  		} else {
  			setColor(fColorMapForeground, WHITE, 255, 255, 255);
  			setColor(fColorMapForeground, WHITE_FOREGROUND, 229, 229, 229);
! 			setColor(fColorMapForeground, BLACK, 0, 0, 0);
  		}
! 		setColor(fColorMapForeground, RED, 255, 128, 128);
! 		setColor(fColorMapForeground, GREEN, 128, 255, 128);
! 		setColor(fColorMapForeground, BLUE, 128, 128, 255);
! 		setColor(fColorMapForeground, YELLOW, 255, 255, 0);
! 		setColor(fColorMapForeground, CYAN, 0, 255, 255);
! 		setColor(fColorMapForeground, MAGENTA, 255, 255, 0);
! 		setColor(fColorMapForeground, GRAY, 128, 128, 128);
  	}
  
--- 69,85 ----
  			setColor(fColorMapForeground, WHITE, 0, 0, 0);
  			setColor(fColorMapForeground, WHITE_FOREGROUND, 50, 50, 50);
! 			setColor(fColorMapForeground, BLACK, 229, 229, 229);
  		} else {
  			setColor(fColorMapForeground, WHITE, 255, 255, 255);
  			setColor(fColorMapForeground, WHITE_FOREGROUND, 229, 229, 229);
! 			setColor(fColorMapForeground, BLACK, 50, 50, 50);
  		}
! 		setColor(fColorMapForeground, RED, 205, 0, 0);
! 		setColor(fColorMapForeground, GREEN, 0, 205, 0);
! 		setColor(fColorMapForeground, BLUE, 0, 0, 238);
! 		setColor(fColorMapForeground, YELLOW, 205, 205, 0);
! 		setColor(fColorMapForeground, CYAN, 0, 205, 205);
! 		setColor(fColorMapForeground, MAGENTA, 205, 0, 205);
! 		setColor(fColorMapForeground, GRAY, 229, 229, 229);
  	}
  
***************
*** 91,102 ****
  			setColor(fColorMapBackground, BLACK, 0, 0, 0);
  		}
! 		setColor(fColorMapBackground, RED, 255, 128, 128);
! 		setColor(fColorMapBackground, GREEN, 128, 255, 128);
! 		setColor(fColorMapBackground, BLUE, 128, 128, 255);
! 		setColor(fColorMapBackground, YELLOW, 255, 255, 0);
! 		setColor(fColorMapBackground, CYAN, 0, 255, 255);
! 		setColor(fColorMapBackground, MAGENTA, 255, 255, 0);
! 		setColor(fColorMapBackground, GRAY, 128, 128, 128);
  	}
  	private void setColor(Map colorMap, String name, int r, int g, int b) {
  		String colorName=PREFIX+r+"-"+g+"-"+b;  //$NON-NLS-1$//$NON-NLS-2$
--- 94,125 ----
  			setColor(fColorMapBackground, BLACK, 0, 0, 0);
  		}
! 		setColor(fColorMapBackground, RED, 205, 0, 0);
! 		setColor(fColorMapBackground, GREEN, 0, 205, 0);
! 		setColor(fColorMapBackground, BLUE, 0, 0, 238);
! 		setColor(fColorMapBackground, YELLOW, 205, 205, 0);
! 		setColor(fColorMapBackground, CYAN, 0, 205, 205);
! 		setColor(fColorMapBackground, MAGENTA, 205, 0, 205);
! 		setColor(fColorMapBackground, GRAY, 229, 229, 229);
  	}
+ 
+ 	private void initIntenseColors() {
+ 		if(fInvertColors) {
+ 			setColor(fColorMapIntense, WHITE, 127, 127, 127);
+ 			setColor(fColorMapIntense, WHITE_FOREGROUND, 0, 0, 0); // only used when colors are inverse
+ 			setColor(fColorMapIntense, BLACK, 255, 255, 255);
+ 		} else {
+ 			setColor(fColorMapIntense, WHITE, 255, 255, 255);
+ 			setColor(fColorMapIntense, WHITE_FOREGROUND, 255, 255, 255);
+ 			setColor(fColorMapIntense, BLACK, 0, 0, 0);
+ 		}
+ 		setColor(fColorMapIntense, RED, 255, 0, 0);
+ 		setColor(fColorMapIntense, GREEN, 0, 255, 0);
+ 		setColor(fColorMapIntense, BLUE, 92, 92, 255);
+ 		setColor(fColorMapIntense, YELLOW, 255, 255, 0);
+ 		setColor(fColorMapIntense, CYAN, 0, 255, 255);
+ 		setColor(fColorMapIntense, MAGENTA, 255, 0, 255);
+ 		setColor(fColorMapIntense, GRAY, 255, 255, 255);
+ 	}
+ 	
  	private void setColor(Map colorMap, String name, int r, int g, int b) {
  		String colorName=PREFIX+r+"-"+g+"-"+b;  //$NON-NLS-1$//$NON-NLS-2$
***************
*** 112,119 ****
  	public Color getForegrondColor(Style style) {
  		style = defaultIfNull(style);
  		if(style.isReverse())
! 			return getColor(fColorMapForeground,style.getBackground());
  		else
! 			return  getColor(fColorMapForeground,style.getForground());
  	}
  	public Color getBackgroundColor(Style style) {
--- 135,144 ----
  	public Color getForegrondColor(Style style) {
  		style = defaultIfNull(style);
+ 		Map map = style.isBold() ? fColorMapIntense : fColorMapForeground;
+ 		//Map map = fColorMapForeground;
  		if(style.isReverse())
! 			return getColor(map ,style.getBackground());
  		else
! 			return  getColor(map ,style.getForground());
  	}
  	public Color getBackgroundColor(Style style) {