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
Show 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
...
@@ -47,3 +47,4 @@ flagstate <State attribute> /error
disappeard <Item has disappeard> /error
disappeard <Item has disappeard> /error
nochildren <Item has no children> /error
nochildren <Item has no children> /error
attrnotfound <Attribute is not found> /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 @@
...
@@ -60,6 +60,7 @@
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkkeysyms.h>
#include "wb_watt_gtk.h"
#include "wb_watt_gtk.h"
#include "wb_watttext_gtk.h"
#include "wb_gre_gtk.h"
#include "wb_gre_gtk.h"
#include "wb_foe_gtk.h"
#include "wb_foe_gtk.h"
#include "cow_login.h"
#include "cow_login.h"
...
@@ -359,6 +360,14 @@ void WFoeGtk::activate_attribute( GtkWidget *w, gpointer data)
...
@@ -359,6 +360,14 @@ void WFoeGtk::activate_attribute( GtkWidget *w, gpointer data)
foe
->
activate_attribute
();
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.
// Callback from the menu.
void
WFoeGtk
::
activate_subwindow
(
GtkWidget
*
w
,
gpointer
data
)
void
WFoeGtk
::
activate_subwindow
(
GtkWidget
*
w
,
gpointer
data
)
...
@@ -900,10 +909,11 @@ typedef void (*gtk_tCallback)(GtkWidget *,gpointer);
...
@@ -900,10 +909,11 @@ typedef void (*gtk_tCallback)(GtkWidget *,gpointer);
int
WFoeGtk
::
modify_popup
(
unsigned
long
popupmenu_mask
,
int
x
,
int
y
)
int
WFoeGtk
::
modify_popup
(
unsigned
long
popupmenu_mask
,
int
x
,
int
y
)
{
{
static
char
buttontext
[][
40
]
=
{
"ObjectEditor"
,
"SubWindow"
,
"Connect"
,
"Delete"
,
static
const
int
bsize
=
12
;
static
char
buttontext
[
bsize
][
40
]
=
{
"ObjectEditor"
,
"SubWindow"
,
"Connect"
,
"Delete"
,
"Paste"
,
"Copy"
,
"Cut"
,
"PrintSelect"
,
"HelpClass"
,
"Paste"
,
"Copy"
,
"Cut"
,
"PrintSelect"
,
"HelpClass"
,
"CreateObjec
t"
};
"CreateObject"
,
"EditCode"
,
"EditTex
t"
};
static
gtk_tCallback
menu_callbacks
[]
=
{
WFoeGtk
::
activate_attribute
,
static
gtk_tCallback
menu_callbacks
[
bsize
]
=
{
WFoeGtk
::
activate_attribute
,
WFoeGtk
::
activate_subwindow
,
WFoeGtk
::
activate_subwindow
,
WFoeGtk
::
activate_getobj
,
WFoeGtk
::
activate_getobj
,
WFoeGtk
::
activate_delete
,
WFoeGtk
::
activate_delete
,
...
@@ -912,12 +922,14 @@ int WFoeGtk::modify_popup( unsigned long popupmenu_mask, int x, int y)
...
@@ -912,12 +922,14 @@ int WFoeGtk::modify_popup( unsigned long popupmenu_mask, int x, int y)
WFoeGtk
::
activate_cut
,
WFoeGtk
::
activate_cut
,
WFoeGtk
::
activate_printselect
,
WFoeGtk
::
activate_printselect
,
WFoeGtk
::
activate_helpclass
,
WFoeGtk
::
activate_helpclass
,
WFoeGtk
::
activate_createobject
};
WFoeGtk
::
activate_createobject
,
WFoeGtk
::
activate_editcode
,
WFoeGtk
::
activate_editcode
};
popupmenu_x
=
x
+
5
;
popupmenu_x
=
x
+
5
;
popupmenu_y
=
y
;
popupmenu_y
=
y
;
GtkMenu
*
menu
=
(
GtkMenu
*
)
g_object_new
(
GTK_TYPE_MENU
,
NULL
);
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
))
{
if
(
popupmenu_mask
&
(
1
<<
i
))
{
GtkWidget
*
w
=
gtk_menu_item_new_with_label
(
buttontext
[
i
]);
GtkWidget
*
w
=
gtk_menu_item_new_with_label
(
buttontext
[
i
]);
g_signal_connect
(
w
,
"activate"
,
g_signal_connect
(
w
,
"activate"
,
...
@@ -987,6 +999,17 @@ WAtt *WFoeGtk::watt_new( void *a_parent_ctx,
...
@@ -987,6 +999,17 @@ WAtt *WFoeGtk::watt_new( void *a_parent_ctx,
return
watt
;
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 a foe instance.
// Destroys the widget and frees allocated memory for the
// 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 {
...
@@ -163,6 +163,11 @@ class WFoeGtk : public WFoe {
int
a_editmode
,
int
a_editmode
,
int
a_advanced_user
,
int
a_advanced_user
,
int
a_display_objectname
);
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
,
virtual
WFoe
*
subwindow_new
(
void
*
f_parent_ctx
,
char
*
f_name
,
char
*
f_name
,
pwr_tObjid
plcprogram
,
pwr_tObjid
plcprogram
,
...
@@ -245,6 +250,7 @@ class WFoeGtk : public WFoe {
...
@@ -245,6 +250,7 @@ class WFoeGtk : public WFoe {
static
void
activate_move_up
(
GtkWidget
*
w
,
gpointer
foe
);
static
void
activate_move_up
(
GtkWidget
*
w
,
gpointer
foe
);
static
void
activate_move_down
(
GtkWidget
*
w
,
gpointer
foe
);
static
void
activate_move_down
(
GtkWidget
*
w
,
gpointer
foe
);
static
void
activate_attribute
(
GtkWidget
*
w
,
gpointer
data
);
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_subwindow
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_undelete
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_undelete
(
GtkWidget
*
w
,
gpointer
data
);
static
void
activate_unselect
(
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
/*
* 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_gtk.cpp -- Display object attributes */
#include "glow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include <gtk/gtk.h>
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_time.h"
#include "cow_wow_gtk.h"
#include "wb_watt_msg.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
#include "wb_watttext_gtk.h"
#include "wb_wtt.h"
#include "wb_wnav.h"
#include "cow_xhelp.h"
void
WAttTextGtk
::
message
(
char
severity
,
const
char
*
message
)
{
gtk_label_set_text
(
GTK_LABEL
(
msg_label
),
message
);
}
void
WAttTextGtk
::
action_text_changed
(
GtkTextBuffer
*
w
,
gpointer
data
)
{
WAttTextGtk
*
watttext
=
(
WAttTextGtk
*
)
data
;
if
(
watttext
->
init
)
return
;
watttext
->
modified
=
1
;
}
void
WAttTextGtk
::
action_text_inserted
(
GtkTextBuffer
*
w
,
GtkTextIter
*
iter
,
gchar
*
str
,
gint
len
,
gpointer
data
)
{
WAttTextGtk
*
watttext
=
(
WAttTextGtk
*
)
data
;
int
count
=
gtk_text_buffer_get_char_count
(
w
);
if
(
count
>
watttext
->
input_max_length
)
{
// Remove inserted chars (note that iter now points at the end of the inserted text)
GtkTextIter
start_iter
;
int
offs
=
gtk_text_iter_get_offset
(
iter
);
gtk_text_buffer_get_iter_at_offset
(
w
,
&
start_iter
,
offs
-
len
);
gtk_text_buffer_delete
(
w
,
&
start_iter
,
iter
);
CoWowGtk
wow
(
watttext
->
toplevel
);
wow
.
DisplayError
(
"Error message"
,
"Attribute size exceeded"
);
}
else
watttext
->
message
(
' '
,
""
);
}
//
// Callbackfunctions from menu entries
//
void
WAttTextGtk
::
activate_exit
(
GtkWidget
*
w
,
gpointer
data
)
{
WAttText
*
watttext
=
(
WAttText
*
)
data
;
watttext
->
activate_exit
();
}
void
WAttTextGtk
::
activate_save
(
GtkWidget
*
w
,
gpointer
data
)
{
WAttText
*
watttext
=
(
WAttText
*
)
data
;
watttext
->
set_attr_value
();
watttext
->
modified
=
0
;
}
void
WAttTextGtk
::
activate_copy
(
GtkWidget
*
w
,
gpointer
data
)
{
WAttTextGtk
*
watttext
=
(
WAttTextGtk
*
)
data
;
GtkClipboard
*
clipboard
=
gtk_clipboard_get
(
GDK_NONE
);
gtk_text_buffer_copy_clipboard
(
watttext
->
textbuffer
,
clipboard
);
}
void
WAttTextGtk
::
activate_cut
(
GtkWidget
*
w
,
gpointer
data
)
{
WAttTextGtk
*
watttext
=
(
WAttTextGtk
*
)
data
;
GtkClipboard
*
clipboard
=
gtk_clipboard_get
(
GDK_NONE
);
gtk_text_buffer_cut_clipboard
(
watttext
->
textbuffer
,
clipboard
,
TRUE
);
}
void
WAttTextGtk
::
activate_paste
(
GtkWidget
*
w
,
gpointer
data
)
{
WAttTextGtk
*
watttext
=
(
WAttTextGtk
*
)
data
;
GtkClipboard
*
clipboard
=
gtk_clipboard_get
(
GDK_NONE
);
gtk_text_buffer_paste_clipboard
(
watttext
->
textbuffer
,
clipboard
,
NULL
,
TRUE
);
}
void
WAttTextGtk
::
activate_ok
(
GtkWidget
*
w
,
gpointer
data
)
{
WAttTextGtk
*
watttext
=
(
WAttTextGtk
*
)
data
;
watttext
->
set_attr_value
();
if
(
watttext
->
close_cb
)
(
watttext
->
close_cb
)(
watttext
);
else
delete
watttext
;
}
void
WAttTextGtk
::
activate_apply
(
GtkWidget
*
w
,
gpointer
data
)
{
WAttTextGtk
*
watttext
=
(
WAttTextGtk
*
)
data
;
watttext
->
set_attr_value
();
watttext
->
modified
=
0
;
}
void
WAttTextGtk
::
activate_cancel
(
GtkWidget
*
w
,
gpointer
data
)
{
WAttTextGtk
*
watttext
=
(
WAttTextGtk
*
)
data
;
if
(
watttext
->
close_cb
)
(
watttext
->
close_cb
)(
watttext
);
else
delete
watttext
;
}
void
WAttTextGtk
::
activate_help
(
GtkWidget
*
w
,
gpointer
data
)
{
CoXHelp
::
dhelp
(
"objecttexteditor_refman"
,
0
,
navh_eHelpFile_Other
,
"$pwr_lang/man_dg.dat"
,
true
);
}
gboolean
WAttTextGtk
::
action_inputfocus
(
GtkWidget
*
w
,
GdkEvent
*
event
,
gpointer
data
)
{
WAttTextGtk
*
watttext
=
(
WAttTextGtk
*
)
data
;
if
(
watttext
->
editmode
)
gtk_widget_grab_focus
(
watttext
->
textview
);
return
FALSE
;
}
void
WAttTextGtk
::
pop
()
{
gtk_window_present
(
GTK_WINDOW
(
toplevel
));
}
void
WAttTextGtk
::
set_editmode
(
int
editmode
,
ldh_tSesContext
ldhses
)
{
if
(
!
this
->
editmode
&&
editmode
)
{
gtk_text_view_set_editable
(
GTK_TEXT_VIEW
(
textview
),
TRUE
);
gtk_text_view_set_cursor_visible
(
GTK_TEXT_VIEW
(
textview
),
TRUE
);
}
else
if
(
this
->
editmode
&&
!
editmode
)
{
gtk_text_view_set_editable
(
GTK_TEXT_VIEW
(
textview
),
FALSE
);
gtk_text_view_set_cursor_visible
(
GTK_TEXT_VIEW
(
textview
),
FALSE
);
}
if
(
ldhses
!=
0
)
this
->
ldhses
=
ldhses
;
this
->
editmode
=
editmode
;
}
void
WAttTextGtk
::
set_attr_value
()
{
int
size
=
input_max_length
+
1
;
pwr_tStatus
sts
;
gchar
*
text
,
*
textutf8
;
unsigned
char
*
s
;
if
(
editmode
)
{
GtkTextIter
start_iter
,
end_iter
;
gtk_text_buffer_get_start_iter
(
textbuffer
,
&
start_iter
);
gtk_text_buffer_get_end_iter
(
textbuffer
,
&
end_iter
);
textutf8
=
gtk_text_buffer_get_text
(
textbuffer
,
&
start_iter
,
&
end_iter
,
FALSE
);
text
=
g_convert
(
textutf8
,
-
1
,
"ISO8859-1"
,
"UTF-8"
,
NULL
,
NULL
,
NULL
);
g_free
(
textutf8
);
// Replace ctrl characters with space
for
(
s
=
(
unsigned
char
*
)
text
;
*
s
;
s
++
)
{
if
(
*
s
<
' '
&&
*
s
!=
10
&&
*
s
!=
13
)
*
s
=
' '
;
}
sts
=
ldh_SetObjectPar
(
ldhses
,
aref
.
Objid
,
"DevBody"
,
aname
,
text
,
size
);
g_free
(
text
);
}
}
WAttTextGtk
::~
WAttTextGtk
()
{
if
(
wow
)
delete
wow
;
if
(
toplevel
)
gtk_widget_destroy
(
toplevel
);
}
static
gint
delete_event
(
GtkWidget
*
w
,
GdkEvent
*
event
,
gpointer
data
)
{
WAttTextGtk
*
watttext
=
(
WAttTextGtk
*
)
data
;
if
(
watttext
->
close_cb
)
(
watttext
->
close_cb
)(
watttext
);
else
delete
watttext
;
return
FALSE
;
}
static
void
destroy_event
(
GtkWidget
*
w
,
gpointer
data
)
{
}
WAttTextGtk
::
WAttTextGtk
(
GtkWidget
*
wa_parent_wid
,
void
*
wa_parent_ctx
,
ldh_tSesContext
wa_ldhses
,
pwr_sAttrRef
wa_aref
,
int
wa_editmode
,
pwr_tStatus
*
status
)
:
WAttText
(
wa_parent_ctx
,
wa_ldhses
,
wa_aref
,
wa_editmode
,
status
),
parent_wid
(
wa_parent_wid
),
toplevel
(
0
),
init
(
1
)
{
int
sts
;
int
size
;
char
*
namep
;
if
(
EVEN
(
*
status
))
return
;
sts
=
ldh_AttrRefToName
(
ldhses
,
&
aref
,
ldh_eName_Hierarchy
,
&
namep
,
&
size
);
if
(
EVEN
(
sts
))
{
*
status
=
sts
;
return
;
}
toplevel
=
(
GtkWidget
*
)
g_object_new
(
GTK_TYPE_WINDOW
,
"default-height"
,
700
,
"default-width"
,
800
,
"title"
,
CoWowGtk
::
convert_utf8
(
namep
),
NULL
);
g_signal_connect
(
toplevel
,
"delete_event"
,
G_CALLBACK
(
delete_event
),
this
);
g_signal_connect
(
toplevel
,
"destroy"
,
G_CALLBACK
(
destroy_event
),
this
);
g_signal_connect
(
toplevel
,
"focus-in-event"
,
G_CALLBACK
(
action_inputfocus
),
this
);
CoWowGtk
::
SetWindowIcon
(
toplevel
);
// Menu
// Accelerators
GtkAccelGroup
*
accel_g
=
(
GtkAccelGroup
*
)
g_object_new
(
GTK_TYPE_ACCEL_GROUP
,
NULL
);
gtk_window_add_accel_group
(
GTK_WINDOW
(
toplevel
),
accel_g
);
GtkMenuBar
*
menu_bar
=
(
GtkMenuBar
*
)
g_object_new
(
GTK_TYPE_MENU_BAR
,
NULL
);
// File entry
GtkWidget
*
file_close
=
gtk_image_menu_item_new_from_stock
(
GTK_STOCK_CLOSE
,
accel_g
);
g_signal_connect
(
file_close
,
"activate"
,
G_CALLBACK
(
activate_exit
),
this
);
GtkWidget
*
file_save
=
gtk_image_menu_item_new_from_stock
(
GTK_STOCK_SAVE
,
accel_g
);
g_signal_connect
(
file_save
,
"activate"
,
G_CALLBACK
(
activate_save
),
this
);
GtkMenu
*
file_menu
=
(
GtkMenu
*
)
g_object_new
(
GTK_TYPE_MENU
,
NULL
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
file_menu
),
file_save
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
file_menu
),
file_close
);
GtkWidget
*
file
=
gtk_menu_item_new_with_mnemonic
(
"_File"
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
menu_bar
),
file
);
gtk_menu_item_set_submenu
(
GTK_MENU_ITEM
(
file
),
GTK_WIDGET
(
file_menu
));
// Edit entry
GtkWidget
*
edit_copy
=
gtk_image_menu_item_new_from_stock
(
GTK_STOCK_COPY
,
accel_g
);
g_signal_connect
(
edit_copy
,
"activate"
,
G_CALLBACK
(
activate_copy
),
this
);
GtkWidget
*
edit_cut
=
gtk_image_menu_item_new_from_stock
(
GTK_STOCK_CUT
,
accel_g
);
g_signal_connect
(
edit_cut
,
"activate"
,
G_CALLBACK
(
activate_cut
),
this
);
GtkWidget
*
edit_paste
=
gtk_image_menu_item_new_from_stock
(
GTK_STOCK_PASTE
,
accel_g
);
g_signal_connect
(
edit_paste
,
"activate"
,
G_CALLBACK
(
activate_paste
),
this
);
GtkMenu
*
edit_menu
=
(
GtkMenu
*
)
g_object_new
(
GTK_TYPE_MENU
,
NULL
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
edit_menu
),
edit_copy
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
edit_menu
),
edit_cut
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
edit_menu
),
edit_paste
);
GtkWidget
*
edit
=
gtk_menu_item_new_with_mnemonic
(
"_Edit"
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
menu_bar
),
edit
);
gtk_menu_item_set_submenu
(
GTK_MENU_ITEM
(
edit
),
GTK_WIDGET
(
edit_menu
));
// Help entry
GtkWidget
*
help_help
=
gtk_image_menu_item_new_from_stock
(
GTK_STOCK_HELP
,
accel_g
);
g_signal_connect
(
help_help
,
"activate"
,
G_CALLBACK
(
activate_help
),
this
);
GtkMenu
*
help_menu
=
(
GtkMenu
*
)
g_object_new
(
GTK_TYPE_MENU
,
NULL
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
help_menu
),
help_help
);
GtkWidget
*
help
=
gtk_menu_item_new_with_mnemonic
(
"_Help"
);
gtk_menu_shell_append
(
GTK_MENU_SHELL
(
menu_bar
),
help
);
gtk_menu_item_set_submenu
(
GTK_MENU_ITEM
(
help
),
GTK_WIDGET
(
help_menu
));
if
(
((
WUtility
*
)
parent_ctx
)
->
utype
==
wb_eUtility_WNav
)
parent_ctx
=
((
WNav
*
)
parent_ctx
)
->
parent_ctx
;
utility
=
((
WUtility
*
)
parent_ctx
)
->
utype
;
textbuffer
=
gtk_text_buffer_new
(
NULL
);
g_signal_connect_after
(
textbuffer
,
"insert-text"
,
G_CALLBACK
(
action_text_inserted
),
this
);
g_signal_connect_after
(
textbuffer
,
"changed"
,
G_CALLBACK
(
action_text_changed
),
this
);
textview
=
gtk_text_view_new_with_buffer
(
textbuffer
);
GtkWidget
*
viewport
=
gtk_viewport_new
(
NULL
,
NULL
);
GtkWidget
*
scrolledwindow
=
gtk_scrolled_window_new
(
NULL
,
NULL
);
gtk_container_add
(
GTK_CONTAINER
(
viewport
),
textview
);
gtk_container_add
(
GTK_CONTAINER
(
scrolledwindow
),
viewport
);
button_ok
=
gtk_button_new_with_label
(
"Ok"
);
gtk_widget_set_size_request
(
button_ok
,
70
,
25
);
g_signal_connect
(
button_ok
,
"clicked"
,
G_CALLBACK
(
activate_ok
),
this
);
button_apply
=
gtk_button_new_with_label
(
"Apply"
);
gtk_widget_set_size_request
(
button_apply
,
70
,
25
);
g_signal_connect
(
button_apply
,
"clicked"
,
G_CALLBACK
(
activate_apply
),
this
);
button_cancel
=
gtk_button_new_with_label
(
"Cancel"
);
gtk_widget_set_size_request
(
button_cancel
,
70
,
25
);
g_signal_connect
(
button_cancel
,
"clicked"
,
G_CALLBACK
(
activate_cancel
),
this
);
GtkWidget
*
hboxbuttons
=
gtk_hbox_new
(
TRUE
,
40
);
gtk_box_pack_start
(
GTK_BOX
(
hboxbuttons
),
button_ok
,
FALSE
,
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
hboxbuttons
),
button_apply
,
FALSE
,
FALSE
,
0
);
gtk_box_pack_end
(
GTK_BOX
(
hboxbuttons
),
button_cancel
,
FALSE
,
FALSE
,
0
);
msg_label
=
gtk_label_new
(
""
);
gtk_widget_set_size_request
(
msg_label
,
-
1
,
25
);
vbox
=
gtk_vbox_new
(
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
GTK_WIDGET
(
menu_bar
),
FALSE
,
FALSE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
scrolledwindow
,
TRUE
,
TRUE
,
0
);
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
hboxbuttons
,
FALSE
,
FALSE
,
5
);
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
msg_label
,
FALSE
,
FALSE
,
5
);
gtk_container_add
(
GTK_CONTAINER
(
toplevel
),
vbox
);
gtk_widget_show_all
(
toplevel
);
if
(
utility
==
wb_eUtility_Wtt
)
{
((
Wtt
*
)
parent_ctx
)
->
register_utility
(
(
void
*
)
this
,
wb_eUtility_AttrTextEditor
);
}
char
*
value
;
ldh_sAttrRefInfo
ainfo
;
sts
=
ldh_GetAttrRefInfo
(
ldhses
,
&
aref
,
&
ainfo
);
if
(
EVEN
(
sts
))
{
*
status
=
sts
;
return
;
}
char
*
s
=
strchr
(
namep
,
'.'
);
if
(
!
s
)
return
;
strncpy
(
aname
,
s
+
1
,
sizeof
(
aname
));
sts
=
ldh_GetObjectPar
(
ldhses
,
aref
.
Objid
,
"DevBody"
,
aname
,
(
char
**
)
&
value
,
&
size
);
if
(
EVEN
(
sts
))
{
*
status
=
sts
;
return
;
}
input_max_length
=
ainfo
.
size
-
1
;
GtkTextIter
start_iter
,
end_iter
;
gtk_text_buffer_get_start_iter
(
textbuffer
,
&
start_iter
);
gtk_text_buffer_get_end_iter
(
textbuffer
,
&
end_iter
);
gtk_text_buffer_delete
(
textbuffer
,
&
start_iter
,
&
end_iter
);
gtk_text_buffer_get_start_iter
(
textbuffer
,
&
start_iter
);
char
*
textutf8
=
g_convert
(
value
,
-
1
,
"UTF-8"
,
"ISO8859-1"
,
NULL
,
NULL
,
NULL
);
gtk_text_buffer_insert
(
textbuffer
,
&
start_iter
,
textutf8
,
-
1
);
g_free
(
textutf8
);
free
(
value
);
if
(
!
editmode
)
{
gtk_text_view_set_editable
(
GTK_TEXT_VIEW
(
textview
),
FALSE
);
gtk_text_view_set_cursor_visible
(
GTK_TEXT_VIEW
(
textview
),
FALSE
);
}
wow
=
new
CoWowGtk
(
toplevel
);
init
=
0
;
}
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" {
...
@@ -73,6 +73,7 @@ extern "C" {
#include "wb_xcrr_gtk.h"
#include "wb_xcrr_gtk.h"
#include "wb_bckw_gtk.h"
#include "wb_bckw_gtk.h"
#include "wb_expw_gtk.h"
#include "wb_expw_gtk.h"
#include "wb_watttext_gtk.h"
#define max(Dragon,Eagle) ((Dragon) > (Eagle) ? (Dragon) : (Eagle))
#define max(Dragon,Eagle) ((Dragon) > (Eagle) ? (Dragon) : (Eagle))
#define min(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)
...
@@ -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
);
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
)
void
WNavGtk
::
wge_subwindow_loop
(
WGe
*
wge
)
{
{
gtk_main
();
gtk_main
();
...
...
wb/lib/wb/gtk/wb_wnav_gtk.h
View file @
ee2dae07
...
@@ -42,6 +42,7 @@
...
@@ -42,6 +42,7 @@
/* wtt_wnav_gtk.h -- Simple navigator */
/* wtt_wnav_gtk.h -- Simple navigator */
class
CoLogin
;
class
CoLogin
;
class
WAttText
;
class
WNavGtk
:
public
WNav
{
class
WNavGtk
:
public
WNav
{
public:
public:
...
@@ -98,6 +99,7 @@ class WNavGtk : public WNav {
...
@@ -98,6 +99,7 @@ class WNavGtk : public WNav {
WCrr
*
wcrr_new
(
pwr_tAttrRef
*
aref
,
pwr_tStatus
*
status
);
WCrr
*
wcrr_new
(
pwr_tAttrRef
*
aref
,
pwr_tStatus
*
status
);
WbBckW
*
bckw_new
(
char
*
name
,
wb_bck_list
*
list
,
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
);
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
trace_scan
(
WNavGtk
*
wnav
);
static
void
sel_lose_cb
(
GtkWidget
*
w
,
GdkEventSelection
*
event
,
static
void
sel_lose_cb
(
GtkWidget
*
w
,
GdkEventSelection
*
event
,
...
...
wb/lib/wb/src/wb_foe.cpp
View file @
ee2dae07
...
@@ -66,9 +66,9 @@
...
@@ -66,9 +66,9 @@
#include "cow_login.h"
#include "cow_login.h"
#include "wb_tra.h"
#include "wb_tra.h"
#include "wb_watt.h"
#include "wb_watt.h"
#include "wb_watttext.h"
#include "wb_gobj.h"
#include "wb_gobj.h"
#include "wb_exo.h"
#include "wb_exo.h"
#include "wb_watt.h"
#include "wb_pal.h"
#include "wb_pal.h"
#include "cow_wow.h"
#include "cow_wow.h"
#include "cow_xhelp.h"
#include "cow_xhelp.h"
...
@@ -782,14 +782,16 @@ void WFoe::activate_changetext()
...
@@ -782,14 +782,16 @@ void WFoe::activate_changetext()
}
}
switch
(
nodelist
[
0
]
->
ln
.
cid
)
{
switch
(
nodelist
[
0
]
->
ln
.
cid
)
{
case
pwr_cClass_Text
:
case
pwr_cClass_BodyText
:
case
pwr_cClass_BodyText
:
case
pwr_cClass_HelpText
:
case
pwr_cClass_HelpText
:
case
pwr_cClass_HelpTextL
:
case
pwr_cClass_HelpTextL
:
attredit_create
(
nodelist
[
0
],
"Text"
);
break
;
case
pwr_cClass_Head
:
case
pwr_cClass_Head
:
case
pwr_cClass_Text
:
case
pwr_cClass_Title
:
case
pwr_cClass_Title
:
attr_create
(
nodelist
[
0
]);
attr_create
(
nodelist
[
0
]);
sts
=
attrlist_get_by_node
(
nodelist
[
0
],
(
void
**
)
&
watt
);
sts
=
attrlist_get_by_node
(
nodelist
[
0
],
foe_eAttr_WAtt
,
(
void
**
)
&
watt
);
if
(
EVEN
(
sts
))
return
;
if
(
EVEN
(
sts
))
return
;
sts
=
watt
->
open_changevalue
(
"Text"
);
sts
=
watt
->
open_changevalue
(
"Text"
);
break
;
break
;
...
@@ -937,7 +939,7 @@ void WFoe::activate_attribute()
...
@@ -937,7 +939,7 @@ void WFoe::activate_attribute()
/* Create attribute editor */
/* Create attribute editor */
if
(
msg_label_id
!=
0
)
message
(
""
);
if
(
msg_label_id
!=
0
)
message
(
""
);
object
=
*
nodelist
;
object
=
*
nodelist
;
sts
=
attrlist_get_by_node
(
object
,
(
void
**
)
&
watt
);
sts
=
attrlist_get_by_node
(
object
,
foe_eAttr_WAtt
,
(
void
**
)
&
watt
);
if
(
ODD
(
sts
))
if
(
ODD
(
sts
))
watt
->
pop
();
watt
->
pop
();
else
{
else
{
...
@@ -961,6 +963,56 @@ void WFoe::activate_attribute()
...
@@ -961,6 +963,56 @@ void WFoe::activate_attribute()
return
;
return
;
}
}
void
WFoe
::
activate_editcode
()
{
unsigned
long
node_count
;
vldh_t_node
*
nodelist
;
vldh_t_node
object
;
int
sts
;
WAttText
*
watttext
;
if
(
msg_label_id
!=
0
)
message
(
""
);
/* Get selected nodes */
gre
->
get_selnodes
(
&
node_count
,
&
nodelist
);
if
(
node_count
==
1
)
{
/* Create attribute editor */
if
(
msg_label_id
!=
0
)
message
(
""
);
object
=
*
nodelist
;
sts
=
attrlist_get_by_node
(
object
,
foe_eAttr_WAttText
,
(
void
**
)
&
watttext
);
if
(
ODD
(
sts
))
watttext
->
pop
();
else
{
clock_cursor
();
switch
(
object
->
ln
.
cid
)
{
case
pwr_cClass_BodyText
:
case
pwr_cClass_HelpText
:
case
pwr_cClass_HelpTextL
:
attredit_create
(
object
,
"Text"
);
break
;
default:
attredit_create
(
object
,
"Code"
);
}
normal_cursor
();
}
// gre->unselect();
}
if
(
node_count
>
0
)
free
((
char
*
)
nodelist
);
if
(
node_count
==
0
)
{
message
(
"Select an object to edit attributes"
);
BEEP
;
}
else
if
(
node_count
>
1
)
{
message
(
"Unable to open object, more than one object selected"
);
BEEP
;
}
return
;
}
//
//
// Callback from the menu.
// Callback from the menu.
...
@@ -1590,14 +1642,16 @@ void WFoe::gre_node_created( WGre *gre, unsigned long current_node_type,
...
@@ -1590,14 +1642,16 @@ void WFoe::gre_node_created( WGre *gre, unsigned long current_node_type,
if
(
EVEN
(
sts
))
return
;
if
(
EVEN
(
sts
))
return
;
switch
(
cid
)
{
switch
(
cid
)
{
case
pwr_cClass_Text
:
case
pwr_cClass_BodyText
:
case
pwr_cClass_BodyText
:
case
pwr_cClass_HelpText
:
case
pwr_cClass_HelpText
:
case
pwr_cClass_HelpTextL
:
case
pwr_cClass_HelpTextL
:
((
WFoe
*
)
gre
->
parent_ctx
)
->
attredit_create
(
node
,
"Text"
);
break
;
case
pwr_cClass_Text
:
case
pwr_cClass_Head
:
case
pwr_cClass_Head
:
case
pwr_cClass_Title
:
case
pwr_cClass_Title
:
((
WFoe
*
)
gre
->
parent_ctx
)
->
attr_create
(
node
);
((
WFoe
*
)
gre
->
parent_ctx
)
->
attr_create
(
node
);
sts
=
attrlist_get_by_node
(
node
,
(
void
**
)
&
watt
);
sts
=
attrlist_get_by_node
(
node
,
foe_eAttr_WAtt
,
(
void
**
)
&
watt
);
if
(
EVEN
(
sts
))
return
;
if
(
EVEN
(
sts
))
return
;
sts
=
watt
->
open_changevalue
(
"Text"
,
1
);
sts
=
watt
->
open_changevalue
(
"Text"
,
1
);
break
;
break
;
...
@@ -1615,14 +1669,16 @@ void WFoe::gre_node_floating_created( WGre *gre, vldh_t_node node)
...
@@ -1615,14 +1669,16 @@ void WFoe::gre_node_floating_created( WGre *gre, vldh_t_node node)
foe
=
(
WFoe
*
)
gre
->
parent_ctx
;
foe
=
(
WFoe
*
)
gre
->
parent_ctx
;
switch
(
node
->
ln
.
cid
)
{
switch
(
node
->
ln
.
cid
)
{
case
pwr_cClass_Text
:
case
pwr_cClass_BodyText
:
case
pwr_cClass_BodyText
:
case
pwr_cClass_HelpText
:
case
pwr_cClass_HelpText
:
case
pwr_cClass_HelpTextL
:
case
pwr_cClass_HelpTextL
:
((
WFoe
*
)
gre
->
parent_ctx
)
->
attredit_create
(
node
,
"Text"
);
break
;
case
pwr_cClass_Text
:
case
pwr_cClass_Head
:
case
pwr_cClass_Head
:
case
pwr_cClass_Title
:
case
pwr_cClass_Title
:
((
WFoe
*
)
gre
->
parent_ctx
)
->
attr_create
(
node
);
((
WFoe
*
)
gre
->
parent_ctx
)
->
attr_create
(
node
);
sts
=
attrlist_get_by_node
(
node
,
(
void
**
)
&
watt
);
sts
=
attrlist_get_by_node
(
node
,
foe_eAttr_WAtt
,
(
void
**
)
&
watt
);
if
(
EVEN
(
sts
))
return
;
if
(
EVEN
(
sts
))
return
;
sts
=
watt
->
open_changevalue
(
"Text"
,
1
);
sts
=
watt
->
open_changevalue
(
"Text"
,
1
);
break
;
break
;
...
@@ -1971,20 +2027,34 @@ void WFoe::gre_popupmenu( WGre *gre, int x_pix, int y_pix, int popupmenu_type,
...
@@ -1971,20 +2027,34 @@ void WFoe::gre_popupmenu( WGre *gre, int x_pix, int y_pix, int popupmenu_type,
foe
->
popupmenu_node
=
node
;
foe
->
popupmenu_node
=
node
;
}
}
foe
->
modify_popup
(
foe_e_popupmenu_attribute
|
unsigned
int
mask
=
foe_ePopupmenu_attribute
|
foe_e_popupmenu_subwindow
|
foe_ePopupmenu_subwindow
|
foe_e_popupmenu_connect
|
foe_ePopupmenu_connect
|
foe_e_popupmenu_delete
|
foe_ePopupmenu_delete
|
foe_e_popupmenu_helpclass
,
foe_ePopupmenu_helpclass
;
x_pix
+
5
,
y_pix
);
if
(
node
)
{
switch
(
node
->
ln
.
cid
)
{
case
pwr_cClass_dataarithm
:
case
pwr_cClass_dataarithml
:
case
pwr_cClass_carithm
:
mask
|=
foe_ePopupmenu_editcode
;
break
;
case
pwr_cClass_BodyText
:
case
pwr_cClass_HelpText
:
case
pwr_cClass_HelpTextL
:
mask
|=
foe_ePopupmenu_edittext
;
break
;
default:
;
}
}
foe
->
modify_popup
(
mask
,
x_pix
+
5
,
y_pix
);
}
}
else
{
else
{
foe
->
modify_popup
(
foe_e
_p
opupmenu_delete
|
foe
->
modify_popup
(
foe_e
P
opupmenu_delete
|
foe_e
_p
opupmenu_copy
|
foe_e
P
opupmenu_copy
|
foe_e
_p
opupmenu_cut
|
foe_e
P
opupmenu_cut
|
foe_e
_p
opupmenu_printselect
|
foe_e
P
opupmenu_printselect
|
foe_e
_p
opupmenu_createobject
,
foe_e
P
opupmenu_createobject
,
x_pix
+
5
,
y_pix
);
x_pix
+
5
,
y_pix
);
}
}
}
}
...
@@ -1993,9 +2063,9 @@ void WFoe::gre_popupmenu( WGre *gre, int x_pix, int y_pix, int popupmenu_type,
...
@@ -1993,9 +2063,9 @@ void WFoe::gre_popupmenu( WGre *gre, int x_pix, int y_pix, int popupmenu_type,
gre
->
node_select
(
node
);
gre
->
node_select
(
node
);
foe
->
popupmenu_node
=
node
;
foe
->
popupmenu_node
=
node
;
}
}
foe
->
modify_popup
(
foe_e
_p
opupmenu_attribute
|
foe
->
modify_popup
(
foe_e
P
opupmenu_attribute
|
foe_e
_p
opupmenu_subwindow
|
foe_e
P
opupmenu_subwindow
|
foe_e
_p
opupmenu_helpclass
,
foe_e
P
opupmenu_helpclass
,
x_pix
+
5
,
y_pix
);
x_pix
+
5
,
y_pix
);
}
}
}
}
...
@@ -2176,7 +2246,7 @@ int WFoe::attr_create( vldh_t_node node)
...
@@ -2176,7 +2246,7 @@ int WFoe::attr_create( vldh_t_node node)
}
}
else
{
else
{
sts
=
attrlist_get_by_node
(
node
,
(
void
**
)
&
watt
);
sts
=
attrlist_get_by_node
(
node
,
foe_eAttr_WAtt
,
(
void
**
)
&
watt
);
if
(
ODD
(
sts
))
if
(
ODD
(
sts
))
watt
->
pop
();
watt
->
pop
();
else
{
else
{
...
@@ -2187,24 +2257,52 @@ int WFoe::attr_create( vldh_t_node node)
...
@@ -2187,24 +2257,52 @@ int WFoe::attr_create( vldh_t_node node)
watt
->
close_cb
=
attr_quit
;
watt
->
close_cb
=
attr_quit
;
/* Store in the array */
/* Store in the array */
sts
=
attrlist_insert
(
watt
,
this
,
node
);
sts
=
attrlist_insert
(
watt
,
this
,
node
,
foe_eAttr_WAtt
);
}
}
}
}
return
FOE__SUCCESS
;
return
FOE__SUCCESS
;
}
}
int
WFoe
::
attredit_create
(
vldh_t_node
node
,
const
char
*
aname
)
{
WAttText
*
watttext
;
int
ate_mode
;
pwr_sAttrRef
aref
,
aaref
;
pwr_tStatus
sts
;
ate_mode
=
(
function
==
EDIT
);
sts
=
attrlist_get_by_node
(
node
,
foe_eAttr_WAttText
,
(
void
**
)
&
watttext
);
if
(
ODD
(
sts
))
watttext
->
pop
();
else
{
aref
=
cdh_ObjidToAref
(
node
->
ln
.
oid
);
sts
=
ldh_ArefANameToAref
(
(
node
->
hn
.
wind
)
->
hw
.
ldhses
,
&
aref
,
aname
,
&
aaref
);
if
(
EVEN
(
sts
))
return
sts
;
watttext
=
watttext_new
(
this
,
(
node
->
hn
.
wind
)
->
hw
.
ldhses
,
aaref
,
ate_mode
,
&
sts
);
watttext
->
close_cb
=
attredit_quit
;
/* Store in the array */
sts
=
attrlist_insert
(
watttext
,
this
,
node
,
foe_eAttr_WAttText
);
}
return
FOE__SUCCESS
;
}
//
//
// Handles the list of attribute editors in foe.
// Handles the list of attribute editors in foe.
// A backcall from the attribute editor is identified by the ate_context.
// A backcall from the attribute editor is identified by the ate_context.
// To assosiate this with a foe and a node the context is stored in
// To assosiate this with a foe and a node the context is stored in
// the attribute list when ate is created.
// the attribute list when ate is created.
//
//
int
WFoe
::
attrlist_get
(
void
*
a_ctx
,
WFoe
**
foe
,
vldh_t_node
*
node
)
int
WFoe
::
attrlist_get
(
void
*
a_ctx
,
foe_eAttr
type
,
WFoe
**
foe
,
vldh_t_node
*
node
)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
attr_count
;
i
++
)
{
for
(
i
=
0
;
i
<
attr_count
;
i
++
)
{
if
(
(
attr_pointer
+
i
)
->
a_ctx
==
a_ctx
)
{
if
(
(
attr_pointer
+
i
)
->
a_ctx
==
a_ctx
&&
(
attr_pointer
+
i
)
->
type
==
type
)
{
/* This is it */
/* This is it */
*
foe
=
(
attr_pointer
+
i
)
->
foe
;
*
foe
=
(
attr_pointer
+
i
)
->
foe
;
*
node
=
(
attr_pointer
+
i
)
->
node
;
*
node
=
(
attr_pointer
+
i
)
->
node
;
...
@@ -2214,12 +2312,12 @@ int WFoe::attrlist_get( void *a_ctx, WFoe **foe, vldh_t_node *node)
...
@@ -2214,12 +2312,12 @@ int WFoe::attrlist_get( void *a_ctx, WFoe **foe, vldh_t_node *node)
return
FOE__OBJECT
;
return
FOE__OBJECT
;
}
}
int
WFoe
::
attrlist_get_by_node
(
vldh_t_node
node
,
void
**
a_ctx
)
int
WFoe
::
attrlist_get_by_node
(
vldh_t_node
node
,
foe_eAttr
type
,
void
**
a_ctx
)
{
{
int
i
;
int
i
;
for
(
i
=
0
;
i
<
attr_count
;
i
++
)
{
for
(
i
=
0
;
i
<
attr_count
;
i
++
)
{
if
(
(
attr_pointer
+
i
)
->
node
==
node
)
{
if
(
(
attr_pointer
+
i
)
->
node
==
node
&&
type
==
(
attr_pointer
+
i
)
->
type
)
{
/* This is it */
/* This is it */
*
a_ctx
=
(
attr_pointer
+
i
)
->
a_ctx
;
*
a_ctx
=
(
attr_pointer
+
i
)
->
a_ctx
;
return
FOE__SUCCESS
;
return
FOE__SUCCESS
;
...
@@ -2228,14 +2326,14 @@ int WFoe::attrlist_get_by_node( vldh_t_node node, void **a_ctx)
...
@@ -2228,14 +2326,14 @@ int WFoe::attrlist_get_by_node( vldh_t_node node, void **a_ctx)
return
FOE__OBJECT
;
return
FOE__OBJECT
;
}
}
int
WFoe
::
attrlist_insert
(
void
*
a_ctx
,
WFoe
*
foe
,
vldh_t_node
node
)
int
WFoe
::
attrlist_insert
(
void
*
a_ctx
,
WFoe
*
foe
,
vldh_t_node
node
,
foe_eAttr
type
)
{
{
int
sts
;
int
sts
;
WFoe
*
dum_foe
;
WFoe
*
dum_foe
;
vldh_t_node
dum_node
;
vldh_t_node
dum_node
;
/* Check that it doesn't exist */
/* Check that it doesn't exist */
sts
=
attrlist_get
(
a_ctx
,
&
dum_foe
,
&
dum_node
);
sts
=
attrlist_get
(
a_ctx
,
type
,
&
dum_foe
,
&
dum_node
);
if
(
EVEN
(
sts
))
{
if
(
EVEN
(
sts
))
{
sts
=
utl_realloc
(
(
char
**
)
&
attr_pointer
,
sts
=
utl_realloc
(
(
char
**
)
&
attr_pointer
,
attr_count
*
sizeof
(
foe_sAttr
),
attr_count
*
sizeof
(
foe_sAttr
),
...
@@ -2245,6 +2343,7 @@ int WFoe::attrlist_insert( void *a_ctx, WFoe *foe, vldh_t_node node)
...
@@ -2245,6 +2343,7 @@ int WFoe::attrlist_insert( void *a_ctx, WFoe *foe, vldh_t_node node)
(
attr_pointer
+
attr_count
)
->
a_ctx
=
a_ctx
;
(
attr_pointer
+
attr_count
)
->
a_ctx
=
a_ctx
;
(
attr_pointer
+
attr_count
)
->
foe
=
foe
;
(
attr_pointer
+
attr_count
)
->
foe
=
foe
;
(
attr_pointer
+
attr_count
)
->
node
=
node
;
(
attr_pointer
+
attr_count
)
->
node
=
node
;
(
attr_pointer
+
attr_count
)
->
type
=
type
;
attr_count
++
;
attr_count
++
;
}
}
return
FOE__SUCCESS
;
return
FOE__SUCCESS
;
...
@@ -2290,8 +2389,12 @@ int WFoe::attr_delete()
...
@@ -2290,8 +2389,12 @@ int WFoe::attr_delete()
/* Get the foe in the attributectx array and reset it*/
/* Get the foe in the attributectx array and reset it*/
for
(
i
=
0
;
i
<
attr_count
;
i
++
)
{
for
(
i
=
0
;
i
<
attr_count
;
i
++
)
{
if
(
this
==
(
attr_pointer
+
i
)
->
foe
)
{
if
(
this
==
(
attr_pointer
+
i
)
->
foe
)
{
if
(
(
attr_pointer
+
i
)
->
type
==
foe_eAttr_WAtt
)
delete
(
WAtt
*
)
(
attr_pointer
+
i
)
->
a_ctx
;
delete
(
WAtt
*
)
(
attr_pointer
+
i
)
->
a_ctx
;
else
if
(
(
attr_pointer
+
i
)
->
type
==
foe_eAttr_WAttText
)
delete
(
WAttText
*
)
(
attr_pointer
+
i
)
->
a_ctx
;
attrlist_delete
(
(
attr_pointer
+
i
)
->
a_ctx
);
attrlist_delete
(
(
attr_pointer
+
i
)
->
a_ctx
);
i
--
;
}
}
}
}
return
FOE__SUCCESS
;
return
FOE__SUCCESS
;
...
@@ -2306,8 +2409,12 @@ void WFoe::attr_set_editmode( int mode)
...
@@ -2306,8 +2409,12 @@ void WFoe::attr_set_editmode( int mode)
int
i
;
int
i
;
for
(
i
=
0
;
i
<
attr_count
;
i
++
)
{
for
(
i
=
0
;
i
<
attr_count
;
i
++
)
{
if
(
this
==
(
attr_pointer
+
i
)
->
foe
)
if
(
this
==
(
attr_pointer
+
i
)
->
foe
)
{
if
(
(
attr_pointer
+
i
)
->
type
==
foe_eAttr_WAtt
)
((
WAtt
*
)(
attr_pointer
+
i
)
->
a_ctx
)
->
set_editmode
(
mode
,
0
);
((
WAtt
*
)(
attr_pointer
+
i
)
->
a_ctx
)
->
set_editmode
(
mode
,
0
);
else
if
(
(
attr_pointer
+
i
)
->
type
==
foe_eAttr_WAttText
)
((
WAttText
*
)(
attr_pointer
+
i
)
->
a_ctx
)
->
set_editmode
(
mode
,
0
);
}
}
}
}
}
...
@@ -2706,6 +2813,18 @@ void WFoe::attr_quit( void *a_ctx)
...
@@ -2706,6 +2813,18 @@ void WFoe::attr_quit( void *a_ctx)
delete
(
WAtt
*
)
a_ctx
;
delete
(
WAtt
*
)
a_ctx
;
}
}
void
WFoe
::
attredit_quit
(
void
*
a_ctx
)
{
int
sts
;
/* Delete from attribute list */
sts
=
attrlist_delete
(
a_ctx
);
error_msg
(
sts
);
/* Delete the attribute editor */
delete
(
WAttText
*
)
a_ctx
;
}
//
//
// Constructor
// Constructor
//
//
...
...
wb/lib/wb/src/wb_foe.h
View file @
ee2dae07
...
@@ -77,30 +77,39 @@ typedef enum {
...
@@ -77,30 +77,39 @@ typedef enum {
foe_eFuncAccess_Edit
=
1
<<
1
foe_eFuncAccess_Edit
=
1
<<
1
}
foe_eFuncAccess
;
}
foe_eFuncAccess
;
enum
foe_e_popupmenu
{
enum
foe_ePopupmenu
{
foe_e_popupmenu_attribute
=
1
<<
0
,
foe_ePopupmenu_attribute
=
1
<<
0
,
foe_e_popupmenu_subwindow
=
1
<<
1
,
foe_ePopupmenu_subwindow
=
1
<<
1
,
foe_e_popupmenu_connect
=
1
<<
2
,
foe_ePopupmenu_connect
=
1
<<
2
,
foe_e_popupmenu_delete
=
1
<<
3
,
foe_ePopupmenu_delete
=
1
<<
3
,
foe_e_popupmenu_paste
=
1
<<
4
,
foe_ePopupmenu_paste
=
1
<<
4
,
foe_e_popupmenu_copy
=
1
<<
5
,
foe_ePopupmenu_copy
=
1
<<
5
,
foe_e_popupmenu_cut
=
1
<<
6
,
foe_ePopupmenu_cut
=
1
<<
6
,
foe_e_popupmenu_printselect
=
1
<<
7
,
foe_ePopupmenu_printselect
=
1
<<
7
,
foe_e_popupmenu_helpclass
=
1
<<
8
,
foe_ePopupmenu_helpclass
=
1
<<
8
,
foe_e_popupmenu_createobject
=
1
<<
9
foe_ePopupmenu_createobject
=
1
<<
9
,
foe_ePopupmenu_editcode
=
1
<<
10
,
foe_ePopupmenu_edittext
=
1
<<
11
};
};
class
WFoe
;
class
WFoe
;
class
WAtt
;
class
WAtt
;
class
WAttText
;
class
CoWow
;
class
CoWow
;
class
Pal
;
class
Pal
;
class
Nav
;
class
Nav
;
class
wb_build_opt
;
class
wb_build_opt
;
typedef
enum
{
foe_eAttr_WAtt
,
foe_eAttr_WAttText
}
foe_eAttr
;
typedef
struct
{
typedef
struct
{
void
*
a_ctx
;
void
*
a_ctx
;
WFoe
*
foe
;
WFoe
*
foe
;
vldh_t_node
node
;
vldh_t_node
node
;
foe_eAttr
type
;
}
foe_sAttr
;
}
foe_sAttr
;
...
@@ -176,6 +185,11 @@ class WFoe : public WUtility {
...
@@ -176,6 +185,11 @@ class WFoe : public WUtility {
int
a_advanced_user
,
int
a_advanced_user
,
int
a_display_objectname
)
int
a_display_objectname
)
{
return
0
;}
{
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
,
virtual
WFoe
*
subwindow_new
(
void
*
f_parent_ctx
,
char
*
f_name
,
char
*
f_name
,
pwr_tObjid
plcprogram
,
pwr_tObjid
plcprogram
,
...
@@ -240,6 +254,7 @@ class WFoe : public WUtility {
...
@@ -240,6 +254,7 @@ class WFoe : public WUtility {
void
activate_scroll
(
flow_eDirection
dir
);
void
activate_scroll
(
flow_eDirection
dir
);
void
activate_move_object
(
flow_eDirection
dir
);
void
activate_move_object
(
flow_eDirection
dir
);
void
activate_attribute
();
void
activate_attribute
();
void
activate_editcode
();
void
activate_subwindow
();
void
activate_subwindow
();
void
activate_undelete
();
void
activate_undelete
();
void
activate_unselect
();
void
activate_unselect
();
...
@@ -275,6 +290,7 @@ class WFoe : public WUtility {
...
@@ -275,6 +290,7 @@ class WFoe : public WUtility {
void
enable_ldh_cb
();
void
enable_ldh_cb
();
void
disable_ldh_cb
();
void
disable_ldh_cb
();
int
attr_create
(
vldh_t_node
node
);
int
attr_create
(
vldh_t_node
node
);
int
attredit_create
(
vldh_t_node
node
,
const
char
*
aname
);
int
attr_delete
();
int
attr_delete
();
void
attr_set_editmode
(
int
mode
);
void
attr_set_editmode
(
int
mode
);
int
parent_quit
();
int
parent_quit
();
...
@@ -323,11 +339,12 @@ class WFoe : public WUtility {
...
@@ -323,11 +339,12 @@ class WFoe : public WUtility {
static
pwr_tStatus
ldh_this_session_cb
(
void
*
ctx
,
ldh_sEvent
*
event
);
static
pwr_tStatus
ldh_this_session_cb
(
void
*
ctx
,
ldh_sEvent
*
event
);
static
void
error_msg
(
unsigned
long
sts
);
static
void
error_msg
(
unsigned
long
sts
);
static
void
info_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
(
void
*
a_ctx
,
foe_eAttr
type
,
WFoe
**
foe
,
vldh_t_node
*
node
);
static
int
attrlist_get_by_node
(
vldh_t_node
node
,
void
**
a_ctx
);
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
);
static
int
attrlist_insert
(
void
*
a_ctx
,
WFoe
*
foe
,
vldh_t_node
node
,
foe_eAttr
type
);
static
int
attrlist_delete
(
void
*
a_ctx
);
static
int
attrlist_delete
(
void
*
a_ctx
);
static
void
attr_quit
(
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_save
(
WFoe
*
foe
);
static
void
edit_exit_nosave
(
WFoe
*
foe
);
static
void
edit_exit_nosave
(
WFoe
*
foe
);
static
void
delete_subwindow_ok_cb
(
void
*
ctx
,
void
*
data
);
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 {
...
@@ -46,7 +46,8 @@ typedef enum {
wb_eUtility_Distributor
=
1002
,
wb_eUtility_Distributor
=
1002
,
wb_eUtility_SpreadsheetEditor
=
1003
,
wb_eUtility_SpreadsheetEditor
=
1003
,
wb_eUtility_Cmd
=
1004
,
wb_eUtility_Cmd
=
1004
,
wb_eUtility_WNav
=
1005
wb_eUtility_WNav
=
1005
,
wb_eUtility_AttrTextEditor
=
1006
}
wb_eUtility
;
}
wb_eUtility
;
class
WUtility
{
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 @@
...
@@ -91,6 +91,10 @@
#include "wb_expw.h"
#include "wb_expw.h"
#endif
#endif
#ifndef wb_watttext_h
#include "wb_watttext.h"
#endif
#define wnav_cVersion "X3.3a"
#define wnav_cVersion "X3.3a"
#define wnav_cScriptDescKey "!** Description"
#define wnav_cScriptDescKey "!** Description"
...
@@ -349,6 +353,7 @@ class WNav : public WUtility{
...
@@ -349,6 +353,7 @@ class WNav : public WUtility{
virtual
WCrr
*
wcrr_new
(
pwr_tAttrRef
*
aref
,
pwr_tStatus
*
status
)
{
return
0
;}
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
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
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
brow_cb
(
FlowCtx
*
ctx
,
flow_tEvent
event
);
static
int
init_brow_base_cb
(
FlowCtx
*
fctx
,
void
*
client_data
);
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 @@
...
@@ -96,6 +96,7 @@
#include "ge.h"
#include "ge.h"
#include "wb_utl.h"
#include "wb_utl.h"
#include "wb_bck.h"
#include "wb_bck.h"
#include "wb_watttext.h"
#define WNAV_MENU_CREATE 0
#define WNAV_MENU_CREATE 0
#define WNAV_MENU_ADD 1
#define WNAV_MENU_ADD 1
...
@@ -3818,6 +3819,34 @@ static int wnav_open_func( void *client_data,
...
@@ -3818,6 +3819,34 @@ static int wnav_open_func( void *client_data,
wnav
->
logw_new
(
itemp
,
catp
,
showitem
);
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
else
{
{
wnav
->
message
(
'E'
,
"Syntax error"
);
wnav
->
message
(
'E'
,
"Syntax error"
);
...
...
wb/lib/wb/src/wb_wtt.cpp
View file @
ee2dae07
...
@@ -61,6 +61,7 @@
...
@@ -61,6 +61,7 @@
#include "wb_wnav_item.h"
#include "wb_wnav_item.h"
#include "wb_pal.h"
#include "wb_pal.h"
#include "wb_watt.h"
#include "wb_watt.h"
#include "wb_watttext.h"
#include "wb_wda.h"
#include "wb_wda.h"
#include "wb_wtt.h"
#include "wb_wtt.h"
#include "wb_wnav_msg.h"
#include "wb_wnav_msg.h"
...
@@ -2277,6 +2278,14 @@ void wtt_watt_close_cb( void *watt)
...
@@ -2277,6 +2278,14 @@ void wtt_watt_close_cb( void *watt)
wtt
->
appl
.
remove
(
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
)
void
wtt_wda_close_cb
(
void
*
wda
)
{
{
Wtt
*
wtt
=
(
Wtt
*
)
((
Wda
*
)
wda
)
->
parent_ctx
;
Wtt
*
wtt
=
(
Wtt
*
)
((
Wda
*
)
wda
)
->
parent_ctx
;
...
@@ -2294,6 +2303,10 @@ void Wtt::register_utility( void *ctx, wb_eUtility utility)
...
@@ -2294,6 +2303,10 @@ void Wtt::register_utility( void *ctx, wb_eUtility utility)
appl
.
insert
(
utility
,
ctx
,
pwr_cNObjid
,
""
);
appl
.
insert
(
utility
,
ctx
,
pwr_cNObjid
,
""
);
((
WAtt
*
)
ctx
)
->
close_cb
=
wtt_watt_close_cb
;
((
WAtt
*
)
ctx
)
->
close_cb
=
wtt_watt_close_cb
;
break
;
break
;
case
wb_eUtility_AttrTextEditor
:
appl
.
insert
(
utility
,
ctx
,
pwr_cNObjid
,
""
);
((
WAtt
*
)
ctx
)
->
close_cb
=
wtt_watttext_close_cb
;
break
;
case
wb_eUtility_SpreadsheetEditor
:
case
wb_eUtility_SpreadsheetEditor
:
appl
.
insert
(
utility
,
ctx
,
pwr_cNObjid
,
""
);
appl
.
insert
(
utility
,
ctx
,
pwr_cNObjid
,
""
);
((
Wda
*
)
ctx
)
->
close_cb
=
wtt_wda_close_cb
;
((
Wda
*
)
ctx
)
->
close_cb
=
wtt_wda_close_cb
;
...
@@ -2590,6 +2603,14 @@ void WttApplList::set_editmode( int editmode, ldh_tSesContext ldhses)
...
@@ -2590,6 +2603,14 @@ void WttApplList::set_editmode( int editmode, ldh_tSesContext ldhses)
remove
(
elem
->
ctx
);
remove
(
elem
->
ctx
);
elem
=
next_elem
;
elem
=
next_elem
;
continue
;
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
:
case
wb_eUtility_SpreadsheetEditor
:
((
Wda
*
)
elem
->
ctx
)
->
set_editmode
(
editmode
,
ldhses
);
((
Wda
*
)
elem
->
ctx
)
->
set_editmode
(
editmode
,
ldhses
);
break
;
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