mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 10:25:32 +02:00
Bug 294468 - [terminal] When a horizontal scrollbar is visible, terminal size is missing 1 line
This commit is contained in:
parent
488a377215
commit
ec57b279a1
3 changed files with 13 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007 Wind River Systems, Inc. and others.
|
* Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,9 +7,11 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Michael Scharf (Wind River) - initial API and implementation
|
* Michael Scharf (Wind River) - initial API and implementation
|
||||||
|
* Anton Leherbauer (Wind River) - [294468] Fix scroller and text line rendering
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.internal.terminal.textcanvas;
|
package org.eclipse.tm.internal.terminal.textcanvas;
|
||||||
|
|
||||||
|
import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,4 +23,5 @@ public interface ILinelRenderer {
|
||||||
void drawLine(ITextCanvasModel model, GC gc, int line, int x, int y, int colFirst, int colLast);
|
void drawLine(ITextCanvasModel model, GC gc, int line, int x, int y, int colFirst, int colLast);
|
||||||
void onFontChange();
|
void onFontChange();
|
||||||
void setInvertedColors(boolean invert);
|
void setInvertedColors(boolean invert);
|
||||||
|
Color getDefaultBackgroundColor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.swt.events.FocusListener;
|
||||||
import org.eclipse.swt.events.MouseEvent;
|
import org.eclipse.swt.events.MouseEvent;
|
||||||
import org.eclipse.swt.events.MouseListener;
|
import org.eclipse.swt.events.MouseListener;
|
||||||
import org.eclipse.swt.events.MouseMoveListener;
|
import org.eclipse.swt.events.MouseMoveListener;
|
||||||
|
import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
@ -278,7 +279,6 @@ public class TextCanvas extends GridCanvas {
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* If set then if the size changes
|
* If set then if the size changes
|
||||||
* @param scrollLock
|
|
||||||
*/
|
*/
|
||||||
public void setScrollLock(boolean scrollLock) {
|
public void setScrollLock(boolean scrollLock) {
|
||||||
fScrollLock=scrollLock;
|
fScrollLock=scrollLock;
|
||||||
|
@ -290,7 +290,9 @@ public class TextCanvas extends GridCanvas {
|
||||||
}
|
}
|
||||||
protected void drawLine(GC gc, int line, int x, int y, int colFirst, int colLast) {
|
protected void drawLine(GC gc, int line, int x, int y, int colFirst, int colLast) {
|
||||||
fCellRenderer.drawLine(fCellCanvasModel, gc,line,x,y,colFirst, colLast);
|
fCellRenderer.drawLine(fCellCanvasModel, gc,line,x,y,colFirst, colLast);
|
||||||
|
}
|
||||||
|
protected Color getTerminalBackgroundColor() {
|
||||||
|
return fCellRenderer.getDefaultBackgroundColor();
|
||||||
}
|
}
|
||||||
protected void visibleCellRectangleChanged(int x, int y, int width, int height) {
|
protected void visibleCellRectangleChanged(int x, int y, int width, int height) {
|
||||||
fCellCanvasModel.setVisibleRectangle(y,x,height,width);
|
fCellCanvasModel.setVisibleRectangle(y,x,height,width);
|
||||||
|
|
|
@ -29,10 +29,8 @@ import org.eclipse.tm.terminal.model.Style;
|
||||||
public class TextLineRenderer implements ILinelRenderer {
|
public class TextLineRenderer implements ILinelRenderer {
|
||||||
private final ITextCanvasModel fModel;
|
private final ITextCanvasModel fModel;
|
||||||
StyleMap fStyleMap=new StyleMap();
|
StyleMap fStyleMap=new StyleMap();
|
||||||
Color fBackgroundColor;
|
|
||||||
public TextLineRenderer(TextCanvas c, ITextCanvasModel model) {
|
public TextLineRenderer(TextCanvas c, ITextCanvasModel model) {
|
||||||
fModel=model;
|
fModel=model;
|
||||||
fBackgroundColor=Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
|
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.imagicus.thumbs.view.ICellRenderer#getCellWidth()
|
* @see com.imagicus.thumbs.view.ICellRenderer#getCellWidth()
|
||||||
|
@ -88,15 +86,17 @@ public class TextLineRenderer implements ILinelRenderer {
|
||||||
|
|
||||||
private void fillBackground(GC gc, int x, int y, int width, int height) {
|
private void fillBackground(GC gc, int x, int y, int width, int height) {
|
||||||
Color bg=gc.getBackground();
|
Color bg=gc.getBackground();
|
||||||
gc.setBackground(getBackgroundColor());
|
gc.setBackground(getDefaultBackgroundColor());
|
||||||
gc.fillRectangle (x,y,width,height);
|
gc.fillRectangle (x,y,width,height);
|
||||||
gc.setBackground(bg);
|
gc.setBackground(bg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color getBackgroundColor() {
|
public Color getDefaultBackgroundColor() {
|
||||||
return fBackgroundColor;
|
// null == default style
|
||||||
|
return fStyleMap.getBackgroundColor(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawCursor(ITextCanvasModel model, GC gc, int row, int x, int y, int colFirst) {
|
private void drawCursor(ITextCanvasModel model, GC gc, int row, int x, int y, int colFirst) {
|
||||||
if(!model.isCursorOn())
|
if(!model.isCursorOn())
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue