12 #ifndef __WXCANTEXT_H__
13 #define __WXCANTEXT_H__
99 a2dCANOBJTEXT_MULTILINE = 1 << 1,
101 a2dCANOBJTEXT_READONLY = 1 << 2,
103 a2dCANOBJTEXT_CARETVISIBLE = 1 << 3,
105 a2dCANOBJTEXT_NEXTLINEUP = 1 << 4,
107 a2dCANOBJTEXT_ENGINEERING = 1 << 5,
109 a2dCANOBJTEXT_BACKGROUND = 1 << 6,
111 a2dCANOBJTEXT_FRAME = 1 << 7,
112 a2dCANVASTEXT_DEFAULTFLAGS = a2dCANOBJTEXT_MULTILINE
113 | a2dCANOBJTEXT_CARETVISIBLE
114 | a2dCANOBJTEXT_NEXTLINEUP
118 DECLARE_EVENT_TABLE()
119 DECLARE_DYNAMIC_CLASS(
a2dText )
125 a2dText( const wxString& text = wxT( "not specified" ) );
137 a2dText( const wxString& text,
double x,
double y,
139 bool up = false,
int alignment = a2dDEFAULT_ALIGNMENT );
149 inline a2dText* TClone( CloneOptions options,
a2dRefMap* refs = NULL ) {
return ( a2dText* )
Clone( options, refs ); }
154 int GetLines()
const;
157 int GetAsArray( wxArrayString& array );
160 wxString GetLine(
int line )
const;
162 wxString GetSelectedText()
const;
166 { m_text = text; m_utbbox_changed =
true;
SetPending(
true ); }
168 inline wxString
GetText()
const {
return m_text; }
170 void InsertTextAtCarret(
const wxString& text );
174 { m_font.SetSize( height ); m_utbbox_changed =
true;
SetPending(
true ); }
182 inline void SetWrongLoad(
bool wrongLoad ) { m_wrongLoad = wrongLoad; }
188 { m_linespace = linespace; m_utbbox_changed =
true;
SetPending(
true ); }
193 inline void SetTextFlags(
unsigned int textflags ) { m_textflags = textflags; m_utbbox_changed =
true; }
198 void SetMultiLine(
bool multiline =
true );
201 {
return ( m_textflags & a2dCANOBJTEXT_MULTILINE ) != 0; }
204 void SetReadOnly(
bool readonly =
true );
207 {
return ( m_textflags & a2dCANOBJTEXT_READONLY ) != 0; }
210 void SetNextLineDirection(
bool up );
213 {
return ( m_textflags & a2dCANOBJTEXT_NEXTLINEUP ) != 0; }
216 void SetEngineeringText(
bool engineering =
true );
219 {
return ( m_textflags & a2dCANOBJTEXT_ENGINEERING ) != 0; }
228 void SetBackGround(
bool background =
true );
231 {
return ( m_textflags & a2dCANOBJTEXT_BACKGROUND ) != 0; }
237 void SetDrawFrame(
bool frame =
true );
240 {
return ( m_textflags & a2dCANOBJTEXT_FRAME ) != 0; }
247 void SetFont(
const a2dFont& font,
double lineSpaceFactor = 0.1 );
265 bool SetCaret(
a2dIterC& ic,
double x,
double y );
268 void SetCaretShow(
bool visible =
true );
271 {
return ( m_textflags & a2dCANOBJTEXT_CARETVISIBLE ) != 0; }
296 if( m_alignment != alignment )
298 m_alignment = alignment; m_utbbox_changed =
true;
SetPending(
true );
305 {
return m_alignment; }
316 #if wxART2D_USE_CVGIO
322 #endif //wxART2D_USE_CVGIO
345 virtual
a2dBoundingBox DoGetUnTransformedBbox( a2dBboxFlags flags = a2dCANOBJ_BBOX_NON ) const;
352 void SetCaretUntransformed(
double xh,
double yh );
357 virtual
bool DoStartEdit( wxUint16 editmode,
wxEditStyle editstyle );
359 virtual
void DoEndEdit();
361 void OnChar( wxKeyEvent& event );
367 const
a2dFont& MX_GetFont()
const {
return m_font; }
368 void MX_SetFont(
const a2dFont& value ) { m_font = value; }
417 #if defined(WXART2D_USINGDLL)
424 enum TEXT_PATHTYPE {TEXT_PATH_END_SQAURE, TEXT_PATH_END_ROUND, TEXT_PATH_END_SQAURE_EXT};
429 enum {FONT0, FONT1, FONT2, FONT3};
430 enum {TOP, MIDDLE, BOTTOM};
431 enum {LEFT, CENTER, RIGTH};
437 #if wxBYTE_ORDER == wxBIG_ENDIAN
438 unsigned m_reserved : 10;
440 unsigned m_vertical: 2;
441 unsigned m_horizontal: 2;
443 unsigned m_horizontal: 2;
444 unsigned m_vertical: 2;
446 unsigned m_reserved : 10;
453 #define DEFAULT_PRESENTATION_FONT FONT0
454 #define DEFAULT_PRESENTATION_VERTICAL TOP
455 #define DEFAULT_PRESENTATION_HORIZONTAL LEFT
456 #define DEFAULT_FONT_HEIGHT 1
476 a2dTextGDS( a2dFontType fontType = a2dFONT_STROKED,
const wxString& text = wxT(
"not specified" ),
double height = 1.0,
short int presentation = 0 );
481 void SetFontGDS(
char nw_font = DEFAULT_PRESENTATION_FONT );
482 void SetVertical(
char nw_vertical = DEFAULT_PRESENTATION_VERTICAL );
483 void SetHorizontal(
char nw_horizontal = DEFAULT_PRESENTATION_HORIZONTAL );
484 short int GetFontGDS();
485 short int GetVertical();
486 short int GetHorizontal();
488 void SetRotation(
double rotation );
489 double GetRotation();
499 void SetPresentationFlags(
short int total );
501 short int GetPresentationFlags( );
503 void SetPathtype( TEXT_PATHTYPE type ) { m_pathtype = type; }
505 TEXT_PATHTYPE GetPathtype() {
return m_pathtype; }
515 #if wxART2D_USE_CVGIO
521 #endif //wxART2D_USE_CVGIO
529 a2dFontType m_fontType;
531 TEXT_PATHTYPE m_pathtype;
537 static double m_fontScaleFactor;
544 } m_presentationflags;
564 static void InitialiseFontList(
const wxArrayString &filterlist = wxArrayString(),
const wxString filtertype = wxT(
"" ));
567 void Set(
const a2dFont& font,
unsigned int textflags,
int alignment,
bool wrongloadflag =
false );
570 void Mix(
const a2dFont& font,
unsigned int textflags,
int alignment );
573 a2dFont GetFont(
const a2dFont& font, wxArrayString valid_styles = wxArrayString(), wxArrayString valid_extras = wxArrayString() )
const;
574 int GetAlignment(
int Alignment )
const;
575 unsigned int GetTextFlags(
unsigned int textflags )
const;
578 bool IsValid()
const {
return m_bFont; }
580 a2dFont GetFont()
const {
return m_Font; }
620 m_textflags = textflags;
627 m_alignment = alignment;
631 bool IsTypeValid()
const {
return m_bType; }
632 bool IsNameValid()
const {
return m_bName; }
633 bool IsStyleValid()
const {
return m_bStyle; }
634 bool IsSizeValid()
const {
return m_bSize; }
635 bool IsAlignmentValid()
const {
return m_balignment; }
636 bool IsTextflagsValid()
const {
return m_btextflags; }
638 void SetStyleValidity(
bool valid ) { m_bStyle = valid; }
639 void SetNameValidity(
bool valid ) { m_bName = valid; }
648 {
return m_alignment; }
651 {
return &m_fontlist; }
653 wxArrayString GetCommonStyle()
654 {
return m_commonstyle; }
671 unsigned int m_textflags;
678 wxArrayString m_commonstyle;
virtual bool GeneratePins(a2dPinClass *toConnectTo, a2dConnectTask task, double x, double y, double margin=0)
create pins in derived objects.
int GetAlignment() const
Get the position of the anchor point w.r.t the text.
wxString TextAlignment2String(int alignment)
convert alignment enum to a string
bool GetWrongLoad() const
Get flag if text couldn't be loadad from file.
mouse event sent from a2dCanvasObject to itself
a2dConnectTask
flags for searching a connecting a2dpinClass, for the connecting task at hand.
void SetAlignment(int alignment)
Set the position of the anchor point w.r.t the text.
Font info class, used as a single element for enumerating fonts.
a2dTextGDS text based on wxDC text drawing.
class to map references to objects stored in XML, in order to make the connection later on...
int m_alignment
Alignment.
virtual bool AdjustPinLocation()
Allow change in pin location when wiring things up.
static double GetFontScaleFactor()
a factor to modify the internal text height, compared to the GDSII file height.
double m_linespace
space between the lines
This is a class/type description for a2dPin's.
bool GetMultiLine() const
True if multiple lines of text are allowed.
a2dObject * Clone(CloneOptions options, a2dRefMap *refs=NULL) const
create an exact copy of this property
bool GetBackGround() const
unsigned int GetTextFlags() const
Get the text flags.
int m_caret
position of caret within text string
Defines a font to be set to a2dDrawer2D or stored in a2dCanvsObject etc.
Input and output handler for the XmlSer format.
UpdateMode
Various mode flags for Update.
virtual void SetPending(bool pending)
set this object pending for update
OVERLAP
Result of a a2dBoundingBox intersection or hittest.
int AlignmentString2TextAlignment(const wxString &alignstring)
convert a string to alignment enum
static void SetFontScaleFactor(double fontScaleFactor)
a factor to modify the internal text height, compared to the GDSII file height.
The base class for all drawable objects in a a2dCanvasDocument.
#define DECLARE_PROPERTIES()
check if class has the given id as a valid id for this object
void SetSize(double size)
Set the size.
bool GetReadOnly()
True if text is readonly.
virtual void DoLoad(wxObject *parent, a2dIOHandlerXmlSerIn &parser, a2dXmlSer_flag xmlparts)
load object specific CVG data
a2dCanvasObject is the base class for Canvas Objects.
bool GetCaretShow() const
return true if caret is visible
static a2dPropertyIdString * PROPID_PreEditText
old Text property, to return text as it was before editing (use in Undo)
double m_YcaretinLine
Y position of caret in world coordinate in line.
a2dFont GetFont() const
get font for text
void SetStyle(const wxString &style)
Set style of font, e.g. Bold.
size_t m_firsteditable
The first editable character, usually 0, but may be different for a2dVisibleProperty.
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
a2dText is an abstract base class.
wxUint16 GetTextType()
GDSII compatible to sub identify types of rectangles.
void SetName(wxString name)
Set the font name.
virtual a2dCanvasObjectList * GetAsCanvasVpaths(bool transform=true) const
when implemented the object without its children, is converted to
void SetTextType(wxUint16 type)
GDSII compatible to sub identify types of rectangles.
void SetStyle(wxString style)
Set the font style.
static a2dFont CreateFont(const a2dFontInfo &info, bool force=false)
Create the font from a fontinfo description.
void SetTextHeight(double height)
set text height in world coordinates
virtual void DoSave(wxObject *parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList *towrite)
write object specific CVGL data
general event sent from a2dHandle to its parent a2dCanvasObject
double GetLineHeight() const
Height in world coordinates of one line.
double GetLineSpacing() const
Get Space in world coordinates between two lines.
bool GetNextLineDirection() const
next line is higher in Y if true or lower if false
Input and output handler for the XmlSer format.
static const a2dCanvasObjectFlagsMask SELECTED
size_t m_selection_start_pos
Selection starting position.
double GetTextHeight() const
get text height in world coordinates
bool GetDrawFrame() const
wxUint32 a2dSnapToWhatMask
mask for a2dSnapToWhat flags
bool GetEngineeringText() const
Is text always readible from the bottom right.
virtual a2dCanvasObjectList * GetSnapVpath(a2dSnapToWhatMask snapToWhat)
return a vectorpath indicating on which point/segments the object likes to be snapped.
unsigned int GetTextFlags() const
Get the text flags.
A 2x3 affine matrix class for 2D transformations.
void SetName(const wxString &name)
Set name of font, e.g. Arial.
a2dBoundingBox m_untransbbox
Untransformed bounding box.
while iterating a a2dCanvasDocument, this holds the context.
const a2dFont * a2dDEFAULT_CANVASFONT
global a2dFont stock object for default font
void SetSize(double size)
Set size of the font.
void SetText(const wxString &text)
set the text for the object ' ' in string means new line
void SetTextFlags(unsigned int textflags)
Set the text flags.
void SetTextFlags(unsigned int textflags)
Set the text flags.
int GetCaret() const
Get position of caret (-1 means off)
wxUint16 m_texttype
GDSII compatible to sub identify types of text.
size_t m_selection_end_pos
Selection end position.
void SetWrongLoad(bool wrongLoad)
Set the flag if text couldn't be loadad from file.
bool m_utbbox_changed
Untransformed bounding box changed.
struct pres_bitflags pres_bitflags
how a GDS-II object is placed relative to its XY position.
double m_XcaretinLine
X position of caret in world coordinate in line.
A list used for enumerating fonts.
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
unsigned int m_textflags
contains several text flags.
void SetCaret(int position)
set position of caret (-1 means off)
int GetAlignment() const
Get the position of the anchor point w.r.t the text.
This template class is for property ids with a known data type.
void SetLineSpacing(double linespace)
Set Space in world coordinates between two lines.
void SetAlignment(int alignment)
Set the position of the anchor point w.r.t the text.
wxString m_text
the text to display
wxString GetText() const
get the text of the object ' ' in string means new line
CloneOptions
options for cloning
how a GDS-II object is placed relative to its XY position.
structure to give as parameter to member functions of a2dCanvasObject