Commit 422a589c authored by Claes Sjofors's avatar Claes Sjofors

Ge dynamic ScrollingText, bounce added

parent daed9044
......@@ -6604,6 +6604,11 @@ void GeScrollingText::get_attributes( attr_sItem *attrinfo, int *item_count)
attrinfo[i].type = glow_eType_Double;
attrinfo[i++].size = sizeof( speed);
strcpy( attrinfo[i].name, "ScrollingText.Bounce");
attrinfo[i].value = &bounce;
attrinfo[i].type = glow_eType_Boolean;
attrinfo[i++].size = sizeof( bounce);
*item_count = i;
}
......@@ -6631,6 +6636,7 @@ void GeScrollingText::save( ofstream& fp)
fp << int(ge_eSave_ScrollingText_attribute) << FSPACE << attribute << endl;
fp << int(ge_eSave_ScrollingText_direction) << FSPACE << int(direction) << endl;
fp << int(ge_eSave_ScrollingText_speed) << FSPACE << speed << endl;
fp << int(ge_eSave_ScrollingText_bounce) << FSPACE << bounce << endl;
fp << int(ge_eSave_End) << endl;
}
......@@ -6659,6 +6665,7 @@ void GeScrollingText::open( ifstream& fp)
break;
case ge_eSave_ScrollingText_direction: fp >> tmp; direction = (glow_eDirection)tmp; break;
case ge_eSave_ScrollingText_speed: fp >> speed; break;
case ge_eSave_ScrollingText_bounce: fp >> bounce; break;
case ge_eSave_End: end_found = 1; break;
default:
cout << "GeScrollingText:open syntax error" << endl;
......@@ -6725,29 +6732,77 @@ int GeScrollingText::scan( grow_tObject object)
switch ( direction) {
case glow_eDirection_Left: {
offset -= speed * dyn->graph->animation_scan_time;
if ( offset < -width)
offset = osize;
if ( bounce) {
if ( width < osize) {
if ( offset < 0) {
offset = -offset;
direction = glow_eDirection_Right;
}
}
else {
if ( offset < osize - width) {
offset += (osize - width) - offset;
direction = glow_eDirection_Right;
}
}
}
else {
if ( offset < -width)
offset = osize;
}
grow_SetAnnotationTextOffset( object, 1, offset, 0);
break;
}
case glow_eDirection_Right: {
offset += speed * dyn->graph->animation_scan_time;
if ( offset > osize)
offset = -width;
if ( bounce) {
if ( width < osize) {
if ( offset > osize - width) {
offset -= offset - (osize - width);
direction = glow_eDirection_Left;
}
}
else {
if ( offset > 0) {
offset = - offset;
direction = glow_eDirection_Left;
}
}
}
else {
if ( offset > osize)
offset = -width;
}
grow_SetAnnotationTextOffset( object, 1, offset, 0);
break;
}
case glow_eDirection_Up: {
offset += speed * dyn->graph->animation_scan_time;
if ( offset > osize)
offset = -height;
if ( bounce) {
if ( offset > osize - height) {
offset -= offset - (osize - height);
direction = glow_eDirection_Down;
}
}
else {
if ( offset > osize)
offset = -height;
}
grow_SetAnnotationTextOffset( object, 1, 0, offset);
break;
}
case glow_eDirection_Down: {
offset -= speed * dyn->graph->animation_scan_time;
if ( offset < -height)
offset = osize;
if ( bounce) {
if ( offset < 0) {
offset = -offset;
direction = glow_eDirection_Up;
}
}
else {
if ( offset < -height)
offset = osize;
}
grow_SetAnnotationTextOffset( object, 1, 0, offset);
break;
}
......
......@@ -554,6 +554,7 @@
ge_eSave_ScrollingText_attribute = 4200,
ge_eSave_ScrollingText_direction = 4201,
ge_eSave_ScrollingText_speed = 4202,
ge_eSave_ScrollingText_bounce = 4203,
ge_eSave_PopupMenu_ref_object = 5000,
ge_eSave_SetDig_attribute = 5100,
ge_eSave_SetDig_instance = 5101,
......@@ -1679,6 +1680,7 @@ class GeScrollingText : public GeDynElem {
pwr_tAName attribute;
glow_eDirection direction;
double speed;
int bounce;
pwr_tString256 *p;
pwr_tSubid subid;
......@@ -1692,11 +1694,11 @@ class GeScrollingText : public GeDynElem {
double tsize;
GeScrollingText( GeDyn *e_dyn) :
GeDynElem(e_dyn, ge_mDynType1_No, ge_mDynType2_ScrollingText, ge_mActionType1_No, ge_mActionType2_No, ge_eDynPrio_ScrollingText), direction(glow_eDirection_Right), speed(2), offset(0), tsize(0)
GeDynElem(e_dyn, ge_mDynType1_No, ge_mDynType2_ScrollingText, ge_mActionType1_No, ge_mActionType2_No, ge_eDynPrio_ScrollingText), direction(glow_eDirection_Right), speed(2), bounce(0), offset(0), tsize(0)
{ strcpy( attribute, "");}
GeScrollingText( const GeScrollingText& x) :
GeDynElem(x.dyn,x.dyn_type1,x.dyn_type2,x.action_type1,x.action_type2,x.prio), direction(x.direction),
speed(x.speed), offset(0), tsize(0)
speed(x.speed), bounce(x.bounce), offset(0), tsize(0)
{ strcpy( attribute, x.attribute);}
void get_attributes( attr_sItem *attrinfo, int *item_count);
void save( ofstream& fp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment