Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

edslrare.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

LONG SLCreate (PED ped, LPCREATESTRUCT lpCreateStruct)
 !! CREATESTRUCT AorW and in other routines

BOOL SLUndo (PED ped)


Function Documentation

LONG SLCreate PED  ped,
LPCREATESTRUCT  lpCreateStruct
 

!! CREATESTRUCT AorW and in other routines

Definition at line 27 of file edslrare.c.

References CBLISTBOXID, tagED::cLines, ECCreate(), ECSetFont(), ECSetPasswordChar(), ECSetText(), FALSE, tagED::fAnsi, GetDlgItem(), gHighestUserAddress, IsEmptyString(), tagED::listboxHwnd, NULL, tagED::pwnd, REBASEPTR, TRUE, UINT, and UNDO_NONE.

Referenced by SLEditWndProc().

00030 { 00031 LPSTR lpWindowText; 00032 LONG windowStyle = ped->pwnd->style; 00033 00034 /* 00035 * Do the standard creation stuff 00036 */ 00037 if (!ECCreate(ped, windowStyle)) 00038 return (-1); 00039 00040 /* 00041 * Single lines always have no undo and 1 line 00042 */ 00043 ped->cLines = 1; 00044 ped->undoType = UNDO_NONE; 00045 00046 /* 00047 * Check if this edit control is part of a combobox and get a pointer to the 00048 * combobox structure. 00049 */ 00050 if (windowStyle & ES_COMBOBOX) 00051 ped->listboxHwnd = GetDlgItem(lpCreateStruct->hwndParent, CBLISTBOXID); 00052 00053 /* 00054 * Set the default font to be the system font. 00055 */ 00056 ECSetFont(ped, NULL, FALSE); 00057 00058 /* 00059 * Set the window text if needed. Return false if we can't set the text 00060 * SLSetText notifies the parent in case there is a no memory error. 00061 */ 00062 if ((ULONG_PTR)lpCreateStruct->lpszName > gHighestUserAddress) 00063 lpWindowText = REBASEPTR(ped->pwnd, (PVOID)lpCreateStruct->lpszName); 00064 else 00065 lpWindowText = (LPSTR)lpCreateStruct->lpszName; 00066 00067 if ((lpWindowText != NULL) 00068 && !IsEmptyString(lpWindowText, ped->fAnsi) 00069 && !ECSetText(ped, lpWindowText)) { 00070 return (-1); 00071 } 00072 00073 if (windowStyle & ES_PASSWORD) 00074 ECSetPasswordChar(ped, (UINT)'*'); 00075 00076 return TRUE; 00077 }

BOOL SLUndo PED  ped  ) 
 

Definition at line 87 of file edslrare.c.

References BOOL, ECDeleteText(), ECInvalidateClient(), ECNotifyParent(), FALSE, FChildVisible(), FWINABLE, tagED::hwnd, ICH, IsWindow(), NotifyWinEvent(), NULL, PBYTE, SLInsertText(), SLSetSelection(), TRUE, UNDO_DELETE, UNDO_INSERT, UNDO_NONE, and UserGlobalFree.

Referenced by SLEditWndProc(), and SLReplaceSel().

00089 { 00090 PBYTE hDeletedText = ped->hDeletedText; 00091 BOOL fDelete = (BOOL)(ped->undoType & UNDO_DELETE); 00092 ICH cchDeleted = ped->cchDeleted; 00093 ICH ichDeleted = ped->ichDeleted; 00094 BOOL fUpdate = FALSE; 00095 00096 if (ped->undoType == UNDO_NONE) { 00097 00098 /* 00099 * No undo... 00100 */ 00101 return FALSE; 00102 } 00103 00104 ped->hDeletedText = NULL; 00105 ped->cchDeleted = 0; 00106 ped->ichDeleted = (ICH)-1; 00107 ped->undoType &= ~UNDO_DELETE; 00108 00109 if (ped->undoType == UNDO_INSERT) { 00110 ped->undoType = UNDO_NONE; 00111 00112 /* 00113 * Set the selection to the inserted text 00114 */ 00115 SLSetSelection(ped, ped->ichInsStart, ped->ichInsEnd); 00116 ped->ichInsStart = ped->ichInsEnd = (ICH)-1; 00117 00118 #ifdef NEVER 00119 00120 /* 00121 * Now send a backspace to deleted and save it in the undo buffer... 00122 */ 00123 SLCharHandler(pped, VK_BACK); 00124 fUpdate = TRUE; 00125 #else 00126 00127 /* 00128 * Delete the selected text and save it in undo buff. 00129 * Call ECDeleteText() instead of sending a VK_BACK message 00130 * which results in an EN_UPDATE notification send even before 00131 * we insert the deleted chars. This results in Bug #6610. 00132 * Fix for Bug #6610 -- SANKAR -- 04/19/91 -- 00133 */ 00134 if (ECDeleteText(ped)) { 00135 00136 /* 00137 * Text was deleted -- flag for update and clear selection 00138 */ 00139 fUpdate = TRUE; 00140 SLSetSelection(ped, ichDeleted, ichDeleted); 00141 } 00142 #endif 00143 } 00144 00145 if (fDelete) { 00146 HWND hwndSave = ped->hwnd; // Used for validation. 00147 00148 /* 00149 * Insert deleted chars. Set the selection to the inserted text. 00150 */ 00151 SLSetSelection(ped, ichDeleted, ichDeleted); 00152 SLInsertText(ped, hDeletedText, cchDeleted); 00153 UserGlobalFree(hDeletedText); 00154 if (!IsWindow(hwndSave)) 00155 return FALSE; 00156 SLSetSelection(ped, ichDeleted, ichDeleted + cchDeleted); 00157 fUpdate = TRUE; 00158 } 00159 00160 if (fUpdate) { 00161 /* 00162 * If we have something to update, send EN_UPDATE before and 00163 * EN_CHANGE after the actual update. 00164 * A part of the fix for Bug #6610 -- SANKAR -- 04/19/91 -- 00165 */ 00166 ECNotifyParent(ped, EN_UPDATE); 00167 00168 if (FChildVisible(ped->hwnd)) { 00169 // JimA changed this to ECInvalidateClient(ped, FALSE) Nov 1994 00170 // GetClientRect(ped->hwnd, &rcEdit); 00171 // if (ped->fBorder && rcEdit.right - rcEdit.left && rcEdit.bottom - rcEdit.top) { 00172 // 00173 // /* 00174 // * Don't invalidate the border so that we avoid flicker 00175 // */ 00176 // InflateRect(&rcEdit, -1, -1); 00177 // } 00178 // NtUserInvalidateRect(ped->hwnd, &rcEdit, FALSE); 00179 ECInvalidateClient(ped, FALSE); 00180 } 00181 00182 ECNotifyParent(ped, EN_CHANGE); 00183 00184 if (FWINABLE()) { 00185 NotifyWinEvent(EVENT_OBJECT_VALUECHANGE, ped->hwnd, OBJID_CLIENT, INDEXID_CONTAINER); 00186 } 00187 } 00188 00189 return TRUE; 00190 }


Generated on Sat May 15 19:43:32 2004 for test by doxygen 1.3.7