PDA

View Full Version : Should I Use Multiple NSTextViews?




robvas
Nov 27, 2011, 02:44 PM
I'm trying to write an IRC client, and am trying to figure out the best way to handle multiple channels and nick lists. There's a chat log for each channel (which I imagine will get very long, thousands of lines) and the nick list is just a list of everyone in that channel (probably 10-200 user names).

What's the best way to organize this? I thought about having 2 NSTextViews in my nib file, and then when you click an NSButton (one is created for each channel you join), it replaces the text with the stored buffer from that channel. I should be able to just change the pointer to the text data, and avoid having to copy it all each time I switch channels, correct?

The other way I thought of doing it was creating a NSTextView for the nick list and the chat log for each channel. Then when you click a button to switch to a channel, you just show those NSTextViews, the rest will be set to hide. I figure that way will also make it easier to split each channel into it's own document or chat window in the future, so you can see more than one channel at a time.

Here's a screenshot from x-chat so you can see what I mean:

http://i.imgur.com/OGTtt.png

They don't show a nick list, but mIRC does:

http://i.imgur.com/MxbHT.gif