Browse Source

Re add the code to enable the topic bar to show tne entire topic wrapped onto a multiline topic bar

Fixes issue 3251: make showfulltopic work

Change-Id: I036e36ae88eed2281fa1ef6086440f927767a751
Reviewed-on: http://gerrit.dmdirc.com/854
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
tags/0.6.3
Gregory Holmes 14 years ago
parent
commit
462fcff921

+ 4
- 5
src/com/dmdirc/addons/ui_swing/SwingController.java View File

794
                 getDomain(),
794
                 getDomain(),
795
                 "shownicklist", "Show nicklist?",
795
                 "shownicklist", "Show nicklist?",
796
                 "Do you want the nicklist visible"));
796
                 "Do you want the nicklist visible"));
797
-        //TODO issue 3251
798
-        //advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(),
799
-        //       "showfulltopic", "Show full topic in topic bar?",
800
-        //       "Do you want to show the full topic in the topic bar or just" +
801
-        //       "first line?"));
797
+        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(),
798
+               "showfulltopic", "Show full topic in topic bar?",
799
+               "Do you want to show the full topic in the topic bar or just" +
800
+               "first line?"));
802
         advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
801
         advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
803
                 getDomain(), "hideEmptyTopicBar", "Hide empty topic bar?",
802
                 getDomain(), "hideEmptyTopicBar", "Hide empty topic bar?",
804
                 "Do you want to hide the topic bar when there is no topic"));
803
                 "Do you want to hide the topic bar when there is no topic"));

+ 20
- 18
src/com/dmdirc/addons/ui_swing/components/TopicBar.java View File

59
 import javax.swing.text.SimpleAttributeSet;
59
 import javax.swing.text.SimpleAttributeSet;
60
 import javax.swing.text.StyleConstants;
60
 import javax.swing.text.StyleConstants;
61
 import javax.swing.text.StyledDocument;
61
 import javax.swing.text.StyledDocument;
62
+import javax.swing.text.StyledEditorKit;
62
 
63
 
63
 import net.miginfocom.swing.MigLayout;
64
 import net.miginfocom.swing.MigLayout;
64
 
65
 
108
         topicLengthMax = channel.getMaxTopicLength();
109
         topicLengthMax = channel.getMaxTopicLength();
109
         errorIcon =
110
         errorIcon =
110
                 new JLabel(IconManager.getIconManager().getIcon("input-error"));
111
                 new JLabel(IconManager.getIconManager().getIcon("input-error"));
111
-        //TODO issue 3251
112
-        //if (channelFrame.getConfigManager().getOptionBool(controller.
113
-        //        getDomain(), "showfulltopic")) {
114
-        //    topicText.setEditorKit(new StyledEditorKit());
115
-        //} else {
116
-        topicText.setEditorKit(new WrapEditorKit());
117
-        //}
112
+        if (channelFrame.getConfigManager().getOptionBool(controller.
113
+                getDomain(), "showfulltopic")) {
114
+            topicText.setEditorKit(new StyledEditorKit());
115
+        } else {
116
+            topicText.setEditorKit(new WrapEditorKit());
117
+        }
118
         ((DefaultStyledDocument) topicText.getDocument()).setDocumentFilter(
118
         ((DefaultStyledDocument) topicText.getDocument()).setDocumentFilter(
119
                 new NewlinesDocumentFilter());
119
                 new NewlinesDocumentFilter());
120
 
120
 
215
         }
215
         }
216
         topicText.setCaretPosition(0);
216
         topicText.setCaretPosition(0);
217
         validateTopic();
217
         validateTopic();
218
+        setVisible(false);
219
+        setVisible(true);
218
     }
220
     }
219
 
221
 
220
     /**
222
     /**
383
     /** {@inheritDoc} */
385
     /** {@inheritDoc} */
384
     @Override
386
     @Override
385
     public void configChanged(String domain, String key) {
387
     public void configChanged(String domain, String key) {
386
-        //TODO issue 3251
387
-        //if ("showfulltopic".equals(key)) {
388
-        //    if (channel.getConfigManager().getOptionBool(controller.getDomain(),
389
-        //            "showfulltopic")) {
390
-        //        topicText.setEditorKit(new StyledEditorKit());
391
-        //    } else {
392
-        //        topicText.setEditorKit(new WrapEditorKit());
393
-        //    }
394
-        //    ((DefaultStyledDocument) topicText.getDocument()).setDocumentFilter(
395
-        //            new NewlinesDocumentFilter());
396
-        //}
388
+        if ("showfulltopic".equals(key)) {
389
+            if (channel.getConfigManager().getOptionBool(controller.getDomain(),
390
+                    "showfulltopic")) {
391
+                topicText.setEditorKit(new StyledEditorKit());
392
+            } else {
393
+                topicText.setEditorKit(new WrapEditorKit());
394
+            }
395
+            ((DefaultStyledDocument) topicText.getDocument()).setDocumentFilter(
396
+                    new NewlinesDocumentFilter());
397
+            topicChanged(channel, null);
398
+        }
397
         setColours();
399
         setColours();
398
         if ("hideEmptyTopicBar".equals(key)) {
400
         if ("hideEmptyTopicBar".equals(key)) {
399
             setVisible(true);
401
             setVisible(true);

Loading…
Cancel
Save