eudora-mac/listview.c

1 line
99 KiB
C
Raw Permalink Normal View History

2018-05-23 09:59:15 +00:00
/* Copyright (c) 2017, Computer History Museum All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Computer History Museum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /********************************************************************** * Implements a hierarchical list similar to Finder's list view **********************************************************************/ #include "listview.h" #define FILE_NUM 83 // Don't include auto bring-to-front feature. There is a bug when returning the window // to it's previous position--it sometimes gets lost. This bug is not reproduceable and // I can't determine what's causing it. ALB 1/24/97 // Well, let's try it again! ALB 7/11/97 #define AUTOFRONT true #pragma segment ListView static short gAddCell,gAddLevel; static OSType gDragFlavor; #define ArrowLeft pView->details.arrowLeft #define IconTop pView->details.iconTop #define IconLeft pView->details.iconLeft #define IconLevelWidth pView->details.iconLevelWidth #define TextBottom pView->details.textBottom #define RowHt pView->details.rowHt #define NameAddMargin pView->details.nameAddMargin #define MaxNameWidth pView->details.maxNameWidth #define KeyNavTicks pView->details.keyNavTicks #define COLLAPSED_ICON 3060 #define EXPANDED_ICON 3061 // Drag info needed for list clickloop typedef struct { ViewListPtr pView; EventRecord *event; Point pt; short clickLoopCount; Boolean dragHilited; DragReference drag; } DragInfo; // Prototypes static void AdjustPeteSize(ViewListPtr pView,Rect *rErase); static void BringWinToFront(ViewListPtr pView); static long CallBack(ViewListPtr pView,short message, long data); static void CheckFillList(ViewListPtr pView); static void CollapseDragExpanded(ViewListPtr pView,short descendent,DragReference drag); static void CopyCellInfo(VLNodeInfo *pInfo,CellRec *pCellData,short rowNum); static void CopyNodeInfo(CellRec *pCellData,VLNodeInfo *pInfo); static short CountChildren(ViewListPtr pView,short item); static void DelayTicks(long tickCount); static void DisposeDragRgn(RgnHandle rgn, GWorldPtr gworld, RgnHandle hDragRgn); static void DoDraw(ViewListPtr pView); static void DontDraw(ViewListPtr pView); static void DragHilite(ViewListPtr pView,short row,Boolean hilite); static void DragSelect(ViewListPtr pView,Point initPt); static void DrawItem(ViewListPtr pView,short row,Rect *pRect,CellRec *pCellData,Boolean select,Boolean eraseName); static void DrawPete(ViewListPtr pView); static void DrawRow(ViewListPtr pView, short row,Boolean hilite); static CellRec *FindByName(ViewListPtr pView,VLNodeID id,StringPtr sName,short *pRow