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
ee2dae07
Commit
ee2dae07
authored
Mar 19, 2015
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wb text editor for text and code attributes
parent
0c3eb346
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1090 additions
and
64 deletions
+1090
-64
src/msg/wb/src/wb_watt_msg.msg
src/msg/wb/src/wb_watt_msg.msg
+1
-0
wb/lib/wb/gtk/wb_foe_gtk.cpp
wb/lib/wb/gtk/wb_foe_gtk.cpp
+38
-15
wb/lib/wb/gtk/wb_foe_gtk.h
wb/lib/wb/gtk/wb_foe_gtk.h
+6
-0
wb/lib/wb/gtk/wb_watttext_gtk.cpp
wb/lib/wb/gtk/wb_watttext_gtk.cpp
+449
-0
wb/lib/wb/gtk/wb_watttext_gtk.h
wb/lib/wb/gtk/wb_watttext_gtk.h
+99
-0
wb/lib/wb/gtk/wb_wnav_gtk.cpp
wb/lib/wb/gtk/wb_wnav_gtk.cpp
+6
-0
wb/lib/wb/gtk/wb_wnav_gtk.h
wb/lib/wb/gtk/wb_wnav_gtk.h
+2
-0
wb/lib/wb/src/wb_foe.cpp
wb/lib/wb/src/wb_foe.cpp
+153
-34
wb/lib/wb/src/wb_foe.h
wb/lib/wb/src/wb_foe.h
+31
-14
wb/lib/wb/src/wb_utility.h
wb/lib/wb/src/wb_utility.h
+2
-1
wb/lib/wb/src/wb_watttext.cpp
wb/lib/wb/src/wb_watttext.cpp
+146
-0
wb/lib/wb/src/wb_watttext.h
wb/lib/wb/src/wb_watttext.h
+102
-0
wb/lib/wb/src/wb_wnav.h
wb/lib/wb/src/wb_wnav.h
+5
-0
wb/lib/wb/src/wb_wnav_command.cpp
wb/lib/wb/src/wb_wnav_command.cpp
+29
-0
wb/lib/wb/src/wb_wtt.cpp
wb/lib/wb/src/wb_wtt.cpp
+21
-0
No files found.
src/msg/wb/src/wb_watt_msg.msg
View file @
ee2dae07
...
...
@@ -47,3 +47,4 @@ flagstate <State attribute> /error
disappeard <Item has disappeard> /error
nochildren <Item has no children> /error
attrnotfound <Attribute is not found> /error
notext <Attribute is not a text attribute> /error
wb/lib/wb/gtk/wb_foe_gtk.cpp
View file @
ee2dae07
...
...
@@ -60,6 +60,7 @@
#include <gdk/gdkkeysyms.h>
#include "wb_watt_gtk.h"
#include "wb_watttext_gtk.h"
#include "wb_gre_gtk.h"
#include "wb_foe_gtk.h"
#include "cow_login.h"
...
...
@@ -359,6 +360,14 @@ void WFoeGtk::activate_attribute( GtkWidget *w, gpointer data)
foe
->
activate_attribute
();
}
// Callback from the menu.
void
WFoeGtk
::
activate_editcode
(
GtkWidget
*
w
,
gpointer
data
)
{
WFoe
*
foe
=
(
WFoe
*
)
data
;
foe
->
activate_editcode
();
}
// Callback from the menu.
void
WFoeGtk
::
activate_subwindow
(
GtkWidget
*
w
,
gpointer
data
)
...
...
@@ -900,24 +909,27 @@ typedef void (*gtk_tCallback)(GtkWidget *,gpointer);
int
WFoeGtk
::
modify_popup
(
unsigned
long
popupmenu_mask
,
int
x
,
int
y
)
{
static
char
buttontext
[][
40
]
=
{
"ObjectEditor"
,
"SubWindow"
,
"Connect"
,
"Delete"
,
"Paste"
,
"Copy"
,
"Cut"
,
"PrintSelect"
,
"HelpClass"
,
"CreateObject"
};
static
gtk_tCallback
menu_callbacks
[]
=
{
WFoeGtk
::
activate_attribute
,
WFoeGtk
::
activate_subwindow
,
WFoeGtk
::
activate_getobj
,
WFoeGtk
::
activate_delete
,
WFoeGtk
::
activate_paste
,
WFoeGtk
::
activate_copy
,
WFoeGtk
::
activate_cut
,
WFoeGtk
::
activate_printselect
,
WFoeGtk
::
activate_helpclass
,
WFoeGtk
::
activate_createobject
};
static
const
int
bsize
=
12
;
static
char
buttontext
[
bsize
][
40
]
=
{
"ObjectEditor"
,
"SubWindow"
,
"Connect"
,
"Delete"
,
"Paste"
,
"Copy"
,
"Cut"
,
"PrintSelect"
,
"HelpClass"
,
"CreateObject"
,
"EditCode"
,
"EditText"
};
static
gtk_tCallback
menu_callbacks
[
bsize
]
=
{
WFoeGtk
::
activate_attribute
,
WFoeGtk
::
activate_subwindow
,
WFoeGtk
::
activate_getobj
,
WFoeGtk
::
activate_delete
,
WFoeGtk
::
activate_paste
,
WFoeGtk
::
activate_copy
,
WFoeGtk
::
activate_cut
,
WFoeGtk
::
activate_printselect
,
WFoeGtk
::
activate_helpclass
,
WFoeGtk
::
activate_createobject
,
WFoeGtk
::
activate_editcode
,
WFoeGtk
::
activate_editcode
};
popupmenu_x
=
x
+
5
;
popupmenu_y
=
y
;
GtkMenu
*
menu
=
(
GtkMenu
*
)
g_object_new
(
GTK_TYPE_MENU
,
NULL
);
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
for
(
int
i
=
0
;
i
<
bsize
;
i
++
)
{
if
(
popupmenu_mask
&
(
1
<<
i
))
{
GtkWidget
*
w
=
gtk_menu_item_new_with_label
(
buttontext
[
i
]);
g_signal_connect
(
w
,
"activate"
,
...
...
@@ -987,6 +999,17 @@ WAtt *WFoeGtk::watt_new( void *a_parent_ctx,
return
watt
;
}
WAttText
*
WFoeGtk
::
watttext_new
(
void
*
a_parent_ctx
,
ldh_tSesContext
a_ldhses
,
pwr_sAttrRef
a_aref
,
int
a_editmode
,
pwr_tStatus
*
status
)
{
WAttTextGtk
*
watttext
=
new
WAttTextGtk
(
parent_wid
,
a_parent_ctx
,
a_ldhses
,
a_aref
,
a_editmode
,
status
);
return
watttext
;
}
//
// Destroys a foe instance.
// Destroys the widget and frees allocated memory for the
...
...
wb/lib/wb/gtk/wb_foe_gtk.h
View file @
ee2dae07
...
...
@@ -163,6 +163,11 @@ class WFoeGtk : public WFoe {
int
a_editmode
,
int
a_advanced_user
,
int
a_display_objectname
);
virtual
WAttText
*
watttext_new
(
void
*
a_parent_ctx
,
ldh_tSesContext
a_ldhses
,
pwr_sAttrRef
a_aref
,
int
a_editmode
,
pwr_tStatus
*
status
);
virtual
WFoe
*
subwindow_new
(
void
*
f_parent_ctx
,
char
*
f_name
,
pwr_tObjid
plcprogram
,
...
...
@@ -245,6 +250,7 @@ class WFoeGtk : public WFoe {
static
void
activate_move_up
(
GtkWidget
*
w
,
gpointer
foe
);
static
void
activate_move_down
(
GtkWidget
*
w
,
gpointer
foe
);
static
void
activate_attribute
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_editcode
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_subwindow
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_undelete
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_unselect
(
GtkWidget
*
w
,
gpointer
data
);
...
...
wb/lib/wb/gtk/wb_watttext_gtk.cpp
0 → 100644
View file @
ee2dae07
This diff is collapsed.
Click to expand it.
wb/lib/wb/gtk/wb_watttext_gtk.h
0 → 100644
View file @
ee2dae07
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2014 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
**/
#ifndef wb_watttext_gtk_h
#define wb_watttext_gtk_h
/* wb_watttext_gtk.h -- Object attribute editor */
#ifndef wb_watttext_h
# include "wb_watttext.h"
#endif
#ifndef cow_wow_gtk_h
# include "cow_wow_gtk.h"
#endif
class
WAttTextGtk
:
public
WAttText
{
public:
WAttTextGtk
(
GtkWidget
*
wa_parent_wid
,
void
*
wa_parent_ctx
,
ldh_tSesContext
wa_ldhses
,
pwr_sAttrRef
wa_aref
,
int
wa_editmode
,
pwr_tStatus
*
status
);
~
WAttTextGtk
();
GtkWidget
*
parent_wid
;
GtkWidget
*
toplevel
;
GtkWidget
*
msg_label
;
GtkWidget
*
vbox
;
GtkWidget
*
textview
;
GtkWidget
*
button_ok
;
GtkWidget
*
button_apply
;
GtkWidget
*
button_cancel
;
GtkTextBuffer
*
textbuffer
;
int
input_max_length
;
int
init
;
void
message
(
char
severity
,
const
char
*
message
);
void
pop
();
void
set_editmode
(
int
editmode
,
ldh_tSesContext
ldhses
);
void
set_attr_value
();
static
void
activate_exit
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_save
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_copy
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_cut
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_paste
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_help
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_ok
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_apply
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_cancel
(
GtkWidget
*
w
,
gpointer
data
);
static
gboolean
action_inputfocus
(
GtkWidget
*
w
,
GdkEvent
*
event
,
gpointer
data
);
static
void
action_text_changed
(
GtkTextBuffer
*
w
,
gpointer
data
);
static
void
action_text_inserted
(
GtkTextBuffer
*
w
,
GtkTextIter
*
arg1
,
gchar
*
arg2
,
gint
arg3
,
gpointer
data
);
};
#endif
wb/lib/wb/gtk/wb_wnav_gtk.cpp
View file @
ee2dae07
...
...
@@ -73,6 +73,7 @@ extern "C" {
#include "wb_xcrr_gtk.h"
#include "wb_bckw_gtk.h"
#include "wb_expw_gtk.h"
#include "wb_watttext_gtk.h"
#define max(Dragon,Eagle) ((Dragon) > (Eagle) ? (Dragon) : (Eagle))
#define min(Dragon,Eagle) ((Dragon) < (Eagle) ? (Dragon) : (Eagle))
...
...
@@ -483,6 +484,11 @@ WbExpW *WNavGtk::expw_new( char *name, int type, pwr_tStatus *status)
return
new
WbExpWGtk
(
this
,
parent_wid
,
ldhses
,
name
,
type
,
1
,
status
);
}
WAttText
*
WNavGtk
::
watttext_new
(
pwr_tAttrRef
aref
,
int
editmode
,
pwr_tStatus
*
status
)
{
return
new
WAttTextGtk
(
parent_wid
,
this
,
ldhses
,
aref
,
editmode
,
status
);
}
void
WNavGtk
::
wge_subwindow_loop
(
WGe
*
wge
)
{
gtk_main
();
...
...
wb/lib/wb/gtk/wb_wnav_gtk.h
View file @
ee2dae07
...
...
@@ -42,6 +42,7 @@
/* wtt_wnav_gtk.h -- Simple navigator */
class
CoLogin
;
class
WAttText
;
class
WNavGtk
:
public
WNav
{
public:
...
...
@@ -98,6 +99,7 @@ class WNavGtk : public WNav {
WCrr
*
wcrr_new
(
pwr_tAttrRef
*
aref
,
pwr_tStatus
*
status
);
WbBckW
*
bckw_new
(
char
*
name
,
wb_bck_list
*
list
,
pwr_tStatus
*
status
);
WbExpW
*
expw_new
(
char
*
name
,
int
type
,
pwr_tStatus
*
status
);
WAttText
*
watttext_new
(
pwr_tAttrRef
aref
,
int
editmode
,
pwr_tStatus
*
status
);
static
void
trace_scan
(
WNavGtk
*
wnav
);
static
void
sel_lose_cb
(
GtkWidget
*
w
,
GdkEventSelection
*
event
,
...
...
wb/lib/wb/src/wb_foe.cpp
View file @
ee2dae07
This diff is collapsed.
Click to expand it.
wb/lib/wb/src/wb_foe.h
View file @
ee2dae07
...
...
@@ -77,30 +77,39 @@ typedef enum {
foe_eFuncAccess_Edit
=
1
<<
1
}
foe_eFuncAccess
;
enum
foe_e_popupmenu
{
foe_e_popupmenu_attribute
=
1
<<
0
,
foe_e_popupmenu_subwindow
=
1
<<
1
,
foe_e_popupmenu_connect
=
1
<<
2
,
foe_e_popupmenu_delete
=
1
<<
3
,
foe_e_popupmenu_paste
=
1
<<
4
,
foe_e_popupmenu_copy
=
1
<<
5
,
foe_e_popupmenu_cut
=
1
<<
6
,
foe_e_popupmenu_printselect
=
1
<<
7
,
foe_e_popupmenu_helpclass
=
1
<<
8
,
foe_e_popupmenu_createobject
=
1
<<
9
enum
foe_ePopupmenu
{
foe_ePopupmenu_attribute
=
1
<<
0
,
foe_ePopupmenu_subwindow
=
1
<<
1
,
foe_ePopupmenu_connect
=
1
<<
2
,
foe_ePopupmenu_delete
=
1
<<
3
,
foe_ePopupmenu_paste
=
1
<<
4
,
foe_ePopupmenu_copy
=
1
<<
5
,
foe_ePopupmenu_cut
=
1
<<
6
,
foe_ePopupmenu_printselect
=
1
<<
7
,
foe_ePopupmenu_helpclass
=
1
<<
8
,
foe_ePopupmenu_createobject
=
1
<<
9
,
foe_ePopupmenu_editcode
=
1
<<
10
,
foe_ePopupmenu_edittext
=
1
<<
11
};
class
WFoe
;
class
WAtt
;
class
WAttText
;
class
CoWow
;
class
Pal
;
class
Nav
;
class
wb_build_opt
;
typedef
enum
{
foe_eAttr_WAtt
,
foe_eAttr_WAttText
}
foe_eAttr
;
typedef
struct
{
void
*
a_ctx
;
WFoe
*
foe
;
vldh_t_node
node
;
foe_eAttr
type
;
}
foe_sAttr
;
...
...
@@ -176,6 +185,11 @@ class WFoe : public WUtility {
int
a_advanced_user
,
int
a_display_objectname
)
{
return
0
;}
virtual
WAttText
*
watttext_new
(
void
*
a_parent_ctx
,
ldh_tSesContext
a_ldhses
,
pwr_sAttrRef
a_aref
,
int
a_editmode
,
pwr_tStatus
*
status
)
{
*
status
=
0
;
return
0
;}
virtual
WFoe
*
subwindow_new
(
void
*
f_parent_ctx
,
char
*
f_name
,
pwr_tObjid
plcprogram
,
...
...
@@ -240,6 +254,7 @@ class WFoe : public WUtility {
void
activate_scroll
(
flow_eDirection
dir
);
void
activate_move_object
(
flow_eDirection
dir
);
void
activate_attribute
();
void
activate_editcode
();
void
activate_subwindow
();
void
activate_undelete
();
void
activate_unselect
();
...
...
@@ -275,6 +290,7 @@ class WFoe : public WUtility {
void
enable_ldh_cb
();
void
disable_ldh_cb
();
int
attr_create
(
vldh_t_node
node
);
int
attredit_create
(
vldh_t_node
node
,
const
char
*
aname
);
int
attr_delete
();
void
attr_set_editmode
(
int
mode
);
int
parent_quit
();
...
...
@@ -323,11 +339,12 @@ class WFoe : public WUtility {
static
pwr_tStatus
ldh_this_session_cb
(
void
*
ctx
,
ldh_sEvent
*
event
);
static
void
error_msg
(
unsigned
long
sts
);
static
void
info_msg
(
unsigned
long
sts
);
static
int
attrlist_get
(
void
*
a_ctx
,
WFoe
**
foe
,
vldh_t_node
*
node
);
static
int
attrlist_get_by_node
(
vldh_t_node
node
,
void
**
a_ctx
);
static
int
attrlist_insert
(
void
*
a_ctx
,
WFoe
*
foe
,
vldh_t_node
node
);
static
int
attrlist_get
(
void
*
a_ctx
,
foe_eAttr
type
,
WFoe
**
foe
,
vldh_t_node
*
node
);
static
int
attrlist_get_by_node
(
vldh_t_node
node
,
foe_eAttr
type
,
void
**
a_ctx
);
static
int
attrlist_insert
(
void
*
a_ctx
,
WFoe
*
foe
,
vldh_t_node
node
,
foe_eAttr
type
);
static
int
attrlist_delete
(
void
*
a_ctx
);
static
void
attr_quit
(
void
*
a_ctx
);
static
void
attredit_quit
(
void
*
a_ctx
);
static
void
edit_exit_save
(
WFoe
*
foe
);
static
void
edit_exit_nosave
(
WFoe
*
foe
);
static
void
delete_subwindow_ok_cb
(
void
*
ctx
,
void
*
data
);
...
...
wb/lib/wb/src/wb_utility.h
View file @
ee2dae07
...
...
@@ -46,7 +46,8 @@ typedef enum {
wb_eUtility_Distributor
=
1002
,
wb_eUtility_SpreadsheetEditor
=
1003
,
wb_eUtility_Cmd
=
1004
,
wb_eUtility_WNav
=
1005
wb_eUtility_WNav
=
1005
,
wb_eUtility_AttrTextEditor
=
1006
}
wb_eUtility
;
class
WUtility
{
...
...
wb/lib/wb/src/wb_watttext.cpp
0 → 100644
View file @
ee2dae07
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2014 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
**/
/* wb_watttext.cpp -- Display object attributes */
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_time.h"
#include "wb_watt_msg.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "wb_watttext.h"
#include "wb_wtt.h"
#include "wb_wnav.h"
#include "cow_xhelp.h"
void
WAttText
::
message_cb
(
void
*
watttext
,
char
severity
,
const
char
*
message
)
{
((
WAttText
*
)
watttext
)
->
message
(
severity
,
message
);
}
void
WAttText
::
activate_exit
()
{
if
(
modified
)
wow
->
DisplayQuestion
(
this
,
"Close text editor"
,
"Do you want to insert text"
,
exit_ok
,
exit_cancel
,
this
);
else
{
if
(
close_cb
)
(
close_cb
)(
this
);
else
delete
this
;
}
}
void
WAttText
::
exit_ok
(
void
*
ctx
,
void
*
data
)
{
WAttText
*
watttext
=
(
WAttText
*
)
ctx
;
watttext
->
set_attr_value
();
if
(
watttext
->
close_cb
)
(
watttext
->
close_cb
)(
watttext
);
else
delete
watttext
;
}
void
WAttText
::
exit_cancel
(
void
*
ctx
,
void
*
data
)
{
WAttText
*
watttext
=
(
WAttText
*
)
ctx
;
if
(
watttext
->
close_cb
)
(
watttext
->
close_cb
)(
watttext
);
else
delete
watttext
;
}
void
WAttText
::
activate_print
()
{
}
WAttText
::~
WAttText
()
{
}
WAttText
::
WAttText
(
void
*
wa_parent_ctx
,
ldh_tSesContext
wa_ldhses
,
pwr_sAttrRef
wa_aref
,
int
wa_editmode
,
pwr_tStatus
*
status
)
:
parent_ctx
(
wa_parent_ctx
),
ldhses
(
wa_ldhses
),
aref
(
wa_aref
),
editmode
(
wa_editmode
),
modified
(
0
),
close_cb
(
0
),
wow
(
0
)
{
pwr_tStatus
sts
;
*
status
=
WATT__SUCCESS
;
ldh_sAttrRefInfo
ainfo
;
sts
=
ldh_GetAttrRefInfo
(
ldhses
,
&
aref
,
&
ainfo
);
if
(
EVEN
(
sts
))
{
*
status
=
sts
;
return
;
}
switch
(
ainfo
.
type
)
{
case
pwr_eType_Text
:
break
;
default:
*
status
=
WATT__NOTEXT
;
return
;
}
}
wb/lib/wb/src/wb_watttext.h
0 → 100644
View file @
ee2dae07
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2014 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
**/
#ifndef wb_watttext_h
#define wb_watttext_h
/* wb_watttext.h -- Object attribute editor */
#ifndef pwr_h
# include "pwr.h"
#endif
#ifndef wb_utility_h
# include "wb_utility.h"
#endif
#ifndef wb_h
# include "wb.h"
#endif
#ifndef wb_ldh_h
# include "wb_ldh.h"
#endif
#ifndef cow_wow_h
# include "cow_wow.h"
#endif
class
WAttText
{
public:
WAttText
(
void
*
wa_parent_ctx
,
ldh_tSesContext
wa_ldhses
,
pwr_sAttrRef
wa_aref
,
int
wa_editmode
,
pwr_tStatus
*
status
);
virtual
~
WAttText
();
void
*
parent_ctx
;
ldh_tSesContext
ldhses
;
pwr_sAttrRef
aref
;
pwr_tOName
aname
;
int
editmode
;
int
modified
;
void
(
*
close_cb
)
(
void
*
);
wb_eUtility
utility
;
CoWow
*
wow
;
virtual
void
message
(
char
severity
,
const
char
*
message
)
{}
virtual
void
pop
()
{}
virtual
void
set_editmode
(
int
editmode
,
ldh_tSesContext
ldhses
)
{}
virtual
void
print
(
const
char
*
title
)
{}
virtual
void
set_attr_value
()
{}
void
activate_print
();
void
activate_exit
();
static
void
exit_ok
(
void
*
ctx
,
void
*
data
);
static
void
exit_cancel
(
void
*
ctx
,
void
*
data
);
static
void
message_cb
(
void
*
watttext
,
char
severity
,
const
char
*
message
);
};
#endif
wb/lib/wb/src/wb_wnav.h
View file @
ee2dae07
...
...
@@ -91,6 +91,10 @@
#include "wb_expw.h"
#endif
#ifndef wb_watttext_h
#include "wb_watttext.h"
#endif
#define wnav_cVersion "X3.3a"
#define wnav_cScriptDescKey "!** Description"
...
...
@@ -349,6 +353,7 @@ class WNav : public WUtility{
virtual
WCrr
*
wcrr_new
(
pwr_tAttrRef
*
aref
,
pwr_tStatus
*
status
)
{
return
0
;}
virtual
WbBckW
*
bckw_new
(
char
*
name
,
wb_bck_list
*
list
,
pwr_tStatus
*
status
)
{
return
0
;}
virtual
WbExpW
*
expw_new
(
char
*
name
,
int
type
,
pwr_tStatus
*
status
)
{
return
0
;}
virtual
WAttText
*
watttext_new
(
pwr_tAttrRef
aref
,
int
editmode
,
pwr_tStatus
*
status
)
{
return
0
;}
static
int
brow_cb
(
FlowCtx
*
ctx
,
flow_tEvent
event
);
static
int
init_brow_base_cb
(
FlowCtx
*
fctx
,
void
*
client_data
);
...
...
wb/lib/wb/src/wb_wnav_command.cpp
View file @
ee2dae07
...
...
@@ -96,6 +96,7 @@
#include "ge.h"
#include "wb_utl.h"
#include "wb_bck.h"
#include "wb_watttext.h"
#define WNAV_MENU_CREATE 0
#define WNAV_MENU_ADD 1
...
...
@@ -3818,6 +3819,34 @@ static int wnav_open_func( void *client_data,
wnav
->
logw_new
(
itemp
,
catp
,
showitem
);
}
else
if
(
cdh_NoCaseStrncmp
(
arg1_str
,
"ATTRIBUTE"
,
strlen
(
arg1_str
))
==
0
)
{
pwr_tAName
namestr
;
pwr_tAttrRef
aref
;
pwr_tStatus
sts
;
// Command is "OPEN ATTRIBUTE"
if
(
EVEN
(
dcli_get_qualifier
(
"/NAME"
,
namestr
,
sizeof
(
namestr
))))
{
if
(
EVEN
(
dcli_get_qualifier
(
"dcli_arg2"
,
namestr
,
sizeof
(
namestr
))))
{
wnav
->
message
(
'E'
,
"Syntax error"
);
return
WNAV__SYNTAX
;
}
}
sts
=
ldh_NameToAttrRef
(
wnav
->
ldhses
,
namestr
,
&
aref
);
if
(
EVEN
(
sts
))
{
wnav
->
message
(
' '
,
wnav_get_message
(
sts
));
return
WNAV__SUCCESS
;
}
WAttText
*
watttext
=
wnav
->
watttext_new
(
aref
,
wnav
->
editmode
,
&
sts
);
if
(
EVEN
(
sts
))
{
wnav
->
message
(
' '
,
wnav_get_message
(
sts
));
delete
watttext
;
return
WNAV__SUCCESS
;
}
}
else
{
wnav
->
message
(
'E'
,
"Syntax error"
);
...
...
wb/lib/wb/src/wb_wtt.cpp
View file @
ee2dae07
...
...
@@ -61,6 +61,7 @@
#include "wb_wnav_item.h"
#include "wb_pal.h"
#include "wb_watt.h"
#include "wb_watttext.h"
#include "wb_wda.h"
#include "wb_wtt.h"
#include "wb_wnav_msg.h"
...
...
@@ -2277,6 +2278,14 @@ void wtt_watt_close_cb( void *watt)
wtt
->
appl
.
remove
(
watt
);
}
void
wtt_watttext_close_cb
(
void
*
watttext
)
{
Wtt
*
wtt
=
(
Wtt
*
)
((
WAttText
*
)
watttext
)
->
parent_ctx
;
delete
(
WAttText
*
)
watttext
;
wtt
->
appl
.
remove
(
watttext
);
}
void
wtt_wda_close_cb
(
void
*
wda
)
{
Wtt
*
wtt
=
(
Wtt
*
)
((
Wda
*
)
wda
)
->
parent_ctx
;
...
...
@@ -2294,6 +2303,10 @@ void Wtt::register_utility( void *ctx, wb_eUtility utility)
appl
.
insert
(
utility
,
ctx
,
pwr_cNObjid
,
""
);
((
WAtt
*
)
ctx
)
->
close_cb
=
wtt_watt_close_cb
;
break
;
case
wb_eUtility_AttrTextEditor
:
appl
.
insert
(
utility
,
ctx
,
pwr_cNObjid
,
""
);
((
WAtt
*
)
ctx
)
->
close_cb
=
wtt_watttext_close_cb
;
break
;
case
wb_eUtility_SpreadsheetEditor
:
appl
.
insert
(
utility
,
ctx
,
pwr_cNObjid
,
""
);
((
Wda
*
)
ctx
)
->
close_cb
=
wtt_wda_close_cb
;
...
...
@@ -2590,6 +2603,14 @@ void WttApplList::set_editmode( int editmode, ldh_tSesContext ldhses)
remove
(
elem
->
ctx
);
elem
=
next_elem
;
continue
;
case
wb_eUtility_AttrTextEditor
:
// Delete the attribute editor
delete
(
WAttText
*
)
elem
->
ctx
;
// Remove element
next_elem
=
elem
->
next
;
remove
(
elem
->
ctx
);
elem
=
next_elem
;
continue
;
case
wb_eUtility_SpreadsheetEditor
:
((
Wda
*
)
elem
->
ctx
)
->
set_editmode
(
editmode
,
ldhses
);
break
;
...
...
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