Prefs: can now change background and caret colors in SciNotes 33/11133/2
Calixte DENIZET [Thu, 28 Mar 2013 10:18:48 +0000 (11:18 +0100)]
Change-Id: Ic798a13357e8b6d53cd36251a127fea31e922443

scilab/modules/preferences/etc/XConfiguration.xml
scilab/modules/scinotes/etc/XConfiguration-scinotes.xml
scilab/modules/scinotes/etc/XConfiguration-scinotes.xsl
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/SciNotes.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/SciNotesOptions.java
scilab/modules/scinotes/src/java/org/scilab/modules/scinotes/ScilabEditorPane.java

index 7710e03..7187ce7 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<interface version="0.11" path="1/" width="800" height="550">
+<interface version="0.12" path="1/" width="800" height="600">
     <general/>
     <web/>
     <preference/>
index d3a91b2..c21c1e1 100644 (file)
@@ -5,7 +5,7 @@
     </body>
     <display title="_(Display)">
         <body>
-            <scinotes-display highlight-current-line="false" current-line-color="#FACADE" show-line-numbers="true" wrap-lines="true" keywords-colorization="true" highlight-brackets="true" brackets-color="#E40087" brackets-highlightment="Framed" brackets-onmouseover="true" highlight-keywords="true" keywords-color="#FFF3D2" keywords-highlightment="Filled" keywords-onmouseover="true" whereami="false" tab-size="4" tab-representation="chevrons" use-spaces="true" indent-size="4" automatic-indent="true" auto-complete-openers="true" auto-complete-keywords="true"/>
+            <scinotes-display highlight-current-line="false" current-line-color="#FACADE" show-line-numbers="true" wrap-lines="true" keywords-colorization="true" highlight-brackets="true" brackets-color="#E40087" brackets-highlightment="Framed" brackets-onmouseover="true" highlight-keywords="true" keywords-color="#FFF3D2" keywords-highlightment="Filled" keywords-onmouseover="true" whereami="false" tab-size="4" tab-representation="chevrons" use-spaces="true" indent-size="4" automatic-indent="true" auto-complete-openers="true" auto-complete-keywords="true" background-color="#FFFFFF" caret-color="#000000"/>
         </body>
     </display>
     <header title="_(Header)">
index eae6476..39a1c59 100644 (file)
                     
                 </Checkbox>
                 
+                <Label text="_(Background color: )" gridx="1" gridy="4" weightx="0"/>
+                <Color color="{@background-color}" listener="ActionListener" gridx="2" gridy="4" fill="none" weightx="0" anchor="west">
+                    
+                    <actionPerformed choose="background-color">
+                        
+                        <xsl:call-template name="context"/>
+                        
+                    </actionPerformed>
+                    
+                </Color>
+                
+                <Label text="_(Cursor color: )" gridx="3" gridy="4" weightx="0"/>
+                <Color color="{@caret-color}" listener="ActionListener" gridx="4" gridy="4" weightx="0" fill="none" anchor="east">
+                    
+                    <actionPerformed choose="caret-color">
+                        
+                        <xsl:call-template name="context"/>
+                        
+                    </actionPerformed>
+                    
+                </Color>
             </Grid>
             
         </Title>
index bdd3ece..08ccd68 100644 (file)
@@ -1443,9 +1443,8 @@ public class SciNotes extends SwingScilabTab {
         pane.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
         pane.setFont(kit.getStylePreferences().tokenFonts[0]);
 
-        // TODO rajouter ca ds les prefs
-        pane.setBackground(ConfigSciNotesManager.getSciNotesBackgroundColor());
-        pane.setCaretColor(ConfigSciNotesManager.getSciNotesForegroundColor());
+        pane.setBackground(SciNotesOptions.getSciNotesDisplay().backgroundColor);
+        pane.setCaretColor(SciNotesOptions.getSciNotesDisplay().caretColor);
 
         pane.setFocusable(true);
         pane.setRequestFocusEnabled(true);
index 10f3fff..bd303c0 100644 (file)
@@ -70,12 +70,12 @@ public class SciNotesOptions {
 
             if (eol.equals("")) {
                 switch (OS.get()) {
-                case WINDOWS:
-                    this.eol = ScilabDocument.EOLWIN;
-                    break;
-                default:
-                    this.eol = ScilabDocument.EOLUNIX;
-                    break;
+                    case WINDOWS:
+                        this.eol = ScilabDocument.EOLWIN;
+                        break;
+                    default:
+                        this.eol = ScilabDocument.EOLUNIX;
+                        break;
                 }
             } else if (eol.startsWith("Windows")) {
                 this.eol = ScilabDocument.EOLWIN;
@@ -114,11 +114,13 @@ public class SciNotesOptions {
         public boolean automaticIndent;
         public boolean autoCompleteOpeners;
         public boolean autoCompleteKeywords;
+        public Color backgroundColor;
+        public Color caretColor;
 
         private Display() { }
 
-        @XConfAttribute(tag = "scinotes-display", attributes = {"highlight-current-line", "current-line-color", "show-line-numbers", "wrap-lines", "keywords-colorization", "highlight-brackets", "brackets-color", "brackets-highlightment", "brackets-onmouseover", "highlight-keywords", "keywords-color", "keywords-highlightment", "keywords-onmouseover", "whereami", "tab-size", "tab-representation", "use-spaces", "indent-size", "automatic-indent", "auto-complete-openers", "auto-complete-keywords"})
-        private void set(boolean highlightCurrentLine, Color currentLineColor, boolean showLineNumbers, boolean wrapLines, boolean keywordsColorization, boolean highlightBrackets, Color bracketsColor, String bracketsHighlightment, boolean bracketsOnmouseover, boolean highlightKeywords, Color keywordsColor, String keywordsHighlightment, boolean keywordsOnmouseover, boolean whereami, int tabSize, String tabRepresentation, boolean useSpaces, int indentSize, boolean automaticIndent, boolean autoCompleteOpeners, boolean autoCompleteKeywords) {
+        @XConfAttribute(tag = "scinotes-display", attributes = {"highlight-current-line", "current-line-color", "show-line-numbers", "wrap-lines", "keywords-colorization", "highlight-brackets", "brackets-color", "brackets-highlightment", "brackets-onmouseover", "highlight-keywords", "keywords-color", "keywords-highlightment", "keywords-onmouseover", "whereami", "tab-size", "tab-representation", "use-spaces", "indent-size", "automatic-indent", "auto-complete-openers", "auto-complete-keywords", "background-color", "caret-color"})
+        private void set(boolean highlightCurrentLine, Color currentLineColor, boolean showLineNumbers, boolean wrapLines, boolean keywordsColorization, boolean highlightBrackets, Color bracketsColor, String bracketsHighlightment, boolean bracketsOnmouseover, boolean highlightKeywords, Color keywordsColor, String keywordsHighlightment, boolean keywordsOnmouseover, boolean whereami, int tabSize, String tabRepresentation, boolean useSpaces, int indentSize, boolean automaticIndent, boolean autoCompleteOpeners, boolean autoCompleteKeywords, Color backgroundColor, Color caretColor) {
             this.highlightCurrentLine = highlightCurrentLine;
             this.currentLineColor = currentLineColor;
             this.showLineNumbers = showLineNumbers;
@@ -164,6 +166,8 @@ public class SciNotesOptions {
 
             this.autoCompleteOpeners = autoCompleteOpeners;
             this.autoCompleteKeywords = autoCompleteKeywords;
+            this.backgroundColor = backgroundColor;
+            this.caretColor = caretColor;
         }
     }
 
index 367a85e..8481adb 100644 (file)
@@ -309,6 +309,8 @@ public class ScilabEditorPane extends JEditorPane implements Highlighter.Highlig
             enableHighlightedLine(SciNotesOptions.getSciNotesDisplay().highlightCurrentLine);
             setHighlightedLineColor(SciNotesOptions.getSciNotesDisplay().currentLineColor);
             enableColorization(SciNotesOptions.getSciNotesDisplay().keywordsColorization);
+            setBackground(SciNotesOptions.getSciNotesDisplay().backgroundColor);
+            setCaretColor(SciNotesOptions.getSciNotesDisplay().caretColor);
 
             boolean kw = SciNotesOptions.getSciNotesDisplay().highlightKeywords;
             boolean op = SciNotesOptions.getSciNotesDisplay().highlightBrackets;