Re: buglet patch


Subject: Re: buglet patch
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Thu Mar 29 2001 - 01:42:34 CST


Hi Patrick,
          Unfortunately this patch makes tab leaders turn into an
underscore when you drag it.

It will have to wait till after 0.7.14.

Cheers

Martin

On Thu, 29 Mar 2001, Patrick Lam wrote:

> This patch fixes the buglet where dragging a tab eradicated the associated
> tab's leader.
>
> Index: src/wp/ap/xp/ap_TopRuler.cpp
> ===================================================================
> RCS file: /cvsroot/abi/src/wp/ap/xp/ap_TopRuler.cpp,v
> retrieving revision 1.99
> diff -u -r1.99 ap_TopRuler.cpp
> --- src/wp/ap/xp/ap_TopRuler.cpp 2001/03/19 08:39:04 1.99
> +++ src/wp/ap/xp/ap_TopRuler.cpp 2001/03/29 05:59:02
> @@ -583,7 +583,8 @@
> void AP_TopRuler::_getTabStopXAnchor(AP_TopRulerInfo * pInfo,
> UT_sint32 k,
> UT_sint32 * pTab,
> - eTabType & iType)
> + eTabType & iType,
> + eTabLeader & iLeader)
> {
> UT_sint32 xAbsLeft = _getFirstPixelInColumn(pInfo,pInfo->m_iCurrentColumn);
>
> @@ -594,6 +595,7 @@
> // this is a new tab
> iPosition = m_dragStart;
> iType = m_draggingTabType;
> + iLeader = FL_LEADER_NONE;
> }
> else
> {
> @@ -606,6 +608,7 @@
> UT_ASSERT(bRes);
> iPosition = TabInfo.getPosition();
> iType = TabInfo.getType();
> + iLeader = TabInfo.getLeader();
> }
>
> if (pTab)
> @@ -635,12 +638,13 @@
> UT_sint32 anchor;
> UT_Rect rect;
> eTabType iType;
> + eTabLeader iLeader;
>
> if (m_draggingWhat == DW_TABSTOP)
> {
> // just deal with the tab being moved
>
> - _getTabStopXAnchor(pInfo, m_draggingTab, &anchor, iType);
> + _getTabStopXAnchor(pInfo, m_draggingTab, &anchor, iType, iLeader);
> _getTabStopRect(pInfo, anchor, &rect);
>
> _drawTabStop(rect, m_draggingTabType, false);
> @@ -666,7 +670,7 @@
> (m_draggingTab == (UT_sint32) i))
> continue;
>
> - _getTabStopXAnchor(pInfo, i, &anchor, iType);
> + _getTabStopXAnchor(pInfo, i, &anchor, iType, iLeader);
> _getTabStopRect(pInfo, anchor, &rect);
>
> if (left < anchor)
> @@ -704,7 +708,7 @@
> }
>
> UT_sint32 AP_TopRuler::_findTabStop(AP_TopRulerInfo * pInfo,
> - UT_uint32 x, UT_uint32 y, eTabType & iType)
> + UT_uint32 x, UT_uint32 y, eTabType & iType, eTabLeader & iLeader)
> {
> // hit-test all the existing tabs
> // return the index of the one found
> @@ -714,7 +718,7 @@
>
> for (UT_sint32 i = 0; i < pInfo->m_iTabStops; i++)
> {
> - _getTabStopXAnchor(pInfo, i, &anchor, iType);
> + _getTabStopXAnchor(pInfo, i, &anchor, iType, iLeader);
> _getTabStopRect(pInfo, anchor, &rect);
>
> if (rect.containsPoint(x,y))
> @@ -1099,7 +1103,8 @@
> // next hit-test against the tabs
>
> eTabType iType;
> - UT_sint32 iTab = _findTabStop(&m_infoCache, x, s_iFixedHeight/2 + s_iFixedHeight/4 - 3, iType);
> + eTabLeader iLeader;
> + UT_sint32 iTab = _findTabStop(&m_infoCache, x, s_iFixedHeight/2 + s_iFixedHeight/4 - 3, iType, iLeader);
> if (iTab >= 0)
> {
> UT_DEBUGMSG(("hit tab %ld\n",iTab));
> @@ -1107,6 +1112,7 @@
> m_draggingWhat = DW_TABSTOP;
> m_draggingTab = iTab;
> m_draggingTabType = iType;
> + m_draggingTabLeader = iLeader;
> m_dragStart = 0;
> m_bBeforeFirstMotion = true;
> return;
> @@ -1193,6 +1199,7 @@
> m_draggingWhat = DW_TABSTOP;
> m_draggingTab = tr_TABINDEX_NEW;
> m_draggingTabType = m_iDefaultTabType;
> + m_draggingTabLeader = FL_LEADER_NONE;
> m_bBeforeFirstMotion = true;
>
> // this is a new widget, so it needs more work to get started
> @@ -1415,19 +1422,20 @@
> case DW_TABSTOP:
> {
> eTabType iType;
> + eTabLeader iLeader;
>
> - UT_sint32 iTab = _findTabStop(&m_infoCache, xgrid+xAbsLeft, s_iFixedHeight/2 + s_iFixedHeight/4 - 3, iType);
> + UT_sint32 iTab = _findTabStop(&m_infoCache, xgrid+xAbsLeft, s_iFixedHeight/2 + s_iFixedHeight/4 - 3, iType, iLeader);
>
> UT_DEBUGMSG (("iTab: %i, m_draggingTab: %i\n", iTab, m_draggingTab));
>
> if (iTab >= 0 && iTab != m_draggingTab)
> {
> UT_DEBUGMSG (("This tab was released over an existing tab. It will be deleted.\n"));
> - _setTabStops(tick, m_draggingTab, true); // true for the last arg will cause this to be deleted
> + _setTabStops(tick, m_draggingTab, iLeader, true); // true for the last arg will cause this to be deleted
> }
> else
> {
> - _setTabStops(tick, iTab, false);
> + _setTabStops(tick, iTab, iLeader, false);
> }
> m_draggingWhat = DW_NOTHING;
> return;
> @@ -1439,7 +1447,7 @@
> }
> }
>
> -void AP_TopRuler::_setTabStops(ap_RulerTicks tick, UT_sint32 iTab, bool bDelete)
> +void AP_TopRuler::_setTabStops(ap_RulerTicks tick, UT_sint32 iTab, eTabLeader iLeader, bool bDelete)
> {
> UT_sint32 xAbsLeft = _getFirstPixelInColumn(&m_infoCache,m_infoCache.m_iCurrentColumn);
> double dxrel = _scalePixelDistanceToUnits(m_draggingCenter-xAbsLeft,tick);
> @@ -1450,7 +1458,9 @@
>
> if (!bDelete)
> {
> - char * sz = NULL;
> + char * sz = NULL, sz1[2];
> + sz1[0] = (char)iLeader + '0'; sz1[1] = 0;
> +
> switch(m_draggingTabType)
> {
> case FL_TAB_LEFT: sz = "L"; break;
> @@ -1464,6 +1474,7 @@
> buf += m_pG->invertDimension(tick.dimType,dxrel);
> buf += "/";
> buf += sz;
> + buf += sz1;
> }
>
> // then append all the remaining tabstops, if any
> @@ -2076,7 +2087,7 @@
> // delete the tab
> m_draggingWhat = dw;
> ap_RulerTicks tick(m_pG,m_dim);
> - _setTabStops(tick, tr_TABINDEX_NONE, true);
> + _setTabStops(tick, tr_TABINDEX_NONE, FL_LEADER_NONE, true);
> }
> break;
>
> Index: src/wp/ap/xp/ap_TopRuler.h
> ===================================================================
> RCS file: /cvsroot/abi/src/wp/ap/xp/ap_TopRuler.h,v
> retrieving revision 1.46
> diff -u -r1.46 ap_TopRuler.h
> --- src/wp/ap/xp/ap_TopRuler.h 2001/02/06 22:54:58 1.46
> +++ src/wp/ap/xp/ap_TopRuler.h 2001/03/29 05:59:02
> @@ -157,16 +157,16 @@
> void _getTabToggleRect(UT_Rect * prToggle);
> void _drawTabToggle(const UT_Rect * pClipRect, bool bErase);
>
> - void _getTabStopXAnchor(AP_TopRulerInfo * pInfo, UT_sint32 k, UT_sint32 * pTab, eTabType & iType);
> + void _getTabStopXAnchor(AP_TopRulerInfo * pInfo, UT_sint32 k, UT_sint32 * pTab, eTabType & iType, eTabLeader & iLeader);
> void _getTabStopRect(AP_TopRulerInfo * pInfo, UT_sint32 anchor, UT_Rect * pRect);
> void _drawTabProperties(const UT_Rect * pClipRect,
> AP_TopRulerInfo * pInfo,
> bool bDrawAll = true);
>
> - UT_sint32 _findTabStop(AP_TopRulerInfo * pInfo, UT_uint32 x, UT_uint32 y, eTabType & iType);
> + UT_sint32 _findTabStop(AP_TopRulerInfo * pInfo, UT_uint32 x, UT_uint32 y, eTabType & iType, eTabLeader & iLeader);
> const char * _getTabStopString(AP_TopRulerInfo * pInfo, UT_sint32 k);
> void _getTabZoneRect(AP_TopRulerInfo * pInfo, UT_Rect &rZone);
> - void _setTabStops(ap_RulerTicks tick, UT_sint32 iTab, bool bDelete);
> + void _setTabStops(ap_RulerTicks tick, UT_sint32 iTab, eTabLeader iLeader, bool bDelete);
>
> UT_sint32 _getColumnMarkerXRightEnd(AP_TopRulerInfo * pInfo, UT_uint32 kCol);
> void _getColumnMarkerRect(AP_TopRulerInfo * pInfo, UT_uint32 kCol, UT_sint32 xCenter,
> @@ -238,6 +238,7 @@
> UT_Rect m_dragging2Rect; /* rect of drag-along */
> UT_sint32 m_draggingTab; /* index of tab being dragged */
> eTabType m_draggingTabType;
> + eTabLeader m_draggingTabLeader;
> UT_sint32 m_dragStart;
> bool m_bBeforeFirstMotion;
>
>
>
>



This archive was generated by hypermail 2b25 : Thu Mar 29 2001 - 01:42:43 CST