~ubuntu-branches/debian/squeeze/freeciv/squeeze

« back to all changes in this revision

Viewing changes to client/gui-xaw/pages.c

  • Committer: Bazaar Package Importer
  • Author(s): Clint Adams, Karl Goetz, Clint Adams
  • Date: 2010-02-23 22:09:02 UTC
  • mfrom: (1.2.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20100223220902-kiyrmr9i4152cka5
Tags: 2.2.0-1
[ Karl Goetz ]
* Remove civserver files in /etc/ggzd/ (Closes: 523772, 517787)
* Adding ${misc:Depends} to all binary packages (lintian warnings)

[ Clint Adams ]
* New upstream version.
  - Drop data_dsc_use_bindir.diff (binary pathnames have changed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
#include <X11/Intrinsic.h>
19
19
#include <X11/StringDefs.h>
 
20
#include <X11/Xaw/Command.h>
20
21
#include <X11/Xaw/Form.h>
21
22
#include <X11/Xaw/Label.h>
 
23
#include <X11/Xaw/List.h>
22
24
#include <X11/Xaw/SimpleMenu.h>
23
 
#include <X11/Xaw/Command.h>
24
 
#include <X11/Xaw/List.h>
25
 
 
26
 
#include "game.h"
27
 
 
 
25
#include <X11/Xaw/Viewport.h>
 
26
 
 
27
/* utility */
28
28
#include "fcintl.h"
 
29
#include "log.h"
29
30
#include "support.h"
30
31
 
31
 
#include "civclient.h"
 
32
/* common */
 
33
#include "game.h"
 
34
 
 
35
/* client */
 
36
#include "client_main.h"
32
37
#include "connectdlg_g.h"
33
38
#include "dialogs_g.h"
34
39
 
43
48
static Widget start_page_shell;
44
49
static Widget start_page_form;
45
50
static Widget start_page_label;
 
51
static Widget start_page_viewport;
46
52
static Widget start_page_players_list;
47
53
static Widget start_page_cancel_command;
48
54
static Widget start_page_nation_command;
69
75
**************************************************************************/
70
76
void set_client_page(enum client_pages page)
71
77
{
72
 
  /* PORTME */
73
 
  if (page == PAGE_GAME) {
 
78
  /* PORTME, PORTME, PORTME */
 
79
  switch (page) {
 
80
  case PAGE_MAIN:
 
81
    /* FIXME: call main/intro page rather than falling to network page */
 
82
    gui_server_connect();
 
83
    break;
 
84
  case PAGE_GAME:
74
85
    if (old_page == PAGE_START) {
75
86
      popdown_start_page();
76
87
    }
77
 
  } else {
78
 
    if (page == PAGE_START) {
79
 
      popup_start_page();
80
 
    }
 
88
    break;
 
89
  case PAGE_START:
 
90
    popup_start_page();
 
91
    break;
 
92
  case PAGE_SCENARIO:
 
93
  case PAGE_LOAD:
 
94
  case PAGE_NETWORK:
 
95
  case PAGE_GGZ:
 
96
    break;
81
97
  }
82
98
 
83
99
  old_page = page;
139
155
                                        labelWidgetClass,
140
156
                                        start_page_form, NULL));
141
157
 
 
158
  start_page_viewport =
 
159
    XtVaCreateManagedWidget("startpageviewport", viewportWidgetClass,
 
160
                            start_page_form, NULL);
 
161
 
142
162
  start_page_players_list =
143
163
    XtVaCreateManagedWidget("startpageplayerslist",
144
164
                            listWidgetClass,
145
 
                            start_page_form,
 
165
                            start_page_viewport,
146
166
                            NULL);
147
167
 
148
168
  start_page_cancel_command =
203
223
    static char *namelist_ptrs[MAX_NUM_PLAYERS];
204
224
    static char namelist_text[MAX_NUM_PLAYERS][256];
205
225
    int j;
206
 
    Dimension width;
 
226
    Dimension width, height;
207
227
 
208
228
    j = 0;
209
229
    players_iterate(pplayer) {
210
 
      if (pplayer->ai.control) {
 
230
      if (pplayer->ai_data.control) {
211
231
        name = _("<AI>");
212
232
      } else {
213
233
        name = pplayer->username;
214
234
      }
215
 
      is_ready = pplayer->ai.control ? TRUE: pplayer->is_ready;
 
235
      is_ready = pplayer->ai_data.control ? TRUE: pplayer->is_ready;
216
236
      if (pplayer->nation == NO_NATION_SELECTED) {
217
237
        nation = _("Random");
218
238
        leader = "";
227
247
                  is_ready ? " Yes " : " No  ",
228
248
                  leader,
229
249
                  nation,
230
 
                  pplayer->player_no);
 
250
                  player_number(pplayer));
231
251
 
232
252
      namelist_ptrs[j]=namelist_text[j];
233
253
      j++;
234
254
    } players_iterate_end;
235
255
    conn_list_iterate(game.est_connections, pconn) {
236
 
      if (pconn->player && !pconn->observer) {
 
256
      if (NULL != pconn->playing && !pconn->observer) {
237
257
        continue; /* Already listed above. */
238
258
      }
239
259
      name = pconn->username;
251
271
      namelist_ptrs[j]=namelist_text[j];
252
272
      j++;
253
273
    } conn_list_iterate_end;
 
274
    XawFormDoLayout(start_page_form, False);
254
275
    XawListChange(start_page_players_list, namelist_ptrs, j, 0, True);
255
276
 
256
 
    XtVaGetValues(start_page_players_list, XtNwidth, &width, NULL);
257
 
    XtVaSetValues(start_page_label, XtNwidth, width, NULL); 
 
277
    XtVaGetValues(start_page_players_list, XtNlongest, &width, NULL);
 
278
    XtVaGetValues(start_page_players_list, XtNheight, &height, NULL);
 
279
    XtVaSetValues(start_page_viewport, XtNwidth, width + 15, NULL); 
 
280
    XtVaSetValues(start_page_label, XtNwidth, width + 15, NULL); 
 
281
    XawFormDoLayout(start_page_form, True);
 
282
    if (height > 120) {
 
283
      height = 120;
 
284
    }
 
285
    XtVaSetValues(start_page_viewport, XtNheight, height, NULL); 
258
286
  }
259
287
}
260
288
 
273
301
void start_page_nation_callback(Widget w, XtPointer client_data,
274
302
                                XtPointer call_data)
275
303
{
276
 
  if (game.player_ptr) {
277
 
    popup_races_dialog(game.player_ptr);
 
304
  if (NULL != client.conn.playing) {
 
305
    popup_races_dialog(client.conn.playing);
278
306
  }
279
307
}
280
308
 
296
324
  popdown_start_page();
297
325
}
298
326
 
299
 
/****************************************************************************
300
 
  Refresh all vote related GUI widgets. Called by the voteinfo module when
301
 
  the client receives new vote information from the server.
302
 
****************************************************************************/
303
 
void voteinfo_gui_update(void)
304
 
{
305
 
  /* PORTME */
306
 
}