From: <jo...@us...> - 2014-07-25 02:52:09
|
Revision: 9529 http://sourceforge.net/p/planeshift/code/9529 Author: joelyon Date: 2014-07-25 02:52:06 +0000 (Fri, 25 Jul 2014) Log Message: ----------- -corrections to SC scrolling -added warn, debug & flash to Active spells(default = off); added config interface Modified Paths: -------------- trunk/src/client/gui/pawsactivemagicwindow.cpp trunk/src/client/gui/pawsactivemagicwindow.h trunk/src/client/gui/pawsconfigactivemagic.cpp trunk/src/client/gui/pawsconfigactivemagic.h trunk/src/client/gui/pawsdndbutton.cpp trunk/src/client/gui/pawsdndbutton.h trunk/src/client/gui/pawsscrollmenu.cpp trunk/src/client/gui/pawsscrollmenu.h trunk/src/client/gui/shortcutwindow.cpp Modified: trunk/src/client/gui/pawsactivemagicwindow.cpp =================================================================== --- trunk/src/client/gui/pawsactivemagicwindow.cpp 2014-07-15 04:10:33 UTC (rev 9528) +++ trunk/src/client/gui/pawsactivemagicwindow.cpp 2014-07-25 02:52:06 UTC (rev 9529) @@ -81,6 +81,7 @@ if(!buffList) return false; buffList->SetEditLock(ScrollMenuOptionDISABLED); + if(autoResize) { buffList->SetLeftScroll(ScrollMenuOptionDISABLED); @@ -233,13 +234,62 @@ if( newButton && useTimers ) { //received 3 times from the server: - // registeredTime = when the client thinks the spell was cast. - // serverTime = when the client sent the active magic update + // registeredTime = when the server thinks the spell was cast. + // serverTime = when the server sent the active magic update // duration = how many ticks the spell will last. // //plus we get the current client time. + if( warnMode==0 ) + newButton->SetWarnLevel(warnLevel/100, warnLow ); + else + { + float ratio = warnLevel*100; + if( ratio > incoming.duration[i]) + { + ratio = 1.0; + } + else + { + ratio = 1-(ratio/(float)incoming.duration[i]); + } + newButton->SetWarnLevel( ratio, warnLow ); + } + if( dangerMode==0 ) + newButton->SetDangerLevel(dangerLevel/100, dangerLow ); + else + { + float ratio = dangerLevel*100; + if( ratio > incoming.duration[i]) + { + ratio = 1.0; + } + else + { + ratio = 1-(ratio/(float)incoming.duration[i]); + } + newButton->SetDangerLevel( ratio, dangerLow ); + } + if( flashMode==0 ) + newButton->SetFlashLevel(flashLevel/100, flashLow ); + else + { + float ratio = flashLevel*100; + if( ratio > incoming.duration[i]) + { + ratio = 1.0; + } + else + { + ratio = 1-(ratio/(float)incoming.duration[i]); + } + newButton->SetFlashLevel( ratio, flashLow ); + } newButton->Start( incoming.registrationTime[i], incoming.serverTime, incoming.duration[i] ); } + else + { + + } } if(autoResize) { @@ -575,36 +625,6 @@ Error1("pawsActiveMagicWindow::LoadUserPrefs unable to retrieve buttonWidthMode"); } - optionNode = mainNode->GetNode("leftScroll"); - if(optionNode != NULL) - { - if( strcasecmp( "buttonScrollOn", optionNode->GetAttributeValue("active") )==0 ) - buffList->SetLeftScroll( ScrollMenuOptionENABLED ); - else if( strcasecmp( "buttonScrollAuto", optionNode->GetAttributeValue("active") )==0 ) - buffList->SetLeftScroll( ScrollMenuOptionDYNAMIC ); - else if( strcasecmp( "buttonScrollOn", optionNode->GetAttributeValue("active") )==0 ) - buffList->SetLeftScroll( ScrollMenuOptionDISABLED ); - } - else - { - Error1("pawsActiveMagicWindow::LoadUserPrefs unable to retrieve leftScroll node"); - } - - optionNode = mainNode->GetNode("rightScroll"); - if(optionNode != NULL) - { - if( strcasecmp( "buttonScrollOn", optionNode->GetAttributeValue("active") )==0 ) - buffList->SetRightScroll( ScrollMenuOptionENABLED ); - else if( strcasecmp( "buttonScrollAuto", optionNode->GetAttributeValue("active") )==0 ) - buffList->SetRightScroll( ScrollMenuOptionDYNAMIC ); - else if( strcasecmp( "buttonScrollOn", optionNode->GetAttributeValue("active") )==0 ) - buffList->SetRightScroll( ScrollMenuOptionDISABLED ); - } - else - { - Error1("pawsActiveMagicWindow::LoadUserPrefs unable to retrieve rightScroll node"); - } - optionNode = mainNode->GetNode("textSize"); if(optionNode == NULL) { @@ -637,7 +657,87 @@ Error1("pawsActiveMagicWindow::LoadUserPrefs unable to retrieve textSpacing node"); } + optionNode = mainNode->GetNode("warnLevel"); + if(optionNode != NULL) + { + warnLevel=optionNode->GetAttributeValueAsFloat("value", true); + } + else + { + Error1("pawsActiveMagicWindow::LoadUserPrefs unable to retrieve warnLevel node"); + warnLevel = 100; + } + optionNode = mainNode->GetNode("warnMode"); + if(optionNode != NULL) + { + if( strcasecmp( "warnModeSeconds", optionNode->GetAttributeValue("active") )==0 ) + { + warnMode=1; + } + else + { + warnMode=0; + } + } + else + { + Error1("pawsActiveMagicWindow::LoadUserPrefs unable to retrieve warnMode node"); + warnMode=0; + } + optionNode = mainNode->GetNode("dangerLevel"); + if(optionNode != NULL) + dangerLevel = optionNode->GetAttributeValueAsFloat("value", true); + else + { + Error1("pawsActiveMagicWindow::LoadUserPrefs unable to retrieve dangerLevel node"); + dangerLevel = 100; + } + optionNode = mainNode->GetNode("dangerMode"); + if(optionNode != NULL) + { + if( strcasecmp( "dangerModeSeconds", optionNode->GetAttributeValue("active") )==0 ) + { + dangerMode=1; + } + else + { + dangerMode=0; + } + } + else + { + Error1("pawsActiveMagicWindow::LoadUserPrefs unable to retrieve dangerMode node"); + dangerMode=0; + } + + optionNode = mainNode->GetNode("flashLevel"); + if(optionNode != NULL) + flashLevel = optionNode->GetAttributeValueAsFloat("value", true); + else + { + Error1("pawsActiveMagicWindow::LoadUserPrefs unable to retrieve flashLevel node"); + flashLevel=100; + } + optionNode = mainNode->GetNode("flashMode"); + if(optionNode != NULL) + { + if( strcasecmp( "flashModeSeconds", optionNode->GetAttributeValue("active") )==0 ) + { + flashMode=1; + } + else + { + flashMode=0; + } + } + else + { + Error1("pawsActiveMagicWindow::LoadUserPrefs unable to retrieve FlashMode node"); + flashMode=0; + } + + return true; } @@ -683,3 +783,57 @@ return show; } +int pawsActiveMagicWindow::GetWarnMode() +{ + return warnMode; +} +void pawsActiveMagicWindow::SetWarnMode(int i) +{ + warnMode=i; +} +float pawsActiveMagicWindow::GetWarnLevel() +{ + return warnLevel; +} +void pawsActiveMagicWindow::SetWarnLevel( float val, bool low ) +{ + warnLevel = val; + warnLow = low; +} + +int pawsActiveMagicWindow::GetDangerMode() +{ + return dangerMode; +} +void pawsActiveMagicWindow::SetDangerMode(int i) +{ + dangerMode=i; +} +float pawsActiveMagicWindow::GetDangerLevel() +{ + return dangerLevel; +} +void pawsActiveMagicWindow::SetDangerLevel( float val, bool low ) +{ + dangerLevel =val; + dangerLow =low; +} + +int pawsActiveMagicWindow::GetFlashMode() +{ + return flashMode; +} +void pawsActiveMagicWindow::SetFlashMode(int i) +{ + flashMode=i; +} +float pawsActiveMagicWindow::GetFlashLevel() +{ + return flashLevel; +} +void pawsActiveMagicWindow::SetFlashLevel( float val, bool low ) +{ + flashLevel = val; + flashLow = low; +} + Modified: trunk/src/client/gui/pawsactivemagicwindow.h =================================================================== --- trunk/src/client/gui/pawsactivemagicwindow.h 2014-07-15 04:10:33 UTC (rev 9528) +++ trunk/src/client/gui/pawsactivemagicwindow.h 2014-07-25 02:52:06 UTC (rev 9529) @@ -90,7 +90,22 @@ return fontName.GetData(); } + int GetWarnMode(); + void SetWarnMode(int i); + float GetWarnLevel(); + void SetWarnLevel(float val, bool low); + int GetDangerMode(); + void SetDangerMode(int i); + float GetDangerLevel(); + void SetDangerLevel(float val, bool low); + + int GetFlashMode(); + void SetFlashMode(int i); + float GetFlashLevel(); + void SetFlashLevel(float val, bool low); + + private: csRef<iVFS> vfs; @@ -102,6 +117,18 @@ show; ///<true==show spell & item effects; false==show spell effects but not item effects + bool warnLow, + dangerLow, + flashLow; + + float warnLevel, + dangerLevel, + flashLevel; + + int warnMode, + dangerMode, + flashMode; + pawsScrollMenu* buffList; uint32_t lastIndex; ///<Version number of the last list received Modified: trunk/src/client/gui/pawsconfigactivemagic.cpp =================================================================== --- trunk/src/client/gui/pawsconfigactivemagic.cpp 2014-07-15 04:10:33 UTC (rev 9528) +++ trunk/src/client/gui/pawsconfigactivemagic.cpp 2014-07-25 02:52:06 UTC (rev 9529) @@ -52,8 +52,11 @@ buttonHeight(NULL), buttonWidthMode(NULL), buttonWidth(NULL), - leftScroll(NULL), - rightScroll(NULL), +// leftScroll(NULL), +// rightScroll(NULL), + warnLevel(NULL), + dangerLevel(NULL), + flashLevel(NULL), textFont(NULL), textSize(NULL), textSpacing(NULL), @@ -126,6 +129,8 @@ { return false; } + buttonHeight->EnableValueLimit(true); + buttonHeight->SetMinValue(8); buttonHeight->SetMaxValue(64); buttonHeight->SetCurrentValue(48,false); @@ -143,18 +148,76 @@ buttonWidth->SetMaxValue(512); buttonWidth->SetCurrentValue(48,false); - leftScroll = (pawsRadioButtonGroup*)FindWidget("leftScroll"); - if(!leftScroll) + warnLevel = (pawsScrollBar*)FindWidget("warnLevel"); + if(!warnLevel) { return false; } + warnLevel->EnableValueLimit(true); + warnLevel->SetMinValue(0); + warnLevel->SetMaxValue(100); + warnLevel->SetCurrentValue(100,false); - rightScroll = (pawsRadioButtonGroup*)FindWidget("rightScroll"); - if(!rightScroll) + warnSetting = (pawsTextBox*)FindWidget("warnSetting"); + if(!warnSetting) { return false; } + warnMode = (pawsRadioButtonGroup*)FindWidget("warnMode"); + if(!warnMode) + { + return false; + } + warnMode->SetActive("warnModePercent"); + + + dangerLevel = (pawsScrollBar*)FindWidget("dangerLevel"); + if(!dangerLevel) + { + return false; + } + dangerLevel->EnableValueLimit(true); + dangerLevel->SetMinValue(0); + dangerLevel->SetMaxValue(100); + dangerLevel->SetCurrentValue(100,false); + + dangerSetting = (pawsTextBox*)FindWidget("dangerSetting"); + if(!dangerSetting) + { + return false; + } + + dangerMode = (pawsRadioButtonGroup*)FindWidget("dangerMode"); + if(!dangerMode) + { + return false; + } + dangerMode->SetActive("dangerModePercent"); + + flashLevel = (pawsScrollBar*)FindWidget("flashLevel"); + if(!flashLevel) + { + return false; + } + flashLevel->EnableValueLimit(true); + flashLevel->SetMinValue(0); + flashLevel->SetMaxValue(100); + flashLevel->SetCurrentValue(100,false); + + flashSetting = (pawsTextBox*)FindWidget("flashSetting"); + if(!flashSetting) + { + return false; + } + + flashMode = (pawsRadioButtonGroup*)FindWidget("flashMode"); + if(!flashMode) + { + return false; + } + flashMode->SetActive("flashModePercent"); + textFont = (pawsComboBox*)FindWidget("textFont"); if(!textFont) { @@ -233,49 +296,82 @@ textSpacing->SetCurrentValue( MenuBar->GetButtonPaddingWidth() ); - switch( MenuBar->GetLeftScroll() ) +// switch( MenuBar->GetLeftScroll() ) +// { +// case ScrollMenuOptionENABLED : +// { +// leftScroll->SetActive( "buttonScrollOn" ); +// } +// break; +// +// case ScrollMenuOptionDYNAMIC : +// { +// leftScroll->SetActive( "buttonScrollAuto" ); +// } +// break; +// +// case ScrollMenuOptionDISABLED : +// { +// leftScroll->SetActive( "buttonScrollOff" ); +// } +// break; +// +// } +// +// switch( MenuBar->GetRightScroll() ) +// { +// case ScrollMenuOptionENABLED : +// { +// rightScroll->SetActive( "buttonScrollOn" ); +// } +// break; +// +// case ScrollMenuOptionDYNAMIC : +// { +// rightScroll->SetActive( "buttonScrollAuto" ); +// } +// break; +// +// case ScrollMenuOptionDISABLED : +// { +// rightScroll->SetActive( "buttonScrollOff" ); +// } +// break; +// +// } + + warnLevel->SetCurrentValue(ActiveMagicWindow->GetWarnLevel() ); + if( ActiveMagicWindow->GetWarnMode()==1 ) { - case ScrollMenuOptionENABLED : - { - leftScroll->SetActive( "buttonScrollOn" ); - } - break; + warnMode->SetActive( "warnModeSeconds" ); + } + else + { + warnMode->SetActive( "warnModePercent" ); + } + UpdateWarnLevel(); - case ScrollMenuOptionDYNAMIC : - { - leftScroll->SetActive( "buttonScrollAuto" ); - } - break; - - case ScrollMenuOptionDISABLED : - { - leftScroll->SetActive( "buttonScrollOff" ); - } - break; - + dangerLevel->SetCurrentValue(ActiveMagicWindow->GetDangerLevel() ); + UpdateDangerLevel(); + if( ActiveMagicWindow->GetDangerMode()==1 ) + { + dangerMode->SetActive( "dangerModeSeconds" ); } + else + { + dangerMode->SetActive( "dangerModePercent" ); + } - switch( MenuBar->GetRightScroll() ) + flashLevel->SetCurrentValue(ActiveMagicWindow->GetFlashLevel() ); + UpdateFlashLevel(); + if( ActiveMagicWindow->GetFlashMode()==1 ) { - case ScrollMenuOptionENABLED : - { - rightScroll->SetActive( "buttonScrollOn" ); - } - break; - - case ScrollMenuOptionDYNAMIC : - { - rightScroll->SetActive( "buttonScrollAuto" ); - } - break; - - case ScrollMenuOptionDISABLED : - { - rightScroll->SetActive( "buttonScrollOff" ); - } - break; - + flashMode->SetActive( "flashModeSeconds" ); } + else + { + flashMode->SetActive( "flashModePercent" ); + } textSize->SetCurrentValue(MenuBar->GetFontSize()); @@ -294,38 +390,30 @@ { csString xml; xml = "<activemagic>\n"; - xml.AppendFmt("<useImages on=\"%s\" />\n", - useImages->GetState() ? "yes" : "no"); - xml.AppendFmt("<autoResize on=\"%s\" />\n", - autoResize->GetState() ? "yes" : "no"); - xml.AppendFmt("<showEffects active=\"%s\" />\n", - showEffects->GetActive().GetData()); - xml.AppendFmt("<showWindow on=\"%s\" />\n", - showWindow->GetState() ? "yes" : "no"); - xml.AppendFmt("<buttonHeight value=\"%d\" />\n", - int(buttonHeight->GetCurrentValue())); - xml.AppendFmt("<buttonWidthMode active=\"%s\" />\n", - buttonWidthMode->GetActive().GetData()); - xml.AppendFmt("<buttonWidth value=\"%d\" />\n", - int(buttonWidth->GetCurrentValue())); - xml.AppendFmt("<leftScroll active=\"%s\" />\n", - leftScroll->GetActive().GetData()); - xml.AppendFmt("<rightScroll active=\"%s\" />\n", - rightScroll->GetActive().GetData()); - xml.AppendFmt("<textSize value=\"%d\" />\n", - int(textSize->GetCurrentValue())); - xml.AppendFmt("<textFont value=\"%s\" />\n", - textFont->GetSelectedRowString().GetData()); - xml.AppendFmt("<textSpacing value=\"%d\" />\n", - int(textSpacing->GetCurrentValue())); + xml.AppendFmt("<useImages on=\"%s\" />\n", useImages->GetState() ? "yes" : "no"); + xml.AppendFmt("<autoResize on=\"%s\" />\n", autoResize->GetState() ? "yes" : "no"); + xml.AppendFmt("<showEffects active=\"%s\" />\n", showEffects->GetActive().GetData()); + xml.AppendFmt("<showWindow on=\"%s\" />\n", showWindow->GetState() ? "yes" : "no"); + xml.AppendFmt("<buttonHeight value=\"%d\" />\n", int(buttonHeight->GetCurrentValue())); + xml.AppendFmt("<buttonWidthMode active=\"%s\" />\n", buttonWidthMode->GetActive().GetData()); + xml.AppendFmt("<buttonWidth value=\"%d\" />\n", int(buttonWidth->GetCurrentValue())); + xml.AppendFmt("<warnLevel value=\"%d\" />\n", int(warnLevel->GetCurrentValue())); + xml.AppendFmt("<warnMode active=\"%s\" />\n", warnMode->GetActive().GetData()); + xml.AppendFmt("<dangerLevel value=\"%d\" />\n", int(dangerLevel->GetCurrentValue())); + xml.AppendFmt("<dangerMode active=\"%s\" />\n", dangerMode->GetActive().GetData()); + xml.AppendFmt("<flashLevel value=\"%d\" />\n", int(flashLevel->GetCurrentValue())); + xml.AppendFmt("<flashMode active=\"%s\" />\n", flashMode->GetActive().GetData()); +// xml.AppendFmt("<leftScroll active=\"%s\" />\n", leftScroll->GetActive().GetData()); +// xml.AppendFmt("<rightScroll active=\"%s\" />\n", rightScroll->GetActive().GetData()); + xml.AppendFmt("<textSize value=\"%d\" />\n", int(textSize->GetCurrentValue())); + xml.AppendFmt("<textFont value=\"%s\" />\n", textFont->GetSelectedRowString().GetData()); + xml.AppendFmt("<textSpacing value=\"%d\" />\n", int(textSpacing->GetCurrentValue())); - xml += "</activemagic>\n"; dirty = false; - return psengine->GetVFS()->WriteFile("/planeshift/userdata/options/configactivemagic.xml", - xml,xml.Length()); + return psengine->GetVFS()->WriteFile("/planeshift/userdata/options/configactivemagic.xml", xml,xml.Length()); } void pawsConfigActiveMagic::SetDefault() @@ -367,6 +455,18 @@ textSpacing->SetCurrentValue(1,false); MenuBar->SetButtonPaddingWidth( textSpacing->GetCurrentValue() ); } + else if(wdg == warnLevel ) + { + UpdateWarnLevel(); + } + else if(wdg == dangerLevel ) + { + UpdateDangerLevel(); + } + else if(wdg == flashLevel ) + { + UpdateFlashLevel(); + } SaveConfig(); MenuBar->LayoutButtons(); @@ -481,41 +581,81 @@ } break; - case 1004 : + case 1002 : //warnMode == percent { - MenuBar->SetLeftScroll(ScrollMenuOptionENABLED ); + //ActiveMagicWindow->SetWarnMode( 0 ); + UpdateWarnLevel(); } break; - case 1005 : + case 1003 : //warnMode == seconds { - MenuBar->SetLeftScroll(ScrollMenuOptionDYNAMIC ); + //ActiveMagicWindow->SetWarnMode( 1 ); + UpdateWarnLevel(); } break; - case 1006 : + case 1004 : //dangerMode == percent { - MenuBar->SetLeftScroll(ScrollMenuOptionDISABLED ); + //ActiveMagicWindow->SetDangerMode( 0 ); + UpdateDangerLevel(); } break; - case 1007 : + case 1005 : //dangerMode == seconds { - MenuBar->SetRightScroll(ScrollMenuOptionENABLED ); + //ActiveMagicWindow->SetDangerMode( 1 ); + UpdateDangerLevel(); } break; - case 1008 : + case 1006 : //flashMode == percent { - MenuBar->SetRightScroll(ScrollMenuOptionDYNAMIC ); + UpdateFlashLevel(); } break; - case 1009 : + + case 1007 : //flashMode == seconds { - MenuBar->SetRightScroll(ScrollMenuOptionDISABLED ); + UpdateFlashLevel(); } break; +// case 1004 : +// { +// MenuBar->SetLeftScroll(ScrollMenuOptionENABLED ); +// } +// break; +// +// case 1005 : +// { +// MenuBar->SetLeftScroll(ScrollMenuOptionDYNAMIC ); +// } +// break; +// +// case 1006 : +// { +// MenuBar->SetLeftScroll(ScrollMenuOptionDISABLED ); +// } +// break; +// +// case 1007 : +// { +// MenuBar->SetRightScroll(ScrollMenuOptionENABLED ); +// } +// break; +// +// case 1008 : +// { +// MenuBar->SetRightScroll(ScrollMenuOptionDYNAMIC ); +// } +// break; +// case 1009 : +// { +// MenuBar->SetRightScroll(ScrollMenuOptionDISABLED ); +// } +// break; + case 1014 : { MenuBar->EnableButtonBackground( ((pawsCheckBox*)wdg)->GetState() ); @@ -584,3 +724,133 @@ } } +void pawsConfigActiveMagic::UpdateWarnLevel( ) +{ + csString temp; + if( strcmp(warnMode->GetActive(),"warnModePercent")==0 ) + { + ActiveMagicWindow->SetWarnMode( 0 ); + if( warnLevel->GetCurrentValue()<100 ) + { + temp.Format("> %2.0f", warnLevel->GetCurrentValue() ); + warnSetting->SetText( temp ); + + //if warnlevel is > danger level in % mode, then increase danger level to match. + if( warnLevel->GetCurrentValue()>dangerLevel->GetCurrentValue() ) + { + dangerLevel->SetCurrentValue( warnLevel->GetCurrentValue() ); + } + ActiveMagicWindow->SetWarnLevel( warnLevel->GetCurrentValue(), false ); //convert 0-100 int to float for pawsProgressMeter + } + else + { + warnSetting->SetText( "Disabled" ); + ActiveMagicWindow->SetWarnLevel( 0, false ); + } + } + else + { + ActiveMagicWindow->SetWarnMode( 1 ); + if( warnLevel->GetCurrentValue()>0 ) + { + temp.Format("< %2.1f", warnLevel->GetCurrentValue()/10 ); + warnSetting->SetText( temp ); + + //if warn level is < danger level in seconds then decrease danger level to match + if( warnLevel->GetCurrentValue()<dangerLevel->GetCurrentValue() ) + { + dangerLevel->SetCurrentValue( warnLevel->GetCurrentValue() ); + } + ActiveMagicWindow->SetWarnLevel( warnLevel->GetCurrentValue(), false ); //convert 0-100 int to float for pawsProgressMeter + } + else + { + warnSetting->SetText( "Disabled" ); + ActiveMagicWindow->SetWarnLevel( 0, false ); + } + + } +} + +void pawsConfigActiveMagic::UpdateDangerLevel() +{ + csString temp; + if( strcmp(dangerMode->GetActive(),"dangerModePercent")==0 ) + { + ActiveMagicWindow->SetDangerMode( 0 ); + //if warn level > danger level in percent mode then increase danger level + if( warnLevel->GetCurrentValue()>dangerLevel->GetCurrentValue() ) + { + dangerLevel->SetCurrentValue( warnLevel->GetCurrentValue() ); + } + + if( dangerLevel->GetCurrentValue()<100 ) + { + temp.Format("> %2.0f", dangerLevel->GetCurrentValue() ); + dangerSetting->SetText( temp ); + ActiveMagicWindow->SetDangerLevel( dangerLevel->GetCurrentValue(), false ); + } + else + { + dangerSetting->SetText( "Disabled" ); + ActiveMagicWindow->SetDangerLevel( 0, false ); //convert 0-100 int to float for pawsProgressMeter + } + + } + else + { + ActiveMagicWindow->SetDangerMode( 1 ); + //if warn level is < danger level in seconds then decrease danger level to match + if( warnLevel->GetCurrentValue()<dangerLevel->GetCurrentValue() ) + { + dangerLevel->SetCurrentValue( warnLevel->GetCurrentValue() ); + } + + if( dangerLevel->GetCurrentValue()>0 ) + { + temp.Format("< %2.1f", dangerLevel->GetCurrentValue()/10 ); + dangerSetting->SetText( temp ); + ActiveMagicWindow->SetDangerLevel( dangerLevel->GetCurrentValue(), false ); + } + else + { + dangerSetting->SetText( "Disabled" ); + ActiveMagicWindow->SetDangerLevel( 0, false ); //convert 0-100 int to float for pawsProgressMeter + } + } +} + +void pawsConfigActiveMagic::UpdateFlashLevel() +{ + csString temp; + if( strcmp(flashMode->GetActive(),"flashModePercent")==0 ) + { + ActiveMagicWindow->SetFlashMode( 0 ); + if( flashLevel->GetCurrentValue()<100 ) + { + temp.Format("> %2.0f", flashLevel->GetCurrentValue() ); + flashSetting->SetText( temp ); + ActiveMagicWindow->SetFlashLevel( flashLevel->GetCurrentValue(), false ); + } + else + { + flashSetting->SetText( "Disabled" ); + ActiveMagicWindow->SetFlashLevel( 0, false ); //convert 0-100 int to float for pawsProgressMeter + } + } + else + { + ActiveMagicWindow->SetFlashMode( 1 ); + if( flashLevel->GetCurrentValue()>0 ) + { + temp.Format("< %2.1f", flashLevel->GetCurrentValue()/10 ); + flashSetting->SetText( temp ); + ActiveMagicWindow->SetFlashLevel( flashLevel->GetCurrentValue(), false ); + } + else + { + flashSetting->SetText( "Disabled" ); + ActiveMagicWindow->SetFlashLevel( 0, false ); //convert 0-100 int to float for pawsProgressMeter + } + } +} Modified: trunk/src/client/gui/pawsconfigactivemagic.h =================================================================== --- trunk/src/client/gui/pawsconfigactivemagic.h 2014-07-15 04:10:33 UTC (rev 9528) +++ trunk/src/client/gui/pawsconfigactivemagic.h 2014-07-25 02:52:06 UTC (rev 9529) @@ -68,6 +68,9 @@ void PickText( const char * fontName, int size ); void SetMainWindowVisible( bool status ); + void UpdateWarnLevel( ); + void UpdateDangerLevel( ); + void UpdateFlashLevel( ); protected: @@ -83,9 +86,21 @@ pawsRadioButtonGroup* buttonWidthMode; pawsScrollBar* buttonWidth; - pawsRadioButtonGroup* leftScroll; - pawsRadioButtonGroup* rightScroll; +// pawsRadioButtonGroup* leftScroll; +// pawsRadioButtonGroup* rightScroll; + pawsScrollBar* warnLevel; + pawsTextBox* warnSetting; + pawsRadioButtonGroup* warnMode; + + pawsScrollBar* dangerLevel; + pawsTextBox* dangerSetting; + pawsRadioButtonGroup* dangerMode; + + pawsScrollBar* flashLevel; + pawsTextBox* flashSetting; + pawsRadioButtonGroup* flashMode; + pawsComboBox* textFont; pawsScrollBar* textSize; pawsScrollBar* textSpacing; Modified: trunk/src/client/gui/pawsdndbutton.cpp =================================================================== --- trunk/src/client/gui/pawsdndbutton.cpp 2014-07-15 04:10:33 UTC (rev 9528) +++ trunk/src/client/gui/pawsdndbutton.cpp 2014-07-25 02:52:06 UTC (rev 9529) @@ -58,7 +58,17 @@ NameCallback(NULL), ActionCallback(NULL), DnDLock(false), - spellProgress(NULL) + spellProgress(NULL), + action(NULL), + warnLevel(0.0), + warnLow(false), + warnMode(0), + dangerLevel(0.0), + dangerLow(false), + dangerMode(0), + flashLevel(0.0), + flashLow(false), + flashMode(0) { factory = "pawsDnDButton"; } @@ -221,9 +231,9 @@ spellProgress->SetTotalValue(1.0); spellProgress->SetColor( 0, 0, 200 ); - spellProgress->SetWarning(0.5, false, 200, 200, 0 ); - spellProgress->SetDanger(0.8, false, 200, 0, 0 ); - spellProgress->SetFlash(0.75, false, 250, 0, 0, 0 ); + spellProgress->SetWarning(warnLevel, warnLow, 200, 200, 0 ); + spellProgress->SetDanger(dangerLevel, warnLow, 200, 0, 0 ); + spellProgress->SetFlash(flashLevel, warnLow, 250, 0, 0, 0 ); float currentProgress = (currentTicks-startTicks)/duration; spellProgress->SetCurrentValue(currentProgress); @@ -501,7 +511,10 @@ } if( mode==true ) { - SetBackground(backgroundBackup); + if(backgroundBackup) + { + SetBackground(backgroundBackup); + } } else //mode == false { @@ -528,3 +541,31 @@ } pawsWidget::SetRelativeFrame(x, y, width, height); } + +void pawsDnDButton::SetWarnLevel( float val, bool low ) +{ + warnLevel = val; + warnLow = low; +} +void pawsDnDButton::SetDangerLevel( float val, bool low ) +{ + dangerLevel = val; + dangerLow = low; +} +void pawsDnDButton::SetFlashLevel( float val, bool low ) +{ + flashLevel = val; + flashLow = low; +} +void pawsDnDButton::SetWarnMode( int i ) +{ + warnMode = i; +} +void pawsDnDButton::SetDangerMode( int i ) +{ + dangerMode = i; +} +void pawsDnDButton::SetFlashMode( int i ) +{ + flashMode = i; +} Modified: trunk/src/client/gui/pawsdndbutton.h =================================================================== --- trunk/src/client/gui/pawsdndbutton.h 2014-07-15 04:10:33 UTC (rev 9528) +++ trunk/src/client/gui/pawsdndbutton.h 2014-07-25 02:52:06 UTC (rev 9529) @@ -103,13 +103,6 @@ } const char* GetName() { - //if(NameCallback) - //{ - // if(NameCallback->Get(id-indexBase).Length()>0) - // { - // return NameCallback->Get(id-indexBase).GetData(); - // } - //} if(GetText()) return GetText(); return NULL; @@ -139,19 +132,19 @@ { return containerID; } + void SetAction(const char* act) { if( act!=NULL ) { action=new csString( act ); -fprintf( stderr, "PawsDnDButton::SetAction sees action as '%s'\n", action->GetData() ); } else { action=NULL; } - //SetAction(new csString(act)); } + void SetAction(csString* act) { if(ActionCallback) @@ -160,21 +153,19 @@ } action = act; } + const char* GetAction() { -fprintf( stderr, "PawsDnDButton::GetAction begins\n" ); if(action!=NULL) { -fprintf( stderr, "PawsDnDButton::GetAction sees action as non NULL\n" ); if(!action->IsEmpty()) { -fprintf( stderr, "PawsDnDButton::GetAction sees action as '%s'\n", action->GetData() ); return action->GetData(); } } -fprintf( stderr, "PawsDnDButton::GetAction sees action as NULL\n" ); return NULL; } + const char* GetTooltip() { if(baseToolTip) @@ -187,10 +178,15 @@ return NULL; } + void SetIcon( const char* icon ); + const char* GetIcon(); + void ClearIcon(); + void SetDnDLock(bool locked) { DnDLock = locked; } + bool GetDnDLock() { return DnDLock; @@ -230,6 +226,13 @@ virtual void SetRelativeFrame(int x, int y, int width, int height); + void SetWarnLevel( float val, bool low ); + void SetDangerLevel( float val, bool low ); + void SetFlashLevel( float val, bool low ); + void SetWarnMode( int ); + void SetDangerMode( int ); + void SetFlashMode( int ); + protected: psSlotManager* mgr; int dragDrop; @@ -245,6 +248,18 @@ csString backgroundBackup; csString baseToolTip; + float warnLevel; + bool warnLow; + int warnMode; + + float dangerLevel; + bool dangerLow; + int dangerMode; + + float flashLevel; + bool flashLow; + int flashMode; + virtual bool CheckKeyHandled(int keyCode); bool DnDLock; // true = locked, false = enabled. Modified: trunk/src/client/gui/pawsscrollmenu.cpp =================================================================== --- trunk/src/client/gui/pawsscrollmenu.cpp 2014-07-15 04:10:33 UTC (rev 9528) +++ trunk/src/client/gui/pawsscrollmenu.cpp 2014-07-25 02:52:06 UTC (rev 9529) @@ -45,7 +45,10 @@ scrollIncrement(0.0), currentButton(0), paddingWidth(0), - scrollProportion(0.5), +// scrollProportion(0.5), + warnLevel(0.0), + dangerLevel(0.0), + flashLevel(0.0), buttonWidthDynamic(true), ButtonHolder(NULL), buttonLocation(BUTTON_PADDING), @@ -185,18 +188,18 @@ } } -void pawsScrollMenu::SetScrollIncrement(int incr) -{ - scrollIncrement = incr; - scrollProportion = 0.0f; -} +//void pawsScrollMenu::SetScrollIncrement(int incr) +//{ +// scrollIncrement = incr; +// scrollProportion = 0.0f; +//} +// +//void pawsScrollMenu::SetScrollProportion(float prop) +//{ +// scrollProportion = prop; +// scrollIncrement = 0; +//} -void pawsScrollMenu::SetScrollProportion(float prop) -{ - scrollProportion = prop; - scrollIncrement = 0; -} - void pawsScrollMenu::OnResize() { if(EditLockButton) @@ -956,3 +959,46 @@ } return 10; //if something DOES end up using the font and there's no size defined, there should be a useful default } + + + +void pawsScrollMenu::SetWarnLevel( float val, bool low) +{ + warnLevel=val; +} +void pawsScrollMenu::SetDangerLevel( float val, bool low) +{ + dangerLevel=val; +} +void pawsScrollMenu::SetFlashLevel( float val, bool low) +{ + flashLevel=val; +} + + + +float pawsScrollMenu::GetWarnLevel() +{ + return warnLevel; +} +float pawsScrollMenu::GetDangerLevel() +{ + return dangerLevel; +} +float pawsScrollMenu::GetFlashLevel() +{ + return flashLevel; +} + +void pawsScrollMenu::SetWarnMode(int i) +{ + warnMode = i; +} +void pawsScrollMenu::SetDangerMode(int i) +{ + dangerMode = i; +} +void pawsScrollMenu::SetFlashMode(int i) +{ + flashMode = i; +} Modified: trunk/src/client/gui/pawsscrollmenu.h =================================================================== --- trunk/src/client/gui/pawsscrollmenu.h 2014-07-15 04:10:33 UTC (rev 9528) +++ trunk/src/client/gui/pawsscrollmenu.h 2014-07-25 02:52:06 UTC (rev 9529) @@ -125,8 +125,8 @@ int GetRightScroll(); void SetButtonWidth(int width); void SetButtonHeight(int height); - void SetScrollIncrement(int incr); - void SetScrollProportion(float prop); +// void SetScrollIncrement(int incr); +// void SetScrollProportion(float prop); bool SetScrollWidget( pawsScrollBar* sb); void SetOrientation(int Orientation); int AutoResize(); @@ -167,8 +167,18 @@ void ShowScrollButtons(); + void SetWarnLevel(float, bool); + void SetDangerLevel(float, bool); + void SetFlashLevel(float, bool); + float GetWarnLevel(); + float GetDangerLevel(); + float GetFlashLevel(); + void SetWarnMode(int); + void SetDangerMode(int); + void SetFlashMode(int); + protected: int buttonWidth, @@ -203,6 +213,16 @@ int Orientation; int EditMode; + float warnLevel; + bool warnLow; + int warnMode; + float dangerLevel; + bool dangerLow; + int dangerMode; + float flashLevel; + bool flashLow; + int flashMode; + }; //---------------------------------------------------------------------- Modified: trunk/src/client/gui/shortcutwindow.cpp =================================================================== --- trunk/src/client/gui/shortcutwindow.cpp 2014-07-15 04:10:33 UTC (rev 9528) +++ trunk/src/client/gui/shortcutwindow.cpp 2014-07-25 02:52:06 UTC (rev 9529) @@ -70,7 +70,7 @@ position(0), buttonWidth(0), //added 20130726 - ticket 6087 textSpacing(0), - scrollSize(0), //added 20130726 - ticket 6087 +// scrollSize(0), //added 20130726 - ticket 6087 EditMode(0) // 0 = edit lock prevents drag, 1 = edit lock prevent all editing { vfs = csQueryRegistry<iVFS > ( PawsManager::GetSingleton().GetObjectRegistry()); @@ -157,10 +157,10 @@ buttonWidth=subnode->GetValueAsInt(); } } - else if( strcasecmp( "scrollSize", subnode->GetName() )==0 ) - { - scrollSize=subnode->GetValueAsFloat(); - } +// else if( strcasecmp( "scrollSize", subnode->GetName() )==0 ) +// { +// scrollSize=subnode->GetValueAsFloat(); +// } else if( strcasecmp( "editMode", subnode->GetName() )==0 ) { if( strcasecmp( "all", subnode->GetValue() )==0 ) @@ -288,6 +288,7 @@ iconScrollBar = (pawsScrollBar*)FindWidget( "iconScroll" ); if( iconScrollBar!=NULL ) { + iconScrollBar->EnableValueLimit(true); iconScrollBar->SetMaxValue( NUM_SHORTCUTS-1 ); iconScrollBar->SetMinValue( 0 ); MenuBar->SetScrollWidget( iconScrollBar ); @@ -295,14 +296,14 @@ MenuBar->SetButtonWidth( buttonWidth ); MenuBar->SetEditMode( EditMode ); - if( scrollSize>1 ) - { - MenuBar->SetScrollIncrement( (int)scrollSize ); - } - else - { - MenuBar->SetScrollProportion( scrollSize ); - } + //if( scrollSize>1 ) + //{ + // MenuBar->SetScrollIncrement( (int)scrollSize ); + //} + //else + //{ + // MenuBar->SetScrollProportion( scrollSize ); + //} MenuBar->SetButtonPaddingWidth( textSpacing ); @@ -323,7 +324,6 @@ LoadUserPrefs(); - return true; } @@ -677,10 +677,25 @@ { if( widget ) { - float pos = widget->GetCurrentValue(); - if( pos>NUM_SHORTCUTS-1 ) +// float pos = widget->GetCurrentValue(); +// if( pos>NUM_SHORTCUTS-1 ) +// { +// pos=NUM_SHORTCUTS-1; +// } +// else if( pos<0 ) +// { +// pos=0.0; +// } + switch( direction ) { - pos=NUM_SHORTCUTS-1; + case SCROLL_DOWN : + MenuBar->ScrollDown(); + break; + case SCROLL_UP : + MenuBar->ScrollUp(); + break; + default : + MenuBar->ScrollToPosition( widget->GetCurrentValue() ); widget->SetCurrentValue( pos ); MenuBar->ScrollToPosition( pos ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |