3 * Micropolis, Unix Version. This game was released for the Unix platform
4 * in or about 1990 and has been modified for inclusion in the One Laptop
5 * Per Child program. Copyright (C) 1989 - 2007 Electronic Arts Inc. If
6 * you need assistance with this program, you may contact:
7 * http://wiki.laptop.org/go/Micropolis or email micropolis@laptop.org.
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or (at
12 * your option) any later version.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details. You should have received a
18 * copy of the GNU General Public License along with this program. If
19 * not, see <http://www.gnu.org/licenses/>.
21 * ADDITIONAL TERMS per GNU GPL Section 7
23 * No trademark or publicity rights are granted. This license does NOT
24 * give you any right, title or interest in the trademark SimCity or any
25 * other Electronic Arts trademark. You may not distribute any
26 * modification of this program using the trademark SimCity or claim any
27 * affliation or association with Electronic Arts Inc. or its employees.
29 * Any propagation or conveyance of this program must include this
30 * copyright notice and these terms.
32 * If you convey this program (or any modifications of it) and assume
33 * contractual liability for the program to recipients of it, you agree
34 * to indemnify Electronic Arts for any liability that those contractual
35 * assumptions impose on Electronic Arts.
37 * You may not misrepresent the origins of this program; modified
38 * versions of the program must be marked as such and not identified as
39 * the original program.
41 * This disclaimer supplements the one included in the General Public
42 * License. TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, THIS
43 * PROGRAM IS PROVIDED TO YOU "AS IS," WITH ALL FAULTS, WITHOUT WARRANTY
44 * OF ANY KIND, AND YOUR USE IS AT YOUR SOLE RISK. THE ENTIRE RISK OF
45 * SATISFACTORY QUALITY AND PERFORMANCE RESIDES WITH YOU. ELECTRONIC ARTS
46 * DISCLAIMS ANY AND ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES,
47 * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY,
48 * FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT OF THIRD PARTY
49 * RIGHTS, AND WARRANTIES (IF ANY) ARISING FROM A COURSE OF DEALING,
50 * USAGE, OR TRADE PRACTICE. ELECTRONIC ARTS DOES NOT WARRANT AGAINST
51 * INTERFERENCE WITH YOUR ENJOYMENT OF THE PROGRAM; THAT THE PROGRAM WILL
52 * MEET YOUR REQUIREMENTS; THAT OPERATION OF THE PROGRAM WILL BE
53 * UNINTERRUPTED OR ERROR-FREE, OR THAT THE PROGRAM WILL BE COMPATIBLE
54 * WITH THIRD PARTY SOFTWARE OR THAT ANY ERRORS IN THE PROGRAM WILL BE
55 * CORRECTED. NO ORAL OR WRITTEN ADVICE PROVIDED BY ELECTRONIC ARTS OR
56 * ANY AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY. SOME
57 * JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF OR LIMITATIONS ON IMPLIED
58 * WARRANTIES OR THE LIMITATIONS ON THE APPLICABLE STATUTORY RIGHTS OF A
59 * CONSUMER, SO SOME OR ALL OF THE ABOVE EXCLUSIONS AND LIMITATIONS MAY
65 Tcl_HashTable EditorCmds
;
70 extern Tk_ConfigSpec TileViewConfigSpecs
[];
72 void ClipTheOverlay(SimView
*view
);
73 void DrawTheOverlay(SimView
*view
, GC gc
, Pixmap pm
, int color
,
74 int top
, int bottom
, int left
, int right
,
76 void DrawOverlay(SimView
*view
);
77 void DrawCursor(SimView
*view
);
78 void DrawPending(SimView
*view
);
79 void DrawOutside(SimView
*view
);
80 void HandleAutoGoto(SimView
*view
);
83 int EditorCmdconfigure(VIEW_ARGS
)
88 result
= Tk_ConfigureInfo(interp
, view
->tkwin
, TileViewConfigSpecs
,
89 (char *) view
, (char *) NULL
, 0);
90 } else if (argc
== 3) {
91 result
= Tk_ConfigureInfo(interp
, view
->tkwin
, TileViewConfigSpecs
,
92 (char *) view
, argv
[2], 0);
94 result
= ConfigureTileView(interp
, view
, argc
-2, argv
+2,
101 int EditorCmdposition(VIEW_ARGS
)
103 if ((argc
!= 2) && (argc
!= 4)) {
107 if ((Tcl_GetInt(interp
, argv
[2], &view
->w_x
) != TCL_OK
) ||
108 (Tcl_GetInt(interp
, argv
[3], &view
->w_y
) != TCL_OK
)) {
112 sprintf(interp
->result
, "%d %d", view
->w_x
, view
->w_y
);
117 int EditorCmdsize(VIEW_ARGS
)
119 if ((argc
!= 2) && (argc
!= 4)) {
125 if (Tcl_GetInt(interp
, argv
[2], &w
) != TCL_OK
) {
128 if (Tcl_GetInt(interp
, argv
[3], &h
) != TCL_OK
) {
134 sprintf(interp
->result
, "%d %d", view
->w_width
, view
->w_height
);
139 int EditorCmdAutoGoto(VIEW_ARGS
)
141 if ((argc
!= 2) && (argc
!= 3)) {
147 if (Tcl_GetInt(interp
, argv
[2], &val
) != TCL_OK
) {
150 view
->auto_goto
= val
;
151 view
->auto_going
= view
->auto_x_goal
= view
->auto_y_goal
= 0;
153 sprintf(interp
->result
, "%d", view
->auto_goto
);
158 int EditorCmdSound(VIEW_ARGS
)
160 if ((argc
!= 2) && (argc
!= 3)) {
166 if (Tcl_GetInt(interp
, argv
[2], &val
) != TCL_OK
) {
170 view
->auto_going
= view
->auto_x_goal
= view
->auto_y_goal
= 0;
172 sprintf(interp
->result
, "%d", view
->sound
);
177 int EditorCmdSkip(VIEW_ARGS
)
179 if ((argc
!= 2) && (argc
!= 3)) {
185 if (Tcl_GetInt(interp
, argv
[2], &val
) != TCL_OK
) {
188 view
->skip
= view
->skips
= val
; // XXX? why setting skips too?
190 sprintf(interp
->result
, "%d", view
->skips
);
195 int EditorCmdUpdate(VIEW_ARGS
)
205 int EditorCmdPan(VIEW_ARGS
)
207 if ((argc
!= 2) && (argc
!= 4)) {
213 if (Tcl_GetInt(interp
, argv
[2], &x
) != TCL_OK
) {
216 if (Tcl_GetInt(interp
, argv
[3], &y
) != TCL_OK
) {
219 DoPanTo(view
, x
, y
); Kick();
221 sprintf(interp
->result
, "%d %d", view
->pan_x
, view
->pan_y
);
226 int EditorCmdToolConstrain(VIEW_ARGS
)
228 int x
= -1, y
= -1, tx
, ty
;
234 if (Tcl_GetInt(interp
, argv
[2], &x
) != TCL_OK
) {
237 if (Tcl_GetInt(interp
, argv
[3], &y
) != TCL_OK
) {
240 view
->tool_x_const
= -1; view
->tool_y_const
= -1;
241 ViewToTileCoords(view
, x
, y
, &tx
, &ty
);
242 view
->tool_x_const
= (x
== -1) ? -1 : tx
;
243 view
->tool_y_const
= (y
== -1) ? -1 : ty
;
248 int EditorCmdToolState(VIEW_ARGS
)
250 if ((argc
!= 2) && (argc
!= 3)) {
256 if (Tcl_GetInt(interp
, argv
[2], &state
) != TCL_OK
) {
259 setWandState(view
, state
);
261 sprintf(interp
->result
, "%d", view
->tool_state
);
266 int EditorCmdToolMode(VIEW_ARGS
)
268 if ((argc
!= 2) && (argc
!= 3)) {
274 if (Tcl_GetInt(interp
, argv
[2], &mode
) != TCL_OK
) {
277 view
->tool_mode
= mode
;
279 sprintf(interp
->result
, "%d", view
->tool_mode
);
284 int EditorCmdDoTool(VIEW_ARGS
)
292 if ((Tcl_GetInt(interp
, argv
[2], &tool
) != TCL_OK
) ||
294 (tool
> lastState
) ||
295 (Tcl_GetInt(interp
, argv
[3], &x
) != TCL_OK
) ||
296 (Tcl_GetInt(interp
, argv
[4], &y
) != TCL_OK
)) {
300 DoTool(view
, tool
, x
, y
); Kick();
305 int EditorCmdToolDown(VIEW_ARGS
)
313 if ((Tcl_GetInt(interp
, argv
[2], &x
) != TCL_OK
) ||
314 (Tcl_GetInt(interp
, argv
[3], &y
) != TCL_OK
)) {
318 ToolDown(view
, x
, y
); Kick();
323 int EditorCmdToolDrag(VIEW_ARGS
)
331 if ((Tcl_GetInt(interp
, argv
[2], &x
) != TCL_OK
) ||
332 (Tcl_GetInt(interp
, argv
[3], &y
) != TCL_OK
)) {
336 ToolDrag(view
, x
, y
); Kick();
341 int EditorCmdToolUp(VIEW_ARGS
)
349 if ((Tcl_GetInt(interp
, argv
[2], &x
) != TCL_OK
) ||
350 (Tcl_GetInt(interp
, argv
[3], &y
) != TCL_OK
)) {
354 ToolUp(view
, x
, y
); Kick();
359 int EditorCmdPanStart(VIEW_ARGS
)
367 if ((Tcl_GetInt(interp
, argv
[2], &x
) != TCL_OK
) ||
368 (Tcl_GetInt(interp
, argv
[3], &y
) != TCL_OK
)) {
378 int EditorCmdPanTo(VIEW_ARGS
)
386 if ((Tcl_GetInt(interp
, argv
[2], &x
) != TCL_OK
) ||
387 (Tcl_GetInt(interp
, argv
[3], &y
) != TCL_OK
)) {
391 dx
= (view
->tool_x_const
== -1) ? (view
->last_x
- x
) : 0;
392 dy
= (view
->tool_y_const
== -1) ? (view
->last_y
- y
) : 0;
396 DoPanBy(view
, dx
, dy
); Kick();
402 int EditorCmdPanBy(VIEW_ARGS
)
410 if ((Tcl_GetInt(interp
, argv
[2], &dx
) != TCL_OK
) ||
411 (Tcl_GetInt(interp
, argv
[3], &dy
) != TCL_OK
)) {
415 DoPanBy(view
, dx
, dy
); Kick();
420 int EditorCmdTweakCursor(VIEW_ARGS
)
422 XWarpPointer (view
->x
->dpy
, None
, None
, 0, 0, 0, 0, 0, 0);
428 int EditorCmdVisible(VIEW_ARGS
)
432 if ((argc
!= 2) && (argc
!= 3)) {
437 if ((Tcl_GetInt(interp
, argv
[2], &visible
) != TCL_OK
) ||
438 (visible
< 0) || (visible
> 1)) {
442 visible
= visible
&& Tk_IsMapped(view
->tkwin
);
443 view
->visible
= visible
;
446 sprintf(interp
->result
, "%d", view
->visible
);
451 int EditorCmdKeyDown(VIEW_ARGS
)
458 doKeyDown(view
, argv
[2][0]);
463 int EditorCmdKeyUp(VIEW_ARGS
)
470 doKeyUp(view
, argv
[2][0]);
475 int EditorCmdTileCoord(VIEW_ARGS
)
479 if ((argc
!= 2) && (argc
!= 4)) {
483 if (Tcl_GetInt(interp
, argv
[2], &x
) != TCL_OK
) {
486 if (Tcl_GetInt(interp
, argv
[3], &y
) != TCL_OK
) {
490 ViewToTileCoords(view
, x
, y
, &x
, &y
);
492 sprintf(interp
->result
, "%d %d", x
, y
);
497 int EditorCmdChalkStart(VIEW_ARGS
)
505 if ((Tcl_GetInt(interp
, argv
[2], &x
) != TCL_OK
) ||
506 (Tcl_GetInt(interp
, argv
[3], &y
) != TCL_OK
)) {
510 ChalkStart(view
, x
, y
, COLOR_WHITE
);
515 int EditorCmdChalkTo(VIEW_ARGS
)
523 if ((Tcl_GetInt(interp
, argv
[2], &x
) != TCL_OK
) ||
524 (Tcl_GetInt(interp
, argv
[3], &y
) != TCL_OK
)) {
533 int EditorCmdAutoGoing(VIEW_ARGS
)
537 if ((argc
!= 2) && (argc
!= 3)) {
542 if ((Tcl_GetInt(interp
, argv
[2], &flag
) != TCL_OK
)) {
546 view
->auto_going
= flag
;
547 if (view
->auto_goto
== -1)
551 sprintf(interp
->result
, "%d", view
->auto_going
);
556 int EditorCmdAutoSpeed(VIEW_ARGS
)
560 if ((argc
!= 2) && (argc
!= 3)) {
565 if ((Tcl_GetInt(interp
, argv
[2], &speed
) != TCL_OK
) ||
570 view
->auto_speed
= speed
;
573 sprintf(interp
->result
, "%d", view
->auto_speed
);
578 int EditorCmdAutoGoal(VIEW_ARGS
)
580 if ((argc
!= 2) && (argc
!= 4)) {
586 if (Tcl_GetInt(interp
, argv
[2], &x
) != TCL_OK
) {
589 if (Tcl_GetInt(interp
, argv
[3], &y
) != TCL_OK
) {
592 view
->auto_x_goal
= x
;
593 view
->auto_y_goal
= y
;
594 /* actually go there if more than a block away */
595 dx
= view
->pan_x
- x
;
596 dy
= view
->pan_y
- y
;
597 view
->auto_going
= (((dx
* dx
) + (dy
* dy
)) > (64 * 64));
598 if ((view
->auto_going
!= 0) &&
599 (view
->auto_goto
== 0))
600 view
->auto_goto
= -1;
603 sprintf(interp
->result
, "%d %d", view
->auto_x_goal
, view
->auto_y_goal
);
608 int EditorCmdSU(VIEW_ARGS
)
612 if ((argc
!= 2) && (argc
!= 4)) {
617 if ((strcmp(argv
[3], "xyzzy") != 0) ||
618 (Tcl_GetInt(interp
, argv
[2], &su
) != TCL_OK
)) {
622 view
->super_user
= su
;
625 sprintf(interp
->result
, "%d", view
->super_user
);
630 int EditorCmdShowMe(VIEW_ARGS
)
634 if ((argc
!= 2) && (argc
!= 3)) {
639 if (Tcl_GetInt(interp
, argv
[2], &flag
) != TCL_OK
) {
643 view
->show_me
= flag
;
646 sprintf(interp
->result
, "%d", view
->show_me
);
651 int EditorCmdFollow(VIEW_ARGS
)
655 if ((argc
!= 2) && (argc
!= 3)) {
661 if (argv
[2][0] != '\0') {
662 for (sprite
= sim
->sprite
; sprite
!= NULL
; sprite
= sprite
->next
) {
663 if (strcmp(sprite
->name
, argv
[2]) == 0) {
664 view
->follow
= sprite
;
670 if (view
->follow
!= NULL
) {
671 HandleAutoGoto(view
);
675 sprintf(interp
->result
, "%s",
676 (view
->follow
== NULL
) ? "" : view
->follow
->name
);
681 int EditorCmdShowOverlay(VIEW_ARGS
)
685 if ((argc
!= 2) && (argc
!= 3)) {
690 if ((Tcl_GetInt(interp
, argv
[2], &flag
) != TCL_OK
)) {
694 view
->show_overlay
= flag
;
697 sprintf(interp
->result
, "%d", view
->show_overlay
);
702 int EditorCmdOverlayMode(VIEW_ARGS
)
706 if ((argc
!= 2) && (argc
!= 3)) {
711 if ((Tcl_GetInt(interp
, argv
[2], &flag
) != TCL_OK
)) {
715 view
->overlay_mode
= flag
;
718 sprintf(interp
->result
, "%d", view
->overlay_mode
);
723 int EditorCmdDynamicFilter(VIEW_ARGS
)
727 if ((argc
!= 2) && (argc
!= 3)) {
732 if ((Tcl_GetInt(interp
, argv
[2], &val
) != TCL_OK
)) {
736 view
->dynamic_filter
= val
;
739 sprintf(interp
->result
, "%d", view
->dynamic_filter
);
744 int EditorCmdWriteJpeg(VIEW_ARGS
)
748 char *fileName
= argv
[2];
755 // Write a jpeg file of this view.
762 editor_command_init(void)
764 extern int TileViewCmd(CLIENT_ARGS
);
766 Tcl_CreateCommand(tk_mainInterp
, "editorview", TileViewCmd
,
767 (ClientData
)MainWindow
, (void (*)()) NULL
);
769 Tcl_InitHashTable(&EditorCmds
, TCL_STRING_KEYS
);
771 #define EDITOR_CMD(name) HASHED_CMD(Editor, name)
773 EDITOR_CMD(configure
);
774 EDITOR_CMD(position
);
776 EDITOR_CMD(AutoGoto
);
781 EDITOR_CMD(ToolConstrain
);
782 EDITOR_CMD(ToolState
);
783 EDITOR_CMD(ToolMode
);
785 EDITOR_CMD(ToolDown
);
786 EDITOR_CMD(ToolDrag
);
788 EDITOR_CMD(PanStart
);
791 EDITOR_CMD(TweakCursor
);
795 EDITOR_CMD(TileCoord
);
796 EDITOR_CMD(ChalkStart
);
798 EDITOR_CMD(AutoGoing
);
799 EDITOR_CMD(AutoSpeed
);
800 EDITOR_CMD(AutoGoal
);
804 EDITOR_CMD(ShowOverlay
);
805 EDITOR_CMD(OverlayMode
);
806 EDITOR_CMD(DynamicFilter
);
811 DoEditorCmd(CLIENT_ARGS
)
813 SimView
*view
= (SimView
*) clientData
;
822 if ((ent
= Tcl_FindHashEntry(&EditorCmds
, argv
[1]))) {
823 cmd
= (int (*)())ent
->clientData
;
824 Tk_Preserve((ClientData
) view
);
825 result
= cmd(view
, interp
, argc
, argv
);
826 Tk_Release((ClientData
) view
);
828 Tcl_AppendResult(interp
, "unknown command name: \"",
829 argv
[0], " ", argv
[1], "\".", (char *) NULL
);
837 /*************************************************************************/
841 DoNewEditor(SimView
*view
)
843 sim
->editors
++; view
->next
= sim
->editor
; sim
->editor
= view
;
849 DoUpdateEditor(SimView
*view
)
855 if (!view
->visible
) {
860 // (!view->invalid) &&
869 if (view
->skip
> 0) {
873 view
->skip
= view
->skips
;
881 HandleAutoGoto(view
);
883 if (DoAnimation
&& SimSpeed
&& !heat_steps
&& !TilesAnimated
) {
890 switch (view
->type
) {
893 MemDrawBeegMapRect(view
, view
->tile_x
, view
->tile_y
,
894 view
->tile_width
, view
->tile_height
);
898 WireDrawBeegMapRect(view
, view
->tile_x
, view
->tile_y
,
899 view
->tile_width
, view
->tile_height
);
904 XCopyArea(view
->x
->dpy
, view
->pixmap
, view
->pixmap2
, view
->x
->gc
,
905 0, 0, view
->screen_width
, view
->screen_height
,
906 view
->screen_x
, view
->screen_y
);
908 if (PendingTool
!= -1) {
912 if (view
->show_overlay
) {
917 for (dx
= dy
= i
= 0; i
< ShakeNow
; i
++) {
922 XCopyArea(view
->x
->dpy
, view
->pixmap2
,
923 Tk_WindowId(view
->tkwin
), view
->x
->gc
,
924 0, 0, view
->w_width
, view
->w_height
, dx
, dy
);
933 HandleAutoGoto(SimView
*view
)
935 if (view
->follow
!= NULL
) {
936 int x
= view
->follow
->x
+ view
->follow
->x_hot
,
937 y
= view
->follow
->y
+ view
->follow
->y_hot
;
939 if ((x
!= view
->pan_x
) ||
940 (y
!= view
->pan_y
)) {
943 } else if (view
->auto_goto
&&
945 (view
->tool_mode
== 0)) {
950 speed
= view
->auto_speed
;
952 if (view
->auto_going
< 5) {
953 sloth
= ((double)view
->auto_going
) / 5.0;
958 dx
= view
->auto_x_goal
- view
->pan_x
;
959 dy
= view
->auto_y_goal
- view
->pan_y
;
961 dist
= sqrt((double)((dx
* dx
) + (dy
* dy
)));
963 if (dist
< (speed
* sloth
)) {
964 view
->auto_going
= 0;
965 if (view
->auto_goto
== -1)
967 DoPanTo(view
, view
->auto_x_goal
, view
->auto_y_goal
);
971 double atan2(), cos(), sin();
972 double direction
, vx
, vy
;
975 direction
= (double)atan2((double)dy
, (double)dx
);
976 co
= (double)cos(direction
);
977 si
= (double)sin(direction
);
978 vx
= co
* (double)speed
;
979 vy
= si
* (double)speed
;
981 vx
*= sloth
; vy
*= sloth
;
984 vx
+= 0.5; vy
+= 0.5;
986 DoPanBy(view
, (int)(vx
), (int)(vy
));
993 DrawOutside(SimView
*view
)
995 Pixmap pm
= view
->pixmap2
;
996 int left
= (view
->w_width
/ 2) - view
->pan_x
;
997 int right
= left
+ view
->i_width
;
998 int top
= (view
->w_height
/ 2) - view
->pan_y
;
999 int bottom
= top
+ view
->i_height
;
1001 if ((top
> 0) || (bottom
< view
->w_height
) ||
1002 (left
> 0) || (right
< view
->w_width
)) {
1003 if (view
->x
->color
) {
1004 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1005 view
->pixels
[COLOR_BLACK
]);
1007 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1008 view
->pixels
[COLOR_WHITE
]);
1012 XFillRectangle(view
->x
->dpy
, pm
, view
->x
->gc
,
1013 0, 0, view
->w_width
, top
);
1014 if (bottom
< view
->w_height
)
1015 XFillRectangle(view
->x
->dpy
, pm
, view
->x
->gc
,
1016 0, bottom
, view
->w_width
,
1017 view
->w_height
- bottom
);
1019 XFillRectangle(view
->x
->dpy
, pm
, view
->x
->gc
,
1020 0, top
, left
, bottom
- top
);
1021 if (right
< view
->w_width
)
1022 XFillRectangle(view
->x
->dpy
, pm
, view
->x
->gc
,
1023 right
, top
, view
->w_width
- right
, bottom
- top
);
1028 char CursorDashes
[] = { 4, 4 };
1031 DrawPending(SimView
*view
)
1033 Pixmap pm
= view
->pixmap2
;
1034 int left
= (view
->w_width
/ 2) - view
->pan_x
;
1035 int top
= (view
->w_height
/ 2) - view
->pan_y
;
1037 char *iconname
= NULL
;
1039 x
= (PendingX
- toolOffset
[PendingTool
]) <<4;
1040 y
= (PendingY
- toolOffset
[PendingTool
]) <<4;
1041 size
= toolSize
[PendingTool
] <<4;
1042 x
+= left
; y
+= top
;
1044 XSetStipple(view
->x
->dpy
, view
->x
->gc
, view
->x
->gray50_stipple
);
1045 XSetTSOrigin(view
->x
->dpy
, view
->x
->gc
, 0, 0);
1046 XSetForeground(view
->x
->dpy
, view
->x
->gc
, view
->x
->pixels
[COLOR_BLACK
]);
1047 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillStippled
);
1048 XFillRectangle(view
->x
->dpy
, pm
, view
->x
->gc
,
1050 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillSolid
);
1052 switch (PendingTool
) {
1053 case residentialState
:
1054 iconname
= "@images/res.xpm"; break;
1055 case commercialState
:
1056 iconname
= "@images/com.xpm"; break;
1057 case industrialState
:
1058 iconname
= "@images/ind.xpm"; break;
1060 iconname
= "@images/fire.xpm"; break;
1062 iconname
= "@images/police.xpm"; break;
1064 iconname
= "@images/stadium.xpm"; break;
1066 iconname
= "@images/seaport.xpm"; break;
1068 iconname
= "@images/coal.xpm"; break;
1070 iconname
= "@images/nuclear.xpm"; break;
1072 iconname
= "@images/airport.xpm"; break;
1077 if (iconname
!= NULL
) {
1078 Pixmap icon
= Tk_GetPixmap(view
->interp
, view
->tkwin
, iconname
);
1082 gettimeofday(&now_time
, NULL
);
1083 f
= (2 * now_time
.tv_usec
/ 1000000.0);
1084 if (f
> 1.0) f
= 2.0 - f
;
1085 i
= (int)(f
* BobHeight
* (Players
- Votes
));
1088 XCopyArea(view
->x
->dpy
, icon
, pm
, view
->x
->gc
,
1089 0, 0, size
, size
, x
+ i
, y
- i
);
1096 DrawCursor(SimView
*view
)
1098 Pixmap pm
= Tk_WindowId(view
->tkwin
);
1099 int left
= (view
->w_width
/ 2) - view
->pan_x
;
1100 int top
= (view
->w_height
/ 2) - view
->pan_y
;
1101 int x
, y
, mode
, size
, offset
, fg
, bg
, light
, dark
;
1104 for (v
= sim
->editor
; v
!= NULL
; v
= v
->next
) {
1105 mode
= v
->tool_mode
;
1106 if ((v
->show_me
!= 0) &&
1107 ((mode
== -1) || v
->tool_showing
)) {
1108 x
= v
->tool_x
; y
= v
->tool_y
;
1109 if (mode
== -1) { /* pan cursor */
1111 x
+= left
; y
+= top
;
1113 XSetLineAttributes(view
->x
->dpy
, view
->x
->gc
, 3,
1114 LineSolid
, CapRound
, JoinMiter
);
1115 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1116 view
->pixels
[COLOR_BLACK
]);
1117 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1118 x
- 6, y
- 6, x
+ 6, y
+ 6);
1119 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1120 x
- 6, y
+ 6, x
+ 6, y
- 6);
1121 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1122 x
- 8, y
, x
+ 8, y
);
1123 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1124 x
, y
+ 8, x
, y
- 8);
1125 XSetLineAttributes(view
->x
->dpy
, view
->x
->gc
, 1,
1126 LineSolid
, CapRound
, JoinMiter
);
1127 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1128 view
->pixels
[COLOR_WHITE
]);
1129 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1130 x
- 6, y
- 6, x
+ 6, y
+ 6);
1131 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1132 x
- 6, y
+ 6, x
+ 6, y
- 6);
1133 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1134 x
- 8, y
, x
+ 8, y
);
1135 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1136 x
, y
+ 8, x
, y
- 8);
1137 XSetLineAttributes(view
->x
->dpy
, view
->x
->gc
, 1,
1138 LineSolid
, CapButt
, JoinMiter
);
1140 } else { /* edit cursor */
1142 size
= toolSize
[v
->tool_state
];
1143 fg
= toolColors
[v
->tool_state
] & 0xff;
1144 light
= COLOR_WHITE
;
1151 switch (v
->tool_state
) {
1154 x
+= left
; y
+= top
;
1160 if (view
->x
->color
) {
1161 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1162 view
->pixels
[COLOR_MEDIUMGRAY
]);
1163 XFillArc(view
->x
->dpy
, pm
, view
->x
->gc
,
1164 x
- 8, y
+ 7, 7, 7, 0, 360 * 64);
1166 XSetStipple(view
->x
->dpy
, view
->x
->gc
,
1167 view
->x
->gray50_stipple
);
1168 XSetTSOrigin(view
->x
->dpy
, view
->x
->gc
, 0, 0);
1169 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1170 view
->x
->pixels
[COLOR_BLACK
]);
1171 XSetBackground(view
->x
->dpy
, view
->x
->gc
,
1172 view
->x
->pixels
[COLOR_WHITE
]);
1173 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillOpaqueStippled
);
1174 XFillArc(view
->x
->dpy
, pm
, view
->x
->gc
,
1175 x
- 8, y
+ 7, 7, 7, 0, 360 * 64);
1176 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillSolid
);
1180 if (view
->x
->color
) {
1181 XSetLineAttributes(view
->x
->dpy
, view
->x
->gc
, 3,
1182 LineSolid
, CapRound
, JoinMiter
);
1183 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1184 view
->pixels
[COLOR_LIGHTGRAY
]);
1185 XFillArc(view
->x
->dpy
, pm
, view
->x
->gc
,
1186 x
- 6 - offset
, y
+ 5 + offset
, 7, 7, 0, 360 * 64);
1187 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1188 x
+ 13 - offset
, y
- 5 + offset
,
1189 x
- 1 - offset
, y
+ 9 + offset
);
1190 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1191 view
->pixels
[COLOR_WHITE
]);
1192 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1193 x
+ 11 - offset
, y
- 7 + offset
,
1194 x
- 3 - offset
, y
+ 7 + offset
);
1195 XFillArc(view
->x
->dpy
, pm
, view
->x
->gc
,
1196 x
+ 8 - offset
, y
- 9 + offset
, 7, 7, 0, 360 * 64);
1197 XSetLineAttributes(view
->x
->dpy
, view
->x
->gc
, 1,
1198 LineSolid
, CapButt
, JoinMiter
);
1200 XSetLineAttributes(view
->x
->dpy
, view
->x
->gc
, 3,
1201 LineSolid
, CapRound
, JoinMiter
);
1202 XSetStipple(view
->x
->dpy
, view
->x
->gc
,
1203 view
->x
->gray25_stipple
);
1204 XSetTSOrigin(view
->x
->dpy
, view
->x
->gc
, 0, 0);
1205 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1206 view
->x
->pixels
[COLOR_BLACK
]);
1207 XSetBackground(view
->x
->dpy
, view
->x
->gc
,
1208 view
->x
->pixels
[COLOR_WHITE
]);
1209 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillOpaqueStippled
);
1210 XFillArc(view
->x
->dpy
, pm
, view
->x
->gc
,
1211 x
- 6 - offset
, y
+ 5 + offset
, 7, 7, 0, 360 * 64);
1212 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1213 x
+ 13 - offset
, y
- 5 + offset
,
1214 x
- 1 - offset
, y
+ 9 + offset
);
1215 XSetStipple(view
->x
->dpy
, view
->x
->gc
,
1216 view
->x
->gray75_stipple
);
1217 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1218 x
+ 11 - offset
, y
- 7 + offset
,
1219 x
- 3 - offset
, y
+ 7 + offset
);
1220 XFillArc(view
->x
->dpy
, pm
, view
->x
->gc
,
1221 x
+ 8 - offset
, y
- 9 + offset
, 7, 7, 0, 360 * 64);
1222 XSetLineAttributes(view
->x
->dpy
, view
->x
->gc
, 1,
1223 LineSolid
, CapButt
, JoinMiter
);
1224 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillSolid
);
1230 x
+= left
; y
+= top
;
1236 if (view
->x
->color
) {
1237 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1238 view
->pixels
[COLOR_MEDIUMGRAY
]);
1239 XFillRectangle(view
->x
->dpy
, pm
, view
->x
->gc
,
1240 x
- 8, y
- 8, 16, 16);
1242 XSetStipple(view
->x
->dpy
, view
->x
->gc
,
1243 view
->x
->gray50_stipple
);
1244 XSetTSOrigin(view
->x
->dpy
, view
->x
->gc
, 0, 0);
1245 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1246 view
->x
->pixels
[COLOR_BLACK
]);
1247 XSetBackground(view
->x
->dpy
, view
->x
->gc
,
1248 view
->x
->pixels
[COLOR_WHITE
]);
1249 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillOpaqueStippled
);
1250 XFillRectangle(view
->x
->dpy
, pm
, view
->x
->gc
,
1251 x
- 8, y
- 8, 16, 16);
1252 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillSolid
);
1256 if (view
->x
->color
) {
1257 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1258 view
->pixels
[COLOR_LIGHTGRAY
]);
1260 XSetStipple(view
->x
->dpy
, view
->x
->gc
,
1261 view
->x
->gray75_stipple
);
1262 XSetTSOrigin(view
->x
->dpy
, view
->x
->gc
, 0, 0);
1263 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1264 view
->x
->pixels
[COLOR_BLACK
]);
1265 XSetBackground(view
->x
->dpy
, view
->x
->gc
,
1266 view
->x
->pixels
[COLOR_WHITE
]);
1267 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillOpaqueStippled
);
1271 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1272 x
- 8 + offset
, y
- 8 - offset
,
1273 x
+ 8 + offset
, y
- 8 - offset
);
1274 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1275 x
- 7 + offset
, y
- 7 - offset
,
1276 x
+ 7 + offset
, y
- 7 - offset
);
1277 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1278 x
- 6 + offset
, y
- 6 - offset
,
1279 x
+ 6 + offset
, y
- 6 - offset
);
1282 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1283 x
- 8 + offset
, y
- 8 - offset
,
1284 x
- 8 + offset
, y
+ 8 - offset
);
1285 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1286 x
- 7 + offset
, y
- 7 - offset
,
1287 x
- 7 + offset
, y
+ 7 - offset
);
1288 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1289 x
- 6 + offset
, y
- 6 - offset
,
1290 x
- 6 + offset
, y
+ 6 - offset
);
1292 if (view
->x
->color
) {
1293 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1294 view
->pixels
[COLOR_BLACK
]);
1296 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillSolid
);
1300 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1301 x
- 7 + offset
, y
+ 7 - offset
,
1302 x
+ 8 + offset
, y
+ 7 - offset
);
1303 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1304 x
- 6 + offset
, y
+ 6 - offset
,
1305 x
+ 7 + offset
, y
+ 6 - offset
);
1306 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1307 x
- 5 + offset
, y
+ 5 - offset
,
1308 x
+ 6 + offset
, y
+ 5 - offset
);
1311 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1312 x
+ 7 + offset
, y
+ 8 - offset
,
1313 x
+ 7 + offset
, y
- 7 - offset
);
1314 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1315 x
+ 6 + offset
, y
+ 7 - offset
,
1316 x
+ 6 + offset
, y
- 6 - offset
);
1317 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1318 x
+ 5 + offset
, y
+ 6 - offset
,
1319 x
+ 5 + offset
, y
- 5 - offset
);
1321 if (view
->x
->color
) {
1322 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1323 view
->pixels
[COLOR_DARKGRAY
]);
1324 XFillRectangle(view
->x
->dpy
, pm
, view
->x
->gc
,
1325 x
- 5 + offset
, y
- 5 - offset
, 10, 10);
1327 XSetStipple(view
->x
->dpy
, view
->x
->gc
,
1328 view
->x
->gray50_stipple
);
1329 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1330 view
->x
->pixels
[COLOR_BLACK
]);
1331 XSetBackground(view
->x
->dpy
, view
->x
->gc
,
1332 view
->x
->pixels
[COLOR_WHITE
]);
1333 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillOpaqueStippled
);
1334 XFillRectangle(view
->x
->dpy
, pm
, view
->x
->gc
,
1335 x
- 5 + offset
, y
- 5 - offset
, 10, 10);
1336 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillSolid
);
1342 offset
= toolOffset
[v
->tool_state
];
1344 bg
= (toolColors
[v
->tool_state
] >> 8) & 0xff;
1346 x
= (x
& ~15) - (offset
<<4);
1347 y
= (y
& ~15) - (offset
<<4);
1349 x
+= left
; y
+= top
;
1351 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1352 view
->pixels
[dark
]);
1353 XDrawRectangle(view
->x
->dpy
, pm
, view
->x
->gc
,
1354 x
- 1, y
- 1, size
+ 4, size
+ 4);
1355 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1356 x
- 3, y
+ size
+ 3,
1357 x
- 1, y
+ size
+ 3);
1358 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1359 x
+ size
+ 3, y
- 3,
1360 x
+ size
+ 3, y
- 1);
1362 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1363 view
->pixels
[light
]);
1364 XDrawRectangle(view
->x
->dpy
, pm
, view
->x
->gc
,
1365 x
- 4, y
- 4, size
+ 4, size
+ 4);
1366 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1367 x
- 4, y
+ size
+ 1,
1368 x
- 4, y
+ size
+ 3);
1369 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1370 x
+ size
+ 1, y
- 4,
1371 x
+ size
+ 3, y
- 4);
1373 if (view
->x
->color
) {
1375 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1376 view
->x
->pixels
[fg
]);
1377 XSetLineAttributes(view
->x
->dpy
, view
->x
->gc
, 2,
1378 LineSolid
, CapButt
, JoinMiter
);
1380 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1381 view
->x
->pixels
[fg
]);
1382 XSetBackground(view
->x
->dpy
, view
->x
->gc
,
1385 XSetLineAttributes(view
->x
->dpy
, view
->x
->gc
, 2,
1386 LineDoubleDash
, CapButt
, JoinMiter
);
1387 XSetDashes(view
->x
->dpy
, view
->x
->gc
, 0, CursorDashes
, 2);
1390 XSetStipple(view
->x
->dpy
, view
->x
->gc
,
1391 view
->x
->gray50_stipple
);
1392 XSetForeground(view
->x
->dpy
, view
->x
->gc
,
1393 view
->x
->pixels
[COLOR_BLACK
]);
1394 XSetBackground(view
->x
->dpy
, view
->x
->gc
,
1395 view
->x
->pixels
[COLOR_WHITE
]);
1396 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillOpaqueStippled
);
1397 XSetLineAttributes(view
->x
->dpy
, view
->x
->gc
, 2,
1398 LineSolid
, CapButt
, JoinMiter
);
1401 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1402 x
- 2, y
- 1, x
- 2, y
+ size
+ 3);
1403 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1404 x
- 1, y
+ size
+ 2, x
+ size
+ 3, y
+ size
+ 2);
1405 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1406 x
+ size
+ 2, y
+ size
+ 1, x
+ size
+ 2, y
- 3);
1407 XDrawLine(view
->x
->dpy
, pm
, view
->x
->gc
,
1408 x
+ size
+ 1, y
- 2, x
- 3, y
- 2);
1410 if (!view
->x
->color
) {
1411 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillSolid
);
1413 XSetLineAttributes(view
->x
->dpy
, view
->x
->gc
, 1,
1414 LineSolid
, CapButt
, JoinMiter
);
1425 TimeElapsed(struct timeval
*elapsed
,
1426 struct timeval
*start
,
1427 struct timeval
*finish
)
1429 int usec
= finish
->tv_usec
- start
->tv_usec
;
1430 int sec
= finish
->tv_sec
- start
->tv_sec
;
1436 elapsed
->tv_usec
= usec
;
1437 elapsed
->tv_sec
= sec
;
1443 DrawOverlay(SimView
*view
)
1445 int width
= view
->w_width
;
1446 int height
= view
->w_height
;
1447 int left
= view
->pan_x
- (width
/ 2);
1448 int top
= view
->pan_y
- (height
/ 2);
1449 int right
= left
+ width
;
1450 int bottom
= top
+ height
;
1453 struct timeval start
, finished
, elapsed
;
1455 for (ink
= sim
->overlay
; ink
!= NULL
; ink
= ink
->next
) {
1456 if ((ink
->bottom
>= top
) && (ink
->top
<= bottom
) &&
1457 (ink
->right
>= left
) && (ink
->left
<= right
)) {
1463 if (!showing
) return;
1465 /* overlay_mode state machine:
1466 0 => overlay invalid:
1467 draw lines to pm => 1
1468 1 => overlay stable:
1469 sync, time draw lines to pm => 2
1470 2 => overlay stable:
1472 sync, time clip ol to pm,
1474 clipping faster? => 4
1476 draw lines to pm => 3
1477 4 => clipping faster:
1481 switch (view
->overlay_mode
) {
1483 DrawTheOverlay(view
, view
->x
->gc
,
1484 view
->pixmap2
, view
->pixels
[COLOR_WHITE
],
1485 top
, bottom
, left
, right
, 0);
1486 view
->overlay_mode
= 1;
1489 XSync(view
->x
->dpy
, False
);
1490 gettimeofday(&start
, NULL
);
1491 DrawTheOverlay(view
, view
->x
->gc
,
1492 view
->pixmap2
, view
->pixels
[COLOR_WHITE
],
1493 top
, bottom
, left
, right
, 0);
1494 XSync(view
->x
->dpy
, False
);
1495 gettimeofday(&finished
, NULL
);
1496 TimeElapsed(&view
->overlay_time
, &start
, &finished
);
1497 view
->overlay_mode
= 2;
1500 XSetForeground(view
->x
->dpy
, view
->x
->overlay_gc
, 0);
1501 XFillRectangle(view
->x
->dpy
, view
->overlay_pixmap
, view
->x
->overlay_gc
,
1502 0, 0, view
->m_width
, view
->m_height
);
1503 DrawTheOverlay(view
, view
->x
->overlay_gc
,
1504 view
->overlay_pixmap
, 1,
1505 top
, bottom
, left
, right
, 1);
1506 XSync(view
->x
->dpy
, False
);
1507 gettimeofday(&start
, NULL
);
1508 ClipTheOverlay(view
);
1509 XSync(view
->x
->dpy
, False
);
1510 gettimeofday(&finished
, NULL
);
1511 TimeElapsed(&elapsed
, &start
, &finished
);
1512 if ((elapsed
.tv_sec
> view
->overlay_time
.tv_sec
) ||
1513 ((elapsed
.tv_sec
== view
->overlay_time
.tv_sec
) &&
1514 ((elapsed
.tv_usec
> view
->overlay_time
.tv_usec
)))) {
1515 view
->overlay_mode
= 3;
1517 view
->overlay_mode
= 4;
1521 DrawTheOverlay(view
, view
->x
->gc
,
1522 view
->pixmap2
, view
->pixels
[COLOR_WHITE
],
1523 top
, bottom
, left
, right
, 0);
1526 ClipTheOverlay(view
);
1533 DrawTheOverlay(SimView
*view
, GC gc
, Pixmap pm
, int color
,
1534 int top
, int bottom
, int left
, int right
,
1539 if (view
->x
->color
) {
1540 XSetForeground(view
->x
->dpy
, gc
, color
);
1541 XSetLineAttributes(view
->x
->dpy
, gc
, 3,
1542 LineSolid
, CapButt
, JoinBevel
);
1545 XSetStipple(view
->x
->dpy
, gc
, view
->x
->gray50_stipple
);
1546 XSetTSOrigin(view
->x
->dpy
, gc
, view
->updates
& 1, 0);
1547 XSetBackground(view
->x
->dpy
, gc
, 0);
1548 XSetFillStyle(view
->x
->dpy
, gc
, FillOpaqueStippled
);
1550 XSetForeground(view
->x
->dpy
, gc
, 1);
1551 XSetLineAttributes(view
->x
->dpy
, gc
, 3,
1552 LineSolid
, CapButt
, JoinBevel
);
1554 for (ink
= sim
->overlay
; ink
!= NULL
; ink
= ink
->next
) {
1555 if ((ink
->bottom
>= top
) && (ink
->top
<= bottom
) &&
1556 (ink
->right
>= left
) && (ink
->left
<= right
)) {
1557 if (ink
->length
<= 1) {
1558 XFillArc(view
->x
->dpy
, pm
, gc
,
1559 ink
->x
- 3, ink
->y
- 3, 6, 6, 0, 360 * 64);
1561 ink
->points
[0].x
= ink
->x
- left
;
1562 ink
->points
[0].y
= ink
->y
- top
;
1563 XDrawLines(view
->x
->dpy
, pm
, gc
,
1564 ink
->points
, ink
->length
, CoordModePrevious
);
1568 if (!view
->x
->color
) {
1569 XSetFillStyle(view
->x
->dpy
, gc
, FillSolid
);
1571 XSetLineAttributes(view
->x
->dpy
, gc
, 1,
1572 LineSolid
, CapButt
, JoinMiter
);
1577 ClipTheOverlay(SimView
*view
)
1579 if (view
->x
->color
) {
1580 XSetForeground(view
->x
->dpy
, view
->x
->gc
, view
->pixels
[COLOR_WHITE
]);
1581 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillStippled
);
1582 XSetStipple(view
->x
->dpy
, view
->x
->gc
, view
->overlay_pixmap
);
1583 XSetTSOrigin(view
->x
->dpy
, view
->x
->gc
, 0, 0);
1584 XFillRectangle(view
->x
->dpy
, view
->pixmap2
, view
->x
->gc
,
1585 0, 0, view
->w_width
, view
->w_height
);
1586 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillSolid
);
1588 XSetStipple(view
->x
->dpy
, view
->x
->gc
, view
->x
->gray50_stipple
);
1589 XSetTSOrigin(view
->x
->dpy
, view
->x
->gc
, view
->updates
& 1, 0);
1590 XSetForeground(view
->x
->dpy
, view
->x
->gc
, view
->pixels
[COLOR_WHITE
]);
1591 XSetBackground(view
->x
->dpy
, view
->x
->gc
, view
->pixels
[COLOR_BLACK
]);
1592 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillOpaqueStippled
);
1593 XSetLineAttributes(view
->x
->dpy
, view
->x
->gc
, 3,
1594 LineSolid
, CapButt
, JoinBevel
);
1595 XSetClipOrigin(view
->x
->dpy
, view
->x
->gc
, 0, 0);
1596 XSetClipMask(view
->x
->dpy
, view
->x
->gc
, view
->overlay_pixmap
);
1597 XFillRectangle(view
->x
->dpy
, view
->pixmap2
, view
->x
->gc
,
1598 0, 0, view
->w_width
, view
->w_height
);
1599 XSetFillStyle(view
->x
->dpy
, view
->x
->gc
, FillSolid
);
1600 XSetClipMask(view
->x
->dpy
, view
->x
->gc
, None
);