Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
51
cde/programs/dticon/Dticon
Normal file
51
cde/programs/dticon/Dticon
Normal file
@@ -0,0 +1,51 @@
|
||||
!######################################################################
|
||||
!#
|
||||
!# Dticon
|
||||
!#
|
||||
!# Common Desktop Environment (CDE)
|
||||
!#
|
||||
!# Application Defaults for the CDE DT Icon Editor
|
||||
!#
|
||||
!# (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
!# (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
!# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
!# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary
|
||||
!# of Novell, Inc.
|
||||
!#
|
||||
!# $XConsortium: Dticon /main/4 1996/08/09 14:46:18 mustafa $
|
||||
!#
|
||||
!######################################################################
|
||||
!#
|
||||
!# These resources set the accelerators used in the Icon Editor
|
||||
!# along with the accelerator Text.
|
||||
!#
|
||||
|
||||
#include "Dt"
|
||||
|
||||
Dticon*fileMenu.exit.acceleratorText: %|nls-9-#Alt+F4#|
|
||||
Dticon*fileMenu.exit.accelerator: %|nls-10-#Alt<Key>F4#|
|
||||
Dticon*editMenu.undo.acceleratorText: %|nls-7-#Ctrl+Z#|
|
||||
Dticon*editMenu.undo.accelerator: %|nls-8-#Ctrl<Key>Z#|
|
||||
Dticon*editMenu.cut.acceleratorText: %|nls-5-#Ctrl+X#|
|
||||
Dticon*editMenu.cut.accelerator: %|nls-6-#Ctrl<Key>X#|
|
||||
Dticon*editMenu.copy.acceleratorText: %|nls-3-#Ctrl+C#|
|
||||
Dticon*editMenu.copy.accelerator: %|nls-4-#Ctrl<Key>C#|
|
||||
Dticon*editMenu.paste.acceleratorText: %|nls-1-#Ctrl+V#|
|
||||
Dticon*editMenu.paste.accelerator: %|nls-2-#Ctrl<Key>V#|
|
||||
|
||||
Dticon*fileMenu.new.acceleratorText: %|nls-11-#Ctrl+N#|
|
||||
Dticon*fileMenu.new.accelerator: %|nls-12-#Ctrl<Key>N#|
|
||||
Dticon*fileMenu.open.acceleratorText: %|nls-13-#Ctrl+O#|
|
||||
Dticon*fileMenu.open.accelerator: %|nls-14-#Ctrl<Key>O#|
|
||||
Dticon*fileMenu.save.acceleratorText: %|nls-15-#Ctrl+S#|
|
||||
Dticon*fileMenu.save.accelerator: %|nls-16-#Ctrl<Key>S#|
|
||||
Dticon*fileMenu.saveas.acceleratorText: %|nls-17-#Ctrl+A#|
|
||||
Dticon*fileMenu.saveas.accelerator: %|nls-18-#Ctrl<Key>A#|
|
||||
|
||||
Dticon*instructionText.alignment: alignment_beginning
|
||||
|
||||
Dticon*useMessaging: True
|
||||
Dticon*useFileFilter: False
|
||||
!#Dticon*secondaryColorSetId: 1
|
||||
|
||||
!########################### eof ###########################
|
||||
15
cde/programs/dticon/FileSetNums
Normal file
15
cde/programs/dticon/FileSetNums
Normal file
@@ -0,0 +1,15 @@
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
2 fileIODialog.c
|
||||
4 newIconDialog.c
|
||||
6 queryDialog.c
|
||||
8 stdErrDialog.c
|
||||
10 utils.c
|
||||
12 dtIconShell.c
|
||||
14 help.c
|
||||
16 process.c
|
||||
69
cde/programs/dticon/Imakefile
Normal file
69
cde/programs/dticon/Imakefile
Normal file
@@ -0,0 +1,69 @@
|
||||
XCOMM $XConsortium: Imakefile /main/9 1996/10/09 14:05:31 drk $
|
||||
|
||||
XCOMM
|
||||
XCOMM Imakefile: for DT Icon Editor
|
||||
XCOMM
|
||||
|
||||
/* General case INCLUDES DEFINES LOCAL_LIBRARIES
|
||||
* Each individual architecture may have more or less of the above.
|
||||
* Use EXTRA_DEFINES and EXTRA_INCLUDES to add defines and includes
|
||||
* to an individual architecture. There is no equivalent for
|
||||
* LOCAL_LIBRARIES.
|
||||
* USE_libraryname in LOCAL_LIBRARIES is by default empty.
|
||||
* It should be set when necessary to the real library macro name.
|
||||
*/
|
||||
|
||||
DEFINES = -D__TOOLTALK
|
||||
INCLUDES = -I.
|
||||
#if defined (SunArchitecture)
|
||||
DEPLIBS = $(DEPDTWIDGETLIB) $(DEPDTSVCLIB) $(DEPTTLIB) \
|
||||
$(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB)
|
||||
LOCAL_LIBRARIES = $(DTWIDGETLIB) $(DTSVCLIB) $(TTLIB) \
|
||||
$(XMLIB) $(XTOOLLIB) $(XLIB)
|
||||
#else
|
||||
DEPLIBS = $(DEPDTHELPLIB) $(DEPDTWIDGETLIB) $(DEPDTSVCLIB) $(DEPTTLIB) \
|
||||
$(DEPXMLIB) $(DEPXTOOLLIB) $(DEPXLIB)
|
||||
LOCAL_LIBRARIES = $(DTHELPLIB) $(DTWIDGETLIB) $(DTSVCLIB) $(TTLIB) \
|
||||
$(XMLIB) $(XTOOLLIB) $(XLIB)
|
||||
#endif /* SunArchitecture */
|
||||
SYS_LIBRARIES = -lm
|
||||
|
||||
#ifdef HPArchitecture
|
||||
#endif
|
||||
|
||||
#ifdef RsArchitecture
|
||||
EXTRA_DEFINES =
|
||||
SYS_LIBRARIES = -lm -liconv
|
||||
#endif
|
||||
|
||||
#if defined (SunArchitecture)
|
||||
SYS_LIBRARIES = -lm -ldl
|
||||
#endif /* SunArchitecture */
|
||||
|
||||
#if defined (USLArchitecture)
|
||||
SYS_LIBRARIES = -lm -ldl -lgen
|
||||
#endif /* USLArchitecture */
|
||||
|
||||
#if defined (UXPArchitecture)
|
||||
EXTRA_DEFINES =
|
||||
SYS_LIBRARIES = -lm -ldl -lgen
|
||||
#endif /* UXPArchitecture */
|
||||
|
||||
#if defined (AlphaArchitecture)
|
||||
EXTRA_DEFINES =
|
||||
#endif
|
||||
|
||||
|
||||
SRCS = dtIconShell.c event.c fileIO.c \
|
||||
fileIODialog.c globals.c graphics.c \
|
||||
help.c image.c main.c \
|
||||
newIconDialog.c process.c queryDialog.c \
|
||||
stdErrDialog.c utils.c version.c
|
||||
|
||||
OBJS = dtIconShell.o event.o fileIO.o \
|
||||
fileIODialog.o globals.o graphics.o \
|
||||
help.o image.o main.o \
|
||||
newIconDialog.o process.o queryDialog.o \
|
||||
stdErrDialog.o utils.o version.o
|
||||
|
||||
ComplexProgramTarget(dticon)
|
||||
22
cde/programs/dticon/bitmaps/circle.xbm
Normal file
22
cde/programs/dticon/bitmaps/circle.xbm
Normal file
@@ -0,0 +1,22 @@
|
||||
/* $XConsortium: circle.xbm /main/3 1995/11/02 14:07:27 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#define circle_width 32
|
||||
#define circle_height 32
|
||||
static unsigned char circle_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00,
|
||||
0x00, 0xfc, 0x3f, 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x80, 0x03, 0xc0, 0x01,
|
||||
0x80, 0x01, 0x80, 0x01, 0xc0, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x00, 0x07,
|
||||
0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06,
|
||||
0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06,
|
||||
0x60, 0x00, 0x00, 0x06, 0x60, 0x00, 0x00, 0x06, 0xe0, 0x00, 0x00, 0x07,
|
||||
0xc0, 0x00, 0x00, 0x03, 0x80, 0x01, 0x80, 0x01, 0x80, 0x03, 0xc0, 0x01,
|
||||
0x00, 0x0f, 0xf0, 0x00, 0x00, 0xfc, 0x3f, 0x00, 0x00, 0xf8, 0x1f, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
22
cde/programs/dticon/bitmaps/ellipse.xbm
Normal file
22
cde/programs/dticon/bitmaps/ellipse.xbm
Normal file
@@ -0,0 +1,22 @@
|
||||
/* $XConsortium: ellipse.xbm /main/3 1995/11/02 14:07:37 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#define ellipse_width 32
|
||||
#define ellipse_height 32
|
||||
static unsigned char ellipse_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x3f, 0x00, 0x80, 0xff, 0xff, 0x01,
|
||||
0xe0, 0x03, 0xc0, 0x07, 0x70, 0x00, 0x00, 0x0e, 0x38, 0x00, 0x00, 0x1c,
|
||||
0x1c, 0x00, 0x00, 0x38, 0x0c, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x30,
|
||||
0x0c, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x30, 0x0c, 0x00, 0x00, 0x30,
|
||||
0x1c, 0x00, 0x00, 0x38, 0x38, 0x00, 0x00, 0x1c, 0x70, 0x00, 0x00, 0x0e,
|
||||
0xe0, 0x03, 0xc0, 0x07, 0x80, 0xff, 0xff, 0x01, 0x00, 0xfc, 0x3f, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
22
cde/programs/dticon/bitmaps/eraser.xbm
Normal file
22
cde/programs/dticon/bitmaps/eraser.xbm
Normal file
@@ -0,0 +1,22 @@
|
||||
/* $XConsortium: eraser.xbm /main/3 1995/11/02 14:07:47 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#define eraser_width 32
|
||||
#define eraser_height 32
|
||||
static unsigned char eraser_bits[] = {
|
||||
0x40, 0x15, 0x00, 0x00, 0xa8, 0x2a, 0x00, 0x00, 0x54, 0x55, 0x00, 0x00,
|
||||
0xaa, 0xaa, 0x00, 0x00, 0x54, 0x55, 0x01, 0x00, 0xaa, 0xaa, 0x02, 0x00,
|
||||
0x55, 0x55, 0x05, 0x00, 0xaa, 0xaa, 0x0a, 0x00, 0x55, 0x55, 0x15, 0x00,
|
||||
0xaa, 0xaa, 0x3f, 0x00, 0x55, 0xd5, 0x40, 0x00, 0xaa, 0x3a, 0x80, 0x00,
|
||||
0x55, 0x0d, 0xf8, 0x01, 0xaa, 0x0a, 0x06, 0x02, 0x54, 0x85, 0x01, 0x04,
|
||||
0xa8, 0x46, 0x00, 0x08, 0x50, 0x43, 0x00, 0x10, 0xa0, 0x22, 0x80, 0x2a,
|
||||
0x40, 0x23, 0x20, 0x40, 0x80, 0x12, 0x08, 0x40, 0x00, 0x13, 0x00, 0x80,
|
||||
0x00, 0x12, 0x04, 0x80, 0x00, 0x14, 0x00, 0x80, 0x00, 0x18, 0x02, 0x80,
|
||||
0x00, 0x10, 0x00, 0x80, 0x00, 0x20, 0x02, 0x80, 0x00, 0x40, 0x00, 0x40,
|
||||
0x00, 0x80, 0x02, 0x40, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00, 0x02, 0x10,
|
||||
0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00, 0xf0, 0x03};
|
||||
22
cde/programs/dticon/bitmaps/face.xbm
Normal file
22
cde/programs/dticon/bitmaps/face.xbm
Normal file
@@ -0,0 +1,22 @@
|
||||
/* $XConsortium: face.xbm /main/3 1995/11/02 14:07:56 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#define face_width 32
|
||||
#define face_height 32
|
||||
static unsigned char face_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x0e, 0x38, 0x00,
|
||||
0x80, 0x01, 0xc0, 0x00, 0x40, 0x1c, 0x1c, 0x01, 0x20, 0x20, 0x02, 0x02,
|
||||
0x90, 0x4f, 0xf9, 0x04, 0x48, 0x90, 0x04, 0x09, 0x28, 0xa0, 0x02, 0x0a,
|
||||
0x24, 0xa0, 0x02, 0x12, 0x24, 0xa2, 0x22, 0x12, 0x24, 0xa0, 0x02, 0x12,
|
||||
0x22, 0xa0, 0x02, 0x22, 0x42, 0x90, 0x04, 0x21, 0x82, 0x8f, 0xf8, 0x20,
|
||||
0x02, 0x80, 0x00, 0x20, 0x02, 0x10, 0x04, 0x20, 0x02, 0x28, 0x0a, 0x20,
|
||||
0x02, 0xc4, 0x11, 0x20, 0x04, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x10,
|
||||
0x84, 0x83, 0xe0, 0x10, 0x08, 0x84, 0x10, 0x08, 0x08, 0xf8, 0x0f, 0x08,
|
||||
0x10, 0x04, 0x10, 0x04, 0x20, 0x08, 0x08, 0x02, 0x40, 0xf0, 0x07, 0x01,
|
||||
0x80, 0x01, 0xc0, 0x00, 0x00, 0x0e, 0x38, 0x00, 0x00, 0xf0, 0x07, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
22
cde/programs/dticon/bitmaps/flood.xbm
Normal file
22
cde/programs/dticon/bitmaps/flood.xbm
Normal file
@@ -0,0 +1,22 @@
|
||||
/* $XConsortium: flood.xbm /main/3 1995/11/02 14:08:04 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#define flood_width 32
|
||||
#define flood_height 32
|
||||
static unsigned char flood_bits[] = {
|
||||
0x10, 0x18, 0x00, 0x00, 0x20, 0x2c, 0x00, 0x00, 0x40, 0x52, 0x00, 0x00,
|
||||
0x80, 0xa1, 0x00, 0x00, 0x80, 0x41, 0x3f, 0x00, 0x40, 0x82, 0xfa, 0x00,
|
||||
0x20, 0x04, 0x75, 0x01, 0x10, 0x38, 0xea, 0x01, 0x08, 0x28, 0xd4, 0x03,
|
||||
0x04, 0x38, 0xd8, 0x03, 0x02, 0x00, 0xe8, 0x02, 0x01, 0x00, 0xa4, 0x03,
|
||||
0x01, 0x00, 0xe2, 0x03, 0x02, 0x00, 0x61, 0x03, 0x04, 0x80, 0xf0, 0x07,
|
||||
0x08, 0x40, 0xf0, 0x05, 0x10, 0x20, 0xb0, 0x07, 0x20, 0x10, 0xf0, 0x06,
|
||||
0x40, 0x08, 0xd0, 0x07, 0x80, 0x04, 0x70, 0x07, 0x00, 0x03, 0xf0, 0x05,
|
||||
0x00, 0x00, 0xd0, 0x07, 0x00, 0x00, 0xf8, 0x0d, 0x00, 0x00, 0xb8, 0x0f,
|
||||
0x00, 0x00, 0xf8, 0x0e, 0x00, 0x00, 0xe8, 0x0b, 0x00, 0x00, 0xf8, 0x0e,
|
||||
0x00, 0x00, 0xb8, 0x0d, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xe8, 0x0e,
|
||||
0x00, 0x00, 0xb8, 0x0b, 0x00, 0x00, 0xf8, 0x0f};
|
||||
22
cde/programs/dticon/bitmaps/line.xbm
Normal file
22
cde/programs/dticon/bitmaps/line.xbm
Normal file
@@ -0,0 +1,22 @@
|
||||
/* $XConsortium: line.xbm /main/3 1995/11/02 14:08:13 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#define line_width 32
|
||||
#define line_height 32
|
||||
static unsigned char line_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
|
||||
0xe0, 0x01, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00,
|
||||
0x00, 0x1e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00,
|
||||
0x00, 0xc0, 0x01, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x0e, 0x00,
|
||||
0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xe0, 0x00,
|
||||
0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
22
cde/programs/dticon/bitmaps/point.xbm
Normal file
22
cde/programs/dticon/bitmaps/point.xbm
Normal file
@@ -0,0 +1,22 @@
|
||||
/* $XConsortium: point.xbm /main/3 1995/11/02 14:08:23 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#define point_width 32
|
||||
#define point_height 32
|
||||
static unsigned char point_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x03, 0x00,
|
||||
0x00, 0xe0, 0x03, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
22
cde/programs/dticon/bitmaps/polygon.xbm
Normal file
22
cde/programs/dticon/bitmaps/polygon.xbm
Normal file
@@ -0,0 +1,22 @@
|
||||
/* $XConsortium: polygon.xbm /main/3 1995/11/02 14:08:34 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#define polygon_width 32
|
||||
#define polygon_height 32
|
||||
static unsigned char polygon_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00,
|
||||
0x00, 0xff, 0x00, 0x00, 0x80, 0xe3, 0x07, 0x00, 0xe0, 0x00, 0x3f, 0x00,
|
||||
0x70, 0x00, 0xf8, 0x01, 0x30, 0x00, 0xc0, 0x01, 0x30, 0x00, 0xe0, 0x01,
|
||||
0x70, 0x00, 0x70, 0x00, 0x60, 0x00, 0x38, 0x00, 0xe0, 0x00, 0x1e, 0x00,
|
||||
0xc0, 0x00, 0x07, 0x00, 0xc0, 0x01, 0x03, 0x00, 0x80, 0x01, 0x07, 0x00,
|
||||
0x80, 0x01, 0x0e, 0x00, 0x80, 0x01, 0x1c, 0x00, 0xc0, 0x01, 0x78, 0x00,
|
||||
0xc0, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0xc0, 0x01, 0x60, 0x00, 0xf0, 0x03,
|
||||
0x70, 0x00, 0xff, 0x00, 0x30, 0xf0, 0x0f, 0x00, 0x38, 0xff, 0x00, 0x00,
|
||||
0xf8, 0x0f, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
22
cde/programs/dticon/bitmaps/polyline.xbm
Normal file
22
cde/programs/dticon/bitmaps/polyline.xbm
Normal file
@@ -0,0 +1,22 @@
|
||||
/* $XConsortium: polyline.xbm /main/3 1995/11/02 14:08:43 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#define polyline_width 32
|
||||
#define polyline_height 32
|
||||
static unsigned char polyline_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00,
|
||||
0x00, 0xff, 0x00, 0x00, 0x80, 0xe3, 0x07, 0x00, 0xe0, 0x00, 0x3f, 0x00,
|
||||
0x70, 0x00, 0xf8, 0x01, 0x30, 0x00, 0xc0, 0x01, 0x30, 0x00, 0xe0, 0x01,
|
||||
0x70, 0x00, 0x70, 0x00, 0x60, 0x00, 0x38, 0x00, 0xe0, 0x00, 0x1e, 0x00,
|
||||
0xc0, 0x00, 0x07, 0x00, 0xc0, 0x01, 0x03, 0x00, 0x80, 0x01, 0x07, 0x00,
|
||||
0x80, 0x01, 0x0e, 0x00, 0x80, 0x01, 0x1c, 0x00, 0xc0, 0x01, 0x78, 0x00,
|
||||
0xc0, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0xc0, 0x01, 0x60, 0x00, 0x80, 0x03,
|
||||
0x70, 0x00, 0x00, 0x01, 0x30, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00,
|
||||
0x18, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
22
cde/programs/dticon/bitmaps/q_mark.xbm
Normal file
22
cde/programs/dticon/bitmaps/q_mark.xbm
Normal file
@@ -0,0 +1,22 @@
|
||||
/* $XConsortium: q_mark.xbm /main/3 1995/11/02 14:08:54 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#define q_mark_width 32
|
||||
#define q_mark_height 32
|
||||
static unsigned char q_mark_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00,
|
||||
0x00, 0xac, 0x2a, 0x00, 0x00, 0x56, 0x55, 0x00, 0x00, 0xeb, 0xaf, 0x00,
|
||||
0x00, 0xf5, 0x5f, 0x01, 0x00, 0xfb, 0xbf, 0x00, 0x00, 0x75, 0x5d, 0x01,
|
||||
0x00, 0xfb, 0xbe, 0x00, 0x00, 0x75, 0x5d, 0x01, 0x00, 0xab, 0xbe, 0x00,
|
||||
0x00, 0x55, 0x5f, 0x01, 0x00, 0xab, 0xaf, 0x00, 0x00, 0xd6, 0x57, 0x01,
|
||||
0x00, 0xac, 0xab, 0x00, 0x00, 0xd8, 0x57, 0x00, 0x00, 0xb0, 0x2a, 0x00,
|
||||
0x00, 0x50, 0x15, 0x00, 0x00, 0xb0, 0x0b, 0x00, 0x00, 0xd0, 0x17, 0x00,
|
||||
0x00, 0xb0, 0x0b, 0x00, 0x00, 0x50, 0x15, 0x00, 0x00, 0xa0, 0x0a, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
22
cde/programs/dticon/bitmaps/rectangle.xbm
Normal file
22
cde/programs/dticon/bitmaps/rectangle.xbm
Normal file
@@ -0,0 +1,22 @@
|
||||
/* $XConsortium: rectangle.xbm /main/3 1995/11/02 14:09:04 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#define rectangle_width 32
|
||||
#define rectangle_height 32
|
||||
static unsigned char rectangle_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f,
|
||||
0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c,
|
||||
0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c,
|
||||
0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c,
|
||||
0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c, 0x30, 0x00, 0x00, 0x0c,
|
||||
0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
22
cde/programs/dticon/bitmaps/select.xbm
Normal file
22
cde/programs/dticon/bitmaps/select.xbm
Normal file
@@ -0,0 +1,22 @@
|
||||
/* $XConsortium: select.xbm /main/3 1995/11/02 14:09:14 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#define select_width 32
|
||||
#define select_height 32
|
||||
static unsigned char select_bits[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x98, 0x99, 0x99, 0x19, 0x08, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x10,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x10,
|
||||
0x08, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x08, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x10,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x10,
|
||||
0x08, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x08, 0x00, 0x00, 0x10, 0x98, 0x99, 0x99, 0x19, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
202
cde/programs/dticon/constants.h
Normal file
202
cde/programs/dticon/constants.h
Normal file
@@ -0,0 +1,202 @@
|
||||
/* $XConsortium: constants.h /main/3 1995/11/02 14:03:35 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
/***
|
||||
#define DEBUG True
|
||||
***/
|
||||
|
||||
#define CLASS_NAME "Dticon"
|
||||
|
||||
/*
|
||||
* This is the linked list of Help dialogs, which
|
||||
* will be created dynamically, as needed.
|
||||
*/
|
||||
|
||||
typedef struct _helpStruct {
|
||||
struct _helpStruct *pNext;
|
||||
struct _helpStruct *pPrev;
|
||||
Widget dialog;
|
||||
Boolean inUse;
|
||||
} HelpStruct;
|
||||
|
||||
typedef struct {
|
||||
Boolean useBMS;
|
||||
String session;
|
||||
String bmSuffix;
|
||||
String pmSuffix;
|
||||
int maxIconWidth;
|
||||
int maxIconHeight;
|
||||
Boolean useFileFilter;
|
||||
Boolean useFileLists;
|
||||
} ApplicationData, *ApplicationDataPtr;
|
||||
|
||||
typedef struct {
|
||||
Boolean useSession;
|
||||
int iconicState;
|
||||
Position x, y;
|
||||
Dimension width, height;
|
||||
} SessionData, *SessionDataPtr;
|
||||
|
||||
typedef struct {
|
||||
XColor xcolor; /* pixel #, red, blue, green, etc. */
|
||||
Pixel mono; /* black or white pixel for mono */
|
||||
Pixel newCell; /* new color cell for grab-screen */
|
||||
} PixelTableItem;
|
||||
|
||||
typedef struct {
|
||||
int pixelTableSize; /* number of allocated table items */
|
||||
int numItems; /* number of items in the table */
|
||||
int lastFound; /* last lookup result, check first */
|
||||
PixelTableItem *item; /* array of actual table entries */
|
||||
} PixelTable;
|
||||
|
||||
#define PIXEL_TABLE_MONO(i) pixelTable.item[i].mono
|
||||
#define PIXEL_TABLE_NEW_CELL(i) pixelTable.item[i].newCell
|
||||
#define PIXEL_TABLE_INC 20 /* size to increase table by each time */
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
/* Maximum icon demensions */
|
||||
#define MAX_ICON_WIDTH 256
|
||||
#define MAX_ICON_HEIGHT 256
|
||||
|
||||
/* Maximum icon demensions */
|
||||
#define MAX_FNAME 256
|
||||
|
||||
#define min(a, b) ((a < b) ? a : b)
|
||||
#define max(a, b) ((a > b) ? a : b)
|
||||
#ifndef abs
|
||||
#define abs(a) (((a) < 0) ? -(a) : (a))
|
||||
#endif
|
||||
#define mag(a,b) ((a-b) < 0 ? (b-a) : (a-b))
|
||||
|
||||
#define DARK 0
|
||||
#define LIGHT 1
|
||||
|
||||
/* rotation direction */
|
||||
#define ROTATE_L 1
|
||||
#define ROTATE_R 2
|
||||
|
||||
/* File I/O flags */
|
||||
#define READ_FLAGS (XpmColorSymbols)
|
||||
#define WRITE_FLAGS (XpmSize|XpmHotspot|XpmCharsPerPixel|XpmInfos)
|
||||
|
||||
/* State flags for Init_Icons() */
|
||||
#define DO_NOT_SAVE 0
|
||||
#define DO_SAVE 1
|
||||
|
||||
/* Graphics Ops. tools */
|
||||
#define POINT 1
|
||||
#define FLOOD 2
|
||||
#define LINE 3
|
||||
#define POLYLINE 4
|
||||
#define RECTANGLE 5
|
||||
#define POLYGON 6
|
||||
#define CIRCLE 7
|
||||
#define ELLIPSE 8
|
||||
#define ERASER 9
|
||||
#define SELECT 10
|
||||
|
||||
/* Secondary Graphics Ops. */
|
||||
#define S_WAIT_RELEASE 99
|
||||
#define S_PASTE 100
|
||||
#define S_ROTATE 101
|
||||
#define S_SCALE_1 102
|
||||
#define S_SCALE_2 103
|
||||
#define S_HOTSPOT 104
|
||||
#define S_GRAB 105
|
||||
|
||||
/* Interrupt flags for SELECT Ops. */
|
||||
#define INITIAL 0
|
||||
#define CONTINUE 1
|
||||
|
||||
#define NUM_GFX_OPS 11 /* number of Graphics Ops. tools + 1*/
|
||||
#define DEFAULT_MAG 8 /* default magnification factor */
|
||||
#define GAMMA_CUTOFF 150 /* x-over pt. for black/white fg color */
|
||||
#define NUM_STATICS 16 /* number of static colors */
|
||||
#define NUM_DYNAMICS 6 /* number of dynamic colors */
|
||||
#define NUM_PENS (NUM_STATICS+NUM_DYNAMICS)
|
||||
|
||||
/* max. points for polylines/polygons */
|
||||
#define MAX_PTS 200
|
||||
|
||||
/* dialog state flag values */
|
||||
#define NONE 0
|
||||
#define NEW 1
|
||||
#define OPEN 2
|
||||
#define SAVE 3
|
||||
#define SAVE_AS 4
|
||||
#define GRAB 5
|
||||
#define DROP 6
|
||||
#define QUIT 99
|
||||
|
||||
/* Transfer_Back_Image() state flag values */
|
||||
#define HOLLOW 0
|
||||
#define FILL 1
|
||||
|
||||
/* File I/O state flag values */
|
||||
#define FILE_READ 0
|
||||
#define FILE_WRITE 1
|
||||
|
||||
/* output file format flags */
|
||||
#define FORMAT_XPM 0
|
||||
#define FORMAT_XBM 1
|
||||
#define FORMAT_NONE 2
|
||||
|
||||
/* which color block? */
|
||||
#define STATIC_COLOR 0
|
||||
#define DYNAMIC_COLOR 1
|
||||
|
||||
/* static color flags */
|
||||
#define COLOR1 0
|
||||
#define COLOR2 1
|
||||
#define COLOR3 2
|
||||
#define COLOR4 3
|
||||
#define COLOR5 4
|
||||
#define COLOR6 5
|
||||
#define COLOR7 6
|
||||
#define COLOR8 7
|
||||
#define GREY1 8
|
||||
#define GREY2 9
|
||||
#define GREY3 10
|
||||
#define GREY4 11
|
||||
#define GREY5 12
|
||||
#define GREY6 13
|
||||
#define GREY7 14
|
||||
#define GREY8 15
|
||||
|
||||
/* dynamic color flags */
|
||||
#define BG_COLOR 100
|
||||
#define FG_COLOR 101
|
||||
#define TS_COLOR 102
|
||||
#define BS_COLOR 103
|
||||
#define SELECT_COLOR 104
|
||||
#define TRANS_COLOR 105
|
||||
|
||||
/* flip orientation flags */
|
||||
#define HORIZONTAL 0
|
||||
#define VERTICAL 1
|
||||
|
||||
/* magnification factor flags */
|
||||
#define MAG_2X 2
|
||||
#define MAG_3X 3
|
||||
#define MAG_4X 4
|
||||
#define MAG_5X 5
|
||||
#define MAG_6X 6
|
||||
#define MAG_8X 8
|
||||
#define MAG_10X 10
|
||||
#define MAG_12X 12
|
||||
|
||||
/* command-line parameter flags */
|
||||
#define AUTO_FILE 0
|
||||
#define AUTO_SIZE 1
|
||||
#define NUM_PARAMS 2
|
||||
2471
cde/programs/dticon/dtIconShell.c
Normal file
2471
cde/programs/dticon/dtIconShell.c
Normal file
File diff suppressed because it is too large
Load Diff
394
cde/programs/dticon/dticon.msg
Normal file
394
cde/programs/dticon/dticon.msg
Normal file
@@ -0,0 +1,394 @@
|
||||
$ $TOG: dticon.msg /main/4 1999/09/17 12:17:03 mgreess $
|
||||
$ *************************************<+>*************************************
|
||||
$ *****************************************************************************
|
||||
$ **
|
||||
$ ** File: dticon.msg
|
||||
$ **
|
||||
$ ** Project: HP DT Icon Editor
|
||||
$ **
|
||||
$ ** Description:
|
||||
$ ** -----------
|
||||
$ ** This file is the source for the message catalog for dticon
|
||||
$ **
|
||||
$ **
|
||||
$ *****************************************************************************
|
||||
$ **
|
||||
$ ** (c) Copyright 1992, 1993, 1994 Hewlett-Packard Company
|
||||
$ ** (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
$ ** (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
$ ** (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
$ ** Novell, Inc.
|
||||
$ **
|
||||
$ ** All Rights reserved
|
||||
$ **
|
||||
$ **
|
||||
$ *****************************************************************************
|
||||
$ **
|
||||
|
||||
$set 2
|
||||
$ *****************************************************************************
|
||||
$ ** _DtMessage set for fileIODialog.c
|
||||
$ **
|
||||
$ ** messages 10-16 are for the FileSelectionBox widget (default labels)
|
||||
$ *****************************************************************************
|
||||
|
||||
2 Icon Editor - File I/O
|
||||
4 Icon Editor - File I/O
|
||||
6 Icon Editor - Save As
|
||||
8 Icon Editor - Open File
|
||||
10 Update
|
||||
12 Folders
|
||||
14 Files
|
||||
16 Enter file name:
|
||||
17 Enter file name:
|
||||
18 Update
|
||||
20 UNTITLED
|
||||
22 Open
|
||||
24 Save
|
||||
|
||||
$set 4
|
||||
$ *****************************************************************************
|
||||
$ ** _DtMessage set for newIconDialog.c
|
||||
$ **
|
||||
$ *****************************************************************************
|
||||
|
||||
2 newIconDialog
|
||||
4 Icon Editor - Resize
|
||||
6 OK
|
||||
8 Cancel
|
||||
10 Help
|
||||
12 New Width:
|
||||
14 New Height:
|
||||
|
||||
$set 6
|
||||
$ *****************************************************************************
|
||||
$ ** _DtMessage set for queryDialog.c
|
||||
$ **
|
||||
$ *****************************************************************************
|
||||
|
||||
2 Icon Editor - Warning
|
||||
6 OK
|
||||
$ ** DO NOT LOCALIZE - the user should never see this message
|
||||
8 Do ya really wanna?
|
||||
10 Cancel
|
||||
|
||||
$set 8
|
||||
$ *****************************************************************************
|
||||
$ ** _DtMessage set for stdErrDialog.c
|
||||
$ ** _DtMessage set for DieFromToolTalkError in main.c
|
||||
$ **
|
||||
$ *****************************************************************************
|
||||
|
||||
2 Icon Editor - Error
|
||||
4 Continue
|
||||
$
|
||||
$ "-NEW"
|
||||
6 OK
|
||||
$
|
||||
$ "-NEW"
|
||||
8 "Could not connect to ToolTalk:\n%s\nExiting ..."
|
||||
|
||||
$set 10
|
||||
$ *****************************************************************************
|
||||
$ ** _DtMessage set for utils.c
|
||||
$ **
|
||||
$ *****************************************************************************
|
||||
|
||||
$ ** DO NOT LOCALIZE messages 2-48, they appear in the errorlog only
|
||||
2 Cannot initialize button icon for circle
|
||||
4 Cannot initialize button icon for solid circle
|
||||
6 Cannot initialize button icon for polyline
|
||||
8 Cannot initialize button icon for polygon
|
||||
10 Cannot initialize button icon for solid polygon
|
||||
12 Cannot initialize button icon for ellipse
|
||||
14 Cannot initialize button icon for solid ellipse
|
||||
16 Cannot initialize button icon for eraser
|
||||
18 Cannot initialize button icon for line
|
||||
20 Cannot initialize button icon for flood
|
||||
22 Cannot initialize button icon for point
|
||||
24 Cannot initialize button icon for rectangle
|
||||
26 Cannot initialize button icon for solid rectangle
|
||||
28 Cannot initialize button icon for select
|
||||
30 Unable to parse static color no.
|
||||
32 Unable to allocate static color no.
|
||||
38 No memory(0)
|
||||
40 No memory(1)
|
||||
42 No memory(2)
|
||||
44 No memory(3)
|
||||
46 No memory(4)
|
||||
48 No memory(5)
|
||||
|
||||
50 Cannot initialize application icon storage
|
||||
52 Invalid use of the '-f' parameter
|
||||
54 Invalid use of the '-i' parameter
|
||||
56 Invalid use of the '-session' parameter
|
||||
58 Invalid size format
|
||||
60 Screen image capture failed
|
||||
62 Operation failed.\nColormap is full
|
||||
64 Invalid dimension parameter
|
||||
|
||||
66 (UNTITLED)
|
||||
|
||||
$set 12
|
||||
$ *****************************************************************************
|
||||
$ ** _DtMessage set for dtIconShell.c
|
||||
$ **
|
||||
$ *****************************************************************************
|
||||
|
||||
1 Icon Editor
|
||||
2 2 Color
|
||||
3 Icon Editor - (UNTITLED)
|
||||
4 Welcome to Icon Editor.
|
||||
6 Fill Solids
|
||||
8 Static Colors
|
||||
10 Dynamic Colors
|
||||
12 Static Grays
|
||||
14 Foreground
|
||||
16 Background
|
||||
18 TopShadow
|
||||
20 BottomShadow
|
||||
22 Select
|
||||
24 Transparent
|
||||
|
||||
$ ** message 26-198 are menu items with corresponding mnemonics
|
||||
$ ** (for set grouping information, see the comment at the end-of-file)
|
||||
26 N
|
||||
28 New
|
||||
30 O
|
||||
32 Open...
|
||||
34 S
|
||||
36 Save
|
||||
38 A
|
||||
40 Save As...
|
||||
42 x
|
||||
44 Exit
|
||||
46 F
|
||||
48 File
|
||||
50 U
|
||||
52 Undo
|
||||
54 t
|
||||
56 Cut Area
|
||||
58 C
|
||||
60 Copy Area
|
||||
62 P
|
||||
64 Paste Area
|
||||
68 L
|
||||
70 Left
|
||||
72 R
|
||||
74 Right
|
||||
76 R
|
||||
78 Rotate Area
|
||||
82 V
|
||||
84 Vertical
|
||||
86 H
|
||||
88 Horizontal
|
||||
90 F
|
||||
92 Flip Area
|
||||
94 S
|
||||
96 Scale Area
|
||||
98 z
|
||||
100 Resize Icon...
|
||||
102 A
|
||||
104 Add Hotspot
|
||||
106 D
|
||||
108 Delete Hotspot
|
||||
110 G
|
||||
112 Grab Screen Image
|
||||
114 e
|
||||
116 Clear Icon
|
||||
118 E
|
||||
120 Edit
|
||||
122 V
|
||||
124 Visible Grid
|
||||
128 B
|
||||
130 XBM
|
||||
134 P
|
||||
136 XPM
|
||||
138 O
|
||||
140 Output Format
|
||||
144 2x
|
||||
146 3x
|
||||
148 4x
|
||||
150 5x
|
||||
152 6x
|
||||
154 8x
|
||||
156 10x
|
||||
158 12x
|
||||
160 M
|
||||
162 Magnification
|
||||
164 O
|
||||
166 Options
|
||||
168 v
|
||||
170 Overview...
|
||||
172 T
|
||||
174 Tasks...
|
||||
176 R
|
||||
178 Reference...
|
||||
180 O
|
||||
182 On Item
|
||||
188 U
|
||||
190 Using Help...
|
||||
192 A
|
||||
194 About the Icon Editor...
|
||||
196 H
|
||||
198 Help
|
||||
|
||||
$ ** message 200-are used in the "instruction" line for current drawing mode
|
||||
200 Current Edit Mode:
|
||||
202 (Filled)
|
||||
204 Pencil
|
||||
206 Flood
|
||||
208 Line
|
||||
210 Polyline
|
||||
212 Rectangle
|
||||
214 Polygon
|
||||
216 Circle
|
||||
218 Ellipse
|
||||
220 Erase
|
||||
222 Select
|
||||
224 Invalid
|
||||
|
||||
$set 14
|
||||
$ *****************************************************************************
|
||||
$ ** _DtMessage set for help.c
|
||||
$ **
|
||||
$ *****************************************************************************
|
||||
|
||||
2 Icon Editor - Help
|
||||
4 You must select an item\nwithin the Icon Editor.
|
||||
|
||||
$set 16
|
||||
$ *****************************************************************************
|
||||
$ ** _DtMessage set for process.c and fileIO.c
|
||||
$ **
|
||||
$ *****************************************************************************
|
||||
|
||||
2 The file cannot be accessed\nor contains invalid data
|
||||
4 Unable to write data to file
|
||||
6 This feature is not available yet
|
||||
8 There is no previous\nimage available
|
||||
10 Invalid width and/or\nheight specified
|
||||
12 No area has been selected
|
||||
14 No area was previously\ncut or copied
|
||||
16 The current icon has not been saved.\n\nYour changes will be lost.
|
||||
20 Check file permissions
|
||||
22 Couldn't restore session from file
|
||||
24 Couldn't save session to file
|
||||
25 File already exists.\n\nOK to overwrite the file?
|
||||
|
||||
$set 18
|
||||
$ *****************************************************************************
|
||||
$ ** _DtMessage set for event.c
|
||||
$ **
|
||||
$ *****************************************************************************
|
||||
2 Grabbed Image Size = %dx%d
|
||||
|
||||
$ *****************************************************************************
|
||||
$ ** End of _DtMessage Catalog File
|
||||
$ ** (Comments only below this line)
|
||||
$ *****************************************************************************
|
||||
$ **
|
||||
$ *****************************************************************************
|
||||
$ ** Unique mnemonic groupings from set 12
|
||||
$ *****************************************************************************
|
||||
$ **
|
||||
$ ** Unique Set 1: (Main Menu Bar)
|
||||
$ **
|
||||
$ ** 46 F
|
||||
$ ** 48 File
|
||||
$ **
|
||||
$ ** 118 E
|
||||
$ ** 120 Edit
|
||||
$ **
|
||||
$ ** 164 O
|
||||
$ ** 166 Options
|
||||
$ **
|
||||
$ ** 196 H
|
||||
$ ** 198 Help
|
||||
$ **
|
||||
$ **
|
||||
$ ** Unique Set 2: (File Menu)
|
||||
$ **
|
||||
$ ** 26 N
|
||||
$ ** 28 New
|
||||
$ ** 30 O
|
||||
$ ** 32 Open...
|
||||
$ ** 34 S
|
||||
$ ** 36 Save
|
||||
$ ** 38 A
|
||||
$ ** 40 Save As...
|
||||
$ ** 42 x
|
||||
$ ** 44 Exit
|
||||
$ **
|
||||
$ **
|
||||
$ ** Unique Set 3: (Edit Menu)
|
||||
$ **
|
||||
$ ** 50 U
|
||||
$ ** 52 Undo
|
||||
$ ** 54 t
|
||||
$ ** 56 Cut Area
|
||||
$ ** 58 C
|
||||
$ ** 60 Copy Area
|
||||
$ ** 62 P
|
||||
$ ** 64 Paste Area
|
||||
$ **
|
||||
$ ** Unique Set 3a: (Rotate Sub-Menu)
|
||||
$ ** 68 L
|
||||
$ ** 70 Left
|
||||
$ ** 72 R
|
||||
$ ** 74 Right
|
||||
$ ** 76 R
|
||||
$ ** 78 Rotate Area
|
||||
$ **
|
||||
$ ** Unique Set 3b: (Flip Sub-Menu)
|
||||
$ ** 82 V
|
||||
$ ** 84 Vertical
|
||||
$ ** 86 H
|
||||
$ ** 88 Horizontal
|
||||
$ ** 90 F
|
||||
$ ** 92 Flip Area
|
||||
$ ** 94 S
|
||||
$ ** 96 Scale Area
|
||||
$ ** 98 z
|
||||
$ ** 100 Resize Icon...
|
||||
$ ** 102 A
|
||||
$ ** 104 Add Hot Spot
|
||||
$ ** 106 D
|
||||
$ ** 108 Delete Hot Spot
|
||||
$ ** 110 G
|
||||
$ ** 112 Grab Screen Image
|
||||
$ ** 114 e
|
||||
$ ** 116 Clear Icon
|
||||
$ **
|
||||
$ **
|
||||
$ ** Unique Set 4: (Options Menu)
|
||||
$ **
|
||||
$ ** 122 V
|
||||
$ ** 124 Visible Grid
|
||||
$ **
|
||||
$ ** Unique Set 4a: (Output Sub-Menu)
|
||||
$ ** 128 B
|
||||
$ ** 130 XBM
|
||||
$ ** 134 P
|
||||
$ ** 136 XPM
|
||||
$ ** 138 O
|
||||
$ ** 140 Output Format
|
||||
$ ** 160 M
|
||||
$ ** 162 Magnification
|
||||
$ **
|
||||
$ **
|
||||
$ ** Unique Set 5: (Help Menu)
|
||||
$ **
|
||||
$ ** 168 I
|
||||
$ ** 170 Introduction...
|
||||
$ ** 172 T
|
||||
$ ** 174 Tasks...
|
||||
$ ** 176 R
|
||||
$ ** 178 Reference...
|
||||
$ ** 180 O
|
||||
$ ** 182 On Item
|
||||
$ ** 188 U
|
||||
$ ** 190 Using Help...
|
||||
$ ** 192 V
|
||||
$ ** 194 Version...
|
||||
$ **
|
||||
911
cde/programs/dticon/event.c
Normal file
911
cde/programs/dticon/event.c
Normal file
@@ -0,0 +1,911 @@
|
||||
/* $XConsortium: event.c /main/6 1996/10/21 15:28:00 mgreess $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
/******************************************************************************
|
||||
** Program: dticon
|
||||
**
|
||||
** Description: X11-based multi-color icon editor
|
||||
**
|
||||
** File: event.c, which contains the following subroutines or
|
||||
** functions:
|
||||
** Clear_ClickCount()
|
||||
** ProcessTabletEvent()
|
||||
** Do_ButtonOp()
|
||||
** iLine()
|
||||
** iRectangle()
|
||||
** iArc()
|
||||
** iPolygon()
|
||||
**
|
||||
******************************************************************************
|
||||
**
|
||||
** Copyright Hewlett-Packard Company, 1990, 1991, 1992.
|
||||
** All rights are reserved. Copying or reproduction of this program,
|
||||
** except for archival purposes, is prohibited without prior written
|
||||
** consent of Hewlett-Packard Company.
|
||||
**
|
||||
** Hewlett-Packard makes no representations about the suitibility of this
|
||||
** software for any purpose. It is provided "as is" without express or
|
||||
** implied warranty.
|
||||
**
|
||||
******************************************************************************/
|
||||
#include <Xm/Xm.h>
|
||||
#include "externals.h"
|
||||
#include "main.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
extern Widget iconForm;
|
||||
#endif
|
||||
|
||||
static Boolean DoingHotBox=False;
|
||||
static XtIntervalId polyTimerID;
|
||||
Widget coordinateText;
|
||||
static int Prev_x, Prev_y;
|
||||
|
||||
static void
|
||||
Clear_ClickCount( void )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out(" - CLICK-COUNT ZEROED.\n");
|
||||
#endif
|
||||
ClickCount = 0;
|
||||
}
|
||||
|
||||
/* Forward declarations */
|
||||
|
||||
void iArc(
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
Boolean backupFlag);
|
||||
void iLine(
|
||||
int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
Boolean backupFlag);
|
||||
void iRectangle(
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
Boolean backupFlag);
|
||||
void iPolygon(void);
|
||||
void Do_ButtonOp(XEvent *);
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: ProcessTabletEvent *
|
||||
* *
|
||||
* Purpose: Global event-handling routine for user input on the tablet. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
ProcessTabletEvent(
|
||||
Widget w,
|
||||
XEvent *xptr,
|
||||
String *params,
|
||||
Cardinal num_params )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
Arg args[10];
|
||||
Dimension db_width, db_height;
|
||||
#endif
|
||||
int x, y, width, height, i, n, xGrid, yGrid;
|
||||
char tmpstr[20];
|
||||
XmString str;
|
||||
|
||||
if (num_params == 3)
|
||||
ClickCount = atoi(params[2]);
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
printf("Event - ");
|
||||
#endif
|
||||
switch(xptr->type) {
|
||||
case ButtonPress : x = xptr->xbutton.x;
|
||||
y = xptr->xbutton.y;
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
printf("Btn Press at [%d,%d]\n", x, y);
|
||||
#endif
|
||||
if (xptr->xbutton.window == tablet_win)
|
||||
Do_ButtonOp(xptr);
|
||||
break;
|
||||
case MotionNotify : x = xptr->xmotion.x;
|
||||
y = xptr->xmotion.y;
|
||||
|
||||
/* Adjust for the Magnification Factor */
|
||||
xGrid = x/MagFactor + 1;
|
||||
yGrid = y/MagFactor + 1;
|
||||
|
||||
/*
|
||||
if coordinates are different then
|
||||
update Previous x & y
|
||||
Display new coordinates, but first...
|
||||
If the ERASER is ON then
|
||||
redraw the contents of the previous Rect.
|
||||
Draw the bounding Rect.
|
||||
*/
|
||||
if (xGrid!=Prev_x || yGrid!=Prev_y){
|
||||
if (GraphicsOp == ERASER)
|
||||
{
|
||||
Transfer_Back_Image(Prev_x-2, Prev_y-2,
|
||||
(Prev_x+1), (Prev_y+1), HOLLOW);
|
||||
XDrawRectangle(dpy, tablet_win, Erase_gc,
|
||||
xGrid*MagFactor-(2*MagFactor),
|
||||
yGrid*MagFactor-(2*MagFactor),
|
||||
(3*MagFactor), (3*MagFactor) );
|
||||
}
|
||||
Prev_x = xGrid;
|
||||
Prev_y = yGrid;
|
||||
tmpstr[0] = '\0';
|
||||
sprintf(tmpstr, "%dx%d", xGrid, yGrid);
|
||||
str= XmStringCreateLocalized (tmpstr);
|
||||
XtVaSetValues (coordinateText, XmNlabelString, str, NULL);
|
||||
XmStringFree(str);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
printf("Btn Motion at [%d,%d]\n", x, y);
|
||||
#endif
|
||||
if (xptr->xmotion.window == tablet_win)
|
||||
Do_ButtonOp(xptr);
|
||||
break;
|
||||
case ButtonRelease : x = xptr->xbutton.x;
|
||||
y = xptr->xbutton.y;
|
||||
#ifdef DEBUG
|
||||
if (debug) {
|
||||
printf("Btn Release at [%d,%d]", x, y);
|
||||
if (ClickCount)
|
||||
printf(", CLICK COUNT = %d", ClickCount);
|
||||
printf("\n");
|
||||
}
|
||||
#endif
|
||||
if (xptr->xbutton.window == tablet_win)
|
||||
Do_ButtonOp(xptr);
|
||||
break;
|
||||
case Expose : if (!tablet_win) {
|
||||
tablet_win = XtWindow(tablet_wid);
|
||||
}
|
||||
if (xptr->xexpose.window == tablet_win) {
|
||||
x = xptr->xexpose.x;
|
||||
y = xptr->xexpose.y;
|
||||
width = xptr->xexpose.width;
|
||||
height = xptr->xexpose.height;
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
printf("Exposure at [%d,%d] of %dx%d\n", x, y, width, height);
|
||||
#endif
|
||||
Repaint_Tablet(xptr->xexpose.window, x, y,
|
||||
width, height);
|
||||
}
|
||||
else if (xptr->xexpose.window ==
|
||||
XtWindow(iconImage)) {
|
||||
XCopyArea(dpy, color_icon,
|
||||
XtWindow(iconImage),
|
||||
Color_gc, 0, 0, icon_width, icon_height, 0, 0);
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
printf("Exposure on iconImage: REPAINTING\n");
|
||||
#endif
|
||||
}
|
||||
else if (xptr->xexpose.window ==
|
||||
XtWindow(monoImage)) {
|
||||
XCopyArea(dpy, mono_icon,
|
||||
XtWindow(monoImage),
|
||||
Color_gc, 0, 0, icon_width, icon_height, 0, 0);
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
printf("Exposure on monoImage: REPAINTING\n");
|
||||
#endif
|
||||
}
|
||||
if (argsNeedProcessed)
|
||||
ProcessAppArgs();
|
||||
break;
|
||||
case EnterNotify : x = xptr->xcrossing.x;
|
||||
y = xptr->xcrossing.y;
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
printf("Enter window at [%d,%d]\n", x, y);
|
||||
#endif
|
||||
break;
|
||||
case LeaveNotify : x = xptr->xcrossing.x;
|
||||
y = xptr->xcrossing.y;
|
||||
|
||||
/* if in ERASER mode
|
||||
restore contents of bounding Rect when
|
||||
leaving the tablet */
|
||||
if (GraphicsOp == ERASER )
|
||||
Transfer_Back_Image(Prev_x-2, Prev_y-2,
|
||||
(Prev_x+1), (Prev_y+1), HOLLOW);
|
||||
if (xptr->xcrossing.window == tablet_win)
|
||||
Do_ButtonOp(xptr);
|
||||
#ifdef DEBUG
|
||||
if (debug) {
|
||||
printf("Leave window at [%d,%d]\n", x, y);
|
||||
i = 0;
|
||||
XtSetArg(args[i], XmNwidth, &db_width); i++;
|
||||
XtSetArg(args[i], XmNheight, &db_height); i++;
|
||||
XtGetValues(iconForm, args, i);
|
||||
stat_out(" - iconForm dimensions: [%dx%d]\n", db_width, db_height);
|
||||
i = 0;
|
||||
XtSetArg(args[i], XmNwidth, &db_width); i++;
|
||||
XtGetValues(iconImage, args, i);
|
||||
stat_out(" - icon widths: %d\n", db_width);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case FocusIn :
|
||||
case FocusOut :
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
printf("Focus change\n");
|
||||
#endif
|
||||
break;
|
||||
default :
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
printf("UNKNOWN type: %d\n", xptr->type);
|
||||
#endif
|
||||
break;
|
||||
break;
|
||||
} /* switch */
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Do_ButtonOp *
|
||||
* *
|
||||
* Purpose: Process ButtonPress/ButtonMotion/ButtonRelease events *
|
||||
* generated by the user on the tablet. Switch between correct *
|
||||
* behaviors depending on the current GraphicsOp tool selected. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
static int Pressed = False, First = False;
|
||||
|
||||
void
|
||||
Do_ButtonOp(
|
||||
XEvent *xptr )
|
||||
{
|
||||
Window lwin;
|
||||
int e_type, x, y, i, j;
|
||||
XRectangle box;
|
||||
char tmpstr[20];
|
||||
XmString str;
|
||||
|
||||
e_type = xptr->type;
|
||||
switch (e_type) {
|
||||
case ButtonPress :
|
||||
case ButtonRelease : x = xptr->xbutton.x;
|
||||
y = xptr->xbutton.y;
|
||||
lwin = xptr->xbutton.window;
|
||||
break;
|
||||
case MotionNotify : x = xptr->xmotion.x;
|
||||
y = xptr->xmotion.y;
|
||||
lwin = xptr->xmotion.window;
|
||||
break;
|
||||
} /* switch */
|
||||
|
||||
switch (e_type) {
|
||||
case ButtonPress :
|
||||
switch (GraphicsOp) {
|
||||
case S_HOTSPOT : if (xptr->xbutton.window == tablet_win) {
|
||||
tx = x;
|
||||
ty = y;
|
||||
Icon_Coords(tx, ty, &ix, &iy);
|
||||
X_Hot = ix;
|
||||
Y_Hot = iy;
|
||||
hotSpot = True;
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out(" - HOTSPOT selected at [%d,%d]\n", ix, iy);
|
||||
#endif
|
||||
Repaint_Exposed_Tablet();
|
||||
}
|
||||
break;
|
||||
case S_PASTE :
|
||||
case S_ROTATE :
|
||||
case S_SCALE_2 : tx = x;
|
||||
ty = y;
|
||||
if (GraphicsOp == S_PASTE)
|
||||
XDrawRectangle(dpy, tablet_win,
|
||||
Flicker_gc, last_tx, last_ty,
|
||||
CutCopy->width*MagFactor - MagFactor,
|
||||
CutCopy->height*MagFactor - MagFactor);
|
||||
else if (GraphicsOp == S_ROTATE)
|
||||
XDrawRectangle(dpy, tablet_win,
|
||||
Flicker_gc, last_tx, last_ty,
|
||||
Rotate->width*MagFactor - MagFactor,
|
||||
Rotate->height*MagFactor - MagFactor);
|
||||
else
|
||||
XDrawRectangle(dpy, tablet_win,
|
||||
Flicker_gc, last_tx, last_ty,
|
||||
Scale->width*MagFactor - MagFactor,
|
||||
Scale->height*MagFactor - MagFactor);
|
||||
Icon_Coords(tx, ty, &ix, &iy);
|
||||
Do_Paste(ix, iy);
|
||||
break;
|
||||
case ERASER :
|
||||
case POINT : Pressed = True;
|
||||
last_tx = tx;
|
||||
last_ty = ty;
|
||||
tx = x;
|
||||
ty = y;
|
||||
Icon_Coords(tx, ty, &ix, &iy);
|
||||
Backup_Icons();
|
||||
if (GraphicsOp == ERASER) {
|
||||
for (i=ix-1; i<=ix+1; i++)
|
||||
for (j=iy-1; j<=iy+1; j++) {
|
||||
XDrawPoint(dpy, color_icon, Erase_gc, i, j);
|
||||
XDrawPoint(dpy,
|
||||
XtWindow(iconImage),
|
||||
Erase_gc, i, j);
|
||||
XDrawPoint(dpy, mono_icon, Erase_gc, i, j);
|
||||
XDrawPoint(dpy,
|
||||
XtWindow(monoImage),
|
||||
Erase_gc, i, j);
|
||||
Paint_Tile(i, j, Erase_gc);
|
||||
}
|
||||
}
|
||||
else {
|
||||
XDrawPoint(dpy, color_icon, Color_gc, ix, iy);
|
||||
XDrawPoint(dpy, XtWindow(iconImage),
|
||||
Color_gc, ix, iy);
|
||||
XDrawPoint(dpy, mono_icon, Mono_gc, ix, iy);
|
||||
XDrawPoint(dpy, XtWindow(monoImage),
|
||||
Mono_gc, ix, iy);
|
||||
Paint_Tile(ix, iy, Color_gc);
|
||||
}
|
||||
case FLOOD : break;
|
||||
case SELECT : if (DoingHotBox) {
|
||||
DoingHotBox = False;
|
||||
Selected = False;
|
||||
Stop_HotBox();
|
||||
}
|
||||
case LINE :
|
||||
case CIRCLE :
|
||||
case ELLIPSE :
|
||||
case S_SCALE_1 :
|
||||
case RECTANGLE : Quantize(&x, &y, True);
|
||||
Pressed = True;
|
||||
tx = x;
|
||||
ty = y;
|
||||
last_tx = tx;
|
||||
last_ty = ty;
|
||||
First = True;
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out(" - Quantized to [%d,%d]\n", x, y);
|
||||
#endif
|
||||
break;
|
||||
case S_GRAB : XGrabServer(dpy);
|
||||
XSync(dpy, False);
|
||||
Pressed = True;
|
||||
tx = x;
|
||||
ty = y;
|
||||
last_tx = tx;
|
||||
last_ty = ty;
|
||||
First = True;
|
||||
break;
|
||||
case POLYLINE :
|
||||
case POLYGON :
|
||||
Quantize(&x, &y, True);
|
||||
tx = x;
|
||||
ty = y;
|
||||
First = True;
|
||||
Icon_Coords(tx, ty, &ix, &iy);
|
||||
pointList[pointCount].x = ix;
|
||||
pointList[pointCount].y = iy;
|
||||
if (pointCount < MAX_PTS) {
|
||||
pointCount++;
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out(" - pointCount++ [%d]\n", pointCount);
|
||||
#endif
|
||||
}
|
||||
if (!Anchored) {
|
||||
Anchored = True;
|
||||
pointCount = 1;
|
||||
Backup_Icons();
|
||||
}
|
||||
else {
|
||||
if (ClickCount) {
|
||||
Anchored = False;
|
||||
ClickCount = 0;
|
||||
if (GraphicsOp == POLYGON)
|
||||
iPolygon();
|
||||
pointCount = 0;
|
||||
}
|
||||
Icon_Coords(last_tx, last_ty, &last_ix, &last_iy);
|
||||
iLine(ix, iy, last_ix, last_iy, False);
|
||||
}
|
||||
last_tx = tx;
|
||||
last_ty = ty;
|
||||
ClickCount++;
|
||||
polyTimerID = XtAppAddTimeOut( AppContext,
|
||||
multiClickTime,
|
||||
(XtTimerCallbackProc)
|
||||
Clear_ClickCount,
|
||||
NULL);
|
||||
break;
|
||||
} /* switch(GraphicsOp) */
|
||||
break;
|
||||
case ButtonRelease :
|
||||
switch (GraphicsOp) {
|
||||
case ERASER :
|
||||
case POINT : if (Pressed) {
|
||||
last_tx = tx;
|
||||
last_ty = ty;
|
||||
tx = x;
|
||||
ty = y;
|
||||
Icon_Coords(tx, ty, &ix, &iy);
|
||||
if (GraphicsOp == ERASER) {
|
||||
for (i=ix-1; i<=ix+1; i++)
|
||||
for (j=iy-1; j<=iy+1; j++) {
|
||||
XDrawPoint(dpy, color_icon, Erase_gc, i, j);
|
||||
XDrawPoint(dpy,
|
||||
XtWindow(iconImage),
|
||||
Erase_gc, i, j);
|
||||
XDrawPoint(dpy, mono_icon, Erase_gc, i, j);
|
||||
XDrawPoint(dpy,
|
||||
XtWindow(monoImage),
|
||||
Erase_gc, i, j);
|
||||
Paint_Tile(i, j, Erase_gc);
|
||||
} /* for */
|
||||
} /* if(GraphicsOp...) */
|
||||
else {
|
||||
XDrawPoint(dpy, color_icon, Color_gc, ix, iy);
|
||||
XDrawPoint(dpy, XtWindow(iconImage),
|
||||
Color_gc, ix, iy);
|
||||
XDrawPoint(dpy, mono_icon, Mono_gc, ix, iy);
|
||||
XDrawPoint(dpy, XtWindow(monoImage),
|
||||
Mono_gc, ix, iy);
|
||||
Paint_Tile(ix, iy, Color_gc);
|
||||
} /* else */
|
||||
Pressed = False;
|
||||
} /* if(Pressed) */
|
||||
break;
|
||||
case FLOOD : tx = x;
|
||||
ty = y;
|
||||
Icon_Coords(tx, ty, &ix, &iy);
|
||||
Flood_Region(ix, iy);
|
||||
break;
|
||||
case LINE : if (Pressed) {
|
||||
Quantize(&x, &y, True);
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out(" - Quantized to [%d,%d]\n", x, y);
|
||||
#endif
|
||||
XDrawLine(dpy, tablet_win,
|
||||
Flicker_gc, tx, ty, last_tx, last_ty);
|
||||
tx = x;
|
||||
ty = y;
|
||||
Pressed = False;
|
||||
Icon_Coords(tx, ty, &ix, &iy);
|
||||
Icon_Coords(last_tx, last_ty, &last_ix, &last_iy);
|
||||
iLine(ix, iy, last_ix, last_iy, True);
|
||||
}
|
||||
break;
|
||||
case S_SCALE_1 :
|
||||
case SELECT : if (Pressed) {
|
||||
Quantize(&x, &y, True);
|
||||
XDrawRectangle(dpy, tablet_win,
|
||||
Flicker_gc, min(tx, last_tx), min(ty, last_ty),
|
||||
abs(tx-last_tx), abs(ty-last_ty));
|
||||
tx = x;
|
||||
ty = y;
|
||||
Pressed = False;
|
||||
Icon_Coords(tx, ty, &ix, &iy);
|
||||
Icon_Coords(last_tx, last_ty, &last_ix, &last_iy);
|
||||
if (GraphicsOp == SELECT) {
|
||||
DoingHotBox = True;
|
||||
Start_HotBox(INITIAL);
|
||||
}
|
||||
else {
|
||||
Scale_Image(); /***TAG***/
|
||||
GraphicsOp = S_SCALE_2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case S_GRAB : if (Pressed) {
|
||||
XDrawRectangle(dpy, lwin,
|
||||
Flicker_gc, min(tx, last_tx), min(ty, last_ty),
|
||||
abs(tx-last_tx), abs(ty-last_ty));
|
||||
if (mag(last_tx, x) <= xrdb.maxIconWidth)
|
||||
tx = x;
|
||||
if (mag(last_ty, y) <= xrdb.maxIconHeight)
|
||||
ty = y;
|
||||
LoadGrabbedImage(
|
||||
min(tx, last_tx), min(ty, last_ty),
|
||||
abs(tx-last_tx), abs(ty-last_ty));
|
||||
GraphicsOp = Backup_G_Op;
|
||||
Backup_G_Op = NULL;
|
||||
Pressed = False;
|
||||
}
|
||||
break;
|
||||
case RECTANGLE : if (Pressed) {
|
||||
Quantize(&x, &y, True);
|
||||
XDrawRectangle(dpy, tablet_win,
|
||||
Flicker_gc, min(tx, last_tx), min(ty, last_ty),
|
||||
abs(tx-last_tx), abs(ty-last_ty));
|
||||
tx = x;
|
||||
ty = y;
|
||||
Pressed = False;
|
||||
Icon_Coords(tx, ty, &ix, &iy);
|
||||
Icon_Coords(last_tx, last_ty, &last_ix, &last_iy);
|
||||
iRectangle(min(ix, last_ix), min(iy, last_iy),
|
||||
abs(ix-last_ix), abs(iy-last_iy), True);
|
||||
}
|
||||
break;
|
||||
case S_HOTSPOT :
|
||||
case S_WAIT_RELEASE :
|
||||
GraphicsOp = Backup_G_Op;
|
||||
Backup_G_Op = NULL;
|
||||
break;
|
||||
case S_ROTATE :
|
||||
case S_SCALE_2 :
|
||||
case POLYLINE :
|
||||
case POLYGON :
|
||||
break;
|
||||
case CIRCLE : if (Pressed) {
|
||||
Quantize(&x, &y, True);
|
||||
Circle_Box(tablet_win,
|
||||
last_tx, last_ty, tx, ty, &box);
|
||||
tx = x;
|
||||
ty = y;
|
||||
Pressed = False;
|
||||
box.x /= MagFactor;
|
||||
box.y /= MagFactor;
|
||||
box.width =
|
||||
((short)(box.width - 1) / MagFactor) + 1;
|
||||
box.height =
|
||||
((short)(box.height - 1) / MagFactor) + 1;
|
||||
iArc(box.x, box.y, box.width, box.height, True);
|
||||
}
|
||||
break;
|
||||
case ELLIPSE : if (Pressed) {
|
||||
Quantize(&x, &y, True);
|
||||
XDrawArc(dpy, tablet_win,
|
||||
Flicker_gc, min(tx, last_tx), min(ty, last_ty),
|
||||
abs(tx-last_tx), abs(ty-last_ty), 0, 360*64);
|
||||
tx = x;
|
||||
ty = y;
|
||||
Pressed = False;
|
||||
Icon_Coords(tx, ty, &ix, &iy);
|
||||
Icon_Coords(last_tx, last_ty, &last_ix, &last_iy);
|
||||
iArc( min(ix, last_ix), min(iy, last_iy),
|
||||
abs(ix-last_ix)+1, abs(iy-last_iy)+1, True);
|
||||
}
|
||||
break;
|
||||
} /* switch(GraphicsOp) */
|
||||
break;
|
||||
case MotionNotify :
|
||||
switch (GraphicsOp) {
|
||||
case S_PASTE :
|
||||
case S_ROTATE :
|
||||
case S_SCALE_2 : last_tx = tx;
|
||||
last_ty = ty;
|
||||
tx = x;
|
||||
ty = y;
|
||||
if (!FirstRigid) {
|
||||
if (GraphicsOp == S_PASTE)
|
||||
XDrawRectangle(dpy, tablet_win,
|
||||
Flicker_gc, last_tx, last_ty,
|
||||
CutCopy->width*MagFactor - MagFactor,
|
||||
CutCopy->height*MagFactor - MagFactor);
|
||||
else if (GraphicsOp == S_ROTATE)
|
||||
XDrawRectangle(dpy, tablet_win,
|
||||
Flicker_gc, last_tx, last_ty,
|
||||
Rotate->width*MagFactor - MagFactor,
|
||||
Rotate->height*MagFactor - MagFactor);
|
||||
else
|
||||
XDrawRectangle(dpy, tablet_win,
|
||||
Flicker_gc, last_tx, last_ty,
|
||||
Scale->width*MagFactor - MagFactor,
|
||||
Scale->height*MagFactor - MagFactor);
|
||||
}
|
||||
if (GraphicsOp == S_PASTE)
|
||||
XDrawRectangle(dpy, tablet_win,
|
||||
Flicker_gc, tx, ty,
|
||||
CutCopy->width*MagFactor - MagFactor,
|
||||
CutCopy->height*MagFactor - MagFactor);
|
||||
else if (GraphicsOp == S_ROTATE)
|
||||
XDrawRectangle(dpy, tablet_win,
|
||||
Flicker_gc, tx, ty,
|
||||
Rotate->width*MagFactor - MagFactor,
|
||||
Rotate->height*MagFactor - MagFactor);
|
||||
else
|
||||
XDrawRectangle(dpy, tablet_win,
|
||||
Flicker_gc, tx, ty,
|
||||
Scale->width*MagFactor - MagFactor,
|
||||
Scale->height*MagFactor - MagFactor);
|
||||
FirstRigid = False;
|
||||
case S_HOTSPOT : break;
|
||||
case ERASER :
|
||||
case POINT : if (Pressed) {
|
||||
last_tx = tx;
|
||||
last_ty = ty;
|
||||
tx = x;
|
||||
ty = y;
|
||||
Icon_Coords(tx, ty, &ix, &iy);
|
||||
if (GraphicsOp == ERASER) {
|
||||
for (i=ix-1; i<=ix+1; i++)
|
||||
for (j=iy-1; j<=iy+1; j++) {
|
||||
XDrawPoint(dpy, color_icon, Erase_gc, i, j);
|
||||
XDrawPoint(dpy,
|
||||
XtWindow(iconImage),
|
||||
Erase_gc, i, j);
|
||||
XDrawPoint(dpy, mono_icon, Erase_gc, i, j);
|
||||
XDrawPoint(dpy,
|
||||
XtWindow(monoImage),
|
||||
Erase_gc, i, j);
|
||||
Paint_Tile(i, j, Erase_gc);
|
||||
} /* for */
|
||||
} /* if(GraphicsOp...) */
|
||||
else {
|
||||
XDrawPoint(dpy, color_icon, Color_gc, ix, iy);
|
||||
XDrawPoint(dpy, XtWindow(iconImage),
|
||||
Color_gc, ix, iy);
|
||||
XDrawPoint(dpy, mono_icon, Mono_gc, ix, iy);
|
||||
XDrawPoint(dpy, XtWindow(monoImage),
|
||||
Mono_gc, ix, iy);
|
||||
Paint_Tile(ix, iy, Color_gc);
|
||||
} /* else */
|
||||
}
|
||||
case FLOOD : break;
|
||||
case POLYLINE :
|
||||
case POLYGON : if (Anchored) {
|
||||
Quantize(&x, &y, True);
|
||||
if (!First)
|
||||
XDrawLine(dpy, tablet_win,
|
||||
Flicker_gc, tx, ty, last_tx, last_ty);
|
||||
tx = x;
|
||||
ty = y;
|
||||
XDrawLine(dpy, tablet_win,
|
||||
Flicker_gc, tx, ty, last_tx, last_ty);
|
||||
First = False;
|
||||
}
|
||||
break;
|
||||
case LINE : if (Pressed) {
|
||||
Quantize(&x, &y, True);
|
||||
if (!First)
|
||||
XDrawLine(dpy, tablet_win,
|
||||
Flicker_gc, tx, ty, last_tx, last_ty);
|
||||
tx = x;
|
||||
ty = y;
|
||||
XDrawLine(dpy, tablet_win,
|
||||
Flicker_gc, tx, ty, last_tx, last_ty);
|
||||
First = False;
|
||||
}
|
||||
break;
|
||||
case ELLIPSE :
|
||||
case SELECT :
|
||||
case S_SCALE_1 :
|
||||
case RECTANGLE : if (Pressed) {
|
||||
Quantize(&x, &y, True);
|
||||
if (!First) {
|
||||
if (GraphicsOp != ELLIPSE)
|
||||
XDrawRectangle(dpy, tablet_win, Flicker_gc,
|
||||
min(tx, last_tx), min(ty, last_ty),
|
||||
abs(tx-last_tx), abs(ty-last_ty));
|
||||
else
|
||||
XDrawArc(dpy, tablet_win, Flicker_gc,
|
||||
min(tx, last_tx), min(ty, last_ty),
|
||||
abs(tx-last_tx), abs(ty-last_ty),
|
||||
0, 360*64);
|
||||
}
|
||||
tx = x;
|
||||
ty = y;
|
||||
if (GraphicsOp != ELLIPSE)
|
||||
XDrawRectangle(dpy, tablet_win,
|
||||
Flicker_gc, min(tx, last_tx), min(ty, last_ty),
|
||||
abs(tx-last_tx), abs(ty-last_ty));
|
||||
else
|
||||
XDrawArc(dpy, tablet_win,
|
||||
Flicker_gc, min(tx, last_tx), min(ty, last_ty),
|
||||
abs(tx-last_tx), abs(ty-last_ty), 0, 360*64);
|
||||
First = False;
|
||||
}
|
||||
break;
|
||||
case S_GRAB : if (Pressed) {
|
||||
if (!First)
|
||||
XDrawRectangle(dpy, lwin, Flicker_gc,
|
||||
min(tx, last_tx), min(ty, last_ty),
|
||||
abs(tx-last_tx), abs(ty-last_ty));
|
||||
if (mag(last_tx, x) <= xrdb.maxIconWidth)
|
||||
tx = x;
|
||||
if (mag(last_ty, y) <= xrdb.maxIconHeight)
|
||||
ty = y;
|
||||
XDrawRectangle(dpy, lwin,
|
||||
Flicker_gc, min(tx, last_tx), min(ty, last_ty),
|
||||
abs(tx-last_tx), abs(ty-last_ty));
|
||||
First = False;
|
||||
/* Tell the user the size of the grabbed image
|
||||
*/
|
||||
sprintf(tmpstr,
|
||||
GETSTR(18,2,"Grabbed Image Size = %dx%d"),
|
||||
abs(tx-last_tx), abs(ty-last_ty));
|
||||
str= XmStringCreateLocalized (tmpstr);
|
||||
XtVaSetValues (coordinateText, XmNlabelString, str, NULL);
|
||||
XmStringFree(str);
|
||||
}
|
||||
break;
|
||||
case CIRCLE : if (Pressed) {
|
||||
Quantize(&x, &y, True);
|
||||
if (!First)
|
||||
Circle_Box(tablet_win,
|
||||
last_tx, last_ty, tx, ty, &box);
|
||||
tx = x;
|
||||
ty = y;
|
||||
Circle_Box(tablet_win,
|
||||
last_tx, last_ty, tx, ty, &box);
|
||||
First = False;
|
||||
}
|
||||
break;
|
||||
} /* switch(GraphicsOp) */
|
||||
break;
|
||||
case LeaveNotify :
|
||||
switch (GraphicsOp) {
|
||||
case POLYLINE :
|
||||
case POLYGON : if (Anchored) {
|
||||
if (!First)
|
||||
XDrawLine(dpy, tablet_win, Flicker_gc, tx, ty,
|
||||
last_tx, last_ty);
|
||||
First = True;
|
||||
}
|
||||
break;
|
||||
} /* switch(GraphicsOp) */
|
||||
break;
|
||||
} /* switch(e_type) */
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* Routine: EndPolyOp *
|
||||
* Purpose: When user does a mouse action outside of the drawing window, *
|
||||
* this implicitly ends the poly* operation. This means that *
|
||||
* things like drawing circles and changing pen color while in *
|
||||
* the middle of a polyline or polygon is no longer allowed. *
|
||||
***************************************************************************/
|
||||
void
|
||||
EndPolyOp()
|
||||
{
|
||||
Anchored = False;
|
||||
Clear_ClickCount();
|
||||
pointCount = 0;
|
||||
}
|
||||
|
||||
void
|
||||
iLine(
|
||||
int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
Boolean backupFlag )
|
||||
{
|
||||
if (backupFlag)
|
||||
Backup_Icons();
|
||||
XDrawLine(dpy, color_icon, Color_gc, x1, y1, x2, y2);
|
||||
XDrawLine(dpy, mono_icon, Mono_gc, x1, y1, x2, y2);
|
||||
XDrawLine(dpy, XtWindow(iconImage), Color_gc, x1, y1, x2, y2);
|
||||
XDrawLine(dpy, XtWindow(monoImage), Mono_gc, x1, y1, x2, y2);
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Transferring from [%d,%d] to [%d,%d]\n", tx, ty,
|
||||
last_tx, last_ty);
|
||||
#endif
|
||||
Transfer_Back_Image(x1, y1, x2, y2, FILL);
|
||||
}
|
||||
|
||||
void
|
||||
iRectangle(
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
Boolean backupFlag )
|
||||
{
|
||||
if (backupFlag)
|
||||
Backup_Icons();
|
||||
if (FillSolids) {
|
||||
XFillRectangle(dpy, color_icon, Color_gc, x, y, width+1, height+1);
|
||||
XFillRectangle(dpy, mono_icon, Mono_gc, x, y, width+1, height+1);
|
||||
XFillRectangle(dpy, XtWindow(iconImage), Color_gc,
|
||||
x, y, width+1, height+1);
|
||||
XFillRectangle(dpy, XtWindow(monoImage), Mono_gc,
|
||||
x, y, width+1, height+1);
|
||||
}
|
||||
else {
|
||||
XDrawRectangle(dpy, color_icon, Color_gc, x, y, width, height);
|
||||
XDrawRectangle(dpy, mono_icon, Mono_gc, x, y, width, height);
|
||||
XDrawRectangle(dpy, XtWindow(iconImage), Color_gc,
|
||||
x, y, width, height);
|
||||
XDrawRectangle(dpy, XtWindow(monoImage), Mono_gc,
|
||||
x, y, width, height);
|
||||
}
|
||||
Transfer_Back_Image(x, y, x+width, y+height, FILL);
|
||||
}
|
||||
|
||||
void
|
||||
iArc(
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
Boolean backupFlag )
|
||||
{
|
||||
if (backupFlag)
|
||||
Backup_Icons();
|
||||
if (FillSolids) {
|
||||
XFillArc(dpy, color_icon, Color_gc, x, y, width, height, 0, 360*64);
|
||||
XFillArc(dpy, mono_icon, Mono_gc, x, y, width, height, 0, 360*64);
|
||||
XFillArc(dpy, XtWindow(iconImage),
|
||||
Color_gc, x, y, width, height, 0, 360*64);
|
||||
XFillArc(dpy, XtWindow(monoImage),
|
||||
Mono_gc, x, y, width, height, 0, 360*64);
|
||||
}
|
||||
else {
|
||||
XDrawArc(dpy, color_icon, Color_gc, x, y, width, height, 0, 360*64);
|
||||
XDrawArc(dpy, mono_icon, Mono_gc, x, y, width, height, 0, 360*64);
|
||||
XDrawArc(dpy, XtWindow(iconImage),
|
||||
Color_gc, x, y, width, height, 0, 360*64);
|
||||
XDrawArc(dpy, XtWindow(monoImage),
|
||||
Mono_gc, x, y, width, height, 0, 360*64);
|
||||
}
|
||||
Transfer_Back_Image(x, y, x+width, y+height, FILL);
|
||||
}
|
||||
|
||||
void
|
||||
iPolygon( void )
|
||||
{
|
||||
int min_x, min_y, max_x, max_y, i;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("iPolygon: pointCount = %d\n", pointCount);
|
||||
#endif
|
||||
|
||||
if (FillSolids) {
|
||||
XFillPolygon(dpy, color_icon, Color_gc, pointList, pointCount,
|
||||
Complex, CoordModeOrigin);
|
||||
XFillPolygon(dpy, mono_icon, Mono_gc, pointList, pointCount,
|
||||
Complex, CoordModeOrigin);
|
||||
XFillPolygon(dpy, XtWindow(iconImage),
|
||||
Color_gc, pointList, pointCount, Complex, CoordModeOrigin);
|
||||
XFillPolygon(dpy, XtWindow(monoImage),
|
||||
Mono_gc, pointList, pointCount, Complex, CoordModeOrigin);
|
||||
}
|
||||
else {
|
||||
if (pointCount < MAX_PTS) {
|
||||
pointList[pointCount].x = pointList[0].x;
|
||||
pointList[pointCount].y = pointList[0].y;
|
||||
pointCount++;
|
||||
}
|
||||
XDrawLines(dpy, color_icon, Color_gc, pointList, pointCount, Complex);
|
||||
XDrawLines(dpy, mono_icon, Mono_gc, pointList, pointCount, Complex);
|
||||
XDrawLines(dpy, XtWindow(iconImage), Color_gc, pointList,
|
||||
pointCount, Complex);
|
||||
XDrawLines(dpy, XtWindow(monoImage), Mono_gc, pointList,
|
||||
pointCount, Complex);
|
||||
}
|
||||
min_x = pointList[0].x;
|
||||
min_y = pointList[0].y;
|
||||
max_x = min_x;
|
||||
max_y = min_y;
|
||||
for (i=1; i<pointCount; i++) {
|
||||
if (pointList[i].x < min_x) min_x = pointList[i].x;
|
||||
if (pointList[i].y < min_y) min_y = pointList[i].y;
|
||||
if (pointList[i].x > max_x) max_x = pointList[i].x;
|
||||
if (pointList[i].y > max_y) max_y = pointList[i].y;
|
||||
}
|
||||
Transfer_Back_Image(min_x, min_y, max_x, max_y, FILL);
|
||||
}
|
||||
110
cde/programs/dticon/externals.h
Normal file
110
cde/programs/dticon/externals.h
Normal file
@@ -0,0 +1,110 @@
|
||||
/* $XConsortium: externals.h /main/3 1995/11/02 14:04:25 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#include <Xm/Xm.h>
|
||||
#include <Dt/xpm.h>
|
||||
#include "constants.h"
|
||||
|
||||
extern char *black_string;
|
||||
extern char *white_string;
|
||||
extern char *none_string;
|
||||
|
||||
extern HelpStruct *help_head;
|
||||
extern int query_state, error_state;
|
||||
|
||||
extern Display *dpy;
|
||||
extern Window root;
|
||||
extern Window tablet_win;
|
||||
extern Widget tablet_wid;
|
||||
extern int screen;
|
||||
extern Screen *screen_ptr;
|
||||
extern Colormap Cmap;
|
||||
extern Cursor cursor;
|
||||
extern GC Color_gc;
|
||||
extern GC Mono_gc;
|
||||
extern GC Flicker_gc;
|
||||
extern GC Grid_gc;
|
||||
extern GC Erase_gc;
|
||||
extern int cmap_size;
|
||||
extern int MagFactor;
|
||||
extern int GraphicsOp;
|
||||
extern int Backup_G_Op;
|
||||
extern int CurrentColor;
|
||||
extern int ColorBlock;
|
||||
extern int tx, ty, last_tx, last_ty;
|
||||
extern int ix, iy, last_ix, last_iy;
|
||||
extern int ClickCount;
|
||||
extern int multiClickTime;
|
||||
extern int format;
|
||||
extern int fileIOMode;
|
||||
extern int fileFormat;
|
||||
extern char last_fname[MAX_FNAME];
|
||||
extern int pointCount;
|
||||
extern XPoint pointList[MAX_PTS];
|
||||
extern XRectangle current_box;
|
||||
extern XRectangle select_box;
|
||||
extern XImage *CutCopy;
|
||||
extern XImage *CutCopy_mono;
|
||||
extern XImage *Rotate;
|
||||
extern XImage *Rotate_mono;
|
||||
extern XImage *Scale;
|
||||
extern XImage *Scale_mono;
|
||||
extern int icon_width, icon_height;
|
||||
extern int backup_width, backup_height;
|
||||
extern Pixmap color_icon, prev_color_icon;
|
||||
extern Pixmap mono_icon, prev_mono_icon;
|
||||
extern Boolean status, Dirty;
|
||||
extern int X_Hot, Y_Hot;
|
||||
extern Boolean hotSpot;
|
||||
extern Boolean FirstRigid, GridEnabled, FloodToBorder, Selected, Anchored;
|
||||
extern Pixel black_pixel, white_pixel;
|
||||
extern Pixel Foreground, Background, TopShadow, BottomShadow;
|
||||
extern Pixel Select, Transparent;
|
||||
extern Pixel StaticPen[NUM_STATICS], DynamicPen[NUM_DYNAMICS];
|
||||
extern Pixel StaticMono[NUM_STATICS], DynamicMono[NUM_DYNAMICS];
|
||||
extern Widget StaticWid[NUM_STATICS], DynamicWid[NUM_DYNAMICS];
|
||||
extern Widget GraphicOpsWid[NUM_GFX_OPS];
|
||||
extern Boolean DialogFlag;
|
||||
extern Boolean FillSolids;
|
||||
extern Boolean UndoFlag;
|
||||
extern Boolean param_flag[NUM_PARAMS];
|
||||
extern Boolean argsNeedProcessed;
|
||||
extern XpmAttributes xpm_ReadAttribs, xpm_WriteAttribs;
|
||||
/* extern int numSymbols; */
|
||||
extern XpmColorSymbol *colorSymbols;
|
||||
extern char *hints_cmt;
|
||||
extern char *colors_cmt;
|
||||
extern char *pixels_cmt;
|
||||
extern char dynamic_c_str[NUM_DYNAMICS][30];
|
||||
extern char *color_table[NUM_STATICS+NUM_DYNAMICS][6];
|
||||
extern PixelTable pixelTable;
|
||||
|
||||
/* globals related to the user interface (motif, etc.) */
|
||||
extern Widget TopLevel;
|
||||
extern char *execName;
|
||||
extern char *progName;
|
||||
extern XtAppContext AppContext;
|
||||
extern Widget mainWindow,
|
||||
dtIconShell,
|
||||
queryDialog,
|
||||
stdErrDialog,
|
||||
newIconDialog,
|
||||
fileIODialog;
|
||||
extern Widget iconImage,
|
||||
monoImage;
|
||||
extern ApplicationData xrdb;
|
||||
extern SessionData session;
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int debug;
|
||||
extern int debug_status;
|
||||
extern XImage *debug_image, *debug_shape;
|
||||
/* extern unsigned char XErrorFlag; */
|
||||
#endif
|
||||
1131
cde/programs/dticon/fileIO.c
Normal file
1131
cde/programs/dticon/fileIO.c
Normal file
File diff suppressed because it is too large
Load Diff
234
cde/programs/dticon/fileIODialog.c
Normal file
234
cde/programs/dticon/fileIODialog.c
Normal file
@@ -0,0 +1,234 @@
|
||||
/* $TOG: fileIODialog.c /main/6 1999/06/01 10:55:30 mgreess $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
/*******************************************************************************
|
||||
fileIODialog.c
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/FileSB.h>
|
||||
#include <Xm/DialogS.h>
|
||||
#include <Xm/MwmUtil.h>
|
||||
#include "main.h"
|
||||
#include "externals.h"
|
||||
#include <Dt/DtPStrings.h>
|
||||
|
||||
#include <Xm/FileSB.h>
|
||||
|
||||
/*******************************************************************************
|
||||
Includes, Defines, and Global variables from the Declarations Editor:
|
||||
*******************************************************************************/
|
||||
|
||||
extern void Do_FileIO();
|
||||
|
||||
Widget fileIODialog;
|
||||
|
||||
/*******************************************************************************
|
||||
Forward declarations of functions that are defined later in this file.
|
||||
*******************************************************************************/
|
||||
|
||||
Widget create_fileIODialog();
|
||||
|
||||
/*******************************************************************************
|
||||
The following are callback functions.
|
||||
*******************************************************************************/
|
||||
|
||||
static void
|
||||
cancelCB_fileIODialog(
|
||||
Widget w,
|
||||
XtPointer clientData,
|
||||
XtPointer callbackArg )
|
||||
{
|
||||
XtUnmanageChild(fileIODialog);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
The following is the 'Interface function' which is the
|
||||
external entry point for creating this interface.
|
||||
This function should be called from your application or from
|
||||
a callback function.
|
||||
*******************************************************************************/
|
||||
Widget
|
||||
create_fileIODialog( void )
|
||||
{
|
||||
Widget fileIODialog_shell, wid;
|
||||
XmString tmpXmStr, tmpXmStr1, tmpXmStr2, tmpXmStr3, tmpXmStr4,
|
||||
tmpXmStr6, tmpXmStr7, tmpXmStr8;
|
||||
Arg args[10];
|
||||
int n;
|
||||
char *userIconPath, *s;
|
||||
struct stat sbuf;
|
||||
|
||||
userIconPath = getenv("XMICONSEARCHPATH");
|
||||
if (NULL == userIconPath)
|
||||
userIconPath = getenv("XMICONBMSEARCHPATH");
|
||||
if (NULL == userIconPath)
|
||||
userIconPath = getenv("HOME");
|
||||
|
||||
if (NULL != userIconPath)
|
||||
{
|
||||
char *s;
|
||||
|
||||
userIconPath = XtNewString(userIconPath);
|
||||
s = strchr(userIconPath, ':');
|
||||
if (NULL != s) *s = '\0';
|
||||
s = strrchr(userIconPath, '/');
|
||||
if (NULL != s) *s = '\0';
|
||||
}
|
||||
|
||||
fileIODialog_shell = XtVaCreatePopupShell( "fileIODialog_shell",
|
||||
xmDialogShellWidgetClass, mainWindow,
|
||||
XmNtitle, GETSTR(2,2, "Icon Editor - File I/O"),
|
||||
NULL );
|
||||
|
||||
tmpXmStr = GETXMSTR(2,6, "Icon Editor - Save As");
|
||||
tmpXmStr1 = GETXMSTR(2,10, "Filter");
|
||||
tmpXmStr2 = GETXMSTR(2,12, "Folders");
|
||||
tmpXmStr3 = GETXMSTR(2,14, "Files");
|
||||
tmpXmStr4 = GETXMSTR(2,16, "Enter file name:");
|
||||
tmpXmStr6 = GETXMSTR(4,8, "Cancel");
|
||||
tmpXmStr7 = GETXMSTR(4,10, "Help");
|
||||
|
||||
fileIODialog = XtVaCreateWidget( "fileIODialog",
|
||||
xmFileSelectionBoxWidgetClass, fileIODialog_shell,
|
||||
XmNdialogTitle, tmpXmStr,
|
||||
XmNfilterLabelString, tmpXmStr1,
|
||||
XmNdirListLabelString, tmpXmStr2,
|
||||
XmNfileListLabelString, tmpXmStr3,
|
||||
XmNselectionLabelString, tmpXmStr4,
|
||||
XmNapplyLabelString, tmpXmStr1,
|
||||
XmNcancelLabelString, tmpXmStr6,
|
||||
XmNhelpLabelString, tmpXmStr7,
|
||||
NULL );
|
||||
|
||||
userIconPath = getenv("XMICONSEARCHPATH");
|
||||
if (NULL != userIconPath)
|
||||
{
|
||||
userIconPath = XtNewString(userIconPath);
|
||||
s = strchr(userIconPath, ':');
|
||||
if (NULL != s) *s = '\0';
|
||||
s = strrchr(userIconPath, '/');
|
||||
if (NULL != s && userIconPath != s) *s = '\0';
|
||||
|
||||
if (0 != stat(userIconPath, &sbuf) ||
|
||||
0 == (S_IFDIR & sbuf.st_mode) ||
|
||||
0 == (S_IWUSR & sbuf.st_mode))
|
||||
{
|
||||
XtFree(userIconPath);
|
||||
userIconPath = NULL;
|
||||
}
|
||||
}
|
||||
if (NULL == userIconPath)
|
||||
{
|
||||
userIconPath = getenv("XMICONBMSEARCHPATH");
|
||||
if (NULL != userIconPath)
|
||||
{
|
||||
userIconPath = XtNewString(userIconPath);
|
||||
s = strchr(userIconPath, ':');
|
||||
if (NULL != s) *s = '\0';
|
||||
s = strrchr(userIconPath, '/');
|
||||
if (NULL != s && userIconPath != s) *s = '\0';
|
||||
|
||||
if (0 != stat(userIconPath, &sbuf) ||
|
||||
0 == (S_IFDIR & sbuf.st_mode) ||
|
||||
0 == (S_IWUSR & sbuf.st_mode))
|
||||
{
|
||||
XtFree(userIconPath);
|
||||
userIconPath = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (NULL == userIconPath)
|
||||
{
|
||||
char buf[MAXPATHLEN+1];
|
||||
char *home;
|
||||
|
||||
home = getenv("HOME");
|
||||
sprintf(buf, "%s/%s/icons", home, DtPERSONAL_CONFIG_DIRECTORY);
|
||||
|
||||
if (0 == stat(buf, &sbuf) &&
|
||||
S_IFDIR & sbuf.st_mode &&
|
||||
S_IWUSR & sbuf.st_mode)
|
||||
{
|
||||
userIconPath = XtNewString(buf);
|
||||
}
|
||||
}
|
||||
if (NULL != userIconPath)
|
||||
{
|
||||
tmpXmStr8 = XmStringCreateLocalized(userIconPath);
|
||||
XtVaSetValues(fileIODialog, XmNdirectory, tmpXmStr8, NULL);
|
||||
XmStringFree(tmpXmStr8);
|
||||
}
|
||||
|
||||
XmStringFree(tmpXmStr);
|
||||
XmStringFree(tmpXmStr1);
|
||||
XmStringFree(tmpXmStr2);
|
||||
XmStringFree(tmpXmStr3);
|
||||
XmStringFree(tmpXmStr4);
|
||||
XmStringFree(tmpXmStr6);
|
||||
XmStringFree(tmpXmStr7);
|
||||
|
||||
XtAddCallback(fileIODialog, XmNcancelCallback, cancelCB_fileIODialog, NULL);
|
||||
XtAddCallback(fileIODialog, XmNokCallback, Do_FileIO, NULL);
|
||||
|
||||
n = 0;
|
||||
XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
|
||||
XtSetArg (args[n], XmNmwmInputMode,MWM_INPUT_PRIMARY_APPLICATION_MODAL);n++;
|
||||
XtSetValues (fileIODialog_shell, args, n);
|
||||
|
||||
|
||||
/* check resources to get rid of unwanted children :-) */
|
||||
if (!xrdb.useFileFilter)
|
||||
{
|
||||
/* remove file filter label and text, and filter button */
|
||||
wid = XmFileSelectionBoxGetChild(fileIODialog, XmDIALOG_FILTER_LABEL);
|
||||
XtUnmanageChild (wid);
|
||||
wid = XmFileSelectionBoxGetChild(fileIODialog, XmDIALOG_FILTER_TEXT);
|
||||
XtUnmanageChild (wid);
|
||||
|
||||
/* if no File Lists, unmanage it... otherwise rename it */
|
||||
if (!xrdb.useFileLists)
|
||||
{
|
||||
XtUnmanageChild (XmFileSelectionBoxGetChild(fileIODialog,
|
||||
XmDIALOG_APPLY_BUTTON));
|
||||
}
|
||||
else
|
||||
{
|
||||
n = 0;
|
||||
tmpXmStr = GETXMSTR(2,18, "Update");
|
||||
XtSetArg (args[n], XmNapplyLabelString, tmpXmStr); n++;
|
||||
XtSetValues (fileIODialog, args, n);
|
||||
XmStringFree(tmpXmStr);
|
||||
}
|
||||
}
|
||||
if (!xrdb.useFileLists)
|
||||
{
|
||||
/* remove label and scrolled lists for directories and files */
|
||||
wid = XmFileSelectionBoxGetChild(fileIODialog, XmDIALOG_DIR_LIST_LABEL);
|
||||
XtUnmanageChild (wid);
|
||||
wid = XmFileSelectionBoxGetChild(fileIODialog, XmDIALOG_LIST_LABEL);
|
||||
XtUnmanageChild (wid);
|
||||
wid = XmFileSelectionBoxGetChild(fileIODialog, XmDIALOG_DIR_LIST);
|
||||
XtUnmanageChild (XtParent(wid));
|
||||
wid = XmFileSelectionBoxGetChild(fileIODialog, XmDIALOG_LIST);
|
||||
XtUnmanageChild (XtParent(wid));
|
||||
}
|
||||
|
||||
return ( fileIODialog );
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
END OF FILE
|
||||
*******************************************************************************/
|
||||
|
||||
134
cde/programs/dticon/globals.c
Normal file
134
cde/programs/dticon/globals.c
Normal file
@@ -0,0 +1,134 @@
|
||||
/* $XConsortium: globals.c /main/3 1995/11/02 14:04:57 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#include <Xm/Xm.h>
|
||||
#include <Dt/xpm.h>
|
||||
#include "constants.h"
|
||||
|
||||
char *black_string="black";
|
||||
char *white_string="white";
|
||||
char *none_string="none";
|
||||
|
||||
HelpStruct *help_head; /* head of the Help dialog list */
|
||||
int query_state, error_state; /* current state of query/error
|
||||
dialogs */
|
||||
|
||||
Display *dpy; /* default display */
|
||||
Window root; /* default root window */
|
||||
Window tablet_win; /* window ID for graphics tablet */
|
||||
Widget tablet_wid; /* widget ID for graphics tablet */
|
||||
int screen; /* default screen index */
|
||||
Screen *screen_ptr; /* ptr to default screen struct. */
|
||||
Colormap Cmap; /* default colormap */
|
||||
Cursor cursor; /* Custom cursor for grab operations */
|
||||
GC Color_gc; /* GC for fat bits & 1:1 color icon */
|
||||
GC Mono_gc; /* GC for 1:1 monochrome icon */
|
||||
GC Flicker_gc; /* GC for flicker lines on tablet */
|
||||
GC Grid_gc; /* GC for grid */
|
||||
GC Erase_gc; /* GC for the ERASE tool */
|
||||
int cmap_size; /* number of cells in colormap */
|
||||
int MagFactor; /* current enlargement value */
|
||||
int GraphicsOp; /* current graphics tool selected */
|
||||
int Backup_G_Op; /* previous graphics tool selected */
|
||||
int CurrentColor; /* current pen color selected */
|
||||
int ColorBlock; /* static color or dynamic color */
|
||||
int tx, ty, last_tx, last_ty; /* x & y values on tablet */
|
||||
int ix, iy, last_ix, last_iy; /* x & y values in icons */
|
||||
int ClickCount = 0; /* ...for multi-click events */
|
||||
int format = ZPixmap; /* XImage format for 2ndary ops. */
|
||||
int multiClickTime; /* system default multi-click time */
|
||||
XRectangle current_box; /* portion of the tablet currently
|
||||
visible */
|
||||
XRectangle select_box; /* currently selected rect. area */
|
||||
int icon_width=32, icon_height=32; /* current icon width & height */
|
||||
int backup_width=0,
|
||||
backup_height=0; /* current backup icon width & height */
|
||||
Pixmap color_icon, prev_color_icon; /* current and 'undo' color pixmaps */
|
||||
Pixmap mono_icon, prev_mono_icon; /* current and 'undo' 2-tone pixmaps */
|
||||
Boolean status, Dirty; /* function return & icon modified
|
||||
flags */
|
||||
int X_Hot, Y_Hot; /* hotspot coords. for XPM/XBM file */
|
||||
Boolean hotSpot=False; /* is a hot spot currently set? */
|
||||
Boolean GridEnabled=True; /* should the tablet grid be visible? */
|
||||
Boolean FloodToBorder=False; /* mono or multi-color flood? */
|
||||
Boolean FirstRigid=False; /* is this the 1st rigid box drawed? */
|
||||
Boolean Selected=False; /* is an area selected? */
|
||||
Boolean Anchored=False; /* state flag for poly{line/gon} Ops. */
|
||||
int pointCount; /* num pts. for poly{line/gon} Ops. */
|
||||
int fileIOMode; /* are we reading or writing a file? */
|
||||
int fileFormat=FORMAT_XPM; /* default file output format */
|
||||
char last_fname[MAX_FNAME]; /* last file read or written */
|
||||
XPoint pointList[MAX_PTS]; /* pt. list for poly{line/gon} Ops. */
|
||||
XImage *CutCopy=NULL; /* XImage from last cut/copy op. */
|
||||
XImage *CutCopy_mono=NULL; /* XImage from last cut/copy op. */
|
||||
XImage *Rotate=NULL; /* XImage from last rotation op. */
|
||||
XImage *Rotate_mono=NULL; /* XImage from last rotation op. */
|
||||
XImage *Scale=NULL; /* XImage from last scale op. */
|
||||
XImage *Scale_mono=NULL; /* XImage from last scale op. */
|
||||
Pixel black_pixel, white_pixel; /* default black & white pixels */
|
||||
Pixel Foreground, Background,
|
||||
TopShadow, BottomShadow,
|
||||
Select, Transparent; /* the 6 dynamic colors */
|
||||
Pixel StaticPen[NUM_STATICS],
|
||||
DynamicPen[NUM_DYNAMICS]; /* 22 pens (pixel values) */
|
||||
Pixel StaticMono[NUM_STATICS],
|
||||
DynamicMono[NUM_DYNAMICS]; /* 22 monochrome fallbacks */
|
||||
Widget StaticWid[NUM_STATICS],
|
||||
DynamicWid[NUM_DYNAMICS]; /* 22 color button widgets */
|
||||
Widget GraphicOpsWid[NUM_GFX_OPS]; /* 10 'Graphics Ops.' button widgets */
|
||||
|
||||
Boolean DialogFlag; /* state flag for pop-up dialogs */
|
||||
Boolean FillSolids; /* state flag for polygon fills */
|
||||
Boolean param_flag[NUM_PARAMS]; /* what cmd. line params got used? */
|
||||
Boolean argsNeedProcessed; /* cmd. line args need to be resolved */
|
||||
Boolean UndoFlag=False; /* Can we undo the last graphics op.? */
|
||||
XpmAttributes xpm_ReadAttribs; /* XPM read file attributes */
|
||||
XpmAttributes xpm_WriteAttribs; /* XPM write file attributes */
|
||||
/* int numSymbols=0; number of color symbols loaded */
|
||||
XpmColorSymbol *colorSymbols; /* color symbols list */
|
||||
ApplicationData xrdb; /* application specific resources */
|
||||
SessionData session; /* session specific resources */
|
||||
PixelTable pixelTable; /* used for getting mono equiv icon */
|
||||
|
||||
char dynamic_c_str[NUM_DYNAMICS][30]; /* RGB value str. for dynamic colors */
|
||||
|
||||
char *color_table[NUM_STATICS+NUM_DYNAMICS][6] = {
|
||||
"0", "iconColor1", "black", NULL, NULL, "black",
|
||||
"1", "iconColor2", "white", NULL, NULL, "white",
|
||||
"2", "iconColor3", "black", NULL, NULL, "red",
|
||||
"3", "iconColor4", "white", NULL, NULL, "green",
|
||||
"4", "iconColor5", "black", NULL, NULL, "blue",
|
||||
"5", "iconColor6", "white", NULL, NULL, "yellow",
|
||||
"6", "iconColor7", "white", NULL, NULL, "cyan",
|
||||
"7", "iconColor8", "black", NULL, NULL, "magenta",
|
||||
"8", "iconGray1", "white", NULL, NULL, "#dededededede",
|
||||
"9", "iconGray2", "white", NULL, NULL, "#bdbdbdbdbdbd",
|
||||
"a", "iconGray3", "white", NULL, NULL, "#adadadadadad",
|
||||
"b", "iconGray4", "white", NULL, NULL, "#949494949494",
|
||||
"c", "iconGray5", "black", NULL, NULL, "#737373737373",
|
||||
"d", "iconGray6", "black", NULL, NULL, "#636363636363",
|
||||
"e", "iconGray7", "black", NULL, NULL, "#424242424242",
|
||||
"f", "iconGray8", "black", NULL, NULL, "#212121212121",
|
||||
"A", "background", "black", NULL, NULL, "#949494949494",
|
||||
"B", "foreground", "white", NULL, NULL, "white",
|
||||
"C", "topShadowColor", "white", NULL, NULL, "#bdbdbdbdbdbd",
|
||||
"D", "bottomShadowColor", "black", NULL, NULL, "#636363636363",
|
||||
"E", "selectColor", "white", NULL, NULL, "#737373737373",
|
||||
"F", "none", "none", NULL, NULL, "none" };
|
||||
|
||||
char *hints_cmt = { " width height ncolors cpp [x_hot y_hot] " };
|
||||
char *colors_cmt = { " colors " };
|
||||
char *pixels_cmt = { " pixels " };
|
||||
|
||||
/****** STUB **********/
|
||||
#ifdef DEBUG
|
||||
int debug=True;
|
||||
int debug_status;
|
||||
XImage *debug_image, *debug_shape;
|
||||
#endif
|
||||
/**********************/
|
||||
366
cde/programs/dticon/graphics.c
Normal file
366
cde/programs/dticon/graphics.c
Normal file
@@ -0,0 +1,366 @@
|
||||
/* $XConsortium: graphics.c /main/4 1995/11/02 14:05:07 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
/******************************************************************************
|
||||
** Program: dticon
|
||||
**
|
||||
** Description: X11-based multi-color icon editor
|
||||
**
|
||||
** File: graphics.c, which contains the following subroutines or
|
||||
** functions:
|
||||
** Flicker_Arc()
|
||||
** Circle_Box()
|
||||
** Set_HotBox_Coords()
|
||||
** Start_HotBox()
|
||||
** Do_HotBox()
|
||||
** Stop_HotBox()
|
||||
**
|
||||
******************************************************************************
|
||||
**
|
||||
** Copyright Hewlett-Packard Company, 1990, 1991, 1992.
|
||||
** All rights are reserved. Copying or reproduction of this program,
|
||||
** except for archival purposes, is prohibited without prior written
|
||||
** consent of Hewlett-Packard Company.
|
||||
**
|
||||
** Hewlett-Packard makes no representations about the suitibility of this
|
||||
** software for any purpose. It is provided "as is" without express or
|
||||
** implied warranty.
|
||||
**
|
||||
******************************************************************************/
|
||||
#include <Xm/Xm.h>
|
||||
#include <math.h>
|
||||
#include "externals.h"
|
||||
|
||||
extern GC scratch_gc;
|
||||
|
||||
Widget editMenu_cut_pb;
|
||||
Widget editMenu_copy_pb;
|
||||
Widget editMenu_rotate_pb;
|
||||
Widget editMenu_flip_pb;
|
||||
Widget editMenu_scale_pb;
|
||||
|
||||
extern void Stop_HotBox(void);
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Flicker_Arc *
|
||||
* *
|
||||
* Purpose: Given 2 points (top-left and bottom-right), draw an *
|
||||
* invertable ellipse around the box they form. *
|
||||
* *
|
||||
*X11***********************************************************************/
|
||||
|
||||
void
|
||||
Flicker_Arc(
|
||||
Window win,
|
||||
int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2 )
|
||||
{
|
||||
int x, y, width, height;
|
||||
|
||||
x = min(x1, x2);
|
||||
y = min(y1, y2);
|
||||
width = abs(x1 - x2);
|
||||
height = abs(y1 - y2);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Doing Flicker_Arc: x=%d, y=%d, width=%d, height=%d\n",
|
||||
x, y, width, height);
|
||||
#endif
|
||||
|
||||
if ((width > 0) && (height > 0))
|
||||
XDrawArc(dpy, win, Flicker_gc, x, y, width, height, 0, 360*64);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Circle_Box *
|
||||
* *
|
||||
* Purpose: Given 2 points (the center and radius of a circle) *
|
||||
* generate a box which would exactly enclose this circle, *
|
||||
* and then draw a flickering circle that matches the box. *
|
||||
* WARNING: [x1,y1] are always assumed to be the centerpoint *
|
||||
* and this routine will generate bogus results if this is *
|
||||
* not TRUE. *
|
||||
* *
|
||||
*X11***********************************************************************/
|
||||
|
||||
void
|
||||
Circle_Box(
|
||||
Window win,
|
||||
int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
XRectangle *box )
|
||||
{
|
||||
int radius, top_x, top_y, bottom_x, bottom_y, width, height;
|
||||
double size;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering Circle_Box\n");
|
||||
#endif
|
||||
|
||||
width = mag(x1, x2);
|
||||
height = mag(y1, y2);
|
||||
size = (double) ((width * width) + (height * height));
|
||||
radius = (int) sqrt(size);
|
||||
|
||||
top_x = x1 - radius;
|
||||
top_y = y1 - radius;
|
||||
bottom_x = x1 + radius;
|
||||
bottom_y = y1 + radius;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out(" Circle_Box values: tx=%d, ty=%d, bx=%d, by=%d\n",
|
||||
top_x, top_y, bottom_x, bottom_x);
|
||||
#endif
|
||||
|
||||
Flicker_Arc(win, top_x, top_y, bottom_x, bottom_y);
|
||||
|
||||
box->x = top_x;
|
||||
box->y = top_y;
|
||||
box->width = bottom_x - top_x + 1;
|
||||
box->height = bottom_y - top_y + 1;
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving Circle_Box\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Set_HotBox_Coords *
|
||||
* *
|
||||
* Purpose: A SELECT operation has just occurred. Initiate a timer *
|
||||
* calculate the area to enclose. *
|
||||
* not TRUE. *
|
||||
* *
|
||||
*X11***********************************************************************/
|
||||
|
||||
#define FLASH_INTERVAL 300
|
||||
static Boolean FlashState=False;
|
||||
static int flash_x, flash_y, flash_width, flash_height;
|
||||
static int box_x1, box_y1, box_x2, box_y2;
|
||||
static XtIntervalId selectTimerID;
|
||||
static void Do_HotBox();
|
||||
|
||||
void
|
||||
Set_HotBox_Coords( void )
|
||||
{
|
||||
int min_x, min_y, max_x, max_y, tmp_x, tmp_y;
|
||||
|
||||
min_x = min(ix, last_ix);
|
||||
min_y = min(iy, last_iy);
|
||||
max_x = max(ix, last_ix);
|
||||
max_y = max(iy, last_iy);
|
||||
|
||||
/*** make sure all four points are on the tablet ***/
|
||||
|
||||
if (min_x < 0)
|
||||
min_x = 0;
|
||||
if (min_y < 0)
|
||||
min_y = 0;
|
||||
if ((max_x) >= icon_width)
|
||||
max_x = icon_width-1;
|
||||
if ((max_y) >= icon_height)
|
||||
max_y = icon_height-1;
|
||||
|
||||
select_box.x = min_x;
|
||||
select_box.y = min_y;
|
||||
select_box.width = max_x - min_x + 1;
|
||||
select_box.height = max_y - min_y + 1;
|
||||
|
||||
box_x1 = min_x;
|
||||
box_y1 = min_y;
|
||||
box_x2 = max_x+1;
|
||||
box_y2 = max_y+1;
|
||||
|
||||
Tablet_Coords(min_x, min_y, &flash_x, &flash_y);
|
||||
Tablet_Coords(max_x+1, max_y+1, &tmp_x, &tmp_y);
|
||||
flash_width = tmp_x - flash_x;
|
||||
flash_height = tmp_y - flash_y;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug) {
|
||||
stat_out(" select_box: x=%d, y=%d, width=%d, height=%d\n",
|
||||
select_box.x, select_box.y,
|
||||
select_box.width, select_box.height);
|
||||
stat_out(" flash box: x=%d, y=%d, width=%d, height=%d\n",
|
||||
flash_x, flash_y, flash_width, flash_height);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Start_HotBox *
|
||||
* *
|
||||
* Purpose: A SELECT operation has just occurred. Initiate a timer *
|
||||
* which flashes a 1-pixel wide box around the perimeter of *
|
||||
* the selected rectangle every FLASH_INTERVAL milliseconds. *
|
||||
* Use the global variables ix, iy, last_ix, last_iy to *
|
||||
* calculate the area to enclose. *
|
||||
* *
|
||||
*X11***********************************************************************/
|
||||
|
||||
void
|
||||
Start_HotBox(
|
||||
int flag )
|
||||
{
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering Start_HotBox\n");
|
||||
#endif
|
||||
|
||||
Selected = True;
|
||||
/* turn on stuff that uses the selected area */
|
||||
XtSetSensitive( editMenu_cut_pb, True);
|
||||
XtSetSensitive( editMenu_copy_pb, True);
|
||||
XtSetSensitive(editMenu_rotate_pb, True);
|
||||
XtSetSensitive(editMenu_flip_pb, True);
|
||||
XtSetSensitive(editMenu_scale_pb, True);
|
||||
XSync(dpy, 0);
|
||||
if (flag == INITIAL)
|
||||
Set_HotBox_Coords();
|
||||
|
||||
selectTimerID = XtAppAddTimeOut(AppContext,
|
||||
FLASH_INTERVAL,
|
||||
(XtTimerCallbackProc) Do_HotBox,
|
||||
NULL);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving Start_HotBox - TimerID=%d\n", selectTimerID);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Do_HotBox *
|
||||
* *
|
||||
* Purpose: Flash one alternating pulse around the selected area, and *
|
||||
* then re-set itself to activate again in FLASH_INTERVAL *
|
||||
* milliseconds. *
|
||||
* *
|
||||
* note: Check selectTimerID so that timeouts added for previous selects *
|
||||
* are ignored. ex: if new select is started before previous select *
|
||||
* timeout is serviced, "Selected" will already be set to true again *
|
||||
* (for new select) when timeout from old selection is called... so *
|
||||
* now Stop_HotBox is called immediately (before HotBox Coords are *
|
||||
* set for new select), and last timeout is ignored. *
|
||||
* *
|
||||
*X11***********************************************************************/
|
||||
|
||||
static void
|
||||
Do_HotBox(
|
||||
XtPointer *client_data,
|
||||
XtIntervalId *local_id )
|
||||
{
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out(". ");
|
||||
#endif
|
||||
|
||||
if (GraphicsOp != SELECT)
|
||||
Selected = False;
|
||||
if (*local_id == selectTimerID)
|
||||
{
|
||||
if (Selected)
|
||||
{
|
||||
if (FlashState) {
|
||||
FlashState = False;
|
||||
XSetForeground(dpy, scratch_gc, black_pixel);
|
||||
}
|
||||
else
|
||||
{
|
||||
FlashState = True;
|
||||
XSetForeground(dpy, scratch_gc, white_pixel);
|
||||
}
|
||||
XSetLineAttributes(dpy, scratch_gc, 1, LineSolid, CapButt, JoinMiter);
|
||||
XDrawRectangle(dpy, tablet_win, scratch_gc,
|
||||
flash_x, flash_y, flash_width, flash_height);
|
||||
selectTimerID=XtAppAddTimeOut(AppContext,
|
||||
FLASH_INTERVAL,
|
||||
(XtTimerCallbackProc) Do_HotBox,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
Stop_HotBox();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Stop_HotBox *
|
||||
* *
|
||||
* Purpose: Undo the last Selected border operation. *
|
||||
* *
|
||||
*X11***********************************************************************/
|
||||
|
||||
void
|
||||
Stop_HotBox( void )
|
||||
{
|
||||
int min_x, min_y, max_x, max_y, tmp_x, tmp_y;
|
||||
static int tmp_ix, tmp_iy;
|
||||
static Boolean Rotate_Move=False;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering Stop_HotBox\n");
|
||||
#endif
|
||||
|
||||
if (GridEnabled) {
|
||||
XDrawLine(dpy, tablet_win, Grid_gc,
|
||||
flash_x, flash_y, (flash_x+flash_width), flash_y);
|
||||
XDrawLine(dpy, tablet_win, Grid_gc,
|
||||
flash_x, (flash_y+flash_height), (flash_x+flash_width),
|
||||
(flash_y+flash_height));
|
||||
XDrawLine(dpy, tablet_win, Grid_gc,
|
||||
flash_x, flash_y, flash_x, (flash_y+flash_height));
|
||||
XDrawLine(dpy, tablet_win, Grid_gc,
|
||||
(flash_x+flash_width), flash_y, (flash_x+flash_width),
|
||||
(flash_y+flash_height));
|
||||
}
|
||||
else {
|
||||
/* since Rotate left and right moves ix and iy revert to tmp_ix, tmp_iy */
|
||||
if (Rotate_Move) { Rotate_Move = False;
|
||||
ix = tmp_ix;
|
||||
iy = tmp_iy; }
|
||||
min_x = min(ix, last_ix);
|
||||
min_y = min(iy, last_iy);
|
||||
max_x = max(ix, last_ix);
|
||||
max_y = max(iy, last_iy);
|
||||
if (++max_x >= icon_width) max_x--;
|
||||
if (++max_y >= icon_height) max_y--;
|
||||
Transfer_Back_Image(min_x, min_y, max_x, max_y, HOLLOW);
|
||||
/* if it is a Rotate Op. then keep ix, iy */
|
||||
if(GraphicsOp == S_ROTATE) { Rotate_Move = True;
|
||||
tmp_ix = ix;
|
||||
tmp_iy = iy; }
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving Stop_HotBox\n");
|
||||
#endif
|
||||
|
||||
}
|
||||
812
cde/programs/dticon/help.c
Normal file
812
cde/programs/dticon/help.c
Normal file
@@ -0,0 +1,812 @@
|
||||
/* $XConsortium: help.c /main/4 1995/11/02 14:05:18 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
/******************************************************************************
|
||||
** Program: dticon
|
||||
**
|
||||
** Description: X11-based multi-color icon editor
|
||||
**
|
||||
** File: help.c, which contains the following subroutines or
|
||||
** functions:
|
||||
** AssignHelpCallbacks()
|
||||
** HelpTriggerCB()
|
||||
** HelpHyperlinkCB()
|
||||
** HelpCloseCB()
|
||||
** GetHelpDialog()
|
||||
** HelpSetVolAndLocation()
|
||||
** DisplayHelp()
|
||||
** DisplayNewHelp()
|
||||
** DisplayHelpDialog()
|
||||
** CreateHelpDialog()
|
||||
**
|
||||
******************************************************************************
|
||||
**
|
||||
** Copyright 1991 by Hewlett-Packard Company, 1990, 1991, 1992.
|
||||
** All rights are reserved. Copying or reproduction of this program,
|
||||
** except for archival purposes, is prohibited without prior written
|
||||
** consent of Hewlett-Packard Company.
|
||||
**
|
||||
** Hewlett-Packard makes no representations about the suitibility of this
|
||||
** software for any purpose. It is provided "as is" without express or
|
||||
** implied warranty.
|
||||
**
|
||||
******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <Xm/DialogS.h>
|
||||
#include <Xm/Form.h>
|
||||
#include <Xm/MwmUtil.h>
|
||||
#include <Dt/HelpDialog.h>
|
||||
#include "help.h"
|
||||
#include "main.h"
|
||||
|
||||
extern Widget circleButton, editMenu_addHS_pb, editMenu_clear_pb;
|
||||
extern Widget editMenu_copy_pb, editMenu_cut_pb, editMenu_deleteHS_pb;
|
||||
extern Widget editMenu_flip_pb, editMenu_paste_pb, editMenu_resize_pb;
|
||||
extern Widget editMenu_rotate_pb, editMenu_scale_pb, editMenu_top_pb;
|
||||
extern Widget editMenu_undo_pb, ellipseButton, eraseButton, floodButton;
|
||||
extern Widget fileMenu_new_pb, fileMenu_open_pb, fileMenu_quit_pb;
|
||||
extern Widget fileMenu_saveAs_pb, fileMenu_save_pb, fileMenu_top_pb;
|
||||
extern Widget lineButton, menu1, optionsMenu_format, optionsMenu_grid;
|
||||
extern Widget optionsMenu_magnify, optionsMenu_top_pb, pointButton;
|
||||
extern Widget polygonButton, polylineButton, queryDialog, rectangleButton;
|
||||
extern Widget selectButton, fillToggle;
|
||||
extern Widget editMenu_grabImage_pb;
|
||||
extern Widget helpMenu_top_pb, helpMenu_intro_pb, helpMenu_tasks_pb,
|
||||
helpMenu_ref_pb, helpMenu_item_pb, helpMenu_using_pb,
|
||||
helpMenu_version_pb;
|
||||
extern Widget rotateMenu, flipMenu, formatMenu, magnificationMenu;
|
||||
extern Widget staticColorsBox, symbolicColorsBox, staticGreysBox;
|
||||
extern Widget viewport;
|
||||
|
||||
void HelpTriggerCB(Widget w, caddr_t client_data, caddr_t call_data);
|
||||
void HelpOnItemCB(Widget w, caddr_t client_data, caddr_t call_data);
|
||||
void HelpSetVolAndLocation(int topic);
|
||||
void DisplayNewHelp(char *helpVolume, char *locationId);
|
||||
void DisplayHelp(char *helpVolume, char *locationId);
|
||||
void DisplayHelpDialog(Widget dialog, char *helpVolume, char *locationId);
|
||||
Widget CreateHelpDialog(HelpStruct *pHelp);
|
||||
|
||||
|
||||
void
|
||||
AssignHelpCallbacks( void )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering AssignHelpCallbacks\n");
|
||||
#endif
|
||||
|
||||
/*** Set Help callbacks for the graphic tools ***/
|
||||
XtAddCallback(pointButton, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_POINT_BUTTON);
|
||||
XtAddCallback(floodButton, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_FLOOD_BUTTON);
|
||||
XtAddCallback(lineButton, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_LINE_BUTTON);
|
||||
XtAddCallback(polylineButton, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_POLYLINE_BUTTON);
|
||||
XtAddCallback(rectangleButton, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_RECTANGLE_BUTTON);
|
||||
XtAddCallback(polygonButton, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_POLYGON_BUTTON);
|
||||
XtAddCallback(circleButton, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_CIRCLE_BUTTON);
|
||||
XtAddCallback(ellipseButton, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_ELLIPSE_BUTTON);
|
||||
XtAddCallback(eraseButton, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_ERASER_BUTTON);
|
||||
XtAddCallback(selectButton, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_SELECT_BUTTON);
|
||||
XtAddCallback(fillToggle, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_FILL_BUTTON);
|
||||
|
||||
/*** Set Help callbacks for the pen groups ***/
|
||||
XtAddCallback(staticColorsBox, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_STATIC_COLOR_BUTTON);
|
||||
XtAddCallback(staticGreysBox, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_STATIC_GREY_BUTTON);
|
||||
XtAddCallback(symbolicColorsBox, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_DYNAMIC_COLOR_BUTTON);
|
||||
|
||||
/*** Set Help callbacks for the File menu ***/
|
||||
XtAddCallback(fileMenu_top_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_FILE_BUTTON);
|
||||
XtAddCallback(fileMenu_new_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_NEW_BUTTON);
|
||||
XtAddCallback(fileMenu_open_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_OPEN_BUTTON);
|
||||
XtAddCallback(fileMenu_save_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_SAVE_BUTTON);
|
||||
XtAddCallback(fileMenu_saveAs_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_SAVE_AS_BUTTON);
|
||||
XtAddCallback(fileMenu_quit_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_QUIT_BUTTON);
|
||||
|
||||
/*** Set Help callbacks for the Edit menu ***/
|
||||
XtAddCallback(editMenu_top_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_EDIT_BUTTON);
|
||||
XtAddCallback(editMenu_undo_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_UNDO_BUTTON);
|
||||
XtAddCallback(editMenu_cut_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_CUT_BUTTON);
|
||||
XtAddCallback(editMenu_copy_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_COPY_BUTTON);
|
||||
XtAddCallback(editMenu_paste_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_PASTE_BUTTON);
|
||||
XtAddCallback(editMenu_rotate_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_ROTATE_BUTTON);
|
||||
XtAddCallback(rotateMenu, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_ROTATE_BUTTON);
|
||||
XtAddCallback(editMenu_flip_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_FLIP_BUTTON);
|
||||
XtAddCallback(flipMenu, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_FLIP_BUTTON);
|
||||
XtAddCallback(editMenu_scale_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_SCALE_BUTTON);
|
||||
XtAddCallback(editMenu_resize_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_RESIZE_ICON_BUTTON);
|
||||
XtAddCallback(editMenu_addHS_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_ADD_HOTSPOT_BUTTON);
|
||||
XtAddCallback(editMenu_deleteHS_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_DELETE_HOTSPOT_BUTTON);
|
||||
XtAddCallback(editMenu_grabImage_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_GRAB_BUTTON);
|
||||
XtAddCallback(editMenu_clear_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_CLEAR_ICON_BUTTON);
|
||||
|
||||
/*** Set Help callbacks for the Options menu ***/
|
||||
XtAddCallback(optionsMenu_top_pb, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_OPTIONS_BUTTON);
|
||||
XtAddCallback(optionsMenu_grid, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_VISIBLE_GRID_BUTTON);
|
||||
XtAddCallback(optionsMenu_format, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_OUTPUT_FORMAT_BUTTON);
|
||||
XtAddCallback(formatMenu, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_OUTPUT_FORMAT_BUTTON);
|
||||
XtAddCallback(optionsMenu_magnify, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_MAGNIFICATION_BUTTON);
|
||||
XtAddCallback(magnificationMenu, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_MAGNIFICATION_BUTTON);
|
||||
|
||||
/*** Set Help callbacks for the Help menu (menu items activated) ***/
|
||||
XtAddCallback(helpMenu_intro_pb,
|
||||
XmNactivateCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_INTRODUCTION);
|
||||
XtAddCallback(helpMenu_tasks_pb,
|
||||
XmNactivateCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_TASKS);
|
||||
XtAddCallback(helpMenu_ref_pb,
|
||||
XmNactivateCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_REFERENCE);
|
||||
XtAddCallback(helpMenu_item_pb,
|
||||
XmNactivateCallback,
|
||||
(XtCallbackProc) HelpOnItemCB,
|
||||
(XtPointer)HELP_ON_ITEM);
|
||||
XtAddCallback(helpMenu_using_pb,
|
||||
XmNactivateCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_USING_HELP);
|
||||
XtAddCallback(helpMenu_version_pb,
|
||||
XmNactivateCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_VERSION);
|
||||
|
||||
/*** Set Help callbacks for the Help menu (help on menu items themselves) ***/
|
||||
XtAddCallback(helpMenu_top_pb,
|
||||
XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_HELP_BUTTON);
|
||||
XtAddCallback(helpMenu_intro_pb,
|
||||
XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_HELP_INTRODUCTION);
|
||||
XtAddCallback(helpMenu_tasks_pb,
|
||||
XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_HELP_TASKS);
|
||||
XtAddCallback(helpMenu_ref_pb,
|
||||
XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_HELP_REFERENCE);
|
||||
XtAddCallback(helpMenu_item_pb,
|
||||
XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_HELP_ON_ITEM);
|
||||
XtAddCallback(helpMenu_using_pb,
|
||||
XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_HELP_USING_HELP);
|
||||
XtAddCallback(helpMenu_version_pb,
|
||||
XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_HELP_VERSION);
|
||||
|
||||
/*** Set Help callbacks for other GUI components ***/
|
||||
XtAddCallback(menu1, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_MENUBAR);
|
||||
XtAddCallback(queryDialog, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_QUERY);
|
||||
XtAddCallback(stdErrDialog, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_ERROR);
|
||||
XtAddCallback(newIconDialog, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_NEW_ICON);
|
||||
XtAddCallback(fileIODialog, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_FILEIO_ICON);
|
||||
XtAddCallback(viewport, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_VIEWPORT);
|
||||
XtAddCallback(mainWindow, XmNhelpCallback,
|
||||
(XtCallbackProc) HelpTriggerCB,
|
||||
(XtPointer)HELP_MAIN_WINDOW);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving AssignHelpCallbacks\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
HelpTriggerCB(
|
||||
Widget w,
|
||||
caddr_t client_data,
|
||||
caddr_t call_data )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering HelpTriggerCB: help-tag=%d\n", (int) client_data);
|
||||
#endif
|
||||
|
||||
HelpSetVolAndLocation((int) client_data);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving HelpTriggerCB\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
HelpOnItemCB(
|
||||
Widget w,
|
||||
caddr_t client_data,
|
||||
caddr_t call_data )
|
||||
{
|
||||
Widget selWidget;
|
||||
int status;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering HelpOnItemCB: help-tag=%d\n", (int) client_data);
|
||||
#endif
|
||||
|
||||
|
||||
while (!XtIsSubclass(w, applicationShellWidgetClass))
|
||||
w = XtParent(w);
|
||||
|
||||
status = DtHelpReturnSelectedWidgetId(w, NULL, &selWidget);
|
||||
/* NULL value for cursor, uses default cursor value. */
|
||||
|
||||
switch ((int)status)
|
||||
{
|
||||
case DtHELP_SELECT_ERROR:
|
||||
/* Display error dialog here, function call failed */
|
||||
break;
|
||||
case DtHELP_SELECT_VALID:
|
||||
while (selWidget != (Widget)NULL)
|
||||
{
|
||||
if ( (XtHasCallbacks(selWidget, XmNhelpCallback)
|
||||
== XtCallbackHasSome) )
|
||||
{
|
||||
XtCallCallbacks(selWidget, XmNhelpCallback, NULL);
|
||||
break;
|
||||
}
|
||||
else
|
||||
selWidget = XtParent(selWidget);
|
||||
}
|
||||
break;
|
||||
case DtHELP_SELECT_ABORT:
|
||||
/* Display error dialog here,
|
||||
* "Selection Aborted by user."
|
||||
*/
|
||||
break;
|
||||
case DtHELP_SELECT_INVALID:
|
||||
DoErrorDialog( GETSTR(14,4,"You must select an item\nwithin the Icon Editor.") );
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving HelpOnItemCB\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
HelpHyperlinkCB(
|
||||
Widget w,
|
||||
caddr_t client_data_unused,
|
||||
caddr_t call_data )
|
||||
{
|
||||
DtHelpDialogCallbackStruct *pHyper =
|
||||
(DtHelpDialogCallbackStruct *) call_data;
|
||||
|
||||
switch(pHyper->hyperType) {
|
||||
case DtHELP_LINK_JUMP_NEW :
|
||||
DisplayNewHelp(pHyper->helpVolume, pHyper->locationId);
|
||||
break;
|
||||
default : ; /* application defined link code goes here */
|
||||
} /* switch */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
HelpCloseCB(
|
||||
Widget w,
|
||||
caddr_t client_data,
|
||||
caddr_t call_data_unused )
|
||||
{
|
||||
HelpStruct *pHelp = (HelpStruct *)client_data;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering HelpCloseCB\n");
|
||||
#endif
|
||||
|
||||
if(pHelp != (HelpStruct *)NULL)
|
||||
{
|
||||
/* this is a "cached" help dialog */
|
||||
pHelp->inUse = False;
|
||||
}
|
||||
|
||||
XtUnmanageChild(w);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving HelpCloseCB\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static Widget
|
||||
GetHelpDialog( void )
|
||||
{
|
||||
HelpStruct *pHelp;
|
||||
Arg args[5];
|
||||
int i, done;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering GetHelpDialog\n");
|
||||
#endif
|
||||
|
||||
if(help_head == (HelpStruct *)NULL) {
|
||||
pHelp = (HelpStruct *)XtMalloc(sizeof(HelpStruct));
|
||||
pHelp->pNext = (HelpStruct *)NULL;
|
||||
pHelp->pPrev = (HelpStruct *)NULL;
|
||||
pHelp->inUse = True;
|
||||
pHelp->dialog = CreateHelpDialog(pHelp);
|
||||
help_head = pHelp;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving GetHelpDialog: Created the 1st help dialog\n");
|
||||
#endif
|
||||
|
||||
return pHelp->dialog;
|
||||
}
|
||||
else {
|
||||
pHelp = help_head;
|
||||
done = False;
|
||||
while (!done) {
|
||||
if(pHelp->inUse == False) {
|
||||
pHelp->inUse = True;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving GetHelpDialog: activated an existing help dialog\n");
|
||||
#endif
|
||||
|
||||
return pHelp->dialog;
|
||||
} /* if */
|
||||
if(pHelp->pNext != (HelpStruct *)NULL)
|
||||
pHelp = pHelp->pNext;
|
||||
else
|
||||
done = True;
|
||||
} /* while */
|
||||
pHelp->pNext = (HelpStruct *) XtMalloc(sizeof(HelpStruct));
|
||||
pHelp->pNext->pPrev = pHelp;
|
||||
pHelp = pHelp->pNext;
|
||||
pHelp->pNext = (HelpStruct *)NULL;
|
||||
pHelp->inUse = True;
|
||||
pHelp->dialog = CreateHelpDialog(pHelp);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving GetHelpDialog: Created a new help dialog\n");
|
||||
#endif
|
||||
|
||||
return pHelp->dialog;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
HelpSetVolAndLocation(
|
||||
int topic)
|
||||
{
|
||||
char *helpVolume, *locationId;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering HelpSetVolAndLocation: topic = %d\n", topic);
|
||||
#endif
|
||||
|
||||
helpVolume = HELP_VOLUME;
|
||||
switch (topic) {
|
||||
|
||||
/*** choices for the 'Help' pulldown menu ***/
|
||||
case HELP_INTRODUCTION:
|
||||
locationId = HELP_INTRODUCTION_STR;
|
||||
break;
|
||||
case HELP_TASKS:
|
||||
locationId = HELP_TASKS_STR;
|
||||
break;
|
||||
case HELP_REFERENCE:
|
||||
locationId = HELP_REFERENCE_STR;
|
||||
break;
|
||||
case HELP_ON_ITEM:
|
||||
locationId = HELP_ON_ITEM_STR;
|
||||
break;
|
||||
case HELP_USING_HELP:
|
||||
helpVolume = HELP_HELP_VOLUME;
|
||||
locationId = HELP_USING_HELP_STR;
|
||||
break;
|
||||
case HELP_VERSION:
|
||||
locationId = HELP_VERSION_STR;
|
||||
break;
|
||||
|
||||
/*** choices for the top-level menus on the main menubar ***/
|
||||
case HELP_FILE_BUTTON:
|
||||
locationId = HELP_FILE_BUTTON_STR;
|
||||
break;
|
||||
case HELP_EDIT_BUTTON:
|
||||
locationId = HELP_EDIT_BUTTON_STR;
|
||||
break;
|
||||
case HELP_OPTIONS_BUTTON:
|
||||
locationId = HELP_OPTIONS_BUTTON_STR;
|
||||
break;
|
||||
case HELP_HELP_BUTTON:
|
||||
locationId = HELP_HELP_BUTTON_STR;
|
||||
break;
|
||||
|
||||
/*** choices for the 'File' pulldown menu ***/
|
||||
case HELP_NEW_BUTTON:
|
||||
locationId = HELP_NEW_BUTTON_STR;
|
||||
break;
|
||||
case HELP_OPEN_BUTTON:
|
||||
locationId = HELP_OPEN_BUTTON_STR;
|
||||
break;
|
||||
case HELP_SAVE_BUTTON:
|
||||
locationId = HELP_SAVE_BUTTON_STR;
|
||||
break;
|
||||
case HELP_SAVE_AS_BUTTON:
|
||||
locationId = HELP_SAVE_AS_BUTTON_STR;
|
||||
break;
|
||||
case HELP_QUIT_BUTTON:
|
||||
locationId = HELP_QUIT_BUTTON_STR;
|
||||
break;
|
||||
|
||||
/*** choices for the 'Edit' pulldown menu ***/
|
||||
case HELP_UNDO_BUTTON:
|
||||
locationId = HELP_UNDO_BUTTON_STR;
|
||||
break;
|
||||
case HELP_CUT_BUTTON:
|
||||
locationId = HELP_CUT_BUTTON_STR;
|
||||
break;
|
||||
case HELP_COPY_BUTTON:
|
||||
locationId = HELP_COPY_BUTTON_STR;
|
||||
break;
|
||||
case HELP_PASTE_BUTTON:
|
||||
locationId = HELP_PASTE_BUTTON_STR;
|
||||
break;
|
||||
case HELP_ROTATE_BUTTON:
|
||||
locationId = HELP_ROTATE_BUTTON_STR;
|
||||
break;
|
||||
case HELP_FLIP_BUTTON:
|
||||
locationId = HELP_FLIP_BUTTON_STR;
|
||||
break;
|
||||
case HELP_SCALE_BUTTON:
|
||||
locationId = HELP_SCALE_BUTTON_STR;
|
||||
break;
|
||||
case HELP_RESIZE_ICON_BUTTON:
|
||||
locationId = HELP_RESIZE_ICON_BUTTON_STR;
|
||||
break;
|
||||
case HELP_ADD_HOTSPOT_BUTTON:
|
||||
locationId = HELP_ADD_HOTSPOT_BUTTON_STR;
|
||||
break;
|
||||
case HELP_DELETE_HOTSPOT_BUTTON:
|
||||
locationId = HELP_DELETE_HOTSPOT_BUTTON_STR;
|
||||
break;
|
||||
case HELP_GRAB_BUTTON:
|
||||
locationId = HELP_GRAB_BUTTON_STR;
|
||||
break;
|
||||
case HELP_CLEAR_ICON_BUTTON:
|
||||
locationId = HELP_CLEAR_ICON_BUTTON_STR;
|
||||
break;
|
||||
|
||||
/*** choices for the 'Options' pulldown menu ***/
|
||||
case HELP_VISIBLE_GRID_BUTTON:
|
||||
locationId = HELP_VISIBLE_GRID_BUTTON_STR;
|
||||
break;
|
||||
case HELP_OUTPUT_FORMAT_BUTTON:
|
||||
locationId = HELP_OUTPUT_FORMAT_BUTTON_STR;
|
||||
break;
|
||||
case HELP_MAGNIFICATION_BUTTON:
|
||||
locationId = HELP_MAGNIFICATION_BUTTON_STR;
|
||||
break;
|
||||
|
||||
/*** choices for the 'Help' pulldown menu ***/
|
||||
case HELP_HELP_INTRODUCTION:
|
||||
locationId = HELP_HELP_INTRODUCTION_STR;
|
||||
break;
|
||||
|
||||
case HELP_HELP_TASKS:
|
||||
locationId = HELP_HELP_TASKS_STR;
|
||||
break;
|
||||
|
||||
case HELP_HELP_REFERENCE:
|
||||
locationId = HELP_HELP_REFERENCE_STR;
|
||||
break;
|
||||
|
||||
case HELP_HELP_ON_ITEM:
|
||||
locationId = HELP_HELP_ON_ITEM_STR;
|
||||
break;
|
||||
|
||||
case HELP_HELP_USING_HELP:
|
||||
locationId = HELP_HELP_USING_HELP_STR;
|
||||
break;
|
||||
|
||||
case HELP_HELP_VERSION:
|
||||
locationId = HELP_HELP_VERSION_STR;
|
||||
break;
|
||||
|
||||
/*** choices for each of the Graphics Tool pushbuttons ***/
|
||||
case HELP_POINT_BUTTON:
|
||||
locationId = HELP_POINT_BUTTON_STR;
|
||||
break;
|
||||
case HELP_FLOOD_BUTTON:
|
||||
locationId = HELP_FLOOD_BUTTON_STR;
|
||||
break;
|
||||
case HELP_LINE_BUTTON:
|
||||
locationId = HELP_LINE_BUTTON_STR;
|
||||
break;
|
||||
case HELP_POLYLINE_BUTTON:
|
||||
locationId = HELP_POLYLINE_BUTTON_STR;
|
||||
break;
|
||||
case HELP_RECTANGLE_BUTTON:
|
||||
locationId = HELP_RECTANGLE_BUTTON_STR;
|
||||
break;
|
||||
case HELP_POLYGON_BUTTON:
|
||||
locationId = HELP_POLYGON_BUTTON_STR;
|
||||
break;
|
||||
case HELP_CIRCLE_BUTTON:
|
||||
locationId = HELP_CIRCLE_BUTTON_STR;
|
||||
break;
|
||||
case HELP_ELLIPSE_BUTTON:
|
||||
locationId = HELP_ELLIPSE_BUTTON_STR;
|
||||
break;
|
||||
case HELP_ERASER_BUTTON:
|
||||
locationId = HELP_ERASER_BUTTON_STR;
|
||||
break;
|
||||
case HELP_SELECT_BUTTON:
|
||||
locationId = HELP_SELECT_BUTTON_STR;
|
||||
break;
|
||||
case HELP_FILL_BUTTON:
|
||||
locationId = HELP_FILL_BUTTON_STR;
|
||||
break;
|
||||
|
||||
/*** choices for each of the Pen Color Group pushbuttons ***/
|
||||
case HELP_STATIC_COLOR_BUTTON:
|
||||
locationId = HELP_STATIC_COLOR_BUTTON_STR;
|
||||
break;
|
||||
case HELP_STATIC_GREY_BUTTON:
|
||||
locationId = HELP_STATIC_GREY_BUTTON_STR;
|
||||
break;
|
||||
case HELP_DYNAMIC_COLOR_BUTTON:
|
||||
locationId = HELP_DYNAMIC_COLOR_BUTTON_STR;
|
||||
break;
|
||||
|
||||
/*** choice for other GUI components ***/
|
||||
case HELP_MENUBAR:
|
||||
locationId = HELP_MENUBAR_STR;
|
||||
break;
|
||||
case HELP_QUERY:
|
||||
locationId = HELP_QUERY_STR;
|
||||
break;
|
||||
case HELP_ERROR:
|
||||
locationId = HELP_ERROR_STR;
|
||||
break;
|
||||
case HELP_NEW_ICON:
|
||||
locationId = HELP_NEW_ICON_STR;
|
||||
break;
|
||||
case HELP_FILEIO_ICON:
|
||||
locationId = HELP_FILEIO_ICON_STR;
|
||||
break;
|
||||
case HELP_VIEWPORT:
|
||||
locationId = HELP_VIEWPORT_STR;
|
||||
break;
|
||||
case HELP_MAIN_WINDOW:
|
||||
locationId = HELP_MAIN_WINDOW_STR;
|
||||
break;
|
||||
default:
|
||||
locationId = HELP_MAIN_WINDOW_STR;
|
||||
break;
|
||||
}
|
||||
DisplayHelp(helpVolume, locationId);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving HelpSetVolAndLocation\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DisplayHelp(
|
||||
char *helpVolume,
|
||||
char *locationId)
|
||||
{
|
||||
static Widget mainHelpDialog = NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering DisplayHelp\n");
|
||||
#endif
|
||||
|
||||
if (mainHelpDialog == NULL)
|
||||
mainHelpDialog = CreateHelpDialog(NULL);
|
||||
|
||||
DisplayHelpDialog (mainHelpDialog, helpVolume, locationId);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving DisplayHelp\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DisplayNewHelp(
|
||||
char *helpVolume,
|
||||
char *locationId)
|
||||
{
|
||||
Widget helpDialog;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering DisplayNewHelp\n");
|
||||
#endif
|
||||
|
||||
helpDialog = GetHelpDialog();
|
||||
DisplayHelpDialog (helpDialog, helpVolume, locationId);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving DisplayNewHelp\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
DisplayHelpDialog (
|
||||
Widget helpDialog,
|
||||
char *helpVolume,
|
||||
char *locationId)
|
||||
{
|
||||
Arg args[10];
|
||||
int n;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering DisplayHelpDialog\n");
|
||||
#endif
|
||||
|
||||
n = 0;
|
||||
XtSetArg(args[n], DtNhelpVolume, helpVolume); n++;
|
||||
XtSetArg(args[n], DtNhelpType, DtHELP_TYPE_TOPIC); n++;
|
||||
XtSetArg(args[n], DtNlocationId, locationId); n++;
|
||||
XtSetValues(helpDialog, args, n);
|
||||
|
||||
XtManageChild(helpDialog);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving DisplayHelpDialog\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Widget
|
||||
CreateHelpDialog (HelpStruct *pHelp)
|
||||
{
|
||||
Widget helpDialog;
|
||||
Arg args[10];
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering CreateHelpDialog, pHelp is %x\n", pHelp);
|
||||
#endif
|
||||
|
||||
i = 0;
|
||||
XtSetArg(args[i], XmNtitle, GETSTR(14,2, "Icon Editor - Help")); i++;
|
||||
XtSetArg(args[i], XmNiconName,GETSTR(14,2, "Icon Editor - Help"));i++;
|
||||
helpDialog = DtCreateHelpDialog(dtIconShell, "helpDlg",
|
||||
args, i);
|
||||
XtAddCallback(helpDialog, DtNhyperLinkCallback,
|
||||
(XtCallbackProc)HelpHyperlinkCB, NULL);
|
||||
XtAddCallback(helpDialog, DtNcloseCallback,
|
||||
(XtCallbackProc)HelpCloseCB, pHelp);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving CreateHelpDialog\n");
|
||||
#endif
|
||||
|
||||
return helpDialog;
|
||||
}
|
||||
|
||||
138
cde/programs/dticon/help.h
Normal file
138
cde/programs/dticon/help.h
Normal file
@@ -0,0 +1,138 @@
|
||||
/* $XConsortium: help.h /main/3 1995/11/02 14:05:30 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
#include "externals.h"
|
||||
|
||||
/* help index flags */
|
||||
#define HELP_QUERY 1
|
||||
#define HELP_ERROR 2
|
||||
#define HELP_ADD_HOTSPOT_BUTTON 4
|
||||
#define HELP_CIRCLE_BUTTON 5
|
||||
#define HELP_CLEAR_ICON_BUTTON 6
|
||||
#define HELP_COPY_BUTTON 7
|
||||
#define HELP_CUT_BUTTON 8
|
||||
#define HELP_DELETE_HOTSPOT_BUTTON 9
|
||||
#define HELP_DYNAMIC_COLOR_BUTTON 10
|
||||
#define HELP_EDIT_BUTTON 11
|
||||
#define HELP_ELLIPSE_BUTTON 12
|
||||
#define HELP_ERASER_BUTTON 13
|
||||
#define HELP_FILE_BUTTON 14
|
||||
#define HELP_FLIP_BUTTON 15
|
||||
#define HELP_FLOOD_BUTTON 16
|
||||
#define HELP_HELP_BUTTON 17
|
||||
#define HELP_LINE_BUTTON 19
|
||||
#define HELP_MAGNIFICATION_BUTTON 20
|
||||
#define HELP_MENUBAR 21
|
||||
#define HELP_NEW_BUTTON 23
|
||||
#define HELP_NEW_ICON 24
|
||||
#define HELP_OPEN_BUTTON 25
|
||||
#define HELP_OPTIONS_BUTTON 26
|
||||
#define HELP_OUTPUT_FORMAT_BUTTON 27
|
||||
#define HELP_PASTE_BUTTON 29
|
||||
#define HELP_POINT_BUTTON 30
|
||||
#define HELP_POLYGON_BUTTON 31
|
||||
#define HELP_POLYLINE_BUTTON 32
|
||||
#define HELP_QUIT_BUTTON 33
|
||||
#define HELP_RECTANGLE_BUTTON 34
|
||||
#define HELP_RESIZE_ICON_BUTTON 35
|
||||
#define HELP_ROTATE_BUTTON 36
|
||||
#define HELP_SAVE_AS_BUTTON 37
|
||||
#define HELP_SAVE_BUTTON 38
|
||||
#define HELP_SCALE_BUTTON 39
|
||||
#define HELP_SELECT_BUTTON 40
|
||||
#define HELP_STATIC_COLOR_BUTTON 41
|
||||
#define HELP_STATIC_GREY_BUTTON 42
|
||||
#define HELP_UNDO_BUTTON 44
|
||||
#define HELP_VISIBLE_GRID_BUTTON 46
|
||||
#define HELP_GRAB_BUTTON 47
|
||||
#define HELP_FILL_BUTTON 48
|
||||
#define HELP_VIEWPORT 49
|
||||
#define HELP_MAIN_WINDOW 50
|
||||
#define HELP_FILEIO_ICON 51
|
||||
|
||||
|
||||
#define HELP_HELP_INTRODUCTION 60
|
||||
#define HELP_HELP_TASKS 61
|
||||
#define HELP_HELP_REFERENCE 62
|
||||
#define HELP_HELP_ON_ITEM 63
|
||||
#define HELP_HELP_USING_HELP 64
|
||||
#define HELP_HELP_VERSION 65
|
||||
|
||||
#define HELP_INTRODUCTION 70
|
||||
#define HELP_TASKS 71
|
||||
#define HELP_REFERENCE 72
|
||||
#define HELP_ON_ITEM 73
|
||||
#define HELP_USING_HELP 74
|
||||
#define HELP_VERSION 75
|
||||
|
||||
|
||||
|
||||
/* help index strings */
|
||||
#define HELP_QUERY_STR "query"
|
||||
#define HELP_ERROR_STR "error"
|
||||
#define HELP_ADD_HOTSPOT_BUTTON_STR "add-hotspot"
|
||||
#define HELP_CIRCLE_BUTTON_STR "circle-tool"
|
||||
#define HELP_CLEAR_ICON_BUTTON_STR "clear-icon"
|
||||
#define HELP_COPY_BUTTON_STR "copy"
|
||||
#define HELP_CUT_BUTTON_STR "cut"
|
||||
#define HELP_DELETE_HOTSPOT_BUTTON_STR "delete-hotspot"
|
||||
#define HELP_DYNAMIC_COLOR_BUTTON_STR "dymanic-colors"
|
||||
#define HELP_EDIT_BUTTON_STR "edit-menu"
|
||||
#define HELP_ELLIPSE_BUTTON_STR "ellipse-tool"
|
||||
#define HELP_ERASER_BUTTON_STR "eraser-tool"
|
||||
#define HELP_FILE_BUTTON_STR "file-menu"
|
||||
#define HELP_FILL_BUTTON_STR "fill-tool"
|
||||
#define HELP_FLIP_BUTTON_STR "flip"
|
||||
#define HELP_FLOOD_BUTTON_STR "flood-tool"
|
||||
#define HELP_HELP_BUTTON_STR "help-menu"
|
||||
#define HELP_LINE_BUTTON_STR "line-tool"
|
||||
#define HELP_MAGNIFICATION_BUTTON_STR "magnification"
|
||||
#define HELP_MAIN_WINDOW_STR "main"
|
||||
#define HELP_FILEIO_ICON_STR "IEopenDB"
|
||||
#define HELP_MENUBAR_STR "menubar"
|
||||
#define HELP_NEW_ICON_STR "newIcon"
|
||||
#define HELP_NEW_BUTTON_STR "new"
|
||||
#define HELP_OPEN_BUTTON_STR "open"
|
||||
#define HELP_OPTIONS_BUTTON_STR "options-menu"
|
||||
#define HELP_OUTPUT_FORMAT_BUTTON_STR "output-format"
|
||||
#define HELP_PASTE_BUTTON_STR "paste"
|
||||
#define HELP_POINT_BUTTON_STR "point-tool"
|
||||
#define HELP_POLYGON_BUTTON_STR "polygon-tool"
|
||||
#define HELP_POLYLINE_BUTTON_STR "polyline-tool"
|
||||
#define HELP_QUIT_BUTTON_STR "quit"
|
||||
#define HELP_RECTANGLE_BUTTON_STR "rectangle-tool"
|
||||
#define HELP_RESIZE_ICON_BUTTON_STR "resize"
|
||||
#define HELP_ROTATE_BUTTON_STR "rotate"
|
||||
#define HELP_SAVE_AS_BUTTON_STR "save-as"
|
||||
#define HELP_SAVE_BUTTON_STR "save"
|
||||
#define HELP_SCALE_BUTTON_STR "scale"
|
||||
#define HELP_SELECT_BUTTON_STR "select-tool"
|
||||
#define HELP_STATIC_COLOR_BUTTON_STR "static-colors"
|
||||
#define HELP_STATIC_GREY_BUTTON_STR "static-greys"
|
||||
#define HELP_UNDO_BUTTON_STR "undo"
|
||||
#define HELP_VIEWPORT_STR "viewport"
|
||||
#define HELP_VISIBLE_GRID_BUTTON_STR "visible-grid"
|
||||
#define HELP_GRAB_BUTTON_STR "grab-image"
|
||||
|
||||
#define HELP_HELP_INTRODUCTION_STR "help-menu-introduction"
|
||||
#define HELP_HELP_TASKS_STR "help-menu-tasks"
|
||||
#define HELP_HELP_REFERENCE_STR "help-menu-reference"
|
||||
#define HELP_HELP_ON_ITEM_STR "help-menu-onItem"
|
||||
#define HELP_HELP_USING_HELP_STR "help-menu-usingHelp"
|
||||
#define HELP_HELP_VERSION_STR "help-menu-version"
|
||||
|
||||
/* these are for the activate callback on the help menu items */
|
||||
#define HELP_INTRODUCTION_STR "_HOMETOPIC"
|
||||
#define HELP_TASKS_STR "tasks"
|
||||
#define HELP_REFERENCE_STR "reference"
|
||||
#define HELP_ON_ITEM_STR "onItem"
|
||||
#define HELP_USING_HELP_STR "_HOMETOPIC"
|
||||
#define HELP_VERSION_STR "_COPYRIGHT"
|
||||
|
||||
#define HELP_VOLUME "Iconed"
|
||||
#define HELP_HELP_VOLUME "Help4Help"
|
||||
533
cde/programs/dticon/image.c
Normal file
533
cde/programs/dticon/image.c
Normal file
@@ -0,0 +1,533 @@
|
||||
/* $XConsortium: image.c /main/4 1995/11/02 14:05:39 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
/******************************************************************************
|
||||
** Program: dticon
|
||||
**
|
||||
** Description: X11-based multi-color icon editor
|
||||
**
|
||||
** File: Image.c, containing the following subroutines/functions:
|
||||
** Mirror_Image()
|
||||
** Block_Rotate()
|
||||
** Scale_Image()
|
||||
** Flood_Region()
|
||||
** Flood_Fill()
|
||||
**
|
||||
******************************************************************************
|
||||
**
|
||||
** Copyright Hewlett-Packard Company, 1990, 1991, 1992.
|
||||
** All rights are reserved. Copying or reproduction of this program,
|
||||
** except for archival purposes, is prohibited without prior written
|
||||
** consent of Hewlett-Packard Company.
|
||||
**
|
||||
** Hewlett-Packard makes no representations about the suitibility of this
|
||||
** software for any purpose. It is provided "as is" without express or
|
||||
** implied warranty.
|
||||
**
|
||||
******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include "externals.h"
|
||||
|
||||
int flood_min_x, flood_min_y, flood_max_x, flood_max_y;
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Mirror_Image *
|
||||
* *
|
||||
* Purpose: Pick "horizontal" or "vertical" from a submenu. Then pick *
|
||||
* the rectangle to be flopped. Create a mirror image (either *
|
||||
* top-to-bottom or left-to-right) and prompt the user for *
|
||||
* placement of the result. *
|
||||
* *
|
||||
*X11***********************************************************************/
|
||||
|
||||
int
|
||||
Mirror_Image(
|
||||
int orientation )
|
||||
{
|
||||
XRectangle tmp_box;
|
||||
XImage *new_image, *old_image, *new_mono, *old_mono;
|
||||
unsigned long n;
|
||||
int i, j;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering Mirror_Image\n");
|
||||
#endif
|
||||
|
||||
if (!Selected)
|
||||
return (False);
|
||||
/*--- get src. & dst. images from both color and monochrome icons ---*/
|
||||
|
||||
old_image = XGetImage(dpy, color_icon, select_box.x, select_box.y,
|
||||
select_box.width, select_box.height, AllPlanes, format);
|
||||
if (old_image == NULL)
|
||||
return (False);
|
||||
new_image = XGetImage(dpy, color_icon, select_box.x, select_box.y,
|
||||
select_box.width, select_box.height, AllPlanes, format);
|
||||
if (new_image == NULL) {
|
||||
XDestroyImage(old_image);
|
||||
return (False);
|
||||
}
|
||||
|
||||
old_mono = XGetImage(dpy, mono_icon, select_box.x, select_box.y,
|
||||
select_box.width, select_box.height, AllPlanes, format);
|
||||
if (old_mono == NULL) {
|
||||
XDestroyImage(old_image);
|
||||
XDestroyImage(new_image);
|
||||
return (False);
|
||||
}
|
||||
new_mono = XGetImage(dpy, mono_icon, select_box.x, select_box.y,
|
||||
select_box.width, select_box.height, AllPlanes, format);
|
||||
if (new_mono == NULL) {
|
||||
XDestroyImage(old_image);
|
||||
XDestroyImage(new_image);
|
||||
XDestroyImage(old_mono);
|
||||
return (False);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out(" - got the images\n");
|
||||
#endif
|
||||
|
||||
for (i=0; i<(int)select_box.width; i++)
|
||||
for (j=0; j<(int)select_box.height; j++) {
|
||||
if (orientation == VERTICAL) {
|
||||
n = XGetPixel(old_image, i, j);
|
||||
XPutPixel(new_image, i, (select_box.height-1)-j, n);
|
||||
n = XGetPixel(old_mono, i, j);
|
||||
XPutPixel(new_mono, i, (select_box.height-1)-j, n);
|
||||
}
|
||||
else {
|
||||
n = XGetPixel(old_image, i, j);
|
||||
XPutPixel(new_image, (select_box.width-1)-i, j, n);
|
||||
n = XGetPixel(old_mono, i, j);
|
||||
XPutPixel(new_mono, (select_box.width-1)-i, j, n);
|
||||
}
|
||||
} /* for(j...) */
|
||||
XFlush(dpy);
|
||||
|
||||
XPutImage(dpy, color_icon, Color_gc, new_image, 0, 0,
|
||||
select_box.x, select_box.y,
|
||||
select_box.width, select_box.height);
|
||||
XPutImage(dpy, XtWindow(iconImage), Color_gc, new_image, 0, 0,
|
||||
select_box.x, select_box.y,
|
||||
select_box.width, select_box.height);
|
||||
|
||||
XPutImage(dpy, mono_icon, Mono_gc, new_mono, 0, 0,
|
||||
select_box.x, select_box.y,
|
||||
select_box.width, select_box.height);
|
||||
XPutImage(dpy, XtWindow(monoImage), Mono_gc, new_mono, 0, 0,
|
||||
select_box.x, select_box.y,
|
||||
select_box.width, select_box.height);
|
||||
Transfer_Back_Image(select_box.x, select_box.y,
|
||||
(select_box.x+select_box.width-1),
|
||||
(select_box.y+select_box.height-1),
|
||||
FILL);
|
||||
|
||||
XDestroyImage(new_image);
|
||||
XDestroyImage(old_image);
|
||||
XDestroyImage(new_mono);
|
||||
XDestroyImage(old_mono);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving Mirror_Image\n");
|
||||
#endif
|
||||
|
||||
return (True);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Block_Rotate *
|
||||
* *
|
||||
* Purpose: Given source and destination pixmaps of the correct size, *
|
||||
* and the type of rotation to do, do a block rotation (90 *
|
||||
* degrees clockwise or counterclockwise) from the source to *
|
||||
* the destination. *
|
||||
* *
|
||||
*X11***********************************************************************/
|
||||
|
||||
int
|
||||
Block_Rotate(
|
||||
XImage *src_image,
|
||||
XImage *dst_image,
|
||||
int rtype )
|
||||
{
|
||||
int i, j, width, height;
|
||||
unsigned long n;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering Block_Rotate\n");
|
||||
#endif
|
||||
|
||||
width = src_image->width;
|
||||
height = src_image->height;
|
||||
|
||||
switch (rtype) {
|
||||
case ROTATE_L : for (i=0; i<width; i++)
|
||||
for (j=0; j<height; j++) {
|
||||
n = XGetPixel(src_image, i, j);
|
||||
XPutPixel(dst_image, j, (width-1)-i, n);
|
||||
}
|
||||
break;
|
||||
case ROTATE_R : for (i=0; i<width; i++)
|
||||
for (j=0; j<height; j++) {
|
||||
n = XGetPixel(src_image, i, j);
|
||||
XPutPixel(dst_image, (height-1)-j, i, n);
|
||||
}
|
||||
break;
|
||||
} /* switch */
|
||||
XFlush(dpy);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving Block_Rotate\n");
|
||||
#endif
|
||||
|
||||
return (True);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Scale_Image *
|
||||
* *
|
||||
* Purpose: Given a scr. and dst. XImage pair, scale the src. image to *
|
||||
* the size of the dst. image. *
|
||||
* *
|
||||
*X11***********************************************************************/
|
||||
|
||||
void
|
||||
Scale_Image( void )
|
||||
{
|
||||
XImage *old_img, *old_mono;
|
||||
int old_x, old_y, new_x, new_y;
|
||||
int old_width, old_height, new_width, new_height;
|
||||
int min_x, min_y, max_x, max_y;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Entering Scale_Image\n");
|
||||
#endif
|
||||
|
||||
min_x = min(ix, last_ix);
|
||||
min_y = min(iy, last_iy);
|
||||
max_x = max(ix, last_ix);
|
||||
max_y = max(iy, last_iy);
|
||||
|
||||
/*** make sure all four points are on the tablet ***/
|
||||
|
||||
if (min_x < 0)
|
||||
min_x = 0;
|
||||
if (min_y < 0)
|
||||
min_y = 0;
|
||||
if ((max_x) >= icon_width)
|
||||
max_x = icon_width-1;
|
||||
if ((max_y) >= icon_height)
|
||||
max_y = icon_height-1;
|
||||
|
||||
old_img = XGetImage(dpy, color_icon, select_box.x, select_box.y,
|
||||
select_box.width, select_box.height,
|
||||
AllPlanes, format);
|
||||
old_mono = XGetImage(dpy, mono_icon, select_box.x, select_box.y,
|
||||
select_box.width, select_box.height,
|
||||
AllPlanes, format);
|
||||
|
||||
Scale = XGetImage(dpy, color_icon, min_x, min_y,
|
||||
(max_x-min_x+1), (max_y-min_y+1), AllPlanes, format);
|
||||
Scale_mono = XGetImage(dpy, mono_icon, min_x, min_y,
|
||||
(max_x-min_x+1), (max_y-min_y+1), AllPlanes, format);
|
||||
|
||||
old_width = old_img->width;
|
||||
old_height = old_img->height;
|
||||
new_width = Scale->width;
|
||||
new_height = Scale->height;
|
||||
for (new_y=0; new_y<new_height; new_y++) {
|
||||
old_y = (old_height * new_y) / new_height;
|
||||
for (new_x=0; new_x<new_width; new_x++) {
|
||||
old_x = (old_width * new_x) / new_width;
|
||||
XPutPixel(Scale, new_x, new_y, XGetPixel(old_img, old_x, old_y));
|
||||
XPutPixel(Scale_mono, new_x, new_y, XGetPixel(old_mono, old_x, old_y));
|
||||
}
|
||||
}
|
||||
|
||||
XDestroyImage(old_img);
|
||||
XDestroyImage(old_mono);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving Scale_Image\n");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Flood_Region *
|
||||
* *
|
||||
* Purpose: Pick the (rectangular) region to be flooded by a new color. *
|
||||
* Then pick an old color (pixel) in that region to be replaced *
|
||||
* by the new color (left button = current foreground, right *
|
||||
* button = current background). *
|
||||
* *
|
||||
*X11***********************************************************************/
|
||||
|
||||
int
|
||||
Flood_Region(
|
||||
int flood_x,
|
||||
int flood_y )
|
||||
{
|
||||
XImage *ImagePix, *MonoPix;
|
||||
unsigned long new_pixel, new_mono;
|
||||
|
||||
#ifdef DEBUG
|
||||
int i, j;
|
||||
unsigned long old_pixel;
|
||||
|
||||
if (debug)
|
||||
stat_out("Entering Flood_Region\n");
|
||||
#endif
|
||||
|
||||
/*--- get the image from the (adjusted) box ---*/
|
||||
|
||||
ImagePix = XGetImage(dpy, color_icon, 0, 0, icon_width, icon_height,
|
||||
AllPlanes, format);
|
||||
if (ImagePix == NULL)
|
||||
return (False);
|
||||
MonoPix = XGetImage(dpy, mono_icon, 0, 0, icon_width, icon_height,
|
||||
AllPlanes, format);
|
||||
if (MonoPix == NULL)
|
||||
return (False);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out(" - got the image\n");
|
||||
#endif
|
||||
|
||||
if (ColorBlock == STATIC_COLOR) {
|
||||
new_pixel = StaticPen[CurrentColor];
|
||||
new_mono = StaticMono[CurrentColor];
|
||||
}
|
||||
else {
|
||||
new_pixel = DynamicPen[CurrentColor];
|
||||
new_mono = DynamicMono[CurrentColor];
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug) {
|
||||
for (i=0; i<icon_width; i++)
|
||||
for (j=0; j<icon_height; j++) {
|
||||
old_pixel = XGetPixel(ImagePix, i, j);
|
||||
if ((old_pixel < 0) || (old_pixel > 255))
|
||||
stat_out(" BAD PIXEL VALUE (%d) AT [%d,%d]\n", old_pixel, i, j);
|
||||
}
|
||||
stat_out(" SUCCESSFULLY accessed each pixel in the image\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
flood_min_x = icon_width;
|
||||
flood_min_y = icon_height;
|
||||
flood_max_x = 0;
|
||||
flood_max_y = 0;
|
||||
|
||||
Flood_Fill(ImagePix, MonoPix, flood_x, flood_y, ImagePix->width,
|
||||
ImagePix->height, new_pixel, new_mono);
|
||||
XFlush(dpy);
|
||||
|
||||
Backup_Icons();
|
||||
XPutImage(dpy, color_icon, Color_gc, ImagePix, 0, 0, 0, 0,
|
||||
icon_width, icon_height);
|
||||
XPutImage(dpy, XtWindow(iconImage), Color_gc, ImagePix,
|
||||
0, 0, 0, 0, icon_width, icon_height);
|
||||
XPutImage(dpy, mono_icon, Mono_gc, MonoPix, 0, 0, 0, 0,
|
||||
icon_width, icon_height);
|
||||
XPutImage(dpy, XtWindow(monoImage), Mono_gc, MonoPix,
|
||||
0, 0, 0, 0, icon_width, icon_height);
|
||||
Transfer_Back_Image(flood_min_x, flood_min_y,
|
||||
flood_max_x, flood_max_y, FILL);
|
||||
XDestroyImage(ImagePix);
|
||||
XDestroyImage(MonoPix);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("Leaving Flood_Region\n");
|
||||
#endif
|
||||
|
||||
return (True);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Set_FloodLimits *
|
||||
* *
|
||||
* Purpose: Given the current [x,y] of a pixel about to be modified by *
|
||||
* a flood-fill operation, compare it's location against the *
|
||||
* limits of the area already affected by the flood-fill. If *
|
||||
* the pixel is outside the already modified area, adjust the *
|
||||
* flood_min_x, flood_min_y, flood_max_x, and flood_min_y, so *
|
||||
* that the current pixel is within the area defined by those *
|
||||
* four variables. When the flood-fill is completed, the *
|
||||
* final values for those four variables will be used (by the *
|
||||
* Transfer_Back_Image() call in Flood_Region()) to minimize *
|
||||
* the size of the sub-image tranferred back to the tablet *
|
||||
* from the color icon pixmap. This process slows down the *
|
||||
* actual flooding operation, but can significantly speed up *
|
||||
* the transfer_back operation, so there is a net performance *
|
||||
* gain (potentially, a large one). *
|
||||
* *
|
||||
*X11***********************************************************************/
|
||||
|
||||
void
|
||||
Set_FloodLimits(
|
||||
int x,
|
||||
int y )
|
||||
{
|
||||
if (x < flood_min_x)
|
||||
flood_min_x = x;
|
||||
if (x > flood_max_x)
|
||||
flood_max_x = x;
|
||||
if (y < flood_min_y)
|
||||
flood_min_y = y;
|
||||
if (y > flood_max_y)
|
||||
flood_max_y = y;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Flood_Fill *
|
||||
* *
|
||||
* Purpose: Interatively examine each pixel within a bounded area, *
|
||||
* replacing the old-colored pixels encountered with *
|
||||
* new-colored pixels. *
|
||||
* *
|
||||
***************************************************************************
|
||||
* one page seed fill program, 1 channel frame buffer version *
|
||||
* *
|
||||
* doesn't read each pixel twice like the BASICFILL algorithm in *
|
||||
* Alvy Ray Smith, "Tint Fill", SIGGRAPH '79 *
|
||||
* *
|
||||
* Paul Heckbert 13 Sept 1982, 28 Jan 1987 *
|
||||
* PIXAR 415-499-3600 *
|
||||
* P.O. Box 13719 UUCP: {sun,ucbvax}!pixar!ph *
|
||||
* San Rafael, CA 94913 ARPA: ph%pixar.uucp@ucbvax.berkeley.edu *
|
||||
*X11***********************************************************************/
|
||||
|
||||
/*
|
||||
* segment of scan line y for xl<=x<=xr was filled,
|
||||
* now explore adjacent pixels in scan line y+dy
|
||||
*/
|
||||
struct seg {short y, xl, xr, dy;};
|
||||
/*********************************************************
|
||||
#define MAX 10000
|
||||
*********************************************************/
|
||||
#define MAX 20000 /* max depth of stack */
|
||||
|
||||
#define PUSH(Y, XL, XR, DY) \
|
||||
if (sp<stack+MAX && Y+(DY)>=0 && Y+(DY)<height) \
|
||||
{sp->y = Y; sp->xl = XL; sp->xr = XR; sp->dy = DY; sp++;}
|
||||
|
||||
#define POP(Y, XL, XR, DY) \
|
||||
{sp--; Y = sp->y+(DY = sp->dy); XL = sp->xl; XR = sp->xr;}
|
||||
|
||||
#ifdef DEBUG
|
||||
int local_debug=False, p_cnt;
|
||||
#endif
|
||||
|
||||
int
|
||||
Flood_Fill(
|
||||
XImage *color_image,
|
||||
XImage *mono_image,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
unsigned long new_pixel,
|
||||
unsigned long new_mono )
|
||||
{
|
||||
int l, x1, x2, dy;
|
||||
unsigned long old_pixel;
|
||||
struct seg stack[MAX], *sp = stack;
|
||||
|
||||
old_pixel = XGetPixel(color_image, x, y); /* read pv at seed point */
|
||||
if (old_pixel==new_pixel || x<0 || x>width || y<0 || y>height) return;
|
||||
PUSH(y, x, x, 1); /* needed in some cases */
|
||||
PUSH(y+1, x, x, -1); /* seed segment (popped 1st) */
|
||||
|
||||
#ifdef DEBUG
|
||||
if (local_debug)
|
||||
p_cnt = 0;
|
||||
#endif
|
||||
while (sp>stack) {
|
||||
/* pop segment off stack and fill a neighboring scan line */
|
||||
POP(y, x1, x2, dy);
|
||||
for (x=x1; x>=0 && XGetPixel(color_image, x, y)==old_pixel; x--)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (local_debug) {
|
||||
stat_out("+[%d,%d] ", x, y);
|
||||
p_cnt++;
|
||||
if (p_cnt == 8) {
|
||||
stat_out("\n");
|
||||
p_cnt = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Set_FloodLimits(x, y);
|
||||
XPutPixel(color_image, x, y, new_pixel);
|
||||
XPutPixel(mono_image, x, y, new_mono);
|
||||
}
|
||||
if (x>=x1) goto skip;
|
||||
l = x+1;
|
||||
if (l<x1) PUSH(y, l, x1-1, -dy); /* leak on left? */
|
||||
x = x1+1;
|
||||
do {
|
||||
for (; x<width && XGetPixel(color_image, x, y)==old_pixel; x++)/**TAG**/
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (local_debug) {
|
||||
stat_out("-[%d,%d] ", x, y);
|
||||
p_cnt++;
|
||||
if (p_cnt == 8) {
|
||||
stat_out("\n");
|
||||
p_cnt = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Set_FloodLimits(x, y);
|
||||
XPutPixel(color_image, x, y, new_pixel);
|
||||
XPutPixel(mono_image, x, y, new_mono);
|
||||
}
|
||||
PUSH(y, l, x-1, dy);
|
||||
if (x>x2+1) PUSH(y, x2+1, x-1, -dy); /* leak on right? */
|
||||
skip: for (x++; x<=x2 && XGetPixel(color_image, x, y)!=old_pixel; x++)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (local_debug) {
|
||||
stat_out(" [%d,%d] ", x, y);
|
||||
p_cnt++;
|
||||
if (p_cnt == 8) {
|
||||
stat_out("\n");
|
||||
p_cnt = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
l = x;
|
||||
} while (x<=x2);
|
||||
}
|
||||
}
|
||||
835
cde/programs/dticon/main.c
Normal file
835
cde/programs/dticon/main.c
Normal file
@@ -0,0 +1,835 @@
|
||||
/* $TOG: main.c /main/11 1999/09/17 13:25:57 mgreess $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
/*-----------------------------------------------------------*/
|
||||
/* This is the project main program file. */
|
||||
/* You may add application dependent source code */
|
||||
/* at the appropriate places. */
|
||||
/*-----------------------------------------------------------*/
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <locale.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <Xm/Protocols.h>
|
||||
#include <Xm/DialogS.h>
|
||||
#include <Xm/MessageB.h>
|
||||
#include <Xm/MwmUtil.h>
|
||||
#include <Dt/EnvControlP.h>
|
||||
#include <Dt/UserMsg.h>
|
||||
#include "externals.h"
|
||||
#include "main.h"
|
||||
|
||||
#ifdef __TOOLTALK
|
||||
#include <Tt/tttk.h>
|
||||
int ttMark;
|
||||
int tt_tmpfile_fd = -1;
|
||||
static int undeclared = 0;
|
||||
static Tt_message local_msg = (Tt_message) 0;
|
||||
void DieFromToolTalkError( );
|
||||
Tt_message ProcessToolTalkMessage( );
|
||||
Tt_message ProcessToolTalkMediaMessage( );
|
||||
extern void ProcessAppArgs();
|
||||
void send_tt_saved();
|
||||
#define dticon_ptype "DT_Icon_Editor"
|
||||
#endif
|
||||
|
||||
#define ERROR -1
|
||||
#define NO_ERROR 0
|
||||
|
||||
static XtResource resources[] = {
|
||||
{"useMessaging", "UseMessaging", XmRBoolean, sizeof (Boolean),
|
||||
XtOffset (ApplicationDataPtr, useBMS), XmRImmediate, (XtPointer)False,
|
||||
},
|
||||
{"session", "Session", XmRString, sizeof (char *),
|
||||
XtOffset (ApplicationDataPtr, session), XmRImmediate, (XtPointer)NULL,
|
||||
},
|
||||
{"bmSuffix", "BmSuffix", XmRString, sizeof (char *),
|
||||
XtOffset (ApplicationDataPtr, bmSuffix), XmRImmediate, (XtPointer)".bm",
|
||||
},
|
||||
{"pmSuffix", "PmSuffix", XmRString, sizeof (char *),
|
||||
XtOffset (ApplicationDataPtr, pmSuffix), XmRImmediate, (XtPointer)".pm",
|
||||
},
|
||||
{"maxIconWidth", "MaxIconWidth", XmRInt, sizeof (int),
|
||||
XtOffset (ApplicationDataPtr, maxIconWidth), XmRImmediate,
|
||||
(caddr_t)MAX_ICON_WIDTH,
|
||||
},
|
||||
{"maxIconHeight", "MaxIconHeight", XmRInt, sizeof (int),
|
||||
XtOffset (ApplicationDataPtr, maxIconHeight), XmRImmediate,
|
||||
(caddr_t)MAX_ICON_HEIGHT,
|
||||
},
|
||||
{"useFileFilter", "UseFileFilter", XmRBoolean, sizeof (Boolean),
|
||||
XtOffset (ApplicationDataPtr, useFileFilter), XmRImmediate, (XtPointer)True,
|
||||
},
|
||||
{"useFileLists", "UseFileLists", XmRBoolean, sizeof (Boolean),
|
||||
XtOffset (ApplicationDataPtr, useFileLists), XmRImmediate, (XtPointer)True,
|
||||
},
|
||||
};
|
||||
|
||||
static XrmOptionDescRec option_list[] =
|
||||
{
|
||||
{"-noMessaging", "useMessaging", XrmoptionNoArg, (caddr_t)"FALSE"},
|
||||
{"-session", "session", XrmoptionSepArg, NULL},
|
||||
{"-bmSuffix", "bmSuffix", XrmoptionSepArg, NULL},
|
||||
{"-pmSuffix", "pmSuffix", XrmoptionSepArg, NULL},
|
||||
{"-maxIconWidth", "maxIconWidth", XrmoptionSepArg, (caddr_t)MAX_ICON_WIDTH},
|
||||
{"-maxIconHeight", "maxIconHeight",XrmoptionSepArg,(caddr_t)MAX_ICON_HEIGHT},
|
||||
{"-noFileFilter", "useFileFilter", XrmoptionNoArg, (caddr_t)"FALSE"},
|
||||
{"-noFileLists", "useFileLists", XrmoptionNoArg, (caddr_t)"FALSE"},
|
||||
{"-useFileFilter", "useFileFilter", XrmoptionNoArg, (caddr_t)"TRUE"},
|
||||
{"-useFileLists", "useFileLists", XrmoptionNoArg, (caddr_t)"TRUE"},
|
||||
};
|
||||
|
||||
|
||||
extern Widget mainForm, iconForm, fileMenu_quit_pb;
|
||||
extern void GetSessionInfo();
|
||||
extern char start_file[];
|
||||
extern char dummy[];
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
/* Insert application global declarations here */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
XtAppContext AppContext;
|
||||
Widget TopLevel;
|
||||
Widget dticonShell;
|
||||
char *execName, *progName;
|
||||
char msgID[120];
|
||||
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
/* User has selected window manager close button... verify */
|
||||
/* close desired if data has not been saved. */
|
||||
/*-----------------------------------------------------------*/
|
||||
static void
|
||||
CloseCB (
|
||||
Widget w,
|
||||
XtPointer clientData,
|
||||
XtPointer callbackArg )
|
||||
{
|
||||
DialogFlag = QUIT;
|
||||
XtCallCallbacks (fileMenu_quit_pb, XmNactivateCallback, NULL);
|
||||
}
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
/* Session is ending, save session information */
|
||||
/*-----------------------------------------------------------*/
|
||||
static void
|
||||
SaveSessionCB (
|
||||
Widget w,
|
||||
XtPointer clientData,
|
||||
XtPointer callbackArg )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (debug)
|
||||
stat_out("SaveSessionCB\n");
|
||||
#endif
|
||||
|
||||
SaveSession();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
/*-----------------------------------------------------------*/
|
||||
/* main */
|
||||
/*-----------------------------------------------------------*/
|
||||
/*-----------------------------------------------------------*/
|
||||
int
|
||||
main(
|
||||
int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
/*-----------------------------------------------------------*/
|
||||
/* Declarations. */
|
||||
/*-----------------------------------------------------------*/
|
||||
Widget w, d;
|
||||
int n;
|
||||
Arg args[20];
|
||||
Atom xa_WM_DELETE_WINDOW, xa_WM_SAVE_YOURSELF;
|
||||
char *tmpPtr=NULL;
|
||||
static char *untitledStr = NULL;
|
||||
char *p=NULL;
|
||||
char *tmpp=NULL;
|
||||
|
||||
#ifdef __TOOLTALK
|
||||
int ttFd;
|
||||
char * procId;
|
||||
Tt_status ttRc;
|
||||
char * sessionString;
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
/* Interface function declaration */
|
||||
/*-----------------------------------------------------------*/
|
||||
Widget create_dtIconShell();
|
||||
Widget create_newIconDialog();
|
||||
Widget create_queryDialog();
|
||||
Widget create_stdErrDialog();
|
||||
Widget create_fileIODialog();
|
||||
void GetMarginData();
|
||||
|
||||
|
||||
/* ------------------------*/
|
||||
/* Initialize program */
|
||||
/*------------------------------*/
|
||||
_DtEnvControl(DT_ENV_SET); /* set up environment variables */
|
||||
|
||||
XtSetLanguageProc(NULL, NULL, NULL);
|
||||
|
||||
execName = argv[0];
|
||||
if (progName=strrchr(argv[0], '/'))
|
||||
progName++;
|
||||
else
|
||||
progName = argv[0];
|
||||
|
||||
|
||||
TopLevel = XtAppInitialize(&AppContext, CLASS_NAME,
|
||||
option_list, XtNumber(option_list),
|
||||
&argc, argv, NULL, NULL, NULL);
|
||||
|
||||
XtGetApplicationResources(TopLevel, &xrdb, resources,
|
||||
XtNumber(resources), NULL, 0);
|
||||
|
||||
GetSessionInfo();
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------*/
|
||||
/* Insert initialization code for your application here */
|
||||
/*------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Create and popup the first window of the interface. The */
|
||||
/* return value can be used in the popdown or destroy functions. */
|
||||
/*------------------------------------------------------------------*/
|
||||
w = create_dtIconShell();
|
||||
dticonShell = w;
|
||||
d = create_fileIODialog();
|
||||
d = create_newIconDialog();
|
||||
d = create_queryDialog();
|
||||
d = create_stdErrDialog();
|
||||
Create_Gfx_Labels(Foreground, Background);
|
||||
AssignHelpCallbacks();
|
||||
|
||||
XtRealizeWidget (TopLevel);
|
||||
XtMapWidget (TopLevel);
|
||||
|
||||
GetMarginData();
|
||||
|
||||
/* */
|
||||
/* Since I can't change the .msg files I'll have to force
|
||||
it here.
|
||||
*/
|
||||
last_fname[0] = '\0';
|
||||
if (!untitledStr)
|
||||
untitledStr = GETSTR(2,20, "UNTITLED");
|
||||
strcpy(last_fname, untitledStr);
|
||||
strcat(last_fname, ".m.pm");
|
||||
ChangeTitle();
|
||||
/* */
|
||||
|
||||
ParseAppArgs(argc, argv);
|
||||
if (start_file[0] != '\0')
|
||||
{
|
||||
/* strip off path portion of name if there is one */
|
||||
tmpPtr = strrchr(start_file,'/');
|
||||
if (tmpPtr != NULL)
|
||||
XtSetArg(args[0], XmNiconName, tmpPtr+1);
|
||||
else
|
||||
XtSetArg(args[0], XmNiconName, start_file);
|
||||
XtSetValues(dtIconShell, args, 1);
|
||||
}
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNresizePolicy, XmRESIZE_NONE); n++;
|
||||
XtSetValues(mainForm, args, n);
|
||||
XtSetValues(iconForm, args, n);
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Catch window close event and call "File...Exit" callback. */
|
||||
/*------------------------------------------------------------------*/
|
||||
xa_WM_DELETE_WINDOW = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
|
||||
XmAddWMProtocolCallback(dtIconShell, xa_WM_DELETE_WINDOW, CloseCB,
|
||||
NULL);
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* Register for save and restore. */
|
||||
/*------------------------------------------------------------------*/
|
||||
xa_WM_SAVE_YOURSELF = XInternAtom(dpy, "WM_SAVE_YOURSELF", False);
|
||||
XmAddWMProtocolCallback(dtIconShell, xa_WM_SAVE_YOURSELF,
|
||||
SaveSessionCB, NULL);
|
||||
|
||||
#ifdef __TOOLTALK
|
||||
ttMark = tt_mark( );
|
||||
p = (char *)getenv("TT_SESSION");
|
||||
if (!p || strlen(p)==0) {
|
||||
tt_default_session_set( tt_X_session( XDisplayString( dpy )));}
|
||||
|
||||
procId = ttdt_open( &ttFd, "dticon", "CDE", "1.0", 1 );
|
||||
ttRc = tt_ptr_error(procId);
|
||||
tmpPtr = GETSTR(8, 8, "Could not connect to ToolTalk:\n%s\nExiting ...");
|
||||
DieFromToolTalkError( dticonShell, tmpPtr, ttRc );
|
||||
|
||||
ttRc = ttmedia_ptype_declare( dticon_ptype, 0,
|
||||
ProcessToolTalkMediaMessage, NULL, 0);
|
||||
DieFromToolTalkError( dticonShell, "ttmedia_ptype_declare: %s", ttRc );
|
||||
|
||||
ttRc = ttmedia_ptype_declare( dticon_ptype, 1000,
|
||||
ProcessToolTalkMediaMessage, NULL, 0);
|
||||
DieFromToolTalkError( dticonShell, "ttmedia_ptype_declare: %s", ttRc );
|
||||
|
||||
ttRc = ttmedia_ptype_declare( dticon_ptype, 2000,
|
||||
ProcessToolTalkMediaMessage, NULL, 1);
|
||||
DieFromToolTalkError( dticonShell, "ttmedia_ptype_declare: %s", ttRc );
|
||||
|
||||
tttk_Xt_input_handler(NULL, 0, 0);
|
||||
|
||||
ttRc = tt_ptr_error(ttdt_session_join( tt_default_session( ),
|
||||
ProcessToolTalkMessage,
|
||||
(Widget) 0, NULL, 1));
|
||||
DieFromToolTalkError( dticonShell, "ttdt_session_join: %s", ttRc );
|
||||
|
||||
XtAppAddInput( AppContext, ttFd, (XtPointer)XtInputReadMask,
|
||||
tttk_Xt_input_handler, 0 );
|
||||
if (!undeclared) tt_ptype_undeclare(dticon_ptype);
|
||||
tt_release(ttMark);
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------*/
|
||||
/* Enter the event loop */
|
||||
/*-------------------------*/
|
||||
{
|
||||
XEvent event;
|
||||
|
||||
for (;;) {
|
||||
XtAppNextEvent(AppContext, &event);
|
||||
if ((GraphicsOp == S_GRAB) &&
|
||||
((event.type == ButtonPress) ||
|
||||
(event.type == MotionNotify) ||
|
||||
(event.type == ButtonRelease)))
|
||||
Do_ButtonOp(&event);
|
||||
else
|
||||
{
|
||||
if ((GraphicsOp == POLYGON || GraphicsOp == POLYLINE) &&
|
||||
(event.type == ButtonPress))
|
||||
{
|
||||
if (event.xbutton.window != tablet_win)
|
||||
EndPolyOp();
|
||||
}
|
||||
XtDispatchEvent(&event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __TOOLTALK
|
||||
|
||||
static void
|
||||
ExitCB (Widget dialog, XtPointer client_data, XtPointer call_data)
|
||||
{
|
||||
exit((int) client_data);
|
||||
}
|
||||
|
||||
void
|
||||
DieFromToolTalkError(Widget parent, char *errfmt, Tt_status status)
|
||||
{
|
||||
Arg args[10];
|
||||
Widget dialog, dialogShell;
|
||||
char *errmsg, *statmsg, *title;
|
||||
XmString xms_errmsg, xms_ok, xms_title;
|
||||
int n;
|
||||
|
||||
if (! tt_is_err(status)) return;
|
||||
|
||||
statmsg = tt_status_message(status);
|
||||
errmsg = XtMalloc(strlen(errfmt) + strlen(statmsg) + 2);
|
||||
sprintf(errmsg, errfmt, statmsg);
|
||||
|
||||
xms_ok = GETXMSTR(8,6, "OK");
|
||||
xms_errmsg = XmStringCreateLocalized(errmsg);
|
||||
xms_title = GETXMSTR(8,2, "Icon Editor - Error");
|
||||
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNautoUnmanage, False); n++;
|
||||
XtSetArg(args[n], XmNokLabelString, xms_ok); n++;
|
||||
XtSetArg(args[n], XmNdialogTitle, xms_title); n++;
|
||||
XtSetArg(args[n], XmNmessageString, xms_errmsg); n++;
|
||||
XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); n++;
|
||||
|
||||
dialog = XmCreateErrorDialog(parent, "IconEditorError", args, n);
|
||||
XtAddCallback(dialog, XmNokCallback, ExitCB, (XtPointer) status);
|
||||
XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_CANCEL_BUTTON));
|
||||
XtUnmanageChild(XmMessageBoxGetChild(dialog, XmDIALOG_HELP_BUTTON));
|
||||
|
||||
/*
|
||||
* Disable the frame menu from dialog since we don't want the user
|
||||
* to be able to close dialogs with the frame menu
|
||||
*/
|
||||
dialogShell = XtParent(dialog);
|
||||
n = 0;
|
||||
XtSetArg(args[n], XmNmwmDecorations, MWM_DECOR_ALL | MWM_DECOR_MENU); n++;
|
||||
XtSetValues(dialogShell, args, n);
|
||||
XtManageChild(dialog);
|
||||
XtRealizeWidget(dialogShell);
|
||||
|
||||
_DtSimpleError(CLASS_NAME, DtFatalError, NULL, errmsg);
|
||||
|
||||
XtFree(errmsg);
|
||||
XmStringFree(xms_ok);
|
||||
XmStringFree(xms_errmsg);
|
||||
XmStringFree(xms_title);
|
||||
|
||||
while (TRUE)
|
||||
XtAppProcessEvent(XtWidgetToApplicationContext(dialog), XtIMAll);
|
||||
}
|
||||
|
||||
|
||||
Tt_message ProcessToolTalkMediaMessage( Tt_message msg,
|
||||
void* cdata,
|
||||
Tttk_op op,
|
||||
Tt_status diag,
|
||||
unsigned char* contents,
|
||||
int len,
|
||||
char* file,
|
||||
char* doc)
|
||||
{
|
||||
int mark = tt_mark();
|
||||
int tmplen=0;
|
||||
int tt_tmpMaskfile_fd = -1;
|
||||
char mask_file[MAX_FNAME];
|
||||
char *tmp = NULL;
|
||||
char *tmp1 = NULL;
|
||||
|
||||
if (tt_message_status(msg) == TT_WRN_START_MESSAGE) tt_message_reply(msg);
|
||||
|
||||
|
||||
switch(op) {
|
||||
case TTME_COMPOSE:
|
||||
/*
|
||||
* At this time, we don't handle composing new icons.
|
||||
* Fail any such requests.
|
||||
*/
|
||||
tt_message_fail(msg);
|
||||
break;
|
||||
case TTME_DISPLAY:
|
||||
/*
|
||||
* At this time, we don't handle displaying icons
|
||||
* without editing them.
|
||||
* Fail any such requests.
|
||||
*/
|
||||
tt_message_fail(msg);
|
||||
break;
|
||||
case TTME_EDIT:
|
||||
|
||||
/*
|
||||
* Undeclare the ptype so that this process will
|
||||
* not service any more TT requests.
|
||||
*/
|
||||
|
||||
tt_ptype_undeclare(dticon_ptype);
|
||||
undeclared = 1;
|
||||
|
||||
if (tt_message_status(msg) != TT_WRN_START_MESSAGE)
|
||||
{
|
||||
/*
|
||||
* A message came in while we were already up
|
||||
* and running -- reject it so that another dticon
|
||||
* process will be started up to service this
|
||||
* request.
|
||||
*/
|
||||
|
||||
tt_message_reject(msg);
|
||||
}
|
||||
else if (edit_notifier(NULL, msg, 0))
|
||||
{
|
||||
strcpy( msgID, tt_message_arg_val(msg, 1) );
|
||||
|
||||
if (file)
|
||||
{
|
||||
/*
|
||||
* Icon data is in a file
|
||||
*/
|
||||
strcpy(start_file, file);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Icon data is in a buffer -- write it
|
||||
* to a /tmp file.
|
||||
*/
|
||||
unsigned char* buf;
|
||||
int blen;
|
||||
int wlen;
|
||||
|
||||
if (tt_message_arg_bval(msg, 0,
|
||||
&buf, &blen) != TT_OK)
|
||||
{
|
||||
tt_message_fail(msg);
|
||||
edit_notifier(NULL, 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
(void) tmpnam(start_file);
|
||||
if( (buf) && (!strncmp((char *)buf, "/* XPM */", 9)) )
|
||||
{
|
||||
/* Format XPM */
|
||||
tt_tmpfile_fd =
|
||||
open(start_file,
|
||||
O_CREAT | O_WRONLY | O_NDELAY,
|
||||
0666);
|
||||
if (tt_tmpfile_fd && (wlen =
|
||||
write(tt_tmpfile_fd,
|
||||
buf, blen)) == blen)
|
||||
{
|
||||
(void) close(tt_tmpfile_fd);
|
||||
param_flag[AUTO_FILE] = True;
|
||||
argsNeedProcessed = True;
|
||||
}
|
||||
else {
|
||||
tt_message_fail(msg);
|
||||
edit_notifier(NULL, 0, 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Format XBM */
|
||||
/* assume two buffers.... */
|
||||
tmp = strchr((char *)buf, ';');
|
||||
tmp ++;
|
||||
tmplen=blen - strlen(tmp);
|
||||
|
||||
/* read XBM file first*/
|
||||
/* Grab the first buffer. */
|
||||
tt_tmpfile_fd =
|
||||
open(start_file,
|
||||
O_CREAT | O_WRONLY | O_NDELAY,
|
||||
0666);
|
||||
|
||||
if (tt_tmpfile_fd && (wlen =
|
||||
write(tt_tmpfile_fd,
|
||||
buf, tmplen)) == tmplen)
|
||||
{
|
||||
(void) close(tt_tmpfile_fd);
|
||||
param_flag[AUTO_FILE] = True;
|
||||
argsNeedProcessed = True;
|
||||
}
|
||||
else
|
||||
{
|
||||
tt_message_fail(msg);
|
||||
edit_notifier(NULL, 0, 1);
|
||||
}
|
||||
|
||||
/* Try to find the second buffer. */
|
||||
tmp ++;
|
||||
if(tmp) tmp1=strchr(tmp, ';');
|
||||
|
||||
if (tmp1)
|
||||
{
|
||||
/* we have a mask */
|
||||
/* construct the name of the mask file */
|
||||
strcpy(mask_file, start_file);
|
||||
strcat(mask_file, "_m\0");
|
||||
tt_tmpMaskfile_fd =
|
||||
open(mask_file,
|
||||
O_CREAT | O_WRONLY | O_NDELAY,
|
||||
0666);
|
||||
/* Read the mask fro the seconf buffer. */
|
||||
if (tt_tmpMaskfile_fd && (wlen =
|
||||
write(tt_tmpMaskfile_fd,
|
||||
tmp, strlen(tmp))) == strlen(tmp))
|
||||
{
|
||||
(void) close(tt_tmpMaskfile_fd);
|
||||
param_flag[AUTO_FILE] = True;
|
||||
argsNeedProcessed = True;
|
||||
}
|
||||
else {
|
||||
tt_message_fail(msg);
|
||||
edit_notifier(NULL, 0, 1);
|
||||
}
|
||||
}
|
||||
} /* else XBM Format */
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
tt_release(mark);
|
||||
return (Tt_message) 0;
|
||||
}
|
||||
|
||||
int
|
||||
edit_notifier(char* fname, Tt_message msg, int clear)
|
||||
{
|
||||
/*
|
||||
* Triple-mode function that either (1) saves the message
|
||||
* so it can be replied to later, (2) replies to a
|
||||
* previously-saved message, or (3) clears its state.
|
||||
*/
|
||||
|
||||
if (clear) {
|
||||
if (local_msg != (Tt_message) 0) {
|
||||
tt_message_reply(local_msg);
|
||||
tt_message_destroy(local_msg);
|
||||
}
|
||||
local_msg = (Tt_message) 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fname && !msg) {
|
||||
|
||||
/*
|
||||
* Not currently used, DELETE THIS COMMENT if it
|
||||
* is ever needed.
|
||||
*/
|
||||
|
||||
if (local_msg != (Tt_message) 0) {
|
||||
/*
|
||||
* Set the filename arg to the new, passed-in
|
||||
* file name, and reply to the message.
|
||||
*/
|
||||
tt_message_arg_val_set(local_msg, 0, fname);
|
||||
tt_message_reply(local_msg);
|
||||
local_msg = (Tt_message) 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else if (!fname && msg) {
|
||||
/*
|
||||
* Just store the message for a later reply. If
|
||||
* we already have a stored message, return a failure
|
||||
* status (0) and reject the incoming message.
|
||||
*/
|
||||
if (local_msg != (Tt_message) 0) {
|
||||
tt_message_reject(msg);
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
local_msg = msg;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* The caller is confused.
|
||||
*/
|
||||
tt_message_reject(msg);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
send_tt_saved()
|
||||
{
|
||||
int mark;
|
||||
int fd;
|
||||
int fdm;
|
||||
int len=0;
|
||||
int Mlen=0;
|
||||
int rlen=0;
|
||||
char* buffer=NULL;
|
||||
char* Fbuffer=NULL;
|
||||
char* Mbuffer=NULL;
|
||||
struct stat statbuf; /* Information on a file. */
|
||||
Tt_status ttstat;
|
||||
Tt_message msg;
|
||||
|
||||
mark = tt_mark();
|
||||
msg = tt_message_create();
|
||||
tt_message_address_set(msg, TT_HANDLER);
|
||||
tt_message_handler_set(msg, tt_message_sender(local_msg));
|
||||
tt_message_class_set(msg, TT_NOTICE);
|
||||
tt_message_scope_set(msg, TT_SESSION);
|
||||
tt_message_session_set(msg, tt_default_session());
|
||||
tt_message_op_set(msg, "Saved");
|
||||
|
||||
/* Read the base file regardless of format */
|
||||
fd = open(last_fname, O_RDONLY | O_NDELAY);
|
||||
len = lseek(fd, 0, SEEK_END);
|
||||
(void) lseek(fd, 0, SEEK_SET);
|
||||
Fbuffer = XtMalloc(len + 1);
|
||||
if ((rlen = read(fd, Fbuffer, len)) != len)
|
||||
{
|
||||
/* didn't read whole file! */
|
||||
printf("dtcreate: Only read %d of %d bytes of icon file!\n", rlen, len);
|
||||
}
|
||||
(void) close(fd);
|
||||
Fbuffer[len]='\0';
|
||||
|
||||
rlen = 0;
|
||||
/* Handle the XBM format */
|
||||
if( (fileFormat != FORMAT_XPM) && (stat(dummy, &statbuf) == 0) )
|
||||
{
|
||||
/* Read the mask file if one exists */
|
||||
fdm = open(dummy, O_RDONLY | O_NDELAY);
|
||||
Mlen = lseek(fdm, 0, SEEK_END);
|
||||
(void) lseek(fdm, 0, SEEK_SET);
|
||||
Mbuffer = XtMalloc(Mlen + 1);
|
||||
if ((rlen = read(fdm, Mbuffer, Mlen)) != Mlen)
|
||||
{
|
||||
/* didn't read whole file! */
|
||||
printf(
|
||||
"dtcreate: Only read %d of %d bytes of icon file!\n",
|
||||
rlen, Mlen);
|
||||
}
|
||||
(void) close(fdm);
|
||||
Mbuffer[Mlen] ='\0';
|
||||
|
||||
/* Double buffer the base and mask */
|
||||
buffer = XtMalloc(strlen(Fbuffer)+strlen(Mbuffer)+1);
|
||||
strcpy(buffer, Fbuffer);
|
||||
buffer[strlen(Fbuffer)] ='\0';
|
||||
strcat(buffer, Mbuffer);
|
||||
buffer[strlen(Fbuffer)+strlen(Mbuffer)+1] ='\0';
|
||||
XtFree(Mbuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No mask/bm just pass the pm file */
|
||||
buffer = XtMalloc(len + 1);
|
||||
strcpy(buffer, Fbuffer);
|
||||
buffer[len+1] ='\0';
|
||||
}
|
||||
|
||||
tt_message_barg_add(msg, TT_IN, tt_message_arg_type(local_msg, 0),
|
||||
(void *) buffer, Mlen+len+1);
|
||||
tt_message_arg_add(msg, TT_IN, "string", msgID);
|
||||
|
||||
ttstat = tt_message_send(msg);
|
||||
tt_message_destroy(msg);
|
||||
tt_release(mark);
|
||||
|
||||
XtFree(Fbuffer);
|
||||
XtFree(buffer);
|
||||
}
|
||||
|
||||
|
||||
Tt_message ProcessToolTalkMessage(Tt_message msg,
|
||||
void* cdata,
|
||||
Tt_message contract)
|
||||
{
|
||||
int mark = tt_mark();
|
||||
char* op = tt_message_op(msg);
|
||||
|
||||
if (!strcmp(op, "Quit")) {
|
||||
/*
|
||||
* Do any necessary cleanup here, call
|
||||
* tt_message_reply(), and quit.
|
||||
* Since this is not currently implemented here,
|
||||
* the message will just be failed for now.
|
||||
*/
|
||||
tt_message_fail(msg);
|
||||
}
|
||||
/*
|
||||
* The messages that must interact with the X environment
|
||||
* are not supported currently. If a realized,
|
||||
* mappedWhenManaged top-level widget were passed to
|
||||
* ttdt_session_join(), they would be handled automatically.
|
||||
* Since that is not the case, they are passed to this
|
||||
* callback, and could be implemented here if desired
|
||||
* (if so, be sure to change tt_message_reject to
|
||||
* tt_message_reply!).
|
||||
*/
|
||||
else {
|
||||
tt_message_reject(msg);
|
||||
}
|
||||
|
||||
tt_release(mark);
|
||||
return (Tt_message) 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
NAME: handle_dialog_child( wgt, manage_func )
|
||||
|
||||
INPUT: Widget wgt - the dialogShellWidget
|
||||
void (*manage_func)() - either XtManageChild
|
||||
or XtUnmanageChild
|
||||
|
||||
RETURN: int - NO_ERROR if successfull
|
||||
ERROR otherwise
|
||||
|
||||
DESCRIPTION: Handles the popping up or popping down of dialog shells
|
||||
by managing or unmanaging their children.
|
||||
|
||||
CREATION: Visual Edge Software Sept 19/91
|
||||
-----------------------------------------------------------------------------*/
|
||||
static int handle_dialog_child( Widget wgt, void (*manage_func)() )
|
||||
{
|
||||
int i, num_children;
|
||||
Widget *children;
|
||||
|
||||
XtVaGetValues( wgt,
|
||||
XmNnumChildren, &num_children,
|
||||
XmNchildren, &children,
|
||||
NULL );
|
||||
|
||||
/* We manage/unmanage the first rectObj child in the list.
|
||||
* Note that the check for rectObjClass is necessary since some
|
||||
* implementations of Motif add protocol children to the dialogShell.
|
||||
*/
|
||||
|
||||
for (i = 0; i < num_children; i++)
|
||||
{
|
||||
if ( XtIsSubclass( children[i], rectObjClass ) )
|
||||
{
|
||||
(*manage_func)(children[i]);
|
||||
return ( NO_ERROR );
|
||||
}
|
||||
}
|
||||
|
||||
return ( ERROR );
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
NAME: PopupInterface( wgt, grab_flag )
|
||||
|
||||
INPUT: Widget wgt - Widget to popup
|
||||
XtGrabKind grab_flag - grab flag
|
||||
|
||||
RETURN: int ERROR or NO_ERROR
|
||||
|
||||
DESCRIPTION: Popups up an interface. The widget should be a toplevel widget.
|
||||
Note that special handling is required for dialogShells since
|
||||
those are popped up by managing their children if they have
|
||||
some.
|
||||
The grab_flag could be any of:
|
||||
no_grab (XtGrabNone)
|
||||
nonexclusive_grab (XtGrabNonexclusive)
|
||||
exclusive_grab (XtGrabExclusive)
|
||||
|
||||
CREATION: Visual Edge Software April 6 1991
|
||||
-----------------------------------------------------------------------------*/
|
||||
int PopupInterface( Widget wgt, XtGrabKind grab_flag )
|
||||
{
|
||||
|
||||
if ( XtIsSubclass( wgt, xmDialogShellWidgetClass ) )
|
||||
{
|
||||
if ( handle_dialog_child( wgt, XtManageChild ) == ERROR )
|
||||
XtPopup( wgt, grab_flag );
|
||||
}
|
||||
else
|
||||
{
|
||||
XtPopup( wgt, grab_flag );
|
||||
}
|
||||
|
||||
return ( NO_ERROR );
|
||||
}
|
||||
51
cde/programs/dticon/main.h
Normal file
51
cde/programs/dticon/main.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* $XConsortium: main.h /main/5 1996/10/21 15:28:26 mgreess $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
/************************************<+>*************************************
|
||||
****************************************************************************
|
||||
**
|
||||
** File: main.h
|
||||
**
|
||||
** Project: DT 3.0
|
||||
**
|
||||
** This file contains global header file information for dticon
|
||||
**
|
||||
**
|
||||
** (c) Copyright Hewlett-Packard Company, 1992.
|
||||
**
|
||||
**
|
||||
****************************************************************************
|
||||
************************************<+>*************************************/
|
||||
#ifndef _main_h
|
||||
#define _main_h
|
||||
|
||||
|
||||
#ifndef NO_MESSAGE_CATALOG
|
||||
# ifdef __ultrix
|
||||
# define _CLIENT_CAT_NAME "dticon.cat"
|
||||
# else
|
||||
# define _CLIENT_CAT_NAME "dticon"
|
||||
# endif /* __ultrix */
|
||||
extern char *_DtGetMessage(char *filename, int set, int n, char *s);
|
||||
# define GETSTR(set, number, string) \
|
||||
(_DtGetMessage(_CLIENT_CAT_NAME, set, number, string))
|
||||
#else
|
||||
# define GETSTR(set, number, string) string
|
||||
#endif
|
||||
|
||||
|
||||
/* get a message catlog string and convert it to an XmString */
|
||||
#define GETXMSTR(set,num,str) XmStringCreateLocalized (GETSTR(set, num, str))
|
||||
|
||||
/* convert a regular string to an XmString */
|
||||
#define XMSTR(str) XmStringCreateLocalized (str)
|
||||
|
||||
|
||||
#endif /* _main_h */
|
||||
/* DON'T ADD ANYTHING AFTER THIS #endif */
|
||||
|
||||
211
cde/programs/dticon/newIconDialog.c
Normal file
211
cde/programs/dticon/newIconDialog.c
Normal file
@@ -0,0 +1,211 @@
|
||||
/* $XConsortium: newIconDialog.c /main/4 1995/11/02 14:06:08 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
/*******************************************************************************
|
||||
newIconDialog.c
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/DialogS.h>
|
||||
#include <Xm/MenuShell.h>
|
||||
#include <Xm/MwmUtil.h>
|
||||
|
||||
#include <Xm/TextF.h>
|
||||
#include <Xm/LabelG.h>
|
||||
#include <Xm/SeparatoG.h>
|
||||
#include <Xm/PushBG.h>
|
||||
#include <Xm/Form.h>
|
||||
|
||||
#include <Dt/DialogBox.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "externals.h"
|
||||
|
||||
/*******************************************************************************
|
||||
Includes, Defines, and Global variables from the Declarations Editor:
|
||||
*******************************************************************************/
|
||||
|
||||
static Widget newSeparator;
|
||||
static Widget newWidthLabel;
|
||||
static Widget newHeightLabel;
|
||||
|
||||
Widget newIconDialog;
|
||||
Widget newWidthText;
|
||||
Widget newHeightText;
|
||||
|
||||
extern Widget editMenu_deleteHS_pb;
|
||||
/*******************************************************************************
|
||||
Forward declarations of functions that are defined later in this file.
|
||||
*******************************************************************************/
|
||||
|
||||
Widget create_newIconDialog();
|
||||
|
||||
/*******************************************************************************
|
||||
The following are callback functions.
|
||||
*******************************************************************************/
|
||||
|
||||
/************************************************************************
|
||||
* ButtonCB()
|
||||
*
|
||||
************************************************************************/
|
||||
static void
|
||||
ButtonCB(
|
||||
Widget w,
|
||||
XtPointer client_data,
|
||||
XtPointer call_data )
|
||||
{
|
||||
DtDialogBoxCallbackStruct *cb = (DtDialogBoxCallbackStruct *)call_data;
|
||||
|
||||
switch (cb->button_position)
|
||||
{
|
||||
case 1: /* OK button */
|
||||
Process_Size_OK();
|
||||
break;
|
||||
|
||||
case 2: /* CANCEL button */
|
||||
Process_Size_Cancel();
|
||||
break;
|
||||
|
||||
case 3: /* HELP button */
|
||||
XtCallCallbacks(w, XmNhelpCallback, NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
The 'build_' function creates all the widgets
|
||||
using the resource values specified in the Property Editor.
|
||||
*******************************************************************************/
|
||||
|
||||
static Widget
|
||||
build_newIconDialog( void )
|
||||
{
|
||||
XmString tmpXmStrings[3];
|
||||
Widget workForm;
|
||||
Arg args[10];
|
||||
int n;
|
||||
|
||||
|
||||
/* create the dialog box with shell */
|
||||
|
||||
tmpXmStrings[0] = GETXMSTR(4,6, "OK");
|
||||
tmpXmStrings[1] = GETXMSTR(4,8, "Cancel");
|
||||
tmpXmStrings[2] = GETXMSTR(4,10, "Help");
|
||||
|
||||
n = 0;
|
||||
XtSetArg (args[n], XmNbuttonCount, 3); n++;
|
||||
XtSetArg (args[n], XmNbuttonLabelStrings, tmpXmStrings); n++;
|
||||
newIconDialog = __DtCreateDialogBoxDialog (mainWindow, "newIconDialog",
|
||||
args, n);
|
||||
|
||||
/* free compound strings now */
|
||||
XmStringFree (tmpXmStrings[0]);
|
||||
XmStringFree (tmpXmStrings[1]);
|
||||
XmStringFree (tmpXmStrings[2]);
|
||||
|
||||
XtAddCallback(newIconDialog, XmNcallback, ButtonCB, NULL);
|
||||
|
||||
n = 0;
|
||||
workForm = _DtDialogBoxGetButton(newIconDialog, 2);
|
||||
XtSetArg(args[n], XmNcancelButton, workForm); n++;
|
||||
XtSetValues (newIconDialog, args, n);
|
||||
|
||||
n = 0;
|
||||
XtSetArg (args[n], XmNtitle, GETSTR(4,4, "Icon Editor - Resize")); n++;
|
||||
XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
|
||||
XtSetArg (args[n], XmNmwmInputMode,MWM_INPUT_PRIMARY_APPLICATION_MODAL);n++;
|
||||
XtSetValues (XtParent(newIconDialog), args, n);
|
||||
|
||||
|
||||
/* create form with width/height to go in dialog box as work area */
|
||||
|
||||
workForm = XtVaCreateManagedWidget( "newIconForm",
|
||||
xmFormWidgetClass, newIconDialog,
|
||||
XmNchildType, XmWORK_AREA,
|
||||
XmNallowOverlap, False,
|
||||
NULL );
|
||||
|
||||
newWidthText = XtVaCreateManagedWidget( "newWidthText",
|
||||
xmTextFieldWidgetClass, workForm,
|
||||
XmNtopOffset, 5,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNrightOffset, 5,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
NULL );
|
||||
|
||||
tmpXmStrings[0] = GETXMSTR(4,12, "New Width:");
|
||||
newWidthLabel = XtVaCreateManagedWidget( "newWidthLabel",
|
||||
xmLabelGadgetClass, workForm,
|
||||
XmNalignment, XmALIGNMENT_END,
|
||||
XmNlabelString, tmpXmStrings[0],
|
||||
XmNtopOffset, 5,
|
||||
XmNtopAttachment, XmATTACH_FORM,
|
||||
XmNrightWidget, newWidthText,
|
||||
XmNrightAttachment, XmATTACH_WIDGET,
|
||||
XmNleftOffset, 5,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
NULL );
|
||||
XmStringFree(tmpXmStrings[0]);
|
||||
|
||||
newHeightText = XtVaCreateManagedWidget( "newHeightText",
|
||||
xmTextFieldWidgetClass, workForm,
|
||||
XmNtopWidget, newWidthText,
|
||||
XmNtopAttachment, XmATTACH_WIDGET,
|
||||
XmNrightOffset, 5,
|
||||
XmNrightAttachment, XmATTACH_FORM,
|
||||
XmNbottomOffset, 5,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
NULL );
|
||||
|
||||
tmpXmStrings[0] = GETXMSTR(4,14, "New Height:");
|
||||
newHeightLabel = XtVaCreateManagedWidget( "newHeightLabel",
|
||||
xmLabelGadgetClass, workForm,
|
||||
XmNalignment, XmALIGNMENT_END,
|
||||
XmNlabelString, tmpXmStrings[0],
|
||||
XmNtopWidget, newWidthLabel,
|
||||
XmNtopAttachment, XmATTACH_WIDGET,
|
||||
XmNrightWidget, newHeightText,
|
||||
XmNrightAttachment, XmATTACH_WIDGET,
|
||||
XmNbottomOffset, 5,
|
||||
XmNbottomAttachment, XmATTACH_FORM,
|
||||
XmNleftOffset, 5,
|
||||
XmNleftAttachment, XmATTACH_FORM,
|
||||
NULL );
|
||||
XmStringFree(tmpXmStrings[0]);
|
||||
|
||||
return ( newIconDialog );
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
The following is the 'Interface function' which is the
|
||||
external entry point for creating this interface.
|
||||
This function should be called from your application or from
|
||||
a callback function.
|
||||
*******************************************************************************/
|
||||
|
||||
Widget
|
||||
create_newIconDialog( void )
|
||||
{
|
||||
Widget rtrn;
|
||||
|
||||
rtrn = build_newIconDialog();
|
||||
|
||||
return(rtrn);
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
END OF FILE
|
||||
*******************************************************************************/
|
||||
|
||||
34
cde/programs/dticon/nlsMsgChk.txt
Normal file
34
cde/programs/dticon/nlsMsgChk.txt
Normal file
@@ -0,0 +1,34 @@
|
||||
# $XConsortium: nlsMsgChk.txt /main/2 1996/11/11 11:29:56 drk $
|
||||
#############################################################################
|
||||
#
|
||||
# (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
# (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
# Novell, Inc.
|
||||
#
|
||||
# Component: dticon
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# NOTE: Some of the dialogs exercise messages which are in different message
|
||||
# sets. The syntax used to specify this is:
|
||||
#
|
||||
# (set #, msg #)
|
||||
#
|
||||
|
||||
1. Screendump file name: 1.Z
|
||||
|
||||
_DtMessage catalog set numbers:
|
||||
|
||||
_DtMessage numbers:
|
||||
|
||||
Instructions: The main dticon window
|
||||
|
||||
At this writing, there is only one screen dump. It is of the main
|
||||
dticon window. The majority of the messages can be seen from the
|
||||
main dticon window and the menu panes from the main window menubar.
|
||||
To see the menu items, position the mouse over the menubar and select
|
||||
mouse button 1.
|
||||
|
||||
|
||||
30
cde/programs/dticon/nlsREADME.txt
Normal file
30
cde/programs/dticon/nlsREADME.txt
Normal file
@@ -0,0 +1,30 @@
|
||||
# $XConsortium: nlsREADME.txt /main/2 1996/11/11 11:30:17 drk $
|
||||
#############################################################################
|
||||
#
|
||||
# (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
# (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
# (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
# (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
# Novell, Inc.
|
||||
#
|
||||
# Component: dticon - multi-color icon editor
|
||||
#
|
||||
############################################################################
|
||||
#
|
||||
#
|
||||
|
||||
_DtMessage catalog source:
|
||||
|
||||
File name: dticon.msg
|
||||
|
||||
Target: /usr/dt/nls/%L/dticon.cat
|
||||
|
||||
|
||||
App-defaults file:
|
||||
|
||||
File name: Dticon
|
||||
|
||||
Target: /usr/dt/app-defaults/%L/Dticon
|
||||
|
||||
The accelerator's may need to be localized... only the acceleratorText
|
||||
is actually visible to the user.
|
||||
52
cde/programs/dticon/pixmaps/Circle.pm
Normal file
52
cde/programs/dticon/pixmaps/Circle.pm
Normal file
@@ -0,0 +1,52 @@
|
||||
/* XPM */
|
||||
/* $XConsortium: Circle.pm /main/3 1995/07/18 16:08:49 drk $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
static char * Circle [] = {
|
||||
/* width height ncolors cpp [x_hot y_hot] */
|
||||
"36 36 2 1 -1 -1",
|
||||
/* colors */
|
||||
" s background m black c #949494949494",
|
||||
". s foreground m white c white",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ....... ",
|
||||
" ... ... ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" ... ... ",
|
||||
" ....... ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
52
cde/programs/dticon/pixmaps/CircleSolid.pm
Normal file
52
cde/programs/dticon/pixmaps/CircleSolid.pm
Normal file
@@ -0,0 +1,52 @@
|
||||
/* XPM */
|
||||
/* $XConsortium: CircleSolid.pm /main/3 1995/07/18 16:08:56 drk $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
static char * CircleSolid [] = {
|
||||
/* width height ncolors cpp [x_hot y_hot] */
|
||||
"36 36 2 1 -1 -1",
|
||||
/* colors */
|
||||
" s background m black c #949494949494",
|
||||
". s foreground m white c white",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ....... ",
|
||||
" ............. ",
|
||||
" ............... ",
|
||||
" ................. ",
|
||||
" ................... ",
|
||||
" ..................... ",
|
||||
" ....................... ",
|
||||
" ......................... ",
|
||||
" ......................... ",
|
||||
" ......................... ",
|
||||
" ........................... ",
|
||||
" ........................... ",
|
||||
" ........................... ",
|
||||
" ........................... ",
|
||||
" ........................... ",
|
||||
" ........................... ",
|
||||
" ........................... ",
|
||||
" ......................... ",
|
||||
" ......................... ",
|
||||
" ......................... ",
|
||||
" ....................... ",
|
||||
" ..................... ",
|
||||
" ................... ",
|
||||
" ................. ",
|
||||
" ............... ",
|
||||
" ............. ",
|
||||
" ....... ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
52
cde/programs/dticon/pixmaps/ConnecClosedSolid.pm
Normal file
52
cde/programs/dticon/pixmaps/ConnecClosedSolid.pm
Normal file
@@ -0,0 +1,52 @@
|
||||
/* XPM */
|
||||
/* $XConsortium: ConnecClosedSolid.pm /main/3 1995/07/18 16:09:03 drk $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
static char * ConnecClosedSolid [] = {
|
||||
/* width height ncolors cpp [x_hot y_hot] */
|
||||
"36 36 2 1 -1 -1",
|
||||
/* colors */
|
||||
" s background m black c #949494949494",
|
||||
". s foreground m white c white",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ... ",
|
||||
" ........ ",
|
||||
" ............. ",
|
||||
" .................. ",
|
||||
" ..................... ",
|
||||
" .................... ",
|
||||
" ................... ",
|
||||
" .................. ",
|
||||
" ................. ",
|
||||
" ................ ",
|
||||
" ............... ",
|
||||
" .............. ",
|
||||
" ............. ",
|
||||
" .............. ",
|
||||
" ............... ",
|
||||
" ................ ",
|
||||
" ................. ",
|
||||
" .................. ",
|
||||
" ................... ",
|
||||
" .................... ",
|
||||
" ..................... ",
|
||||
" ...................... ",
|
||||
" ....................... ",
|
||||
" ........................ ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
52
cde/programs/dticon/pixmaps/Connected.pm
Normal file
52
cde/programs/dticon/pixmaps/Connected.pm
Normal file
@@ -0,0 +1,52 @@
|
||||
/* XPM */
|
||||
/* $XConsortium: Connected.pm /main/3 1995/07/18 16:09:10 drk $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
static char * Connected [] = {
|
||||
/* width height ncolors cpp [x_hot y_hot] */
|
||||
"36 36 2 1 -1 -1",
|
||||
/* colors */
|
||||
" s background m black c #949494949494",
|
||||
". s foreground m white c white",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ... ",
|
||||
" ..... . ",
|
||||
" ..... . ",
|
||||
" ..... . ",
|
||||
" ... . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
52
cde/programs/dticon/pixmaps/ConnectedClosed.pm
Normal file
52
cde/programs/dticon/pixmaps/ConnectedClosed.pm
Normal file
@@ -0,0 +1,52 @@
|
||||
/* XPM */
|
||||
/* $XConsortium: ConnectedClosed.pm /main/3 1995/07/18 16:09:18 drk $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
static char * ConnectedClosed [] = {
|
||||
/* width height ncolors cpp [x_hot y_hot] */
|
||||
"36 36 2 1 -1 -1",
|
||||
/* colors */
|
||||
" s background m black c #949494949494",
|
||||
". s foreground m white c white",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ... ",
|
||||
" ..... . ",
|
||||
" ..... . ",
|
||||
" ..... . ",
|
||||
" ... . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" ........................ ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
52
cde/programs/dticon/pixmaps/Ellipse.pm
Normal file
52
cde/programs/dticon/pixmaps/Ellipse.pm
Normal file
@@ -0,0 +1,52 @@
|
||||
/* XPM */
|
||||
/* $XConsortium: Ellipse.pm /main/3 1995/07/18 16:09:25 drk $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
static char * Ellipse [] = {
|
||||
/* width height ncolors cpp [x_hot y_hot] */
|
||||
"36 36 2 1 -1 -1",
|
||||
/* colors */
|
||||
" s background m black c #949494949494",
|
||||
". s foreground m white c white",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .......... ",
|
||||
" ... ... ",
|
||||
" ... ... ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" ... ... ",
|
||||
" ... ... ",
|
||||
" .......... ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
52
cde/programs/dticon/pixmaps/EllipseSolid.pm
Normal file
52
cde/programs/dticon/pixmaps/EllipseSolid.pm
Normal file
@@ -0,0 +1,52 @@
|
||||
/* XPM */
|
||||
/* $XConsortium: EllipseSolid.pm /main/3 1995/07/18 16:09:32 drk $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
static char * EllipseSolid [] = {
|
||||
/* width height ncolors cpp [x_hot y_hot] */
|
||||
"36 36 2 1 -1 -1",
|
||||
/* colors */
|
||||
" s background m black c #949494949494",
|
||||
". s foreground m white c white",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .......... ",
|
||||
" ................ ",
|
||||
" ...................... ",
|
||||
" ........................ ",
|
||||
" .......................... ",
|
||||
" ............................ ",
|
||||
" .............................. ",
|
||||
" ................................ ",
|
||||
" ................................ ",
|
||||
" ................................ ",
|
||||
" ................................ ",
|
||||
" ................................ ",
|
||||
" .............................. ",
|
||||
" ............................ ",
|
||||
" .......................... ",
|
||||
" ........................ ",
|
||||
" ...................... ",
|
||||
" ................ ",
|
||||
" .......... ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
58
cde/programs/dticon/pixmaps/Eraser.pm
Normal file
58
cde/programs/dticon/pixmaps/Eraser.pm
Normal file
@@ -0,0 +1,58 @@
|
||||
/* XPM */
|
||||
/* $XConsortium: Eraser.pm /main/3 1995/07/18 16:09:39 drk $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
static char * Eraser [] = {
|
||||
/* width height ncolors cpp [x_hot y_hot] */
|
||||
"36 36 8 1 0 0",
|
||||
/* colors */
|
||||
" s iconColor6 m white c yellow",
|
||||
". s iconColor2 m white c white",
|
||||
"X s background m black c #949494949494",
|
||||
"o s iconGray5 m black c #737373737373",
|
||||
"O s iconGray1 m white c #dededededede",
|
||||
"+ s iconGray3 m white c #adadadadadad",
|
||||
"@ s iconColor3 m black c red",
|
||||
"# s iconColor1 m black c black",
|
||||
/* pixels */
|
||||
" . . XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"o . . XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
" o . . XXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"o o . . XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
" o o . . XXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"o o o . . XXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"Xo o o . . XXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXo o o . . XXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXo o o . . XXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXo o o . . XXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXo o o . . XXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXo o o . . XXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXo o o . . XXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXo o o ...OXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXo o o+...OXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXo oo++...OXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXo+oo++...OXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXX++oo++..ooXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXX++oo++o@.@XXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXX++ooo@.@O@XXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX+oo@+@O@O@XXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXo@o@o@O@O@XXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXo@o@o@O@O@#########",
|
||||
"XXXXXXXXXXXXXXXXXXo@o@o@O@##########",
|
||||
"XXXXXXXXXXXXXXXXXXXo@o@o@###########",
|
||||
"XXXXXXXXXXXXXXXXXXXXo@o@############",
|
||||
"XXXXXXXXXXXXXXXXXXXXXo@#############",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"};
|
||||
52
cde/programs/dticon/pixmaps/Line.pm
Normal file
52
cde/programs/dticon/pixmaps/Line.pm
Normal file
@@ -0,0 +1,52 @@
|
||||
/* XPM */
|
||||
/* $XConsortium: Line.pm /main/3 1995/07/18 16:09:45 drk $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
static char * Line [] = {
|
||||
/* width height ncolors cpp [x_hot y_hot] */
|
||||
"36 36 2 1 -1 -1",
|
||||
/* colors */
|
||||
" s background m black c #949494949494",
|
||||
". s foreground m white c white",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" . ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
62
cde/programs/dticon/pixmaps/PaintBucket.pm
Normal file
62
cde/programs/dticon/pixmaps/PaintBucket.pm
Normal file
@@ -0,0 +1,62 @@
|
||||
/* XPM */
|
||||
/* $XConsortium: PaintBucket.pm /main/3 1995/07/18 16:09:52 drk $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
static char * PaintBucket [] = {
|
||||
/* width height ncolors cpp [x_hot y_hot] */
|
||||
"36 36 12 1 0 0",
|
||||
/* colors */
|
||||
" s background m black c #949494949494",
|
||||
". s iconGray1 m white c #dededededede",
|
||||
"X s iconColor1 m black c black",
|
||||
"o s iconColor2 m white c white",
|
||||
"O s iconGray7 m black c #424242424242",
|
||||
"+ s iconGray8 m black c #212121212121",
|
||||
"@ s iconGray5 m black c #737373737373",
|
||||
"# s iconGray3 m white c #adadadadadad",
|
||||
"$ s iconColor4 m black c green",
|
||||
"% s iconColor3 m black c red",
|
||||
"& s iconColor6 m white c yellow",
|
||||
"* s iconColor5 m black c blue",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ............. ",
|
||||
" ..XXXXXXXXXXXX. ",
|
||||
" ..XX .XX. ",
|
||||
" ..XX .XX ",
|
||||
" .XX .X ",
|
||||
" .X .X ",
|
||||
" .X ....... .X ",
|
||||
" .X oooOOOO... .X ",
|
||||
" .X o.OOOOOOO...XX ",
|
||||
" .X o..OOOOOOOO...X ",
|
||||
" .+o@...OOOOOOO..XX# ",
|
||||
" ..@@....OOOOOO...X## ",
|
||||
" ..@@@....OOOOO..@X### ",
|
||||
" ..@@@@@...O.O....@Xo### ",
|
||||
" ..$$$$%%%&&&**..##XXo### ",
|
||||
" ..$$%%%%&&&&*...XoXoXo### ",
|
||||
" .$$%%%%&&&&**...XoXoXoo###",
|
||||
" .$$%%%&&&&**..@.X#ooXooo##",
|
||||
" .$%%%&&&&**..@.@XXXXXoooo#",
|
||||
" $$%%&&&&**..O.@.@XXX..oooo",
|
||||
" $$%%&o***..OOO.@.@.....ooo",
|
||||
" $%%&&&*...O.OOO.@.@.....oo",
|
||||
" $$%%&&**.OOOO.OOO.@.@.....o",
|
||||
" $$%%&***.OOOOO.OOO.@.@.....",
|
||||
" $%%&&***O.OOOOO.OOO.@.@....",
|
||||
" $%%&***..O.OOOOO.OOO.@.@...",
|
||||
" $$%&&***...O.OOOOO.OOO.@.@..",
|
||||
" $%%&&*** ...O.OOOOO.OOO.@.@.",
|
||||
" $$%%&&** ...O.OOOOO.OOO.@.@",
|
||||
" $$%%&&** ...O.OOOOO.OOO.@.",
|
||||
" $%%%&&** ...O.OOOOO.OOO.@",
|
||||
" $$%%%&&** ...O.OOOOO.OOO ",
|
||||
" $$%%&&&** ...O.OOOOO.OO ",
|
||||
" $$%%&&&** ...O.OOOOO ",
|
||||
" $$%%&&*** ...O.OOO "};
|
||||
58
cde/programs/dticon/pixmaps/Pencil.pm
Normal file
58
cde/programs/dticon/pixmaps/Pencil.pm
Normal file
@@ -0,0 +1,58 @@
|
||||
/* XPM */
|
||||
/* $XConsortium: Pencil.pm /main/3 1995/07/18 16:10:00 drk $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
static char * Pencil [] = {
|
||||
/* width height ncolors cpp [x_hot y_hot] */
|
||||
"36 36 8 1 0 0",
|
||||
/* colors */
|
||||
" s background m black c #949494949494",
|
||||
". s iconColor6 m white c yellow",
|
||||
"X s iconColor2 m white c white",
|
||||
"o s iconGray5 m black c #737373737373",
|
||||
"O s foreground m white c white",
|
||||
"+ s iconGray3 m white c #adadadadadad",
|
||||
"@ s iconGray1 m white c #dededededede",
|
||||
"# s iconGray7 m black c #424242424242",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" .",
|
||||
" .X",
|
||||
" .X.",
|
||||
" .X.X",
|
||||
" .X.X.",
|
||||
" .X.X.o",
|
||||
" .X.X.o.",
|
||||
" .X.X.o.o",
|
||||
" OOOOO .X.X.o.o.",
|
||||
" OOO .X.X.o.o.o",
|
||||
" O .X.X.o.o.o ",
|
||||
" O .X.X.o.o.o ",
|
||||
" O .X.X.o.o.o ",
|
||||
" O .X.X.o.o.o ",
|
||||
" O .X.X.o.o.o ",
|
||||
" O +@XX.o.o.o ",
|
||||
" O +XX@o.o.o ",
|
||||
" OO +XX@ooo.o ",
|
||||
" OOO +X@ooo.o ",
|
||||
" O +X@ooooo ",
|
||||
" O +@ooooo ",
|
||||
" O +#ooooo ",
|
||||
" O ###oo ",
|
||||
" O ##o ",
|
||||
" OO ## ",
|
||||
" O## ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
52
cde/programs/dticon/pixmaps/Rectangle.pm
Normal file
52
cde/programs/dticon/pixmaps/Rectangle.pm
Normal file
@@ -0,0 +1,52 @@
|
||||
/* XPM */
|
||||
/* $XConsortium: Rectangle.pm /main/3 1995/07/18 16:10:08 drk $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
static char * Rectangle [] = {
|
||||
/* width height ncolors cpp [x_hot y_hot] */
|
||||
"36 36 2 1 -1 -1",
|
||||
/* colors */
|
||||
" s background m black c #949494949494",
|
||||
". s foreground m white c white",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .............................. ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" . . ",
|
||||
" .............................. ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
52
cde/programs/dticon/pixmaps/RectangleSolid.pm
Normal file
52
cde/programs/dticon/pixmaps/RectangleSolid.pm
Normal file
@@ -0,0 +1,52 @@
|
||||
/* XPM */
|
||||
/* $XConsortium: RectangleSolid.pm /main/3 1995/07/18 16:10:15 drk $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
static char * RectangleSolid [] = {
|
||||
/* width height ncolors cpp [x_hot y_hot] */
|
||||
"36 36 2 1 -1 -1",
|
||||
/* colors */
|
||||
" s background m black c #949494949494",
|
||||
". s foreground m white c white",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" .............................. ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
53
cde/programs/dticon/pixmaps/SelectArea.pm
Normal file
53
cde/programs/dticon/pixmaps/SelectArea.pm
Normal file
@@ -0,0 +1,53 @@
|
||||
/* XPM */
|
||||
/* $XConsortium: SelectArea.pm /main/3 1995/07/18 16:10:23 drk $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
static char * SelectArea [] = {
|
||||
/* width height ncolors cpp [x_hot y_hot] */
|
||||
"36 36 3 1 -1 -1",
|
||||
/* colors */
|
||||
" s background m black c #949494949494",
|
||||
". s iconColor1 m black c black",
|
||||
"X s iconColor2 m white c white",
|
||||
/* pixels */
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" .... .. .. .. .. .... ",
|
||||
" .... .. .. .. .. .... ",
|
||||
" ..XXX XX XX XX XX X..X ",
|
||||
" ..XXXX XX XX XX XX ..XX ",
|
||||
" XX XX ",
|
||||
" X X ",
|
||||
" .. .. ",
|
||||
" ..X ..X ",
|
||||
" XX XX ",
|
||||
" X X ",
|
||||
" .. .. ",
|
||||
" ..X ..X ",
|
||||
" XX XX ",
|
||||
" X X ",
|
||||
" .. .. ",
|
||||
" ..X ..X ",
|
||||
" XX XX ",
|
||||
" X X ",
|
||||
" .. .. ",
|
||||
" ..X ..X ",
|
||||
" .... .. .. .. .. ....XX ",
|
||||
" .... .. .. .. .. ....XX ",
|
||||
" XXXX XX XX XX XX XXXXX ",
|
||||
" XXXX XX XX XX XX XXXX ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
||||
963
cde/programs/dticon/process.c
Normal file
963
cde/programs/dticon/process.c
Normal file
@@ -0,0 +1,963 @@
|
||||
/* $TOG: process.c /main/7 1999/08/16 11:03:31 mgreess $ */
|
||||
/********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
/******************************************************************************
|
||||
** Program: dticon.c
|
||||
**
|
||||
** Description: X11-based multi-color icon editor
|
||||
**
|
||||
** File: process.c, which contains the following subroutines or
|
||||
** functions:
|
||||
** Process_New()
|
||||
** Process_Open()
|
||||
** Process_Save()
|
||||
** Process_SaveAs()
|
||||
** Process_Quit()
|
||||
** Process_Query_OK()
|
||||
** Process_Query_Cancel()
|
||||
** Process_Size_OK()
|
||||
** Eval_NewSize()
|
||||
** Process_Size_Cancel()
|
||||
** Process_StdErr_OK()
|
||||
** Process_Undo()
|
||||
** Process_Cut()
|
||||
** Process_Copy()
|
||||
** Process_Paste()
|
||||
** Process_Scale()
|
||||
** Process_Resize()
|
||||
** Process_AddHotspot()
|
||||
** Process_DeleteHotspot()
|
||||
** Process_Clear()
|
||||
** Process_RotateLeft()
|
||||
** Process_RotateRight()
|
||||
** Process_FlipV()
|
||||
** Process_FlipH()
|
||||
** Process_GridState()
|
||||
** Process_DropCheckOp()
|
||||
** Do_DropCheckOp()
|
||||
** Process_DropOp()
|
||||
** Do_Paste()
|
||||
** Do_DropOp()
|
||||
**
|
||||
******************************************************************************
|
||||
**
|
||||
** Copyright Hewlett-Packard Company, 1990, 1991, 1992.
|
||||
** All rights are reserved. Copying or reproduction of this program,
|
||||
** except for archival purposes, is prohibited without prior written
|
||||
** consent of Hewlett-Packard Company.
|
||||
**
|
||||
** Hewlett-Packard makes no representations about the suitibility of this
|
||||
** software for any purpose. It is provided "as is" without express or
|
||||
** implied warranty.
|
||||
**
|
||||
*****************************************************************************
|
||||
*/
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/XmP.h>
|
||||
#include <Xm/TextF.h>
|
||||
#include "externals.h"
|
||||
#include <string.h>
|
||||
|
||||
#include <Xm/DragC.h>
|
||||
#include <Dt/Dnd.h>
|
||||
|
||||
#include <Dt/HelpDialog.h>
|
||||
#include "main.h"
|
||||
|
||||
#ifdef __TOOLTALK
|
||||
#include <Tt/tttk.h>
|
||||
extern void ReplyToMessage( );
|
||||
extern Tt_message replyMsg;
|
||||
#endif
|
||||
|
||||
static void Do_DropCheckOp(DtDndTransferCallback);
|
||||
static void Do_DropOp(void);
|
||||
|
||||
extern Widget optionsMenu_grid;
|
||||
Widget editMenu_paste_pb;
|
||||
Widget editMenu_cut_pb;
|
||||
Widget editMenu_copy_pb;
|
||||
Widget editMenu_rotate_pb;
|
||||
Widget editMenu_flip_pb;
|
||||
Widget editMenu_scale_pb;
|
||||
Widget editMenu_undo_pb;
|
||||
extern Widget newWidthText, newHeightText;
|
||||
|
||||
extern GC scratch_gc;
|
||||
extern char dummy[];
|
||||
|
||||
Boolean Write_File( char * );
|
||||
Boolean Read_File( char * );
|
||||
|
||||
extern void Process_SaveAs(void);
|
||||
extern void Eval_NewSize(int, int);
|
||||
extern void Process_Copy(XImage **, XImage **);
|
||||
extern void Process_Resize(void);
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
/* Insert application global declarations here */
|
||||
/*-----------------------------------------------------------*/
|
||||
static char undo_file[MAX_FNAME]; /* save the file name after new */
|
||||
char dropFileName[MAX_FNAME];
|
||||
int SaveMeNot = TRUE; /* used to flag a save as for existing file */
|
||||
int SavedOnce = False;
|
||||
int NewFlag = False; /* use for undo after new */
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Process_New *
|
||||
* *
|
||||
* Purpose: Process the selection of the NEW button in the 'File' *
|
||||
* pulldown menu. If the 'Dirty' flag is set, changes have *
|
||||
* been made to the drawing tablet since the last save, which *
|
||||
* would be lost by quitting. Notify the user of this and *
|
||||
* allow them the chance to change their minds. If they do *
|
||||
* not, pop-up the NewIconDialog for the user to select new *
|
||||
* dimensions (if desired) for the new icon. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
void
|
||||
Process_New( void )
|
||||
{
|
||||
DialogFlag = NEW;
|
||||
if (Dirty)
|
||||
DoQueryDialog( GETSTR(16,16, "The current icon has not been saved.\n\nYour changes will be lost.") );
|
||||
else {
|
||||
Process_Resize();
|
||||
DialogFlag = NONE; }
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Process_Open *
|
||||
* *
|
||||
* Purpose: Process the selection of the OPEN button in the 'File' *
|
||||
* pulldown menu. If the 'Dirty' flag is set, changes have *
|
||||
* been made to the drawing tablet since the last save, which *
|
||||
* would be lost by quitting. Notify the user of this and *
|
||||
* allow them the chance to change their minds. If they do *
|
||||
* not, pop-up the FileSelectionDialog for the user to select *
|
||||
* the new file to be loaded. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
Process_Open( void )
|
||||
{
|
||||
DialogFlag = OPEN;
|
||||
fileIOMode = FILE_READ;
|
||||
if (Dirty)
|
||||
DoQueryDialog( GETSTR(16,16, "The current icon has not been saved.\nYour changes will be lost.") );
|
||||
else
|
||||
{
|
||||
XtManageChild(fileIODialog);
|
||||
SetFileIODialogInfo();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Process_Save *
|
||||
* *
|
||||
* Purpose: Process the selection of the SAVE button in the 'File' *
|
||||
* pulldown menu. This automatically saves the current icon *
|
||||
* to the same file it was loaded from, or saved to the last *
|
||||
* time. If this file was created 'from scratch' and no *
|
||||
* previous save operation has taken place, selecting this *
|
||||
* operation behaves the same way that the SAVE_AS operation *
|
||||
* behaves. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
Process_Save( void )
|
||||
{
|
||||
static char *untitledStr = NULL;
|
||||
static char newName[MAX_FNAME];
|
||||
char *tmp1 = NULL;
|
||||
char *tmp2 = NULL;
|
||||
int c;
|
||||
|
||||
DialogFlag = SAVE;
|
||||
fileIOMode = FILE_WRITE;
|
||||
|
||||
untitledStr = GETSTR(2,20, "UNTITLED");
|
||||
tmp1= strrchr(last_fname, '/');
|
||||
if (tmp1) {
|
||||
c = tmp1[1];
|
||||
tmp2 = strchr(tmp1, c);
|
||||
strcpy(newName, tmp2);
|
||||
}
|
||||
if (strncmp(newName, untitledStr, 8) == 0 || last_fname[0] == NULL) Process_SaveAs();
|
||||
else
|
||||
{
|
||||
if (SavedOnce == True)
|
||||
{
|
||||
if (!Write_File(last_fname))
|
||||
DoErrorDialog( GETSTR(16,4, "Unable to write data to file") );
|
||||
else
|
||||
Dirty = False;
|
||||
}
|
||||
else
|
||||
Process_SaveAs();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Process_SaveAs *
|
||||
* *
|
||||
* Purpose: Process the selection of the SAVE_AS button in the 'File' *
|
||||
* pulldown menu. This pops-up the FileSelectionDialog which *
|
||||
* prompts the user to select the file in which to save the *
|
||||
* current icon. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
Process_SaveAs( void )
|
||||
{
|
||||
DialogFlag = SAVE_AS;
|
||||
fileIOMode = FILE_WRITE;
|
||||
XtManageChild(fileIODialog);
|
||||
SetFileIODialogInfo();
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Process_Quit *
|
||||
* *
|
||||
* Purpose: Process the selection of the QUIT button in the 'File' *
|
||||
* pulldown menu. If the 'Dirty' flag is set, changes have *
|
||||
* been made to the drawing tablet since the last save, which *
|
||||
* would be lost by quitting. Notify the user of this and *
|
||||
* allow them the chance to change their minds. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
Process_Quit( void )
|
||||
{
|
||||
extern int ttMark;
|
||||
extern int tt_tmpfile_fd;
|
||||
|
||||
DialogFlag = QUIT;
|
||||
if (Dirty)
|
||||
DoQueryDialog( GETSTR(16,16, "The current icon has not been saved.\nYour changes will be lost.") );
|
||||
else {
|
||||
#ifdef __TOOLTALK
|
||||
edit_notifier(NULL, 0, 1);
|
||||
ttdt_session_quit( 0, 0, 1 );
|
||||
ttdt_close( 0, 0, 1 );
|
||||
tt_release( ttMark );
|
||||
if (tt_tmpfile_fd != -1) {
|
||||
unlink(last_fname);
|
||||
if (fileFormat != FORMAT_XPM ) {
|
||||
unlink(dummy);
|
||||
} /* if */
|
||||
} /* if */
|
||||
#endif
|
||||
exit(0);
|
||||
} /* else */
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
Process_Query_OK( void )
|
||||
{
|
||||
extern int ttMark;
|
||||
extern int tt_tmpfile_fd;
|
||||
|
||||
switch (DialogFlag) {
|
||||
case QUIT :
|
||||
#ifdef __TOOLTALK
|
||||
edit_notifier(NULL, 0, 1);
|
||||
ttdt_session_quit( 0, 0, 1 );
|
||||
ttdt_close( 0, 0, 1 );
|
||||
tt_release( ttMark );
|
||||
if (tt_tmpfile_fd != -1) {
|
||||
unlink(last_fname);
|
||||
if (fileFormat != FORMAT_XPM ) {
|
||||
unlink(dummy);}
|
||||
}
|
||||
#endif
|
||||
exit(0);
|
||||
break;
|
||||
case NEW : Process_Resize();
|
||||
DialogFlag= NONE;
|
||||
break;
|
||||
case OPEN : XtManageChild(fileIODialog);
|
||||
SetFileIODialogInfo();
|
||||
break;
|
||||
case SAVE_AS : SaveMeNot = False;
|
||||
Do_FileIO(NULL, NULL, NULL);
|
||||
break;
|
||||
case GRAB : Do_GrabOp();
|
||||
break;
|
||||
case DROP : Do_DropOp();
|
||||
break;
|
||||
} /* switch */
|
||||
XSync(dpy, 0);
|
||||
}
|
||||
|
||||
void
|
||||
Process_Query_Cancel( void )
|
||||
{
|
||||
DialogFlag = NONE;
|
||||
}
|
||||
|
||||
void
|
||||
Process_Size_OK( void )
|
||||
{
|
||||
char *widthStr, *heightStr;
|
||||
int new_width, new_height;
|
||||
|
||||
XtUnmanageChild(newIconDialog);
|
||||
widthStr = XmTextFieldGetString(newWidthText);
|
||||
heightStr = XmTextFieldGetString(newHeightText);
|
||||
new_width = atoi(widthStr);
|
||||
new_height = atoi(heightStr);
|
||||
Eval_NewSize(new_width, new_height);
|
||||
DialogFlag = NONE;
|
||||
}
|
||||
|
||||
void
|
||||
Eval_NewSize(
|
||||
int width,
|
||||
int height )
|
||||
{
|
||||
char old_width[10], old_height[10];
|
||||
int flag;
|
||||
|
||||
if ((width < 1) || (width > xrdb.maxIconWidth) ||
|
||||
(height < 1) || (height > xrdb.maxIconHeight)) {
|
||||
sprintf(old_width, "%d", icon_width);
|
||||
XmTextFieldSetString(newWidthText, old_width);
|
||||
sprintf(old_height, "%d", icon_height);
|
||||
XmTextFieldSetString(newHeightText, old_height);
|
||||
DoErrorDialog(GETSTR(16,10,"Invalid width and/or\nheight specified"));
|
||||
}
|
||||
else {
|
||||
|
||||
if (DialogFlag == NEW)
|
||||
flag = DO_NOT_SAVE;
|
||||
else
|
||||
flag = DO_SAVE;
|
||||
|
||||
Backup_Icons(); /* for undo */
|
||||
Init_Icons(width, height, flag);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Process_Size_Cancel( void )
|
||||
{
|
||||
DialogFlag = NONE;
|
||||
XtUnmanageChild(newIconDialog);
|
||||
}
|
||||
|
||||
void
|
||||
Process_StdErr_OK( void )
|
||||
{
|
||||
DialogFlag = NONE;
|
||||
XtUnmanageChild(stdErrDialog);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Process_Undo *
|
||||
* *
|
||||
* Purpose: Process the selection of the 'Undo' button in the 'Edit' *
|
||||
* pulldown menu. If no previous icon state is available, *
|
||||
* notify the user via a pop-up error dialog. Otherwise, *
|
||||
* reverse the Backup_Icon() function behavior, update the *
|
||||
* tablet to reflect the change, and set the UndoFlag to *
|
||||
* False (indicating that no further undo ops. are possible). *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
Process_Undo( void )
|
||||
{
|
||||
if (UndoFlag) {
|
||||
if ((icon_width != backup_width) || (icon_height != backup_height))
|
||||
Init_Icons(backup_width, backup_height, DO_NOT_SAVE);
|
||||
XCopyArea(dpy, prev_color_icon, color_icon,
|
||||
Color_gc, 0, 0, icon_width, icon_height, 0, 0);
|
||||
XCopyArea(dpy, prev_mono_icon, mono_icon,
|
||||
Mono_gc, 0, 0, icon_width, icon_height, 0, 0);
|
||||
if (XtWindow(iconImage))
|
||||
XCopyArea(dpy, color_icon, XtWindow(iconImage), Color_gc,
|
||||
0, 0, icon_width, icon_height, 0, 0);
|
||||
if (XtWindow(monoImage))
|
||||
XCopyArea(dpy, mono_icon, XtWindow(monoImage), Mono_gc,
|
||||
0, 0, icon_width, icon_height, 0, 0);
|
||||
Repaint_Exposed_Tablet();
|
||||
UndoFlag = False;
|
||||
Dirty = True;
|
||||
XtSetSensitive( editMenu_undo_pb, False);
|
||||
|
||||
if ( NewFlag == TRUE ){
|
||||
NewFlag = False;
|
||||
strcpy(last_fname, undo_file);
|
||||
last_fname[strlen(last_fname)] = '\0';
|
||||
ChangeTitle();}
|
||||
}
|
||||
else
|
||||
DoErrorDialog( GETSTR(16,8,"There is no previous\nimage available") );
|
||||
}
|
||||
|
||||
void
|
||||
Process_Cut( void )
|
||||
{
|
||||
Process_Copy(&CutCopy, &CutCopy_mono);
|
||||
if (Selected) {
|
||||
Backup_Icons();
|
||||
XSetForeground(dpy, scratch_gc, Transparent);
|
||||
XFillRectangle(dpy, color_icon, scratch_gc, select_box.x, select_box.y,
|
||||
select_box.width, select_box.height);
|
||||
XFillRectangle(dpy, mono_icon, scratch_gc, select_box.x, select_box.y,
|
||||
select_box.width, select_box.height);
|
||||
XFillRectangle(dpy, XtWindow(iconImage), scratch_gc,
|
||||
select_box.x, select_box.y, select_box.width, select_box.height);
|
||||
XFillRectangle(dpy, XtWindow(monoImage), scratch_gc,
|
||||
select_box.x, select_box.y, select_box.width, select_box.height);
|
||||
Transfer_Back_Image(select_box.x, select_box.y,
|
||||
(select_box.x+select_box.width),
|
||||
(select_box.y+select_box.height), FILL);
|
||||
XtSetSensitive( editMenu_paste_pb, True);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Process_Copy(
|
||||
XImage **img,
|
||||
XImage **img_mono )
|
||||
{
|
||||
if (Selected) {
|
||||
*img = XGetImage(dpy, color_icon, select_box.x, select_box.y,
|
||||
select_box.width, select_box.height, AllPlanes, format);
|
||||
*img_mono = XGetImage(dpy, mono_icon, select_box.x, select_box.y,
|
||||
select_box.width, select_box.height, AllPlanes, format);
|
||||
XtSetSensitive( editMenu_paste_pb, True);
|
||||
}
|
||||
else
|
||||
DoErrorDialog( GETSTR(16,12, "No area has been selected") );
|
||||
}
|
||||
|
||||
void
|
||||
Process_Paste( void )
|
||||
{
|
||||
if (CutCopy) {
|
||||
Backup_Icons();
|
||||
Backup_G_Op = GraphicsOp;
|
||||
GraphicsOp = S_PASTE;
|
||||
FirstRigid = True;
|
||||
/* grayout unusable stuff */
|
||||
XtSetSensitive( editMenu_cut_pb, False);
|
||||
XtSetSensitive( editMenu_copy_pb, False);
|
||||
XtSetSensitive(editMenu_rotate_pb, False);
|
||||
XtSetSensitive(editMenu_flip_pb, False);
|
||||
XtSetSensitive(editMenu_scale_pb, False);
|
||||
XSync(dpy, 0);
|
||||
}
|
||||
else
|
||||
DoErrorDialog(GETSTR(16,14, "No area was previously\ncut or copied"));
|
||||
}
|
||||
|
||||
void
|
||||
Process_Scale( void )
|
||||
{
|
||||
if (Selected) {
|
||||
Backup_Icons();
|
||||
Backup_G_Op = GraphicsOp;
|
||||
GraphicsOp = S_SCALE_1;
|
||||
FirstRigid = True;
|
||||
}
|
||||
else
|
||||
DoErrorDialog( GETSTR(16,12, "No area has been selected") );
|
||||
}
|
||||
|
||||
void
|
||||
Process_Resize( void )
|
||||
{
|
||||
int flag;
|
||||
char old_width[10], old_height[10];
|
||||
static char *untitledStr = NULL;
|
||||
|
||||
if ( DialogFlag == NEW ) {
|
||||
strcpy(undo_file, last_fname);
|
||||
last_fname[0] = '\0';
|
||||
SavedOnce = False;
|
||||
Backup_Icons(); /* for undo */
|
||||
flag = DO_NOT_SAVE;
|
||||
Init_Icons(icon_width, icon_height, flag);
|
||||
if (!untitledStr)
|
||||
untitledStr = GETSTR(2,20, "UNTITLED");
|
||||
strcpy(last_fname, untitledStr);
|
||||
strcat(last_fname, ".m.pm");
|
||||
last_fname[strlen(last_fname)] = '\0';
|
||||
ChangeTitle();
|
||||
Repaint_Exposed_Tablet();
|
||||
Dirty = False;
|
||||
NewFlag = TRUE;
|
||||
}
|
||||
else{
|
||||
sprintf(old_width, "%d", icon_width);
|
||||
XmTextFieldSetString(newWidthText, old_width);
|
||||
sprintf(old_height, "%d", icon_height);
|
||||
XmTextFieldSetString(newHeightText, old_height);
|
||||
XtManageChild(newIconDialog);
|
||||
XmProcessTraversal(newWidthText, XmTRAVERSE_CURRENT);
|
||||
XmTextFieldSetSelection(newWidthText, 0, 3, CurrentTime); }
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Process_Clear *
|
||||
* *
|
||||
* Purpose: Process the selection of the 'Clear' button in the 'Edit' *
|
||||
* pulldown menu. This should be undo'able, just like a normal *
|
||||
* graphics ops., so back up the icons before wiping out their *
|
||||
* contents. After painting them to transparent, copy the *
|
||||
* contents of the color icon back onto the tablet. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
Process_Clear( void )
|
||||
{
|
||||
Backup_Icons();
|
||||
XSetForeground(dpy, scratch_gc, Transparent);
|
||||
XFillRectangle(dpy, color_icon, scratch_gc, 0, 0, icon_width, icon_height);
|
||||
XFillRectangle(dpy, mono_icon, scratch_gc, 0, 0, icon_width, icon_height);
|
||||
if (XtWindow(iconImage))
|
||||
XCopyArea(dpy, color_icon, XtWindow(iconImage), scratch_gc,
|
||||
0, 0, icon_width, icon_height, 0, 0);
|
||||
if (XtWindow(monoImage))
|
||||
XCopyArea(dpy, mono_icon, XtWindow(monoImage), scratch_gc,
|
||||
0, 0, icon_width, icon_height, 0, 0);
|
||||
Repaint_Exposed_Tablet();
|
||||
Dirty = False;
|
||||
}
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Process_GrabImage *
|
||||
* *
|
||||
* Purpose: You're a computer programmer. *YOU* figure out what it does.*
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
Process_GrabImage( void )
|
||||
{
|
||||
DialogFlag = GRAB;
|
||||
if (Dirty)
|
||||
DoQueryDialog( GETSTR(16,16, "The current icon has not been saved.\nYour changes will be lost.") );
|
||||
else
|
||||
Do_GrabOp();
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Process_AddHotspot *
|
||||
* *
|
||||
* Purpose: Process the selection of the 'Add Hotspot' button in the *
|
||||
* 'Edit' pulldown menu. Save the current graphics ops. flag *
|
||||
* and set the flag to S_HOTSPOT. The actual [x,y] location *
|
||||
* selection for the hotspot will occur in the event processing *
|
||||
* loop for the tablet. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
Process_AddHotspot( void )
|
||||
{
|
||||
Backup_G_Op = GraphicsOp;
|
||||
GraphicsOp = S_HOTSPOT;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Process_DeleteHotspot *
|
||||
* *
|
||||
* Purpose: Process the selection of the 'Delete Hotspot' button in the *
|
||||
* 'Edit' pulldown menu. Set the X and Y hot values to -1, set *
|
||||
* the hotSpot flag to FALSE, and repaint the exposed portion *
|
||||
* of the tablet (to remove the visible hotspot indicator). *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
Process_DeleteHotspot( void )
|
||||
{
|
||||
X_Hot = -1;
|
||||
Y_Hot = -1;
|
||||
hotSpot = False;
|
||||
Repaint_Exposed_Tablet();
|
||||
}
|
||||
|
||||
void
|
||||
Process_RotateLeft( void )
|
||||
{
|
||||
XImage *color_img, *mono_img;
|
||||
|
||||
Process_Copy(&color_img, &mono_img);
|
||||
/* Turn off Paste since no area is available to Paste */
|
||||
XtSetSensitive( editMenu_paste_pb, False);
|
||||
if (Selected) {
|
||||
Backup_Icons();
|
||||
Rotate = XGetImage(dpy, root, 0, 0, color_img->height, color_img->width,
|
||||
AllPlanes, format);
|
||||
Rotate_mono = XGetImage(dpy, root, 0, 0, mono_img->height, mono_img->width,
|
||||
AllPlanes, format);
|
||||
Block_Rotate(color_img, Rotate, ROTATE_L);
|
||||
Block_Rotate(mono_img, Rotate_mono, ROTATE_L);
|
||||
XDestroyImage(color_img);
|
||||
XDestroyImage(mono_img);
|
||||
Backup_G_Op = GraphicsOp;
|
||||
GraphicsOp = S_ROTATE;
|
||||
FirstRigid = True;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Process_RotateRight( void )
|
||||
{
|
||||
XImage *color_img, *mono_img;
|
||||
|
||||
Process_Copy(&color_img, &mono_img);
|
||||
/* Turn off Paste since no area is available to Paste */
|
||||
XtSetSensitive( editMenu_paste_pb, False);
|
||||
if (Selected) {
|
||||
Backup_Icons();
|
||||
Rotate = XGetImage(dpy, root, 0, 0, color_img->height, color_img->width,
|
||||
AllPlanes, format);
|
||||
Rotate_mono = XGetImage(dpy, root, 0, 0, mono_img->height, mono_img->width,
|
||||
AllPlanes, format);
|
||||
Block_Rotate(color_img, Rotate, ROTATE_R);
|
||||
Block_Rotate(mono_img, Rotate_mono, ROTATE_R);
|
||||
XDestroyImage(color_img);
|
||||
XDestroyImage(mono_img);
|
||||
Backup_G_Op = GraphicsOp;
|
||||
GraphicsOp = S_ROTATE;
|
||||
FirstRigid = True;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Process_FlipV *
|
||||
* *
|
||||
* Purpose: Process the selection of the 'Vertical' button in the 'Edit' *
|
||||
* ->'Flip Area' pulldown menu. This should be undo'able, *
|
||||
* just like a normal graphics ops., so back up the icons *
|
||||
* first, then call Mirror_Image(), with the flag VERTICAL. *
|
||||
* If no area is SELECTED, map the error dialog with the *
|
||||
* appropriate message. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
Process_FlipV( void )
|
||||
{
|
||||
if (Selected) {
|
||||
Backup_Icons();
|
||||
Mirror_Image(VERTICAL);
|
||||
}
|
||||
else
|
||||
DoErrorDialog( GETSTR(16,12, "No area has been selected") );
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Process_FlipH *
|
||||
* *
|
||||
* Purpose: Process the selection of the 'Horizontal' button in the *
|
||||
* 'Edit'->'Flip Area' pulldown menu. This should be undo'able,*
|
||||
* just like a normal graphics ops., so back up the icons *
|
||||
* first, then call Mirror_Image(), with the flag HORIZONTAL. *
|
||||
* If no area is SELECTED, map the error dialog with the *
|
||||
* appropriate message. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
Process_FlipH( void )
|
||||
{
|
||||
if (Selected) {
|
||||
Backup_Icons();
|
||||
Mirror_Image(HORIZONTAL);
|
||||
}
|
||||
else
|
||||
DoErrorDialog( GETSTR(16,12, "No area has been selected") );
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Process_GridState *
|
||||
* *
|
||||
* Purpose: Process the selection of the 'Visible Grid' button in the *
|
||||
* 'Options' pulldown menu. Set the GridEnabled internal flag *
|
||||
* to reflect the current state of the toggle. If the value is *
|
||||
* different from the previous value, repaint the tablet. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
Process_GridState( void )
|
||||
{
|
||||
Arg args[10];
|
||||
int i;
|
||||
Boolean new_val;
|
||||
|
||||
i = 0;
|
||||
XtSetArg(args[i], XmNset, &new_val); i++;
|
||||
XtGetValues(optionsMenu_grid, args, i);
|
||||
#ifdef DEBUG
|
||||
if (debug) {
|
||||
stat_out("Toggling tablet grid ");
|
||||
switch (new_val) {
|
||||
case True : stat_out("ON\n");
|
||||
break;
|
||||
case False : stat_out("OFF\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (new_val != GridEnabled) {
|
||||
GridEnabled = new_val;
|
||||
Repaint_Exposed_Tablet();
|
||||
}
|
||||
}
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: ConvertDropName *
|
||||
* *
|
||||
* Purpose: Convert the "object" received from bms to a full path name *
|
||||
* note: I am making BIG assumptions about the format of the *
|
||||
* file I am getting from dtfile. "<host> - <path>" *
|
||||
* WARNING: I have used an Xe function directly (XeIsLocalHostP), rather *
|
||||
* than include Dt/Connect.h, which was causing bad things to *
|
||||
* happen at build time, probably because dticon is not ansi- *
|
||||
* clean (it tried to get c++ version of /usr/include/stdlib.h?) *
|
||||
* It's simply too late to clean up the ansi... (the bell tolls) *
|
||||
* *
|
||||
***************************************************************************/
|
||||
static char *
|
||||
ConvertDropName( char *objects)
|
||||
{
|
||||
char *host;
|
||||
char *path;
|
||||
char *fullName;
|
||||
char *tmp;
|
||||
char *netfile;
|
||||
|
||||
host = objects;
|
||||
tmp = strchr(objects,' ');
|
||||
if (tmp==NULL) /* shouldn't happen */
|
||||
return (strdup(strchr(objects, '/')));
|
||||
|
||||
/* check if same host */
|
||||
tmp[0] = '\0';
|
||||
if ((Boolean)XeIsLocalHostP(host))
|
||||
{
|
||||
tmp[0] = ' ';
|
||||
return (strdup(strchr(objects, '/')));
|
||||
}
|
||||
|
||||
/* different host... get full path name */
|
||||
path = tmp+3; /* skip past the " - " */
|
||||
|
||||
/* Convert to a valid name on the local host. */
|
||||
netfile = tt_host_file_netfile(host, path);
|
||||
fullName = tt_netfile_file(netfile);
|
||||
tt_free(netfile);
|
||||
|
||||
tmp[0] = ' '; /* put back the " " after host name */
|
||||
return (fullName);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Process_DropCheckOp *
|
||||
* *
|
||||
* Purpose: Validate the drag-n-drop operation that just occured on the *
|
||||
* tablet window. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
Process_DropCheckOp(
|
||||
Widget w,
|
||||
XtPointer client_data,
|
||||
XtPointer call_data)
|
||||
{
|
||||
DtDndTransferCallback transferInfo = (DtDndTransferCallback) call_data;
|
||||
|
||||
/* save name in global array for later (Do_DropOp function) */
|
||||
/*
|
||||
* REMIND: Need to address case of multiple file names - here and
|
||||
* elsewhere in the code. This continues with the assumption
|
||||
* that there is only one file name transfered.
|
||||
*/
|
||||
if (transferInfo->dropData->numItems > 0)
|
||||
{
|
||||
strncpy (dropFileName, transferInfo->dropData->data.files[0],
|
||||
MAX_FNAME);
|
||||
}
|
||||
else
|
||||
dropFileName[0] = '\0';
|
||||
|
||||
Do_DropCheckOp(transferInfo);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug) {
|
||||
stat_out(" file-name = %s\n", dropFileName);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
extern Widget formatMenu_xpm_tb, formatMenu_xbm_tb;
|
||||
extern int successFormat, x_hot, y_hot;
|
||||
extern unsigned int width_ret, height_ret;
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Do_DropCheckOp *
|
||||
* *
|
||||
* Purpose: Verify the drag-n-drop operation that just occured on the *
|
||||
* tablet window. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
static void
|
||||
Do_DropCheckOp(
|
||||
DtDndTransferCallback transferInfo)
|
||||
{
|
||||
|
||||
#ifdef DEBUG
|
||||
if (debug) {
|
||||
stat_out(" Doing DROP OPERATION :\n");
|
||||
stat_out(" name is = %s\n", dropFileName);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dropFileName[0] != '\0')
|
||||
{
|
||||
if (!Read_File(dropFileName))
|
||||
{
|
||||
DoErrorDialog( GETSTR(16,2,
|
||||
"The file cannot be accessed\nor contains invalid data") );
|
||||
transferInfo->status = DtDND_FAILURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
transferInfo->status = DtDND_SUCCESS;
|
||||
} /* else */
|
||||
} /* if */
|
||||
}
|
||||
|
||||
void
|
||||
Process_DropOp(
|
||||
Widget w,
|
||||
XtPointer client_data,
|
||||
XtPointer call_data)
|
||||
{
|
||||
DialogFlag = DROP;
|
||||
|
||||
if (Dirty)
|
||||
DoQueryDialog( GETSTR(16,16, "The current icon has not been saved.\n\nYour changes will be lost.") );
|
||||
else {
|
||||
Do_DropOp();}
|
||||
}
|
||||
|
||||
static void
|
||||
Do_DropOp(void)
|
||||
{
|
||||
if (successFormat == FORMAT_XPM)
|
||||
{
|
||||
X_Hot = xpm_ReadAttribs.x_hotspot;
|
||||
Y_Hot = xpm_ReadAttribs.y_hotspot;
|
||||
Display_XPMFile(xpm_ReadAttribs.width, xpm_ReadAttribs.height);
|
||||
}
|
||||
else if (successFormat == FORMAT_XBM)
|
||||
{
|
||||
X_Hot = x_hot;
|
||||
Y_Hot = y_hot;
|
||||
Display_XBMFile(width_ret, height_ret);
|
||||
}
|
||||
|
||||
Dirty = False;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Routine: Do_Paste *
|
||||
* *
|
||||
* Purpose: Paste the CutCopy image at the tablet location specified by *
|
||||
* the [x,y] parameters in the call. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
void
|
||||
Do_Paste(
|
||||
int x,
|
||||
int y )
|
||||
{
|
||||
XImage *color_img, *mono_img;
|
||||
|
||||
if (GraphicsOp == S_PASTE) {
|
||||
color_img = CutCopy;
|
||||
mono_img = CutCopy_mono;
|
||||
}
|
||||
else if (GraphicsOp == S_ROTATE) {
|
||||
color_img = Rotate;
|
||||
mono_img = Rotate_mono;
|
||||
}
|
||||
else {
|
||||
color_img = Scale;
|
||||
mono_img = Scale_mono;
|
||||
}
|
||||
|
||||
if (GraphicsOp == S_PASTE)
|
||||
{
|
||||
GraphicsOp = S_WAIT_RELEASE;
|
||||
}
|
||||
else
|
||||
{
|
||||
GraphicsOp = Backup_G_Op;
|
||||
if (Backup_G_Op == SELECT)
|
||||
Start_HotBox(CONTINUE);
|
||||
Backup_G_Op = NULL;
|
||||
}
|
||||
|
||||
XPutImage(dpy, color_icon, Color_gc, color_img, 0, 0, x, y,
|
||||
color_img->width, color_img->height);
|
||||
XPutImage(dpy, mono_icon, Mono_gc, mono_img, 0, 0, x, y,
|
||||
mono_img->width, mono_img->height);
|
||||
XCopyArea(dpy, color_icon, XtWindow(iconImage), Color_gc,
|
||||
x, y, color_img->width, color_img->height, x, y);
|
||||
XCopyArea(dpy, mono_icon, XtWindow(monoImage), Mono_gc,
|
||||
x, y, mono_img->width, mono_img->height, x, y);
|
||||
Transfer_Back_Image(x, y, x+color_img->width, y+color_img->height, FILL);
|
||||
}
|
||||
|
||||
132
cde/programs/dticon/queryDialog.c
Normal file
132
cde/programs/dticon/queryDialog.c
Normal file
@@ -0,0 +1,132 @@
|
||||
/* $XConsortium: queryDialog.c /main/4 1995/11/02 14:06:32 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
/*******************************************************************************
|
||||
queryDialog.c
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/DialogS.h>
|
||||
#include <Xm/MenuShell.h>
|
||||
#include <Xm/MwmUtil.h>
|
||||
#include <Xm/MessageB.h>
|
||||
#include "main.h"
|
||||
#include "externals.h"
|
||||
|
||||
#define RES_CONVERT( res_name, res_value) \
|
||||
XtVaTypedArg, (res_name), XmRString, (res_value), strlen(res_value) + 1
|
||||
|
||||
/*******************************************************************************
|
||||
Includes, Defines, and Global variables from the Declarations Editor:
|
||||
*******************************************************************************/
|
||||
|
||||
Widget queryDialog;
|
||||
|
||||
/*******************************************************************************
|
||||
Forward declarations of functions that are defined later in this file.
|
||||
*******************************************************************************/
|
||||
|
||||
Widget create_queryDialog();
|
||||
|
||||
/*******************************************************************************
|
||||
The following are callback functions.
|
||||
*******************************************************************************/
|
||||
|
||||
static void
|
||||
okCallback_queryDialog(
|
||||
Widget w,
|
||||
XtPointer clientData,
|
||||
XtPointer callbackArg )
|
||||
{
|
||||
Process_Query_OK();
|
||||
}
|
||||
|
||||
static void
|
||||
cancelCB_queryDialog(
|
||||
Widget w,
|
||||
XtPointer clientData,
|
||||
XtPointer callbackArg )
|
||||
{
|
||||
Process_Query_Cancel();
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
The 'build_' function creates all the widgets
|
||||
using the resource values specified in the Property Editor.
|
||||
*******************************************************************************/
|
||||
|
||||
static Widget
|
||||
build_queryDialog( void )
|
||||
{
|
||||
Widget queryDialog_shell;
|
||||
XmString tmpXmStr, tmpXmStr2, tmpXmStr3, tmpXmStr4, tmpXmStr5;
|
||||
Arg args[10];
|
||||
int n;
|
||||
|
||||
|
||||
queryDialog_shell = XtVaCreatePopupShell( "queryDialog_shell",
|
||||
xmDialogShellWidgetClass, mainWindow,
|
||||
XmNtitle, GETSTR(6,2, "Icon Editor - Warning"),
|
||||
NULL );
|
||||
|
||||
tmpXmStr = GETXMSTR(6,2, "Icon Editor - Warning");
|
||||
tmpXmStr2= GETXMSTR(6,6, "OK");
|
||||
tmpXmStr3= GETXMSTR(6,8, "Do ya really wanna?");
|
||||
tmpXmStr4= GETXMSTR(6,10, "Cancel");
|
||||
tmpXmStr5= GETXMSTR(4,10, "Help");
|
||||
queryDialog = XtVaCreateWidget( "queryDialog",
|
||||
xmMessageBoxWidgetClass, queryDialog_shell,
|
||||
XmNdefaultButtonType, XmDIALOG_CANCEL_BUTTON,
|
||||
XmNdialogTitle, tmpXmStr,
|
||||
XmNokLabelString, tmpXmStr2,
|
||||
XmNmessageString, tmpXmStr3,
|
||||
XmNcancelLabelString, tmpXmStr4,
|
||||
XmNhelpLabelString, tmpXmStr5,
|
||||
XmNdialogType, XmDIALOG_WARNING,
|
||||
NULL );
|
||||
XmStringFree(tmpXmStr);
|
||||
XmStringFree(tmpXmStr2);
|
||||
XmStringFree(tmpXmStr3);
|
||||
XmStringFree(tmpXmStr4);
|
||||
XmStringFree(tmpXmStr5);
|
||||
|
||||
XtAddCallback( queryDialog, XmNokCallback, okCallback_queryDialog, NULL);
|
||||
XtAddCallback( queryDialog, XmNcancelCallback, cancelCB_queryDialog, NULL);
|
||||
|
||||
n = 0;
|
||||
XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
|
||||
XtSetArg (args[n], XmNmwmInputMode,MWM_INPUT_PRIMARY_APPLICATION_MODAL);n++;
|
||||
XtSetValues (queryDialog_shell, args, n);
|
||||
|
||||
|
||||
return ( queryDialog );
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
The following is the 'Interface function' which is the
|
||||
external entry point for creating this interface.
|
||||
This function should be called from your application or from
|
||||
a callback function.
|
||||
*******************************************************************************/
|
||||
|
||||
Widget
|
||||
create_queryDialog( void )
|
||||
{
|
||||
Widget rtrn;
|
||||
|
||||
rtrn = build_queryDialog();
|
||||
|
||||
return(rtrn);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
END OF FILE
|
||||
*******************************************************************************/
|
||||
|
||||
120
cde/programs/dticon/stdErrDialog.c
Normal file
120
cde/programs/dticon/stdErrDialog.c
Normal file
@@ -0,0 +1,120 @@
|
||||
/* $XConsortium: stdErrDialog.c /main/4 1995/11/02 14:06:41 rswiston $ */
|
||||
/*********************************************************************
|
||||
* (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
* (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
* (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
* Novell, Inc.
|
||||
**********************************************************************/
|
||||
/*******************************************************************************
|
||||
stdErrDialog.c
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <Xm/Xm.h>
|
||||
#include <Xm/DialogS.h>
|
||||
#include <Xm/MenuShell.h>
|
||||
#include <Xm/MwmUtil.h>
|
||||
#include "main.h"
|
||||
#include "externals.h"
|
||||
|
||||
#include <Xm/MessageB.h>
|
||||
|
||||
/*******************************************************************************
|
||||
Includes, Defines, and Global variables from the Declarations Editor:
|
||||
*******************************************************************************/
|
||||
|
||||
Widget stdErrDialog;
|
||||
|
||||
/*******************************************************************************
|
||||
Forward declarations of functions that are defined later in this file.
|
||||
*******************************************************************************/
|
||||
|
||||
Widget create_stdErrDialog();
|
||||
|
||||
/*******************************************************************************
|
||||
The following are callback functions.
|
||||
*******************************************************************************/
|
||||
|
||||
static void
|
||||
okCallback_stdErrDialog(
|
||||
Widget w,
|
||||
XtPointer clientData,
|
||||
XtPointer callbackArg )
|
||||
{
|
||||
Process_StdErr_OK();
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
The 'build_' function creates all the widgets
|
||||
using the resource values specified in the Property Editor.
|
||||
*******************************************************************************/
|
||||
|
||||
static Widget
|
||||
build_stdErrDialog( void )
|
||||
{
|
||||
Widget stdErrDialog_shell;
|
||||
XmString tmpXmStr, tmpXmStr2;
|
||||
Arg args[10];
|
||||
int n;
|
||||
|
||||
|
||||
stdErrDialog_shell = XtVaCreatePopupShell( "stdErrDialog_shell",
|
||||
xmDialogShellWidgetClass, mainWindow,
|
||||
XmNtitle, GETSTR(8,2, "Icon Editor - Error"),
|
||||
NULL );
|
||||
|
||||
tmpXmStr = GETXMSTR(8,4, "Continue");
|
||||
tmpXmStr2= GETXMSTR(8,2, "Icon Editor - Error");
|
||||
stdErrDialog = XtVaCreateWidget( "stdErrDialog",
|
||||
xmMessageBoxWidgetClass, stdErrDialog_shell,
|
||||
XmNokLabelString, tmpXmStr,
|
||||
XmNdialogTitle, tmpXmStr2,
|
||||
XmNdialogType, XmDIALOG_ERROR,
|
||||
NULL );
|
||||
XmStringFree(tmpXmStr);
|
||||
XmStringFree(tmpXmStr2);
|
||||
|
||||
XtAddCallback( stdErrDialog, XmNokCallback, okCallback_stdErrDialog, NULL);
|
||||
|
||||
n = 0;
|
||||
XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
|
||||
XtSetArg (args[n], XmNmwmInputMode,MWM_INPUT_PRIMARY_APPLICATION_MODAL);n++;
|
||||
XtSetValues (stdErrDialog_shell, args, n);
|
||||
|
||||
return ( stdErrDialog );
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
The following is the 'Interface function' which is the
|
||||
external entry point for creating this interface.
|
||||
This function should be called from your application or from
|
||||
a callback function.
|
||||
*******************************************************************************/
|
||||
|
||||
Widget
|
||||
create_stdErrDialog( void )
|
||||
{
|
||||
Widget rtrn;
|
||||
|
||||
rtrn = build_stdErrDialog();
|
||||
|
||||
{
|
||||
Widget w0, w1, w2;
|
||||
Arg arg[10];
|
||||
int i;
|
||||
w0 = rtrn;
|
||||
w1 = XmMessageBoxGetChild(w0, XmDIALOG_CANCEL_BUTTON);
|
||||
w2 = XmMessageBoxGetChild(w0, XmDIALOG_HELP_BUTTON);
|
||||
XtUnmanageChild(w1);
|
||||
XtUnmanageChild(w2);
|
||||
}
|
||||
return(rtrn);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
END OF FILE
|
||||
*******************************************************************************/
|
||||
|
||||
2500
cde/programs/dticon/utils.c
Normal file
2500
cde/programs/dticon/utils.c
Normal file
File diff suppressed because it is too large
Load Diff
15
cde/programs/dticon/version.c
Normal file
15
cde/programs/dticon/version.c
Normal file
@@ -0,0 +1,15 @@
|
||||
/* $XConsortium: version.c /main/5 1996/08/30 15:32:43 drk $
|
||||
*
|
||||
* (c) Copyright 1996 Digital Equipment Corporation.
|
||||
* (c) Copyright 1993,1994,1996 Hewlett-Packard Company.
|
||||
* (c) Copyright 1993,1994,1996 International Business Machines Corp.
|
||||
* (c) Copyright 1993,1994,1996 Sun Microsystems, Inc.
|
||||
* (c) Copyright 1993,1994,1996 Novell, Inc.
|
||||
* (c) Copyright 1996 FUJITSU LIMITED.
|
||||
* (c) Copyright 1996 Hitachi.
|
||||
*/
|
||||
#include <include/hpversion.h>
|
||||
|
||||
#ifndef lint
|
||||
version_tag("dticon: $XConsortium: version.c /main/5 1996/08/30 15:32:43 drk $")
|
||||
#endif /* lint */
|
||||
Reference in New Issue
Block a user