summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scilab/CHANGES_5.3.X9
-rw-r--r--scilab/modules/Makefile.am2
-rw-r--r--scilab/modules/Makefile.in16
-rw-r--r--scilab/modules/commons/src/java/org/scilab/commons/gui/ScilabCaret.java84
-rw-r--r--scilab/modules/console/src/java/org/scilab/modules/console/SciInputCommandView.java7
-rw-r--r--scilab/modules/console/src/java/org/scilab/modules/console/SciOutputView.java14
-rw-r--r--scilab/modules/console/tests/nonreg_tests/bug_7625.tst23
7 files changed, 137 insertions, 18 deletions
diff --git a/scilab/CHANGES_5.3.X b/scilab/CHANGES_5.3.X
index 80f0d52..1eaebd9 100644
--- a/scilab/CHANGES_5.3.X
+++ b/scilab/CHANGES_5.3.X
@@ -1,6 +1,15 @@
1 Changes between version 5.3.0-beta-2 and 5.3.0-beta-3 of Scilab 1 Changes between version 5.3.0-beta-2 and 5.3.0-beta-3 of Scilab
2 =============================================================== 2 ===============================================================
3 3
4Scilab:
5=======
6
7Some long-standing usability bugs have been fixed in this release:
8
9* bug 7625 fixed - Some selection issues were appearing from time to time when
10 Scilab was losing the focus.
11
12
4SciNotes: 13SciNotes:
5========= 14=========
6 15
diff --git a/scilab/modules/Makefile.am b/scilab/modules/Makefile.am
index c5f017d..f2ed570 100644
--- a/scilab/modules/Makefile.am
+++ b/scilab/modules/Makefile.am
@@ -28,6 +28,7 @@ history_manager \
28spreadsheet \ 28spreadsheet \
29tclsci \ 29tclsci \
30localization \ 30localization \
31commons \
31action_binding \ 32action_binding \
32renderer \ 33renderer \
33shell \ 34shell \
@@ -36,7 +37,6 @@ console \
36graphic_export \ 37graphic_export \
37gui \ 38gui \
38jvm \ 39jvm \
39commons \
40graphics \ 40graphics \
41optimization \ 41optimization \
42symbolic \ 42symbolic \
diff --git a/scilab/modules/Makefile.in b/scilab/modules/Makefile.in
index 3738876..eaf4e06 100644
--- a/scilab/modules/Makefile.in
+++ b/scilab/modules/Makefile.in
@@ -153,10 +153,10 @@ ETAGS = etags
153CTAGS = ctags 153CTAGS = ctags
154DIST_SUBDIRS = core output_stream arnoldi elementary_functions string \ 154DIST_SUBDIRS = core output_stream arnoldi elementary_functions string \
155 api_scilab dynamic_link fileio history_manager spreadsheet \ 155 api_scilab dynamic_link fileio history_manager spreadsheet \
156 tclsci localization action_binding renderer shell completion \ 156 tclsci localization commons action_binding renderer shell \
157 console graphic_export gui jvm commons graphics optimization \ 157 completion console graphic_export gui jvm graphics \
158 symbolic randlib statistics special_functions interpolation \ 158 optimization symbolic randlib statistics special_functions \
159 linear_algebra integer data_structures mexlib \ 159 interpolation linear_algebra integer data_structures mexlib \
160 differential_equations cacsd polynomials boolean double pvm io \ 160 differential_equations cacsd polynomials boolean double pvm io \
161 intersci signal_processing call_scilab sound time sparse \ 161 intersci signal_processing call_scilab sound time sparse \
162 windows_tools functions overloading maple2scilab m2sci texmacs \ 162 windows_tools functions overloading maple2scilab m2sci texmacs \
@@ -440,10 +440,10 @@ top_srcdir = @top_srcdir@
440# since it already linked almost the whole world 440# since it already linked almost the whole world
441SUBDIRS = core output_stream arnoldi elementary_functions string \ 441SUBDIRS = core output_stream arnoldi elementary_functions string \
442 api_scilab dynamic_link fileio history_manager spreadsheet \ 442 api_scilab dynamic_link fileio history_manager spreadsheet \
443 tclsci localization action_binding renderer shell completion \ 443 tclsci localization commons action_binding renderer shell \
444 console graphic_export gui jvm commons graphics optimization \ 444 completion console graphic_export gui jvm graphics \
445 symbolic randlib statistics special_functions interpolation \ 445 optimization symbolic randlib statistics special_functions \
446 linear_algebra integer data_structures mexlib \ 446 interpolation linear_algebra integer data_structures mexlib \
447 differential_equations cacsd polynomials boolean double pvm io \ 447 differential_equations cacsd polynomials boolean double pvm io \
448 intersci signal_processing core call_scilab interpolation \ 448 intersci signal_processing core call_scilab interpolation \
449 sound time randlib sparse windows_tools functions overloading \ 449 sound time randlib sparse windows_tools functions overloading \
diff --git a/scilab/modules/commons/src/java/org/scilab/commons/gui/ScilabCaret.java b/scilab/modules/commons/src/java/org/scilab/commons/gui/ScilabCaret.java
new file mode 100644
index 0000000..61e8c4e
--- /dev/null
+++ b/scilab/modules/commons/src/java/org/scilab/commons/gui/ScilabCaret.java
@@ -0,0 +1,84 @@
1/*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2010 - Calixte DENIZET
4 *
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
10 *
11 */
12
13package org.scilab.modules.commons.gui;
14
15import java.awt.Color;
16import java.awt.event.FocusEvent;
17import java.awt.event.FocusListener;
18import java.awt.event.MouseEvent;
19
20import javax.swing.text.JTextComponent;
21import javax.swing.UIManager;
22import javax.swing.text.DefaultCaret;
23
24/**
25 * This class handles the tabulation
26 * @author Calixte DENIZET
27 */
28public class ScilabCaret extends DefaultCaret {
29
30 private static final long serialVersionUID = 8230195712653828841L;
31
32 private static Color selectionColor;
33 private static Color inactiveSelectionColor;
34
35 private JTextComponent editor;
36
37 /**
38 * Constructor
39 * @param editor the editor where the caret lives
40 */
41 public ScilabCaret(JTextComponent editor) {
42 super();
43 this.editor = editor;
44 selectionColor = editor.getSelectionColor();
45 inactiveSelectionColor = UIManager.getColor("TextComponent.selectionBackgroundInactive");
46 if (inactiveSelectionColor == null) {
47 float r = 0.6f * selectionColor.getRed() / 255f + 0.4f * Color.LIGHT_GRAY.getRed() / 255f;
48 float g = 0.6f * selectionColor.getGreen() / 255f + 0.4f * Color.LIGHT_GRAY.getGreen() / 255f;
49 float b = 0.6f * selectionColor.getBlue() / 255f + 0.4f * Color.LIGHT_GRAY.getBlue() / 255f;
50 inactiveSelectionColor = new Color(r, g, b);
51 }
52 }
53
54 /**
55 * {@inheritDoc}
56 */
57 public void setSelectionVisible(boolean vis) {
58 super.setSelectionVisible(true);
59 }
60
61 /**
62 * {@inheritDoc}
63 */
64 public void focusGained(FocusEvent e) {
65 editor.setSelectionColor(selectionColor);
66 super.focusGained(e);
67 }
68
69 /**
70 * {@inheritDoc}
71 */
72 public void focusLost(FocusEvent e) {
73 editor.setSelectionColor(inactiveSelectionColor);
74 super.focusLost(e);
75 }
76
77 /**
78 * {@inheritDoc}
79 */
80 public void mouseDragged(MouseEvent e) {
81 editor.setSelectionColor(selectionColor);
82 super.mouseDragged(e);
83 }
84}
diff --git a/scilab/modules/console/src/java/org/scilab/modules/console/SciInputCommandView.java b/scilab/modules/console/src/java/org/scilab/modules/console/SciInputCommandView.java
index c0753f6..a09f588 100644
--- a/scilab/modules/console/src/java/org/scilab/modules/console/SciInputCommandView.java
+++ b/scilab/modules/console/src/java/org/scilab/modules/console/SciInputCommandView.java
@@ -10,12 +10,10 @@
10 * 10 *
11 */ 11 */
12 12
13
14/* Copyright INRIA 2007 */
15
16package org.scilab.modules.console; 13package org.scilab.modules.console;
17 14
18import org.scilab.modules.history_manager.HistoryManagement; 15import org.scilab.modules.history_manager.HistoryManagement;
16import org.scilab.modules.commons.gui.ScilabCaret;
19import java.awt.Component; 17import java.awt.Component;
20import java.awt.EventQueue; 18import java.awt.EventQueue;
21import java.awt.FontMetrics; 19import java.awt.FontMetrics;
@@ -40,7 +38,7 @@ import com.artenum.rosetta.ui.ConsoleTextPane;
40import com.artenum.rosetta.util.StringConstants; 38import com.artenum.rosetta.util.StringConstants;
41 39
42/** 40/**
43 * Scilab UI that contains the line edited by th euser 41 * Scilab UI that contains the line edited by the user
44 * @author Vincent COUVERT 42 * @author Vincent COUVERT
45 */ 43 */
46public class SciInputCommandView extends ConsoleTextPane implements InputCommandView { 44public class SciInputCommandView extends ConsoleTextPane implements InputCommandView {
@@ -67,6 +65,7 @@ public class SciInputCommandView extends ConsoleTextPane implements InputCommand
67 65
68 // Input command line is not editable when created 66 // Input command line is not editable when created
69 this.setEditable(false); 67 this.setEditable(false);
68 setCaret(new ScilabCaret(this));
70 } 69 }
71 70
72 /** 71 /**
diff --git a/scilab/modules/console/src/java/org/scilab/modules/console/SciOutputView.java b/scilab/modules/console/src/java/org/scilab/modules/console/SciOutputView.java
index d32db66..8fa053b 100644
--- a/scilab/modules/console/src/java/org/scilab/modules/console/SciOutputView.java
+++ b/scilab/modules/console/src/java/org/scilab/modules/console/SciOutputView.java
@@ -12,6 +12,7 @@
12 12
13package org.scilab.modules.console; 13package org.scilab.modules.console;
14 14
15import java.awt.Color;
15import java.awt.Dimension; 16import java.awt.Dimension;
16import java.awt.Toolkit; 17import java.awt.Toolkit;
17import java.awt.datatransfer.Clipboard; 18import java.awt.datatransfer.Clipboard;
@@ -20,6 +21,8 @@ import java.awt.datatransfer.Transferable;
20import java.awt.datatransfer.UnsupportedFlavorException; 21import java.awt.datatransfer.UnsupportedFlavorException;
21import java.awt.dnd.DnDConstants; 22import java.awt.dnd.DnDConstants;
22import java.awt.dnd.DropTarget; 23import java.awt.dnd.DropTarget;
24import java.awt.event.FocusEvent;
25import java.awt.event.FocusListener;
23import java.awt.event.MouseEvent; 26import java.awt.event.MouseEvent;
24import java.io.IOException; 27import java.io.IOException;
25import java.io.Writer; 28import java.io.Writer;
@@ -32,11 +35,14 @@ import javax.swing.JPanel;
32import javax.swing.JScrollPane; 35import javax.swing.JScrollPane;
33import javax.swing.JTextPane; 36import javax.swing.JTextPane;
34import javax.swing.SwingUtilities; 37import javax.swing.SwingUtilities;
38import javax.swing.UIManager;
35import javax.swing.text.BadLocationException; 39import javax.swing.text.BadLocationException;
36import javax.swing.text.DefaultCaret; 40import javax.swing.text.DefaultCaret;
37import javax.swing.text.JTextComponent; 41import javax.swing.text.JTextComponent;
38import javax.swing.text.StyleContext; 42import javax.swing.text.StyleContext;
39 43
44import org.scilab.modules.commons.gui.ScilabCaret;
45
40import com.artenum.rosetta.interfaces.ui.OutputView; 46import com.artenum.rosetta.interfaces.ui.OutputView;
41import com.artenum.rosetta.util.BufferedWriter; 47import com.artenum.rosetta.util.BufferedWriter;
42import com.artenum.rosetta.util.StringConstants; 48import com.artenum.rosetta.util.StringConstants;
@@ -98,15 +104,13 @@ public class SciOutputView extends JTextPane implements OutputView {
98 * Default caret for output view (to handle paste actions using middle button) 104 * Default caret for output view (to handle paste actions using middle button)
99 * @author Vincent COUVERT 105 * @author Vincent COUVERT
100 */ 106 */
101 final class FixedCaret extends DefaultCaret { 107 final class FixedCaret extends ScilabCaret {
102
103 private static final long serialVersionUID = 8230195712653828841L;
104 108
105 /** 109 /**
106 * Constructor 110 * Constructor
107 */ 111 */
108 private FixedCaret() { 112 private FixedCaret() {
109 super(); 113 super(SciOutputView.this);
110 } 114 }
111 115
112 /** 116 /**
diff --git a/scilab/modules/console/tests/nonreg_tests/bug_7625.tst b/scilab/modules/console/tests/nonreg_tests/bug_7625.tst
new file mode 100644
index 0000000..1b2b274
--- /dev/null
+++ b/scilab/modules/console/tests/nonreg_tests/bug_7625.tst
@@ -0,0 +1,23 @@
1// =============================================================================
2// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3// Copyright (C) 2010 - Calixte DENIZET
4//
5// This file is distributed under the same license as the Scilab package.
6// =============================================================================
7
8// <-- INTERACTIVE TEST -->
9// <-- TEST WITH CONSOLE -->
10//
11// <-- Non-regression test for bug 7625 -->
12//
13// <-- Bugzilla URL -->
14// http://bugzilla.scilab.org/show_bug.cgi?id=7625
15//
16// <-- Short Description -->
17// Problem with selection which disappeared when a window lost the focus.
18
19// i) Have a terminal and a console opened.
20// ii) Select a line in the console.
21// iii) Select a line in the terminal.
22
23// the selection in the console shouldn't disappear.