Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions | Variables
popfind.c File Reference
#include <windows.h>
#include <commdlg.h>
#include <string.h>

Go to the source code of this file.

Defines

#define MAX_STRING_LEN   256

Functions

HWND PopFindFindDlg (HWND hwnd)
HWND PopFindReplaceDlg (HWND hwnd)
BOOL PopFindFindText (HWND hwndEdit, int *piSearchOffset, LPFINDREPLACE lpfr)
BOOL PopFindNextText (HWND hwndEdit, int *piSearchOffset)
BOOL PopFindReplaceText (HWND hwndEdit, int *piSearchOffset, LPFINDREPLACE lpfr)
BOOL PopFindValidFind (void)

Variables

static char szFindText [MAX_STRING_LEN]
static char szReplText [MAX_STRING_LEN]

Define Documentation

Definition at line 46 of file popfind.c.


Function Documentation

Definition at line 51 of file popfind.c.

     {
     static FINDREPLACE fr ;       // must be static for modeless dialog!!!

     fr.lStructSize      = sizeof (FINDREPLACE) ;
     fr.hwndOwner        = hwnd ;
     fr.hInstance        = NULL ;
     fr.Flags            = FR_HIDEUPDOWN | FR_HIDEMATCHCASE | FR_HIDEWHOLEWORD ;
     fr.lpstrFindWhat    = szFindText ;
     fr.lpstrReplaceWith = NULL ;
     fr.wFindWhatLen     = sizeof (szFindText) ;
     fr.wReplaceWithLen  = 0 ;
     fr.lCustData        = 0 ;
     fr.lpfnHook         = NULL ;
     fr.lpTemplateName   = NULL ;

     return FindText (&fr) ;
     }

Here is the caller graph for this function:

BOOL PopFindFindText ( HWND  hwndEdit,
int piSearchOffset,
LPFINDREPLACE  lpfr 
)

Definition at line 89 of file popfind.c.

     {
     int         iPos ;
     LOCALHANDLE hLocal ;
     LPSTR       lpstrDoc, lpstrPos ;

               // Get a pointer to the edit document

     hLocal   = (HWND) SendMessage (hwndEdit, EM_GETHANDLE, 0, 0L) ;
     lpstrDoc = (LPSTR) LocalLock (hLocal) ;

               // Search the document for the find string

     lpstrPos = _fstrstr (lpstrDoc + *piSearchOffset, lpfr->lpstrFindWhat) ;
     LocalUnlock (hLocal) ;

               // Return an error code if the string cannot be found

     if (lpstrPos == NULL)
          return FALSE ;

               // Find the position in the document and the new start offset

     iPos = lpstrPos - lpstrDoc ;
     *piSearchOffset = iPos + _fstrlen (lpfr->lpstrFindWhat) ;

               // Select the found text

     SendMessage (hwndEdit, EM_SETSEL, 0,
                  MAKELONG (iPos, *piSearchOffset)) ;

     return TRUE ;
     }

Here is the caller graph for this function:

BOOL PopFindNextText ( HWND  hwndEdit,
int piSearchOffset 
)

Definition at line 123 of file popfind.c.

     {
     FINDREPLACE fr ;

     fr.lpstrFindWhat = szFindText ;

     return PopFindFindText (hwndEdit, piSearchOffset, &fr) ;
     }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 70 of file popfind.c.

     {
     static FINDREPLACE fr ;       // must be static for modeless dialog!!!

     fr.lStructSize      = sizeof (FINDREPLACE) ;
     fr.hwndOwner        = hwnd ;
     fr.hInstance        = NULL ;
     fr.Flags            = FR_HIDEUPDOWN | FR_HIDEMATCHCASE | FR_HIDEWHOLEWORD ;
     fr.lpstrFindWhat    = szFindText ;
     fr.lpstrReplaceWith = szReplText ;
     fr.wFindWhatLen     = sizeof (szFindText) ;
     fr.wReplaceWithLen  = sizeof (szReplText) ;
     fr.lCustData        = 0 ;
     fr.lpfnHook         = NULL ;
     fr.lpTemplateName   = NULL ;

     return ReplaceText (&fr) ;
     }

Here is the caller graph for this function:

BOOL PopFindReplaceText ( HWND  hwndEdit,
int piSearchOffset,
LPFINDREPLACE  lpfr 
)

Definition at line 132 of file popfind.c.

     {
               // Find the text

     if (!PopFindFindText (hwndEdit, piSearchOffset, lpfr))
          return FALSE ;

               // Replace it

     SendMessage (hwndEdit, EM_REPLACESEL, 0, (long) lpfr->lpstrReplaceWith) ;

     return TRUE ;
     }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 146 of file popfind.c.

     {
     return *szFindText != '\0' ;
     }

Here is the caller graph for this function:


Variable Documentation

char szFindText[MAX_STRING_LEN] [static]

Definition at line 48 of file popfind.c.

char szReplText[MAX_STRING_LEN] [static]

Definition at line 49 of file popfind.c.