eudora-mac/searchwin.c

1 line
143 KiB
C
Raw 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. */ #ifdef NEWFIND #include "searchwin.h" #include "regexp.h" #define FILE_NUM 114 #pragma segment Find /* Copyright (c) 1998 by QUALCOMM Incorporated */ // constants enum { kMaxCriteria = 16, // should be enough kWinHeaderHt = 99, // height of window header excluding criteria kCriteriaHt = 27, // height of 1 criteria line kMBHdrHt = 18, // height of mailbox header control kFrontWinTicks = 60, // max ticks allowed when search window is in front, hog CPU time but exit for any events kBgdWinTicks = 10, // max ticks allowed when search window is not in front kInBGTicks = 4, // max ticks allowed when Eudora is in background kChaseArrowTicks = 15, // call idle function for chase arrows 4 times a second kDateWi = 100, // Date control width kDateHt = 22, // Date control height (must be 20) kIOBufSize = 32 K, // Size of bulk search I/O buffers kSpecListType = 'Spec' }; // criteria category menu items enum { scAnywhere=1,scHeaders,scBody,scAttachNames,scDiv1, scSummary,scStatus,scJunkScore,scPriority,scAttachCount,scLabel,scDate,scSize,scAge, scPersonality, scDiv2,scTo,scFrom,scSubject,scCC,scBCC,scAnyRecipient,scLimit }; // We save the criteria differently from how they appear in the menus. // Map saved categories to the ones we use in the menu char SavedCategory2MenuCategory[] = {0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,8}; #define SafeSavedCategory2MenuCategory(x) ((x)<scLimit ? SavedCategory2MenuCategory[x]:1) // Map the categories in the menu to the ones we save char MenuCategory2SavedCategory[] = {0,1,2,3,4,5,6,7,22,8,9,10,11,12,13,14,15,16,17,18,19,20,21}; enum { ssText=1,ssDate,ssAge,ssNumber }; enum { sauMinutes=1,sauHours,sauDays,sauWeeks,sauMonths,sauYears }; enum { matchAll=1,matchAny }; enum { tabMailboxes=1,tabResults }; static short MenuToDateField[] = { minuteField,hourField,dayField,dayField,monthField,yearField }; // criteria relation menu items enum { srIs=1,srIsNot,srGreater,srLess }; enum { strContains=1,strContainsWord,strDoesNotContain,strIs,strIsNot,strStarts,strEnds,strRegExp }; // category table indicates relation and specifier enum { kNeedsSum=1<<0, kNeedsMsg=1<<1, }; enum { kSearchingLocal=1<<0, kSearchingIMAP=1<<1 }; // Auditable Search Window controls enum { kctlSearch=0, kctlMore, kctlFewer, kctlTabs, kctlSrchResults, kctlCriteria, kctlMatch }; struct { short relation; short specifier; short