Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
691e5a57
Commit
691e5a57
authored
Jan 23, 2004
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Connect function via X selection implemented
parent
d9e8fa9f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
182 additions
and
78 deletions
+182
-78
src/lib/co/src/co_wow.c
src/lib/co/src/co_wow.c
+67
-2
src/lib/co/src/co_wow.h
src/lib/co/src/co_wow.h
+10
-0
xtt/lib/ge/src/ge.cpp
xtt/lib/ge/src/ge.cpp
+105
-76
No files found.
src/lib/co/src/co_wow.c
View file @
691e5a57
...
@@ -21,21 +21,32 @@
...
@@ -21,21 +21,32 @@
#include <Xm/MainW.h>
#include <Xm/MainW.h>
#include <Xm/FileSB.h>
#include <Xm/FileSB.h>
#include <Xm/Form.h>
#include <Xm/Form.h>
#include <X11/Xatom.h>
#include <X11/Xmu/Atoms.h>
#include <X11/Xmu/StdSel.h>
#include "pwr.h"
#include "pwr.h"
#include "co_dcli.h"
#include "co_dcli.h"
#include "co_wow.h"
#include "co_wow.h"
#include "flow_x.h"
#define WOW_MAXNAMES 400
#define WOW_MAXNAMES 400
typedef
struct
typedef
struct
{
{
void
*
ctx
;
void
*
ctx
;
void
*
data
;
void
*
data
;
void
(
*
questionbox_ok
)
();
void
(
*
questionbox_ok
)
();
void
(
*
questionbox_cancel
)
();
void
(
*
questionbox_cancel
)
();
}
wow_t_question_cb
;
}
wow_t_question_cb
;
typedef
struct
{
char
str
[
200
];
int
len
;
int
received
;
pwr_tStatus
sts
;
Atom
atom
;
}
wow_sSelection
;
static
void
wow_question_ok_cb
(
static
void
wow_question_ok_cb
(
Widget
dialog
,
Widget
dialog
,
XtPointer
data
,
XtPointer
data
,
...
@@ -639,6 +650,60 @@ void wow_GetCSText( XmString ar_value, char *t_buffer)
...
@@ -639,6 +650,60 @@ void wow_GetCSText( XmString ar_value, char *t_buffer)
}
}
#endif
#endif
static
void
wow_get_selection_cb
(
Widget
w
,
XtPointer
clientdata
,
Atom
*
selection
,
Atom
*
type
,
XtPointer
value
,
unsigned
long
*
len
,
int
*
format
)
{
wow_sSelection
*
data
=
(
wow_sSelection
*
)
clientdata
;
if
(
*
len
!=
0
&&
value
!=
NULL
)
{
if
(
*
type
==
data
->
atom
)
{
if
(
*
len
>
sizeof
(
data
->
str
)
-
1
)
{
data
->
sts
=
0
;
return
;
}
strncpy
(
data
->
str
,
(
char
*
)
value
,
*
len
);
data
->
str
[
*
len
]
=
0
;
data
->
len
=
*
len
;
data
->
sts
=
1
;
}
else
data
->
sts
=
0
;
}
else
data
->
sts
=
0
;
XtFree
(
(
char
*
)
value
);
data
->
received
=
1
;
}
int
wow_GetSelection
(
Widget
w
,
char
*
str
,
int
size
,
Atom
atom
)
{
wow_sSelection
data
;
data
.
received
=
0
;
data
.
atom
=
atom
;
XtGetSelectionValue
(
w
,
XA_PRIMARY
,
atom
,
wow_get_selection_cb
,
&
data
,
CurrentTime
);
while
(
!
data
.
received
)
{
XEvent
e
;
XtAppNextEvent
(
XtWidgetToApplicationContext
(
w
),
&
e
);
XtDispatchEvent
(
&
e
);
}
if
(
data
.
sts
&&
data
.
len
<
size
)
strcpy
(
str
,
data
.
str
);
return
data
.
sts
;
}
void
wow_GetAtoms
(
Widget
w
,
Atom
*
graph_atom
,
Atom
*
objid_atom
,
Atom
*
attrref_atom
)
{
if
(
graph_atom
)
*
graph_atom
=
XInternAtom
(
flow_Display
(
w
),
"PWR_GRAPH"
,
False
);
if
(
objid_atom
)
*
objid_atom
=
XInternAtom
(
flow_Display
(
w
),
"PWR_OBJID"
,
False
);
if
(
attrref_atom
)
*
attrref_atom
=
XInternAtom
(
flow_Display
(
w
),
"PWR_ATTRREF"
,
False
);
}
...
...
src/lib/co/src/co_wow.h
View file @
691e5a57
...
@@ -9,6 +9,11 @@
...
@@ -9,6 +9,11 @@
<Description>. */
<Description>. */
#include <Xm/Xm.h>
#include <Xm/Xm.h>
#include <X11/Xatom.h>
#if defined __cplusplus
extern
"C"
{
#endif
typedef
enum
{
typedef
enum
{
wow_eFileSelType_All
,
wow_eFileSelType_All
,
...
@@ -71,7 +76,12 @@ void wow_CreateFileSelDia( Widget parent_wid,
...
@@ -71,7 +76,12 @@ void wow_CreateFileSelDia( Widget parent_wid,
void
wow_GetLabel
(
Widget
w
,
char
*
label
);
void
wow_GetLabel
(
Widget
w
,
char
*
label
);
void
wow_GetCSText
(
XmString
ar_value
,
char
*
t_buffer
);
void
wow_GetCSText
(
XmString
ar_value
,
char
*
t_buffer
);
int
wow_GetSelection
(
Widget
w
,
char
*
str
,
int
size
,
Atom
atom
);
void
wow_GetAtoms
(
Widget
w
,
Atom
*
graph_atom
,
Atom
*
objid_atom
,
Atom
*
attrref_atom
);
#if defined __cplusplus
}
#endif
#endif
#endif
...
...
xtt/lib/ge/src/ge.cpp
View file @
691e5a57
...
@@ -122,6 +122,7 @@ typedef struct ge_sCtx {
...
@@ -122,6 +122,7 @@ typedef struct ge_sCtx {
void
*
focused_component
;
void
*
focused_component
;
grow_tObject
recover_object
;
grow_tObject
recover_object
;
char
recover_name
[
80
];
char
recover_name
[
80
];
Atom
graph_atom
;
}
*
ge_tCtx
;
}
*
ge_tCtx
;
// Static variables
// Static variables
...
@@ -847,14 +848,22 @@ static int ge_get_plant_select_cb( void *ge_ctx, char *select_name)
...
@@ -847,14 +848,22 @@ static int ge_get_plant_select_cb( void *ge_ctx, char *select_name)
char
*
s
;
char
*
s
;
if
(
!
gectx
->
ldhses
)
if
(
!
gectx
->
ldhses
)
{
return
0
;
sts
=
wow_GetSelection
(
gectx
->
toplevel
,
str
,
sizeof
(
str
),
gectx
->
graph_atom
);
if
(
ODD
(
sts
))
strcpy
(
select_name
,
str
);
else
{
sts
=
wow_GetSelection
(
gectx
->
toplevel
,
str
,
sizeof
(
str
),
XA_STRING
);
if
(
ODD
(
sts
))
strcpy
(
select_name
,
str
);
}
return
sts
;
}
sts
=
plant_get_select
(
gectx
->
plantctx
,
&
attrref
,
&
is_attrref
);
sts
=
plant_get_select
(
gectx
->
plantctx
,
&
attrref
,
&
is_attrref
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
ODD
(
sts
))
{
if
(
is_attrref
)
if
(
is_attrref
)
{
{
sts
=
ldh_AttrRefToName
(
gectx
->
ldhses
,
&
attrref
,
ldh_eName_Aref
,
sts
=
ldh_AttrRefToName
(
gectx
->
ldhses
,
&
attrref
,
ldh_eName_Aref
,
&
str_p
,
&
size
);
&
str_p
,
&
size
);
...
@@ -868,8 +877,7 @@ static int ge_get_plant_select_cb( void *ge_ctx, char *select_name)
...
@@ -868,8 +877,7 @@ static int ge_get_plant_select_cb( void *ge_ctx, char *select_name)
sts
=
ldh_GetObjectClass
(
gectx
->
ldhses
,
attrref
.
Objid
,
&
classid
);
sts
=
ldh_GetObjectClass
(
gectx
->
ldhses
,
attrref
.
Objid
,
&
classid
);
if
(
EVEN
(
sts
))
return
0
;
if
(
EVEN
(
sts
))
return
0
;
}
}
else
else
{
{
sts
=
ldh_ObjidToName
(
gectx
->
ldhses
,
attrref
.
Objid
,
ldh_eName_Hierarchy
,
sts
=
ldh_ObjidToName
(
gectx
->
ldhses
,
attrref
.
Objid
,
ldh_eName_Hierarchy
,
str
,
sizeof
(
str
),
&
size
);
str
,
sizeof
(
str
),
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
EVEN
(
sts
))
return
sts
;
...
@@ -881,8 +889,7 @@ static int ge_get_plant_select_cb( void *ge_ctx, char *select_name)
...
@@ -881,8 +889,7 @@ static int ge_get_plant_select_cb( void *ge_ctx, char *select_name)
sts
=
ldh_GetClassBody
(
gectx
->
ldhses
,
classid
,
sts
=
ldh_GetClassBody
(
gectx
->
ldhses
,
classid
,
"GraphPlcNode"
,
&
body_class
,
(
char
**
)
&
graph_body
,
&
size
);
"GraphPlcNode"
,
&
body_class
,
(
char
**
)
&
graph_body
,
&
size
);
if
(
ODD
(
sts
))
if
(
ODD
(
sts
))
{
{
strcpy
(
attr_name
,
graph_body
->
debugpar
);
strcpy
(
attr_name
,
graph_body
->
debugpar
);
}
}
else
else
...
@@ -897,8 +904,7 @@ static int ge_get_plant_select_cb( void *ge_ctx, char *select_name)
...
@@ -897,8 +904,7 @@ static int ge_get_plant_select_cb( void *ge_ctx, char *select_name)
// Check that attribute exists
// Check that attribute exists
sts
=
ldh_NameToAttrRef
(
gectx
->
ldhses
,
name
,
&
attr_ref
);
sts
=
ldh_NameToAttrRef
(
gectx
->
ldhses
,
name
,
&
attr_ref
);
if
(
ODD
(
sts
))
if
(
ODD
(
sts
))
{
{
// If attribute is an array element get attribute definition for
// If attribute is an array element get attribute definition for
// the array.
// the array.
if
(
(
p1
=
strstr
(
attr_name
,
"["
)))
if
(
(
p1
=
strstr
(
attr_name
,
"["
)))
...
@@ -909,15 +915,13 @@ static int ge_get_plant_select_cb( void *ge_ctx, char *select_name)
...
@@ -909,15 +915,13 @@ static int ge_get_plant_select_cb( void *ge_ctx, char *select_name)
sts
=
ldh_GetAttrDef
(
gectx
->
ldhses
,
classid
,
"SysBody"
,
sts
=
ldh_GetAttrDef
(
gectx
->
ldhses
,
classid
,
"SysBody"
,
attr_name
,
&
attr_def
);
attr_name
,
&
attr_def
);
if
(
ODD
(
sts
)
&&
gectx
->
graph
->
type_to_string
(
attr_def
.
Par
->
Input
.
Info
.
Type
,
if
(
ODD
(
sts
)
&&
gectx
->
graph
->
type_to_string
(
attr_def
.
Par
->
Input
.
Info
.
Type
,
type_buff
,
NULL
))
type_buff
,
NULL
))
{
{
char
num
[
8
];
char
num
[
8
];
if
(
(
p2
=
strstr
(
buff
,
"["
)))
if
(
(
p2
=
strstr
(
buff
,
"["
)))
*
p2
=
'\0'
;
*
p2
=
'\0'
;
if
(
attr_def
.
Par
->
Input
.
Info
.
Type
==
pwr_eType_String
)
if
(
attr_def
.
Par
->
Input
.
Info
.
Type
==
pwr_eType_String
)
{
{
sprintf
(
num
,
"%d"
,
attr_def
.
Par
->
Input
.
Info
.
Size
/
attr_def
.
Par
->
Input
.
Info
.
Elements
);
sprintf
(
num
,
"%d"
,
attr_def
.
Par
->
Input
.
Info
.
Size
/
attr_def
.
Par
->
Input
.
Info
.
Elements
);
strcat
(
type_buff
,
num
);
strcat
(
type_buff
,
num
);
}
}
...
@@ -925,8 +929,7 @@ static int ge_get_plant_select_cb( void *ge_ctx, char *select_name)
...
@@ -925,8 +929,7 @@ static int ge_get_plant_select_cb( void *ge_ctx, char *select_name)
strcat
(
buff
,
type_buff
);
strcat
(
buff
,
type_buff
);
// Check if array
// Check if array
if
(
p1
)
if
(
p1
)
{
{
sprintf
(
&
buff
[
strlen
(
buff
)],
"#%d"
,
sprintf
(
&
buff
[
strlen
(
buff
)],
"#%d"
,
attr_def
.
Par
->
Input
.
Info
.
Elements
);
attr_def
.
Par
->
Input
.
Info
.
Elements
);
*
p1
=
'['
;
*
p1
=
'['
;
...
@@ -936,8 +939,31 @@ static int ge_get_plant_select_cb( void *ge_ctx, char *select_name)
...
@@ -936,8 +939,31 @@ static int ge_get_plant_select_cb( void *ge_ctx, char *select_name)
}
}
strcpy
(
select_name
,
buff
);
strcpy
(
select_name
,
buff
);
return
1
;
return
1
;
}
else
{
sts
=
wow_GetSelection
(
gectx
->
toplevel
,
str
,
sizeof
(
str
),
gectx
->
graph_atom
);
if
(
ODD
(
sts
))
strcpy
(
select_name
,
str
);
else
{
sts
=
wow_GetSelection
(
gectx
->
toplevel
,
str
,
sizeof
(
str
),
XA_STRING
);
if
(
ODD
(
sts
))
strcpy
(
select_name
,
str
);
}
return
sts
;
}
#else
#else
return
0
;
pwr_tStatus
sts
;
ge_tCtx
gectx
=
(
ge_tCtx
)
ge_ctx
;
sts
=
wow_GetSelection
(
gectx
->
toplevel
,
str
,
sizeof
(
str
),
gectx
->
graph_atom
);
if
(
ODD
(
sts
))
strcpy
(
select_name
,
str
);
else
{
sts
=
wow_GetSelection
(
gectx
->
toplevel
,
str
,
sizeof
(
str
),
XA_STRING
);
if
(
ODD
(
sts
))
strcpy
(
select_name
,
str
);
}
return
sts
;
#endif
#endif
}
}
...
@@ -2912,6 +2938,9 @@ void *ge_new( void *parent_ctx,
...
@@ -2912,6 +2938,9 @@ void *ge_new( void *parent_ctx,
flow_AddCloseVMProtocolCb
(
gectx
->
toplevel
,
flow_AddCloseVMProtocolCb
(
gectx
->
toplevel
,
(
XtCallbackProc
)
ge_activate_exit
,
gectx
);
(
XtCallbackProc
)
ge_activate_exit
,
gectx
);
// Get proview defined selection atoms
wow_GetAtoms
(
gectx
->
toplevel
,
&
gectx
->
graph_atom
,
0
,
0
);
ge_get_systemname
(
systemname
);
ge_get_systemname
(
systemname
);
gectx
->
graph
->
set_systemname
(
systemname
);
gectx
->
graph
->
set_systemname
(
systemname
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment