[Igarden-commit] CommonSource/YAAFExtensions RGTableCell.cpp, 1.46.2.25, 1.46.2.26 RGTableView.cpp,
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2008-05-17 19:44:33
|
Update of /cvsroot/igarden/CommonSource/YAAFExtensions In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv9210/YAAFExtensions Modified Files: Tag: Release_branch_v1 RGTableCell.cpp RGTableView.cpp RGTableView.h RGTableCell.h Log Message: Add being able to drag from the source materials window Index: RGTableCell.h =================================================================== RCS file: /cvsroot/igarden/CommonSource/YAAFExtensions/RGTableCell.h,v retrieving revision 1.23.2.13 retrieving revision 1.23.2.14 diff -C2 -d -r1.23.2.13 -r1.23.2.14 *** RGTableCell.h 17 May 2008 16:59:18 -0000 1.23.2.13 --- RGTableCell.h 17 May 2008 19:44:32 -0000 1.23.2.14 *************** *** 76,79 **** --- 76,80 ---- #define KTypeIconToggle 14 #define KTypeFlexCount 15 + #define KTypeIconDrag 16 typedef enum { kLeftJust, kCenterJust, kRightJust } titleJust_t; *************** *** 164,167 **** --- 165,169 ---- void SetIcon(short iconID, short height, short width); + void SetDragIcon(short iconID, short height, short width); bool IsReadOnly(); Index: RGTableCell.cpp =================================================================== RCS file: /cvsroot/igarden/CommonSource/YAAFExtensions/RGTableCell.cpp,v retrieving revision 1.46.2.25 retrieving revision 1.46.2.26 diff -C2 -d -r1.46.2.25 -r1.46.2.26 *** RGTableCell.cpp 17 May 2008 16:59:18 -0000 1.46.2.25 --- RGTableCell.cpp 17 May 2008 19:44:32 -0000 1.46.2.26 *************** *** 451,454 **** --- 451,455 ---- case KTypeIcon: case KTypeIconToggle: + case KTypeIconDrag: h = _iconSize.v + 4; // Center by one pixel break; *************** *** 485,488 **** --- 486,490 ---- { case KTypeIcon: + case KTypeIconDrag: if(IsDrawnAsSelected()) draw.FillRect(back, kTableHilightColor); *************** *** 650,654 **** _parent->DoDispatch(KTableChange,_parent->GetViewID(),NULL); } ! else if(_type != KTypeIcon) { _parent->InlineEdit(); --- 652,656 ---- _parent->DoDispatch(KTableChange,_parent->GetViewID(),NULL); } ! else if(_type != KTypeIcon && _type != KTypeIconDrag) { _parent->InlineEdit(); *************** *** 1099,1102 **** --- 1101,1123 ---- } + //******************************************* + /// SetIcon + // + /// Set the current cell data to the given icon + // + void RGTableCell::SetDragIcon(short iconID, short height, short width) + { + _iconID = iconID; + _iconSize.h = width; + _iconSize.v = height; + + _isEmpty = false; + _type = KTypeIconDrag; + if(_myRow != NULL) + { + _parent->ComputeRowHeight(GetRow()); + _parent->Update(); + } + } Index: RGTableView.cpp =================================================================== RCS file: /cvsroot/igarden/CommonSource/YAAFExtensions/RGTableView.cpp,v retrieving revision 1.28.2.39 retrieving revision 1.28.2.40 diff -C2 -d -r1.28.2.39 -r1.28.2.40 *** RGTableView.cpp 9 May 2008 13:10:09 -0000 1.28.2.39 --- RGTableView.cpp 17 May 2008 19:44:32 -0000 1.28.2.40 *************** *** 125,128 **** --- 125,129 ---- _dragCol = -1; _selectColIcon = 0; + _mouseDownDrag = false; } *************** *** 391,399 **** ColRecord *column = _colArray[selCol]; ! if(cell->GetType() != KTypePicture) // Always open picture type, as it can't be seen otehrwise { ! if(!_rowArray[selRow]->forceWritable || (cell != NULL && cell->GetType() == KTypeIcon)) { ! if ((column->display == true) || (cell != NULL && (cell->IsReadOnly() || cell->GetType() == KTypeIcon))) { SetSelectRow(selRow); --- 392,409 ---- ColRecord *column = _colArray[selCol]; ! if(cell->GetType() == KTypeIconDrag) { ! _mouseDownDrag = true; ! _dragInfo.pt = where; ! _dragInfo.mod = modifier; ! _dragInfo.row = selRow; ! _dragInfo.col = selCol; ! return false; ! } ! else if(cell->GetType() != KTypePicture) // Always open picture type, as it can't be seen otehrwise ! { ! if(!_rowArray[selRow]->forceWritable || (cell != NULL && cell->GetType() == KTypeIconDrag)) { ! if ((column->display == true) || (cell != NULL && (cell->IsReadOnly() || cell->GetType() == KTypeIconDrag))) { SetSelectRow(selRow); *************** *** 424,427 **** --- 434,443 ---- void RGTableView::DoMouseUp(Point where, short /*flag*/) { + if(_mouseDownDrag) + { + SetSelectRow(_dragInfo.row); + _mouseDownDrag = false; + } + if(_dragCol >= 0 && _activeHeader) { *************** *** 453,457 **** void RGTableView::DoMouseMove(Point pt,short) { ! if(_activeHeader) { if(_dragCol >= 0) --- 469,485 ---- void RGTableView::DoMouseMove(Point pt,short) { ! if(_mouseDownDrag) ! { ! short dx, dy; ! ! dx = pt.h - _dragInfo.pt.h; ! dy = pt.v - _dragInfo.pt.v; ! if(dx < -2 || dx > 2 || dy < -2 || dy > 2) ! { ! SendMessage(KXGTableIconDrag,GetViewID(),&_dragInfo); ! _mouseDownDrag = false; ! } ! } ! else if(_activeHeader) { if(_dragCol >= 0) Index: RGTableView.h =================================================================== RCS file: /cvsroot/igarden/CommonSource/YAAFExtensions/RGTableView.h,v retrieving revision 1.16.2.16 retrieving revision 1.16.2.17 diff -C2 -d -r1.16.2.16 -r1.16.2.17 *** RGTableView.h 11 May 2008 12:42:56 -0000 1.16.2.16 --- RGTableView.h 17 May 2008 19:44:32 -0000 1.16.2.17 *************** *** 62,65 **** --- 62,66 ---- #define kTableSelectChange 'Tsch' #define kTableInputErr 'TsIE' + #define KXGTableIconDrag 'TicD' /************************************************************************/ *************** *** 133,136 **** --- 134,145 ---- }; + typedef struct + { + Point pt; + short mod; + short row; + short col; + } iconCellDragInfo_t; + /************************************************************************/ /* */ *************** *** 373,376 **** --- 382,388 ---- long _dragCol; long _selectColIcon; + + bool _mouseDownDrag; + iconCellDragInfo_t _dragInfo; }; |