1998-03-28 05:44:41 +03:00
|
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
|
*
|
2004-04-25 20:36:22 +04:00
|
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-03-28 05:44:41 +03:00
|
|
|
|
*
|
2004-04-25 20:36:22 +04:00
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
|
*
|
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
|
* License.
|
1998-03-28 05:44:41 +03:00
|
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
|
*
|
2004-04-25 20:36:22 +04:00
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s):
|
|
|
|
|
*
|
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
1999-11-06 06:43:54 +03:00
|
|
|
|
*
|
2004-04-25 20:36:22 +04:00
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <CWASTEEdit.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
// Wrapping Modes
|
|
|
|
|
//
|
|
|
|
|
// Text can be wrapped in one of the following three ways:
|
|
|
|
|
//
|
|
|
|
|
// wrapMode_WrapToFrame - Wrap to view frame. This is similar to common
|
|
|
|
|
// TE style wrapping.
|
|
|
|
|
//
|
|
|
|
|
// wrapMode_FixedPage - Don't wrap. This would be like the metrowerks
|
|
|
|
|
// code editor in which the page size is arbitrarily large in width
|
|
|
|
|
// but no wrapping will occur when text flows outside the page bounds.
|
|
|
|
|
//
|
|
|
|
|
// wrapMode_FixedPage - Text is wrapped to the width of the page. This
|
|
|
|
|
// would be like a word processor.
|
|
|
|
|
//
|
|
|
|
|
// wrapMode_WrapWidestUnbreakable - The page size is determined by
|
|
|
|
|
// the view frame size or the width of the widest unbreakable run.
|
|
|
|
|
// This behaviour would be most like an HTML browser. Text can
|
|
|
|
|
// always be broken, but things like graphic images can not.
|
|
|
|
|
// With text only, this behaves like the normal wrap to frame mode.
|
|
|
|
|
//
|
|
|
|
|
// IMPORTANT NOTE: if you are providing multiple views on a text engine,
|
|
|
|
|
// and those views have different wrapping modes, the formatter will
|
|
|
|
|
// reformat the text to the mode specified by the view EVERY TIME THE
|
|
|
|
|
// VIEW IS FOCUSED. This is probably not something you'd want to have
|
|
|
|
|
// happening in your app.
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
wrapMode_WrapToFrame = 1,
|
|
|
|
|
wrapMode_FixedPage,
|
|
|
|
|
wrapMode_FixedPageWrap,
|
|
|
|
|
wrapMode_WrapWidestUnbreakable
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct SSimpleTextParms {
|
|
|
|
|
Uint16 attributes;
|
|
|
|
|
Uint16 wrappingMode;
|
|
|
|
|
ResIDT traitsID;
|
|
|
|
|
ResIDT textID;
|
|
|
|
|
Int32 pageWidth;
|
|
|
|
|
Int32 pageHeight;
|
|
|
|
|
Rect margins;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CSimpleTextView : public CWASTEEdit
|
|
|
|
|
{
|
|
|
|
|
// friend class LTextEditHandler; // this will be going away!
|
|
|
|
|
|
|
|
|
|
private:
|
1998-06-23 01:21:28 +04:00
|
|
|
|
typedef CWASTEEdit Inherited;
|
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
|
|
CSimpleTextView(); // Must use parameters
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
class_ID = 'Stxt'
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CSimpleTextView( LStream *inStream);
|
|
|
|
|
|
|
|
|
|
virtual ~CSimpleTextView();
|
|
|
|
|
|
|
|
|
|
// virtual void BuildTextObjects(LModelObject *inSuperModel);
|
|
|
|
|
|
|
|
|
|
// <20> Event Handler Overrides
|
|
|
|
|
// virtual void NoteOverNewThing(LManipulator* inThing);
|
|
|
|
|
|
|
|
|
|
virtual Boolean ObeyCommand( CommandT inCommand,
|
|
|
|
|
void *ioParam);
|
|
|
|
|
|
|
|
|
|
virtual void FindCommandStatus( CommandT inCommand,
|
|
|
|
|
Boolean &outEnabled,
|
|
|
|
|
Boolean &outUsesMark,
|
|
|
|
|
Char16 &outMark,
|
|
|
|
|
Str255 outName);
|
|
|
|
|
|
|
|
|
|
static pascal void TSMPreUpdate( WEReference inWE);
|
|
|
|
|
|
|
|
|
|
// <20> Initialization
|
|
|
|
|
|
|
|
|
|
virtual void SetInitialTraits(ResIDT inTextTraitsID);
|
|
|
|
|
virtual void SetInitialText(ResIDT inTextID);
|
|
|
|
|
|
1998-06-23 01:21:28 +04:00
|
|
|
|
virtual Boolean IsReadOnly();
|
1998-03-28 05:44:41 +03:00
|
|
|
|
virtual void SetReadOnly( const Boolean inFlag );
|
|
|
|
|
|
1998-06-23 01:21:28 +04:00
|
|
|
|
virtual void SetTabSelectsAll ( const Boolean inTabIntoFieldSelectsAll )
|
|
|
|
|
{
|
|
|
|
|
mTabIntoFieldSelectsAll = inTabIntoFieldSelectsAll;
|
|
|
|
|
};
|
1998-03-28 05:44:41 +03:00
|
|
|
|
// Commands
|
|
|
|
|
|
|
|
|
|
void Save( const FSSpec &inFileSpec );
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
virtual void ClickSelf( const SMouseDownEvent &inMouseDown);
|
1998-06-23 01:21:28 +04:00
|
|
|
|
virtual Boolean HandleKeyPress( const EventRecord & inKeyEvent);
|
|
|
|
|
|
1998-03-28 05:44:41 +03:00
|
|
|
|
virtual void BeTarget();
|
|
|
|
|
virtual void DontBeTarget();
|
|
|
|
|
|
|
|
|
|
virtual void FinishCreateSelf(void);
|
|
|
|
|
virtual void Initialize();
|
|
|
|
|
|
|
|
|
|
// SSimpleTextParms* mTextParms;
|
|
|
|
|
|
|
|
|
|
static Boolean sInitialized;
|
|
|
|
|
static Boolean sHasTSM;
|
|
|
|
|
static WETSMPreUpdateUPP sPreUpdateUPP;
|
|
|
|
|
static CSimpleTextView *sTargetView;
|
|
|
|
|
|
1998-06-23 01:21:28 +04:00
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
Boolean mTabIntoFieldSelectsAll;
|
1998-03-28 05:44:41 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|