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
3bdbf1e2
Commit
3bdbf1e2
authored
Feb 07, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved from src
parent
ae159498
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1116 additions
and
0 deletions
+1116
-0
profibus/mmi/pb/motif/os_linux/hw_x86/makefile
profibus/mmi/pb/motif/os_linux/hw_x86/makefile
+15
-0
profibus/mmi/pb/motif/pb_gsd_attr.uil
profibus/mmi/pb/motif/pb_gsd_attr.uil
+503
-0
src/lib/co/motif/co_mrm_util.c
src/lib/co/motif/co_mrm_util.c
+385
-0
src/lib/co/motif/co_mrm_util.h
src/lib/co/motif/co_mrm_util.h
+53
-0
xtt/lib/flow/motif/flow_x.c
xtt/lib/flow/motif/flow_x.c
+108
-0
xtt/lib/flow/motif/flow_x.h
xtt/lib/flow/motif/flow_x.h
+52
-0
No files found.
profibus/mmi/pb/motif/os_linux/hw_x86/makefile
0 → 100644
View file @
3bdbf1e2
include
$(pwre_dir_symbols)
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq
($($(type_name)_generic_mk),)
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq
($($(type_name)_generic_mk),)
include
$(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include
../../special.mk
-include
../special.mk
-include
special.mk
profibus/mmi/pb/motif/pb_gsd_attr.uil
0 → 100644
View file @
3bdbf1e2
!
! Proview $Id: pb_gsd_attr.uil,v 1.1 2007-02-07 15:40:48 claes Exp $
! Copyright (C) 2005 SSAB Oxelsund AB.
!
! 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 the program, if not, write to the Free Software
! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
!
module pb_gsdattr
version = 'v1.0'
names = case_sensitive
objects = {
XmSeparator = gadget ;
}
identifier
gsdattr_ctx;
procedure
gsdattr_activate_exit(integer);
gsdattr_activate_print(integer);
gsdattr_activate_change_value(integer);
gsdattr_activate_copy(integer);
gsdattr_activate_cut(integer);
gsdattr_activate_paste(integer);
gsdattr_activate_zoom_in(integer);
gsdattr_activate_zoom_out(integer);
gsdattr_activate_zoom_reset(integer);
gsdattr_activate_help(integer);
gsdattr_create_menubutton(integer);
gsdattr_create_msg_label(integer);
gsdattr_create_cmd_prompt(integer);
gsdattr_create_cmd_input(integer);
gsdattr_create_attrnav_form(integer);
gsdattr_create_cmd_ok(integer);
gsdattr_activate_cmd_ok(integer);
gsdattr_create_cmd_ca(integer);
gsdattr_activate_cmd_ca(integer);
value
menu_font : font ('-*-Helvetica-Bold-R-Normal--12-*-*-*-P-*-ISO8859-1');
!----------------------------------------
! First declare the 'top level' widgets. These are not controlled by
! any other widgets. They are each fetched individually as needed.
!----------------------------------------
object gsd_attr_window : XmMainWindow
{
arguments
{
XmNx = 0;
XmNy = 0;
XmNwidth = 450;
XmNheight = 400;
};
controls
{
XmMenuBar attr_menu;
XmPanedWindow main_pane;
};
};
object main_pane : XmPanedWindow
{
arguments
{
XmNtraversalOn = false;
};
controls
{
XmPanedWindow attrnav_form;
XmForm form;
};
};
object form : XmForm
{
arguments
{
XmNwidth = 500;
XmNheight = 100;
XmNpaneMinimum = 100;
XmNpaneMaximum = 100;
XmNresizePolicy = XmRESIZE_NONE;
};
controls
{
XmLabel msg_label;
XmText cmd_input;
XmLabel cmd_prompt;
XmPushButton cmd_ok;
XmPushButton cmd_cancel;
};
};
object attr_menu : XmMenuBar
{
arguments
{
XmNorientation = XmHORIZONTAL;
XmNspacing = 15;
XmNmenuHelpWidget = XmCascadeButton help_entry;
};
controls
{
XmCascadeButton file_entry;
XmCascadeButton edit_entry;
XmCascadeButton functions_entry;
XmCascadeButton view_entry;
XmCascadeButton help_entry;
};
};
object file_entry : XmCascadeButton
{
arguments
{
XmNlabelString = compound_string("File");
XmNfontList = menu_font;
};
controls
{
XmPulldownMenu
{
controls
{
XmPushButton
{
arguments
{
XmNlabelString = compound_string("Print");
XmNfontList = menu_font;
};
callbacks
{
XmNactivateCallback = procedure gsdattr_activate_print(gsdattr_ctx);
};
};
XmPushButton
{
arguments
{
XmNlabelString = compound_string("Close");
XmNfontList = menu_font;
};
callbacks
{
XmNactivateCallback = procedure gsdattr_activate_exit(gsdattr_ctx);
};
};
};
};
};
};
object edit_entry : XmCascadeButton
{
arguments
{
XmNlabelString = compound_string("Edit");
XmNfontList = menu_font;
};
controls
{
XmPulldownMenu
{
controls
{
XmPushButton
{
arguments
{
XmNlabelString = compound_string("Copy");
XmNmnemonic = keysym('C');
XmNaccelerator = "Ctrl<Key>C";
XmNacceleratorText = compound_string('Ctrl+C');
XmNfontList = menu_font;
XmNuserData = 1;
};
callbacks
{
XmNactivateCallback = procedure gsdattr_activate_copy(gsdattr_ctx);
MrmNcreateCallback = procedure gsdattr_create_menubutton( gsdattr_ctx);
};
};
XmPushButton
{
arguments
{
XmNlabelString = compound_string("Cut");
XmNmnemonic = keysym('u');
XmNaccelerator = "Ctrl<Key>X";
XmNacceleratorText = compound_string('Ctrl+X');
XmNfontList = menu_font;
XmNuserData = 2;
};
callbacks
{
XmNactivateCallback = procedure gsdattr_activate_cut(gsdattr_ctx);
MrmNcreateCallback = procedure gsdattr_create_menubutton( gsdattr_ctx);
};
};
XmPushButton
{
arguments
{
XmNlabelString = compound_string("Paste");
XmNmnemonic = keysym('P');
XmNaccelerator = "Ctrl<Key>V";
XmNacceleratorText = compound_string('Ctrl+V');
XmNfontList = menu_font;
XmNuserData = 3;
};
callbacks
{
XmNactivateCallback = procedure gsdattr_activate_paste(gsdattr_ctx);
MrmNcreateCallback = procedure gsdattr_create_menubutton( gsdattr_ctx);
};
};
};
};
};
};
object functions_entry : XmCascadeButton
{
arguments
{
XmNlabelString = compound_string("Functions");
XmNfontList = menu_font;
};
controls
{
XmPulldownMenu
{
controls
{
XmPushButton
{
arguments
{
XmNlabelString = compound_string("Change value");
XmNmnemonic = keysym('H');
XmNaccelerator = "Ctrl<Key>Q";
XmNacceleratorText = compound_string('Ctrl+Q');
XmNfontList = menu_font;
XmNuserData = 4;
};
callbacks
{
XmNactivateCallback = procedure gsdattr_activate_change_value(gsdattr_ctx);
MrmNcreateCallback = procedure gsdattr_create_menubutton( gsdattr_ctx);
};
};
};
};
};
};
object view_entry : XmCascadeButton
{
arguments
{
XmNlabelString = compound_string("View");
XmNfontList = menu_font;
};
controls
{
XmPulldownMenu
{
controls
{
XmPushButton
{
arguments
{
XmNlabelString = compound_string("Zoom in");
XmNmnemonic = keysym('i');
XmNaccelerator = "Ctrl<Key>I";
XmNacceleratorText = compound_string('Ctrl+I');
XmNfontList = menu_font;
};
callbacks
{
XmNactivateCallback = procedure gsdattr_activate_zoom_in(gsdattr_ctx);
};
};
XmPushButton
{
arguments
{
XmNlabelString = compound_string("Zoom out");
XmNmnemonic = keysym('o');
XmNaccelerator = "Ctrl<Key>O";
XmNacceleratorText = compound_string('Ctrl+O');
XmNfontList = menu_font;
};
callbacks
{
XmNactivateCallback = procedure gsdattr_activate_zoom_out(gsdattr_ctx);
};
};
XmPushButton
{
arguments
{
XmNlabelString = compound_string("Zoom reset");
XmNmnemonic = keysym('r');
XmNfontList = menu_font;
};
callbacks
{
XmNactivateCallback = procedure gsdattr_activate_zoom_reset(gsdattr_ctx);
};
};
};
};
};
};
object help_entry : XmCascadeButton
{
arguments
{
XmNlabelString = compound_string("Help");
XmNfontList = menu_font;
};
controls
{
XmPulldownMenu
{
controls
{
XmPushButton
{
arguments
{
XmNlabelString = compound_string("Help");
XmNfontList = menu_font;
};
callbacks
{
XmNactivateCallback = procedure gsdattr_activate_help(gsdattr_ctx);
};
};
};
};
};
};
object attrnav_form : XmPanedWindow
{
arguments
{
! XmNleftAttachment = XmATTACH_FORM;
! XmNrightAttachment = XmATTACH_FORM;
! XmNbottomAttachment = XmATTACH_FORM;
! XmNbottomOffset = 150;
! XmNtopAttachment = XmATTACH_FORM;
! XmNheight = 300;
! XmNpaneMinimum = 300;
};
controls
{
};
callbacks
{
MrmNcreateCallback = procedure gsdattr_create_attrnav_form( gsdattr_ctx);
};
};
object msg_label : XmLabel
{
arguments
{
XmNborderWidth = 0;
XmNrightAttachment = XmATTACH_FORM;
XmNleftAttachment = XmATTACH_FORM;
XmNbottomAttachment = XmATTACH_FORM;
XmNbottomOffset = 50;
XmNalignment = XmALIGNMENT_BEGINNING;
XmNlabelString = "";
XmNheight = 20;
XmNfontList = menu_font;
};
controls
{
};
callbacks
{
MrmNcreateCallback = procedure gsdattr_create_msg_label( gsdattr_ctx);
};
};
object cmd_prompt : XmLabel
{
arguments
{
! XmNborderWidth = 1;
XmNleftAttachment = XmATTACH_FORM;
! XmNbottomAttachment = XmATTACH_FORM;
! XmNbottomOffset = 20;
XmNtopAttachment = XmATTACH_WIDGET;
XmNtopWidget = XmPanedWindow attrnav_form;
XmNtopOffset = 5;
XmNalignment = XmALIGNMENT_BEGINNING;
XmNlabelString = "";
XmNwidth = 50;
XmNheight = 30;
XmNfontList = menu_font;
};
controls
{
};
callbacks
{
MrmNcreateCallback = procedure gsdattr_create_cmd_prompt ( gsdattr_ctx) ;
};
};
object cmd_input : XmText
{
arguments
{
XmNleftAttachment = XmATTACH_FORM;
XmNleftOffset = 50;
XmNrightAttachment = XmATTACH_FORM;
XmNtopAttachment = XmATTACH_WIDGET;
XmNtopWidget = XmPanedWindow attrnav_form;
! XmNeditMode = XmMULTI_LINE_EDIT;
XmNrows = 1;
XmNborderWidth = 0;
XmNshadowThickness = 0;
XmNheight = 30;
XmNfontList = menu_font;
};
controls
{
};
callbacks
{
MrmNcreateCallback = procedure gsdattr_create_cmd_input( gsdattr_ctx);
};
};
object cmd_ok : XmPushButton
{
arguments
{
XmNlabelString = compound_string(" Apply");
XmNleftAttachment = XmATTACH_FORM;
XmNleftOffset = 50;
XmNbottomAttachment = XmATTACH_FORM;
XmNbottomOffset = 10;
XmNalignment = XmALIGNMENT_BEGINNING;
XmNwidth = 70;
!XmNheight = 30;
XmNfontList = menu_font;
};
callbacks
{
MrmNcreateCallback = procedure gsdattr_create_cmd_ok( gsdattr_ctx);
XmNactivateCallback = procedure gsdattr_activate_cmd_ok(gsdattr_ctx);
};
};
object cmd_cancel : XmPushButton
{
arguments
{
XmNlabelString = compound_string(" Close");
XmNrightAttachment = XmATTACH_FORM;
XmNrightOffset = 110;
XmNbottomAttachment = XmATTACH_FORM;
XmNbottomOffset = 10;
XmNalignment = XmALIGNMENT_BEGINNING;
XmNwidth = 70;
!XmNheight = 30;
XmNfontList = menu_font;
};
callbacks
{
MrmNcreateCallback = procedure gsdattr_create_cmd_ca( gsdattr_ctx);
XmNactivateCallback = procedure gsdattr_activate_cmd_ca(gsdattr_ctx);
};
};
end module;
src/lib/co/motif/co_mrm_util.c
0 → 100644
View file @
3bdbf1e2
/**
* Proview $Id: co_mrm_util.c,v 1.1 2007-02-07 15:37:44 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
/* co_mrm_util.c -- Motif utitlities */
#if !defined OS_ELN
#include <stdio.h>
#include <stdlib.h>
#include <Xm/Xm.h>
#include <Xm/XmP.h>
#include <Xm/Text.h>
#include <Mrm/MrmPublic.h>
#include <X11/Intrinsic.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#define XK_MISCELLANY
#include <X11/keysymdef.h>
#if defined OS_VMS
#include <Xm/DECWmHints.h>
#endif
#include "flow_x.h"
#include "co_mrm_util.h"
//
// Init motif text widget with recall.
//
void
mrm_TextInit
(
Widget
w
,
XtActionProc
value_changed_cb
,
mrm_eUtility
utility
)
{
// Wtt, Xtt and Admin will not appear in the same executable ?
switch
(
utility
)
{
case
mrm_eUtility_Wtt
:
case
mrm_eUtility_Xtt
:
case
mrm_eUtility_Admin
:
{
static
XtTranslations
compiled_translations_wtt
=
NULL
;
static
char
translations_wtt
[]
=
"<KeyDown>: key_down_wtt()"
;
static
XtActionsRec
actions_wtt
[
1
]
=
{
{
"key_down_wtt"
,
0
}
};
actions_wtt
[
0
].
proc
=
value_changed_cb
;
if
(
compiled_translations_wtt
==
NULL
)
XtAppAddActions
(
XtWidgetToApplicationContext
(
w
),
actions_wtt
,
XtNumber
(
actions_wtt
));
if
(
compiled_translations_wtt
==
NULL
)
compiled_translations_wtt
=
XtParseTranslationTable
(
translations_wtt
);
XtOverrideTranslations
(
w
,
compiled_translations_wtt
);
break
;
}
case
mrm_eUtility_Ge
:
{
static
XtTranslations
compiled_translations_ge
=
NULL
;
static
char
translations_ge
[]
=
"<KeyDown>: key_down_ge()"
;
static
XtActionsRec
actions_ge
[
1
]
=
{
{
"key_down_ge"
,
0
}
};
actions_ge
[
0
].
proc
=
value_changed_cb
;
if
(
compiled_translations_ge
==
NULL
)
XtAppAddActions
(
XtWidgetToApplicationContext
(
w
),
actions_ge
,
XtNumber
(
actions_ge
));
if
(
compiled_translations_ge
==
NULL
)
compiled_translations_ge
=
XtParseTranslationTable
(
translations_ge
);
XtOverrideTranslations
(
w
,
compiled_translations_ge
);
break
;
}
case
mrm_eUtility_WAtt
:
case
mrm_eUtility_XAtt
:
{
static
XtTranslations
compiled_translations_watt
=
NULL
;
static
char
translations_watt
[]
=
"<KeyDown>: key_down_watt()"
;
static
XtActionsRec
actions_watt
[
1
]
=
{
{
"key_down_watt"
,
0
}
};
actions_watt
[
0
].
proc
=
value_changed_cb
;
if
(
compiled_translations_watt
==
NULL
)
XtAppAddActions
(
XtWidgetToApplicationContext
(
w
),
actions_watt
,
XtNumber
(
actions_watt
));
if
(
compiled_translations_watt
==
NULL
)
compiled_translations_watt
=
XtParseTranslationTable
(
translations_watt
);
XtOverrideTranslations
(
w
,
compiled_translations_watt
);
break
;
}
case
mrm_eUtility_Wda
:
case
mrm_eUtility_XAttOne
:
{
static
XtTranslations
compiled_translations_wda
=
NULL
;
static
char
translations_wda
[]
=
"<KeyDown>: key_down_wda()"
;
static
XtActionsRec
actions_wda
[
1
]
=
{
{
"key_down_wda"
,
0
}
};
actions_wda
[
0
].
proc
=
value_changed_cb
;
if
(
compiled_translations_wda
==
NULL
)
XtAppAddActions
(
XtWidgetToApplicationContext
(
w
),
actions_wda
,
XtNumber
(
actions_wda
));
if
(
compiled_translations_wda
==
NULL
)
compiled_translations_wda
=
XtParseTranslationTable
(
translations_wda
);
XtOverrideTranslations
(
w
,
compiled_translations_wda
);
break
;
}
case
mrm_eUtility_Attr
:
{
static
XtTranslations
compiled_translations_attr
=
NULL
;
static
char
translations_attr
[]
=
"<KeyDown>: key_down_attr()"
;
static
XtActionsRec
actions_attr
[
1
]
=
{
{
"key_down_attr"
,
0
}
};
actions_attr
[
0
].
proc
=
value_changed_cb
;
if
(
compiled_translations_attr
==
NULL
)
XtAppAddActions
(
XtWidgetToApplicationContext
(
w
),
actions_attr
,
XtNumber
(
actions_attr
));
if
(
compiled_translations_attr
==
NULL
)
compiled_translations_attr
=
XtParseTranslationTable
(
translations_attr
);
XtOverrideTranslations
(
w
,
compiled_translations_attr
);
break
;
}
case
mrm_eUtility_GsdAttr
:
{
static
XtTranslations
compiled_translations_gsdattr
=
NULL
;
static
char
translations_gsdattr
[]
=
"<KeyDown>: key_down_gsdattr()"
;
static
XtActionsRec
actions_gsdattr
[
1
]
=
{
{
"key_down_gsdattr"
,
0
}
};
actions_gsdattr
[
0
].
proc
=
value_changed_cb
;
if
(
compiled_translations_gsdattr
==
NULL
)
XtAppAddActions
(
XtWidgetToApplicationContext
(
w
),
actions_gsdattr
,
XtNumber
(
actions_gsdattr
));
if
(
compiled_translations_gsdattr
==
NULL
)
compiled_translations_gsdattr
=
XtParseTranslationTable
(
translations_gsdattr
);
XtOverrideTranslations
(
w
,
compiled_translations_gsdattr
);
break
;
}
default:
;
}
}
//
// Input from motif text-widget with recall
// Returns 1 if return i pressed, else 0.
//
int
mrm_TextInput
(
Widget
w
,
XEvent
*
event
,
char
*
recall
,
int
line_size
,
int
recall_size
,
int
*
current_recall_line
)
{
KeySym
keysym
;
Modifiers
mod
;
int
pos
;
char
*
text
;
char
newtext
[
160
];
int
i
;
XmTextPosition
left
,
right
;
char
*
s
,
*
t
;
text
=
XmTextGetString
(
w
);
XtTranslateKeycode
(
flow_Display
(
w
),
event
->
xkey
.
keycode
,
event
->
xkey
.
state
,
&
mod
,
&
keysym
);
keysym
&=
0xFFFF
;
switch
(
keysym
)
{
case
XK_Return
:
case
XK_Linefeed
:
// Insert in recall buffer
if
(
strcmp
(
text
,
""
)
!=
0
)
{
for
(
i
=
recall_size
-
2
;
i
>=
0
;
i
--
)
strcpy
(
recall
+
(
i
+
1
)
*
line_size
,
recall
+
i
*
line_size
);
strncpy
(
recall
,
text
,
line_size
);
recall
[
line_size
-
1
]
=
0
;
}
*
current_recall_line
=
0
;
return
1
;
case
XK_Up
:
(
*
current_recall_line
)
++
;
if
(
*
current_recall_line
>
recall_size
-
1
)
*
current_recall_line
=
recall_size
-
1
;
XmTextSetString
(
w
,
recall
+
(
*
current_recall_line
-
1
)
*
line_size
);
XmTextSetCursorPosition
(
w
,
strlen
(
recall
+
(
*
current_recall_line
-
1
)
*
line_size
));
break
;
case
XK_Down
:
if
(
*
current_recall_line
==
0
)
XmTextSetString
(
w
,
""
);
else
if
(
*
current_recall_line
==
1
)
{
XmTextSetString
(
w
,
""
);
(
*
current_recall_line
)
--
;
}
else
{
(
*
current_recall_line
)
--
;
XmTextSetString
(
w
,
recall
+
(
*
current_recall_line
-
1
)
*
line_size
);
XmTextSetCursorPosition
(
w
,
strlen
(
recall
+
(
*
current_recall_line
-
1
)
*
line_size
));
}
break
;
case
XK_Left
:
XmTextClearSelection
(
w
,
CurrentTime
);
pos
=
XmTextGetCursorPosition
(
w
);
if
(
pos
==
0
)
break
;
pos
--
;
XmTextSetCursorPosition
(
w
,
pos
);
break
;
case
XK_Right
:
XmTextClearSelection
(
w
,
CurrentTime
);
pos
=
XmTextGetCursorPosition
(
w
);
if
(
pos
>=
line_size
-
1
)
break
;
pos
++
;
if
(
pos
>
strlen
(
text
))
break
;
XmTextSetCursorPosition
(
w
,
pos
);
break
;
case
XK_BackSpace
:
case
65535
:
if
(
XmTextGetSelectionPosition
(
w
,
&
left
,
&
right
))
{
for
(
s
=
text
+
left
,
t
=
text
+
right
;
*
t
;
s
++
,
t
++
)
*
s
=
*
t
;
*
s
=
0
;
XmTextSetString
(
w
,
text
);
XmTextSetCursorPosition
(
w
,
left
);
}
else
{
pos
=
XmTextGetCursorPosition
(
w
);
if
(
pos
==
0
)
break
;
if
(
pos
==
1
)
strcpy
(
newtext
,
""
);
else
strncpy
(
newtext
,
text
,
pos
-
1
);
newtext
[
pos
-
1
]
=
0
;
strncat
(
newtext
,
&
text
[
pos
],
sizeof
(
newtext
));
XmTextSetString
(
w
,
newtext
);
XmTextSetCursorPosition
(
w
,
pos
-
1
);
}
break
;
default:
if
(
event
->
xkey
.
state
&
ControlMask
)
return
0
;
if
(
keysym
>
256
)
return
0
;
if
(
XmTextGetSelectionPosition
(
w
,
&
left
,
&
right
))
{
for
(
s
=
text
+
left
,
t
=
text
+
right
;
*
t
;
s
++
,
t
++
)
*
s
=
*
t
;
*
s
=
0
;
XmTextSetCursorPosition
(
w
,
left
);
}
pos
=
XmTextGetCursorPosition
(
w
);
if
(
pos
>=
line_size
-
1
)
break
;
if
(
pos
==
0
)
strcpy
(
newtext
,
""
);
else
strncpy
(
newtext
,
text
,
pos
);
newtext
[
pos
]
=
keysym
;
newtext
[
pos
+
1
]
=
0
;
strncat
(
newtext
,
&
text
[
pos
],
sizeof
(
newtext
));
XmTextSetString
(
w
,
newtext
);
XmTextSetCursorPosition
(
w
,
pos
+
1
);
}
return
0
;
}
int
mrm_IsIconicState
(
Widget
W
)
{
#if defined OS_VMS
static
Atom
WmStateAtom
=
0
;
int
state
,
sts
;
int
Iconic
=
0
;
WmIconStateRec
*
IconStateData
;
Atom
atom_ret
;
int
format_ret
;
unsigned
long
nitems_ret
,
bytesleft
;
Widget
Shell
;
if
(
W
==
NULL
)
return
FALSE
;
Shell
=
W
;
while
(
!
XtIsShell
(
Shell
))
Shell
=
XtParent
(
Shell
);
if
(
WmStateAtom
==
0
)
{
WmStateAtom
=
XInternAtom
(
XtDisplay
(
Shell
),
"WM_STATE"
,
1
);
}
if
(
WmStateAtom
)
{
sts
=
XGetWindowProperty
(
XtDisplay
(
Shell
),
XtWindow
(
Shell
),
WmStateAtom
,
0L
,
(
sizeof
(
*
IconStateData
)
/
sizeof
(
long
)),
FALSE
,
AnyPropertyType
,
&
atom_ret
,
&
format_ret
,
&
nitems_ret
,
&
bytesleft
,
(
unsigned
char
**
)
&
IconStateData
);
if
(
sts
==
Success
&&
IconStateData
!=
NULL
&&
IconStateData
->
state
==
IconicState
)
Iconic
=
TRUE
;
else
Iconic
=
FALSE
;
if
(
sts
==
Success
&&
IconStateData
!=
NULL
)
XFree
(
IconStateData
);
}
return
Iconic
;
#else
return
0
;
#endif
}
void
mrm_PositionPopup
(
Widget
popup
,
Widget
parent
,
int
x
,
int
y
)
{
short
x0
,
y0
,
x1
,
y1
;
Arg
args
[
5
];
Widget
grandparent
;
x0
=
(
short
)
x
;
y0
=
(
short
)
y
;
grandparent
=
XtParent
(
parent
);
while
(
grandparent
)
{
XtSetArg
(
args
[
0
],
XmNx
,
&
x1
);
XtSetArg
(
args
[
1
],
XmNy
,
&
y1
);
XtGetValues
(
parent
,
args
,
2
);
if
(
XtIsShell
(
parent
))
break
;
x0
+=
x1
;
y0
+=
y1
;
parent
=
grandparent
;
grandparent
=
XtParent
(
parent
);
}
XtSetArg
(
args
[
0
],
XmNx
,
x0
);
XtSetArg
(
args
[
1
],
XmNy
,
y0
);
XtSetValues
(
popup
,
args
,
2
);
}
#endif
src/lib/co/motif/co_mrm_util.h
0 → 100644
View file @
3bdbf1e2
/**
* Proview $Id: co_mrm_util.h,v 1.1 2007-02-07 15:37:44 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef co_mrm_util_h
#define co_mrm_util_h
/* co_mrm_util.h -- Motif utitlities */
#ifdef __cplusplus
extern
"C"
{
#endif
typedef
enum
{
mrm_eUtility_Xtt
,
mrm_eUtility_Admin
,
mrm_eUtility_Wtt
,
mrm_eUtility_Ge
,
mrm_eUtility_PlcEditor
,
mrm_eUtility_WAtt
,
mrm_eUtility_Attr
,
mrm_eUtility_Wda
,
mrm_eUtility_XAtt
,
mrm_eUtility_XAttOne
,
mrm_eUtility_GsdAttr
}
mrm_eUtility
;
void
mrm_TextInit
(
Widget
w
,
XtActionProc
value_changed_cb
,
mrm_eUtility
utility
);
int
mrm_TextInput
(
Widget
w
,
XEvent
*
event
,
char
*
recall
,
int
line_size
,
int
recall_size
,
int
*
current_recall_line
);
int
mrm_IsIconicState
(
Widget
W
);
void
mrm_PositionPopup
(
Widget
popup
,
Widget
parent
,
int
x
,
int
y
);
#ifdef __cplusplus
}
#endif
#endif
xtt/lib/flow/motif/flow_x.c
0 → 100644
View file @
3bdbf1e2
/**
* Proview $Id: flow_x.c,v 1.1 2007-02-07 15:44:25 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
//
// Interface to Xlib and Xt macros which is compiled with alignment on alpha.
// Proview $Id: flow_x.c,v 1.1 2007-02-07 15:44:25 claes Exp $ is compiled without alignment X-macros doesn't work, and neither
// does the #pragma alignment...
//
#include "flow_std.h"
#include <stdio.h>
#include <stdlib.h>
#include <Xm/Xm.h>
#include <Xm/XmP.h>
#include <Mrm/MrmPublic.h>
#include <Xm/Protocols.h>
#include <X11/Intrinsic.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include "flow_x.h"
void
flow_SetInputFocus
(
Widget
w
)
{
XSetInputFocus
(
XtDisplay
(
w
),
XtWindow
(
w
),
RevertToParent
,
CurrentTime
);
}
Boolean
flow_IsShell
(
Widget
w
)
{
return
XtIsShell
(
w
);
}
Boolean
flow_IsManaged
(
Widget
w
)
{
return
XtIsManaged
(
w
);
}
Boolean
flow_IsRealized
(
Widget
w
)
{
return
XtIsRealized
(
w
);
}
void
flow_AddCloseVMProtocolCb
(
Widget
shell
,
XtCallbackProc
callback
,
void
*
client_data
)
{
Atom
WM_DELETE_WINDOW
=
XmInternAtom
(
XtDisplay
(
shell
),
"WM_DELETE_WINDOW"
,
False
);
XmAddWMProtocolCallback
(
shell
,
WM_DELETE_WINDOW
,
callback
,
client_data
);
}
void
flow_Bell
(
Widget
w
)
{
XBell
(
XtDisplay
(
w
),
100
);
}
void
flow_UnmapWidget
(
Widget
w
)
{
XtUnmapWidget
(
w
);
}
void
flow_MapWidget
(
Widget
w
)
{
XtMapWidget
(
w
);
}
Screen
*
flow_Screen
(
Widget
w
)
{
return
XtScreen
(
w
);
}
Display
*
flow_Display
(
Widget
w
)
{
return
XtDisplay
(
w
);
}
Window
flow_Window
(
Widget
w
)
{
return
XtWindow
(
w
);
}
int
flow_IsViewable
(
Widget
w
)
{
XWindowAttributes
xwa
;
if
(
XGetWindowAttributes
(
XtDisplay
(
w
),
XtWindow
(
w
),
&
xwa
)
&&
xwa
.
map_state
==
IsViewable
)
return
1
;
return
0
;
}
xtt/lib/flow/motif/flow_x.h
0 → 100644
View file @
3bdbf1e2
/*
* Proview $Id: flow_x.h,v 1.1 2007-02-07 15:36:52 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef flow_x_h
#define flow_x_h
#if defined __cplusplus
extern
"C"
{
#endif
#include <Xm/Xm.h>
#include <Mrm/MrmPublic.h>
#ifndef _XtIntrinsic_h
#include <X11/Intrinsic.h>
#endif
#include <X11/Xlib.h>
#include <X11/Xutil.h>
void
flow_SetInputFocus
(
Widget
w
);
Boolean
flow_IsManaged
(
Widget
w
);
Boolean
flow_IsShell
(
Widget
w
);
Boolean
flow_IsRealized
(
Widget
w
);
void
flow_AddCloseVMProtocolCb
(
Widget
shell
,
XtCallbackProc
callback
,
void
*
client_data
);
void
flow_Bell
(
Widget
w
);
void
flow_UnmapWidget
(
Widget
w
);
void
flow_MapWidget
(
Widget
w
);
Screen
*
flow_Screen
(
Widget
w
);
Display
*
flow_Display
(
Widget
w
);
Window
flow_Window
(
Widget
w
);
int
flow_IsViewable
(
Widget
w
);
#if defined __cplusplus
}
#endif
#endif
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