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

« back to all changes in this revision

Viewing changes to client/gui-win32/gui_main.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:
15
15
#include <config.h>
16
16
#endif
17
17
 
 
18
#ifdef AUDIO_SDL
 
19
#include "SDL.h"
 
20
#endif
 
21
 
18
22
#include <windows.h>
19
23
#include <winsock.h>
20
24
#include <windowsx.h>
21
25
#include <commctrl.h>
22
26
#include <richedit.h>
23
27
 
 
28
/* utility */
24
29
#include "fciconv.h"
25
30
#include "fcintl.h"
26
 
#include "game.h"
27
31
#include "log.h"
28
 
#include "map.h"
29
32
#include "mem.h"
30
33
#include "netintf.h"
31
34
#include "shared.h"
32
35
#include "support.h"
 
36
 
 
37
/* common */
 
38
#include "game.h"
 
39
#include "map.h"
33
40
#include "version.h"
34
41
#include "timing.h"
35
42
 
 
43
/* client */
36
44
#include "chatline.h"
37
 
#include "civclient.h"
 
45
#include "client_main.h"
38
46
#include "climisc.h"
39
47
#include "clinet.h"
40
48
#include "colors.h"
41
49
#include "connectdlg.h"
42
50
#include "control.h"
43
51
#include "dialogs.h"
 
52
#include "editgui_g.h"
 
53
#include "ggz_g.h"
44
54
#include "gotodlg.h"
45
55
#include "gui_stuff.h"
46
56
#include "graphics.h"
94
104
 
95
105
extern int seconds_to_turndone;   
96
106
 
97
 
bool better_fog = TRUE;
98
 
bool enable_alpha = TRUE;
99
 
 
100
107
const static RECT textwin_size={0,1,0,100};
101
108
 
102
109
struct fcwin_box *main_win_box;
105
112
const char * const gui_character_encoding = NULL;
106
113
const bool gui_use_transliteration = TRUE;
107
114
 
108
 
client_option gui_options[] = {
109
 
  GEN_BOOL_OPTION_CB(better_fog,
110
 
                     N_("Better fog-of-war drawing"),
111
 
                     N_("If this is enabled then a better method is used for "
112
 
                        "drawing fog-of-war.  It is not any slower but will "
113
 
                        "consume about twice as much memory."),
114
 
                     COC_GRAPHICS, mapview_redraw_callback),
115
 
  GEN_BOOL_OPTION_CB(enable_alpha,
116
 
                     N_("Enable alpha blending"),
117
 
                     N_("If this is enabled, then alpha blending will be "
118
 
                        "used in rendering, instead of an ordered dither.  "
119
 
                        "If there is no hardware support for alpha "
120
 
                        "blending, this is much slower."),
121
 
                     COC_GRAPHICS, mapview_redraw_callback)
122
 
};
123
 
const int num_gui_options = ARRAY_SIZE(gui_options);
124
 
 
125
115
bool process_net_input(void);
126
116
 
127
117
struct callback {
535
525
              WM_SETFONT,(WPARAM) font_12arial,MAKELPARAM(TRUE,0)); 
536
526
  SendMessage(unit_info_label,
537
527
              WM_SETFONT,(WPARAM) font_12arial,MAKELPARAM(TRUE,0)); 
538
 
  append_output_window(_("Freeciv is free software and you are welcome to distribute copies of"
539
 
                         " it\nunder certain conditions; See the \"Copying\" item on the Help"
540
 
                         " menu.\nNow.. Go give'em hell!") );
 
528
  chat_welcome_message();
541
529
  hchatline=fcwin_box_add_edit(main_win_box,"",40,
542
530
                               IDOK, 
543
531
                               ES_WANTRETURN | ES_AUTOVSCROLL | ES_MULTILINE,
566
554
    FD_SET(net_input, &civfdset);
567
555
    tv.tv_sec = 0;
568
556
    tv.tv_usec = 0;
569
 
    if (my_select(1, &civfdset, NULL, NULL, &tv)) {
 
557
    if (fc_select(1, &civfdset, NULL, NULL, &tv)) {
570
558
      if (FD_ISSET(net_input, &civfdset)) {
571
559
        input_from_server(net_input);
572
560
        processed = TRUE;
600
588
 
601
589
}
602
590
 
 
591
/****************************************************************************
 
592
  Extra initializers for client options.
 
593
****************************************************************************/
 
594
void gui_options_extra_init(void)
 
595
{
 
596
  /* Nothing to do. */
 
597
}
 
598
 
603
599
static HINSTANCE hmsimg32;
604
600
 
605
601
/**************************************************************************
621
617
    if ((AlphaBlend = GetProcAddress(hmsimg32, "AlphaBlend"))) {
622
618
      /* fall through, do nothing */
623
619
    } else {
624
 
      freelog(LOG_NORMAL, "No AlphaBlend() in msimg32.dll, alpha blending disabled");
 
620
      freelog(LOG_TEST, "No AlphaBlend() in msimg32.dll, alpha blending disabled");
625
621
      return FALSE;
626
622
    }
627
623
  } else {
628
 
    freelog(LOG_NORMAL, "No msimg32.dll, alpha blending disabled");
 
624
    freelog(LOG_TEST, "No msimg32.dll, alpha blending disabled");
629
625
    return FALSE;
630
626
  }
631
627
 
632
628
  hdc = GetDC(map_window);
633
629
 
634
630
  if (GetDeviceCaps(hdc, BITSPIXEL) < 32) {
635
 
    freelog(LOG_NORMAL, "Not running in 32 bit color, alpha blending disabled");
 
631
    freelog(LOG_TEST, "Not running in 32 bit color, alpha blending disabled");
636
632
    ReleaseDC(map_window, hdc);
637
633
    return FALSE;
638
634
  }
642
638
#define SB_NONE 0
643
639
 
644
640
  if (GetDeviceCaps(hdc, SHADEBLENDCAPS) == SB_NONE) {
645
 
    freelog(LOG_NORMAL, "Device does not support alpha blending, alpha blending disabled");
 
641
    freelog(LOG_TEST, "Device does not support alpha blending, alpha blending disabled");
646
642
    ReleaseDC(map_window, hdc);
647
643
    return FALSE;
648
644
  }
712
708
  return TRUE;
713
709
}
714
710
 
715
 
/**************************************************************************
716
 
 
 
711
extern void anim_cursor(float time);
 
712
 
 
713
/**************************************************************************
 
714
  Entry point for whole freeciv client program.
 
715
**************************************************************************/
 
716
int main(int argc, char **argv)
 
717
{
 
718
  return client_main(argc, argv);
 
719
}
 
720
 
 
721
/**************************************************************************
 
722
  Entry point for GUI specific portion. Called from client_main()
717
723
**************************************************************************/
718
724
void
719
725
ui_main(int argc, char *argv[])
732
738
  InitCommonControls();
733
739
 
734
740
  have_AlphaBlend = test_alphablend();
735
 
  enable_alpha = have_AlphaBlend;
 
741
  gui_win32_enable_alpha = have_AlphaBlend;
736
742
 
737
743
  unitselect_init(freecivhinst);
738
744
  init_mapwindow();
752
758
 
753
759
  freecivaccel=my_create_menu_acceltable();
754
760
 
755
 
  set_client_state(C_S_PREPARING);
 
761
  set_client_state(C_S_DISCONNECTED);
756
762
 
757
763
  callbacks = callback_list_new();
758
764
 
808
814
 
809
815
  free_timer(anim_timer);
810
816
  free_timer(callback_timer);
811
 
  callback_list_unlink_all(callbacks);
812
 
  free(callbacks);
 
817
  callback_list_free(callbacks);
813
818
 
814
819
  FreeLibrary(hmsimg32);
815
820
}
823
828
}
824
829
 
825
830
/**************************************************************************
 
831
  Return our GUI type
 
832
**************************************************************************/
 
833
enum gui_type get_gui_type(void)
 
834
{
 
835
  return GUI_WIN32;
 
836
}
 
837
 
 
838
/**************************************************************************
826
839
 Update the connected users list at pregame state.
827
840
**************************************************************************/
828
841
void update_conn_list_dialog(void)
906
919
 
907
920
  callback_list_prepend(callbacks, cb);
908
921
}
 
922
 
 
923
/****************************************************************************
 
924
  Stub for editor function
 
925
****************************************************************************/
 
926
void editgui_tileset_changed(void)
 
927
{}
 
928
 
 
929
/****************************************************************************
 
930
  Stub for editor function
 
931
****************************************************************************/
 
932
void editgui_refresh(void)
 
933
{}
 
934
 
 
935
/****************************************************************************
 
936
  Stub for editor function
 
937
****************************************************************************/
 
938
void editgui_popup_properties(const struct tile_list *tiles, int objtype)
 
939
{}
 
940
 
 
941
/****************************************************************************
 
942
  Stub for editor function
 
943
****************************************************************************/
 
944
void editgui_popdown_all(void)
 
945
{}
 
946
 
 
947
/****************************************************************************
 
948
  Stub for editor function
 
949
****************************************************************************/
 
950
void editgui_notify_object_changed(int objtype, int object_id, bool remove)
 
951
{}
 
952
 
 
953
/****************************************************************************
 
954
  Stub for editor function
 
955
****************************************************************************/
 
956
void editgui_notify_object_created(int tag, int id)
 
957
{}
 
958
 
 
959
/****************************************************************************
 
960
  Stub for ggz function
 
961
****************************************************************************/
 
962
void gui_ggz_embed_leave_table(void)
 
963
{}
 
964
 
 
965
/****************************************************************************
 
966
  Stub for ggz function
 
967
****************************************************************************/
 
968
void gui_ggz_embed_ensure_server(void)
 
969
{}
 
970
 
 
971
 
 
972
/**************************************************************************
 
973
  Updates a gui font style.
 
974
**************************************************************************/
 
975
void gui_update_font(const char *font_name, const char *font_value)
 
976
{
 
977
  /* PORTME */
 
978
}