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
c7f51200
Commit
c7f51200
authored
Apr 25, 2008
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fileview, read and write object added
parent
e2e84fde
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
169 additions
and
2 deletions
+169
-2
xtt/lib/xtt/src/xtt_xnav_command.cpp
xtt/lib/xtt/src/xtt_xnav_command.cpp
+169
-2
No files found.
xtt/lib/xtt/src/xtt_xnav_command.cpp
View file @
c7f51200
/*
* Proview $Id: xtt_xnav_command.cpp,v 1.3
3 2008-01-24 09:38:28
claes Exp $
* Proview $Id: xtt_xnav_command.cpp,v 1.3
4 2008-04-25 11:29:21
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -72,6 +72,7 @@
#include "xtt_audio.h"
#include "xtt_clog.h"
#include "xtt_hist.h"
#include "xtt_fileview.h"
class
xnav_file
{
public:
...
...
@@ -186,6 +187,10 @@ static int xnav_print_func( void *client_data,
void
*
client_flag
);
static
int
xnav_sound_func
(
void
*
client_data
,
void
*
client_flag
);
static
int
xnav_write_func
(
void
*
client_data
,
void
*
client_flag
);
static
int
xnav_read_func
(
void
*
client_data
,
void
*
client_flag
);
dcli_tCmdTable
xnav_command_table
[]
=
{
{
...
...
@@ -205,7 +210,7 @@ dcli_tCmdTable xnav_command_table[] = {
"/NAVIGATOR"
,
"/CENTER"
,
"/OBJECT"
,
"/NEW"
,
"/INSTANCE"
,
"/COLLECT"
,
"/FOCUS"
,
"/INPUTEMPTY"
,
"/ENTRY"
,
"/TITLE"
,
"/ACCESS"
,
"/CLASSGRAPH"
,
"/BYPASS"
,
"/CLOSEBUTTON"
,
""
}
"/CLOSEBUTTON"
,
"
/TARGET"
,
"/TRIGGER"
,
"/TYPE"
,
"
"
}
},
{
"CLOSE"
,
...
...
@@ -339,6 +344,16 @@ dcli_tCmdTable xnav_command_table[] = {
&
xnav_sound_func
,
{
"dcli_arg1"
,
"/OBJECT"
,
""
}
},
{
"WRITE"
,
&
xnav_write_func
,
{
"dcli_arg1"
,
"/OBJECT"
,
"/FILE"
,
""
}
},
{
"READ"
,
&
xnav_read_func
,
{
"dcli_arg1"
,
"/OBJECT"
,
"/FILE"
,
""
}
},
{
""
,}};
...
...
@@ -3037,6 +3052,66 @@ static int xnav_open_func( void *client_data,
xnav
->
clog
->
close_cb
=
xnav_clog_close_cb
;
}
}
else
if
(
strncmp
(
arg1_str
,
"FILEVIEW"
,
strlen
(
arg1_str
))
==
0
)
{
XttFileview
*
fileview
;
pwr_tFileName
file_str
;
pwr_tFileName
dir_str
;
pwr_tAName
target_str
;
pwr_tAName
trigger_str
;
char
title_str
[
80
];
char
type_str
[
80
];
int
type
;
char
*
s
;
pwr_tAttrRef
aref
;
pwr_tStatus
sts
;
if
(
EVEN
(
dcli_get_qualifier
(
"/FILE"
,
dir_str
,
sizeof
(
dir_str
))))
{
xnav
->
message
(
'E'
,
"Enter file specification"
);
return
XNAV__HOLDCOMMAND
;
}
if
(
EVEN
(
dcli_get_qualifier
(
"/TARGET"
,
target_str
,
sizeof
(
target_str
))))
{
xnav
->
message
(
'E'
,
"Enter target attribute"
);
return
XNAV__HOLDCOMMAND
;
}
if
(
EVEN
(
dcli_get_qualifier
(
"/TRIGGER"
,
trigger_str
,
sizeof
(
trigger_str
))))
{
xnav
->
message
(
'E'
,
"Enter trigger attribute"
);
return
XNAV__HOLDCOMMAND
;
}
if
(
ODD
(
dcli_get_qualifier
(
"/TYPE"
,
type_str
,
sizeof
(
type_str
))))
{
if
(
strcmp
(
type_str
,
"SAVE"
)
==
0
)
type
=
fileview_eType_Save
;
else
if
(
strcmp
(
type_str
,
"OPEN"
)
==
0
)
type
=
fileview_eType_Open
;
else
{
xnav
->
message
(
'E'
,
"Type syntax error"
);
return
XNAV__HOLDCOMMAND
;
}
}
else
type
=
fileview_eType_Open
;
if
(
EVEN
(
dcli_get_qualifier
(
"/TITLE"
,
title_str
,
sizeof
(
title_str
))))
{
if
(
type
==
fileview_eType_Open
)
strcpy
(
title_str
,
"Open File"
);
else
if
(
type
==
fileview_eType_Save
)
strcpy
(
title_str
,
"Save File"
);
}
if
(
(
s
=
strrchr
(
dir_str
,
'/'
)))
{
*
s
=
0
;
strcpy
(
file_str
,
s
+
1
);
}
sts
=
gdh_NameToAttrref
(
pwr_cNObjid
,
target_str
,
&
aref
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
'E'
,
"Uable to find target object"
);
return
XNAV__HOLDCOMMAND
;
}
fileview
=
xnav
->
fileview_new
(
aref
.
Objid
,
title_str
,
dir_str
,
file_str
,
type
,
target_str
,
trigger_str
);
}
else
xnav
->
message
(
'E'
,
"Syntax error"
);
...
...
@@ -4604,6 +4679,98 @@ static int xnav_sound_func(void *client_data,
return
XNAV__SUCCESS
;
}
static
int
xnav_write_func
(
void
*
client_data
,
void
*
client_flag
)
{
XNav
*
xnav
=
(
XNav
*
)
client_data
;
char
arg1_str
[
80
];
int
arg1_sts
;
arg1_sts
=
dcli_get_qualifier
(
"dcli_arg1"
,
arg1_str
,
sizeof
(
arg1_str
));
if
(
strncmp
(
arg1_str
,
"OBJECT"
,
strlen
(
arg1_str
))
==
0
)
{
pwr_tOName
object_str
;
pwr_tFileName
file_str
;
int
sts
;
pwr_tAttrRef
aref
;
if
(
EVEN
(
dcli_get_qualifier
(
"/OBJECT"
,
object_str
,
sizeof
(
object_str
))))
{
if
(
EVEN
(
dcli_get_qualifier
(
"dcli_arg2"
,
object_str
,
sizeof
(
object_str
))))
{
xnav
->
message
(
'E'
,
"Object is missing"
);
return
XNAV__HOLDCOMMAND
;
}
}
if
(
EVEN
(
dcli_get_qualifier
(
"/FILE"
,
file_str
,
sizeof
(
file_str
))))
{
xnav
->
message
(
'E'
,
"Enter file"
);
return
XNAV__HOLDCOMMAND
;
}
sts
=
gdh_NameToAttrref
(
pwr_cNObjid
,
object_str
,
&
aref
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
'E'
,
"Object not found"
);
return
XNAV__HOLDCOMMAND
;
}
sts
=
gdh_FWriteObject
(
file_str
,
&
aref
);
if
(
EVEN
(
sts
))
xnav
->
message
(
' '
,
XNav
::
get_message
(
sts
));
}
else
{
xnav
->
message
(
'E'
,
"Syntax error"
);
return
XNAV__HOLDCOMMAND
;
}
return
XNAV__SUCCESS
;
}
static
int
xnav_read_func
(
void
*
client_data
,
void
*
client_flag
)
{
XNav
*
xnav
=
(
XNav
*
)
client_data
;
char
arg1_str
[
80
];
int
arg1_sts
;
arg1_sts
=
dcli_get_qualifier
(
"dcli_arg1"
,
arg1_str
,
sizeof
(
arg1_str
));
if
(
strncmp
(
arg1_str
,
"OBJECT"
,
strlen
(
arg1_str
))
==
0
)
{
pwr_tOName
object_str
;
pwr_tFileName
file_str
;
int
sts
;
pwr_tAttrRef
aref
;
if
(
EVEN
(
dcli_get_qualifier
(
"/OBJECT"
,
object_str
,
sizeof
(
object_str
))))
{
if
(
EVEN
(
dcli_get_qualifier
(
"dcli_arg2"
,
object_str
,
sizeof
(
object_str
))))
{
xnav
->
message
(
'E'
,
"Object is missing"
);
return
XNAV__HOLDCOMMAND
;
}
}
if
(
EVEN
(
dcli_get_qualifier
(
"/FILE"
,
file_str
,
sizeof
(
file_str
))))
{
xnav
->
message
(
'E'
,
"Enter file"
);
return
XNAV__HOLDCOMMAND
;
}
sts
=
gdh_NameToAttrref
(
pwr_cNObjid
,
object_str
,
&
aref
);
if
(
EVEN
(
sts
))
{
xnav
->
message
(
'E'
,
"Object not found"
);
return
XNAV__HOLDCOMMAND
;
}
sts
=
gdh_FReadObject
(
file_str
,
&
aref
);
if
(
EVEN
(
sts
))
xnav
->
message
(
' '
,
XNav
::
get_message
(
sts
));
}
else
{
xnav
->
message
(
'E'
,
"Syntax error"
);
return
XNAV__HOLDCOMMAND
;
}
return
XNAV__SUCCESS
;
}
int
XNav
::
show_database
()
{
int
sts
;
...
...
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