Commit 0757ba8d authored by Claes Sjofors's avatar Claes Sjofors

Xtt command 'open graph' and 'set subw', /x0 /y0 /x1 /y1 added

parent fca71a72
......@@ -1696,10 +1696,17 @@ supplying the object with the /object qualifier.
<B>xtt> set subwindow 'graphname' /name= /source= [/object=]
'graphname' <t>the graph where the window object resides.
/name= <t>the name of the window object.
/source= <t>name of the Ge graph to view in the window object.
/object= <t>specifies the object when the graph is an object graph.
'graphname' <t>the graph where the window object resides.
/name <t>the name of the window object.
/source <t>name of the Ge graph to view in the window object.
/object <t>specifies the object when the graph is an object graph.
/x0 <t>Upper left x Ge coordinate for graph border. If x0, y0, x1, y1 are
<t>supplied, another part of the graph than the one specified in the Graph
<t>attributes x0, y0, x1, y1 will be displayed. Implemented for graphs
<t>in a multiview cell, not for window objects.
/y0 <t>Upper left y Ge coordinate for graph border.
/x1 <t>Lower right x Ge coordinate for graph border.
/x1 <t>Lower right y Ge coordinate for graph border.
</TOPIC>
<TOPIC> add menu <style> function
......@@ -2095,6 +2102,12 @@ a XttGraph object.
/maximize <t>Open the window maximized with frame.
/iconify <t>Open the window iconified.
/hide <t>Don't display the graph on the screen.
/x0 <t>Upper left x Ge coordinate for graph border. If x0, y0, x1, y1 are
<t>supplied, another part of the graph than the one specified in the Graph
<t>attributes x0, y0, x1, y1 will be displayed.
/y0 <t>Upper left y Ge coordinate for graph border.
/x1 <t>Lower right x Ge coordinate for graph border.
/x1 <t>Lower right y Ge coordinate for graph border.
</TOPIC>
<TOPIC> open multiview <style> function
......
......@@ -2054,6 +2054,16 @@ XttGraph objekt.
<t>Strängen $current anger nuvarande fönster när grafen öppnas från en
<t>tryckknapp i detta fönster.
/pinstance <t>Instance namn för pwindow grafen, om pwindow är en objektsbild.
/fullscreen <t>Öppna fönstret med full skärm utan ram.
/maximize <t>Öppna fönstret maximerat med ram.
/iconify <t>Öppna fönstret ikoniserat.
/hide <t>Visa inte fönstret på skärmen.
/x0 <t>Övre vänstra x koordinat i Ge för grafens gränslinje. Om x0, y0, x1, y1
<t>angesvisas en annan del av grafen än den som är specificerad Graph
<t>attributes x0, y0, x1, y1.
/y0 <t>Övre vänstra y koordinat i Ge för grafens gränslinje.
/x1 <t>Undre högra x koordinat i Ge för grafen gränslinje.
/x1 <t>Undre högra y koordinat i Ge för grafen gränslinje.
</TOPIC>
<TOPIC> open jgraph <style> function
......
......@@ -189,7 +189,7 @@ Graph::Graph(
graph_object_scan(0), graph_object_close(0), local_db(0),
use_default_access(xn_use_default_access),
default_access(xn_default_access), keep_mode(false),
subgraph_dyn(0), was_subgraph(0), disable_log(1)
subgraph_dyn(0), was_subgraph(0), disable_log(1), pending_borders(0)
{
cdh_StrncpyCutOff( name, xn_name, sizeof(name), 1);
strcpy( default_path, xn_default_path);
......@@ -629,6 +629,19 @@ void Graph::unzoom()
grow_UnZoom( grow->ctx);
}
//
// Return to base zoom factor
//
void Graph::set_borders( double *borders)
{
if ( grow)
grow_SetLayout( grow->ctx, borders[0], borders[1], borders[2], borders[3]);
else {
pending_borders = (double *)calloc( 4, sizeof(double));
memcpy( pending_borders, borders, 4*sizeof(double));
}
}
//
// Return to base zoom factor
//
......@@ -3338,6 +3351,14 @@ int graph_init_grow_base_cb( GlowCtx *fctx, void *client_data)
if ( graph->init_cb)
(graph->init_cb) (graph->parent_ctx);
if ( graph->pending_borders) {
grow_SetLayout( graph->grow->ctx, graph->pending_borders[0], graph->pending_borders[1],
graph->pending_borders[2], graph->pending_borders[3]);
free( graph->pending_borders);
graph->pending_borders = 0;
}
return 1;
}
......
......@@ -535,6 +535,7 @@ class Graph {
char java_package[80]; //!< Package for generated java code for baseclasses
vector<GraphRef> reflist; //!< List with stored references
int disable_log; //!< Disable wb log window
double *pending_borders; //!< Stored initial borders
//! Print to postscript file.
/*! \param filename Name of postscript file. */
......@@ -552,6 +553,9 @@ class Graph {
/*! Return to base zoom factor. */
void unzoom();
//! Set graph borders.
void set_borders( double *borders);
//! Set edit mode.
/*!
\param mode Edit mode.
......
......@@ -288,7 +288,7 @@ XttGeGtk::XttGeGtk( GtkWidget *xg_parent_wid, void *xg_parent_ctx, const char *x
const char *xg_filename, int xg_scrollbar, int xg_menu, int xg_navigator,
int xg_width, int xg_height, int x, int y, double scan_time,
const char *object_name, int use_default_access, unsigned int access,
unsigned int options, void *basewidget,
unsigned int options, void *basewidget, double *borders,
int (*xg_command_cb) (void *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int)) :
......@@ -478,6 +478,9 @@ XttGeGtk::XttGeGtk( GtkWidget *xg_parent_wid, void *xg_parent_ctx, const char *x
gtk_widget_set_size_request( graph_form, window_width, window_height);
}
if ( borders)
((Graph *)graph)->set_borders( borders);
}
static gint confirm_delete_event( GtkWidget *w, GdkEvent *event, gpointer ge)
......
......@@ -66,7 +66,7 @@ class XttGeGtk : public XttGe {
XttGeGtk( GtkWidget *parent_wid, void *parent_ctx, const char *name, const char *filename,
int scrollbar, int menu, int navigator, int width, int height,
int x, int y, double scan_time, const char *object_name, int use_default_access,
unsigned int access, unsigned int options, void *basewidget,
unsigned int access, unsigned int options, void *basewidget, double *borders,
int (*xg_command_cb) (void *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int));
......
......@@ -314,7 +314,7 @@ XttMultiViewGtk::XttMultiViewGtk( GtkWidget *mv_parent_wid, void *mv_parent_ctx,
gectx[i*rows + j] = new XttGeGtk( toplevel, this, "No title",
graph_name, scrollbar, menu, 0, w, h, mv_x, mv_y,
1.0, objectname_p, 0, 0,
ge_mOptions_Embedded, 0,
ge_mOptions_Embedded, 0, 0,
multiview_ge_command_cb, multiview_ge_get_current_objects_cb,
multiview_ge_is_authorized_cb);
......@@ -719,7 +719,7 @@ void *XttMultiViewGtk::get_widget()
return box_widget;
}
int XttMultiViewGtk::set_subwindow_source( const char *name, char *source, char *object,
int XttMultiViewGtk::set_subwindow_source( const char *name, char *source, char *object, double *borders,
int insert, int cont)
{
pwr_sClass_XttMultiView mv;
......@@ -764,7 +764,7 @@ int XttMultiViewGtk::set_subwindow_source( const char *name, char *source, char
XttGeGtk *ctx = new XttGeGtk( toplevel, this, "No title",
source, scrollbar, menu, 0, w, h, x, y,
1.0, object, 0, 0,
ge_mOptions_Embedded, 0,
ge_mOptions_Embedded, 0, borders,
multiview_ge_command_cb, multiview_ge_get_current_objects_cb,
multiview_ge_is_authorized_cb);
......@@ -1111,7 +1111,7 @@ int XttMultiViewGtk::set_subwindow_source( const char *name, char *source, char
break;
}
case pwr_eMultiViewContentEnum_MultiView: {
mvctx[i*rows+j]->set_subwindow_source( sub_name, source, object,
mvctx[i*rows+j]->set_subwindow_source( sub_name, source, object, borders,
insert);
}
default: ;
......
......@@ -79,7 +79,8 @@ class XttMultiViewGtk : public XttMultiView {
void create_confirm_dialog();
void confirm_reply( int ok);
void *get_widget();
int set_subwindow_source( const char *name, char *source, char *object, int insert = 1, int more = 0);
int set_subwindow_source( const char *name, char *source, char *object, double *borders,
int insert = 1, int more = 0);
static void ge_change_value_cb( void *ge_ctx, void *value_object, char *text);
static void confirm_cb( void *ge_ctx, void *confirm_object, char *text);
......
......@@ -322,14 +322,15 @@ XttGe *XNavGtk::xnav_ge_new( const char *name, const char *filename, int scrollb
int navigator, int width, int height, int x, int y,
double scan_time, const char *object_name,
int use_default_access, unsigned int access,
unsigned int options, void *basewidget,
unsigned int options, void *basewidget, double *borders,
int (*command_cb) (void *, char *, void *),
int (*get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*is_authorized_cb) (void *, unsigned int))
{
return new XttGeGtk( parent_wid, this, name, filename, scrollbar, menu, navigator,
width, height, x, y, scan_time, object_name, use_default_access,
access, options, basewidget, command_cb, get_current_objects_cb, is_authorized_cb);
access, options, basewidget, borders,
command_cb, get_current_objects_cb, is_authorized_cb);
}
XttMultiView *XNavGtk::multiview_new( const char *name, pwr_tAttrRef *aref,
......
......@@ -91,7 +91,7 @@ class XNavGtk : public XNav {
int navigator, int width, int height, int x, int y,
double scan_time, const char *object_name,
int use_default_access, unsigned int access, unsigned int options,
void *basewidget,
void *basewidget, double *borders,
int (*xg_command_cb) (void *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int));
......
......@@ -314,6 +314,7 @@ XttGeMotif::XttGeMotif( Widget xg_parent_wid, void *xg_parent_ctx, const char *x
int xg_navigator, int xg_width, int xg_height, int x, int y,
double scan_time, const char *object_name,
int use_default_access, unsigned int access, unsigned int options,
void *basewidget, double *borders,
int (*xg_command_cb) (void *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int)) :
......
......@@ -61,7 +61,7 @@ class XttGeMotif : public XttGe {
XttGeMotif( Widget parent_wid, void *parent_ctx, const char *name, const char *filename,
int scrollbar, int menu, int navigator, int width, int height,
int x, int y, double scan_time, const char *object_name, int use_default_access,
unsigned int access, unsigned int options,
unsigned int access, unsigned int options, void *basewidget, double *borders,
int (*xg_command_cb) (void *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int));
......
......@@ -292,13 +292,15 @@ XttGe *XNavMotif::xnav_ge_new( const char *name, const char *filename, int scrol
int navigator, int width, int height, int x, int y,
double scan_time, const char *object_name,
int use_default_access, unsigned int access, unsigned int options,
void *basewidget, double* borders,
int (*command_cb) (void *, char *, void *),
int (*get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*is_authorized_cb) (void *, unsigned int))
{
return new XttGeMotif( parent_wid, this, name, filename, scrollbar, menu, navigator,
width, height, x, y, scan_time, object_name, use_default_access,
access, options, command_cb, get_current_objects_cb, is_authorized_cb);
access, options, basewidget, scroll_x, scroll_y,
command_cb, get_current_objects_cb, is_authorized_cb);
}
GeCurve *XNavMotif::gecurve_new( char *name, char *filename, GeCurveData *data,
......
......@@ -85,6 +85,7 @@ class XNavMotif : public XNav {
int navigator, int width, int height, int x, int y,
double scan_time, const char *object_name,
int use_default_access, unsigned int access, unsigned int options,
void *basewidget, double *borders,
int (*xg_command_cb) (void *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int));
......
......@@ -1495,7 +1495,7 @@ int ItemFile::open_children( XNavBrow *brow, double x, double y)
break;
}
case item_eFileType_Graph:
xnav->open_graph( name, file_name, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
xnav->open_graph( name, file_name, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
break;
case item_eFileType_RttLog:
xnav->open_rttlog( name, file_name);
......
......@@ -106,7 +106,8 @@ class XttMultiView {
virtual void pop() {}
virtual void set_size( int width, int height) {}
virtual void *get_widget() { return 0;}
virtual int set_subwindow_source( const char *name, char *source, char *object, int insert = 1, int cont = 0) {return 0;}
virtual int set_subwindow_source( const char *name, char *source, char *object, double *borders,
int insert = 1, int cont = 0) {return 0;}
void message( char severity, const char *msg);
int set_object_focus( const char *name, int empty);
......
......@@ -370,7 +370,7 @@ class XNav {
int navigator, int width, int height, int x, int y,
double scan_time, const char *object_name,
int use_default_access, unsigned int access, unsigned int options,
void *basewidget,
void *basewidget, double *borders,
int (*xg_command_cb) (void *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int)) {return 0;}
......@@ -524,9 +524,10 @@ class XNav {
int collect);
int show_symbols();
void open_graph( const char *name, const char *filename, int scrollbar, int menu,
int navigator, int width, int height, int x, int y, const char *object_name,
const char *focus, int inputempty, int use_default_access,
unsigned int access, unsigned int options, void *basewidget);
int navigator, int width, int height, int x, int y, const char *object_name,
const char *focus, int inputempty, int use_default_access,
unsigned int access, unsigned int options, void *basewidget,
double *borders);
void close_graph( char *filename, char *object_name);
int exec_xttgraph( pwr_tObjid xttgraph, char *instance,
char *focus, int inputempty, int use_default_access,
......
......@@ -276,7 +276,7 @@ dcli_tCmdTable xnav_command_table[] = {
"/PINSTANCE", "/BYPASS",
"/CLOSEBUTTON", "/TARGET", "/TRIGGER", "/TYPE", "/FTYPE",
"/FULLSCREEN", "/MAXIMIZE", "/FULLMAXIMIZE", "/ICONIFY", "/HIDE",
"/XPOSITION", "/YPOSITION", ""}
"/XPOSITION", "/YPOSITION", "/X0", "/Y0", "/X1", "/Y1", ""}
},
{
"CLOSE",
......@@ -358,7 +358,8 @@ dcli_tCmdTable xnav_command_table[] = {
"SET",
&xnav_set_func,
{ "dcli_arg1", "dcli_arg2", "/NAME", "/VALUE",
"/BYPASS", "/INDEX", "/SOURCE", "/OBJECT", "/CONTINUE", ""}
"/BYPASS", "/INDEX", "/SOURCE", "/OBJECT", "/CONTINUE",
"/X0", "/Y0", "/X1", "/Y1", ""}
},
{
"SETUP",
......@@ -882,12 +883,59 @@ static int xnav_set_func( void *client_data,
else {
pwr_tStatus sts;
pwr_tAttrRef aref;
char tmp_str[80];
int nr;
double borders[4] = {0,0,0,0};
double *bordersp = borders;
xnav_replace_node_str( graph_str, graph_str);
if ( ODD( dcli_get_qualifier( "/X0", tmp_str, sizeof(tmp_str)))) {
nr = sscanf( tmp_str, "%lf", &borders[0]);
if ( nr != 1) {
xnav->message('E', "Syntax error in x0");
return XNAV__HOLDCOMMAND;
}
}
else
borders[0] = 0;
if ( ODD( dcli_get_qualifier( "/Y0", tmp_str, sizeof(tmp_str)))) {
nr = sscanf( tmp_str, "%lf", &borders[1]);
if ( nr != 1) {
xnav->message('E', "Syntax error in y0");
return XNAV__HOLDCOMMAND;
}
}
else
borders[1] = 0;
if ( ODD( dcli_get_qualifier( "/X1", tmp_str, sizeof(tmp_str)))) {
nr = sscanf( tmp_str, "%lf", &borders[2]);
if ( nr != 1) {
xnav->message('E', "Syntax error in x1");
return XNAV__HOLDCOMMAND;
}
}
else
borders[2] = 0;
if ( ODD( dcli_get_qualifier( "/Y1", tmp_str, sizeof(tmp_str)))) {
nr = sscanf( tmp_str, "%lf", &borders[3]);
if ( nr != 1) {
xnav->message('E', "Syntax error in y1");
return XNAV__HOLDCOMMAND;
}
}
else
borders[3] = 0;
if ( borders[0] == 0 && borders[1] == 0 && borders[2] == 0 && borders[3] == 0)
bordersp = 0;
sts = gdh_NameToAttrref( pwr_cNObjid, graph_str, &aref);
if ( ODD(sts) && xnav->appl.find( applist_eType_MultiView, &aref, (void **) &mvctx)) {
return mvctx->set_subwindow_source( name_str, source_str, object_p, cont);
return mvctx->set_subwindow_source( name_str, source_str, object_p, bordersp, cont);
}
else {
xnav->message('E', "Graph is not open");
......@@ -3112,6 +3160,8 @@ static int xnav_open_func( void *client_data,
char tmp_str[80];
char *focus_p;
int width, height, nr, scrollbar, menu, navigator;
double borders[4] = {0,0,0,0};
double *bordersp = borders;
int inputempty;
pwr_tFileName fname;
int use_default_access;
......@@ -3126,7 +3176,7 @@ static int xnav_open_func( void *client_data,
navigator = ODD( dcli_get_qualifier( "/NAVIGATOR", 0, 0));
xnav->open_graph( "Collect", "_none_", scrollbar, menu, navigator,
0, 0, 0, 0, "collect", NULL, 0, 0, 0, options, basewidget);
0, 0, 0, 0, "collect", NULL, 0, 0, 0, options, basewidget, 0);
return XNAV__SUCCESS;
}
if ( ODD( dcli_get_qualifier( "dcli_arg2", file_str, sizeof(file_str)))) {
......@@ -3247,6 +3297,49 @@ static int xnav_open_func( void *client_data,
else
height = 0;
if ( ODD( dcli_get_qualifier( "/X0", tmp_str, sizeof(tmp_str)))) {
nr = sscanf( tmp_str, "%lf", &borders[0]);
if ( nr != 1) {
xnav->message('E', "Syntax error in x0");
return XNAV__HOLDCOMMAND;
}
}
else
borders[0] = 0;
if ( ODD( dcli_get_qualifier( "/Y0", tmp_str, sizeof(tmp_str)))) {
nr = sscanf( tmp_str, "%lf", &borders[1]);
if ( nr != 1) {
xnav->message('E', "Syntax error in y0");
return XNAV__HOLDCOMMAND;
}
}
else
borders[1] = 0;
if ( ODD( dcli_get_qualifier( "/X1", tmp_str, sizeof(tmp_str)))) {
nr = sscanf( tmp_str, "%lf", &borders[2]);
if ( nr != 1) {
xnav->message('E', "Syntax error in x1");
return XNAV__HOLDCOMMAND;
}
}
else
borders[2] = 0;
if ( ODD( dcli_get_qualifier( "/Y1", tmp_str, sizeof(tmp_str)))) {
nr = sscanf( tmp_str, "%lf", &borders[3]);
if ( nr != 1) {
xnav->message('E', "Syntax error in y1");
return XNAV__HOLDCOMMAND;
}
}
else
borders[3] = 0;
if ( borders[0] == 0 && borders[1] == 0 && borders[2] == 0 && borders[3] == 0)
bordersp = 0;
if ( ODD( dcli_get_qualifier( "/ACCESS", tmp_str, sizeof(tmp_str)))) {
nr = sscanf( tmp_str, "%u", &access);
if ( nr != 1) {
......@@ -3260,7 +3353,7 @@ static int xnav_open_func( void *client_data,
xnav->open_graph( name_str, file_str, scrollbar, menu, navigator,
width, height, 0, 0, instance_p, focus_p, inputempty,
use_default_access, access, options, basewidget);
use_default_access, access, options, basewidget, bordersp);
return XNAV__SUCCESS;
}
}
......@@ -8490,9 +8583,10 @@ static int xnav_ge_get_current_objects_cb( void *vxnav, pwr_sAttrRef **alist,
}
void XNav::open_graph( const char *name, const char *filename, int scrollbar, int menu,
int navigator, int width, int height, int x, int y,
const char *object_name, const char *focus_name, int input_focus_empty,
int use_default_access, unsigned int access, unsigned int options, void *basewidget)
int navigator, int width, int height, int x, int y,
const char *object_name, const char *focus_name, int input_focus_empty,
int use_default_access, unsigned int access, unsigned int options, void *basewidget,
double *borders)
{
XttGe *gectx;
......@@ -8507,7 +8601,7 @@ void XNav::open_graph( const char *name, const char *filename, int scrollbar, in
gectx = xnav_ge_new( name, filename,
scrollbar, menu, navigator, width, height, x, y, gbl.scantime,
object_name, use_default_access, access, options, basewidget,
&xnav_ge_command_cb,
borders, &xnav_ge_command_cb,
&xnav_ge_get_current_objects_cb, &xnav_ge_is_authorized_cb);
gectx->close_cb = xnav_ge_close_cb;
gectx->help_cb = xnav_ge_help_cb;
......@@ -8591,7 +8685,7 @@ int XNav::exec_xttgraph( pwr_tObjid xttgraph, char *instance,
open_graph( xttgraph_o.Title, action, scrollbars,
menu, navigator, xttgraph_o.Width,
xttgraph_o.Height, xttgraph_o.X, xttgraph_o.Y, instance,
focus, inputempty, use_default_access, access, options, basewidget);
focus, inputempty, use_default_access, access, options, basewidget, 0);
}
else if ( (strstr( action, ".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