Commit 5b3bf603 authored by claes's avatar claes

Fix for ReflextionX that can't handle aspect ratio correct

parent 942751fa
...@@ -40,7 +40,7 @@ extern "C" { ...@@ -40,7 +40,7 @@ extern "C" {
#include "co_lng.h" #include "co_lng.h"
#include "xtt_ge.h" #include "xtt_ge.h"
#include "ge_graph.h" #include "ge_graph.h"
#include "xtt_xnav.h"
// //
// Test program // Test program
...@@ -110,13 +110,23 @@ static void ge_graph_init_cb( void *client_data) ...@@ -110,13 +110,23 @@ static void ge_graph_init_cb( void *client_data)
sts = ((Graph *)gectx->graph)->get_default_size( &default_width, &default_height); sts = ((Graph *)gectx->graph)->get_default_size( &default_width, &default_height);
if ( ODD(sts)) if ( ODD(sts))
{ {
short x1, x2, y1, y2;
i = 0; i = 0;
XtSetArg(args[i],XmNwidth, default_width);i++; XtSetArg(args[i],XmNwidth, default_width);i++;
XtSetArg(args[i],XmNheight, default_height);i++; XtSetArg(args[i],XmNheight, default_height);i++;
XtSetArg(args[i], XmNminAspectX, default_width); i++;
XtSetArg(args[i], XmNminAspectY, default_height); i++; x1 = default_width;
XtSetArg(args[i], XmNmaxAspectX, default_width); i++; y1 = default_height;
XtSetArg(args[i], XmNmaxAspectY, default_height); i++; x2 = default_width;
y2 = default_height;
// This condition is due to a bug in Reflection X 11.0.5...
if ( !((XNav *)gectx->parent_ctx)->gbl.no_graph_ratio) {
XtSetArg(args[i], XmNminAspectX, x1); i++;
XtSetArg(args[i], XmNminAspectY, y1); i++;
XtSetArg(args[i], XmNmaxAspectX, x2); i++;
XtSetArg(args[i], XmNmaxAspectY, y2); i++;
}
XtSetValues( gectx->toplevel, args,i); XtSetValues( gectx->toplevel, args,i);
} }
} }
......
...@@ -191,18 +191,19 @@ class ApplList { ...@@ -191,18 +191,19 @@ class ApplList {
class XNavGbl { class XNavGbl {
public: public:
XNavGbl() : XNavGbl() :
priv(0), UserObject(pwr_cNObjid), AlarmAutoLoad(0), AlarmMessage(0), priv(0), UserObject(pwr_cNObjid), AlarmAutoLoad(0), AlarmMessage(0),
AlarmBeep(0), AlarmReturn(0), AlarmAck(0), gdh_started(1), AlarmBeep(0), AlarmReturn(0), AlarmAck(0), gdh_started(1),
verify(0), scantime(0.5), signal_test_mode(0), advanced_user(0), show_truedb(0) verify(0), scantime(0.5), signal_test_mode(0), advanced_user(0), show_truedb(0),
{ no_graph_ratio(0)
strcpy( version, xnav_cVersion); strcpy( time, ""); {
strcpy( ConfigureObject, ""); strcpy( AlarmLastMessage, ""); strcpy( version, xnav_cVersion); strcpy( time, "");
strcpy( AlarmText1, ""); strcpy( AlarmText2, ""); strcpy( AlarmText3, ""); strcpy( ConfigureObject, ""); strcpy( AlarmLastMessage, "");
strcpy( AlarmText4, ""); strcpy( AlarmText5, ""); strcpy( AlarmText1, ""); strcpy( AlarmText2, ""); strcpy( AlarmText3, "");
strcpy( platform, ""); strcpy( os, ""); strcpy( hw, ""); strcpy( AlarmText4, ""); strcpy( AlarmText5, "");
strcpy( node, ""); strcpy( sys, ""); strcpy( default_directory, ""); strcpy( platform, ""); strcpy( os, ""); strcpy( hw, "");
strcpy( symbolfilename, ""); strcpy( node, ""); strcpy( sys, ""); strcpy( default_directory, "");
}; strcpy( symbolfilename, "");
};
char version[10]; char version[10];
char time[80]; char time[80];
unsigned long priv; unsigned long priv;
...@@ -232,6 +233,7 @@ class XNavGbl { ...@@ -232,6 +233,7 @@ class XNavGbl {
int signal_test_mode; int signal_test_mode;
int advanced_user; int advanced_user;
int show_truedb; int show_truedb;
int no_graph_ratio;
int load_config( void *xnav); int load_config( void *xnav);
int symbolfile_exec( void *xnav); int symbolfile_exec( void *xnav);
......
...@@ -302,7 +302,7 @@ dcli_tCmdTable xnav_command_table[] = { ...@@ -302,7 +302,7 @@ dcli_tCmdTable xnav_command_table[] = {
"PRINT", "PRINT",
&xnav_print_func, &xnav_print_func,
{ "dcli_arg1", "dcli_arg2", "/NAME", "/FILE", { "dcli_arg1", "dcli_arg2", "/NAME", "/FILE",
"/OBJECT", "/OBJECT", "/CLASSGRAPH", "/INSTANCE",
""} ""}
}, },
{"",}}; {"",}};
...@@ -665,6 +665,11 @@ static int xnav_set_func( void *client_data, ...@@ -665,6 +665,11 @@ static int xnav_set_func( void *client_data,
cdh_ToLower( language_str, language_str); cdh_ToLower( language_str, language_str);
Lng::set( language_str); Lng::set( language_str);
} }
else if ( strncmp( arg1_str, "NORATIO", strlen( arg1_str)) == 0)
{
// Command is "SET NORATIO"
xnav->gbl.no_graph_ratio = 1;
}
else else
xnav->message('E',"Syntax error"); xnav->message('E',"Syntax error");
return 1; return 1;
...@@ -4275,9 +4280,29 @@ static int xnav_print_func(void *client_data, ...@@ -4275,9 +4280,29 @@ static int xnav_print_func(void *client_data,
if ( strncmp( arg1_str, "GRAPH", strlen( arg1_str)) == 0) if ( strncmp( arg1_str, "GRAPH", strlen( arg1_str)) == 0)
{ {
char file_str[80]; char file_str[80];
char name_str[80] = ""; char instance_str[80];
ge_tCtx gectx; ge_tCtx gectx;
char fname[200]; char fname[200];
int classgraph;
char *instance_p;
int sts;
if ( ODD( dcli_get_qualifier( "/INSTANCE", instance_str))) {
instance_p = instance_str;
}
else
instance_p = 0;
if ( ODD( dcli_get_qualifier( "/CLASSGRAPH", 0))) {
classgraph = 1;
if ( !instance_p) {
xnav->message('E', "Instance is missing");
return XNAV__HOLDCOMMAND;
}
}
else
classgraph = 0;
if ( ODD( dcli_get_qualifier( "dcli_arg2", file_str))) { if ( ODD( dcli_get_qualifier( "dcli_arg2", file_str))) {
if ( file_str[0] == '/') { if ( file_str[0] == '/') {
...@@ -4289,8 +4314,70 @@ static int xnav_print_func(void *client_data, ...@@ -4289,8 +4314,70 @@ static int xnav_print_func(void *client_data,
// Get base class graphs on $pwr_exe // Get base class graphs on $pwr_exe
cdh_ToLower( fname, file_str); cdh_ToLower( fname, file_str);
} }
else if ( classgraph) {
// Get file from class of instance object
pwr_sAttrRef aref;
char cname[80];
pwr_tCid cid;
char found_file[200];
if ( !instance_p) {
xnav->message('E',"Enter instance object");
return XNAV__HOLDCOMMAND;
}
sts = gdh_NameToAttrref( pwr_cNObjid, instance_p, &aref);
if ( EVEN(sts)) {
xnav->message('E',"Instance object not found");
return XNAV__HOLDCOMMAND;
}
sts = gdh_GetAttrRefTid( &aref, &cid);
while ( ODD(sts)) {
// Try all superclasses
sts = gdh_ObjidToName( cdh_ClassIdToObjid( cid), cname, sizeof(cname),
cdh_mName_object);
if ( EVEN(sts)) return sts;
cdh_ToLower( cname, cname);
if ( cdh_CidToVid(cid) < cdh_cUserClassVolMin ||
(cdh_CidToVid(cid) >= cdh_cManufactClassVolMin &&
cdh_CidToVid(cid) <= cdh_cManufactClassVolMax)) {
if ( cname[0] == '$')
sprintf( file_str, "pwr_c_%s", &cname[1]);
else
sprintf( file_str, "pwr_c_%s", cname);
}
else
strcpy( file_str, cname);
// Get base class graphs on $pwr_exe
cdh_ToLower( fname, file_str);
if ( instance_p &&
(strncmp( fname, "pwr_c_", 6) == 0 ||
strncmp( fname, "pwr_c_", 6) == 0)) {
strcpy( fname, "$pwr_exe/");
strcat( fname, file_str);
strcpy( file_str, fname);
}
else {
strcpy( fname, "$pwrp_exe/");
strcat( fname, file_str);
strcpy( file_str, fname);
}
strcat( fname, ".pwg");
sts = dcli_search_file( fname, found_file, DCLI_DIR_SEARCH_INIT);
dcli_search_file( fname, found_file, DCLI_DIR_SEARCH_END);
if ( ODD(sts)) break;
sts = gdh_GetSuperClass( cid, &cid);
}
if ( EVEN(sts)) {
xnav->message('E',"No classgraph found");
return XNAV__HOLDCOMMAND;
}
}
if ( xnav->appl.find( applist_eType_Graph, file_str, name_str, if ( xnav->appl.find( applist_eType_Graph, file_str, instance_p,
(void **) &gectx)) (void **) &gectx))
ge_print( gectx); ge_print( gectx);
else { else {
......
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