Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2005:
[Freeciv-Dev] (PR#11386) Should popup_intel_dialog be rewritten like pop
Home

[Freeciv-Dev] (PR#11386) Should popup_intel_dialog be rewritten like pop

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: evyscr@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#11386) Should popup_intel_dialog be rewritten like popup_spaceship_dialog?
From: "Christian Prochaska" <cp.ml.freeciv.dev@xxxxxxxxxxxxxx>
Date: Tue, 27 Dec 2005 13:47:59 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11386 >

Here's a patch for gui-sdl.
Index: client/gui-sdl/gui_main.c
===================================================================
--- client/gui-sdl/gui_main.c   (Revision 11399)
+++ client/gui-sdl/gui_main.c   (Arbeitskopie)
@@ -60,6 +60,7 @@
 #include "gui_id.h"
 #include "gui_stuff.h"         /* gui */
 #include "gui_tilespec.h"
+#include "inteldlg.h"
 #include "mapctrl.h"
 #include "mapview.h"
 #include "menu.h"
@@ -901,6 +902,8 @@
       
   load_cursors();  
 
+  intel_dialog_init();
+
   clear_double_messages_call();
     
   create_units_order_widgets();
@@ -969,6 +972,9 @@
   #endif
 
   free_auxiliary_tech_icons();
+  
+  intel_dialog_done();  
+  
   unload_cursors();
   
 /* FIXME: the font system cannot be freed yet, because it is still 
Index: client/gui-sdl/dialogs.c
===================================================================
--- client/gui-sdl/dialogs.c    (Revision 11399)
+++ client/gui-sdl/dialogs.c    (Arbeitskopie)
@@ -162,7 +162,7 @@
   popdown_worklist_editor();
   popdown_economy_report_dialog();
   popdown_activeunits_report_dialog();
-  popdown_intel_dialog();
+  popdown_intel_dialogs();
   popdown_players_nations_dialog();
   popdown_players_dialog();
   popdown_goto_airlift_dialog();
Index: client/gui-sdl/inteldlg.c
===================================================================
--- client/gui-sdl/inteldlg.c   (Revision 11400)
+++ client/gui-sdl/inteldlg.c   (Arbeitskopie)
@@ -38,11 +38,62 @@
 
 #include "inteldlg.h"
 
-static struct ADVANCED_DLG  *pIntel_Dlg = NULL;
+struct intel_dialog {
+  struct player *pplayer;
+  struct ADVANCED_DLG *pdialog;
+  int pos_x, pos_y;
+};
 
+#define SPECLIST_TAG dialog
+#define SPECLIST_TYPE struct intel_dialog
+#include "speclist.h"
+
+#define dialog_list_iterate(dialoglist, pdialog) \
+    TYPED_LIST_ITERATE(struct intel_dialog, dialoglist, pdialog)
+#define dialog_list_iterate_end  LIST_ITERATE_END
+
+static struct dialog_list *dialog_list;
+static struct intel_dialog *create_intel_dialog(struct player *p);
+
+/****************************************************************
+...
+*****************************************************************/
+void intel_dialog_init()
+{
+  dialog_list = dialog_list_new();
+}
+
+/****************************************************************
+...
+*****************************************************************/
+void intel_dialog_done()
+{
+  dialog_list_free(dialog_list);
+}
+
+/****************************************************************
+...
+*****************************************************************/
+static struct intel_dialog *get_intel_dialog(struct player *pplayer)
+{
+  dialog_list_iterate(dialog_list, pdialog) {
+    if (pdialog->pplayer == pplayer) {
+      return pdialog;
+    }
+  } dialog_list_iterate_end;
+
+  return NULL;
+}
+
+/****************************************************************
+...
+*****************************************************************/
 static int intel_window_dlg_callback(struct GUI *pWindow)
 {
-  return std_move_window_group_callback(pIntel_Dlg->pBeginWidgetList, pWindow);
+  struct intel_dialog *pSelectedDialog = 
get_intel_dialog(pWindow->data.player);
+
+  return 
std_move_window_group_callback(pSelectedDialog->pdialog->pBeginWidgetList,
+                                                                     pWindow);
 }
 
 static int tech_callback(struct GUI *pWidget)
@@ -54,7 +105,7 @@
 static int spaceship_callback(struct GUI *pWidget)
 {
   struct player *pPlayer = pWidget->data.player;
-  popdown_intel_dialog();
+  popdown_intel_dialog(pPlayer);
   popup_spaceship_dialog(pPlayer);
   return -1;
 }
@@ -62,16 +113,82 @@
 
 static int exit_intel_dlg_callback(struct GUI *pWidget)
 {
-  popdown_intel_dialog();
+  popdown_intel_dialog(pWidget->data.player);
   flush_dirty();
   return -1;
 }
 
+static struct intel_dialog *create_intel_dialog(struct player *pPlayer) {
+
+  struct intel_dialog *pdialog = MALLOC(sizeof(struct intel_dialog));
+
+  pdialog->pplayer = pPlayer;
+  
+  pdialog->pdialog = MALLOC(sizeof(struct ADVANCED_DLG));
+      
+  pdialog->pos_x = 0;
+  pdialog->pos_y = 0;
+    
+  dialog_list_prepend(dialog_list, pdialog);  
+  
+  return pdialog;
+}
+
+
 /**************************************************************************
   Popup an intelligence dialog for the given player.
 **************************************************************************/
-void popup_intel_dialog(struct player *pPlayer)
+void popup_intel_dialog(struct player *p)
 {
+  struct intel_dialog *pdialog;
+
+  if (!(pdialog = get_intel_dialog(p))) {
+    pdialog = create_intel_dialog(p);
+  } else {
+    /* bring existing dialog to front */
+    sellect_window_group_dialog(pdialog->pdialog->pBeginWidgetList,
+                                         pdialog->pdialog->pEndWidgetList);
+  }
+
+  update_intel_dialog(p);
+}
+
+/**************************************************************************
+  Popdown an intelligence dialog for the given player.
+**************************************************************************/
+void popdown_intel_dialog(struct player *p)
+{
+  struct intel_dialog *pdialog = get_intel_dialog(p);
+    
+  if (pdialog) {
+    popdown_window_group_dialog(pdialog->pdialog->pBeginWidgetList,
+                                         pdialog->pdialog->pEndWidgetList);
+      
+    dialog_list_unlink(dialog_list, pdialog);
+      
+    FREE(pdialog->pdialog->pScroll);
+    FREE(pdialog->pdialog);  
+    FREE(pdialog);
+  }
+}
+
+/**************************************************************************
+  Popdown all intelligence dialogs
+**************************************************************************/
+void popdown_intel_dialogs() {
+  dialog_list_iterate(dialog_list, pdialog) {
+    popdown_intel_dialog(pdialog->pplayer);
+  } dialog_list_iterate_end;
+}
+
+/****************************************************************************
+  Update the intelligence dialog for the given player.  This is called by
+  the core client code when that player's information changes.
+****************************************************************************/
+void update_intel_dialog(struct player *p)
+{
+  struct intel_dialog *pdialog = get_intel_dialog(p);
+      
   struct GUI *pWindow = NULL, *pBuf = NULL, *pLast;
   SDL_Surface *pLogo = NULL;
   SDL_Surface *pText1, *pInfo, *pText2 = NULL;
@@ -80,239 +197,224 @@
   char cBuf[256];
   int i, n = 0, w = 0, h, count = 0, col;
   struct city *pCapital;
-    
-  if (pIntel_Dlg) {
-    return;
-  }
-     
-  h = WINDOW_TILE_HIGH + adj_size(3) + FRAME_WH;
       
-  pIntel_Dlg = MALLOC(sizeof(struct ADVANCED_DLG));
+  if (pdialog) {
+
+    /* save window position and delete old content */
+    if (pdialog->pdialog->pEndWidgetList) {
+      pdialog->pos_x = pdialog->pdialog->pEndWidgetList->size.x;
+      pdialog->pos_y = pdialog->pdialog->pEndWidgetList->size.y;
+        
+      popdown_window_group_dialog(pdialog->pdialog->pBeginWidgetList,
+                                            pdialog->pdialog->pEndWidgetList);
+    }
+        
+    h = WINDOW_TILE_HIGH + adj_size(3) + FRAME_WH;
   
-  pStr = create_str16_from_char(_("Foreign Intelligence Report") , 
adj_font(12));
-  pStr->style |= TTF_STYLE_BOLD;
-  
-  pWindow = create_window(NULL, pStr, adj_size(10), adj_size(10), 
WF_DRAW_THEME_TRANSPARENT);
+    pStr = create_str16_from_char(_("Foreign Intelligence Report") , 
adj_font(12));
+    pStr->style |= TTF_STYLE_BOLD;
     
-  pWindow->action = intel_window_dlg_callback;
-  set_wstate(pWindow , FC_WS_NORMAL);
-  w = MAX(w , pWindow->size.w);
-  
-  add_to_gui_list(ID_WINDOW, pWindow);
-  pIntel_Dlg->pEndWidgetList = pWindow;
-  /* ---------- */
-  /* exit button */
-  pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
-                                               WF_DRAW_THEME_TRANSPARENT);
-  w += pBuf->size.w + adj_size(10);
-  pBuf->action = exit_intel_dlg_callback;
-  set_wstate(pBuf, FC_WS_NORMAL);
-  pBuf->key = SDLK_ESCAPE;
-  
-  add_to_gui_list(ID_BUTTON, pBuf);
-  /* ---------- */
-  
-  pLogo = GET_SURF(get_nation_flag_sprite(tileset, pPlayer->nation));
-  pLogo = make_flag_surface_smaler(pLogo);
-  
-  pText1 = ZoomSurface(pLogo, 4.0 , 4.0, 1);
-  FREESURFACE(pLogo);
-  pLogo = pText1;
-  SDL_SetColorKey(pLogo,
-        SDL_SRCCOLORKEY|SDL_RLEACCEL, getpixel(pLogo, pLogo->w - 1, pLogo->h - 
1));
-       
-  pBuf = create_icon2(pLogo, pWindow->dst,
-       (WF_DRAW_THEME_TRANSPARENT|WF_WIDGET_HAS_INFO_LABEL|
-                                       WF_FREE_STRING|WF_FREE_THEME));
-  pBuf->action = spaceship_callback;
-  set_wstate(pBuf, FC_WS_NORMAL);
-  pBuf->data.player = pPlayer;
-  my_snprintf(cBuf, sizeof(cBuf),
-             _("Intelligence Information about %s Spaceship"), 
-                                       get_nation_name(pPlayer->nation));
-  pBuf->string16 = create_str16_from_char(cBuf, adj_font(12));
-       
-  add_to_gui_list(ID_ICON, pBuf);
-       
-  /* ---------- */
-  my_snprintf(cBuf, sizeof(cBuf),
-             _("Intelligence Information for the %s Empire"), 
-                                       get_nation_name(pPlayer->nation));
-  
-  pStr = create_str16_from_char(cBuf, adj_font(14));
-  pStr->style |= TTF_STYLE_BOLD;
-  pStr->render = 3;
-  pStr->bgcol.unused = 128;
-  
-  pText1 = create_text_surf_from_str16(pStr);
-  SDL_SetAlpha(pText1, 0x0, 0x0);
-  w = MAX(w, pText1->w + adj_size(20));
-  h += pText1->h + adj_size(20);
+    pWindow = create_window(NULL, pStr, adj_size(10), adj_size(10), 
WF_DRAW_THEME_TRANSPARENT);
+      
+    pWindow->action = intel_window_dlg_callback;
+    set_wstate(pWindow , FC_WS_NORMAL);
+    pWindow->data.player = p;
+    w = MAX(w , pWindow->size.w);
     
-  /* ---------- */
-  
-  pCapital = find_palace(pPlayer);
-  struct player_research* research = get_player_research(pPlayer);
-  change_ptsize16(pStr, adj_font(10));
-  pStr->style &= ~TTF_STYLE_BOLD;
-  if (research->researching != A_NOINFO) {
+    add_to_gui_list(ID_WINDOW, pWindow);
+    pdialog->pdialog->pEndWidgetList = pWindow;
+    /* ---------- */
+    /* exit button */
+    pBuf = create_themeicon(pTheme->Small_CANCEL_Icon, pWindow->dst,
+                                                  WF_DRAW_THEME_TRANSPARENT);
+    w += pBuf->size.w + adj_size(10);
+    pBuf->action = exit_intel_dlg_callback;
+    set_wstate(pBuf, FC_WS_NORMAL);
+    pBuf->data.player = p;  
+    pBuf->key = SDLK_ESCAPE;
+    
+    add_to_gui_list(ID_BUTTON, pBuf);
+    /* ---------- */
+    
+    pLogo = GET_SURF(get_nation_flag_sprite(tileset, p->nation));
+    pLogo = make_flag_surface_smaler(pLogo);
+    
+    pText1 = ZoomSurface(pLogo, 4.0 , 4.0, 1);
+    FREESURFACE(pLogo);
+    pLogo = pText1;
+    SDL_SetColorKey(pLogo,
+          SDL_SRCCOLORKEY|SDL_RLEACCEL, getpixel(pLogo, pLogo->w - 1, pLogo->h 
- 1));
+          
+    pBuf = create_icon2(pLogo, pWindow->dst,
+          (WF_DRAW_THEME_TRANSPARENT|WF_WIDGET_HAS_INFO_LABEL|
+                                          WF_FREE_STRING|WF_FREE_THEME));
+    pBuf->action = spaceship_callback;
+    set_wstate(pBuf, FC_WS_NORMAL);
+    pBuf->data.player = p;
     my_snprintf(cBuf, sizeof(cBuf),
-      _("Ruler: %s %s  Government: %s\nCapital: %s  Gold: %d\nTax: %d%%"
-        " Science: %d%% Luxury: %d%%\nResearching: %s(%d/%d)"),
-      get_ruler_title(pPlayer->government, pPlayer->is_male, pPlayer->nation),
-      pPlayer->name, get_government_name(pPlayer->government),
-      (!pCapital) ? _("(Unknown)") : pCapital->name, pPlayer->economic.gold,
-      pPlayer->economic.tax, pPlayer->economic.science, 
pPlayer->economic.luxury,
-      get_tech_name(pPlayer, research->researching),
-      research->bulbs_researched, total_bulbs_required(pPlayer));
-  } else {
+                _("Intelligence Information about %s Spaceship"), 
+                                          get_nation_name(p->nation));
+    pBuf->string16 = create_str16_from_char(cBuf, adj_font(12));
+          
+    add_to_gui_list(ID_ICON, pBuf);
+          
+    /* ---------- */
     my_snprintf(cBuf, sizeof(cBuf),
-      _("Ruler: %s %s  Government: %s\nCapital: %s  Gold: %d\nTax: %d%%"
-        " Science: %d%% Luxury: %d%%\nResearching: Unknown"),
-      get_ruler_title(pPlayer->government, pPlayer->is_male, pPlayer->nation),
-      pPlayer->name, get_government_name(pPlayer->government),
-      (!pCapital) ? _("(Unknown)") : pCapital->name, pPlayer->economic.gold,
-      pPlayer->economic.tax, pPlayer->economic.science, 
pPlayer->economic.luxury);
-  }
-  
-  copy_chars_to_string16(pStr, cBuf);
-  pInfo = create_text_surf_from_str16(pStr);
-  SDL_SetAlpha(pInfo, 0x0, 0x0);
-  w = MAX(w, pLogo->w + adj_size(10) + pInfo->w + adj_size(20));
-  h += MAX(pLogo->h + adj_size(20), pInfo->h + adj_size(20));
+                _("Intelligence Information for the %s Empire"), 
+                                          get_nation_name(p->nation));
     
-  /* ---------- */
-  col = w / (get_tech_icon(A_FIRST)->w + adj_size(4));
-  n = 0;
-  pLast = pBuf;
-  for(i = A_FIRST; i<game.control.num_tech_types; i++) {
-    if(get_invention(pPlayer, i) == TECH_KNOWN &&
-      tech_is_available(game.player_ptr, i) &&
-      get_invention(game.player_ptr, i) != TECH_KNOWN) {
+    pStr = create_str16_from_char(cBuf, adj_font(14));
+    pStr->style |= TTF_STYLE_BOLD;
+    pStr->render = 3;
+    pStr->bgcol.unused = 128;
+    
+    pText1 = create_text_surf_from_str16(pStr);
+    SDL_SetAlpha(pText1, 0x0, 0x0);
+    w = MAX(w, pText1->w + adj_size(20));
+    h += pText1->h + adj_size(20);
       
-      pBuf = create_icon2(get_tech_icon(i), pWindow->dst,
-       (WF_DRAW_THEME_TRANSPARENT|WF_WIDGET_HAS_INFO_LABEL|WF_FREE_STRING));
-      pBuf->action = tech_callback;
-      set_wstate(pBuf, FC_WS_NORMAL);
-
-      pBuf->string16 = create_str16_from_char(advances[i].name, adj_font(12));
-       
-      add_to_gui_list(ID_ICON, pBuf);
-       
-      if(n > ((2 * col) - 1)) {
-       set_wflag(pBuf, WF_HIDDEN);
-      }
+    /* ---------- */
+    
+    pCapital = find_palace(p);
+    struct player_research* research = get_player_research(p);
+    change_ptsize16(pStr, adj_font(10));
+    pStr->style &= ~TTF_STYLE_BOLD;
+    if (research->researching != A_NOINFO) {
+      my_snprintf(cBuf, sizeof(cBuf),
+        _("Ruler: %s %s  Government: %s\nCapital: %s  Gold: %d\nTax: %d%%"
+          " Science: %d%% Luxury: %d%%\nResearching: %s(%d/%d)"),
+        get_ruler_title(p->government, p->is_male, p->nation),
+        p->name, get_government_name(p->government),
+        (!pCapital) ? _("(Unknown)") : pCapital->name, p->economic.gold,
+        p->economic.tax, p->economic.science, p->economic.luxury,
+        get_tech_name(p, research->researching),
+        research->bulbs_researched, total_bulbs_required(p));
+    } else {
+      my_snprintf(cBuf, sizeof(cBuf),
+        _("Ruler: %s %s  Government: %s\nCapital: %s  Gold: %d\nTax: %d%%"
+          " Science: %d%% Luxury: %d%%\nResearching: Unknown"),
+        get_ruler_title(p->government, p->is_male, p->nation),
+        p->name, get_government_name(p->government),
+        (!pCapital) ? _("(Unknown)") : pCapital->name, p->economic.gold,
+        p->economic.tax, p->economic.science, p->economic.luxury);
+    }
+    
+    copy_chars_to_string16(pStr, cBuf);
+    pInfo = create_text_surf_from_str16(pStr);
+    SDL_SetAlpha(pInfo, 0x0, 0x0);
+    w = MAX(w, pLogo->w + adj_size(10) + pInfo->w + adj_size(20));
+    h += MAX(pLogo->h + adj_size(20), pInfo->h + adj_size(20));
       
-      n++;     
-    }
-  }
+    /* ---------- */
+    col = w / (get_tech_icon(A_FIRST)->w + adj_size(4));
+    n = 0;
+    pLast = pBuf;
+    for(i = A_FIRST; i<game.control.num_tech_types; i++) {
+      if(get_invention(p, i) == TECH_KNOWN &&
+        tech_is_available(game.player_ptr, i) &&
+        get_invention(game.player_ptr, i) != TECH_KNOWN) {
+        
+        pBuf = create_icon2(get_tech_icon(i), pWindow->dst,
+          (WF_DRAW_THEME_TRANSPARENT|WF_WIDGET_HAS_INFO_LABEL|WF_FREE_STRING));
+        pBuf->action = tech_callback;
+        set_wstate(pBuf, FC_WS_NORMAL);
   
-  pIntel_Dlg->pBeginWidgetList = pBuf;
-  
-  if(n) {
-    pIntel_Dlg->pBeginActiveWidgetList = pBuf;
-    pIntel_Dlg->pEndActiveWidgetList = pLast->prev;
-    if(n > 2 * col) {
-      pIntel_Dlg->pActiveWidgetList = pLast->prev;
-      count = create_vertical_scrollbar(pIntel_Dlg, col, 2, TRUE, TRUE);
-      h += (2 * pBuf->size.h + adj_size(10));
-    } else {
-      count = 0;
-      if(n > col) {
-       h += pBuf->size.h;
+        pBuf->string16 = create_str16_from_char(advances[i].name, 
adj_font(12));
+          
+        add_to_gui_list(ID_ICON, pBuf);
+          
+        if(n > ((2 * col) - 1)) {
+          set_wflag(pBuf, WF_HIDDEN);
+        }
+        
+        n++;   
       }
-      h += (adj_size(10) + pBuf->size.h);
     }
     
-    w = MAX(w, col * pBuf->size.w + count + DOUBLE_FRAME_WH);
+    pdialog->pdialog->pBeginWidgetList = pBuf;
     
-    my_snprintf(cBuf, sizeof(cBuf), _("Their techs that we don't have :"));
-    copy_chars_to_string16(pStr, cBuf);
-    pStr->style |= TTF_STYLE_BOLD;
-    pText2 = create_text_surf_from_str16(pStr);
-    SDL_SetAlpha(pText2, 0x0, 0x0);    
-  }
-  
-  FREESTRING16(pStr);
-  
-  /* ------------------------ */  
-  pWindow->size.x = (Main.screen->w - w) / 2;
-  pWindow->size.y = (Main.screen->h - h) / 2;
-  
-  resize_window(pWindow, NULL, NULL, w, h);
-  
-  /* exit button */
-  pBuf = pWindow->prev; 
-  pBuf->size.x = pWindow->size.x + pWindow->size.w - pBuf->size.w - FRAME_WH - 
1;
-  pBuf->size.y = pWindow->size.y + 1;
-  
-  dst.x = (pWindow->size.w - pText1->w) / 2;
-  dst.y = WINDOW_TILE_HIGH + adj_size(12);
-  
-  SDL_BlitSurface(pText1, NULL, pWindow->theme, &dst);
-  dst.y += pText1->h + adj_size(10);
-  FREESURFACE(pText1);
-  
-  /* space ship button */
-  pBuf = pBuf->prev;
-  dst.x = (pWindow->size.w - (pBuf->size.w + adj_size(10) + pInfo->w)) / 2;
-  pBuf->size.x = pWindow->size.x + dst.x;
-  pBuf->size.y = pWindow->size.y + dst.y;
-  
-  dst.x += pBuf->size.w + adj_size(10);  
-  SDL_BlitSurface(pInfo, NULL, pWindow->theme, &dst);
-  dst.y += pInfo->h + adj_size(10);
-  FREESURFACE(pInfo);
+    if(n) {
+      pdialog->pdialog->pBeginActiveWidgetList = pBuf;
+      pdialog->pdialog->pEndActiveWidgetList = pLast->prev;
+      if(n > 2 * col) {
+        pdialog->pdialog->pActiveWidgetList = pLast->prev;
+        count = create_vertical_scrollbar(pdialog->pdialog, col, 2, TRUE, 
TRUE);
+        h += (2 * pBuf->size.h + adj_size(10));
+      } else {
+        count = 0;
+        if(n > col) {
+          h += pBuf->size.h;
+        }
+        h += (adj_size(10) + pBuf->size.h);
+      }
       
-  /* --------------------- */
+      w = MAX(w, col * pBuf->size.w + count + DOUBLE_FRAME_WH);
+      
+      my_snprintf(cBuf, sizeof(cBuf), _("Their techs that we don't have :"));
+      copy_chars_to_string16(pStr, cBuf);
+      pStr->style |= TTF_STYLE_BOLD;
+      pText2 = create_text_surf_from_str16(pStr);
+      SDL_SetAlpha(pText2, 0x0, 0x0);    
+    }
     
-  if(n) {
+    FREESTRING16(pStr);
     
-    dst.x = FRAME_WH + adj_size(5);
-    SDL_BlitSurface(pText2, NULL, pWindow->theme, &dst);
-    dst.y += pText2->h + adj_size(2);
-    FREESURFACE(pText2);
+    /* ------------------------ */  
+    pWindow->size.x = (pdialog->pos_x) ? (pdialog->pos_x) : ((Main.screen->w - 
w) / 2);
+    pWindow->size.y = (pdialog->pos_y) ? (pdialog->pos_y) : ((Main.screen->h - 
h) / 2);
     
-    setup_vertical_widgets_position(col,
-       pWindow->size.x + FRAME_WH,
-       pWindow->size.y + dst.y,
-         0, 0, pIntel_Dlg->pBeginActiveWidgetList,
-                         pIntel_Dlg->pEndActiveWidgetList);
+    resize_window(pWindow, NULL, NULL, w, h);
     
-    if(pIntel_Dlg->pScroll) {
-      setup_vertical_scrollbar_area(pIntel_Dlg->pScroll,
-       pWindow->size.x + pWindow->size.w - FRAME_WH,
-       pWindow->size.y + dst.y,
-       pWindow->size.h - (dst.y + FRAME_WH + 1), TRUE);
+    /* exit button */
+    pBuf = pWindow->prev; 
+    pBuf->size.x = pWindow->size.x + pWindow->size.w - pBuf->size.w - FRAME_WH 
- 1;
+    pBuf->size.y = pWindow->size.y + 1;
+    
+    dst.x = (pWindow->size.w - pText1->w) / 2;
+    dst.y = WINDOW_TILE_HIGH + adj_size(12);
+    
+    SDL_BlitSurface(pText1, NULL, pWindow->theme, &dst);
+    dst.y += pText1->h + adj_size(10);
+    FREESURFACE(pText1);
+    
+    /* space ship button */
+    pBuf = pBuf->prev;
+    dst.x = (pWindow->size.w - (pBuf->size.w + adj_size(10) + pInfo->w)) / 2;
+    pBuf->size.x = pWindow->size.x + dst.x;
+    pBuf->size.y = pWindow->size.y + dst.y;
+    
+    dst.x += pBuf->size.w + adj_size(10);  
+    SDL_BlitSurface(pInfo, NULL, pWindow->theme, &dst);
+    dst.y += pInfo->h + adj_size(10);
+    FREESURFACE(pInfo);
+        
+    /* --------------------- */
+      
+    if(n) {
+      
+      dst.x = FRAME_WH + adj_size(5);
+      SDL_BlitSurface(pText2, NULL, pWindow->theme, &dst);
+      dst.y += pText2->h + adj_size(2);
+      FREESURFACE(pText2);
+      
+      setup_vertical_widgets_position(col,
+          pWindow->size.x + FRAME_WH,
+          pWindow->size.y + dst.y,
+            0, 0, pdialog->pdialog->pBeginActiveWidgetList,
+                            pdialog->pdialog->pEndActiveWidgetList);
+      
+      if(pdialog->pdialog->pScroll) {
+        setup_vertical_scrollbar_area(pdialog->pdialog->pScroll,
+          pWindow->size.x + pWindow->size.w - FRAME_WH,
+          pWindow->size.y + dst.y,
+          pWindow->size.h - (dst.y + FRAME_WH + 1), TRUE);
+      }
     }
-  }
+
+    redraw_group(pdialog->pdialog->pBeginWidgetList, 
pdialog->pdialog->pEndWidgetList, 0);
+    sdl_dirty_rect(pWindow->size);
+  
+    flush_dirty();
     
-  /* --------------------- */
-  /* redraw */
-  redraw_group(pIntel_Dlg->pBeginWidgetList, pWindow, 0);
-  sdl_dirty_rect(pWindow->size);
-  
-  flush_dirty();
-}
-
-/**************************************************************************
-  Popdown an intelligence dialog for the given player.
-**************************************************************************/
-void popdown_intel_dialog(void)
-{
-  if (pIntel_Dlg) {
-    popdown_window_group_dialog(pIntel_Dlg->pBeginWidgetList,
-                       pIntel_Dlg->pEndWidgetList);
-    FREE(pIntel_Dlg->pScroll);
-    FREE(pIntel_Dlg);
   }
 }
-
-/****************************************************************************
-  Update the intelligence dialog for the given player.  This is called by
-  the core client code when that player's information changes.
-****************************************************************************/
-void update_intel_dialog(struct player *p)
-{
-  /* PORTME */
-}
Index: client/gui-sdl/inteldlg.h
===================================================================
--- client/gui-sdl/inteldlg.h   (Revision 11395)
+++ client/gui-sdl/inteldlg.h   (Arbeitskopie)
@@ -15,6 +15,10 @@
 
 #include "inteldlg_g.h"
 
-void popdown_intel_dialog(void);
+void intel_dialog_init(void);
+void intel_dialog_done(void);
 
+void popdown_intel_dialog(struct player *p);
+void popdown_intel_dialogs(void);
+
 #endif                         /* FC__INTELDLG_H */

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11386) Should popup_intel_dialog be rewritten like popup_spaceship_dialog?, Christian Prochaska <=