Commit efa52ba1 authored by claes's avatar claes

Bugfix in objecteditor for casted attribute objects, and new pixmap for plcpgm

parent be1c37a7
...@@ -66,7 +66,6 @@ ItemObject::ItemObject( XNavBrow *brow, pwr_tObjid item_objid, ...@@ -66,7 +66,6 @@ ItemObject::ItemObject( XNavBrow *brow, pwr_tObjid item_objid,
int sts; int sts;
char segname[120]; char segname[120];
pwr_tObjid child; pwr_tObjid child;
pwr_tClassId classid;
char descr[80]; char descr[80];
type = xnav_eItemType_Object; type = xnav_eItemType_Object;
...@@ -87,19 +86,24 @@ ItemObject::ItemObject( XNavBrow *brow, pwr_tObjid item_objid, ...@@ -87,19 +86,24 @@ ItemObject::ItemObject( XNavBrow *brow, pwr_tObjid item_objid,
} }
if ( EVEN(sts)) throw co_error(sts); if ( EVEN(sts)) throw co_error(sts);
sts = gdh_GetObjectClass( objid, &cid);
if ( EVEN(sts)) throw co_error(sts);
// Set pixmap // Set pixmap
sts = gdh_GetChild( objid, &child); sts = gdh_GetChild( objid, &child);
if( ODD(sts)) if( ODD(sts)) {
brow_SetAnnotPixmap( node, 0, brow->pixmap_map); if ( cid == pwr_cClass_plc)
brow_SetAnnotPixmap( node, 0, brow->pixmap_plcpgm);
else
brow_SetAnnotPixmap( node, 0, brow->pixmap_map);
}
else else
brow_SetAnnotPixmap( node, 0, brow->pixmap_leaf); brow_SetAnnotPixmap( node, 0, brow->pixmap_leaf);
// Set object name annotation // Set object name annotation
brow_SetAnnotation( node, 0, segname, strlen(segname)); brow_SetAnnotation( node, 0, segname, strlen(segname));
// Set class annotation // Set class annotation
sts = gdh_GetObjectClass( objid, &classid); sts = gdh_ObjidToName( cdh_ClassIdToObjid( cid),
if ( EVEN(sts)) throw co_error(sts);
sts = gdh_ObjidToName( cdh_ClassIdToObjid( classid),
segname, sizeof(segname), cdh_mName_object); segname, sizeof(segname), cdh_mName_object);
if ( EVEN(sts)) throw co_error(sts); if ( EVEN(sts)) throw co_error(sts);
brow_SetAnnotation( node, 1, segname, strlen(segname)); brow_SetAnnotation( node, 1, segname, strlen(segname));
...@@ -155,8 +159,12 @@ int ItemBaseObject::open_children( XNavBrow *brow, double x, double y) ...@@ -155,8 +159,12 @@ int ItemBaseObject::open_children( XNavBrow *brow, double x, double y)
brow_CloseNode( brow->ctx, node); brow_CloseNode( brow->ctx, node);
if ( brow_IsOpen( node) & xnav_mOpen_Attributes) if ( brow_IsOpen( node) & xnav_mOpen_Attributes)
brow_RemoveAnnotPixmap( node, 1); brow_RemoveAnnotPixmap( node, 1);
if ( brow_IsOpen( node) & xnav_mOpen_Children) if ( brow_IsOpen( node) & xnav_mOpen_Children) {
brow_SetAnnotPixmap( node, 0, brow->pixmap_map); if ( cid == pwr_cClass_plc)
brow_SetAnnotPixmap( node, 0, brow->pixmap_plcpgm);
else
brow_SetAnnotPixmap( node, 0, brow->pixmap_map);
}
brow_ResetOpen( node, xnav_mOpen_All); brow_ResetOpen( node, xnav_mOpen_All);
brow_ResetNodraw( brow->ctx); brow_ResetNodraw( brow->ctx);
brow_Redraw( brow->ctx, node_y); brow_Redraw( brow->ctx, node_y);
...@@ -280,7 +288,10 @@ int ItemBaseObject::open_attributes( XNavBrow *brow, double x, double y) ...@@ -280,7 +288,10 @@ int ItemBaseObject::open_attributes( XNavBrow *brow, double x, double y)
brow_CloseNode( brow->ctx, node); brow_CloseNode( brow->ctx, node);
brow_ResetOpen( node, xnav_mOpen_Children); brow_ResetOpen( node, xnav_mOpen_Children);
brow_ResetOpen( node, xnav_mOpen_Crossref); brow_ResetOpen( node, xnav_mOpen_Crossref);
brow_SetAnnotPixmap( node, 0, brow->pixmap_map); if ( cid == pwr_cClass_plc)
brow_SetAnnotPixmap( node, 0, brow->pixmap_plcpgm);
else
brow_SetAnnotPixmap( node, 0, brow->pixmap_map);
brow_ResetNodraw( brow->ctx); brow_ResetNodraw( brow->ctx);
brow_Redraw( brow->ctx, node_y); brow_Redraw( brow->ctx, node_y);
} }
...@@ -450,8 +461,12 @@ int ItemBaseObject::open_crossref( XNavBrow *brow, double x, double y) ...@@ -450,8 +461,12 @@ int ItemBaseObject::open_crossref( XNavBrow *brow, double x, double y)
brow_CloseNode( brow->ctx, node); brow_CloseNode( brow->ctx, node);
if ( brow_IsOpen( node) & xnav_mOpen_Attributes) if ( brow_IsOpen( node) & xnav_mOpen_Attributes)
brow_RemoveAnnotPixmap( node, 1); brow_RemoveAnnotPixmap( node, 1);
if ( brow_IsOpen( node) & xnav_mOpen_Children) if ( brow_IsOpen( node) & xnav_mOpen_Children) {
brow_SetAnnotPixmap( node, 0, brow->pixmap_map); if ( cid == pwr_cClass_plc)
brow_SetAnnotPixmap( node, 0, brow->pixmap_plcpgm);
else
brow_SetAnnotPixmap( node, 0, brow->pixmap_map);
}
brow_ResetOpen( node, xnav_mOpen_All); brow_ResetOpen( node, xnav_mOpen_All);
brow_ResetNodraw( brow->ctx); brow_ResetNodraw( brow->ctx);
brow_Redraw( brow->ctx, node_y); brow_Redraw( brow->ctx, node_y);
...@@ -514,8 +529,12 @@ void ItemBaseObject::close( XNavBrow *brow, double x, double y) ...@@ -514,8 +529,12 @@ void ItemBaseObject::close( XNavBrow *brow, double x, double y)
brow_CloseNode( brow->ctx, node); brow_CloseNode( brow->ctx, node);
if ( brow_IsOpen( node) & xnav_mOpen_Attributes) if ( brow_IsOpen( node) & xnav_mOpen_Attributes)
brow_RemoveAnnotPixmap( node, 1); brow_RemoveAnnotPixmap( node, 1);
if ( brow_IsOpen( node) & xnav_mOpen_Children) if ( brow_IsOpen( node) & xnav_mOpen_Children) {
brow_SetAnnotPixmap( node, 0, brow->pixmap_map); if ( cid == pwr_cClass_plc)
brow_SetAnnotPixmap( node, 0, brow->pixmap_plcpgm);
else
brow_SetAnnotPixmap( node, 0, brow->pixmap_map);
}
brow_ResetOpen( node, xnav_mOpen_All); brow_ResetOpen( node, xnav_mOpen_All);
brow_ResetNodraw( brow->ctx); brow_ResetNodraw( brow->ctx);
brow_Redraw( brow->ctx, node_y); brow_Redraw( brow->ctx, node_y);
......
...@@ -216,15 +216,15 @@ class ItemFile : public Item { ...@@ -216,15 +216,15 @@ class ItemFile : public Item {
class ItemBaseObject : public Item { class ItemBaseObject : public Item {
public: public:
ItemBaseObject( pwr_tObjid item_objid, int item_is_root): ItemBaseObject( pwr_tObjid item_objid, int item_is_root):
Item( item_objid, item_is_root) {}; Item( item_objid, item_is_root), cid(0) {};
virtual int open_children( XNavBrow *brow, double x, double y); virtual int open_children( XNavBrow *brow, double x, double y);
virtual int open_attributes( XNavBrow *brow, double x, double y); virtual int open_attributes( XNavBrow *brow, double x, double y);
virtual int open_trace( XNavBrow *brow, double x, double y); virtual int open_trace( XNavBrow *brow, double x, double y);
virtual int open_crossref( XNavBrow *brow, double x, double y); virtual int open_crossref( XNavBrow *brow, double x, double y);
virtual void close( XNavBrow *brow, double x, double y); virtual void close( XNavBrow *brow, double x, double y);
virtual int open_attribute( XNavBrow *brow, double x, double y, virtual int open_attribute( XNavBrow *brow, double x, double y,
char *attr_name, int element); char *attr_name, int element);
pwr_tCid cid;
}; };
class ItemObject : public ItemBaseObject { class ItemObject : public ItemBaseObject {
......
...@@ -726,6 +726,7 @@ int XAttNav::object_attr() ...@@ -726,6 +726,7 @@ int XAttNav::object_attr()
gdh_sAttrDef *bd; gdh_sAttrDef *bd;
int rows; int rows;
char aname[120]; char aname[120];
char attr_name[120];
char name[240]; char name[240];
char *s; char *s;
...@@ -755,12 +756,15 @@ int XAttNav::object_attr() ...@@ -755,12 +756,15 @@ int XAttNav::object_attr()
bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE) bd[i].attr->Param.Info.Flags & PWR_MASK_PRIVATE)
continue; continue;
if ( objar.Flags.b.CastAttr)
cdh_SuppressSuper( attr_name, bd[i].attrName);
if ( strcmp( aname, "") == 0) if ( strcmp( aname, "") == 0)
strcpy( name, bd[i].attrName); strcpy( name, attr_name);
else { else {
strcpy( name, aname); strcpy( name, aname);
strcat( name, "."); strcat( name, ".");
strcat( name, bd[i].attrName); strcat( name, attr_name);
} }
elements = 1; elements = 1;
......
...@@ -196,6 +196,14 @@ extern "C" { ...@@ -196,6 +196,14 @@ extern "C" {
#include "xnav_bitmap_castattr18.h" #include "xnav_bitmap_castattr18.h"
#include "xnav_bitmap_castattr20.h" #include "xnav_bitmap_castattr20.h"
#include "xnav_bitmap_castattr24.h" #include "xnav_bitmap_castattr24.h"
#include "xnav_bitmap_plcpgm8.h"
#include "xnav_bitmap_plcpgm10.h"
#include "xnav_bitmap_plcpgm12.h"
#include "xnav_bitmap_plcpgm14.h"
#include "xnav_bitmap_plcpgm16.h"
#include "xnav_bitmap_plcpgm18.h"
#include "xnav_bitmap_plcpgm20.h"
#include "xnav_bitmap_plcpgm24.h"
#if 0 #if 0
...@@ -245,6 +253,7 @@ void XNavBrow::free_pixmaps() ...@@ -245,6 +253,7 @@ void XNavBrow::free_pixmaps()
brow_FreeAnnotPixmap( ctx, pixmap_arrowright); brow_FreeAnnotPixmap( ctx, pixmap_arrowright);
brow_FreeAnnotPixmap( ctx, pixmap_attrref); brow_FreeAnnotPixmap( ctx, pixmap_attrref);
brow_FreeAnnotPixmap( ctx, pixmap_castattr); brow_FreeAnnotPixmap( ctx, pixmap_castattr);
brow_FreeAnnotPixmap( ctx, pixmap_plcpgm);
} }
// //
...@@ -948,6 +957,37 @@ void XNavBrow::allocate_pixmaps() ...@@ -948,6 +957,37 @@ void XNavBrow::allocate_pixmaps()
pixmap_data[i++].bits = (char *)xnav_bitmap_castattr24_bits; pixmap_data[i++].bits = (char *)xnav_bitmap_castattr24_bits;
brow_AllocAnnotPixmap( ctx, &pixmap_data, &pixmap_castattr); brow_AllocAnnotPixmap( ctx, &pixmap_data, &pixmap_castattr);
i = 0;
pixmap_data[i].width =xnav_bitmap_plcpgm8_width;
pixmap_data[i].height =xnav_bitmap_plcpgm8_height;
pixmap_data[i++].bits = (char *)xnav_bitmap_plcpgm8_bits;
pixmap_data[i].width =xnav_bitmap_plcpgm10_width;
pixmap_data[i].height =xnav_bitmap_plcpgm10_height;
pixmap_data[i++].bits = (char *)xnav_bitmap_plcpgm10_bits;
pixmap_data[i].width =xnav_bitmap_plcpgm12_width;
pixmap_data[i].height =xnav_bitmap_plcpgm12_height;
pixmap_data[i++].bits = (char *)xnav_bitmap_plcpgm12_bits;
pixmap_data[i].width =xnav_bitmap_plcpgm14_width;
pixmap_data[i].height =xnav_bitmap_plcpgm14_height;
pixmap_data[i++].bits = (char *)xnav_bitmap_plcpgm14_bits;
pixmap_data[i].width =xnav_bitmap_plcpgm16_width;
pixmap_data[i].height =xnav_bitmap_plcpgm16_height;
pixmap_data[i++].bits = (char *)xnav_bitmap_plcpgm16_bits;
pixmap_data[i].width =xnav_bitmap_plcpgm18_width;
pixmap_data[i].height =xnav_bitmap_plcpgm18_height;
pixmap_data[i++].bits = (char *)xnav_bitmap_plcpgm18_bits;
pixmap_data[i].width =xnav_bitmap_plcpgm20_width;
pixmap_data[i].height =xnav_bitmap_plcpgm20_height;
pixmap_data[i++].bits = (char *)xnav_bitmap_plcpgm20_bits;
pixmap_data[i].width =xnav_bitmap_plcpgm20_width;
pixmap_data[i].height =xnav_bitmap_plcpgm20_height;
pixmap_data[i++].bits = (char *)xnav_bitmap_plcpgm20_bits;
pixmap_data[i].width =xnav_bitmap_plcpgm24_width;
pixmap_data[i].height =xnav_bitmap_plcpgm24_height;
pixmap_data[i++].bits = (char *)xnav_bitmap_plcpgm24_bits;
brow_AllocAnnotPixmap( ctx, &pixmap_data, &pixmap_plcpgm);
} }
// //
......
...@@ -68,6 +68,7 @@ class XNavBrow { ...@@ -68,6 +68,7 @@ class XNavBrow {
flow_sAnnotPixmap *pixmap_arrowright; flow_sAnnotPixmap *pixmap_arrowright;
flow_sAnnotPixmap *pixmap_attrref; flow_sAnnotPixmap *pixmap_attrref;
flow_sAnnotPixmap *pixmap_castattr; flow_sAnnotPixmap *pixmap_castattr;
flow_sAnnotPixmap *pixmap_plcpgm;
char push_command[200]; char push_command[200];
void free_pixmaps(); void free_pixmaps();
......
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