From: <wel...@us...> - 2010-01-06 13:29:56
|
Revision: 5160 http://planeshift.svn.sourceforge.net/planeshift/?rev=5160&view=rev Author: weltall2 Date: 2010-01-06 13:29:44 +0000 (Wed, 06 Jan 2010) Log Message: ----------- added the possibility to define your own chat window widget. Added a gui feature to choose between chat_basic.xml and chat.xml. defaulted chat_basic.xml. Modified Paths: -------------- trunk/data/gui/configchattabs.xml trunk/data/options/chat_def.xml trunk/src/client/gui/chatwindow.cpp trunk/src/client/gui/chatwindow.h trunk/src/client/gui/pawsconfigchattabs.cpp trunk/src/client/gui/pawsconfigchattabs.h trunk/src/client/psengine.cpp trunk/src/client/psengine.h Added Paths: ----------- trunk/data/gui/chat_basic.xml Added: trunk/data/gui/chat_basic.xml =================================================================== --- trunk/data/gui/chat_basic.xml (rev 0) +++ trunk/data/gui/chat_basic.xml 2010-01-06 13:29:44 UTC (rev 5160) @@ -0,0 +1,219 @@ +<widget_description> + <widget name="ChatWindow" factory="pawsChatWindow" visible="yes" savepositions="yes" movable="yes" resizable="yes" keepaspect="no" configurable="yes" style="New Standard GUI" scalefont="no"> + + <frame x="0" y="300" width="505" height="268" border="no" /> + <minframe width="350" height="100" /> + <maxframe width="1000" height="1000" /> + <title resource="Scaling Title Bar" text="Communication" align="left" close_button="yes"/> + <bgimage resource="Scaling Widget Background" /> + + <widget name="InputText" factory="pawsEditTextBox"> + <frame x="50" y="243" width="445" height="25" border="no" /> + <attachpoints> + <attach point="PROPORTIONAL_RIGHT" /> + <attach point="PROPORTIONAL_BOTTOM" /> + <attach point="ATTACH_LEFT" /> + </attachpoints> + </widget> + + + + <widget name="Chat Tabs" factory="pawsTabWindow"> + <frame x="0" y="0" width="500" height="268" border="no" /> + <attachpoints> + <attach point="ATTACH_BOTTOM" /> + <attach point="ATTACH_TOP" /> + <attach point="ATTACH_LEFT" /> + <attach point="ATTACH_RIGHT" /> + </attachpoints> + + + <widget name="ButtonsBackground" factory="pawsWidget"> + <frame x="0" y="0" width="50" height="268" border="no" /> + <bgimage resource="Scaling Field Background" /> + <attachpoints> + <attach point="ATTACH_TOP" /> + <attach point="ATTACH_BOTTOM" /> + <attach point="ATTACH_LEFT" /> + <attach point="ATTACH_RIGHT" /> + </attachpoints> + </widget> + + <widget name="Main Button" factory="pawsButton" toggle="yes" id="1000" tooltip="Main" shadows="yes" style="Standard Tab"> + <frame x="0" y="0" width="50" height="25" border="no" /> + <label text="Main"/> + <attachpoints> + <attach point="ATTACH_TOP" /> + <attach point="ATTACH_LEFT" /> + </attachpoints> + + </widget> + <widget name="NPC Button" factory="pawsButton" toggle="yes" id="1002" tooltip="NPC" shadows="yes" style="Standard Tab"> + <frame x="0" y="25" width="50" height="25" border="no" /> + <label text="NPC"/> + <attachpoints> + <attach point="ATTACH_TOP" /> + <attach point="ATTACH_LEFT" /> + </attachpoints> + + </widget> + <widget name="Tell Button" factory="pawsButton" toggle="yes" id="1003" tooltip="Whisper" shadows="yes" style="Standard Tab"> + <frame x="0" y="50" width="50" height="25" border="no" /> + <label text="Whisper"/> + <attachpoints> + <attach point="ATTACH_TOP" /> + <attach point="ATTACH_LEFT" /> + </attachpoints> + + </widget> + + </widget> + <widget name="Help Button" factory="pawsButton" toggle="yes" id="1007" tooltip="Help" shadows="yes" style="Standard Tab"> + <label text="Help"/> + <frame x="0" y="75" width="50" height="25" border="no" /> + <attachpoints> + <attach point="ATTACH_TOP" /> + <attach point="ATTACH_LEFT" /> + </attachpoints> + + </widget> + + + + <widget name="MainText" factory="pawsMessageTextBox" visible="no" id="1100"> + <frame x="55" y="0" width="435" height="233" border="no" /> + <attachpoints> + <attach point="ATTACH_RIGHT" /> + <attach point="PROPORTIONAL_TOP" /> + <attach point="ATTACH_LEFT" /> + <attach point="PROPORTIONAL_BOTTOM" /> + </attachpoints> + <pawsScrollBar width="15" tick="0.1" maxValue="1.0" /> + <subscriptions overwrite = "false"> + <subscribe data="subMainText" /> + </subscriptions> + </widget> + <widget name="SystemText" factory="pawsMessageTextBox" visible="no" id="1101"> + <frame x="55" y="0" width="435" height="233" border="no" /> + <attachpoints> + <attach point="ATTACH_RIGHT" /> + <attach point="PROPORTIONAL_TOP" /> + <attach point="ATTACH_LEFT" /> + <attach point="PROPORTIONAL_BOTTOM" /> + </attachpoints> + <subscriptions overwrite = "false"> + <subscribe data="subSystemText" /> + </subscriptions> + <pawsScrollBar width="15" tick="0.1" maxValue="1.0" /> + </widget> + <widget name="NpcText" factory="pawsMessageTextBox" visible="no" id="1102"> + <frame x="55" y="0" width="435" height="233" border="no" /> + <attachpoints> + <attach point="ATTACH_RIGHT" /> + <attach point="PROPORTIONAL_TOP" /> + <attach point="ATTACH_LEFT" /> + <attach point="PROPORTIONAL_BOTTOM" /> + </attachpoints> + <subscriptions overwrite = "false"> + <subscribe data="subNPCText" /> + </subscriptions> + <pawsScrollBar width="15" tick="0.1" maxValue="1.0" /> + </widget> + <widget name="TellText" factory="pawsMessageTextBox" visible="no" id="1103"> + <frame x="55" y="0" width="435" height="233" border="no" /> + <attachpoints> + <attach point="ATTACH_RIGHT" /> + <attach point="PROPORTIONAL_TOP" /> + <attach point="ATTACH_LEFT" /> + <attach point="PROPORTIONAL_BOTTOM" /> + </attachpoints> + <subscriptions overwrite = "false"> + <subscribe data="subTellText" /> + </subscriptions> + <pawsScrollBar width="15" tick="0.1" maxValue="1.0" /> + </widget> + <widget name="GuildText" factory="pawsMessageTextBox" visible="no" id="1104"> + <frame x="55" y="0" width="435" height="233" border="no" /> + <attachpoints> + <attach point="ATTACH_RIGHT" /> + <attach point="PROPORTIONAL_TOP" /> + <attach point="ATTACH_LEFT" /> + <attach point="PROPORTIONAL_BOTTOM" /> + </attachpoints> + <subscriptions overwrite = "false"> + <subscribe data="subGuildText" /> + </subscriptions> + <pawsScrollBar width="15" tick="0.1" maxValue="1.0" /> + </widget> + <widget name="AllianceText" factory="pawsMessageTextBox" visible="no" id="1109"> + <frame x="55" y="0" width="435" height="233" border="no" /> + <attachpoints> + <attach point="ATTACH_RIGHT" /> + <attach point="PROPORTIONAL_TOP" /> + <attach point="ATTACH_LEFT" /> + <attach point="PROPORTIONAL_BOTTOM" /> + </attachpoints> + <subscriptions overwrite = "false"> + <subscribe data="subAllianceText" /> + </subscriptions> + <pawsScrollBar width="15" tick="0.1" maxValue="1.0" /> + </widget> + <widget name="GroupText" factory="pawsMessageTextBox" visible="no" id="1105"> + <frame x="55" y="0" width="435" height="233" border="no" /> + <attachpoints> + <attach point="ATTACH_RIGHT" /> + <attach point="PROPORTIONAL_TOP" /> + <attach point="ATTACH_LEFT" /> + <attach point="PROPORTIONAL_BOTTOM" /> + </attachpoints> + <subscriptions overwrite = "false"> + <subscribe data="subGroupText" /> + </subscriptions> + <pawsScrollBar width="15" tick="0.1" maxValue="1.0" /> + </widget> + <widget name="AuctionText" factory="pawsMessageTextBox" visible="no" id="1106"> + <frame x="55" y="0" width="435" height="233" border="no" /> + <attachpoints> + <attach point="ATTACH_RIGHT" /> + <attach point="PROPORTIONAL_TOP" /> + <attach point="ATTACH_LEFT" /> + <attach point="PROPORTIONAL_BOTTOM" /> + </attachpoints> + <subscriptions overwrite = "false"> + <subscribe data="subAuctionsText" /> + </subscriptions> + <pawsScrollBar width="15" tick="0.1" maxValue="1.0" /> + </widget> + + <widget name="ChannelsText" factory="pawsMessageTextBox" visible="no" id="1108"> + <frame x="55" y="0" width="435" height="233" border="no" /> + <attachpoints> + <attach point="ATTACH_RIGHT" /> + <attach point="PROPORTIONAL_TOP" /> + <attach point="ATTACH_LEFT" /> + <attach point="PROPORTIONAL_BOTTOM" /> + </attachpoints> + <subscriptions overwrite = "false"> + <subscribe data="subChannelsText"/> + </subscriptions> + <pawsScrollBar width="15" tick="0.1" maxValue="1.0" /> + </widget> + + <widget name="HelpText" factory="pawsMessageTextBox" visible="no" id="1107"> + <frame x="55" y="0" width="435" height="233" border="no" /> + <attachpoints> + <attach point="ATTACH_RIGHT" /> + <attach point="PROPORTIONAL_TOP" /> + <attach point="ATTACH_LEFT" /> + <attach point="PROPORTIONAL_BOTTOM" /> + </attachpoints> + <subscriptions overwrite = "false"> + <subscribe data="subHelpText" /> + </subscriptions> + <pawsScrollBar width="15" tick="0.1" maxValue="1.0" /> + </widget> + </widget> + + </widget> + +</widget_description> Property changes on: trunk/data/gui/chat_basic.xml ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: trunk/data/gui/configchattabs.xml =================================================================== --- trunk/data/gui/configchattabs.xml 2010-01-05 19:54:17 UTC (rev 5159) +++ trunk/data/gui/configchattabs.xml 2010-01-06 13:29:44 UTC (rev 5160) @@ -51,5 +51,10 @@ <text string="Help" /> </widget> + <widget name="basicchat" factory="pawsCheckBox"> + <frame x="160" y="60" width="240" height="20" /> + <text string="Use basic chat window (need reload)" /> + </widget> + </widget> </widget_description> Modified: trunk/data/options/chat_def.xml =================================================================== --- trunk/data/options/chat_def.xml 2010-01-05 19:54:17 UTC (rev 5159) +++ trunk/data/options/chat_def.xml 2010-01-06 13:29:44 UTC (rev 5160) @@ -7,6 +7,7 @@ <loose value="0" /> <logAllChat value="1" /> <logSystemChat value="0" /> + <chatWidget value="chat_basic.xml" /> </chatoptions> <bindings> <listener name="subMainText"> Modified: trunk/src/client/gui/chatwindow.cpp =================================================================== --- trunk/src/client/gui/chatwindow.cpp 2010-01-05 19:54:17 UTC (rev 5159) +++ trunk/src/client/gui/chatwindow.cpp 2010-01-06 13:29:44 UTC (rev 5160) @@ -148,6 +148,7 @@ settings.yourColorMix = true; settings.joindefaultchannel = true; settings.defaultlastchat = true; + settings.chatWidget = "chat.xml"; for (int i = 0; i < CHAT_NLOG; i++) @@ -285,6 +286,13 @@ settings.joindefaultchannel = option->GetAttributeValueAsBool("value", true); else if (nodeName == "defaultlastchat") settings.defaultlastchat = option->GetAttributeValueAsBool("value", true); + else if (nodeName == "chatWidget") + { + settings.chatWidget = option->GetAttributeValue("value"); + if(!settings.chatWidget.Length()) //if none are defined put a default one + settings.chatWidget = "chat.xml"; + printf("hello %s\n", settings.chatWidget.GetData()); + } else { for (int i = 0; i < CHAT_NLOG; i++) @@ -924,7 +932,7 @@ csRef<iDocumentNode> root,chatNode, colorNode, optionNode,looseNode,filtersNode, badWordsNode,badWordsTextNode,cNode, logNode, selectTabStyleNode, echoScreenInSystemNode, mainBracketsNode, yourColorMixNode, joindefaultchannelNode, - defaultlastchatNode, mainTabNode, flashingNode, flashingOnCharNode, node; + defaultlastchatNode, chatWidgetNode, mainTabNode, flashingNode, flashingOnCharNode, node; root = doc->CreateRoot(); @@ -957,6 +965,11 @@ defaultlastchatNode = optionNode->CreateNodeBefore(CS_NODE_ELEMENT,0); defaultlastchatNode->SetValue("defaultlastchat"); defaultlastchatNode->SetAttributeAsInt("value",(int)settings.defaultlastchat); + + chatWidgetNode = optionNode->CreateNodeBefore(CS_NODE_ELEMENT,0); + chatWidgetNode->SetValue("chatWidget"); + chatWidgetNode->SetAttribute("value",settings.chatWidget.GetData()); + printf("%s\n", settings.chatWidget.GetData()); looseNode = optionNode->CreateNodeBefore(CS_NODE_ELEMENT,0); looseNode->SetValue("loose"); Modified: trunk/src/client/gui/chatwindow.h =================================================================== --- trunk/src/client/gui/chatwindow.h 2010-01-05 19:54:17 UTC (rev 5159) +++ trunk/src/client/gui/chatwindow.h 2010-01-06 13:29:44 UTC (rev 5160) @@ -95,6 +95,7 @@ bool mainBrackets; //If it's true brackets like [guild] [tell] will be put in main tab. bool yourColorMix; //If it's true the yourColor will be mixed with the Color of the destination //Example: if you send a tell the color of your text will be (yourColor+tellColor)/2 + csString chatWidget; ///< contains the widget to load, default being chat.xml. It's used during engine init and for changing settings. csArray<csString> badWords; csArray<csString> goodWords; // chat type to subscription name binding Modified: trunk/src/client/gui/pawsconfigchattabs.cpp =================================================================== --- trunk/src/client/gui/pawsconfigchattabs.cpp 2010-01-05 19:54:17 UTC (rev 5159) +++ trunk/src/client/gui/pawsconfigchattabs.cpp 2010-01-06 13:29:44 UTC (rev 5160) @@ -66,6 +66,8 @@ return false; if ((ihelp = FindCheckbox("ihelp")) == NULL) return false; + if ((basicchat = FindCheckbox("basicchat")) == NULL) + return false; return true; } @@ -84,6 +86,7 @@ iauction->SetState(false); isys->SetState(false); ihelp->SetState(false); + basicchat->SetState(settings.chatWidget == "chat_basic.xml"); csArray<csString> allMainBindings = settings.bindings.GetAll("subMainText"); for(size_t i = 0; i < allMainBindings.GetSize(); i++) @@ -193,7 +196,8 @@ settings.bindings.Put("subMainText", "CHAT_ADVICE"); } - chatWindow->SetSettings(settings); + //could be made more generic (scan the dir?) + settings.chatWidget = basicchat->GetState() ? "chat_basic.xml" : "chat.xml"; // Save to file chatWindow->SaveChatSettings(); Modified: trunk/src/client/gui/pawsconfigchattabs.h =================================================================== --- trunk/src/client/gui/pawsconfigchattabs.h 2010-01-05 19:54:17 UTC (rev 5159) +++ trunk/src/client/gui/pawsconfigchattabs.h 2010-01-06 13:29:44 UTC (rev 5160) @@ -42,7 +42,7 @@ private: - pawsCheckBox *isysbase, *ichat, *inpc, *itells, *iguild, *igroup, *iauction, *isys, *ihelp; + pawsCheckBox *isysbase, *ichat, *inpc, *itells, *iguild, *igroup, *iauction, *isys, *ihelp, *basicchat; /// Finds the checkbox widget by name and returns the widget or NULL if not found. pawsCheckBox *FindCheckbox(const char *name); Modified: trunk/src/client/psengine.cpp =================================================================== --- trunk/src/client/psengine.cpp 2010-01-05 19:54:17 UTC (rev 5159) +++ trunk/src/client/psengine.cpp 2010-01-06 13:29:44 UTC (rev 5160) @@ -1375,7 +1375,7 @@ LoadPawsWidget( "Status window", "infowindow.xml" ); LoadPawsWidget( "Ignore window", "ignorewindow.xml" ); - LoadPawsWidget( "Communications window", "chat.xml" ); + LoadPawsWidget( "Communications window", GetChatWindowWidget().GetData() ); LoadPawsWidget( "Inventory window", "inventory.xml" ); LoadPawsWidget( "Item description window", "itemdesc.xml" ); LoadPawsWidget( "Container description window","containerdesc.xml" ); @@ -1526,6 +1526,43 @@ return mouseBinds; } +csString psEngine::GetChatWindowWidget() +{ + csString chatWidget = "chat.xml"; + csRef<iDocument> doc; + csRef<iDocumentNode> root, chatNode, optionNode; + if (psengine->GetVFS()->Exists(CONFIG_CHAT_FILE_NAME)) + doc = ParseFile(GetObjectRegistry(), CONFIG_CHAT_FILE_NAME); + else + doc = ParseFile(GetObjectRegistry(), CONFIG_CHAT_FILE_NAME_DEF); + + if (doc == NULL) + return chatWidget; + + root = doc->GetRoot(); + if (root == NULL) + return chatWidget; + + chatNode = root->GetNode("chat"); + if (chatNode == NULL) + return chatWidget; + + optionNode = chatNode->GetNode("chatoptions"); + if (optionNode != NULL) + { + csRef<iDocumentNode> oNode = optionNode->GetNode("chatWidget"); + if (oNode) + { + chatWidget = oNode->GetAttributeValue("value"); + printf("%s\n", chatWidget.GetData()); + if(!chatWidget.Length()) //if none are defined put a default one + { + chatWidget = "chat.xml"; printf("a\n"); } + } + } + return chatWidget; +} + size_t psEngine::GetTime() { return modehandler->GetTime(); Modified: trunk/src/client/psengine.h =================================================================== --- trunk/src/client/psengine.h 2010-01-05 19:54:17 UTC (rev 5159) +++ trunk/src/client/psengine.h 2010-01-06 13:29:44 UTC (rev 5160) @@ -347,9 +347,13 @@ void UnregisterDelayedLoader(DelayedLoader* obj) { delayedLoaders.Delete(obj); } private: - // Load the log report settings from the config file. + /// Load the log report settings from the config file. void LoadLogSettings(); + /** Load the chat widget which we will use from the chat options file. + * @return A string containing the filename of the widget to load. + */ + csString GetChatWindowWidget(); /// queries all needed plugins bool QueryPlugins(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |