[hg] main-silver: #217426 - Cannot change font add effects to an...

  • From: Milutin Kristofic < >
  • To:
  • Subject: [hg] main-silver: #217426 - Cannot change font add effects to an...
  • Date: Wed, 17 Apr 2013 13:00:13 -0700

changeset 907a3edd5a4a in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/907a3edd5a4a
description:
        #217426 - Cannot change font add effects to any options in the 
'Highlighting" section of Fonts & Colors Options

diffstat:

 
options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.form 
|  64 ++++++
 
options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.java 
|  96 +++++++++-
 2 files changed, 157 insertions(+), 3 deletions(-)

diffs (276 lines):

diff --git 
a/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.form
 
b/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.form
--- 
a/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.form
+++ 
b/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.form
@@ -21,15 +21,28 @@
               <Group type="103" groupAlignment="0" attributes="0">
                   <Group type="102" alignment="0" attributes="0">
                       <Component id="cpCategories" pref="206" max="32767" 
attributes="0"/>
+                      <Group type="103" groupAlignment="0" attributes="0">
+                          <Group type="102" attributes="0">
                       <EmptySpace min="-2" pref="20" max="-2" 
attributes="0"/>
                       <Group type="103" groupAlignment="0" attributes="0">
                           <Component id="lBackground" alignment="0" min="-2" 
max="-2" attributes="0"/>
                           <Component id="lForeground" alignment="0" min="-2" 
max="-2" attributes="0"/>
                       </Group>
+                          </Group>
+                          <Group type="102" alignment="0" attributes="0">
+                              <EmptySpace type="separate" max="-2" 
attributes="0"/>
+                              <Group type="103" groupAlignment="0" 
attributes="0">
+                                  <Component id="lEffectColor" min="-2" 
max="-2" attributes="0"/>
+                                  <Component id="lEffects" min="-2" max="-2" 
attributes="0"/>
+                              </Group>
+                          </Group>
+                      </Group>
                       <EmptySpace max="-2" attributes="0"/>
                       <Group type="103" groupAlignment="0" attributes="0">
                           <Component id="cbBackground" alignment="1" 
pref="49" max="32767" attributes="1"/>
                           <Component id="cbForeground" alignment="1" 
pref="49" max="32767" attributes="1"/>
+                          <Component id="cbEffects" max="32767" 
attributes="1"/>
+                          <Component id="cbEffectColor" max="32767" 
attributes="1"/>
                       </Group>
                   </Group>
                   <Component id="lCategory" alignment="0" min="-2" max="-2" 
attributes="0"/>
@@ -55,6 +68,17 @@
                           <Component id="lBackground" alignment="3" min="-2" 
max="-2" attributes="0"/>
                           <Component id="cbBackground" alignment="3" 
min="-2" max="-2" attributes="0"/>
                       </Group>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="3" attributes="0">
+                          <Component id="cbEffects" alignment="3" min="-2" 
max="-2" attributes="0"/>
+                          <Component id="lEffects" alignment="3" min="-2" 
max="-2" attributes="0"/>
+                      </Group>
+                      <EmptySpace max="-2" attributes="0"/>
+                      <Group type="103" groupAlignment="3" attributes="0">
+                          <Component id="cbEffectColor" alignment="3" 
min="-2" max="-2" attributes="0"/>
+                          <Component id="lEffectColor" alignment="3" 
min="-2" max="-2" attributes="0"/>
+                      </Group>
+                      <EmptySpace min="0" pref="0" max="32767" 
attributes="0"/>
                   </Group>
                   <Component id="cpCategories" alignment="0" pref="189" 
max="32767" attributes="0"/>
               </Group>
@@ -121,5 +145,45 @@
         <AuxValue name="JavaCodeGenerator_CreateCodeCustom" 
type="java.lang.String" value="new ColorComboBox();"/>
       </AuxValues>
     </Component>
+    <Component class="javax.swing.JComboBox" name="cbEffects">
+      <Properties>
+        <Property name="model" type="javax.swing.ComboBoxModel" 
editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
+          <StringArray count="0"/>
+        </Property>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JComboBox" name="cbEffectColor">
+      <Properties>
+        <Property name="model" type="javax.swing.ComboBoxModel" 
editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
+          <StringArray count="0"/>
+        </Property>
+      </Properties>
+      <AuxValues>
+        <AuxValue name="JavaCodeGenerator_CreateCodeCustom" 
type="java.lang.String" value="new ColorComboBox();"/>
+      </AuxValues>
+    </Component>
+    <Component class="javax.swing.JLabel" name="lEffects">
+      <Properties>
+        <Property name="labelFor" type="java.awt.Component" 
editor="org.netbeans.modules.form.ComponentChooserEditor">
+          <ComponentRef name="cbEffects"/>
+        </Property>
+        <Property name="text" type="java.lang.String" 
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString 
bundle="org/netbeans/modules/options/colors/Bundle.properties" 
key="CTL_Effects_label" 
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, 
&quot;{key}&quot;)"/>
+        </Property>
+      </Properties>
+      <AuxValues>
+        <AuxValue name="JavaCodeGenerator_SerializeTo" 
type="java.lang.String" value="HighlightingPanel_lEffects"/>
+      </AuxValues>
+    </Component>
+    <Component class="javax.swing.JLabel" name="lEffectColor">
+      <Properties>
+        <Property name="labelFor" type="java.awt.Component" 
editor="org.netbeans.modules.form.ComponentChooserEditor">
+          <ComponentRef name="cbEffectColor"/>
+        </Property>
+        <Property name="text" type="java.lang.String" 
editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString 
bundle="org/netbeans/modules/options/colors/Bundle.properties" 
key="CTL_Effects_color" 
replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, 
&quot;{key}&quot;)"/>
+        </Property>
+      </Properties>
+    </Component>
   </SubComponents>
 </Form>
diff --git 
a/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.java
 
b/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.java
--- 
a/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.java
+++ 
b/options.editor/src/org/netbeans/modules/options/colors/HighlightingPanel.java
@@ -69,6 +69,7 @@
 import javax.swing.text.AttributeSet;
 import javax.swing.text.SimpleAttributeSet;
 import javax.swing.text.StyleConstants;
+import org.netbeans.api.editor.settings.EditorStyleConstants;
 import org.openide.awt.ColorComboBox;
 import org.openide.awt.Mnemonics;
 import org.openide.util.NbBundle;
@@ -115,6 +116,15 @@
         cbForeground.addItemListener(this);
         cbBackground.addItemListener (this);
 
+        cbEffects.addItem (loc ("CTL_Effects_None"));
+        cbEffects.addItem (loc ("CTL_Effects_Underlined"));
+        cbEffects.addItem (loc ("CTL_Effects_Wave_Underlined"));
+        cbEffects.addItem (loc ("CTL_Effects_Strike_Through"));
+        cbEffects.getAccessibleContext ().setAccessibleName (loc 
("AN_Effects"));
+        cbEffects.getAccessibleContext ().setAccessibleDescription (loc 
("AD_Effects"));
+        cbEffects.addActionListener (this);
+        cbEffectColor.addItemListener(this);
+
         lCategory.setLabelFor (lCategories);
         loc (lCategory, "CTL_Category");
         loc (lForeground, "CTL_Foreground_label");
@@ -136,6 +146,10 @@
         lBackground = new javax.swing.JLabel();
         cbBackground = new ColorComboBox();
         cbForeground = new ColorComboBox();
+        cbEffects = new javax.swing.JComboBox();
+        cbEffectColor = new ColorComboBox();
+        lEffects = new javax.swing.JLabel();
+        lEffectColor = new javax.swing.JLabel();
 
         
lCategory.setText(org.openide.util.NbBundle.getMessage(HighlightingPanel.class,
 "CTL_Category")); // NOI18N
 
@@ -145,6 +159,12 @@
 
         
lBackground.setText(org.openide.util.NbBundle.getMessage(HighlightingPanel.class,
 "CTL_Background_label")); // NOI18N
 
+        lEffects.setLabelFor(cbEffects);
+        
lEffects.setText(org.openide.util.NbBundle.getMessage(HighlightingPanel.class,
 "CTL_Effects_label")); // NOI18N
+
+        lEffectColor.setLabelFor(cbEffectColor);
+        
lEffectColor.setText(org.openide.util.NbBundle.getMessage(HighlightingPanel.class,
 "CTL_Effects_color")); // NOI18N
+
         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
         this.setLayout(layout);
         layout.setHorizontalGroup(
@@ -154,14 +174,23 @@
                 
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                     .addGroup(layout.createSequentialGroup()
                         .addComponent(cpCategories, 
javax.swing.GroupLayout.DEFAULT_SIZE, 206, Short.MAX_VALUE)
+                        
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                            .addGroup(layout.createSequentialGroup()
                         .addGap(20, 20, 20)
                         
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                             .addComponent(lBackground)
-                            .addComponent(lForeground))
+                                    .addComponent(lForeground)))
+                            .addGroup(layout.createSequentialGroup()
+                                .addGap(18, 18, 18)
+                                
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                                    .addComponent(lEffectColor)
+                                    .addComponent(lEffects))))
                         
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                         
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                             .addComponent(cbBackground, 
javax.swing.GroupLayout.Alignment.TRAILING, 0, 49, Short.MAX_VALUE)
-                            .addComponent(cbForeground, 
javax.swing.GroupLayout.Alignment.TRAILING, 0, 49, Short.MAX_VALUE)))
+                            .addComponent(cbForeground, 
javax.swing.GroupLayout.Alignment.TRAILING, 0, 49, Short.MAX_VALUE)
+                            .addComponent(cbEffects, 0, 
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+                            .addComponent(cbEffectColor, 0, 
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                     .addComponent(lCategory))
                 .addContainerGap())
         );
@@ -179,7 +208,16 @@
                         
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                         
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                             .addComponent(lBackground)
-                            .addComponent(cbBackground, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)))
+                            .addComponent(cbBackground, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE))
+                        
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                        
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                            .addComponent(cbEffects, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)
+                            .addComponent(lEffects))
+                        
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+                        
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                            .addComponent(cbEffectColor, 
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 
javax.swing.GroupLayout.PREFERRED_SIZE)
+                            .addComponent(lEffectColor))
+                        .addGap(0, 0, Short.MAX_VALUE))
                     .addComponent(cpCategories, 
javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE))
                 .addContainerGap())
         );
@@ -188,11 +226,15 @@
     
     // Variables declaration - do not modify//GEN-BEGIN:variables
     private javax.swing.JComboBox cbBackground;
+    private javax.swing.JComboBox cbEffectColor;
+    private javax.swing.JComboBox cbEffects;
     private javax.swing.JComboBox cbForeground;
     private javax.swing.JScrollPane cpCategories;
     private javax.swing.JLabel lBackground;
     private javax.swing.JList lCategories;
     private javax.swing.JLabel lCategory;
+    private javax.swing.JLabel lEffectColor;
+    private javax.swing.JLabel lEffects;
     private javax.swing.JLabel lForeground;
     // End of variables declaration//GEN-END:variables
     
@@ -200,6 +242,12 @@
     @Override
     public void actionPerformed (ActionEvent evt) {
         if (!listen) return;
+        if (evt.getSource () == cbEffects) {
+            if (cbEffects.getSelectedIndex () == 0)
+                cbEffectColor.setSelectedItem( null );
+           cbEffectColor.setEnabled (cbEffects.getSelectedIndex () > 0);
+            updateData ();
+       }
         updateData ();
         changed = true;
     }
@@ -319,6 +367,34 @@
             c.removeAttribute(StyleConstants.Foreground);
         }
         
+        Color underline = null,
+              wave = null,
+              strikethrough = null;
+        if (cbEffects.getSelectedIndex () == 1)
+            underline = ((ColorComboBox)cbEffectColor).getSelectedColor();
+        if (cbEffects.getSelectedIndex () == 2)
+            wave = ((ColorComboBox)cbEffectColor).getSelectedColor();
+        if (cbEffects.getSelectedIndex () == 3)
+            strikethrough = 
((ColorComboBox)cbEffectColor).getSelectedColor();
+
+        if (underline != null) {
+            c.addAttribute(StyleConstants.Underline, underline);
+        } else {
+            c.removeAttribute(StyleConstants.Underline);
+        }
+
+        if (strikethrough != null) {
+            c.addAttribute(StyleConstants.StrikeThrough, strikethrough);
+        } else {
+            c.removeAttribute(StyleConstants.StrikeThrough);
+        }
+
+        if (wave != null) {
+            c.addAttribute(EditorStyleConstants.WaveUnderlineColor, wave);
+        } else {
+            c.removeAttribute(EditorStyleConstants.WaveUnderlineColor);
+        }
+        
         categories.set(index, c);
         toBeSaved.add(currentProfile);
     }
@@ -354,6 +430,20 @@
             
ColorComboBoxSupport.setInheritedColor((ColorComboBox)cbBackground, 
inheritedBackground);
         }
         
+        if (category.getAttribute(StyleConstants.Underline) != null) {
+            cbEffects.setSelectedIndex(1);
+            cbEffectColor.setEnabled(true);
+            ((ColorComboBox) cbEffectColor).setSelectedColor((Color) 
category.getAttribute(StyleConstants.Underline));
+        } else if 
(category.getAttribute(EditorStyleConstants.WaveUnderlineColor) != null) {
+            cbEffects.setSelectedIndex(2);
+            cbEffectColor.setEnabled(true);
+            ((ColorComboBox) cbEffectColor).setSelectedColor((Color) 
category.getAttribute(EditorStyleConstants.WaveUnderlineColor));
+        } else {
+            cbEffects.setSelectedIndex(0);
+            cbEffectColor.setEnabled(false);
+            cbEffectColor.setSelectedIndex(-1);
+        }
+    
         // set values
         ColorComboBoxSupport.setSelectedColor((ColorComboBox)cbForeground, 
(Color) category.getAttribute (StyleConstants.Foreground));
         ColorComboBoxSupport.setSelectedColor((ColorComboBox)cbBackground, 
(Color) category.getAttribute (StyleConstants.Background));

[hg] main-silver: #217426 - Cannot change font add effects to an...

Milutin Kristofic 04/17/2013

Project Features

About this Project

Editor was started in November 2009, is owned by Martin Ryzl, and has 147 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close