Page 1 of 1
help with making a new tab
Posted: Fri Jun 20, 2008 2:32 pm
by the panda next door
I find that when I have been sent private messages, they are stuck in between other chat messages and I need to scroll up or down and find flashing messages. Because of that, I want to make a new tab and bind it to "Shift+F5", but what I'm trying obviously isn't working. I have already made the tab appear with the text "->you". How to filter and insert text into the tab also eludes me.
Posted: Fri Jun 20, 2008 9:31 pm
by joevano
Why don't you run debugger on the code and see what happens when you switch tabs, that may give you a clue...
Posted: Sat Jun 21, 2008 12:47 pm
by anomaly
Look in playing.cxx around line 2568 for 'case MsgMessage:' . That seems to be where the player to player messages are handled. You can follow the logic to figure out how to code your own message mode.
Posted: Tue Jun 24, 2008 4:25 am
by Enigma
If you followed what anomaly said, you should have ended up looking in the function handleMessage(void*) in playing.cxx. If you scroll to the end of the function, you'll see some calls to addMessage(). This function calls ControlPanel::addMessage(), and, as you would expect, adds a message to the console. The integer constant passed to addMessage() in playing.cxx is the tab the text will show up in. The integer constant corresponds to an enumeration in ControlPanel.h:
Code: Select all
enum MessageModes {
MessageAllTabs = -2,
MessageCurrent = -1,
MessageAll = 0,
MessageChat = 1,
MessageServer = 2,
MessageMisc = 3,
MessageAdmin = 4, //I added this to try adding a tab
MessageModeCount
};
The enumeration is private, which explains why integer constants are used instead of the enumeration names.
In playing.cxx, I just added a small "if(toAdmin)" to the code:
Code: Select all
if (fromServer)
addMessage(NULL, fullMsg, 2, false, oldcolor.c_str());
else if(toAdmin)
addMessage(NULL, fullMsg, 4, false, oldcolor.c_str());
else
addMessage(NULL, fullMsg, 1, false, oldcolor.c_str());
binding tab to F5
Posted: Tue Jun 24, 2008 6:53 pm
by the panda next door
I finally got it to work!
Explanation in this pic: