Commit 560722ce authored by Claes Sjofors's avatar Claes Sjofors

Ge, transient for graphs implemented

parent cfc0bda9
......@@ -2057,6 +2057,11 @@ a XttGraph object.
/focus <t>Name of a value input object. The object will gain input focus
<t>when the graph is opened.
/inputempty <t>The input label of the input focus object will be empty.
/pwindow <t>Filename of another window that this graph should be placed
<t>on top of. The string $current will denote the current window
<t>when the graph is opened from a push button in this window.
/pinstance <t>Instance name for the pwindow graph, if pwindow is an object
<t>graph.
</TOPIC>
<TOPIC> open jgraph <style> function
......
......@@ -2018,6 +2018,10 @@ XttGraph objekt.
/focus <t>Namn på ett inmatnings objekt. Objektet kommer att ges input focus
<t>när grafen öppnas.
/inputempty <t>Texten i inmatningsfältet töms.
/pwindow <t>Filnamn för ett annat fönster som grafen ska placera ovanför.
<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.
</TOPIC>
<TOPIC> open jgraph <style> function
......
......@@ -284,8 +284,8 @@ 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,
int (*xg_command_cb) (XttGe *, char *),
unsigned int options, void *basewidget,
int (*xg_command_cb) (XttGe *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int)) :
XttGe( xg_parent_ctx, xg_name, xg_filename, xg_scrollbar, xg_menu, xg_navigator, xg_width,
......@@ -333,6 +333,10 @@ XttGeGtk::XttGeGtk( GtkWidget *xg_parent_wid, void *xg_parent_ctx, const char *x
CoWowGtk::SetWindowIcon( toplevel);
if ( basewidget) {
gtk_window_set_transient_for(GTK_WINDOW(toplevel), GTK_WINDOW(basewidget));
}
if ( xg_menu) {
GtkAccelGroup *accel_g = (GtkAccelGroup *) g_object_new(GTK_TYPE_ACCEL_GROUP, NULL);
gtk_window_add_accel_group(GTK_WINDOW(toplevel), accel_g);
......
......@@ -66,8 +66,8 @@ 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,
int (*xg_command_cb) (XttGe *, char *),
unsigned int access, unsigned int options, void *basewidget,
int (*xg_command_cb) (XttGe *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int));
~XttGeGtk();
......@@ -76,6 +76,7 @@ class XttGeGtk : public XttGe {
void set_size( int width, int height);
void create_confirm_dialog();
void confirm_reply( int ok);
void *get_widget() { return toplevel;}
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);
......
......@@ -286,14 +286,14 @@ 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,
int (*command_cb) (XttGe *, char *),
unsigned int options, void *basewidget,
int (*command_cb) (XttGe *, 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, command_cb, get_current_objects_cb, is_authorized_cb);
access, options, basewidget, command_cb, get_current_objects_cb, is_authorized_cb);
}
GeCurve *XNavGtk::gecurve_new( char *name, char *filename, GeCurveData *data,
......
......@@ -89,7 +89,8 @@ 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,
int (*xg_command_cb) (XttGe *, char *),
void *basewidget,
int (*xg_command_cb) (XttGe *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int));
GeCurve *gecurve_new( char *name, char *filename, GeCurveData *data,
......
......@@ -314,7 +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,
int (*xg_command_cb) (XttGe *, char *),
int (*xg_command_cb) (XttGe *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int)) :
XttGe( xg_parent_ctx, xg_name, xg_filename, xg_scrollbar, xg_menu, xg_navigator, xg_width,
......
......@@ -62,7 +62,7 @@ class XttGeMotif : public XttGe {
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,
int (*xg_command_cb) (XttGe *, char *),
int (*xg_command_cb) (XttGe *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int));
~XttGeMotif();
......
......@@ -292,7 +292,8 @@ 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,
int (*command_cb) (XttGe *, char *),
void *basewidget,
int (*command_cb) (XttGe *, char *, void *),
int (*get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*is_authorized_cb) (void *, unsigned int))
{
......
......@@ -83,7 +83,8 @@ 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,
int (*xg_command_cb) (XttGe *, char *),
void *basewidget,
int (*xg_command_cb) (XttGe *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int));
GeCurve *gecurve_new( char *name, char *filename, GeCurveData *data,
......
......@@ -1961,7 +1961,7 @@ static pwr_tStatus CrrOpenTraceFilter( xmenu_sMenuCall *ip)
// Open graph
static pwr_tStatus CrrOpenGraph( xmenu_sMenuCall *ip)
{
((XNav *)ip->EditorContext)->exec_xttgraph( ip->Pointed.Objid, 0, 0, 0, 0, 0, 0);
((XNav *)ip->EditorContext)->exec_xttgraph( ip->Pointed.Objid, 0, 0, 0, 0, 0, 0, 0);
return XNAV__SUCCESS;
}
......
......@@ -97,7 +97,7 @@ int XttGe::ge_command_cb( void *ge_ctx, char *cmd)
if ( ge->command_cb)
{
sts = (ge->command_cb)( ge, cmd);
sts = (ge->command_cb)( ge, cmd, ge_ctx);
return sts;
}
return 0;
......@@ -247,7 +247,7 @@ XttGe::XttGe( void *xg_parent_ctx, const char *xg_name, 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,
int (*xg_command_cb) (XttGe *, char *),
int (*xg_command_cb) (XttGe *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int)) :
parent_ctx(xg_parent_ctx), scrollbar(xg_scrollbar),
......
......@@ -57,7 +57,7 @@ class XttGe {
void *current_confirm_object;
int value_input_open;
int confirm_open;
int (*command_cb)(XttGe *, char *);
int (*command_cb)(XttGe *, char *, void *);
void (*close_cb)(XttGe *);
void (*help_cb)(XttGe *, const char *key);
void (*display_in_xnav_cb)(void *, pwr_sAttrRef *);
......@@ -76,7 +76,7 @@ class XttGe {
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,
int (*xg_command_cb) (XttGe *, char *),
int (*xg_command_cb) (XttGe *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int));
virtual ~XttGe();
......@@ -84,6 +84,7 @@ class XttGe {
virtual void pop() {}
virtual void set_size( int width, int height) {}
virtual void confirm_reply( int ok) {}
virtual void *get_widget() { return 0;}
void message( char severity, const char *msg);
void print();
......
......@@ -1457,7 +1457,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);
xnav->open_graph( name, file_name, 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);
......
......@@ -360,6 +360,7 @@ class XNav {
CoLogin *cologin;
sevcli_tCtx scctx;
XColWind *last_xcolwind;
void *current_gectx;
virtual void set_inputfocus() {}
virtual void pop() {}
......@@ -394,7 +395,8 @@ 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,
int (*xg_command_cb) (XttGe *, char *),
void *basewidget,
int (*xg_command_cb) (XttGe *, char *, void *),
int (*xg_get_current_objects_cb) (void *, pwr_sAttrRef **, int **),
int (*xg_is_authorized_cb) (void *, unsigned int)) {return 0;}
virtual GeCurve *gecurve_new( char *name, char *filename, GeCurveData *data,
......@@ -538,11 +540,11 @@ class XNav {
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);
unsigned int access, unsigned int options, void *basewidget);
void close_graph( char *filename, char *object_name);
int exec_xttgraph( pwr_tObjid xttgraph, char *instance,
char *focus, int inputempty,
int use_default_access, unsigned int access, unsigned int options);
char *focus, int inputempty, int use_default_access, unsigned int access,
unsigned int options, void *basewidget);
void ge_event_exec( int type, char *name, char *instance, void *event, unsigned int size);
int set_parameter( char *name_str, char *value_str, int bypass);
void open_rttlog( char *name, char *filename);
......
......@@ -158,7 +158,7 @@ static int xnav_attribute_func (
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string);
static int xnav_ge_command_cb( XttGe *gectx, char *command);
static int xnav_ge_command_cb( XttGe *gectx, char *command, void *caller);
static void xnav_ge_close_cb( XttGe *gectx);
//new code by Jonas Nylund 030131
static void xnav_hist_close_cb( void *ctx);
......@@ -262,7 +262,8 @@ dcli_tCmdTable xnav_command_table[] = {
"/SCROLLBAR", "/WIDTH", "/HEIGHT", "/MENU",
"/NAVIGATOR", "/CENTER", "/OBJECT", "/NEW",
"/INSTANCE", "/COLLECT", "/FOCUS", "/INPUTEMPTY",
"/ENTRY", "/TITLE", "/ACCESS", "/CLASSGRAPH", "/PARENT", "/BYPASS",
"/ENTRY", "/TITLE", "/ACCESS", "/CLASSGRAPH", "/PARENT", "/PWINDOW",
"/PINSTANCE", "/BYPASS",
"/CLOSEBUTTON", "/TARGET", "/TRIGGER", "/TYPE", "/FTYPE",
"/FULLSCREEN", "/MAXIMIZE", "/FULLMAXIMIZE", "/ICONIFY", "/HIDE", ""}
},
......@@ -2528,6 +2529,10 @@ static int xnav_open_func( void *client_data,
int parent;
pwr_tStatus sts;
unsigned int options = 0;
pwr_tFileName pwindow_str;
pwr_tAName pinstance_str;
void *basewidget = 0;
parent = ODD( dcli_get_qualifier( "/PARENT", 0, 0));
......@@ -2542,6 +2547,27 @@ static int xnav_open_func( void *client_data,
if ( ODD( dcli_get_qualifier( "/HIDE", 0, 0)))
options |= ge_mOptions_Invisible;
if ( ODD( dcli_get_qualifier( "/PWINDOW", pwindow_str, sizeof(pwindow_str)))) {
char *pinstance_p = 0;
XttGe *gectx;
if ( cdh_NoCaseStrcmp(pwindow_str, "$current") == 0) {
pwr_tFileName name;
pwr_tAName inst;
if ( xnav->appl.find( applist_eType_Graph, xnav->current_gectx, name, inst))
basewidget = ((XttGe *)xnav->current_gectx)->get_widget();
}
else {
if ( ODD( dcli_get_qualifier( "/PINSTANCE", pinstance_str, sizeof(pinstance_str)))) {
pinstance_p = pinstance_str;
}
if ( xnav->appl.find( applist_eType_Graph, pwindow_str, pinstance_p,
(void **) &gectx))
basewidget = gectx->get_widget();
}
}
if ( ODD( dcli_get_qualifier( "/INSTANCE", instance_str, sizeof(instance_str)))) {
instance_p = instance_str;
......@@ -2677,7 +2703,7 @@ static int xnav_open_func( void *client_data,
use_default_access = 0;
xnav->exec_xttgraph( objid, instance_p, focus_p, inputempty, use_default_access, access,
options);
options, basewidget);
}
else {
pwr_tFileName file_str;
......@@ -2700,7 +2726,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);
0, 0, 0, 0, "collect", NULL, 0, 0, 0, options, basewidget);
return XNAV__SUCCESS;
}
if ( ODD( dcli_get_qualifier( "dcli_arg2", file_str, sizeof(file_str)))) {
......@@ -2834,7 +2860,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);
use_default_access, access, options, basewidget);
return XNAV__SUCCESS;
}
}
......@@ -4235,8 +4261,9 @@ static void xnav_ge_help_cb( XttGe *gectx, const char *key)
xnav->message( ' ', null_str);
}
static int xnav_ge_command_cb( XttGe *gectx, char *command)
static int xnav_ge_command_cb( XttGe *gectx, char *command, void *caller)
{
((XNav *)gectx->parent_ctx)->current_gectx = caller;
((XNav *)gectx->parent_ctx)->command( command);
return ((XNav *)gectx->parent_ctx)->get_command_sts();
}
......@@ -7586,7 +7613,7 @@ 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)
int use_default_access, unsigned int access, unsigned int options, void *basewidget)
{
XttGe *gectx;
......@@ -7600,7 +7627,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,
object_name, use_default_access, access, options, basewidget,
&xnav_ge_command_cb,
&xnav_ge_get_current_objects_cb, &xnav_ge_is_authorized_cb);
gectx->close_cb = xnav_ge_close_cb;
......@@ -7632,7 +7659,7 @@ void XNav::close_graph( char *filename, char *object_name)
int XNav::exec_xttgraph( pwr_tObjid xttgraph, char *instance,
char *focus, int inputempty,
int use_default_access, unsigned int access,
unsigned int options)
unsigned int options, void *basewidget)
{
pwr_sClass_XttGraph xttgraph_o;
char action[80];
......@@ -7678,7 +7705,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);
focus, inputempty, use_default_access, access, options, basewidget);
}
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