1 /* Definitions for the X11 Xt interface to Xconq. 2 Copyright (C) 1987-1989, 1991-1999 Stanley T. Shebs. 3 4 Xconq 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, or (at your option) 7 any later version. See the file COPYING. */ 8 9 /* Default color of text and icons - 0 is for white on black, 1 is for 10 black on white. Should be set appropriately for the most common 11 monochrome display (color displays always do white on black). This 12 is also settable by the player, so the default is just for 13 convenience of the majority. */ 14 15 #define BLACKONWHITE 1 16 17 /* The default fonts can be altered by users, so these are just hints. */ 18 19 #define TEXTFONT "fixed" 20 21 /* Some X11 servers die if too much is written between output flushes. */ 22 23 /* #define STUPIDFLUSH */ 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 #if (!defined (__CYGWIN32__) && !defined (__MINGW32__)) 29 #include <X11/Xos.h> 30 #endif 31 #include <X11/Xlib.h> 32 #include <X11/Xutil.h> 33 #include <X11/Xresource.h> 34 #ifdef __cplusplus 35 } 36 #endif 37 38 #include <math.h> 39 40 #include "imf.h" 41 #include "ximf.h" 42 #include "ui.h" 43 #include "print.h" 44 45 enum grayshade { 46 black, 47 gray, 48 darkgray, 49 numgrays 50 }; 51 52 /* This is the name of a family of programs, so argv[0] inadequate. */ 53 54 #define PROGRAMNAME "xtconq" 55 #define PROGRAMCLASSNAME "Xtconq" 56 57 #ifdef __cplusplus 58 extern "C" { 59 #endif 60 #include <X11/Intrinsic.h> 61 #include <X11/StringDefs.h> 62 #include <X11/Xaw/Box.h> 63 #include <X11/Xaw/Form.h> 64 #include <X11/Xaw/Paned.h> 65 #include <X11/Xaw/Dialog.h> 66 #include <X11/Xaw/Label.h> 67 #include <X11/Xaw/Command.h> 68 #include <X11/Xaw/Toggle.h> 69 #include <X11/Xaw/List.h> 70 #include <X11/Xaw/AsciiText.h> 71 #include <X11/Xaw/Viewport.h> 72 #include <X11/Xaw/Panner.h> 73 #include <X11/Xaw/Porthole.h> 74 #include <X11/Shell.h> 75 76 #include <X11/Xaw/Cardinals.h> 77 #include <X11/Xaw/Toggle.h> 78 #include <X11/Xaw/SmeBSB.h> 79 #ifdef __cplusplus 80 } 81 #endif 82 83 #include <math.h> 84 85 /* Types of controls. */ 86 87 enum controltypeenum { 88 LOOK = 0, 89 MOVE, 90 UNIT_MOVE, 91 UNIT_SHOOT, 92 UNIT_BUILD, 93 SHOW_TERRAIN, 94 SHOW_GRID, 95 SHOW_UNITS, 96 SHOW_NAMES, 97 SHOW_FEATURE_NAMES, 98 SHOW_FEATURE_BOUNDARIES, 99 SHOW_NUMBERS, 100 SHOW_PEOPLE, 101 SHOW_CONTROL, 102 SHOW_ELEV, 103 SHOW_TEMP, 104 SHOW_CLOUDS, 105 SHOW_WINDS, 106 SHOW_COVER, 107 SHOW_ALL, 108 SHOW_MERIDIANS, 109 SHOW_MORE, 110 COLR_UNITS, 111 COLR_TERR, 112 COLR_EMBL, 113 MONO_REVERSE, 114 ZOOM_OUT, 115 ZOOM_IN, 116 POPUP_HELP, 117 numcontrols 118 }; 119 120 /* Tools govern the interpretation of mouse clicks in a map view. */ 121 122 enum tooltypes { 123 looktool, 124 movetool, 125 unitmovetool, 126 unitshoottool, 127 unitbuildtool, 128 #ifdef DESIGNERS 129 cellpainttool, 130 bordpainttool, 131 connpainttool, 132 unitaddtool, 133 peoplepainttool, 134 featurepainttool, 135 #endif /* DESIGNERS */ 136 numtools 137 }; 138 139 enum movie_type { 140 movie_null, 141 movie_miss, 142 movie_hit, 143 movie_death, 144 movie_nuke, 145 movie_sound, 146 movie_flash 147 }; 148 149 struct a_movie { 150 char *type; 151 enum movie_type itype; 152 int args[5]; 153 }; 154 155 #define N_COMMAND 3 156 #define N_CHOICE 1 157 #define N_BUTTON (N_COMMAND+N_CHOICE) 158 #define N_TOGGLE 6 159 #define N_DIALOG 12 160 #define N_DIMEN_D 10 161 #define N_WIDGET (N_BUTTON+N_TOGGLE+N_DIALOG) 162 163 /* The user interface substructure. This is only allocated for sides with 164 attached displays. */ 165 166 typedef struct a_ui { 167 Display *dpy; /* The X display used by this side */ 168 int active; /* True when the display is usable */ 169 int screen; /* The X screen in use */ 170 Widget shell; /* Main shell for this side's displays */ 171 Window rootwin; /* The root window */ 172 Pixel foreground; 173 Pixel background; 174 String geospec; 175 int mpTime; /* # of milliseconds to pause between mplayer moves */ 176 Atom kill_atom; 177 short bonw; /* true if display is black-on-white */ 178 short follow_action; /* scroll to where something has occured */ 179 int sxdown, sydown; 180 int cellx, celly; 181 Boolean cellxy_ok; /* cellx & celly valid? */ 182 struct a_map *mapdown; 183 int beepcount; /* number of times we've been beeped */ 184 /* Constructed during display init. */ 185 short monochrome; /* obvious */ 186 short fw, fh; /* dimensions of text font (in pixels) */ 187 /* Working variables for the display. */ 188 long bgcolor; /* background color */ 189 long fgcolor; /* foreground (text) color */ 190 long whitecolor; /* actual white for this display */ 191 long blackcolor; /* actual black for this display */ 192 long graycolor; /* color for graying out (usually gray) */ 193 long diffcolor; /* unusual/distinct color (usually maroon) */ 194 long goodcolor; /* color for OKness (usually green) */ 195 long badcolor; /* color for non-OKness (usually red) */ 196 long gridcolor; 197 long unseencolor; 198 long contour_color; 199 long country_border_color; 200 long feature_color; 201 long frontline_color; 202 long meridian_color; 203 long shoreline_color; 204 long unit_name_color; 205 long *cellcolor; /* the color of each terrain type */ 206 #if 0 207 long *cellfgcolor; /* the "fg" color of each terrain type */ 208 #endif 209 long colors[MAXSIDES][3]; 210 int numcolors[MAXSIDES]; 211 long *unitcolors; 212 long *numunitcolors; 213 short dflt_color_unit_images; 214 short dflt_color_terr_images; 215 short dflt_color_embl_images; 216 short pref_solid_color_terrain; 217 short default_meridian_interval; 218 GC gc; /* a tmp graphics context for this display */ 219 GC textgc; /* foreground on background text */ 220 GC ltextgc; /* foreground on background text */ 221 GC terrgc; /* terrain display gc */ 222 GC unitgc; /* unit display gc */ 223 GC emblgc; /* emblem display gc */ 224 GC bdrygc; /* country/feature boundary gc */ 225 XFontStruct *textfont; /* Font for text display */ 226 /* Map-related slots. */ 227 struct a_map *maps; /* Chain of maps that are up */ 228 /* Help-related slots. */ 229 Widget help_shell; 230 Widget help_form; 231 Widget help_topicPort; 232 Widget help_topicList; 233 Widget help_title; 234 Widget help_text; 235 Widget help_button_box; 236 Widget help_next; 237 Widget help_prev; 238 Widget help_back; 239 Widget help_close; 240 short helpw, helph; 241 struct a_helpnode *curhelpnode; 242 struct a_helpnode **nodestack; 243 int nodenumber, nodestackpos; 244 /* Printing-related slots. */ 245 Widget print_shell; 246 Widget print_help_shell; 247 Widget print_cmds[N_WIDGET]; 248 PrintParameters *ps_pp; 249 int choi[N_CHOICE]; 250 int flag[N_TOGGLE]; 251 double parm[N_DIALOG]; 252 int i_metric; 253 #ifdef DESIGNERS 254 /* Design-related slots. */ 255 Widget design_shell; 256 Widget design; 257 Widget normal_button; 258 Widget normal_label; 259 Widget terrain_button; 260 Widget terrain_label; 261 Widget unit_button; 262 Widget unit_label; 263 Widget people_button; 264 Widget people_label; 265 Widget feature_button; 266 Widget feature_label; 267 Widget brush_radius_label; 268 short curdesigntool; 269 short curbrushradius; 270 short curttype; 271 short curbgttype; 272 short curutype; 273 short curusidenumber; 274 short cursidenumber; 275 short curfid; 276 #endif /* DESIGNERS */ 277 /* Arrays of image families for terrain and side emblems. 278 uimages is no longer part of the ui, but a global declared in ui.h. */ 279 ImageFamily **timages; 280 ImageFamily **eimages; 281 short *eimages_loaded; 282 /* Terrain drawing machinery */ 283 enum whattouse *usewhat[NUMPOWERS]; /* for each terrain */ 284 /* (should use as cache of image in image family - calc as needed) */ 285 Pixmap *terrpics[NUMPOWERS]; /* for each terrain */ 286 char *terrchars[NUMPOWERS]; /* for each terrain */ 287 XFontStruct **terrfonts[NUMPOWERS]; /* for each terrain */ 288 Pixmap hexpics[NUMPOWERS], bhexpics[NUMPOWERS]; 289 Pixmap hexchars[NUMPOWERS], bhexchars[NUMPOWERS]; 290 XFontStruct *hexfonts[NUMPOWERS], *bhexfonts[NUMPOWERS]; 291 /* Unit drawing machinery */ 292 Pixmap *unitpics[NUMPOWERS]; /* for each utype */ 293 Pixmap *unitmasks[NUMPOWERS]; /* for each utype */ 294 char *unitchars[NUMPOWERS]; /* for each utype */ 295 XFontStruct **unitfonts[NUMPOWERS]; /* for each utype */ 296 XFontStruct *unitfont; /* font for unit characters */ 297 /* Emblem drawing machinery */ 298 Pixmap emblempics[MAXSIDES]; 299 Pixmap emblemmasks[MAXSIDES]; 300 int embw[MAXSIDES], embh[MAXSIDES]; 301 /* Map legend drawing machinery */ 302 XFontStruct **ulegendfonts[NUMPOWERS]; /* for each utype */ 303 XFontStruct *flegendfonts[6]; 304 Font flegendfids[6]; 305 Legend *legends; 306 /* Side closeup list */ 307 struct a_side_closeup *sidecloseuplist; 308 /* Unit list */ 309 struct a_unit_list *unitlistlist; 310 /* Unit closeup list */ 311 struct a_unit_closeup *unitcloseuplist; 312 /* Unit closeup summary */ 313 struct a_closeup_summary *closeupsummary; 314 /* Orders interface */ 315 Widget orders_shell; 316 Widget orders_label; 317 Widget orders_form; 318 Widget orders_radio; 319 Widget orders_help_shell; 320 StandingOrder *sorder_edit; 321 char *sorder_types_edit; 322 Task *sorder_task_edit; 323 struct a_order_interface *ordi_edit; 324 struct a_order_interface *orderlist; 325 int *grok_p1; 326 int *grok_p2; 327 int grok_size; 328 /* Random stuff */ 329 Pixmap bombpics[4]; 330 Pixmap hitpics[3]; 331 Pixmap controlpics[numcontrols]; 332 Pixmap toolcursors[numtools]; 333 Pixmap *unitcursors_foo; /* for each utype */ 334 Pixmap grays[numgrays]; 335 Pixmap dots; 336 int numscheduled; 337 struct a_movie movies[10]; 338 short told_outcome; 339 struct a_map *curmap; 340 } UI; 341 342 /* A closer look at a side. */ 343 344 typedef struct a_side_closeup { 345 struct a_map *map; 346 struct a_side *side; 347 Widget shell, info, *filter, list_units; 348 struct a_side_closeup *next; 349 } SideCloseup; 350 351 /* A list of units. */ 352 353 typedef struct a_unit_list { 354 struct a_map *map; 355 int number; 356 Unit **units; 357 char **labels; 358 Widget shell, label, list, close; 359 struct a_unit_list *next; 360 } UnitList; 361 362 /* A closer look at a unit. */ 363 364 typedef struct a_unit_closeup { 365 struct a_map *map; 366 struct a_unit *unit; 367 Widget shell, info; 368 struct a_unit_closeup *next; 369 } UnitCloseup; 370 371 /* List of unit closeups */ 372 373 typedef struct a_closeup_summary { 374 int number; 375 UnitCloseup **unitcloseups; 376 char **labels; 377 Widget shell, label, list; 378 } CloseupSummary; 379 380 /* Orders interface. */ 381 382 typedef struct a_order_interface { 383 StandingOrder *sorder; 384 Widget form, toggle, types, etype, eparms, task, tparms; 385 Pixel form_bg, form_fg; 386 struct a_order_interface *next; 387 } OrderInterface; 388 389 /* Iteration over all of a side's unit closeups. */ 390 391 #define for_all_unit_closeups(c,s) \ 392 for ((c) = (s)->ui->unitcloseuplist; (c) != NULL; (c) = (c)->next) 393 394 /* Iteration over all of a side's unit lists. */ 395 396 #define for_all_unit_lists(l,s) \ 397 for ((l) = (s)->ui->unitlistlist; (l) != NULL; (l) = (l)->next) 398 399 /* Iteration over all of a side's side closeups. */ 400 401 #define for_all_side_closeups(c,s) \ 402 for ((c) = (s)->ui->sidecloseuplist; (c) != NULL; (c) = (c)->next) 403 404 /* Each side can open up any number and shape of maps. */ 405 406 /* All the maps will share colors and bitmaps though. */ 407 408 typedef struct a_map { 409 /* Widgets that make up the map. */ 410 Widget mainwidget; 411 Widget leftpane; /* lefthand area of window */ 412 Widget leftform; /* */ 413 Widget rightpane; /* righthand area of window */ 414 Widget infoform; /* parts of leftform */ 415 Widget controlform; /* parts of leftform */ 416 Widget *controls; /* Array of controls */ 417 Widget mapform; /* parts of leftform */ 418 Widget sideform; /* parts of rightform */ 419 Widget info; /* Info about current pos/unit */ 420 Widget porthole; 421 Widget portlabel; 422 Widget gamedate; /* Overall game info */ 423 Widget gameclock; /* overall game info */ 424 Widget msgarea; /* miscellaneous info related to UI */ 425 Widget sides; /* List of sides */ 426 Widget history; /* Place for notices/warnings */ 427 Widget promptlabel; 428 Widget listview; 429 Widget listform; 430 Widget *list_buttons; /* numutypes+1 of these */ 431 Widget pannerbox; 432 Widget panner; 433 Widget help_pop; 434 Widget ctrlpanel_pop; /* View control popup */ 435 Widget ctrlpanel_shell; /* View control popup's shell */ 436 Widget ctrlpanel_form; 437 Widget *ctrlpanel_buttons; /* Array of buttons */ 438 /* Raw windows that we draw into directly. */ 439 Window infowin; /* info about a unit and/or cell */ 440 Pixmap viewwin; /* actual graphical display of an area */ 441 Window sideswin; /* list of sides */ 442 /* panner pixmap */ 443 Pixmap panner_pix; 444 /* How to draw the map. */ 445 short seeall; /* True if viewing world data directly */ 446 short use_color_terr_images; 447 short use_color_embl_images; 448 short fullpanel; 449 short follow_action; 450 /* Slots used for internal display calculations. */ 451 VP *vp; /* This map's generic view parameters */ 452 short totalw, totalh; /* Total size of window in pixels */ 453 short leftfrac; 454 short leftw; 455 short pxw, pxh; /* Size of map subwindow in pixels */ 456 short toph; 457 short infoh; 458 short list1frac; 459 short list1w, list1h; 460 short list2w, list2h; 461 short panw, panh; 462 short sidespacing; /* Vertical space for each side in side list */ 463 short *last_num_in_play; /* for each utype */ 464 short *last_num_incomplete; /* for each utype */ 465 /* Interaction controls. */ 466 short curtool; /* Interpretation of left-mouse clicks */ 467 short curx, cury; /* Current spot being looked at */ 468 struct a_unit *curunit; /* Unit under cursor */ 469 short savedcurx, savedcury; /* Current spot being looked at (saved) */ 470 struct a_unit *savedcurunit;/* Unit under cursor (saved) */ 471 void (*modalhandler)(Side *side, struct a_map *map, int cancelled); 472 char inpch; /* Keyboard char */ 473 short inptype; /* Unit type clicked in unit type list */ 474 short prefixarg; /* numerical prefix argument */ 475 int argunitid; /* is unit id, not ptr, for safety */ 476 short tmpt; 477 struct a_side *argside; 478 short *uvec; /* vector of allowed unit types to input, size numutypes */ 479 char *ustr; /* used in composing unit type hints, size numutypes+1 */ 480 short *tvec; /* vector of allowed terrain types to input, size numttypes */ 481 char *tstr; /* used in composing terrain type hints, size numttypes+1 */ 482 char prompt[BUFSIZE]; /* prompt for input */ 483 char answer[BUFSIZE]; /* string being typed in */ 484 int tmpint; 485 short frombutton; /* true if command was issued from button */ 486 short anim_state; 487 /* Link to the next map. */ 488 struct a_map *next; 489 } Map; 490 491 /* Iteration over all of a side's map windows. */ 492 493 #define for_all_maps(s,m) \ 494 for ((m) = (s)->ui->maps; (m) != NULL; (m) = (m)->next) 495 496 #define num_unit_colors(s,s2,u) \ 497 (((s)->ui->numunitcolors)[numutypes * (s2) + (u)]) 498 499 #define unit_color(s,s2,u,n) \ 500 (((s)->ui->numunitcolors)[3 * (numutypes * (s2) + (u)) + (n)]) 501 502 /* Values shared by all displays and all sides. */ 503 504 extern Widget thistoplevel; 505 extern XtAppContext thisapp; 506 extern int nargs; 507 extern Arg tmpargs[]; 508 509 /* Declarations of globally visible functions. */ 510 511 extern int ask_unit_type(Side *side, Map *map, char *prompt, int *poss, 512 void (*handler)(Side *side, Map *map, int cancel)); 513 extern int ask_terrain_type(Side *side, Map *map, char *prompt, int *poss, 514 void (*handler)(Side *side, Map *map, int cancel)); 515 extern void ask_side(Side *side, Map *map, char *prompt, Side *dflt, 516 void (*handler)(Side *side, Map *map, int cancel)); 517 extern void ask_position(Side *side, Map *map, char *prompt, 518 void (*handler)(Side *side, Map *map, int cancel)); 519 extern void ask_bool(Side *side, Map *map, char *prompt, int dflt, 520 void (*handler)(Side *side, Map *map, int cancel)); 521 extern void ask_string(Side *side, Map *map, char *prompt, char *dflt, 522 void (*handler)(Side *side, Map *map, int cancel)); 523 524 extern int grok_unit_type(Side *side, Map *map, int *typep); 525 extern int grok_terrain_type(Side *side, Map *map, int *typep); 526 extern int grok_side(Side *side, Map *map, Side **side2p); 527 extern int grok_position(Side *side, Map *map, int *xp, int *yp, Unit **unitp); 528 extern int grok_bool(Side *side, Map *map); 529 extern int grok_string(Side *side, Map *map, char **strp); 530 531 extern void xform(Side *side, Map *map, int x, int y, int *sxp, int *syp); 532 extern void x_xform_unit(Side *side, Map *map, Unit *unit, 533 int *sxp, int *syp, int *swp, int *shp); 534 extern void x_xform_unit_self(Side *side, Map *map, Unit *unit, 535 int *sxp, int *syp, int *swp, int *shp); 536 extern void x_xform_occupant(Side *side, Map *map, Unit *transport, Unit *unit, 537 int sx, int sy, int sw, int sh, 538 int *sxp, int *syp, int *swp, int *shp); 539 extern int x_nearest_cell(Side *side, Map *map, int sx, int sy, 540 int *xp, int *yp); 541 extern int x_nearest_boundary(Side *side, Map *map, int sx, int sy, 542 int *xp, int *yp, int *dirp); 543 extern int x_nearest_unit(Side *side, Map *map, int sx, int sy, Unit **unitp); 544 545 extern void init_x_signal_handlers(void); 546 547 extern void popup_game_dialog(void); 548 549 extern void check_player_displays(void); 550 extern void init_redraws(void); 551 extern void init_display(Side *side); 552 extern void set_colors(Side *side); 553 extern long request_color(Side *side, char *name); 554 555 extern XFontStruct *open_font(Side *side, char *name, char *xdefault, 556 XFontStruct *altfont, char *alttype, Font *fid); 557 extern Cursor make_cursor(Display *dpy, Window win, 558 char *cursbits, char *maskbits, 559 unsigned long fg, unsigned long bg, 560 unsigned int x, unsigned int y); 561 562 extern void reset_color_state(Side *side); 563 extern void reset_window_colors(Side *side, Window win); 564 565 extern void set_current_unit(Side *side, Map *map, Unit *unit); 566 extern void set_current_xy(Side *side, Map *map, int x, int y); 567 extern void clear_current(Side *side, Map *map); 568 extern void save_cur(Side *side, Map *map); 569 extern void restore_cur(Side *side, Map *map); 570 571 extern Map *create_map(Side *side, int power, char *geospec); 572 573 extern void add_map_actions(void); 574 575 extern void set_tool_cursor(Side *side, Map *map); 576 577 extern void set_map_power(Side *side, Map *map, int power); 578 extern void x_center_on_focus(Side *side, Map *map); 579 580 extern void handle_key_event(Side *side, Map *map, XEvent *evt); 581 582 extern int find_side_and_map(Widget w, Side **sidep, Map **mapp); 583 extern int find_side_and_map_via_control(Widget w, Side **sidep, Map **mapp); 584 extern int find_side_and_map_via_listform(Widget w, Side **sidep, Map **mapp); 585 extern int find_side_and_map_via_mapform(Widget w, Side **sidep, Map **mapp); 586 extern int find_side_and_map_via_rightform(Widget w, Side **sidep, Map **mapp); 587 extern int find_side_and_map_via_a_toplevel(Widget w, Side **sidep, 588 Map **mapp); 589 extern int find_side_and_map_via_porthole(Widget w, Side **sidep, Map **mapp); 590 extern int find_side_via_widget(Widget w, Side **sidep); 591 592 extern void update_controls(Side *side, Map *map); 593 594 extern void draw_all_maps(Side *side); 595 596 extern void draw_map(Side *side, Map *map); 597 extern void draw_map_view(Side *side, Map *map); 598 extern void destroy_map(Side *side, Map *map); 599 600 601 extern void draw_row(Side *side, Map *map, int x0, int y0, int len, 602 int clearit); 603 extern void draw_unit_image(ImageFamily *imf, Side *side, Window win, 604 int sx, int sy, int sw, int sh, 605 int s2, int fg, int bg, int mod); 606 extern void draw_side_emblem(Side *side, Window win, int ex, int ey, 607 int ew, int eh, int s2, int style); 608 extern void draw_current(Side *side, Map *map); 609 extern void erase_current(Side *side, Map *map, int x, int y, Unit *unit); 610 611 extern void draw_prompt(Side *side, Map *map); 612 extern void clear_prompt(Side *side, Map *map); 613 extern void draw_map_info(Side *side, Map *map); 614 extern void draw_game_state(Side *side, Map *map); 615 extern void draw_game_clocks(Side *side, Map *map); 616 extern void draw_map_sides(Side *side, Map *map); 617 extern void draw_side_info(Side *side, Map *map, Side *side2); 618 extern void draw_side_progress(Side *side, Map *map, Side *side2); 619 620 extern void put_on_screen(Side *side, Map *map, int x, int y); 621 extern int in_middle(Side *side, Map *map, int x, int y); 622 623 extern void move_the_selected_unit(Side *side, Map *map, Unit *unit, 624 int sx, int sy); 625 626 extern void create_help(Side *side); 627 extern void popup_help(Side *side); 628 extern void popdown_help(Side *side); 629 630 extern void recenter(Side *side, Map *map, int x, int y); 631 632 extern void draw_text(Side *side, Window win, int x, int y, char *str, 633 int color); 634 extern void draw_fg_text(Side *side, Window win, int x, int y, char *str); 635 636 extern void textw_printf(const Widget w, const char *fmt, ...); 637 638 extern int font_width(XFontStruct *font); 639 extern int font_height(XFontStruct *font); 640 641 extern void close_display(Side *side); 642 643 extern void exit_xconq(Side *side); 644 645 extern void notify_all(char *fmt, ...); 646 extern void low_notify(Side *side, char *str); 647 extern void redraw(Side *side); 648 extern void flush_output(Side *side); 649 extern void beep(Side *side); 650 651 extern void flush_input(Side *side); 652 653 extern void build_name(char *name, char *first, char *second); 654 655 extern void draw_view_in_panner(Side *side, Map *map); 656 657 extern void set_message_area(Map *map, char *msg); 658 659 extern void add_map_actions(void); 660 661 extern void update_unit_type_list(Side *side, Map *map, int u); 662 663 extern XawTextPosition widget_text_length(Widget w); 664 665 extern void move_caret_to_end(Widget w); 666 667 extern int popup_print_setup_dialog(Side *side); 668 669 void place_legends(Side *side); 670 671 672 void enable_in_unit_type_list(Side *side, Map *map, int u, int flag); 673 674 extern void zoom_in_out(Side *side, Map *map, int which); 675 676 extern int find_side_and_map_via_ctrlpanel_form(Widget w, Side **sidep, 677 Map **mapp); 678 679 extern time_t game_start_in_real_time; 680 extern time_t turn_play_start_in_real_time; 681 682 extern void handle_map_sides_events(Widget w, XtPointer clientdata, 683 XEvent *evt, Boolean *contdispatch); 684 extern void handle_map_info_events(Widget w, XtPointer clientdata, 685 XEvent *evt, Boolean *contdispatch); 686 687 extern void place_legends(Side *side); 688 689 extern void scroll_map_absolute(Side *side, Map *map, int sx, int sy); 690 extern void scroll_map_relative(Side *side, Map *map, int sx, int sy); 691 692 extern void draw_blast_image(Side *side, Map *map, int sx, int sy, 693 int sw, int sh, int blasttype); 694 extern void invert_unit_subarea(Side *side, Map *map, int x, int y); 695 696 extern void update_help(Side *side); 697 698 #ifdef DESIGNERS 699 extern void create_design(Side *side); 700 extern void popup_design(Side *side); 701 extern void update_curttype(Side *side); 702 extern void update_curutype(Side *side); 703 extern void update_cursidenumber(Side *side); 704 extern void update_curfeature(Side *side); 705 extern void update_curbrushradius(Side *side); 706 extern void set_designer_cur_from_map(Side *side, Map *map, int sx, int sy); 707 extern void handle_designer_map_click(Side *side, Map *map, int sx, int sy); 708 extern void popdown_design(Side *side); 709 #endif /* DESIGNERS */ 710 711 extern UnitCloseup *find_unit_closeup(Side *side, Unit *unit); 712 extern UnitCloseup *find_unit_closeup_via_button(Widget w, Side *side); 713 extern UnitCloseup *create_unit_closeup(Side *side, Map *map, Unit *unit); 714 extern void draw_unit_closeup(Side *side, UnitCloseup *unitcloseup); 715 extern void destroy_unit_closeup(Side *side, UnitCloseup *unitcloseup); 716 extern SideCloseup *find_side_closeup(Side *side, Side *side2); 717 extern SideCloseup *find_side_closeup_via_button(Widget w, Side *side); 718 extern SideCloseup *create_side_closeup(Side *side, Map *map, Side *side2); 719 extern void draw_side_closeup(Side *side, SideCloseup *sidecloseup); 720 extern void destroy_side_closeup(Side *side, SideCloseup *sidecloseup); 721 extern Pixmap get_unit_picture(int utype, Side *side); 722 extern Pixmap get_side_picture(Side *side, Side *side1); 723 724 void raise_widget(Widget w); 725 726 void initial_ui_init(int argc, char *argv[]); 727 void ui_init(void); 728 void ui_mainloop(void); 729 730 731