ReconnectDialog::ReconnectDialog():
	wxDialog( (wxFrame*)&ui().mw(), -1, _( "Reconnect Dialog" ), wxDefaultPosition, wxSize( 400, 150 ), wxRESIZE_BORDER | wxDEFAULT_DIALOG_STYLE ),
	WindowAttributesPickle( _T("reconnectdialog"), this, wxSize( 400, 150 ) )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	SetSizeHints( wxDefaultSize, wxDefaultSize );

	wxBoxSizer* m_main_sizer = new wxBoxSizer( wxVERTICAL );

	wxBoxSizer* m_buttons_sizer;
	m_buttons_sizer = new wxBoxSizer( wxHORIZONTAL );

	wxButton* m_retry_btn = new wxButton( this, CONNECT_RECONNECT, _( "Try Reconnecting" ), wxDefaultPosition, wxDefaultSize, 0 );
	m_retry_btn->SetToolTip( TE( _( "Tries to connect to the next server in the list." ) ) );
	m_buttons_sizer->Add( m_retry_btn, 0, wxALL, 5 );

	wxButton* m_next_btn = new wxButton( this, CONNECT_NEXT, _( "Try Next Server" ), wxDefaultPosition, wxDefaultSize, 0 );
	m_next_btn->SetToolTip( TE( _( "Tries to connect to the next server in the list." ) ) );
	m_buttons_sizer->Add( m_next_btn, 0, wxALL, 5 );

	wxButton* m_cancel_btn = new wxButton( this, CONNECT_CANCEL, _( "Do nothing" ), wxDefaultPosition, wxDefaultSize, 0 );
	m_buttons_sizer->Add( m_cancel_btn, 0, wxALL, 5 );

	m_main_sizer->Add( CreateTextSizer( _( "Couldn't estabilish a connection with the server\nWhat would you like to do?" ) ), 1, wxALL | wxEXPAND | wxCENTER, 10 );
	m_main_sizer->Add( m_buttons_sizer, 1, wxALL | wxEXPAND | wxCENTER, 10 );

	SetSizer( m_main_sizer );
	SetAutoLayout( true );
	Raise();
	m_next_btn->SetFocus();
	ConnectGlobalEvent(this, GlobalEvent::OnQuit, wxObjectEventFunction(&ReconnectDialog::OnQuit));
}
Beispiel #2
0
Battle::Battle( IServer& serv, int id ) :
		m_serv(serv),
        m_ah(*this),
        m_autolock_on_start(false),
        m_id( id )
{
	ConnectGlobalEvent(this, GlobalEvent::OnUnitsyncReloaded, wxObjectEventFunction(&Battle::OnUnitsyncReloaded));
    m_opts.battleid =  m_id;
}
SinglePlayerBattle::SinglePlayerBattle( MainSinglePlayerTab& msptab ):
  m_sptab(msptab),
  m_me( User(sett().GetDefaultNick()))
{
	OnUserAdded( m_me );
	m_me.BattleStatus().side = sett().GetBattleLastSideSel( GetHostModName() );
	m_me.BattleStatus().colour = sett().GetBattleLastColour();
    CustomBattleOptions().setSingleOption( "startpostype", LSL::Util::ToString(ST_Pick), LSL::OptionsWrapper::EngineOption );
	ConnectGlobalEvent(this, GlobalEvent::OnUnitsyncReloaded, wxObjectEventFunction(&SinglePlayerBattle::OnUnitsyncReloaded));
}
BattleRoomTab::BattleRoomTab(wxWindow* parent, IBattle* battle)
    : wxScrolledWindow(parent, -1)
    , m_battle(battle)
    , m_BattleActionSink(this, &UiEvents::GetUiEventSender(UiEvents::OnBattleActionEvent))
{
	GetAui().manager->AddPane(this, wxLEFT, _T( "battleroomtab" ));

	// Create all widgets
	m_splitter = new wxSplitterWindow(this, -1, wxDefaultPosition, wxSize(100, 60));

	m_player_panel = new wxScrolledWindow(m_splitter, -1);
	m_player_panel->SetScrollRate(SCROLL_RATE, SCROLL_RATE);
	m_team_sel = new wxComboBox(m_player_panel, BROOM_TEAMSEL, _T( "1" ), wxDefaultPosition, wxSize(50, CONTROL_HEIGHT), team_choices);
	m_team_sel->SetToolTip(_("Players with the same team number share control of their units."));
	m_ally_sel = new wxComboBox(m_player_panel, BROOM_ALLYSEL, _T( "1" ), wxDefaultPosition, wxSize(50, CONTROL_HEIGHT), ally_choices);
	m_ally_sel->SetToolTip(_("Players with the same ally number work together to achieve victory."));
	m_color_sel = new ColorButton(m_player_panel, BROOM_COLOURSEL, wxColour(0, 0, 0), wxDefaultPosition, wxSize(-1, CONTROL_HEIGHT));
	m_color_sel->SetToolTip(_("Select a color to identify your units in-game"));
	m_side_sel = new wxBitmapComboBox(m_player_panel, BROOM_SIDESEL, wxEmptyString, wxDefaultPosition, wxSize(-1, CONTROL_HEIGHT), wxArrayString(), wxCB_READONLY);
	m_side_sel->SetToolTip(_("Select your faction"));
	m_spec_chk = new wxCheckBox(m_player_panel, BROOM_SPEC, _("Spectator"), wxDefaultPosition, wxSize(-1, CONTROL_HEIGHT));
	m_spec_chk->SetToolTip(_("Spectate (watch) the battle instead of playing"));
	m_auto_unspec_chk = new wxCheckBox(m_player_panel, BROOM_UNSPEC, _("Auto un-spectate"), wxDefaultPosition, wxSize(-1, CONTROL_HEIGHT));
	m_auto_unspec_chk->SetToolTip(_("automatically unspec when there's a free slot"));
	m_ready_chk = new wxCheckBox(m_player_panel, BROOM_IMREADY, _("I'm ready"), wxDefaultPosition, wxSize(-1, CONTROL_HEIGHT));
	m_ready_chk->SetToolTip(_("Click this if you are content with the battle settings."));

	m_team_lbl = new wxStaticText(m_player_panel, -1, _("Team"));
	m_ally_lbl = new wxStaticText(m_player_panel, -1, _("Ally"));
	m_color_lbl = new wxStaticText(m_player_panel, -1, _("Color"));
	m_side_lbl = new wxStaticText(m_player_panel, -1, _("Side"));

	m_ally_setup_lbl = new wxStaticText(m_player_panel, -1, _T("0"));
	m_specs_setup_lbl = new wxStaticText(m_player_panel, -1, _T("0"));
	m_players_setup_lbl = new wxStaticText(m_player_panel, -1, _T("0"));
	m_ok_count_lbl = new wxStaticText(m_player_panel, -1, _T("0"));

	m_map_combo = new wxComboBox(this, BROOM_MAP_SEL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayString(), wxCB_READONLY);

	m_minimap = new MapCtrl(this, 162, m_battle, true, true, false);
	m_minimap->SetToolTip(_("A preview of the selected map.  You can see the starting positions, or (if set) starting boxes."));

	m_browse_map_btn = new wxButton(this, BROOM_MAP_BROWSE, _("Map"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
	//m_browse_map_btn->SetSize( m_browse_map_btn->GetSize().GetWidth() * 2 , m_browse_map_btn->GetSize().GetHeight() ) ; // has 0 effect

	m_players = new BattleroomListCtrl(m_player_panel, m_battle, false, true);
	m_chat = new ChatPanel(m_splitter, m_battle);

	m_command_line = new wxStaticLine(this, -1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);

	m_host_new_btn = new wxButton(this, BROOM_HOST_NEW, _("Host new"), wxDefaultPosition, wxDefaultSize);
	m_host_new_btn->SetToolTip(_("Host a new battle"));
	m_leave_btn = new wxButton(this, BROOM_LEAVE, _("Leave"), wxDefaultPosition, wxSize(-1, CONTROL_HEIGHT));
	m_leave_btn->SetToolTip(_("Leave the battle and return to the battle list"));
	m_start_btn = new wxButton(this, BROOM_START, _("Start"), wxDefaultPosition, wxSize(-1, CONTROL_HEIGHT));
	m_start_btn->SetToolTip(_("Start the battle"));

	m_manage_players_btn = new wxButton(this, BROOM_MANAGE_MENU, _("Player Management"), wxDefaultPosition, wxSize(-1, CONTROL_HEIGHT));
	m_manage_players_btn->SetToolTip(_("Various functions to make team games simplers to setup"));

	m_addbot_btn = new wxButton(this, BROOM_ADDBOT, _("Add Bot..."), wxDefaultPosition, wxSize(-1, CONTROL_HEIGHT));
	m_addbot_btn->SetToolTip(_("Add a computer-controlled player to the game"));
	m_autolock_chk = new wxCheckBox(this, BROOM_AUTOLOCK, _("Autolock on start"), wxDefaultPosition, wxSize(-1, CONTROL_HEIGHT));
	m_autolock_chk->SetToolTip(_("Automatically locks the battle when the game starts and unlock when it's finished."));
	m_autolock_chk->SetValue(sett().GetLastAutolockStatus());

	m_lock_chk = new wxCheckBox(this, BROOM_LOCK, _("Locked"), wxDefaultPosition, wxSize(-1, CONTROL_HEIGHT));
	m_lock_chk->SetToolTip(_("Prevent additional players from joining the battle"));

	m_manage_users_mnu = new wxMenu();

	m_autohost_mnu = new wxMenuItem(m_manage_users_mnu, BROOM_AUTOHOST, _("Autohost"), _("Toggle autohost mode.  This allows players to control your battle using commands like '!balance' and '!start'."), wxITEM_CHECK);
	m_manage_users_mnu->Append(m_autohost_mnu);
	m_autohost_mnu->Check(false);


	m_autopaste_mnu = new wxMenuItem(m_manage_users_mnu, BROOM_AUTOPASTE, _("AutoPaste Description"), _("Automatically paste battle's descriptoin when a new user joins"), wxITEM_CHECK);
	m_manage_users_mnu->Append(m_autopaste_mnu);
	m_autopaste_mnu->Check(sett().GetBattleLastAutoAnnounceDescription());
	m_autospec_mnu = new wxMenuItem(m_manage_users_mnu, BROOM_AUTOSPECT, _("AutoSpect"), _("Automatically spectate players that don't ready up or become synced within x seconds."), wxITEM_CHECK);
	m_manage_users_mnu->Append(m_autospec_mnu);
	m_autospec_mnu->Check(sett().GetBattleLastAutoSpectTime() > 0);
	m_autocontrol_mnu = new wxMenuItem(m_manage_users_mnu, BROOM_AUTOCONTROL, _("AutoControlBalance"), _("Automatically balance teams and allies and fix colors when all players are ready and synced"), wxITEM_CHECK);
	m_manage_users_mnu->Append(m_autocontrol_mnu);
	m_autocontrol_mnu->Check(sett().GetBattleLastAutoControlState());
	m_autostart_mnu = new wxMenuItem(m_manage_users_mnu, BROOM_AUTOSTART, _("AutoStart"), _("Automatically start the battle when all players are ready and synced"), wxITEM_CHECK);
	m_manage_users_mnu->Append(m_autostart_mnu);
	m_autostart_mnu->Check(sett().GetBattleLastAutoStartState());

	m_lock_balance_mnu = new wxMenuItem(m_manage_users_mnu, BROOM_LOCK_BALANCE, _("Lock Balance"), _("When activated, prevents anyone but the host to change team and ally"), wxITEM_CHECK);
	m_manage_users_mnu->Append(m_lock_balance_mnu);
	m_lock_balance_mnu->Check(false);

	wxMenu* ring_menu = new wxMenu;
	wxMenuItem* ring_unready = new wxMenuItem(ring_menu, BROOM_RING_UNREADY, _("Ring unready"), _("Rings all players that don't have ready status and aren't spectators"));
	ring_menu->Append(ring_unready);
	wxMenuItem* ring_unsynced = new wxMenuItem(ring_menu, BROOM_RING_UNSYNC, _("Ring unsynced"), _("Rings all players that don't have sync status and aren't spectators"));
	ring_menu->Append(ring_unsynced);
	wxMenuItem* ring_unready_unsynced = new wxMenuItem(ring_menu, BROOM_RING_UNREADY_UNSYNC, _("Ring unready and unsynced"), _("Rings all players that don't have sync status or don't have ready status and aren't spectators"));
	ring_menu->Append(ring_unready_unsynced);
	m_manage_users_mnu->Append(wxID_ANY, _("Ring ..."), ring_menu);

	wxMenu* spect_menu = new wxMenu;
	wxMenuItem* spect_unready = new wxMenuItem(spect_menu, BROOM_SPECT_UNREADY, _("Spect unready"), _("Force to spectate all players that don't have ready status"));
	spect_menu->Append(spect_unready);
	wxMenuItem* spect_unsynced = new wxMenuItem(spect_menu, BROOM_SPECT_UNSYNC, _("Spect unsynced"), _("Force to spectate all players that don't have sync status"));
	spect_menu->Append(spect_unsynced);
	wxMenuItem* spect_unready_unsynced = new wxMenuItem(spect_menu, BROOM_SPECT_UNREADY_UNSYNC, _("Force to spectate unready and unsynced"), _("Rings all players that don't have sync status or don't have ready status"));
	spect_menu->Append(spect_unready_unsynced);
	m_manage_users_mnu->Append(wxID_ANY, _("Force spectate ..."), spect_menu);

	wxMenuItem* m_balance_mnu = new wxMenuItem(m_manage_users_mnu, BROOM_BALANCE, _("Balance alliances"), _("Automatically balance players into two or more alliances"));
	m_manage_users_mnu->Append(m_balance_mnu);

	wxMenuItem* m_fix_colours_mnu = new wxMenuItem(m_manage_users_mnu, BROOM_FIXCOLOURS, _("Fix colours"), _("Make player colors unique"));
	m_manage_users_mnu->Append(m_fix_colours_mnu);

	wxMenuItem* m_fix_team_mnu = new wxMenuItem(m_manage_users_mnu, BROOM_FIXID, _("Balance teams"), _("Automatically balance players into control teams, by default none shares control"));
	m_manage_users_mnu->Append(m_fix_team_mnu);

	wxStaticBoxSizer* m_preset_sizer;
	m_preset_sizer = new wxStaticBoxSizer(new wxStaticBox(this, 0, _("Manage Presets")), wxVERTICAL);

	wxBoxSizer* m_preset_btns_sizer;
	m_preset_btns_sizer = new wxBoxSizer(wxHORIZONTAL);

	m_options_preset_sel = new wxComboBox(this, BROOM_PRESETSEL, wxEmptyString, wxDefaultPosition, wxDefaultSize, sett().GetPresetList(), wxCB_READONLY);
	m_options_preset_sel->SetToolTip(_("Load battle preset"));

	m_preset_sizer->Add(m_options_preset_sel, 0, wxEXPAND | wxALL);

	m_save_btn = new wxButton(this, BROOM_SAVEPRES, _("Save"), wxDefaultPosition, wxDefaultSize);
	m_save_btn->SetToolTip(_("Save a set of options."));

	m_preset_btns_sizer->Add(m_save_btn, 0, wxEXPAND);

	m_delete_btn = new wxButton(this, BROOM_DELETEPRES, _("Delete"), wxDefaultPosition, wxDefaultSize);
	m_delete_btn->SetToolTip(_("Delete a set of options."));

	m_preset_btns_sizer->Add(m_delete_btn, 0, wxEXPAND);

	m_default_btn = new wxButton(this, BROOM_SETDEFAULTPRES, _("Set default"), wxDefaultPosition, wxDefaultSize);
	m_default_btn->SetToolTip(_("Use the current set of options as game's default."));

	m_preset_btns_sizer->Add(m_default_btn, 0, wxEXPAND);

	m_preset_sizer->Add(m_preset_btns_sizer, 0, wxEXPAND);


	m_opts_list = new wxListCtrl(this, BROOM_OPTIONLIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT);
	//m_opts_list->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
	m_opts_list->SetFont(wxFont(8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_LIGHT));
	m_opts_list->SetToolTip(_("Activate an element to quickly change it"));

	m_opts_list->InsertColumn(0, _("Option"), wxLIST_FORMAT_LEFT, 160);
	m_opts_list->InsertColumn(1, _("Value"), wxLIST_FORMAT_LEFT, 140);

	// Create Sizers
	m_players_sizer = new wxBoxSizer(wxVERTICAL);
	m_player_sett_sizer = new wxBoxSizer(wxHORIZONTAL);
	wxBoxSizer* m_map_select_sizer = new wxBoxSizer(wxHORIZONTAL);
	m_info_sizer = new wxBoxSizer(wxVERTICAL);
	m_top_sizer = new wxBoxSizer(wxHORIZONTAL);
	m_buttons_sizer = new wxBoxSizer(wxHORIZONTAL);
	//m_info1_sizer = new wxBoxSizer( wxHORIZONTAL );
	m_main_sizer = new wxBoxSizer(wxVERTICAL);

	// Put widgets in place
	m_player_sett_sizer->Add(m_team_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2);
	m_player_sett_sizer->Add(m_team_sel, 0, wxEXPAND | wxALL, 2);
	m_player_sett_sizer->Add(m_ally_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2);
	m_player_sett_sizer->Add(m_ally_sel, 0, wxEXPAND | wxALL, 2);
	m_player_sett_sizer->Add(m_color_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2);
	m_player_sett_sizer->Add(m_color_sel, 0, wxEXPAND | wxALL, 2);
	m_player_sett_sizer->Add(m_side_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 2);
	m_player_sett_sizer->Add(m_side_sel, 0, wxEXPAND | wxALL, 2);
	m_player_sett_sizer->Add(m_spec_chk, 0, wxEXPAND | wxALL, 2);
	m_player_sett_sizer->Add(m_auto_unspec_chk, 0, wxEXPAND | wxALL, 2);
	m_player_sett_sizer->Add(m_ready_chk, 0, wxEXPAND | wxALL, 2);
	m_player_sett_sizer->AddStretchSpacer();
	m_player_sett_sizer->Add((new wxGenericStaticBitmap(m_player_panel, wxID_ANY, icons().GetIcon(icons().ICON_SPECTATOR))), 0, (wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT) | wxALL, 2);
	m_player_sett_sizer->Add(m_specs_setup_lbl, 0, (wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT) | wxALL, 2);
	m_player_sett_sizer->Add((new wxGenericStaticBitmap(m_player_panel, wxID_ANY, icons().GetIcon(icons().ICON_PLAYER))), 0, (wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT) | wxALL, 2);
	m_player_sett_sizer->Add(m_players_setup_lbl, 0, (wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT) | wxALL, 2);
	m_player_sett_sizer->Add((new wxGenericStaticBitmap(m_player_panel, wxID_ANY, icons().GetIcon(icons().ICON_STARTED_GAME))), 0, (wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT) | wxALL, 2);
	m_player_sett_sizer->Add(m_ally_setup_lbl, 0, (wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT) | wxALL, 2);
	m_player_sett_sizer->Add((new wxGenericStaticBitmap(m_player_panel, wxID_ANY, icons().GetIcon(icons().ICON_NREADY))), 0, (wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT) | wxALL, 2);
	m_player_sett_sizer->Add(m_ok_count_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 2);

	m_players_sizer->Add(m_players, 1, wxEXPAND);
	m_players_sizer->Add(m_player_sett_sizer, 0, wxEXPAND);

	m_player_panel->SetSizer(m_players_sizer);

	SplitSizerHorizontally(sett().GetSplitBRoomHorizontally());

	//m_info1_sizer->Add( m_wind_lbl, 1, wxEXPAND );
	//m_info1_sizer->Add( m_size_lbl, 1, wxEXPAND );

	m_info_sizer->Add(m_minimap, 0, wxEXPAND);
	m_map_select_sizer->Add(m_map_combo, 0, wxALL | wxEXPAND, 2);
	m_map_select_sizer->Add(m_browse_map_btn, 0, wxALIGN_RIGHT | wxALL, 2);
	m_info_sizer->Add(m_map_select_sizer, 0, wxEXPAND | wxALL, 2);
	//m_info_sizer->Add( m_info1_sizer, 0, wxEXPAND );
	//m_info_sizer->Add( m_tidal_lbl, 0, wxEXPAND );
	m_info_sizer->Add(m_opts_list, 1, wxEXPAND | wxTOP, 4);
	m_info_sizer->Add(m_preset_sizer, 0, wxEXPAND, 4);


	m_top_sizer->Add(m_splitter, 1, wxEXPAND | wxALL, 2);
	m_top_sizer->Add(m_info_sizer, 0, wxEXPAND | wxALL, 2);

	m_buttons_sizer->AddStretchSpacer();
	m_buttons_sizer->Add(m_host_new_btn, 0, wxEXPAND | wxALL, 2);
	m_buttons_sizer->AddStretchSpacer();
	m_buttons_sizer->Add(m_leave_btn, 0, wxEXPAND | wxALL, 2);
	m_buttons_sizer->Add(m_addbot_btn, 0, wxEXPAND | wxALL, 2);
	m_buttons_sizer->Add(m_autolock_chk, 0, wxEXPAND | wxALL, 2);
	m_buttons_sizer->Add(m_lock_chk, 0, wxEXPAND | wxALL, 2);
	m_buttons_sizer->Add(m_manage_players_btn, 0, wxEXPAND | wxALL, 2);
	m_buttons_sizer->Add(m_start_btn, 0, wxEXPAND | wxALL, 2);

	m_main_sizer->Add(m_top_sizer, 1, wxEXPAND);
	m_main_sizer->Add(m_command_line, 0, wxEXPAND);
	m_main_sizer->Add(m_buttons_sizer, 0, wxEXPAND);

	m_splitter->SetMinimumPaneSize(240);

	SetBattle(battle);

	SetScrollRate(SCROLL_RATE, SCROLL_RATE);
	SetSizer(m_main_sizer);
	Layout();

	ConnectGlobalEvent(this, GlobalEvent::OnUnitsyncReloaded, wxObjectEventFunction(&BattleRoomTab::OnUnitsyncReloaded));
}
BattleListTab::BattleListTab(wxWindow* parent)
    : wxScrolledWindow(parent, -1)
    , m_sel_battle(0)
{
	GetAui().manager->AddPane(this, wxLEFT, _T( "battlelisttab" ));

	m_main_sizer = new wxBoxSizer(wxVERTICAL);

	wxBoxSizer* m_filter_sizer;
	m_filter_sizer = new wxBoxSizer(wxVERTICAL);


	m_battlelist_sizer = new wxBoxSizer(wxVERTICAL);

	m_battle_list = new BattleListCtrl(this);
	m_battle_list->SetHighLightAction(UserActions::ActHighlight);
	m_battlelist_sizer->Add(m_battle_list, 1, wxEXPAND);

	m_main_sizer->Add(m_battlelist_sizer, 1, wxEXPAND);

	m_info_sizer = new wxBoxSizer(wxHORIZONTAL);

	m_minimap = new MapCtrl(this, 100, 0, true, false, false);
	m_info_sizer->Add(m_minimap, 0, wxALL, 5);

	m_data_sizer = new wxFlexGridSizer(4, 2, 0, 0);

	m_map_lbl = new wxStaticText(this, wxID_ANY, _("Map:"), wxDefaultPosition, wxDefaultSize, 0);
	m_data_sizer->Add(m_map_lbl, 0, wxALL, 5);

	m_map_text = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
	m_data_sizer->Add(m_map_text, 0, wxALL, 5);

	m_mod_lbl = new wxStaticText(this, wxID_ANY, _("Game:"), wxDefaultPosition, wxDefaultSize, 0);
	m_data_sizer->Add(m_mod_lbl, 0, wxALL, 5);

	m_mod_text = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
	m_data_sizer->Add(m_mod_text, 0, wxALL, 5);

	m_players_lbl = new wxStaticText(this, wxID_ANY, _("Players:"), wxDefaultPosition, wxDefaultSize, 0);
	m_data_sizer->Add(m_players_lbl, 0, wxALL, 5);

	m_players_text = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
	m_data_sizer->Add(m_players_text, 0, wxALL, 5);

	m_spec_lbl = new wxStaticText(this, wxID_ANY, _("Spectators:"), wxDefaultPosition, wxDefaultSize, 0);
	m_data_sizer->Add(m_spec_lbl, 0, wxALL, 5);

	m_spec_text = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
	m_data_sizer->Add(m_spec_text, 0, wxALL, 5);

	m_info_sizer->Add(m_data_sizer, 1, wxEXPAND, 5);

	m_players = new NickListCtrl(this, false, 0, true, _T("battlelist_nicklist"));
	m_info_sizer->Add(m_players, 1, wxALL | wxEXPAND, 5);

	m_main_sizer->Add(m_info_sizer, 0, wxEXPAND, 5);


	m_filter = new BattleListFilter(this, wxID_ANY, this, wxDefaultPosition, wxSize(-1, -1), wxEXPAND);
	m_filter_sizer->Add(m_filter, 0, wxEXPAND, 5);

	m_main_sizer->Add(m_filter_sizer, 0, wxEXPAND, 5);

	m_buttons_sep = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);
	m_main_sizer->Add(m_buttons_sep, 0, wxALL | wxEXPAND, 5);

	wxBoxSizer* m_buttons_sizer;
	m_buttons_sizer = new wxBoxSizer(wxHORIZONTAL);

	m_buttons_sizer->Add(0, 0, 1, wxEXPAND, 0);

#if wxUSE_TOGGLEBTN
	m_filter_show = new wxToggleButton(this, BATTLE_LIST_FILTER_BUTTON, _(" Filter "), wxDefaultPosition, wxSize(-1, 28), 0);
#else
	m_filter_show = new wxCheckBox(this, BATTLE_LIST_FILTER_BUTTON, _(" Filter "), wxDefaultPosition, wxSize(-1, 28), 0);
#endif
	m_buttons_sizer->Add(m_filter_show, 0, 0, 5);

	m_filter_activ = new wxCheckBox(this, BATTLE_LIST_FILTER_ACTIV, _("Activated"), wxDefaultPosition, wxDefaultSize, 0);
	m_buttons_sizer->Add(m_filter_activ, 0, wxALL, 5);

#if wxUSE_TOGGLEBTN
	m_info_show = new wxToggleButton(this, BATTLE_LIST_INFO_BUTTON, _(" Battle infos "), wxDefaultPosition, wxSize(-1, 28), 0);
#else
	m_info_show = new wxCheckBox(this, BATTLE_LIST_INFO_BUTTON, _(" Battle infos "), wxDefaultPosition, wxSize(-1, 28), 0);
#endif
	m_buttons_sizer->Add(m_info_show, 0, 0, 5);

	m_battle_num = new wxStaticText(this, wxID_ANY, _("0 battles displayed"), wxDefaultPosition, wxDefaultSize, 0);
	m_buttons_sizer->Add(m_battle_num, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, 4);
	m_buttons_sizer->Add(0, 0, 1, wxEXPAND, 0);

	m_host_btn = new wxButton(this, BATTLE_HOST, _("Host new..."), wxDefaultPosition, wxSize(-1, 28), 0);
	m_buttons_sizer->Add(m_host_btn, 0, wxBOTTOM | wxLEFT | wxRIGHT, 5);

	m_join_btn = new wxButton(this, BATTLE_JOIN, _("Join"), wxDefaultPosition, wxSize(-1, 28), 0);
	m_buttons_sizer->Add(m_join_btn, 0, wxBOTTOM | wxRIGHT, 5);

	m_main_sizer->Add(m_buttons_sizer, 0, wxEXPAND, 5);

	m_filter->Hide();

	SetScrollRate(SCROLL_RATE, SCROLL_RATE);
	SetSizer(m_main_sizer);
	Layout();

	SelectBattle(0);
	ShowExtendedInfos(cfg().ReadBool(_T("/BattleListTab/ShowExtendedInfos")));
	ConnectGlobalEvent(this, GlobalEvent::OnUnitsyncReloaded, wxObjectEventFunction(&BattleListTab::OnUnitsyncReloaded));
}
SinglePlayerTab::SinglePlayerTab(wxWindow* parent, MainSinglePlayerTab& msptab):
        wxScrolledWindow( parent, -1 ),
        m_battle(msptab)
{
    GetAui().manager->AddPane( this, wxLEFT, _T("singleplayertab") );

    wxBoxSizer* m_main_sizer = new wxBoxSizer( wxVERTICAL );

    wxBoxSizer* m_mapabour_sizer = new wxBoxSizer( wxHORIZONTAL );

    wxBoxSizer* m_map_sizer = new wxBoxSizer( wxHORIZONTAL );
   // m_map_sizer->SetMinSize( wxSize( 352, -1 ) );

    m_minimap = new MapCtrl( this, 100, &m_battle, false, false, true, true );
    m_minimap->SetToolTip( TE(_("You can drag the sun/bot icon around to define start position.\n "
                                "Hover over the icon for a popup that lets you change side, ally and bonus." )) );
    m_map_sizer->Add( m_minimap, 1, wxALL | wxEXPAND, 2 );
    m_mapabour_sizer->Add(m_map_sizer, 1, wxEXPAND, 2 );

    //map description and parametrs like in battletab
    wxBoxSizer* m_opts_sizer = new wxBoxSizer( wxVERTICAL );

	m_map_opts_list = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxSize( 150, 160 ), wxLC_NO_HEADER | wxLC_REPORT );
	m_map_opts_list->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
	m_map_opts_list->SetFont( wxFont( 8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_LIGHT ) );

	wxListItem col;

	col.SetText( _( "Option" ) );
	m_map_opts_list->InsertColumn( 0, col );
	col.SetText( _( "Value" ) );
	m_map_opts_list->InsertColumn( 1, col );
	m_map_opts_list->SetColumnWidth( 0, 90 );
	m_map_opts_list->SetColumnWidth( 1, 50 );

	m_map_opts_list->InsertItem( 0, _( "Size" ) );
	m_map_opts_list->InsertItem( 1, _( "Windspeed" ) );
	m_map_opts_list->InsertItem( 2, _( "Tidal strength" ) );
	m_map_opts_list->InsertItem( 3, _( "Gravity" ) );
	m_map_opts_list->InsertItem( 4, _( "Extractor radius" ) );
	m_map_opts_list->InsertItem( 5, _( "Max metal" ) );

	m_opts_sizer->Add( m_map_opts_list, 0, wxALL, 2 );

    m_map_desc = new wxStaticText(this,-1,wxEmptyString);
    m_map_desc->Wrap(160);

    m_opts_sizer->Add( m_map_desc, 0, wxALL, 2 );
    m_mapabour_sizer->Add( m_opts_sizer, 0, wxALL | wxEXPAND, 2 );
    m_main_sizer->Add( m_mapabour_sizer, 1, wxEXPAND, 5 );

    wxBoxSizer* m_ctrl_sizer = new wxBoxSizer( wxHORIZONTAL );

    m_map_lbl = new wxStaticText( this, -1, _("Map:") );
    m_ctrl_sizer->Add( m_map_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );

    m_map_pick = new wxChoice( this, SP_MAP_PICK );
    m_ctrl_sizer->Add( m_map_pick, 1, wxALL, 5 );

    m_select_btn = new wxButton( this, SP_BROWSE_MAP, _T("..."), wxDefaultPosition, wxSize(CONTROL_HEIGHT, CONTROL_HEIGHT), wxBU_EXACTFIT );
    m_ctrl_sizer->Add( m_select_btn, 0, wxBOTTOM|wxRIGHT|wxTOP, 5 );

	m_mod_lbl = new wxStaticText( this, -1, _("Game:") );
    m_ctrl_sizer->Add( m_mod_lbl, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );

    m_mod_pick = new wxChoice( this, SP_MOD_PICK );
    m_ctrl_sizer->Add( m_mod_pick, 1, wxALL, 5 );


//  m_ctrl_sizer->Add( 0, 0, 1, wxEXPAND, 0 );

    m_addbot_btn = new wxButton( this, SP_ADD_BOT, _("Add bot..."), wxDefaultPosition, wxSize(80, CONTROL_HEIGHT), 0 );
    m_ctrl_sizer->Add( m_addbot_btn, 0, wxALL, 5 );

    m_main_sizer->Add( m_ctrl_sizer, 0, wxEXPAND, 5 );

    m_buttons_sep = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
    m_main_sizer->Add( m_buttons_sep, 0, wxLEFT|wxRIGHT|wxEXPAND, 5 );

    wxBoxSizer* m_buttons_sizer = new wxBoxSizer( wxHORIZONTAL );

// see http://projects.springlobby.info/issues/show/649
//  m_reset_btn = new wxButton( this, SP_RESET, _("Reset"), wxDefaultPosition, wxSize(80, CONTROL_HEIGHT), 0 );
//  m_buttons_sizer->Add( m_reset_btn, 0, wxALL, 5 );

    m_buttons_sizer->Add( 0, 0, 1, wxEXPAND, 0 );

    m_color_btn = new  ColorButton( this, SP_COLOUR, sett().GetBattleLastColour(), wxDefaultPosition, wxSize(30, CONTROL_HEIGHT) );
	m_buttons_sizer->Add( m_color_btn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 0 );

    m_spectator_check = new wxCheckBox( this, SP_SPECTATE, _("Spectate only") );
	m_buttons_sizer->Add( m_spectator_check, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    m_random_check = new wxCheckBox( this, SP_RANDOM, _("Random start positions") );
	m_buttons_sizer->Add( m_random_check, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    m_start_btn = new wxButton( this, SP_START, _("Start"), wxDefaultPosition, wxSize(80, CONTROL_HEIGHT), 0 );
	m_buttons_sizer->Add( m_start_btn, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );

	m_main_sizer->Add( m_buttons_sizer, 0, wxEXPAND, 5 );

    SetScrollRate( SCROLL_RATE, SCROLL_RATE );
    this->SetSizer( m_main_sizer );
    this->Layout();

    ReloadMaplist();
    ReloadModlist();
	ConnectGlobalEvent(this, GlobalEvent::OnUnitsyncReloaded, wxObjectEventFunction(&SinglePlayerTab::OnUnitsyncReloaded));
}
MapSelectDialog::MapSelectDialog( wxWindow* parent )
	: // WindowHintsPickle( m_dialog_name, this, wxSize( DEFSETT_MW_WIDTH, DEFSETT_MW_HEIGHT ) ),
	m_horizontal_direction( sett().GetHorizontalSortorder() ),
	m_vertical_direction( sett().GetVerticalSortorder() )
{
	//(*Initialize(MapSelectDialog)
	wxStaticBoxSizer* StaticBoxSizer2;
	wxStaticText* StaticText2;
	wxStaticText* StaticText1;
	wxBoxSizer* BoxSizer2;
	wxBoxSizer* boxSizerHorizontal;
	wxBoxSizer* BoxSizer1;
	wxStaticBoxSizer* StaticBoxSizer1;
	wxBoxSizer* boxSizerVertical;
	wxStdDialogButtonSizer* StdDialogButtonSizer1;

	Create(parent, wxID_ANY, _("Select map (click and drag to scroll)"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX, _T("wxID_ANY"));
	BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
	BoxSizer2 = new wxBoxSizer(wxVERTICAL);
	StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Vertical sort key"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2"));
	BoxSizer2->Add(StaticText2, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	boxSizerVertical = new wxBoxSizer(wxHORIZONTAL);
	m_vertical_choice = new wxChoice(this, ID_VERTICAL_CHOICE, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_VERTICAL_CHOICE"));
	boxSizerVertical->Add(m_vertical_choice, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer2->Add(boxSizerVertical, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Horizontal sort key"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
	BoxSizer2->Add(StaticText1, 0, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
	boxSizerHorizontal = new wxBoxSizer(wxHORIZONTAL);
	m_horizontal_choice = new wxChoice(this, ID_HORIZONTAL_CHOICE, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_HORIZONTAL_CHOICE"));
	boxSizerHorizontal->Add(m_horizontal_choice, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer2->Add(boxSizerHorizontal, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("Show"));
	m_filter_all = new wxRadioButton(this, ID_FILTER_ALL, _("All maps"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_FILTER_ALL"));
	m_filter_all->SetToolTip(_("Shows all available maps"));
	StaticBoxSizer1->Add(m_filter_all, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	m_filter_popular = new wxRadioButton(this, ID_FILTER_POPULAR, _("Popular maps"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_FILTER_POPULAR"));
	m_filter_popular->SetToolTip(_("Shows only maps which are currently being player on the server. You must be online to use this."));
	StaticBoxSizer1->Add(m_filter_popular, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	m_filter_recent = new wxRadioButton(this, ID_FILTER_RECENT, _("Recently played maps"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_FILTER_RECENT"));
	m_filter_recent->SetValue(true);
	m_filter_recent->SetToolTip(_("Shows only maps you played recently. (Based on your replays.)"));
	StaticBoxSizer1->Add(m_filter_recent, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	BoxSizer2->Add(StaticBoxSizer1, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StaticBoxSizer2 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Filter"));
	m_filter_text = new wxTextCtrl(this, ID_FILTER_TEXT, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_FILTER_TEXT"));
	m_filter_text->SetToolTip(_("Shows only maps which contain this text in their name or description."));
	StaticBoxSizer2->Add(m_filter_text, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
	BoxSizer2->Add(StaticBoxSizer2, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	m_map_details = new wxStaticBoxSizer(wxVERTICAL, this, _("Map details"));
	m_map_name = new wxStaticText(this, ID_MAP_NAME, wxEmptyString, wxDefaultPosition, wxSize(170,90), wxST_NO_AUTORESIZE, _T("ID_MAP_NAME"));
	m_map_name->SetLabel( wxEmptyString );
	m_map_details->Add(m_map_name, 0, wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	m_map_opts_list = new wxListCtrl(this, ID_MAP_OPTS_LIST, wxDefaultPosition, wxSize(170,120), wxLC_REPORT|wxLC_NO_HEADER|wxNO_BORDER, wxDefaultValidator, _T("ID_MAP_OPTS_LIST"));
	m_map_details->Add(m_map_opts_list, 1, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer2->Add(m_map_details, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	StdDialogButtonSizer1 = new wxStdDialogButtonSizer();
	StdDialogButtonSizer1->AddButton(new wxButton(this, wxID_OK, wxEmptyString));
	StdDialogButtonSizer1->AddButton(new wxButton(this, wxID_CANCEL, wxEmptyString));
	StdDialogButtonSizer1->Realize();
	BoxSizer2->Add(StdDialogButtonSizer1, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	BoxSizer1->Add(BoxSizer2, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	m_mapgrid = new MapGridCtrl(this, wxSize(600,400), ID_MAPGRID);
	BoxSizer1->Add(m_mapgrid, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	SetSizer(BoxSizer1);
	BoxSizer1->Fit(this);
	BoxSizer1->SetSizeHints(this);
	Center();

	Connect(ID_VERTICAL_CHOICE,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&MapSelectDialog::OnSortKeySelect);
	Connect(ID_HORIZONTAL_CHOICE,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&MapSelectDialog::OnSortKeySelect);
	Connect(ID_FILTER_ALL,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&MapSelectDialog::OnFilterAllSelect);
	Connect(ID_FILTER_POPULAR,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&MapSelectDialog::OnFilterPopularSelect);
	Connect(ID_FILTER_RECENT,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&MapSelectDialog::OnFilterRecentSelect);
	Connect(ID_FILTER_TEXT,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&MapSelectDialog::OnFilterTextChanged);
	m_mapgrid->Connect(ID_MAPGRID,wxEVT_LEFT_DCLICK,(wxObjectEventFunction)&MapSelectDialog::OnMapGridLeftDClick,0,this);
	Connect(wxID_ANY,wxEVT_INIT_DIALOG,(wxObjectEventFunction)&MapSelectDialog::OnInit);
	//*)

	Connect(ID_MAPGRID,MapGridCtrl::MapSelectedEvt,(wxObjectEventFunction)&MapSelectDialog::OnMapSelected,0,this);
	Connect(ID_MAPGRID,MapGridCtrl::LoadingCompletedEvt,(wxObjectEventFunction)&MapSelectDialog::OnMapLoadingCompleted,0,this);

	// Ugh.. Can not have these created by generated code because wxSmith doesn't accept a symbolic size,
	// (ie. wxSize(CONTROL_HEIGHT,CONTROL_HEIGHT)) and all Set*Size() methods don't seem to have any effect.
	m_vertical_direction_button = new wxButton(this, ID_VERTICAL_DIRECTION, _T("ᴠ"), wxDefaultPosition, wxSize(CONTROL_HEIGHT,CONTROL_HEIGHT), 0, wxDefaultValidator, _T("ID_VERTICAL_DIRECTION"));
	boxSizerVertical->Add(m_vertical_direction_button, 0, wxALL|wxEXPAND|wxSHAPED|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	m_horizontal_direction_button = new wxButton(this, ID_HORIZONTAL_DIRECTION, _T(">"), wxDefaultPosition, wxSize(CONTROL_HEIGHT,CONTROL_HEIGHT), 0, wxDefaultValidator, _T("ID_HORIZONTAL_DIRECTION"));
	boxSizerHorizontal->Add(m_horizontal_direction_button, 0, wxALL|wxEXPAND|wxSHAPED|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
	//<>ᴠᴧ

	Connect(ID_VERTICAL_DIRECTION, wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&MapSelectDialog::OnVerticalDirectionClicked);
	Connect(ID_HORIZONTAL_DIRECTION, wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&MapSelectDialog::OnHorizontalDirectionClicked);

	// TODO: refactor, this is copied from battlemaptab.cpp
	m_map_opts_list->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
	m_map_opts_list->SetFont( wxFont( 8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_LIGHT ) );

	wxListItem col;

	col.SetText( _("Option") );
	m_map_opts_list->InsertColumn( 0, col );
	col.SetText( _("Value") );
	m_map_opts_list->InsertColumn( 1, col );
	m_map_opts_list->SetColumnWidth( 0, 90 );
	m_map_opts_list->SetColumnWidth( 1, 80 );

	m_map_opts_list->InsertItem( 0, _("Size") );
	m_map_opts_list->InsertItem( 1, _("Windspeed") );
	m_map_opts_list->InsertItem( 2, _("Tidal strength") );
	m_map_opts_list->InsertItem( 3, _("Gravity") );
	m_map_opts_list->InsertItem( 4, _("Extractor radius") );
	m_map_opts_list->InsertItem( 5, _("Max metal") );
	m_map_opts_list->InsertItem( 6, _("Start positions") );

    Layout();
	ConnectGlobalEvent(this, GlobalEvent::OnUnitsyncReloaded, wxObjectEventFunction(&MapSelectDialog::OnUnitsyncReloaded));
}
Beispiel #8
0
BattleMapTab::BattleMapTab( wxWindow* parent, Battle* battle )
    : wxScrolledWindow( parent, -1 ),
	m_battle( battle )
{
	GetAui().manager->AddPane( this, wxLEFT, _T( "battlemaptab" ) );

	wxBoxSizer* m_main_sizer = new wxBoxSizer( wxHORIZONTAL );
	wxBoxSizer* m_map_sizer = new wxBoxSizer( wxVERTICAL );

	m_map_sizer->SetMinSize( wxSize( 352, -1 ) );
	m_minimap = new MapCtrl( this, 352, m_battle, true, false, true, false );

	m_minimap->SetMinSize( wxSize( 352, 352 ) );

	m_map_sizer->Add( m_minimap, 1, wxALL | wxEXPAND, 2 );

	wxBoxSizer* m_selmap_sizer = new wxBoxSizer( wxHORIZONTAL );

	m_map_combo = new wxChoice( this, BMAP_MAP_SEL, wxDefaultPosition, wxDefaultSize );
	m_selmap_sizer->Add( m_map_combo, 1, wxALL, 2 );

	m_browse_btn = new wxButton( this, BMAP_MAP_BROWSE, _( "Select" ), wxDefaultPosition, wxDefaultSize, 0 );

	m_selmap_sizer->Add( m_browse_btn, 0, wxALL, 2 );

	m_map_sizer->Add( m_selmap_sizer, 0, wxEXPAND, 5 );

	m_main_sizer->Add( m_map_sizer, 1, wxEXPAND, 5 );

	wxBoxSizer* m_opts_sizer = new wxBoxSizer( wxVERTICAL );

	//m_opts_sizer->SetMinSize(wxSize( 200,-1 ));
	m_map_opts_list = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxSize( 150, 160 ), wxLC_NO_HEADER | wxLC_REPORT );
	m_map_opts_list->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
	m_map_opts_list->SetFont( wxFont( 8, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_LIGHT ) );

	wxListItem col;

	col.SetText( _( "Option" ) );
	m_map_opts_list->InsertColumn( 0, col );
	col.SetText( _( "Value" ) );
	m_map_opts_list->InsertColumn( 1, col );
	m_map_opts_list->SetColumnWidth( 0, 90 );
	m_map_opts_list->SetColumnWidth( 1, 50 );

	m_map_opts_list->InsertItem( 0, _( "Size" ) );
	m_map_opts_list->InsertItem( 1, _( "Windspeed" ) );
	m_map_opts_list->InsertItem( 2, _( "Tidal strength" ) );
	m_map_opts_list->InsertItem( 3, _( "Gravity" ) );
	m_map_opts_list->InsertItem( 4, _( "Extractor radius" ) );
	m_map_opts_list->InsertItem( 5, _( "Max metal" ) );

	m_opts_sizer->Add( m_map_opts_list, 0, wxALL, 2 );


	wxString m_start_radiosChoices[] = { _( "Fixed" ), _( "Random" ), _( "Choose in game" ), _( "Chose before game" ) };
	int m_start_radiosNChoices = sizeof( m_start_radiosChoices ) / sizeof( wxString );
	//TODO these need to be tooltipped, no idea how yet
	m_start_radios = new wxRadioBox( this, BMAP_START_TYPE, _( "Startpositions" ), wxDefaultPosition, wxSize( 150, -1 ), m_start_radiosNChoices, m_start_radiosChoices, 1, wxRA_SPECIFY_COLS );

	m_opts_sizer->Add( m_start_radios, 0, wxALL, 2 );

	m_map_desc = new wxStaticText(this,-1,wxEmptyString);
    m_map_desc->Wrap(160);

    m_opts_sizer->Add( m_map_desc, 0, wxALL, 2 );

	m_main_sizer->Add( m_opts_sizer, 0, wxEXPAND, 5 );
	//m_main_sizer->AddStretchSpacer();
	SetSizer( m_main_sizer );
	Layout();

	SetBattle( battle );

	SetScrollRate( SCROLL_RATE, SCROLL_RATE );
	Layout();
	ConnectGlobalEvent(this, GlobalEvent::OnUnitsyncReloaded, wxObjectEventFunction(&BattleMapTab::OnUnitsyncReloaded));
}