Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

[[ Bug 13085 ]] Add field equivalents of some paragraph properties #7195

Open
wants to merge 1 commit into
base: develop
Choose a base branch
Loading
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions 7 docs/dictionary/property/leftIndent.lcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name: leftIndent

Type: property

Syntax: set the leftIndent of <line> of <field> to <pixels>
Syntax: set the leftIndent [of <line>] of <field> to <pixels>

Summary:
Determines the indentation of a paragraph in a <field>.
Expand All @@ -15,6 +15,9 @@ OS: mac, windows, linux, ios, android

Platforms: desktop, server, mobile

Example:
set the leftIndent of field 1 to 10

Example:
set the leftIndent of line 1 of field 1 to 15

Expand All @@ -23,7 +26,7 @@ pixels (integer):
The number of pixels to indent the left of a paragraph of text.

Value:
The <leftIndent> of a line of text in a field returns an integer.
The <leftIndent> of a field or line of text in a field returns an integer.

Description:
Use the <leftIndent> property to indent the left side of whole
Expand Down
7 changes: 5 additions & 2 deletions 7 docs/dictionary/property/rightIndent.lcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name: rightIndent

Type: property

Syntax: set the rightIndent of <line> of <field> to <pixels>
Syntax: set the rightIndent [of <line>] of <field> to <pixels>

Summary:
Determines the indentation of a paragraph in a <field>.
Expand All @@ -15,6 +15,9 @@ OS: mac, windows, linux, ios, android

Platforms: desktop, server, mobile

Example:
set the rightIndent of field 1 to 10

Example:
set the rightIndent of line 1 of field 1 to 15

Expand All @@ -23,7 +26,7 @@ pixels (integer):
The number of pixels to indent the right of a paragraph of text.

Value:
The <rightIndent> of a line of text in a field returns an integer.
The <rightIndent> of a field or line of text in a field returns an integer.

Description:
Use the <rightIndent> property to indent the right side of whole
Expand Down
7 changes: 5 additions & 2 deletions 7 docs/dictionary/property/spaceAbove.lcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name: spaceAbove

Type: property

Syntax: set the spaceAbove of <line> of <field> to <pixels>
Syntax: set the spaceAbove [of <line>] of <field> to <pixels>

Summary:
Determines the space above a paragraph in a field.
Expand All @@ -15,6 +15,9 @@ OS: mac, windows, linux, ios, android

Platforms: desktop, server, mobile

Example:
set the spaceAbove of field 1 to 10

Example:
set the spaceAbove of line 1 of field 1 to 20

Expand All @@ -23,7 +26,7 @@ pixels (integer):
The number of pixels of space above the paragraph.

Value:
The <spaceAbove> of a line of text in a field returns an integer.
The <spaceAbove> of a field or line of text in a field returns an integer.

Description:
Use the <spaceAbove> property to specify the amount of space above a
Expand Down
7 changes: 5 additions & 2 deletions 7 docs/dictionary/property/spaceBelow.lcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Name: spaceBelow

Type: property

Syntax: set the spaceBelow of <line> of <field> to <pixels>
Syntax: set the spaceBelow [of <line>] of <field> to <pixels>

Summary:
Determines the space below a paragraph in a field.
Expand All @@ -15,6 +15,9 @@ OS: mac, windows, linux, ios, android

Platforms: desktop, server, mobile

Example:
set the spaceBelow of field 1 to 10

Example:
set the spaceBelow of line 1 of field 1 to 20

Expand All @@ -23,7 +26,7 @@ pixels (integer):
The number of pixels of space below the paragraph.

Value:
The <spaceBelow> of a line of text in a field returns an integer.
The <spaceBelow> of a field or line of text in a field returns an integer.

Description:
Use the <spaceBelow> property to specify the amount of space below a
Expand Down
1 change: 1 addition & 0 deletions 1 docs/notes/bugfix-13085.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# The paragraph properties `leftIndent`, `rightIndent`, `spaceAbove` and `spaceBelow` can now be set for the entire field
46 changes: 45 additions & 1 deletion 46 engine/src/exec-interface-field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,51 @@ void MCField::GetFirstIndent(MCExecContext& ctxt, integer_t& r_indent)
void MCField::SetFirstIndent(MCExecContext& ctxt, integer_t p_indent)
{
indent = p_indent;
Redraw();
Redraw(true);
}

void MCField::GetLeftIndent(MCExecContext& ctxt, integer_t& r_indent)
{
r_indent = leftindent;
}

void MCField::SetLeftIndent(MCExecContext& ctxt, integer_t p_indent)
{
leftindent = p_indent;
Redraw(true);
}

void MCField::GetRightIndent(MCExecContext& ctxt, integer_t& r_indent)
{
r_indent = rightindent;
}

void MCField::SetRightIndent(MCExecContext& ctxt, integer_t p_indent)
{
rightindent = p_indent;
Redraw(true);
}

void MCField::GetSpaceAbove(MCExecContext& ctxt, integer_t& r_above)
{
r_above = spaceabove;
}

void MCField::SetSpaceAbove(MCExecContext& ctxt, integer_t p_above)
{
spaceabove = p_above;
Redraw();
}

void MCField::GetSpaceBelow(MCExecContext& ctxt, integer_t& r_below)
{
r_below = spacebelow;
}

void MCField::SetSpaceBelow(MCExecContext& ctxt, integer_t p_below)
{
spacebelow = p_below;
Redraw();
}

void MCField::GetWideMargins(MCExecContext& ctxt, bool& r_setting)
Expand Down
114 changes: 109 additions & 5 deletions 114 engine/src/field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ MCPropertyInfo MCField::kProperties[] =
DEFINE_RW_OBJ_PROPERTY(P_AUTO_HILITE, Bool, MCField, AutoHilite)
DEFINE_RW_OBJ_PROPERTY(P_AUTO_ARM, Bool, MCField, AutoArm)
DEFINE_RW_OBJ_PROPERTY(P_FIRST_INDENT, Int16, MCField, FirstIndent)
DEFINE_RW_OBJ_PROPERTY(P_WIDE_MARGINS, Bool, MCField, WideMargins)
DEFINE_RW_OBJ_PROPERTY(P_LEFT_INDENT, Int16, MCField, LeftIndent)
DEFINE_RW_OBJ_PROPERTY(P_RIGHT_INDENT, Int16, MCField, RightIndent)
DEFINE_RW_OBJ_PROPERTY(P_SPACE_ABOVE, Int16, MCField, SpaceAbove)
DEFINE_RW_OBJ_PROPERTY(P_SPACE_BELOW, Int16, MCField, SpaceBelow)
DEFINE_RW_OBJ_PROPERTY(P_WIDE_MARGINS, Bool, MCField, WideMargins)
DEFINE_RW_OBJ_PROPERTY(P_HSCROLL, Int32, MCField, HScroll)
DEFINE_RW_OBJ_PROPERTY(P_VSCROLL, Int32, MCField, VScroll)
DEFINE_RW_OBJ_PROPERTY(P_HSCROLLBAR, Bool, MCField, HScrollbar)
Expand Down Expand Up @@ -245,7 +249,11 @@ MCField::MCField()
fixeda = fixedd = fixedheight = 0;
leftmargin = rightmargin = topmargin = bottommargin = narrowmargin;
indent = 0;
cury = focusedy = firsty = topmargin;
leftindent = 0;
rightindent = 0;
spaceabove = 0;
spacebelow = 0;
cury = focusedy = firsty = topmargin;
firstparagraph = lastparagraph = NULL;
foundlength = 0;
vscrollbar = hscrollbar = NULL;
Expand Down Expand Up @@ -274,7 +282,11 @@ MCField::MCField(const MCField &fref) : MCControl(fref)
textheight = textwidth = 0;
fixeda = fixedd = fixedheight = 0;
indent = fref.indent;
cury = focusedy = firsty = topmargin;
leftindent = fref.leftindent;
rightindent = fref.rightindent;
spaceabove = fref.spaceabove;
spacebelow = fref.spacebelow;
cury = focusedy = firsty = topmargin;
firstparagraph = lastparagraph = NULL;
foundlength = 0;
cursor_movement = fref.cursor_movement;
Expand Down Expand Up @@ -2570,7 +2582,11 @@ void MCField::draw(MCDC *dc, const MCRectangle& p_dirty, bool p_isolated, bool p
// SN-2015-04-30: [[ Bug 15175 ]] TabAlignment flag added
#define FIELD_EXTRA_TABALIGN (1 << 1)
#define FIELD_EXTRA_KEYBOARDTYPE (1 << 2)
#define FIELD_EXTRA_RETURNKEYTYPE (1 << 3)
#define FIELD_EXTRA_RETURNKEYTYPE (1 << 3)
#define FIELD_EXTRA_LEFTINDENT (1 << 4)
#define FIELD_EXTRA_RIGHTINDENT (1 << 5)
#define FIELD_EXTRA_SPACEABOVE (1 << 6)
#define FIELD_EXTRA_SPACEBELOW (1 << 7)

IO_stat MCField::extendedsave(MCObjectOutputStream& p_stream, uint4 p_part, uint32_t p_version)
{
Expand Down Expand Up @@ -2605,6 +2621,30 @@ IO_stat MCField::extendedsave(MCObjectOutputStream& p_stream, uint4 p_part, uint
t_flags |= FIELD_EXTRA_RETURNKEYTYPE;
t_size += sizeof(int8_t);
}

if (leftindent != 0)
{
t_flags |= FIELD_EXTRA_LEFTINDENT;
t_size += sizeof(uint16_t);
}

if (rightindent != 0)
{
t_flags |= FIELD_EXTRA_RIGHTINDENT;
t_size += sizeof(uint16_t);
}

if (spaceabove != 0)
{
t_flags |= FIELD_EXTRA_SPACEABOVE;
t_size += sizeof(uint16_t);
}

if (spacebelow != 0)
{
t_flags |= FIELD_EXTRA_SPACEBELOW;
t_size += sizeof(uint16_t);
}

IO_stat t_stat;
t_stat = p_stream . WriteTag(t_flags, t_size);
Expand All @@ -2630,6 +2670,26 @@ IO_stat MCField::extendedsave(MCObjectOutputStream& p_stream, uint4 p_part, uint
t_stat = p_stream . WriteS8((int8_t)return_key_type);
}

if (t_stat == IO_NORMAL && (t_flags & FIELD_EXTRA_LEFTINDENT))
{
t_stat = p_stream . WriteU16(leftindent);
}

if (t_stat == IO_NORMAL && (t_flags & FIELD_EXTRA_RIGHTINDENT))
{
t_stat = p_stream . WriteU16(rightindent);
}

if (t_stat == IO_NORMAL && (t_flags & FIELD_EXTRA_SPACEABOVE))
{
t_stat = p_stream . WriteU16(spaceabove);
}

if (t_stat == IO_NORMAL && (t_flags & FIELD_EXTRA_SPACEBELOW))
{
t_stat = p_stream . WriteU16(spacebelow);
}

if (t_stat == IO_NORMAL)
t_stat = MCObject::extendedsave(p_stream, p_part, p_version);

Expand Down Expand Up @@ -2709,6 +2769,46 @@ IO_stat MCField::extendedload(MCObjectInputStream& p_stream, uint32_t p_version,
}
}

if (t_stat == IO_NORMAL && (t_flags & FIELD_EXTRA_LEFTINDENT) != 0)
{
uint16_t t_value;
t_stat = checkloadstat(p_stream . ReadU16(t_value));
if (t_stat == IO_NORMAL)
{
leftindent = t_value;
}
}

if (t_stat == IO_NORMAL && (t_flags & FIELD_EXTRA_RIGHTINDENT) != 0)
{
uint16_t t_value;
t_stat = checkloadstat(p_stream . ReadU16(t_value));
if (t_stat == IO_NORMAL)
{
rightindent = t_value;
}
}

if (t_stat == IO_NORMAL && (t_flags & FIELD_EXTRA_SPACEABOVE) != 0)
{
uint16_t t_value;
t_stat = checkloadstat(p_stream . ReadU16(t_value));
if (t_stat == IO_NORMAL)
{
spaceabove = t_value;
}
}

if (t_stat == IO_NORMAL && (t_flags & FIELD_EXTRA_SPACEBELOW) != 0)
{
uint16_t t_value;
t_stat = checkloadstat(p_stream . ReadU16(t_value));
if (t_stat == IO_NORMAL)
{
spacebelow = t_value;
}
}

if (t_stat == IO_NORMAL)
t_stat = checkloadstat(p_stream . Skip(t_length));

Expand Down Expand Up @@ -2737,7 +2837,11 @@ IO_stat MCField::save(IO_handle stream, uint4 p_part, bool p_force_ext, uint32_t
t_has_extension = text_direction != kMCTextDirectionAuto ||
nalignments != 0 ||
keyboard_type != kMCInterfaceKeyboardTypeNone ||
return_key_type != kMCInterfaceReturnKeyTypeNone;
return_key_type != kMCInterfaceReturnKeyTypeNone ||
leftindent != 0 ||
rightindent != 0 ||
spaceabove != 0 ||
spacebelow != 0;

if ((stat = MCObject::save(stream, p_part, t_has_extension || p_force_ext, p_version)) != IO_NORMAL)
return stat;
Expand Down
22 changes: 19 additions & 3 deletions 22 engine/src/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ class MCField : public MCControl, public MCMixinObjectHandle<MCField>
uint4 textheight;
uint2 textwidth;
int2 indent;
uint2 fixeda;
uint16_t leftindent;
uint16_t rightindent;
uint16_t spaceabove;
uint16_t spacebelow;
uint2 fixeda;
uint2 fixedd;
uint2 fixedheight;
findex_t foundlength;
Expand Down Expand Up @@ -372,7 +376,11 @@ class MCField : public MCControl, public MCMixinObjectHandle<MCField>
int32_t getcontenty(void) const;
int32_t gettexty(void) const;
int32_t getfirstindent(void) const;
int32_t getfixedheight(void) const { return fixedheight; }
int32_t getleftindent(void) const;
int32_t getrightindent(void) const;
int32_t getspaceabove(void) const;
int32_t getspacebelow(void) const;
int32_t getfixedheight(void) const { return fixedheight; }

MCTextDirection gettextdirection() const { return text_direction; }

Expand Down Expand Up @@ -658,7 +666,15 @@ class MCField : public MCControl, public MCMixinObjectHandle<MCField>
void SetAutoArm(MCExecContext& ctxt, bool setting);
void GetFirstIndent(MCExecContext& ctxt, integer_t& r_indent);
void SetFirstIndent(MCExecContext& ctxt, integer_t indent);
void GetWideMargins(MCExecContext& ctxt, bool& r_setting);
void GetLeftIndent(MCExecContext& ctxt, integer_t& r_indent);
void SetLeftIndent(MCExecContext& ctxt, integer_t indent);
void GetRightIndent(MCExecContext& ctxt, integer_t& r_indent);
void SetRightIndent(MCExecContext& ctxt, integer_t indent);
void GetSpaceAbove(MCExecContext& ctxt, integer_t& r_above);
void SetSpaceAbove(MCExecContext& ctxt, integer_t above);
void GetSpaceBelow(MCExecContext& ctxt, integer_t& r_below);
void SetSpaceBelow(MCExecContext& ctxt, integer_t below);
void GetWideMargins(MCExecContext& ctxt, bool& r_setting);
void SetWideMargins(MCExecContext& ctxt, bool setting);
void GetHScroll(MCExecContext& ctxt, integer_t& r_scroll);
void SetHScroll(MCExecContext& ctxt, integer_t scroll);
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.