ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/crossedit/crossedit.c
Revision: 1.1.1.1 (vendor branch)
Committed: Fri Feb 3 07:11:44 2006 UTC (18 years, 3 months ago) by root
Content type: text/plain
Branch: UPSTREAM
CVS Tags: UPSTREAM_2006_03_15, LAST_C_VERSION, UPSTREAM_2006_02_22, difficulty_fix_merge_060810_2300, UPSTREAM_2006_02_03
Branch point for: difficulty_fix
Changes since 1.1: +0 -0 lines
Log Message:
initial import

File Contents

# User Rev Content
1 root 1.1 /*
2     Copyright (C) 1993 Jarkko Sonninen & Petri Heinila
3    
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8    
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12     GNU General Public License for more details.
13    
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17    
18     The authors can be reached via e-mail to Jarkko.Sonninen@lut.fi
19     or Petri.Heinila@lut.fi .
20     */
21    
22     #include <Posix.h>
23     #include "App.h"
24     #include "X11.h"
25     #include "debug.h"
26    
27     /**********************************************************************
28     * application resources
29     **********************************************************************/
30    
31     #define Offset(field) XtOffsetOf(AppRes, field)
32     static XtResource resources[] = {
33     {"mapWidth", "MapWidth", XtRDimension, sizeof (Dimension),
34     Offset (mapWidth), XtRDimension, NULL},
35     {"mapHeight", "MapHeight", XtRDimension, sizeof (Dimension),
36     Offset (mapHeight), XtRDimension, NULL},
37     {"usePixmaps", "UsePixmaps", XtRBoolean, sizeof (XtRBoolean),
38     Offset (usePixmaps), XtRImmediate, False},
39     {"useColorPixmaps", "UseColorPixmaps", XtRBoolean, sizeof (XtRBoolean),
40     Offset (useColorPixmaps), XtRImmediate, False},
41     {"usePng", "UsePng", XtRBoolean, sizeof (XtRBoolean),
42     Offset (usePng), XtRImmediate, False},
43     {"cmdCrossfire", "CmdCrossfire", XtRString, sizeof (XtRString),
44     Offset (cmdCrossfire), XtRString, NULL},
45     {"cmdReset", "CmdReset", XtRString, sizeof (XtRString),
46     Offset (cmdReset), XtRString, NULL},
47     {"creator", "Creator", XtRString, sizeof (XtRString),
48     Offset (creator), XtRString, "No Body"},
49     {"email", "Email", XtRString, sizeof (XtRString),
50     Offset (email), XtRString, "none@foo.bar"},
51     };
52     #undef Offset
53    
54     static XrmOptionDescRec options[] = {
55     {"-pix","*usePixmaps",XrmoptionNoArg,"TRUE"},
56     {"-xpm","*useColorPixmaps",XrmoptionNoArg,"TRUE"},
57     {"-png","*usePng",XrmoptionNoArg,"TRUE"},
58    
59     };
60    
61     String fallback_resources[] = {
62     #include <Crossedit.ad.h>
63     NULL
64     };
65    
66     enum DisplayMode displaymode=Dm_Png;
67    
68     void EditDirtyAc(Widget w, XEvent * event, String * argv, Cardinal * argc) {
69     debug0 ("EditDirtyAc\n");
70     }
71    
72     void Nop(Widget w, XEvent * event, String * argv, Cardinal * argc) {}
73     XtActionsRec mainActions[] = {
74     {"Nop", Nop},
75     {"EditKey", EditDirtyAc},
76     };
77    
78     /**********************************************************************
79     * main
80     **********************************************************************/
81    
82     int main (int argc, char **argv, char **env)
83     {
84     XtAppContext app_con;
85    
86     App app;
87    
88     /* Crossedit seems to have so many memory problems, this seems like
89     * a really good idea.
90     */
91     #ifdef DEBUG_MALLOC_LEVEL
92     malloc_debug(DEBUG_MALLOC_LEVEL);
93     #endif
94    
95    
96     /* crossfire init */
97     init_globals();
98     init_library ();
99     init_regions();
100     init_archetypes ();
101     editor = TRUE;
102     #if 0
103     /* Enable this if you want people to be able to edit maps
104     * in a different directory other than the master map
105     * directory. Note that the 'editor' directory of maps
106     * needs to be in LIBDIR/maps (LIBDIR/maps being where
107     * the maps will be saved.
108     *
109     * An alternative method would be to have a link to a high
110     * level directory from the master map source (ie, something
111     * like 'ln -s /users .LIBDIR. Then users can select the users
112     * directory in the map editor, which will take them to the
113     * directory above their home directory, select their home directory,
114     * and then whatever directory they want to save the maps in.
115     */
116     if (getenv("LIBDIR")) LibDir = getenv("LIBDIR");
117     #endif
118    
119     /*XtAppInitialize (&app_con, "Crossedit", NULL, 0, &argc, argv,
120     fallback_resources, NULL, 0);*/
121    
122     XtToolkitInitialize ();
123     app_con = XtCreateApplicationContext();
124     #if 1
125     XtAppSetFallbackResources (app_con, fallback_resources);
126     #endif
127     XtAppAddActions(app_con,mainActions, XtNumber (mainActions));
128    
129     /*XtGetApplicationResources (app.shell, (XtPointer) & app->res,
130     resources, XtNumber (resources), NULL, 0);*/
131    
132     app = AppCreate(app_con, "Crossedit", resources, XtNumber (resources),
133     options,XtNumber(options), &argc, argv);
134    
135    
136     /*** usage ***/
137     if (argc > 1) {
138     fprintf(stderr,"Usage: crossedit [-options]\n\t[-options]:\tXt-options\n\n");
139     exit(2);
140     }
141    
142     XtRealizeWidget (app->shell);
143     XtAppMainLoop (app_con);
144     exit(0);
145     }
146    
147     /*** End of crossfire.c ***/