|
From: <Qa...@us...> - 2006-12-12 22:50:00
|
Revision: 2905
http://jnode.svn.sourceforge.net/jnode/?rev=2905&view=rev
Author: QaDeS
Date: 2006-12-12 14:49:58 -0800 (Tue, 12 Dec 2006)
Log Message:
-----------
proportional font cursor fix (generic)
tiny cleanups
Modified Paths:
--------------
trunk/distr/src/apps/org/jnode/apps/console/ShellEmu.java
trunk/gui/src/driver/org/jnode/driver/console/swing/SwingTextScreenConsoleManager.java
trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java
Modified: trunk/distr/src/apps/org/jnode/apps/console/ShellEmu.java
===================================================================
--- trunk/distr/src/apps/org/jnode/apps/console/ShellEmu.java 2006-12-12 22:20:48 UTC (rev 2904)
+++ trunk/distr/src/apps/org/jnode/apps/console/ShellEmu.java 2006-12-12 22:49:58 UTC (rev 2905)
@@ -14,7 +14,7 @@
public static void main(String[] argv) throws Exception {
initEnv();
SwingTextScreenConsoleManager cm = new SwingTextScreenConsoleManager();
- new Thread(new CommandShell((TextConsole) cm.createConsole(null,
+ new Thread(new CommandShell((TextConsole) cm.createConsole("Console 1",
ConsoleManager.CreateOptions.TEXT | ConsoleManager.CreateOptions.SCROLLABLE))).
start();
}
Modified: trunk/gui/src/driver/org/jnode/driver/console/swing/SwingTextScreenConsoleManager.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/console/swing/SwingTextScreenConsoleManager.java 2006-12-12 22:20:48 UTC (rev 2904)
+++ trunk/gui/src/driver/org/jnode/driver/console/swing/SwingTextScreenConsoleManager.java 2006-12-12 22:49:58 UTC (rev 2905)
@@ -35,6 +35,7 @@
initializeKeyboard(systemScreen.getKeyboardDevice());
addPointerDevice(systemScreen.getPointerDevivce());
frame = new JFrame("Console");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.addWindowListener(new WindowAdapter(){
public void windowClosed(WindowEvent e) {
closeAll();
Modified: trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java
===================================================================
--- trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java 2006-12-12 22:20:48 UTC (rev 2904)
+++ trunk/gui/src/driver/org/jnode/driver/textscreen/swing/SwingPcTextScreen.java 2006-12-12 22:49:58 UTC (rev 2905)
@@ -15,6 +15,7 @@
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
+import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.KeyboardFocusManager;
import java.awt.event.*;
@@ -88,11 +89,11 @@
int offset = i * SCREEN_WIDTH;
int lenght = SCREEN_WIDTH;
if (offset <= cursorOffset && cursorOffset < offset + SCREEN_WIDTH) {
- char[] line = new char[SCREEN_WIDTH];
- for (int j = 0; j < SCREEN_WIDTH; j++) {
- line[j] = offset + j == cursorOffset ? '_' : ' ';
- }
- g.drawChars(line, 0, lenght, margin, h + i * h);
+ FontMetrics fm = getFontMetrics(getFont());
+ int x = margin + fm.charsWidth(buffer, offset, cursorOffset - offset);
+ int y = h + i * h;
+ int width = fm.charWidth(buffer[cursorOffset]);
+ g.drawLine(x, y, x+width, y);
}
g.drawChars(buffer, offset, lenght, margin, h + i * h);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|