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,11 +794,10 @@ public final class SwingController extends Plugin implements Serializable,
794 794
                 getDomain(),
795 795
                 "shownicklist", "Show nicklist?",
796 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 801
         advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
803 802
                 getDomain(), "hideEmptyTopicBar", "Hide empty topic bar?",
804 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,6 +59,7 @@ import javax.swing.text.DefaultStyledDocument;
59 59
 import javax.swing.text.SimpleAttributeSet;
60 60
 import javax.swing.text.StyleConstants;
61 61
 import javax.swing.text.StyledDocument;
62
+import javax.swing.text.StyledEditorKit;
62 63
 
63 64
 import net.miginfocom.swing.MigLayout;
64 65
 
@@ -108,13 +109,12 @@ public class TopicBar extends JComponent implements ActionListener,
108 109
         topicLengthMax = channel.getMaxTopicLength();
109 110
         errorIcon =
110 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 118
         ((DefaultStyledDocument) topicText.getDocument()).setDocumentFilter(
119 119
                 new NewlinesDocumentFilter());
120 120
 
@@ -215,6 +215,8 @@ public class TopicBar extends JComponent implements ActionListener,
215 215
         }
216 216
         topicText.setCaretPosition(0);
217 217
         validateTopic();
218
+        setVisible(false);
219
+        setVisible(true);
218 220
     }
219 221
 
220 222
     /**
@@ -383,17 +385,17 @@ public class TopicBar extends JComponent implements ActionListener,
383 385
     /** {@inheritDoc} */
384 386
     @Override
385 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 399
         setColours();
398 400
         if ("hideEmptyTopicBar".equals(key)) {
399 401
             setVisible(true);

Loading…
Cancel
Save