10#include <owl/docview.rh>
11#include <owl/editview.rh>
45 Attr.AccelTable = IDA_EDITVIEW;
107 unique_ptr<tistream> inStream (Doc->InStream(ios::in | ios::binary));
110 Doc->PostError(IDS_UNABLEOPEN, MB_OK);
113 inStream->seekg(0, ios::end);
114 streamsize count =
static_cast<streamsize
>(inStream->tellg() - streampos(0));
115 inStream->seekg(0, ios::beg);
120 Doc->PostError(IDS_NOMEMORYFORVIEW, MB_OK);
125 Doc->PostError(IDS_NOMEMORYFORVIEW, MB_OK);
129 inStream->read(buf, count);
130 bool status = (inStream->gcount() == count);
134 Doc->PostError(IDS_READERROR, MB_OK);
151 Doc->PostError(IDS_NOMEMORYFORVIEW, MB_OK);
155 if (Doc->GetDocPath() ==
nullptr) {
173 unique_ptr<tostream> outStream(Doc->OutStream(ios::out | ios::binary));
174 if (!outStream.get())
176 Doc->PostError(IDS_UNABLEOPEN, MB_OK);
179 outStream->seekp(Origin);
185 outStream->write(buf, count);
186 status = outStream->good();
191 Doc->PostError(IDS_WRITEERROR, MB_OK);
212#if OWL_PERSISTENT_STREAMS
222 is >> GetObject()->Origin;
230TEditView::Streamer::Write(opstream& os)
const
234 os << GetObject()->Origin;
TEditSearch is an edit control that responds to Find, Replace, and FindNext menu commands.
Derived from TView and TEditSearch, TEditView provides a view wrapper for the ObjectWindows text edit...
bool VnCommit(bool force)
Commits changes made in the view to the document.
void EvNCDestroy()
Used internally by TEditView to manage memory.
bool VnDocClosed(int omode)
Indicates that the document has been closed.
TEditView(TDocument &doc, TWindow *parent=0)
Creates a TEditView object associated with the specified document and parent window.
bool VnRevert(bool clear)
Returns a nonzero value if changes made to the view should be erased and the data from the document s...
~TEditView() override
Destroys a TEditView object.
bool VnIsDirty()
Returns a nonzero value if changes made to the data in the view have not been saved to the document; ...
bool LoadData()
Reads the view from the stream and closes the file.
bool VnIsWindow(HWND hWnd)
Returns a nonzero value if the window's handle passed in hWnd is the same as that of the view's displ...
Abstract base class for view access from document.
friend class TDocument
needs access to NextView
TView(TDocument &doc)
Constructs a TView object of the document associated with the view.
void SetViewMenu(TMenuDescr *menu)
static uint GetNextViewId()
Next global ID to assign.
void NotOK()
To flag errors in creation.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
virtual bool Create()
Creates the window interface element to be associated with this ObjectWindows interface element.
TModule * GetModule() const
Returns a pointer to the module object.
bool IsChild(HWND hWnd) const
Returns true if the window is a child window or a descendant window of this window.
void EvNCDestroy()
Responds to an incoming WM_NCDESTROY message, the last message sent to an MS-Windows interface elemen...
HWND GetHandle() const
Returns the handle of the window.
TXOwl is root class of the ObjectWindows exception hierarchy.
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
#define DEFINE_RESPONSE_TABLE1(cls, base)
Macro to define a response table for a class with one base.
void ReadBaseObject(Base *base, ipstream &in)
void WriteBaseObject(Base *base, opstream &out)
void Scroll(int horizontalUnit, int verticalUnit)
Scroll the text by the specified horizontal and vertical amounts.
TEditSearch(TWindow *parent=nullptr, int id=0, LPCTSTR text=nullptr, int x=0, int y=0, int w=0, int h=0, TModule *module=nullptr)
Constructs a TEditSearch object given the parent window, resource ID, and character string (text).
void ClearModify()
Resets the change flag of the edit control causing IsModified to return false.
void UnlockBuffer(LPCTSTR buffer, bool updateHandle=false)
Unlock the edit control's buffer locked by LockBuffer.
int GetFirstVisibleLine() const
Indicates the topmost visible line in an edit control.
TCHAR * LockBuffer(uint newSize=0)
Lock and unlock this edit control's buffer.
void Clear() override
Override TStatic virtual member functions.
virtual bool SetSelection(int startPos, int endPos)
Select the characters in the range "startPos .. endPos".
TRange GetSelection() const
Functional style overload.
@ ofWrite
ios::out, open for writing
Object Windows Library (OWLNext Core).
bool IsRepresentable(U v)
Helper function for testing for integer truncations.
IMPLEMENT_STREAMABLE2(TEditView, TEditSearch, TView)
DIAG_DECLARE_GROUP(OwlThread)