From: <lpa...@us...> - 2013-07-07 20:22:28
|
Revision: 8733 http://sourceforge.net/p/planeshift/code/8733 Author: lpancallo Date: 2013-07-07 20:22:25 +0000 (Sun, 07 Jul 2013) Log Message: ----------- fixed dragging of objects by Eredin. Modified Paths: -------------- trunk/data/gui/shortcutwindow.xml trunk/src/client/cmdutil.cpp trunk/src/client/gui/pawsconfigkeys.cpp trunk/src/client/gui/pawscontrolwindow.cpp trunk/src/client/gui/pawsdndbutton.cpp trunk/src/client/gui/pawsdndbutton.h trunk/src/client/gui/pawsscrollmenu.cpp trunk/src/client/gui/shortcutwindow.cpp trunk/src/client/pscharcontrol.cpp trunk/src/client/psslotmgr.cpp Modified: trunk/data/gui/shortcutwindow.xml =================================================================== --- trunk/data/gui/shortcutwindow.xml 2013-07-04 22:41:11 UTC (rev 8732) +++ trunk/data/gui/shortcutwindow.xml 2013-07-07 20:22:25 UTC (rev 8733) @@ -1,13 +1,13 @@ <widget_description> - <widget name="ShortcutWindow" factory="pawsShortcutWindow" style="New Standard GUI" + <widget name="ShortcutMenu" factory="pawsShortcutWindow" style="New Standard GUI" buttonimage="Scaling Button" visible="no" configurable="yes" savepositions="yes" movable="yes" resizable="yes" keepaspect="no" > - <frame x="5" y="50" width="400" height="75" border="yes" /> - <minframe width="150" height="75" /> + <frame x="5" y="50" width="528" height="90" border="yes" /> + <minframe width="150" height="90" /> <!-- This resource definition makes the background frame invisible. comment it out if you want to see the frame --> <bgimage resource="Back" alpha="255" /> @@ -17,9 +17,9 @@ <!-- Bars for the health, stamina, mana, and mental stamina. comment them out if you don't want them --> <widget name="Bars" factory="pawsWidget" > - <frame x="5" y="5" width="400" height="24" /> - <minframe width="150" height="100" /> - <maxframe width="2000" height="100" /> + <frame x="5" y="5" width="528" height="24" /> + <minframe width="150" height="24" /> + <maxframe width="2000" height="24" /> <attachpoints> <attach point="ATTACH_RIGHT" /> <attach point="ATTACH_TOP" /> @@ -27,7 +27,7 @@ </attachpoints> <widget name="My HP" factory="pawsProgressBar" tooltip="Health"> - <frame x="0" y="5" width="199" height="15" border="no" resizable="yes" /> + <frame x="0" y="5" width="264" height="15" border="no" resizable="yes" /> <attachpoints> <attach point="PROPORTIONAL_RIGHT" /> <attach point="PROPORTIONAL_LEFT" /> @@ -39,7 +39,7 @@ </subscriptions> </widget> <widget name="My PysStamina" factory="pawsProgressBar" tooltip="Physical Stamina"> - <frame x="14" y="20" width="185" height="5" border="no" resizable="yes" /> + <frame x="24" y="20" width="240" height="5" border="no" resizable="yes" /> <attachpoints> <attach point="PROPORTIONAL_RIGHT" /> <attach point="PROPORTIONAL_LEFT" /> @@ -52,7 +52,7 @@ </widget> <widget name="My Mana" factory="pawsProgressBar" tooltip="Mana"> - <frame x="200" y="5" width="200" height="15" border="no" resizable="yes" /> + <frame x="264" y="5" width="264" height="15" border="no" resizable="yes" /> <attachpoints> <attach point="PROPORTIONAL_RIGHT" /> <attach point="PROPORTIONAL_LEFT" /> @@ -65,7 +65,7 @@ </widget> <widget name="My MenStamina" factory="pawsProgressBar" tooltip="Mental Stamina"> - <frame x="200" y="20" width="185" height="5" border="no" resizable="yes" /> + <frame x="264" y="20" width="240" height="5" border="no" resizable="yes" /> <attachpoints> <attach point="PROPORTIONAL_RIGHT" /> <attach point="PROPORTIONAL_LEFT" /> @@ -94,7 +94,7 @@ <widget name="MenuBar" factory="pawsScrollMenu" buttonWidth="128" scrollSize="0.75" > --> <widget name="MenuBar" factory="pawsScrollMenu" > - <frame x="0" y="40" height="48" width="400" resizeable="yes" border="no" /> + <frame x="0" y="40" height="48" width="520" resizeable="yes" border="no" /> <minframe width="150" height="48" /> <attachpoints> <attach point="ATTACH_TOP" /> @@ -161,9 +161,9 @@ <attach point="ATTACH_TOP" /> </attachpoints> </widget> - <widget name="SetKeyButton" factory="pawsButton" toggle="no" id="1102" notify="ShortcutWindow" style="Standard Button"> + <widget name="SetKeyButton" factory="pawsButton" toggle="no" id="1102" notify="ShortcutMenu" style="Standard Button"> <frame x="260" y="28" width="50" height="24" /> - <notify name="ShortcutWindow" /> + <notify name="ShortcutMenu" /> <label text="Set" /> <attachpoints> <attach point="ATTACH_RIGHT" /> @@ -198,16 +198,16 @@ </attachpoints> </widget> - <widget name="DoneButton" factory="pawsButton" toggle="no" id="1100" notify="ShortcutWindow" style="Standard Button"> + <widget name="DoneButton" factory="pawsButton" toggle="no" id="1100" notify="ShortcutMenu" style="Standard Button"> <frame x="20" y="250" width="50" height="24" /> - <notify name="ShortcutWindow" /> + <notify name="ShortcutMenu" /> <label text="Done" /> <attachpoints> <attach point="ATTACH_LEFT" /> <attach point="ATTACH_BOTTOM" /> </attachpoints> </widget> - <widget name="ClearButton" factory="pawsButton" toggle="no" id="1103" notify="ShortcutWindow" style="Standard Button"> + <widget name="ClearButton" factory="pawsButton" toggle="no" id="1103" notify="ShortcutMenu" style="Standard Button"> <frame x="80" y="250" width="50" height="24" /> <label text="Clear" /> <attachpoints> @@ -215,7 +215,7 @@ <attach point="ATTACH_BOTTOM" /> </attachpoints> </widget> - <widget name="ClearIconButton" factory="pawsButton" toggle="no" id="1104" notify="ShortcutWindow" style="Standard Button"> + <widget name="ClearIconButton" factory="pawsButton" toggle="no" id="1104" notify="ShortcutMenu" style="Standard Button"> <frame x="140" y="250" width="70" height="24" /> <label text="Clear Icon" /> <attachpoints> @@ -223,7 +223,7 @@ <attach point="ATTACH_BOTTOM" /> </attachpoints> </widget> - <widget name="CancelButton" factory="pawsButton" toggle="no" id="1101" notify="ShortcutWindow" style="Standard Button"> + <widget name="CancelButton" factory="pawsButton" toggle="no" id="1101" notify="ShortcutMenu" style="Standard Button"> <frame x="220" y="250" width="50" height="24" /> <label text="Cancel" /> <attachpoints> @@ -232,4 +232,4 @@ </attachpoints> </widget> </widget> -</widget_description> +</widget_description> \ No newline at end of file Modified: trunk/src/client/cmdutil.cpp =================================================================== --- trunk/src/client/cmdutil.cpp 2013-07-04 22:41:11 UTC (rev 8732) +++ trunk/src/client/cmdutil.cpp 2013-07-07 20:22:25 UTC (rev 8733) @@ -208,7 +208,7 @@ } if(words[1] == "shortcut") { - ((pawsShortcutWindow*)PawsManager::GetSingleton().FindWidget("ShortcutWindow"))->LoadCommandsFile(); + ((pawsShortcutWindow*)PawsManager::GetSingleton().FindWidget("ShortcutMenu"))->LoadCommandsFile(); return "Shortcuts reloaded"; } return "try /reload sound"; Modified: trunk/src/client/gui/pawsconfigkeys.cpp =================================================================== --- trunk/src/client/gui/pawsconfigkeys.cpp 2013-07-04 22:41:11 UTC (rev 8732) +++ trunk/src/client/gui/pawsconfigkeys.cpp 2013-07-07 20:22:25 UTC (rev 8733) @@ -292,7 +292,7 @@ psengine->GetCharControl()->LoadDefaultKeys(); pawsShortcutWindow* shortcuts = dynamic_cast<pawsShortcutWindow*> - (PawsManager::GetSingleton().FindWidget("ShortcutWindow")); + (PawsManager::GetSingleton().FindWidget("ShortcutMenu")); if (shortcuts) shortcuts->LoadDefaultCommands(); Modified: trunk/src/client/gui/pawscontrolwindow.cpp =================================================================== --- trunk/src/client/gui/pawscontrolwindow.cpp 2013-07-04 22:41:11 UTC (rev 8732) +++ trunk/src/client/gui/pawscontrolwindow.cpp 2013-07-07 20:22:25 UTC (rev 8733) @@ -90,7 +90,7 @@ AddWindow( "SpellBookWindow" , "SpellBookButton" ); AddWindow( "InfoWindow" , "InfoButton" ); AddWindow( "HelpWindow" , "HelpButton" ); - AddWindow( "ShortcutWindow" , "ShortcutButton" ); + AddWindow( "ShortcutMenu" , "ShortcutButton" ); AddWindow( "BuddyWindow" , "BuddyButton" ); AddWindow( "GroupWindow" , "GroupButton" ); AddWindow( "PetitionWindow" , "PetitionButton" ); @@ -317,7 +317,7 @@ else if(widgetStr == "gm") widget = "GmGUI"; else if(widgetStr == "shortcut") - widget = "ShortcutWindow"; + widget = "ShortcutMenu"; else if(widgetStr == "group") widget = "GroupWindow"; else if(widgetStr == "guild") Modified: trunk/src/client/gui/pawsdndbutton.cpp =================================================================== --- trunk/src/client/gui/pawsdndbutton.cpp 2013-07-04 22:41:11 UTC (rev 8732) +++ trunk/src/client/gui/pawsdndbutton.cpp 2013-07-07 20:22:25 UTC (rev 8733) @@ -390,10 +390,13 @@ bool pawsDnDButton::PlaceItem(const char* imageName, const char* Name, const char* toolTip, const char* action) { +printf( "pawsDnDButton::PlaceItem begins\n" ); + bool validMove = false; //if function returns false don't delet the original if( imageName ) { + maskingImageName=imageName; SetMaskingImage(imageName); if(ImageNameCallback) { @@ -404,6 +407,10 @@ } validMove = true; } + else + { + ImageNameCallback=NULL; + } if(Name ) { SetName( Name ); @@ -424,6 +431,10 @@ } validMove = true; } + else + { + NameCallback=NULL; + } } if( !validMove ) { @@ -441,6 +452,11 @@ ActionCallback->Get(id-indexBase).Replace(action); } } + else + { + ActionCallback=NULL; + } +printf( "pawsDnDButton::PlaceItem ends\n" ); return true; } Modified: trunk/src/client/gui/pawsdndbutton.h =================================================================== --- trunk/src/client/gui/pawsdndbutton.h 2013-07-04 22:41:11 UTC (rev 8732) +++ trunk/src/client/gui/pawsdndbutton.h 2013-07-07 20:22:25 UTC (rev 8733) @@ -95,7 +95,9 @@ return NameCallback->Get(id-indexBase).GetData(); } } - return GetText(); + if( GetText() ) + return GetText(); + return NULL; } csArray<csString>* GetActionCallback() Modified: trunk/src/client/gui/pawsscrollmenu.cpp =================================================================== --- trunk/src/client/gui/pawsscrollmenu.cpp 2013-07-04 22:41:11 UTC (rev 8732) +++ trunk/src/client/gui/pawsscrollmenu.cpp 2013-07-07 20:22:25 UTC (rev 8733) @@ -68,7 +68,7 @@ AddChild(EditLockButton); EditLockButton->SetSound("gui.shortcut"); EditLockButton->SetID(101); - EditLockButton->SetToolTip("Prevent/Allow Drag and Drop"); + EditLockButton->SetToolTip("Prevent/Allow Editing and Drag/Drop"); EditLockButton->SetToggle(true); EditLockButton->SetUpImage("lockicon"); EditLockButton->SetDownImage("unlockicon"); @@ -160,8 +160,7 @@ topSpace = (LeftScrollMode>ScrollMenuOptionDISABLED?buttonHeight/2:0)+(RightScrollMode>ScrollMenuOptionDISABLED?buttonHeight/2:0); } - //ButtonHolder->SetRelativeFrame(leftEdge, topSpace, GetScreenFrame().Width()-edgeSpace, GetScreenFrame().Height()-2*topSpace ); - ButtonHolder->SetRelativeFrame(leftEdge, topSpace, GetScreenFrame().Width()-edgeSpace, GetScreenFrame().Height()-topSpace ); + ButtonHolder->SetRelativeFrame(leftEdge, topSpace, GetScreenFrame().Width()-edgeSpace, GetScreenFrame().Height()-2*topSpace ); //if we have buttons then size them properly, show those within the buttonHolder visible area and hide the rest if(Buttons.GetSize() >0) Modified: trunk/src/client/gui/shortcutwindow.cpp =================================================================== --- trunk/src/client/gui/shortcutwindow.cpp 2013-07-04 22:41:11 UTC (rev 8732) +++ trunk/src/client/gui/shortcutwindow.cpp 2013-07-07 20:22:25 UTC (rev 8733) @@ -506,7 +506,7 @@ } else { - if( cmds.GetSize()>0 ) + if( cmds.GetSize()>0 && !MenuBar->IsEditable() ) { if( (cmds[widget->GetID() - SHORTCUT_BUTTON_OFFSET + position ]) ) { Modified: trunk/src/client/pscharcontrol.cpp =================================================================== --- trunk/src/client/pscharcontrol.cpp 2013-07-04 22:41:11 UTC (rev 8732) +++ trunk/src/client/pscharcontrol.cpp 2013-07-07 20:22:25 UTC (rev 8733) @@ -114,7 +114,7 @@ { static pawsShortcutWindow* shortcuts = NULL; if (!shortcuts) - shortcuts = dynamic_cast<pawsShortcutWindow*>(PawsManager::GetSingleton().FindWidget("ShortcutWindow")); + shortcuts = dynamic_cast<pawsShortcutWindow*>(PawsManager::GetSingleton().FindWidget("ShortcutMenu")); if (shortcuts) name = shortcuts->GetCommandName(id-1); @@ -658,11 +658,10 @@ { static pawsShortcutWindow* shortcutwin = NULL; if (!shortcutwin) - shortcutwin = dynamic_cast<pawsShortcutWindow*>(PawsManager::GetSingleton().FindWidget("ShortcutWindow")); + shortcutwin = dynamic_cast<pawsShortcutWindow*>(PawsManager::GetSingleton().FindWidget("ShortcutMenu")); if (shortcutwin && value) - { - size_t start = trigger->name.FindLast(' ') + 1; + { size_t start = trigger->name.FindLast(' ') + 1; csString cutter = trigger->name.Slice(start,trigger->name.Length()-start); int sc = atoi(cutter.GetDataSafe()); if (sc == 0) Modified: trunk/src/client/psslotmgr.cpp =================================================================== --- trunk/src/client/psslotmgr.cpp 2013-07-04 22:41:11 UTC (rev 8732) +++ trunk/src/client/psslotmgr.cpp 2013-07-07 20:22:25 UTC (rev 8733) @@ -434,6 +434,10 @@ widget->SetRelativeFrame( 0,0, target->GetDefaultFrame().Width(), target->GetDefaultFrame().Height() ); widget->PlaceItem( target->GetMaskingImageName(), target->GetName(), target->GetToolTip(), target->GetAction() ); + if( !target->GetMaskingImageName() ) + { + widget->SetText(target->GetName()); + } widget->SetBackgroundAlpha(0); widget->SetParent( NULL ); @@ -455,11 +459,12 @@ } if ( target->GetDnDLock() ) //state "down" == true == editable { + target->Clear(); + target->SetImageNameCallback( ((pawsDnDButton *)draggingSlot.slot)->GetImageNameCallback() ); target->SetNameCallback( ((pawsDnDButton *)draggingSlot.slot)->GetNameCallback() ); target->SetActionCallback( ((pawsDnDButton *)draggingSlot.slot)->GetActionCallback() ); -; if( target->PlaceItem( ((pawsDnDButton *)draggingSlot.slot)->GetMaskingImageName(), ((pawsDnDButton *)draggingSlot.slot)->GetName(), ((pawsDnDButton *)draggingSlot.slot)->GetToolTip(), ((pawsDnDButton *)draggingSlot.slot)->GetAction() ) ) { //move key bindings @@ -486,8 +491,19 @@ psengine->GetCharControl()->RemapTrigger( editedCmd, keyDevice, keyButton, keyMods ); } + //set text if there's no icon + if( ((pawsDnDButton *)draggingSlot.slot)->GetMaskingImageName().IsEmpty() ) + { + target->SetText( ((pawsDnDButton *)draggingSlot.slot)->GetName() ); + } + //clear contents of the originating button ((pawsDnDButton *)draggingSlot.slot)->Clear(); + + //redraw the parent window to change layout + target->SetParent( ((pawsDnDButton *)draggingSlot.slot)->GetParent() ); + target->GetParent()->GetParent()->OnResize(); // parent is the buttonHolder, grandparent is the shortcut window. + } CancelDrag(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |