Commit 6197f6b6 authored by claes's avatar claes

Fixposition added to GrowRect and GrowPolyLine

parent dd46515c
/* /*
* Proview $Id: glow.h,v 1.22 2007-07-18 09:26:43 claes Exp $ * Proview $Id: glow.h,v 1.23 2007-09-04 07:23:06 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -1206,6 +1206,7 @@ typedef enum { ...@@ -1206,6 +1206,7 @@ typedef enum {
glow_eSave_GrowRect_disable_shadow = 1917, glow_eSave_GrowRect_disable_shadow = 1917,
glow_eSave_GrowRect_invisible = 1918, glow_eSave_GrowRect_invisible = 1918,
glow_eSave_GrowRect_fixcolor = 1919, glow_eSave_GrowRect_fixcolor = 1919,
glow_eSave_GrowRect_fixposition = 1920,
glow_eSave_GrowLine_x_right = 2000, glow_eSave_GrowLine_x_right = 2000,
glow_eSave_GrowLine_x_left = 2001, glow_eSave_GrowLine_x_left = 2001,
glow_eSave_GrowLine_y_high = 2002, glow_eSave_GrowLine_y_high = 2002,
...@@ -1324,6 +1325,7 @@ typedef enum { ...@@ -1324,6 +1325,7 @@ typedef enum {
glow_eSave_GrowPolyLine_fill_eq_light = 2619, glow_eSave_GrowPolyLine_fill_eq_light = 2619,
glow_eSave_GrowPolyLine_fill_eq_shadow = 2620, glow_eSave_GrowPolyLine_fill_eq_shadow = 2620,
glow_eSave_GrowPolyLine_fixcolor = 2621, glow_eSave_GrowPolyLine_fixcolor = 2621,
glow_eSave_GrowPolyLine_fixposition = 2622,
glow_eSave_GrowNode_node_part = 2700, glow_eSave_GrowNode_node_part = 2700,
glow_eSave_GrowNode_dynamic = 2701, glow_eSave_GrowNode_dynamic = 2701,
glow_eSave_GrowNode_dynamicsize = 2702, glow_eSave_GrowNode_dynamicsize = 2702,
......
/* /*
* Proview $Id: glow_growapi.cpp,v 1.32 2007-07-18 09:26:43 claes Exp $ * Proview $Id: glow_growapi.cpp,v 1.33 2007-09-04 07:23:06 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -1178,6 +1178,11 @@ int grow_GetObjectAttrInfo( grow_tObject object, char *transtab, ...@@ -1178,6 +1178,11 @@ int grow_GetObjectAttrInfo( grow_tObject object, char *transtab,
attrinfo[i].type = glow_eType_Boolean; attrinfo[i].type = glow_eType_Boolean;
attrinfo[i++].size = sizeof( op->disable_shadow); attrinfo[i++].size = sizeof( op->disable_shadow);
strcpy( attrinfo[i].name, "fixposition");
attrinfo[i].value_p = &op->fixposition;
attrinfo[i].type = glow_eType_Boolean;
attrinfo[i++].size = sizeof( op->fixposition);
strcpy( attrinfo[i].name, "Dynamic"); strcpy( attrinfo[i].name, "Dynamic");
op->get_dynamic( &dynamic, &dynsize); op->get_dynamic( &dynamic, &dynsize);
attrinfo[i].value_p = malloc( 1024); attrinfo[i].value_p = malloc( 1024);
...@@ -1289,6 +1294,11 @@ int grow_GetObjectAttrInfo( grow_tObject object, char *transtab, ...@@ -1289,6 +1294,11 @@ int grow_GetObjectAttrInfo( grow_tObject object, char *transtab,
attrinfo[i].type = glow_eType_Boolean; attrinfo[i].type = glow_eType_Boolean;
attrinfo[i++].size = sizeof( op->fixcolor); attrinfo[i++].size = sizeof( op->fixcolor);
strcpy( attrinfo[i].name, "fixposition");
attrinfo[i].value_p = &op->fixposition;
attrinfo[i].type = glow_eType_Boolean;
attrinfo[i++].size = sizeof( op->fixposition);
strcpy( attrinfo[i].name, "Dynamic"); strcpy( attrinfo[i].name, "Dynamic");
op->get_dynamic( &dynamic, &dynsize); op->get_dynamic( &dynamic, &dynsize);
attrinfo[i].value_p = malloc( 1024); attrinfo[i].value_p = malloc( 1024);
......
/* /*
* Proview $Id: glow_growpolyline.cpp,v 1.6 2007-06-15 11:33:55 claes Exp $ * Proview $Id: glow_growpolyline.cpp,v 1.7 2007-09-04 07:23:06 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -43,7 +43,8 @@ GrowPolyLine::GrowPolyLine( GrowCtx *glow_ctx, char *name, ...@@ -43,7 +43,8 @@ GrowPolyLine::GrowPolyLine( GrowCtx *glow_ctx, char *name,
original_fill_drawtype(fill_d_type), fill_drawtype(fill_d_type), original_fill_drawtype(fill_d_type), fill_drawtype(fill_d_type),
border(display_border), fill_eq_border(0), current_point(0), border(display_border), fill_eq_border(0), current_point(0),
shadow(display_shadow), shadow_width(5), relief(glow_eRelief_Up), shadow(display_shadow), shadow_width(5), relief(glow_eRelief_Up),
shadow_contrast(2), disable_shadow(0), fill_eq_light(0), fill_eq_shadow(0), fixcolor(0) shadow_contrast(2), disable_shadow(0), fill_eq_light(0),
fill_eq_shadow(0), fixcolor(0), fixposition(0)
{ {
strcpy( n_name, name); strcpy( n_name, name);
pzero.nav_zoom(); pzero.nav_zoom();
...@@ -463,6 +464,8 @@ void GrowPolyLine::erase( GlowWind *w, GlowTransform *t, int hot, void *node) ...@@ -463,6 +464,8 @@ void GrowPolyLine::erase( GlowWind *w, GlowTransform *t, int hot, void *node)
void GrowPolyLine::move( double delta_x, double delta_y, int grid) void GrowPolyLine::move( double delta_x, double delta_y, int grid)
{ {
if ( fixposition)
return;
ctx->set_defered_redraw(); ctx->set_defered_redraw();
ctx->draw( &ctx->mw, x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - 2*DRAW_MP, ctx->draw( &ctx->mw, x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - 2*DRAW_MP,
y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - 2*DRAW_MP, y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - 2*DRAW_MP,
...@@ -585,8 +588,10 @@ GrowPolyLine::~GrowPolyLine() ...@@ -585,8 +588,10 @@ GrowPolyLine::~GrowPolyLine()
void GrowPolyLine::move_noerase( int delta_x, int delta_y, int grid) void GrowPolyLine::move_noerase( int delta_x, int delta_y, int grid)
{ {
if ( grid) if ( fixposition)
{ return;
if ( grid) {
double x_grid, y_grid; double x_grid, y_grid;
/* Move to closest grid point */ /* Move to closest grid point */
...@@ -595,8 +600,7 @@ void GrowPolyLine::move_noerase( int delta_x, int delta_y, int grid) ...@@ -595,8 +600,7 @@ void GrowPolyLine::move_noerase( int delta_x, int delta_y, int grid)
trf.move( x_grid - x_left, y_grid - y_low); trf.move( x_grid - x_left, y_grid - y_low);
get_node_borders(); get_node_borders();
} }
else else {
{
double dx, dy; double dx, dy;
dx = double( delta_x) / ctx->mw.zoom_factor_x; dx = double( delta_x) / ctx->mw.zoom_factor_x;
...@@ -811,6 +815,7 @@ void GrowPolyLine::save( ofstream& fp, glow_eSaveMode mode) ...@@ -811,6 +815,7 @@ void GrowPolyLine::save( ofstream& fp, glow_eSaveMode mode)
fp << int(glow_eSave_GrowPolyLine_fill_eq_light) << FSPACE << fill_eq_light << endl; fp << int(glow_eSave_GrowPolyLine_fill_eq_light) << FSPACE << fill_eq_light << endl;
fp << int(glow_eSave_GrowPolyLine_fill_eq_shadow) << FSPACE << fill_eq_shadow << endl; fp << int(glow_eSave_GrowPolyLine_fill_eq_shadow) << FSPACE << fill_eq_shadow << endl;
fp << int(glow_eSave_GrowPolyLine_fixcolor) << FSPACE << fixcolor << endl; fp << int(glow_eSave_GrowPolyLine_fixcolor) << FSPACE << fixcolor << endl;
fp << int(glow_eSave_GrowPolyLine_fixposition) << FSPACE << fixposition << endl;
fp << int(glow_eSave_End) << endl; fp << int(glow_eSave_End) << endl;
} }
...@@ -881,6 +886,7 @@ void GrowPolyLine::open( ifstream& fp) ...@@ -881,6 +886,7 @@ void GrowPolyLine::open( ifstream& fp)
case glow_eSave_GrowPolyLine_fill_eq_light: fp >> fill_eq_light; break; case glow_eSave_GrowPolyLine_fill_eq_light: fp >> fill_eq_light; break;
case glow_eSave_GrowPolyLine_fill_eq_shadow: fp >> fill_eq_shadow; break; case glow_eSave_GrowPolyLine_fill_eq_shadow: fp >> fill_eq_shadow; break;
case glow_eSave_GrowPolyLine_fixcolor: fp >> fixcolor; break; case glow_eSave_GrowPolyLine_fixcolor: fp >> fixcolor; break;
case glow_eSave_GrowPolyLine_fixposition: fp >> fixposition; break;
case glow_eSave_End: end_found = 1; break; case glow_eSave_End: end_found = 1; break;
default: default:
cout << "GrowPolyLine:open syntax error" << endl; cout << "GrowPolyLine:open syntax error" << endl;
...@@ -1329,51 +1335,53 @@ void GrowPolyLine::add_and_shift_y_value_filled( double value) ...@@ -1329,51 +1335,53 @@ void GrowPolyLine::add_and_shift_y_value_filled( double value)
void GrowPolyLine::align( double x, double y, glow_eAlignDirection direction) void GrowPolyLine::align( double x, double y, glow_eAlignDirection direction)
{ {
double dx, dy; double dx, dy;
erase( &ctx->mw); if ( fixposition)
erase( &ctx->navw); return;
ctx->set_defered_redraw();
draw();
switch ( direction)
{
case glow_eAlignDirection_CenterVert:
dx = x - (x_right + x_left) / 2;
dy = 0;
break;
case glow_eAlignDirection_CenterHoriz:
dx = 0;
dy = y - (y_high + y_low) / 2;
break;
case glow_eAlignDirection_CenterCenter:
dx = x - (x_right + x_left) / 2;
dy = y - (y_high + y_low) / 2;
break;
case glow_eAlignDirection_Right:
dx = x - x_right;
dy = 0;
break;
case glow_eAlignDirection_Left:
dx = x - x_left;
dy = 0;
break;
case glow_eAlignDirection_Up:
dx = 0;
dy = y - y_high;
break;
case glow_eAlignDirection_Down:
dx = 0;
dy = y - y_low;
break;
}
trf.move( dx, dy);
x_right += dx;
x_left += dx;
y_high += dy;
y_low += dy;
draw(); erase( &ctx->mw);
ctx->redraw_defered(); erase( &ctx->navw);
ctx->set_defered_redraw();
draw();
switch ( direction) {
case glow_eAlignDirection_CenterVert:
dx = x - (x_right + x_left) / 2;
dy = 0;
break;
case glow_eAlignDirection_CenterHoriz:
dx = 0;
dy = y - (y_high + y_low) / 2;
break;
case glow_eAlignDirection_CenterCenter:
dx = x - (x_right + x_left) / 2;
dy = y - (y_high + y_low) / 2;
break;
case glow_eAlignDirection_Right:
dx = x - x_right;
dy = 0;
break;
case glow_eAlignDirection_Left:
dx = x - x_left;
dy = 0;
break;
case glow_eAlignDirection_Up:
dx = 0;
dy = y - y_high;
break;
case glow_eAlignDirection_Down:
dx = 0;
dy = y - y_low;
break;
}
trf.move( dx, dy);
x_right += dx;
x_left += dx;
y_high += dy;
y_low += dy;
draw();
ctx->redraw_defered();
} }
......
/* /*
* Proview $Id: glow_growpolyline.h,v 1.6 2007-06-15 11:33:55 claes Exp $ * Proview $Id: glow_growpolyline.h,v 1.7 2007-09-04 07:23:06 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -357,6 +357,7 @@ class GrowPolyLine : public GlowPolyLine { ...@@ -357,6 +357,7 @@ class GrowPolyLine : public GlowPolyLine {
int fill_eq_light; //!< Fill is drawn with light shadow color. int fill_eq_light; //!< Fill is drawn with light shadow color.
int fill_eq_shadow; //!< Fill is drawn with dark shadow color. int fill_eq_shadow; //!< Fill is drawn with dark shadow color.
int fixcolor; //!< Color independent of node color. int fixcolor; //!< Color independent of node color.
int fixposition; //!< Can't be moved.
//! Set user data. //! Set user data.
/*! /*!
......
/* /*
* Proview $Id: glow_growrect.cpp,v 1.9 2007-07-04 13:29:54 claes Exp $ * Proview $Id: glow_growrect.cpp,v 1.10 2007-09-04 07:23:06 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -40,7 +40,7 @@ GrowRect::GrowRect( GrowCtx *glow_ctx, char *name, double x, double y, ...@@ -40,7 +40,7 @@ GrowRect::GrowRect( GrowCtx *glow_ctx, char *name, double x, double y,
original_fill_drawtype(fill_d_type), fill_drawtype(fill_d_type), original_fill_drawtype(fill_d_type), fill_drawtype(fill_d_type),
border(display_border), border(display_border),
dynamic(0), dynamicsize(0), shadow(display_shadow), shadow_width(5), relief(glow_eRelief_Up), dynamic(0), dynamicsize(0), shadow(display_shadow), shadow_width(5), relief(glow_eRelief_Up),
shadow_contrast(2), disable_shadow(0), invisible(0), fixcolor(0) shadow_contrast(2), disable_shadow(0), invisible(0), fixcolor(0), fixposition(0)
{ {
strcpy( n_name, name); strcpy( n_name, name);
pzero.nav_zoom(); pzero.nav_zoom();
...@@ -82,6 +82,8 @@ GrowRect::~GrowRect() ...@@ -82,6 +82,8 @@ GrowRect::~GrowRect()
void GrowRect::move( double delta_x, double delta_y, int grid) void GrowRect::move( double delta_x, double delta_y, int grid)
{ {
if ( fixposition)
return;
ctx->set_defered_redraw(); ctx->set_defered_redraw();
ctx->draw( &ctx->mw, x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - DRAW_MP, ctx->draw( &ctx->mw, x_left * ctx->mw.zoom_factor_x - ctx->mw.offset_x - DRAW_MP,
y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - DRAW_MP, y_low * ctx->mw.zoom_factor_y - ctx->mw.offset_y - DRAW_MP,
...@@ -127,6 +129,8 @@ void GrowRect::move( double delta_x, double delta_y, int grid) ...@@ -127,6 +129,8 @@ void GrowRect::move( double delta_x, double delta_y, int grid)
void GrowRect::move_noerase( int delta_x, int delta_y, int grid) void GrowRect::move_noerase( int delta_x, int delta_y, int grid)
{ {
if ( fixposition)
return;
if ( grid) if ( grid)
{ {
double x_grid, y_grid; double x_grid, y_grid;
...@@ -278,6 +282,7 @@ void GrowRect::save( ofstream& fp, glow_eSaveMode mode) ...@@ -278,6 +282,7 @@ void GrowRect::save( ofstream& fp, glow_eSaveMode mode)
fp << int(glow_eSave_GrowRect_relief) << FSPACE << int(relief) << endl; fp << int(glow_eSave_GrowRect_relief) << FSPACE << int(relief) << endl;
fp << int(glow_eSave_GrowRect_invisible) << FSPACE << invisible << endl; fp << int(glow_eSave_GrowRect_invisible) << FSPACE << invisible << endl;
fp << int(glow_eSave_GrowRect_fixcolor) << FSPACE << fixcolor << endl; fp << int(glow_eSave_GrowRect_fixcolor) << FSPACE << fixcolor << endl;
fp << int(glow_eSave_GrowRect_fixposition) << FSPACE << fixposition << endl;
fp << int(glow_eSave_GrowRect_disable_shadow) << FSPACE << disable_shadow << endl; fp << int(glow_eSave_GrowRect_disable_shadow) << FSPACE << disable_shadow << endl;
fp << int(glow_eSave_GrowRect_dynamicsize) << FSPACE << dynamicsize << endl; fp << int(glow_eSave_GrowRect_dynamicsize) << FSPACE << dynamicsize << endl;
fp << int(glow_eSave_GrowRect_dynamic) << endl; fp << int(glow_eSave_GrowRect_dynamic) << endl;
...@@ -335,6 +340,7 @@ void GrowRect::open( ifstream& fp) ...@@ -335,6 +340,7 @@ void GrowRect::open( ifstream& fp)
case glow_eSave_GrowRect_disable_shadow: fp >> disable_shadow; break; case glow_eSave_GrowRect_disable_shadow: fp >> disable_shadow; break;
case glow_eSave_GrowRect_invisible: fp >> invisible; break; case glow_eSave_GrowRect_invisible: fp >> invisible; break;
case glow_eSave_GrowRect_fixcolor: fp >> fixcolor; break; case glow_eSave_GrowRect_fixcolor: fp >> fixcolor; break;
case glow_eSave_GrowRect_fixposition: fp >> fixposition; break;
case glow_eSave_GrowRect_dynamicsize: fp >> dynamicsize; break; case glow_eSave_GrowRect_dynamicsize: fp >> dynamicsize; break;
case glow_eSave_GrowRect_dynamic: case glow_eSave_GrowRect_dynamic:
fp.getline( dummy, sizeof(dummy)); fp.getline( dummy, sizeof(dummy));
...@@ -938,6 +944,9 @@ void GrowRect::align( double x, double y, glow_eAlignDirection direction) ...@@ -938,6 +944,9 @@ void GrowRect::align( double x, double y, glow_eAlignDirection direction)
{ {
double dx, dy; double dx, dy;
if ( fixposition)
return;
erase( &ctx->mw); erase( &ctx->mw);
erase( &ctx->navw); erase( &ctx->navw);
ctx->set_defered_redraw(); ctx->set_defered_redraw();
......
/* /*
* Proview $Id: glow_growrect.h,v 1.7 2007-01-04 07:57:39 claes Exp $ * Proview $Id: glow_growrect.h,v 1.8 2007-09-04 07:23:06 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -285,6 +285,7 @@ class GrowRect : public GlowRect { ...@@ -285,6 +285,7 @@ class GrowRect : public GlowRect {
int disable_shadow; //!< Disable shadow, even if parent node has shadow. int disable_shadow; //!< Disable shadow, even if parent node has shadow.
int invisible; //!< Invisible if not highlighted. int invisible; //!< Invisible if not highlighted.
int fixcolor; //!< Color independent of node color. int fixcolor; //!< Color independent of node color.
int fixposition; //!< Can't be moved.
//! Set user data. //! Set user data.
/*! /*!
......
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