ryzom / ryzomcore

Ryzom Core is the open-source project related to the Ryzom game. This community repository is synchronized with the Ryzom Forge repository, based on the Core branch.
https://wiki.ryzom.dev
GNU Affero General Public License v3.0
337 stars 90 forks source link

drag-n-drop not working for inventory items #78

Closed ryzom-pipeline closed 10 years ago

ryzom-pipeline commented 10 years ago

Original report by Meelis Mägi (Bitbucket: [Meelis Mägi](https://bitbucket.org/Meelis Mägi), ).


Current hg version does not allow to drag inventory items, but 'hands', 'equip', etc items are draggable.

Problem exists, because inventory item ctrl is built by CDBGroupListSheet::setup() by hand and uses CCtrlSheetInfo::parseCtrlInfo() which does not support 'dragable' attribute. 'dragable' is only parsed by CDBCtrlSheet:parse() ( xml element)

I tried to come up a patch, but its way too ugly.

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


Thanks for your investigation !

So if we add a "dragable" attribute parsing and we set the corresponding boolean, is it enough (I didn't check the code :s) ?

ryzom-pipeline commented 10 years ago

Original comment by Meelis Mägi (Bitbucket: [Meelis Mägi](https://bitbucket.org/Meelis Mägi), ).


This is one liner that I use currently

#!c++

+++ b/code/ryzom/client/src/interface_v3/dbgroup_list_sheet.cpp
@@ -864,6 +864,7 @@
                ctrl->setToolTipParent(getToolTipParent());
                ctrl->setToolTipParentPosRef(getToolTipParentPosRef());
                ctrl->setToolTipPosRef(getToolTipPosRef());
+               ctrl->setDraggable(true);
                // link on the element i+_StartDbIdx
                if (_DisplayEmptySlot)
                {

'dragable' needs to be parsed in CCtrlSheetInfo::parseCtrlInfo(), but then CCtrlSheetInfo also needs to inherit from CCtrlDraggable and then CDBCtrlSheet should not (it already inherits CCtrlSheetInfo).

Its way to messy for me to handle ;-)

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


Ah, in fact, I wasn't aware of CCtrlDraggable :(

ryzom-pipeline commented 10 years ago

Original comment by Cédric Ochs (Bitbucket: [Cédric OCHS](https://bitbucket.org/Cédric OCHS), ).


Fixed in 1e89d15