Commit 130fc06d authored by claes's avatar claes

CreateObject in WFoe popupmenu

parent 7094d765
/*
* Proview $Id: wb_foe.cpp,v 1.2 2007-01-15 13:22:11 claes Exp $
* Proview $Id: wb_foe.cpp,v 1.3 2007-01-24 12:37:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -608,6 +608,11 @@ void WFoe::activate_delete()
}
}
void WFoe::activate_createobject( float x, float y)
{
gre_node_created( gre, 0, x, y);
}
//
// Callback from the menu.
// Deletes the selected nodes and connections.
......@@ -1640,7 +1645,8 @@ void WFoe::gre_popupmenu( WGre *gre, int x_pix, int y_pix, int popupmenu_type,
foe->modify_popup( foe_e_popupmenu_delete |
foe_e_popupmenu_copy |
foe_e_popupmenu_cut |
foe_e_popupmenu_printselect,
foe_e_popupmenu_printselect |
foe_e_popupmenu_createobject,
x_pix + 5, y_pix);
}
}
......
/*
* Proview $Id: wb_foe.h,v 1.11 2007-01-04 07:29:03 claes Exp $
* Proview $Id: wb_foe.h,v 1.12 2007-01-24 12:37:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -65,7 +65,8 @@ enum foe_e_popupmenu {
foe_e_popupmenu_copy = 1 << 5,
foe_e_popupmenu_cut = 1 << 6,
foe_e_popupmenu_printselect = 1 << 7,
foe_e_popupmenu_helpclass = 1 << 8
foe_e_popupmenu_helpclass = 1 << 8,
foe_e_popupmenu_createobject = 1 << 9
};
class WFoe;
......@@ -197,6 +198,7 @@ class WFoe : public WUtility {
void activate_syntax();
void activate_compile();
void activate_delete();
void activate_createobject( float x, float y);
void activate_changetext();
void activate_cut();
void activate_copy();
......
/*
* Proview $Id: wb_gre.cpp,v 1.2 2007-01-17 06:21:33 claes Exp $
* Proview $Id: wb_gre.cpp,v 1.3 2007-01-24 12:37:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1437,7 +1437,7 @@ int WGre::flow_cb( FlowCtx *ctx, flow_tEvent event)
flow_SetSelectHighlight( ctx);
break;
case flow_eEvent_MB2Click:
/* Crdate node */
/* Create node */
switch ( event->object.object_type) {
case flow_eObjectType_NoObject:
(gre->gre_node_created) ( gre, dummy, event->object.x,
......@@ -1511,6 +1511,8 @@ int WGre::flow_cb( FlowCtx *ctx, flow_tEvent event)
flow_PositionToPixel( gre->flow_ctx, event->object.x,
event->object.y, &x_pix, &y_pix);
gre->popup_menu_x = x_pix;
gre->popup_menu_y = y_pix;
gre->get_popup_position( &x_pix, &y_pix);
current_node = 0;
......@@ -2882,6 +2884,7 @@ int WGre::set_trace_attributes( char *host)
node_ptr = nodelist;
for ( i = 0; i < (int)node_count; i++) {
inverted = 0;
sts = trace_get_attributes( this, *node_ptr, object_str, attr_str,
&trace_type, &inverted);
if ( ODD(sts) && sts != TRA__DISCARD ) {
......@@ -3014,3 +3017,8 @@ void WGre::set_grid_size( double size)
mask |= flow_eAttr_grid_size_y;
flow_SetAttributes( flow_ctx, &flow_attr, mask);
}
void WGre::pixel_to_position( int pix_x, int pix_y, double *x, double *y)
{
flow_PixelToPosition( flow_ctx, pix_x, pix_y, x, y);
}
/*
* Proview $Id: wb_gre.h,v 1.6 2007-01-04 07:29:03 claes Exp $
* Proview $Id: wb_gre.h,v 1.7 2007-01-24 12:37:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -109,7 +109,9 @@ class WGre {
int trace_started;
flow_tNodeClass trace_analyse_nc;
flow_tConClass trace_con_cc;
flow_tNode trace_changenode;
flow_tNode trace_changenode;
int popup_menu_x;
int popup_menu_y;
/* Callbacks */
void (*gre_setup_window)(WGre *);
......@@ -223,6 +225,7 @@ class WGre {
void disable_button_events();
int get_conclass( pwr_tClassId cid, ldh_tSesContext ldhses, unsigned long con_type,
flow_tConClass *con_class);
void pixel_to_position( int pix_x, int pix_y, double *x, double *y);
static int get_annot_width( flow_tNodeClass nodeclass,
float *annot_width, char *annot_str, int annot_count,
......
/*
* Proview $Id: flow_api.cpp,v 1.7 2007-01-17 06:19:26 claes Exp $
* Proview $Id: flow_api.cpp,v 1.8 2007-01-24 12:37:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -579,6 +579,12 @@ void flow_PositionToPixel( flow_tCtx ctx, double x, double y,
ctx->position_to_pixel( x, y, pix_x, pix_y);
}
void flow_PixelToPosition( flow_tCtx ctx, int pix_x, int pix_y,
double *x, double *y)
{
ctx->pixel_to_position( pix_x, pix_y, x, y);
}
void flow_UnZoom( flow_tCtx ctx)
{
ctx->unzoom();
......
/*
* Proview $Id: flow_api.h,v 1.7 2007-01-17 06:19:26 claes Exp $
* Proview $Id: flow_api.h,v 1.8 2007-01-24 12:37:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -207,6 +207,8 @@ void flow_SetAttributes( flow_tCtx ctx, flow_sAttributes *attr,
void flow_GetAttributes( flow_tCtx ctx, flow_sAttributes *attr);
void flow_PositionToPixel( flow_tCtx ctx, double x, double y,
int *pix_x, int *pix_y);
void flow_PixelToPosition( flow_tCtx ctx, int pix_x, int pix_y,
double *x, double *y);
void flow_UnZoom( flow_tCtx ctx);
void flow_CenterObject( flow_tCtx ctx, flow_tObject object);
void flow_GetNodePosition( flow_tNode node, double *x, double *y);
......
/*
* Proview $Id: flow_ctx.h,v 1.4 2007-01-17 06:19:26 claes Exp $
* Proview $Id: flow_ctx.h,v 1.5 2007-01-24 12:37:07 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -286,6 +286,9 @@ class FlowCtx {
void position_to_pixel( double x, double y, int *pix_x, int *pix_y)
{ *pix_x = int( x * zoom_factor - offset_x);
*pix_y = int( y * zoom_factor - offset_y);};
void pixel_to_position( int pix_x, int pix_y, double *x, double *y)
{ *x = double( pix_x + offset_x) / zoom_factor;
*y = double( pix_y + offset_y) / zoom_factor;};
void unzoom() { zoom( base_zoom_factor / zoom_factor);};
void center_object( FlowArrayElem *object);
FlowArrayElem *get_document( double x, double y);
......
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