Commit d0982a96 authored by claes's avatar claes

Also connections can be deleted from keyboard

parent bd593437
/* /*
* Proview $Id: wb_foe.cpp,v 1.11 2008-10-03 14:18:37 claes Exp $ * Proview $Id: wb_foe.cpp,v 1.12 2008-10-09 08:32:51 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
...@@ -565,20 +565,27 @@ void WFoe::activate_delete_confirm() ...@@ -565,20 +565,27 @@ void WFoe::activate_delete_confirm()
{ {
unsigned long node_count; unsigned long node_count;
vldh_t_node *nodelist; vldh_t_node *nodelist;
unsigned long con_count = 0;
vldh_t_con *conlist;
char msg[200]; char msg[200];
gre->get_selnodes( &node_count, &nodelist); gre->get_selnodes( &node_count, &nodelist);
if ( !node_count) { if ( !node_count) {
message( "Nothing to delete"); gre->get_selcons( &con_count, &conlist);
return; if ( !con_count) {
message( "Nothing to delete");
return;
}
if ( con_count > 0) free((char *) conlist);
} }
if ( node_count > 0) free((char *) nodelist);
if ( node_count > 1) if ( node_count + con_count > 1)
strcpy( msg, "Do you want to delete the selected objects"); strcpy( msg, "Do you want to delete the selected objects");
else else
strcpy( msg, "Do you want to delete the selected object"); strcpy( msg, "Do you want to delete the selected object");
wow->DisplayQuestion( this, "Delete", msg, delete_ok_cb, 0, *nodelist); wow->DisplayQuestion( this, "Delete", msg, delete_ok_cb, 0, 0);
} }
// //
......
/* /*
* Proview $Id: wb_gre.cpp,v 1.11 2008-10-03 14:18:37 claes Exp $ * Proview $Id: wb_gre.cpp,v 1.12 2008-10-09 08:33:14 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
...@@ -1223,6 +1223,36 @@ int WGre::get_selnodes( unsigned long *node_count, vldh_t_node **nodelist) ...@@ -1223,6 +1223,36 @@ int WGre::get_selnodes( unsigned long *node_count, vldh_t_node **nodelist)
return GRE__SUCCESS; return GRE__SUCCESS;
} }
//
// Returns an array of all selected connections.
// The array should be freed by the user with a free call.
//
int WGre::get_selcons( unsigned long *con_count, vldh_t_con **conlist)
{
int i;
vldh_t_con con;
flow_tCon *fcon_list;
int fcon_count;
flow_GetSelectedCons( flow_ctx, &fcon_list, &fcon_count);
*con_count = 0;
if ( fcon_count == 0)
return GRE__SUCCESS;
/* create array */
*conlist = (vldh_t_con *)calloc( fcon_count,
sizeof(con));
/* Insert the cons */
for ( i = 0; i < fcon_count; i++ ) {
flow_GetUserData( fcon_list[i], (void **)&con);
*(*conlist + *con_count) = con;
(*con_count)++;
}
return GRE__SUCCESS;
}
// //
// Returns a neted nodetypeid for the specified objecttype. // Returns a neted nodetypeid for the specified objecttype.
// If the the mask for the nodetype is of the defaultmask for // If the the mask for the nodetype is of the defaultmask for
......
/* /*
* Proview $Id: wb_gre.h,v 1.10 2008-10-03 14:18:37 claes Exp $ * Proview $Id: wb_gre.h,v 1.11 2008-10-09 08:33:14 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
...@@ -168,6 +168,7 @@ class WGre { ...@@ -168,6 +168,7 @@ class WGre {
int copy(); int copy();
int window_draw(); int window_draw();
int get_selnodes( unsigned long *node_count, vldh_t_node **nodelist); int get_selnodes( unsigned long *node_count, vldh_t_node **nodelist);
int get_selcons( unsigned long *con_count, vldh_t_con **conlist);
int get_nodeclass( pwr_tClassId cid, ldh_tSesContext ldhses, unsigned long node_type, int get_nodeclass( pwr_tClassId cid, ldh_tSesContext ldhses, unsigned long node_type,
unsigned int *mask, unsigned long subwindowmark, unsigned int *mask, unsigned long subwindowmark,
unsigned long node_width, flow_tNodeClass *node_class, unsigned long node_width, flow_tNodeClass *node_class,
......
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