Exemplo n.º 1
0
/** \brief A container for the various option panels
 * Contains a notebook holding the real option panels as pages. Handles "apply" and "restore" events for those pages,
 * rather then those having to implement (and duplicate) this functionality. \n
 * See SpringOptionsTab, TorrentOptionsPanel, ChatOptionsTab
 */
MainOptionsTab::MainOptionsTab( wxWindow* parent )
    : wxScrolledWindow( parent, -1 )
{
	frame = parent;
    GetAui().manager->AddPane( this, wxLEFT, _T("mainoptionstab") );
    m_tabs = new SLNotebook( this, _T("mainoptionstab"), OPTIONS_TABS, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_TOP | wxAUI_NB_TAB_EXTERNAL_MOVE );
    m_tabs->SetArtProvider(new SLArtProvider);
/*    m_imagelist = new wxImageList( 12, 12 );
    m_imagelist->Add( wxIcon(spring_xpm) );
    m_imagelist->Add( charArr2wxBitmap( torrentoptionspanel_icon_png, sizeof(torrentoptionspanel_icon_png) )  );
    m_imagelist->Add( wxIcon(userchat_xpm) );
    m_imagelist->Add( wxIcon(userchat_xpm) );
    m_imagelist->Add( wxIcon(springlobby12x12_xpm) );
*/
    m_spring_opts = new SpringOptionsTab( m_tabs );
    m_tabs->AddPage( m_spring_opts, _("Spring"), true, wxIcon(spring_xpm) );

    m_torrent_opts = new TorrentOptionsPanel( m_tabs );
	m_tabs->AddPage( m_torrent_opts, _("Downloads"), true, charArr2wxBitmap( torrentoptionspanel_icon_png, sizeof(torrentoptionspanel_icon_png) ) );

    m_chat_opts = new ChatOptionsTab( m_tabs );
    m_tabs->AddPage( m_chat_opts, _("Chat"), true, wxIcon(userchat_xpm) );

	m_lobby_opts = new LobbyOptionsTab( m_tabs );
	m_tabs->AddPage ( m_lobby_opts, _( "General" ), true, wxIcon( springlobby12x12_xpm ) );

	m_groups_opts = new GroupOptionsPanel( m_tabs );
	m_tabs->AddPage ( m_groups_opts, _( "Groups" ), true, wxIcon( userchat_xpm ) );

	m_apply_btn = new wxButton( this, wxID_APPLY, _( "Apply" ) );
	m_cancel_btn = new wxButton( this, wxID_CANCEL, _( "Cancel" ) );
	m_ok_btn = new wxButton( this, wxID_OK, _( "Ok" ) );

	m_button_sizer = new wxBoxSizer( wxHORIZONTAL );
	m_button_sizer->AddStretchSpacer();
	m_button_sizer->Add( m_apply_btn, 0, wxALL, 2 );
	m_button_sizer->Add( m_cancel_btn, 0, wxALL, 2 );
	m_button_sizer->Add( m_ok_btn, 0, wxALL, 2 );

	m_main_sizer = new wxBoxSizer( wxVERTICAL );
	m_main_sizer->Add( m_tabs, 1, wxEXPAND );
	m_main_sizer->Add( m_button_sizer, 0, wxEXPAND );

	SetSizer( m_main_sizer );
	SetScrollRate( SCROLL_RATE, SCROLL_RATE );
	Layout();
	Refresh();
}
void NotificationManager::ShowNotification( const UiEvents::NotficationData& data )
{
	if ( sett().GetUseNotificationPopups() ) {
		const bool spring_running = spring().IsRunning();
		const bool disable_if_ingame = sett().Get<bool>( _T("/GUI/NotificationPopupDisableIngame"), true );
		if ( m_notification_wrapper &&  ! ( disable_if_ingame && spring_running ) ) {
			//! \todo use image from customizations
			wxBitmap nmp ( charArr2wxBitmap( springlobby_64_png, sizeof(springlobby_64_png) ) );
			m_notification_wrapper->Show( nmp, sett().GetNotificationPopupPosition(), data );
		}
	}
	#ifndef DISABLE_SOUND
		if ( sett().GetChatPMSoundNotificationEnabled() )
			sound().pm();
	#endif
}
Exemplo n.º 3
0
ToasterBoxWindow::ToasterBoxWindow(wxWindow* parent, wxTimer* _parent2)
    : startTime(wxGetLocalTime())
    , parent2(_parent2)
    , sleepTime(10)
    , pauseTime(1700)
    , textColor(*wxWHITE)
    , headerTextColor(*wxBLUE)
    , popupText(_T("Change Me!"))
    , shrink(false)
{
	Create(parent, wxID_ANY);
	SetWindowStyleFlag(wxNO_BORDER | wxSTAY_ON_TOP | wxFRAME_NO_TASKBAR);
	count++;
	//the size we want the dialog to be
	wxSize dialogSize(150, 170);
	bottomRight = wxPoint(wxGetDisplaySize().GetWidth(), wxGetDisplaySize().GetHeight());
	SetSize(bottomRight.x, bottomRight.y, dialogSize.GetWidth(), dialogSize.GetHeight());
	ToasterBase::Connect(wxEVT_PAINT, (wxObjectEventFunction)&ToasterBoxWindow::OnPaint);
	SetBackgroundBitmap(charArr2wxBitmap(notif_bg_png, sizeof(notif_bg_png)));
}
Exemplo n.º 4
0
HostBattleDialog::HostBattleDialog( wxWindow* parent )
	: wxDialog( parent, -1, _( "Host new battle" ), wxDefaultPosition, wxSize( 410, 441 ), wxRESIZE_BORDER | wxDEFAULT_DIALOG_STYLE ),
	WindowHintsPickle ( _T("hostbattledialog"), this, wxSize( 410, 441 ) ),
    m_last_relayhost( sett().GetLastRelayedHost() )
{
//	this->SetSizeHints( GetSize(), wxDefaultSize );

	m_panel = new wxScrolledWindow( this );
//		m_panel ->SetSizeHints( GetSize(), wxDefaultSize );
	wxBoxSizer* all_sizer = new wxBoxSizer( wxVERTICAL );

	wxFlexGridSizer* topsizer = new wxFlexGridSizer( 2,  0, 10);
//	topsizer->AddGrowableCol( 1, 1 );

//	SetSizeHints( wxDefaultSize, wxDefaultSize );
	wxBoxSizer* m_main_sizer;
	m_main_sizer = new wxBoxSizer( wxVERTICAL );

	m_desc_lbl = new wxStaticText( m_panel, wxID_ANY, _( "Description" ), wxDefaultPosition, wxDefaultSize, 0 );
	m_desc_lbl->Wrap( -1 );
	topsizer->Add( m_desc_lbl, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );

//    wxBoxSizer* desc_sizer = new wxBoxSizer( wxVERTICAL );
	m_desc_text = new wxTextCtrl( m_panel, wxID_ANY, sett().GetLastHostDescription(), wxDefaultPosition, wxDefaultSize, 0 );
	m_desc_text->SetToolTip( TE( _( "A short description of the game, this will show up in the battle list." ) ) );
	topsizer ->Add( m_desc_text, 1, wxALL | wxEXPAND, 5 );

	m_desc_check = new wxCheckBox( m_panel, wxID_ANY, _( "Autopaste description" ) );
	m_desc_check->SetValue( sett().GetBattleLastAutoAnnounceDescription() );
	m_desc_check->SetToolTip( TE( _( "Automatically write the battle description when a user joins." ) ) );

    topsizer->AddStretchSpacer();
	topsizer->Add( m_desc_check, 0, wxLEFT, 5 );
//	topsizer->Add( desc_sizer , 0, wxEXPAND | wxALL, 0 );

	m_mod_lbl = new wxStaticText( m_panel, wxID_ANY, _( "Game" ), wxDefaultPosition, wxDefaultSize, 0 );
	m_mod_lbl->Wrap( -1 );
	topsizer->Add( m_mod_lbl, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5 );

	wxArrayString m_mod_picChoices;
	wxBoxSizer* mod_choice_button_sizer = new wxBoxSizer( wxHORIZONTAL );
	m_mod_pic = new wxChoice( m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_mod_picChoices, 0 );
	m_mod_pic->SetToolTip( TE( _( "Select the game to play." ) ) );
	mod_choice_button_sizer->Add( m_mod_pic, 0, wxALL , 5 );

    wxBitmap mp = charArr2wxBitmap( arrow_refresh_png, sizeof( arrow_refresh_png ) );
	m_refresh_btn = new wxBitmapButton( m_panel, BTN_REFRESH, mp );
	mod_choice_button_sizer->Add( m_refresh_btn, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );

	topsizer->Add( mod_choice_button_sizer, 0,  wxEXPAND|wxALL ,1 );

	m_pwd_lbl = new wxStaticText( m_panel, wxID_ANY, _( "Password\n(no spaces)" ), wxDefaultPosition, wxDefaultSize, 0 );
	m_pwd_lbl->Wrap( -1 );
	topsizer->Add( m_pwd_lbl, 1, wxALL| wxALIGN_CENTER_VERTICAL, 5 );

	m_pwd_text = new wxTextCtrl( m_panel, wxID_ANY, sett().GetLastHostPassword(), wxDefaultPosition, wxDefaultSize, wxTE_PASSWORD );
	m_pwd_text->SetToolTip( TE( _( "Password needed to join game. Keep empty for no password" ) ) );
	topsizer->Add( m_pwd_text, 1, wxALL| wxEXPAND, 5 );

	m_port_lbl = new wxStaticText( m_panel, wxID_ANY, _( "Port" ), wxDefaultPosition, wxDefaultSize, 0 );
	m_port_lbl->Wrap( -1 );
	topsizer->Add( m_port_lbl, 1, wxALL| wxALIGN_CENTER_VERTICAL, 5 );

	m_port_text = new wxTextCtrl( m_panel, wxID_ANY, wxFormat( _T( "%d" ) ) % sett().GetLastHostPort(), wxDefaultPosition, wxDefaultSize, 0 );
	m_port_text->SetToolTip( TE( _( "UDP port to host game on. Default is 8452." ) ) );
	topsizer->Add( m_port_text, 1, wxALL| wxEXPAND, 5 );

//	m_port_test_check = new wxCheckBox( m_panel, wxID_ANY, _("Test firewall"), wxDefaultPosition, wxDefaultSize, 0 );
//	m_port_test_check->SetValue( sett().GetTestHostPort() );
//	m_port_sizer->Add( m_port_test_check, 1, wxALL|wxEXPAND, 5 );



	m_relayed_host_check = new wxCheckBox( m_panel, CHK_USE_RELAY, _( "Use relayhost" ), wxDefaultPosition, wxDefaultSize, 0 );
	m_relayed_host_check->SetToolTip( TE( _( "host and control game on remote server, helps if you have trouble hosting" ) ) );
	m_relayed_host_pick = new wxButton( m_panel, PICK_RELAYHOST, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
	m_relayed_host_pick->SetLabel( m_last_relayhost.IsEmpty() ? _T("automatic") : m_last_relayhost );

	m_relayhost_list = new wxMenu();
	wxMenuItem* automatic_pick = new wxMenuItem( m_relayhost_list, AUTO_PICK_HOST, _("Chose automatically"), _("Randomly picks an available one"), wxITEM_RADIO );
	m_relayhost_list->Append( automatic_pick );
	automatic_pick->Check( m_last_relayhost.IsEmpty() );
	m_relayhost_list->AppendSeparator();
	wxMenuItem* manual_pick_relay = new wxMenuItem( m_relayhost_list, MANUAL_PICK_HOST, _("Manually enter the manager name"), _("You'll get prompted for the exact manager name"), wxITEM_RADIO );
	m_relayhost_list->Append( manual_pick_relay );
	m_relayhost_list->AppendSeparator();
	m_relayhost_array_list = serverSelector().GetServer().GetRelayHostList();
	for ( unsigned int i = 0; i < m_relayhost_array_list.GetCount(); i++ )
	{
		wxMenuItem* newitem = new wxMenuItem( m_relayhost_list, MANUAL_PICK_HOST + 1 + i, m_relayhost_array_list[i], _T("") , wxITEM_RADIO );
		m_relayhost_list->Append( newitem );
		newitem->Check( m_last_relayhost == m_relayhost_array_list[i] );
	}

	m_relayed_host_check->SetValue( sett().GetLastHostRelayedMode() );
	m_relayed_host_pick->Show( m_relayed_host_check->IsChecked() );

	topsizer->Add(  m_relayed_host_check, 1, wxALL | wxEXPAND, 5 );
	topsizer->Add(  m_relayed_host_pick, 0, wxALL | wxEXPAND, 5);

	m_main_sizer->Add( topsizer, 0, wxEXPAND, 0 );

	wxStaticBoxSizer* m_players_box;
	m_players_box = new wxStaticBoxSizer( new wxStaticBox( m_panel, -1, _( "Number of players" ) ), wxVERTICAL );

	m_players_box->SetMinSize( wxSize( -1, 60 ) );
	m_players_slide = new wxSlider( m_panel, wxID_ANY, sett().GetLastHostPlayerNum(), 2, SPRING_MAX_USERS, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS | wxSL_BOTH | wxSL_HORIZONTAL | wxSL_LABELS );
	m_players_slide->SetToolTip( TE( _( "The maximum number of players to allow in the battle." ) ) );
	m_players_box->Add( m_players_slide, 0, wxALL | wxEXPAND, 5 );

	m_main_sizer->Add( m_players_box, 0, wxALL | wxEXPAND, 5 );

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

	wxString m_nat_radiosChoices[] = { _( "None" ), _( "Hole punching" )/*, _("Fixed source ports")*/ };
	int m_nat_radiosNChoices = sizeof( m_nat_radiosChoices ) / sizeof( wxString );
	m_nat_radios = new wxRadioBox( m_panel, CHOSE_NAT, _( "NAT traversal" ), wxDefaultPosition, wxDefaultSize, m_nat_radiosNChoices, m_nat_radiosChoices, 1, wxRA_SPECIFY_COLS );
	m_nat_radios->SetSelection( sett().GetLastHostNATSetting() );

	//m_nat_radios->Enable( false );
	m_nat_radios->Enable( true );

	m_nat_radios->SetToolTip( TE( _( "NAT traversal to use." ) ) );

	m_pl_nat_sizer->Add( m_nat_radios, 1, wxALL | wxEXPAND, 5 );

	wxStaticBoxSizer* m_rank_box;
	m_rank_box = new wxStaticBoxSizer( new wxStaticBox( m_panel, -1, _( "Rank requirement" ) ), wxVERTICAL );
	wxArrayString rankFilterChoices;
	rankFilterChoices.Add(_("At least"));
	rankFilterChoices.Add(_("No greater than"));
	m_rank_direction = new wxChoice( m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, rankFilterChoices, 0 );
	m_rank_direction->SetToolTip( TE( _( "Select the type of rank enforcement." ) ) );
	m_rank_box->Add(m_rank_direction);

	wxFlexGridSizer* m_rank_sizer;
	m_rank_sizer = new wxFlexGridSizer( 2, 6, 0, 0 );
	m_rank_sizer->SetFlexibleDirection( wxBOTH );

	m_rank0_radio = new wxRadioButton( m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
	m_rank_sizer->Add( m_rank0_radio, 0, wxALL, 5 );

	m_rank0_img = new wxStaticBitmap( m_panel, wxID_ANY, wxBitmap( rank0_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 );
	m_rank_sizer->Add( m_rank0_img, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL, 5 );

	m_rank1_radio = new wxRadioButton( m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_rank_sizer->Add( m_rank1_radio, 0, wxALL, 5 );

	m_rank1_img = new wxStaticBitmap( m_panel, wxID_ANY, wxBitmap( rank1_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 );
	m_rank_sizer->Add( m_rank1_img, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL | wxALL, 2 );

	m_rank2_radio = new wxRadioButton( m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_rank_sizer->Add( m_rank2_radio, 0, wxALL, 5 );

	m_rank2_img = new wxStaticBitmap( m_panel, wxID_ANY, wxBitmap( rank2_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 );
	m_rank_sizer->Add( m_rank2_img, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL, 2 );

	m_rank3_radio = new wxRadioButton( m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_rank_sizer->Add( m_rank3_radio, 0, wxALL, 5 );

	m_rank3_img = new wxStaticBitmap( m_panel, wxID_ANY, wxBitmap( rank3_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 );
	m_rank_sizer->Add( m_rank3_img, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL, 2 );

	m_rank4_radio = new wxRadioButton( m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_rank_sizer->Add( m_rank4_radio, 0, wxALL, 5 );

	m_rank4_img = new wxStaticBitmap( m_panel, wxID_ANY, wxBitmap( rank4_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 );
	m_rank_sizer->Add( m_rank4_img, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxALL, 2 );

	m_rank5_radio = new wxRadioButton( m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_rank_sizer->Add( m_rank5_radio, 0, wxALL, 5 );

	m_rank5_img = new wxStaticBitmap( m_panel, wxID_ANY, wxBitmap( rank5_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 );
	m_rank_sizer->Add( m_rank5_img, 0, wxALL | wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL, 5 );

	m_rank6_radio = new wxRadioButton( m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_rank_sizer->Add( m_rank6_radio, 0, wxALL, 5 );

	m_rank6_img = new wxStaticBitmap( m_panel, wxID_ANY, wxBitmap( rank6_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 );
	m_rank_sizer->Add( m_rank6_img, 0, wxALL, 5 );

	m_rank7_radio = new wxRadioButton( m_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
	m_rank_sizer->Add( m_rank7_radio, 0, wxALL, 5 );

	m_rank7_img = new wxStaticBitmap( m_panel, wxID_ANY, wxBitmap( rank7_xpm ), wxDefaultPosition, wxSize( 16, 16 ), 0 );
	m_rank_sizer->Add( m_rank7_img, 0, wxALL, 5 );

	m_rank_box->Add( m_rank_sizer, 1, wxEXPAND, 5 );

	m_pl_nat_sizer->Add( m_rank_box, 1, wxALL | wxEXPAND, 5 );

	m_main_sizer->Add( m_pl_nat_sizer, 0, wxEXPAND, 5 );
	m_main_sizer->Add( 0, 0, 1, wxEXPAND, 0 );

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

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

	m_cancel_btn = new wxButton( m_panel, HOST_CANCEL, _( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
	m_buttons_sizer->Add( 0, 0, 1, wxEXPAND, 0 );
	m_buttons_sizer->Add( m_cancel_btn, 0, wxALL, 5 );

	m_host_btn = new wxButton( m_panel, HOST_OK, _( "Host" ), wxDefaultPosition, wxDefaultSize, 0 );
	m_host_btn->SetToolTip( TE( _( "Start hosting the battle." ) ) );

	m_buttons_sizer->Add( m_host_btn, 0, wxALL, 5 );

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

	m_panel->SetSizer( m_main_sizer );
	all_sizer->Add( m_panel, 1, wxEXPAND, 0 );
	this->SetSizer( all_sizer );
	m_panel->SetScrollRate( SCROLL_RATE, SCROLL_RATE );
	this->Layout();
	m_host_btn->SetFocus();

	ReloadModList();
}
Exemplo n.º 5
0
wxIcon charArr2wxIcon(const unsigned char* arg, int size)
{
	wxIcon ic;
	ic.CopyFromBitmap(charArr2wxBitmap(arg, size));
	return ic;
}
Exemplo n.º 6
0
_mapconvTab::_mapconvTab(wxWindow* parent, wxWindowID id) : wxPanel(parent, id)
{
    bLowpass = true;
    bInvert = true;
    bFeatureEnable = false;
    bTypemapEnable = false;
    bOtherEnable = false;
    bOtherFirstTime = true;

    bHeightmapLoaded = false;
    bTextureLoaded = false;
    bMetalLoaded = false;
    bFeatureLoaded = false;
    bTypemapLoaded = false;

    wxBoxSizer *hboxMain = new wxBoxSizer(wxHORIZONTAL);

//Vertical box for the files////////////////////////////////////////////////////////////////////////
    wxStaticBoxSizer *gboxFiles = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Files"));

    wxBoxSizer *hboxHeight = new wxBoxSizer(wxHORIZONTAL);              //Heightmap/////////////////
    btnHeight = new wxButton(this, IDBTN_HEIGHT, wxT("Height Map"));
    tcHeight = new wxTextCtrl(this, wxID_ANY, wxT("heightmap.bmp"));

    wxBoxSizer *hboxTexture = new wxBoxSizer(wxHORIZONTAL);             //Texture///////////////////
    btnTexture = new wxButton(this, IDBTN_TEXTURE, wxT("Texture"));
    tcTexture = new wxTextCtrl(this, wxID_ANY, wxT("texture.bmp"));

    wxBoxSizer *hboxMetal = new wxBoxSizer(wxHORIZONTAL);               //Metal/////////////////////
    btnMetal = new wxButton(this, IDBTN_METAL, wxT("Metal"));
    tcMetal = new wxTextCtrl(this, wxID_ANY, wxT("metal.bmp"));

    wxBoxSizer *hboxFeatureEnable = new wxBoxSizer(wxHORIZONTAL);       //Feature enable////////////
    cbFeatureEnable = new wxCheckBox(this, IDCB_FEATURE_ENABLE, wxT("Enable Feature Map"));
    wxBoxSizer *hboxFeature = new wxBoxSizer(wxHORIZONTAL);             //Feature///////////////////
    btnFeature = new wxButton(this, IDBTN_FEATURE, wxT("Feature"));
    tcFeature = new wxTextCtrl(this, wxID_ANY, wxT("featuremap.bmp"));
    btnFeature->Enable(bFeatureEnable);
    tcFeature->Enable(bFeatureEnable);

    wxBoxSizer *hboxFeatureList = new wxBoxSizer(wxHORIZONTAL);         //Feature list//////////////
    btnFeatureList = new wxButton(this, IDBTN_FEATURELIST, wxT("Feature List"));
    tcFeatureList = new wxTextCtrl(this, wxID_ANY, wxT("featurelist.txt"));
    btnFeatureList->Enable(bFeatureEnable);
    tcFeatureList->Enable(bFeatureEnable);

    wxBoxSizer *hboxTypeEnable = new wxBoxSizer(wxHORIZONTAL);       //Type enable////////////
    cbTypeEnable = new wxCheckBox(this, IDCB_TYPEMAP_ENABLE, wxT("Enable Type Map"));
    wxBoxSizer *hboxType = new wxBoxSizer(wxHORIZONTAL);             //Type///////////////////
    btnType = new wxButton(this, IDBTN_TYPE, wxT("Type"));
    tcType = new wxTextCtrl(this, wxID_ANY, wxT("typemap.bmp"));
    btnType->Enable(bTypemapEnable);
    tcType->Enable(bTypemapEnable);

    wxBoxSizer *hboxGeovent = new wxBoxSizer(wxHORIZONTAL);               //Geovent///////////////////
    btnGeovent = new wxButton(this, IDBTN_GEOVENT, wxT("Geovent"));
    tcGeovent = new wxTextCtrl(this, wxID_ANY, wxT("geovent.bmp"));

    wxBoxSizer *hboxOutput = new wxBoxSizer(wxHORIZONTAL);               //Output////////////////////
    btnOutput = new wxButton(this, IDBTN_OUTPUT, wxT("Output"));
    tcOutput = new wxTextCtrl(this, wxID_ANY, wxT("Output.smf"));

    wxBoxSizer *hboxOtherOptions = new wxBoxSizer(wxHORIZONTAL);
    wxBoxSizer *vboxOtherOptions = new wxBoxSizer(wxVERTICAL);
    cbOtherOptionsEnable = new wxCheckBox(this, IDCB_OTHER_ENABLE, wxT("Enable Additional Options"));
    tcOtherOptions = new wxTextCtrl(this, IDST_OTHER, wxT("Additional Options"));
    tcOtherOptions->Enable(bOtherEnable);

//Vertical box for the heightmap options and quality controls/////////////////////////////////////////////////////////////////
    wxBoxSizer *vboxOptions = new wxBoxSizer(wxVERTICAL);
    wxStaticBoxSizer *gboxHeightOptions = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Heightmap Options"));
    wxStaticBoxSizer *gboxAdditionalOptions = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Other Options"));
    wxStaticBoxSizer *gboxPreview = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Preview"));

    wxFlexGridSizer *fgHeightOptions = new wxFlexGridSizer(4,2,5,5);
        stMax = new wxStaticText(this, wxID_ANY, wxT("Maximum"));
        tcMax = new wxTextCtrl(this, IDTC_MIN_HEIGHT, wxT(MAX_HEIGHT));
        stMin = new wxStaticText(this, wxID_ANY, wxT("Minimum"));
        tcMin = new wxTextCtrl(this, IDTC_MIN_HEIGHT, wxT(MIN_HEIGHT));
        cbLowpass = new wxCheckBox(this, IDCB_LOWPASS, wxT("Lowpass"));
        wxPanel *pnlLowpassPadding = new wxPanel(this, wxID_ANY);
        cbInvert = new wxCheckBox(this, IDCB_INVERT, wxT("Invert"));
        wxPanel *pnlInvertPadding = new wxPanel(this, wxID_ANY);
        cbLowpass->SetValue(bLowpass);
        cbInvert->SetValue(bInvert);

    wxFlexGridSizer *fgCompression = new wxFlexGridSizer(2,2,5,5);
        tcCompression = new wxTextCtrl(this, wxID_ANY, wxT("0.8"));
        stCompression = new wxStaticText(this, wxID_ANY, wxT("Compression"));
        tcFeatureRotate = new wxTextCtrl(this, wxID_ANY, wxT("0"));
        stFeatureRotate = new wxStaticText(this, wxID_ANY, wxT("Rotate # features"));

    wxArrayString *asQuality = new wxArrayString();
        asQuality->Add(wxT("Low"), 1);
        asQuality->Add(wxT("Medium"), 1);
        asQuality->Add(wxT("High"), 1);
        asQuality->Add(wxT("Best"), 1);
    rbxQuality = new wxRadioBox(this, IDRBX_QUALITY, wxT("nvdxt Options"), wxDefaultPosition, wxDefaultSize, *asQuality, 0, wxRA_SPECIFY_ROWS, wxDefaultValidator, wxT("radioBox"));
    rbxQuality->SetSelection(2);
    rbxQuality->SetItemToolTip(1, wxT("Requires an nvidia 8 gfx card or better."));

//Preview box////////////////////////////////////////////////////////////////////////////////////////
	sbmPreview = new wxStaticBitmap(this, wxID_ANY, charArr2wxBitmap( placeholder_png, sizeof( placeholder_png ) ), wxPoint(10, 10));

    gboxPreview->Add(sbmPreview, 1,  wxEXPAND | wxRIGHT | wxLEFT | wxBOTTOM | wxTOP, 5);
//Assemble files vbox////////////////////////////////////////////////////////////////////
    hboxHeight->Add(tcHeight, 1, wxLEFT | wxRIGHT, 8);
    hboxHeight->Add(btnHeight, 0, wxLEFT | wxRIGHT, 8);
    hboxTexture->Add(tcTexture, 1, wxLEFT | wxRIGHT, 8);
    hboxTexture->Add(btnTexture, 0, wxLEFT | wxRIGHT, 8);
    hboxMetal->Add(tcMetal, 1, wxLEFT | wxRIGHT, 8);
    hboxMetal->Add(btnMetal, 0, wxLEFT | wxRIGHT, 8);
    hboxFeatureEnable->Add(cbFeatureEnable, 0, wxLEFT | wxRIGHT, 8);
    hboxFeature->Add(tcFeature, 1, wxLEFT | wxRIGHT, 8);
    hboxFeature->Add(btnFeature, 0, wxLEFT | wxRIGHT, 8);
    hboxFeatureList->Add(tcFeatureList, 1, wxLEFT | wxRIGHT, 8);
    hboxFeatureList->Add(btnFeatureList, 0, wxLEFT | wxRIGHT, 8);
    hboxTypeEnable->Add(cbTypeEnable, 0, wxLEFT | wxRIGHT, 8);
    hboxType->Add(tcType, 1, wxLEFT | wxRIGHT, 8);
    hboxType->Add(btnType, 0, wxLEFT | wxRIGHT, 8);
    hboxGeovent->Add(tcGeovent, 1, wxLEFT | wxRIGHT, 8);
    hboxGeovent->Add(btnGeovent, 0, wxLEFT | wxRIGHT, 8);
    hboxOutput->Add(tcOutput, 1, wxLEFT | wxRIGHT, 8);
    hboxOutput->Add(btnOutput, 0, wxLEFT | wxRIGHT, 8);
        vboxOtherOptions->Add(cbOtherOptionsEnable, 0, wxLEFT | wxRIGHT, 8);
        vboxOtherOptions->Add(-1, 15);
        vboxOtherOptions->Add(tcOtherOptions, 1, wxLEFT | wxRIGHT, 8);
    hboxOtherOptions->Add(vboxOtherOptions, 1, wxLEFT | wxRIGHT, 8);

    gboxFiles->Add(hboxHeight, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5);
    gboxFiles->Add(hboxTexture, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5);
    gboxFiles->Add(hboxMetal, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5);
    gboxFiles->Add(hboxFeatureEnable, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5);
    gboxFiles->Add(hboxFeature, 1, wxEXPAND | wxLEFT | wxRIGHT, 5);
    gboxFiles->Add(hboxFeatureList, 1, wxEXPAND | wxLEFT | wxRIGHT, 5);
    gboxFiles->Add(hboxTypeEnable, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5);
    gboxFiles->Add(hboxType, 1, wxEXPAND | wxLEFT | wxRIGHT, 5);
    gboxFiles->Add(hboxGeovent, 1, wxEXPAND | wxLEFT | wxRIGHT, 5);
    gboxFiles->Add(hboxOutput, 1, wxEXPAND | wxLEFT | wxRIGHT, 5);

    gboxFiles->Add(hboxOtherOptions, 0, wxEXPAND | wxLEFT | wxRIGHT, 5);
//Assemble Heightmap options////////////////////////////////////////////////////////////////////////
        fgHeightOptions->Add(stMax, 1, wxEXPAND | wxRIGHT | wxLEFT , 5);
        fgHeightOptions->Add(tcMax, 1, wxEXPAND | wxRIGHT | wxLEFT , 5);
        fgHeightOptions->Add(stMin, 1, wxEXPAND | wxRIGHT | wxLEFT , 5);
        fgHeightOptions->Add(tcMin, 1, wxEXPAND | wxRIGHT | wxLEFT , 5);
        fgHeightOptions->Add(cbLowpass, 1, wxEXPAND | wxRIGHT | wxLEFT , 5);
        fgHeightOptions->Add(pnlLowpassPadding, 1, wxRIGHT | wxLEFT , 5);
        fgHeightOptions->Add(cbInvert, 1, wxEXPAND | wxRIGHT | wxLEFT , 5);
        fgHeightOptions->Add(pnlInvertPadding, 1, wxEXPAND | wxRIGHT | wxLEFT , 5);
    gboxHeightOptions->Add(fgHeightOptions, 1, wxEXPAND ,0 ,0);
//Assemble Quality boxes////////////////////////////////////////////////////////////////////////////


    fgCompression->Add(stCompression, 1,  wxEXPAND | wxRIGHT | wxLEFT, 5);
    fgCompression->Add(tcCompression, 1,  wxEXPAND | wxRIGHT | wxLEFT, 5);
    fgCompression->Add(stFeatureRotate, 1,  wxEXPAND | wxRIGHT | wxLEFT, 5);
    fgCompression->Add(tcFeatureRotate, 1,  wxEXPAND | wxRIGHT | wxLEFT, 5);

    gboxAdditionalOptions->Add(fgCompression, 1, wxEXPAND | wxRIGHT | wxLEFT | wxTOP, 8);


    vboxOptions->Add(gboxHeightOptions, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5);
    vboxOptions->Add(rbxQuality, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5);/////////////////////////////////////////////////////
    vboxOptions->Add(gboxAdditionalOptions, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5);
    vboxOptions->Add(gboxPreview, 0, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5);
//Final assembly////////////////////////////////////////////////////////////////////////////////////
    hboxMain->Add(gboxFiles, 2, wxLEFT | wxRIGHT | wxTOP | wxBOTTOM, 5);
    hboxMain->Add(vboxOptions, 1, wxTOP | wxBOTTOM | wxALIGN_RIGHT, 5);

    this->SetSizer(hboxMain);


    calculateWaterHeight();


//Enabling checkboxes//
    Connect(IDCB_FEATURE_ENABLE, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(_mapconvTab::OnToggleFeatureEnable));
    Connect(IDCB_TYPEMAP_ENABLE, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(_mapconvTab::OnToggleTypemapEnable));
    Connect(IDCB_OTHER_ENABLE, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(_mapconvTab::OnToggleOtherEnable));

    Connect(IDCB_LOWPASS, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(_mapconvTab::OnToggleLowpass));
    Connect(IDCB_INVERT, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(_mapconvTab::OnToggleInvert));
//File inputs//
    Connect(IDBTN_HEIGHT, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(_mapconvTab::OnOpenHeight));
    Connect(IDBTN_TEXTURE, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(_mapconvTab::OnOpenTexture));
    Connect(IDBTN_METAL, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(_mapconvTab::OnOpenMetal));
    Connect(IDBTN_FEATURE, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(_mapconvTab::OnOpenFeature));
    Connect(IDBTN_FEATURELIST, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(_mapconvTab::OnOpenFeatureList));
    Connect(IDBTN_TYPE, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(_mapconvTab::OnOpenType));
    Connect(IDBTN_GEOVENT, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(_mapconvTab::OnOpenGeovent));
    Connect(IDBTN_OUTPUT, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(_mapconvTab::OnOpenOutput));

    Connect(IDTC_MAX_HEIGHT, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(_mapconvTab::OnChangeMax));
    Connect(IDTC_MIN_HEIGHT, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(_mapconvTab::OnChangeMin));
}
Exemplo n.º 7
0
_previewTab::_previewTab(wxWindow* parent, wxWindowID id) : wxPanel(parent, id){
    bShowWater = false;
    bShowWater = false;
    bHeightmapLoaded = false;
    bTextureLoaded = false;
    bMetalLoaded = false;
    bFeatureLoaded = false;
    bTypemapLoaded = false;

    wxBoxSizer *hboxPreview = new wxBoxSizer(wxHORIZONTAL);
        wxStaticBoxSizer *gboxPreviewBig = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Preview"));

        wxBitmap bmTemp = charArr2wxBitmap( placeholderbig_png, sizeof( placeholderbig_png ) );

        imHeightmap = bmTemp.ConvertToImage();
        imTexture = bmTemp.ConvertToImage();
        imMetal = bmTemp.ConvertToImage();
        imFeature = bmTemp.ConvertToImage();
        imTypemap = bmTemp.ConvertToImage();

        imHeightmapWater = bmTemp.ConvertToImage();
        imTextureWater = bmTemp.ConvertToImage();
        imMetalWater = bmTemp.ConvertToImage();
        imFeatureWater = bmTemp.ConvertToImage();
        imTypemapWater = bmTemp.ConvertToImage();

        _previewPanel *pnlPreviewBig = new _previewPanel(this, IDPNL_PREVIEW);/////////////////////////////////////////////////
        wxBoxSizer *vboxPreviewBig = new wxBoxSizer(wxVERTICAL);
        sbmPreviewBig = new wxStaticBitmap(pnlPreviewBig, wxID_ANY, charArr2wxBitmap( placeholderbig_png, sizeof( placeholderbig_png ) ), wxPoint(10, 10));

        vboxPreviewBig->Add(sbmPreviewBig, 1, wxEXPAND, 5);
        pnlPreviewBig->SetSizer(vboxPreviewBig);
        gboxPreviewBig->Add(pnlPreviewBig, 1, wxEXPAND | wxRIGHT | wxLEFT | wxBOTTOM | wxTOP, 5);
        sbmPreviewBig->CentreOnParent();

        wxBoxSizer *vboxOptions = new wxBoxSizer(wxVERTICAL);
                wxArrayString *asPreview = new wxArrayString();
                asPreview->Add(wxT("Heightmap"), 1);
                asPreview->Add(wxT("Texture"), 1);
                asPreview->Add(wxT("Metal"), 1);
                asPreview->Add(wxT("Feature"), 1);
                asPreview->Add(wxT("Type"), 1);
            rbxPreview = new wxRadioBox(this, IDRBX_PREVIEW, wxT("Select File for Preview"), wxDefaultPosition, wxDefaultSize, *asPreview, 0, wxRA_SPECIFY_ROWS, wxDefaultValidator, wxT("radioBox"));
            wxStaticBoxSizer *gboxWaterOptions = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Water"));
                cbOverlayWater = new wxCheckBox(this, IDCB_WATER_OVERLAY, wxT("Show Water"));
                cbOverlayWater->SetValue(true);
                wxBoxSizer *hboxHeightMax = new wxBoxSizer(wxHORIZONTAL);
                    wxStaticText *stHeightMax = new wxStaticText(this, wxID_ANY, wxT("Max"));
                    tcHeightMax = new wxTextCtrl(this, IDTC_MAX_HEIGHT_PREVIEW, wxT(MAX_HEIGHT));
                wxBoxSizer *hboxHeightMin = new wxBoxSizer(wxHORIZONTAL);
                    wxStaticText *stHeightMin = new wxStaticText(this, wxID_ANY, wxT("Min"));
                    tcHeightMin = new wxTextCtrl(this, IDTC_MIN_HEIGHT_PREVIEW, wxT(MIN_HEIGHT));

                btnRecalculateWater = new wxButton(this, IDBTN_RECALCULATEWATER, wxT("Recalc Water"));

                hboxHeightMax->Add(stHeightMax, wxTOP | wxBOTTOM, wxEXPAND, 5);
                hboxHeightMax->Add(tcHeightMax, wxTOP | wxBOTTOM, wxEXPAND, 5);
                hboxHeightMin->Add(stHeightMin, wxTOP | wxBOTTOM, wxEXPAND, 5);
                hboxHeightMin->Add(tcHeightMin, wxTOP | wxBOTTOM, wxEXPAND, 5);

            gboxWaterOptions->Add(cbOverlayWater, wxTOP | wxBOTTOM, wxEXPAND, 5);
            gboxWaterOptions->Add(hboxHeightMax, wxTOP | wxBOTTOM, wxEXPAND, 5);
            gboxWaterOptions->Add(hboxHeightMin, wxTOP | wxBOTTOM, wxEXPAND, 5);
            gboxWaterOptions->Add(btnRecalculateWater, wxTOP | wxBOTTOM, wxEXPAND, 5);


            vboxOptions->Add(rbxPreview, 0, wxEXPAND, 5);
            vboxOptions->Add(gboxWaterOptions, 0, wxEXPAND, 5);


    hboxPreview->Add(gboxPreviewBig, 4, wxEXPAND, 5);
    hboxPreview->Add(vboxOptions, 1, wxEXPAND, 5);
    this->SetSizer(hboxPreview);

    Connect(IDRBX_PREVIEW, wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler(_previewTab::OnChangePreview));
    Connect(IDBTN_RECALCULATEWATER, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(_previewTab::OnClickRecalculateWater));
    Connect(IDCB_WATER_OVERLAY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(_previewTab::OnClickShowWater));
    Connect(IDTC_MAX_HEIGHT_PREVIEW, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(_previewTab::OnChangeMaxPreview));
    Connect(IDTC_MIN_HEIGHT_PREVIEW, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler(_previewTab::OnChangeMinPreview));
    Connect(IDPNL_PREVIEW, wxEVT_LEFT_DOWN, wxMouseEventHandler(_previewTab::OnClickPreview));
}
Exemplo n.º 8
0
IconImageList::IconImageList() : wxImageList(16,16,true)
{
    ICON_ADMIN = Add( charArr2wxBitmap( admin_png, sizeof(admin_png) ) );
    ICON_ADMIN_AWAY = Add( charArr2wxBitmap( admin_away_png, sizeof(admin_away_png) ) );
    ICON_ADMIN_BROOM = Add( charArr2wxBitmap( admin_broom_png, sizeof(admin_broom_png) ) );
    ICON_ADMIN_INGAME = Add( charArr2wxBitmap( admin_ingame_png, sizeof(admin_ingame_png) ) );

    ICON_BOT = Add( wxBitmap(bot_xpm) );
    ICON_BOT_BROOM = Add( charArr2wxBitmap( bot_broom_png, sizeof( bot_broom_png ) )  );
    ICON_BOT_INGAME = Add( charArr2wxBitmap( bot_ingame_png, sizeof( bot_ingame_png ) ) );
    ICON_BOT_AWAY = Add( wxBitmap(bot_away_xpm) );

    ICON_AWAY = Add( charArr2wxBitmap( away_png, sizeof( away_png ) ) );
    ICON_BROOM = Add( charArr2wxBitmap(broom_png, sizeof(broom_png) ) );
    ICON_INGAME = Add( charArr2wxBitmap(ingame_png, sizeof(ingame_png) ) );

    ICON_OP = Add( wxBitmap(chanop_xpm) );
    ICON_OP_AWAY = Add( wxBitmap(chanop_away_xpm) );
    ICON_OP_BROOM = Add( wxBitmap(chanop_broom_xpm) );
    ICON_OP_INGAME = Add( wxBitmap(chanop_ingame_xpm) );

    ICON_UP = Add( wxBitmap(up_xpm) );
    ICON_DOWN = Add( wxBitmap(down_xpm) );

    ICON_RANK_UNKNOWN = Add( wxBitmap(rank_unknown_xpm) );
    ICON_RANK1 = Add( wxBitmap(rank0_xpm) );
    ICON_RANK2 = Add( wxBitmap(rank1_xpm) );
    ICON_RANK3 = Add( wxBitmap(rank2_xpm) );
    ICON_RANK4 = Add( wxBitmap(rank3_xpm) );
    ICON_RANK5 = Add( wxBitmap(rank4_xpm) );
    ICON_RANK6 = Add( wxBitmap(rank5_xpm) );
    ICON_RANK7 = Add( wxBitmap(rank6_xpm) );
	ICON_RANK8 = Add( wxBitmap(rank7_xpm) );
	ICON_SPRINGLOBBY = Add(wxBitmap(springlobby_xpm));

	m_rank_requirements.push_back(ICON_RANK1);
	m_rank_requirements.push_back(ICON_RANK2);
	m_rank_requirements.push_back(ICON_RANK3);
	m_rank_requirements.push_back(ICON_RANK4);
	m_rank_requirements.push_back(ICON_RANK5);
	m_rank_requirements.push_back(ICON_RANK6);
	m_rank_requirements.push_back(ICON_RANK7);
	m_rank_requirements.push_back(ICON_RANK8);

	wxBitmap major_bitmap(major_xpm);
	wxBitmap minor_bitmap(minor_xpm);
	m_minimum_rank_requirement_border = m_rank_requirements.size();
	for ( int i = 0; i < m_minimum_rank_requirement_border; i++)
	{
		wxBitmap to_blend= GetBitmap(m_rank_requirements[i]);
		m_rank_requirements[i] = Add( BlendBitmaps( to_blend, major_bitmap ) ); // replace old with blended with major
		m_rank_requirements.push_back( Add( BlendBitmaps( to_blend, minor_bitmap ) ) ); // add new blended with minor
	}

    ICON_READY = ICON_OPEN_GAME = Add( charArr2wxBitmap(open_game_png, sizeof(open_game_png) ) );
    ICON_OPEN_PW_GAME = Add( charArr2wxBitmap(open_pw_game_png, sizeof(open_pw_game_png) ) );
    ICON_OPEN_FULL_PW_GAME = Add( charArr2wxBitmap(open_full_pw_game_png, sizeof(open_full_pw_game_png) ) );
    ICON_OPEN_FULL_GAME = Add( charArr2wxBitmap(open_full_game_png, sizeof(open_full_game_png) ) );
    ICON_NREADY = ICON_CLOSED_GAME = Add( charArr2wxBitmap(closed_game_png, sizeof(closed_game_png) ) );
    ICON_CLOSED_PW_GAME = Add( charArr2wxBitmap(closed_pw_game_png, sizeof(closed_pw_game_png) ) );
    ICON_CLOSED_FULL_PW_GAME = Add( charArr2wxBitmap(closed_full_pw_game_png, sizeof(closed_full_pw_game_png) ) );
    ICON_CLOSED_FULL_GAME = Add( charArr2wxBitmap(closed_full_game_png, sizeof(closed_full_game_png) ) );
    ICON_STARTED_GAME = Add(  charArr2wxBitmap(ingame_png, sizeof(ingame_png) ) );

    ICON_STARTED_GAME_LOCKED = Add( charArr2wxBitmapWithBlending( closed_game_png, sizeof(closed_game_png), ingame_png, sizeof(ingame_png) ) );


    ICON_READY_UNSYNC = Add( wxBitmap(ready_unsync_xpm) );
    ICON_NREADY_UNSYNC = Add( wxBitmap(nready_unsync_xpm) );
    ICON_READY_QSYNC = Add( wxBitmap(ready_q_xpm) );
    ICON_NREADY_QSYNC = Add( wxBitmap(nready_q_xpm) );

    ICON_NEXISTS = Add( wxBitmap(nexists_xpm) );
    ICON_EXISTS = Add( wxBitmap(exists_xpm) );

    ICON_SPECTATOR = Add( charArr2wxBitmap(spectator_png, sizeof(spectator_png) ) );
    ICON_HOST = Add( wxBitmap(host_xpm) );
    ICON_HOST_SPECTATOR = Add( wxBitmap(host_spectator_xpm) );

    ICON_SIDEPIC_0 = Add( charArr2wxBitmap(no1_icon_png, sizeof(no1_icon_png) ) );
    ICON_SIDEPIC_1 = Add( charArr2wxBitmap(no2_icon_png, sizeof(no2_icon_png) ) );

    ICON_CHANNEL_OPTIONS = Add( wxBitmap(channel_options_xpm) );

//	SetColourIcon( wxColour( 255,   0,   0 ) );
//	SetColourIcon( wxColour(   0, 255,   0 ) );
//	SetColourIcon( wxColour(   0,   0, 255 ) );


  //ICON_FIXCOLOURS_PALETTE = Add( wxBitmap(fixcolours_palette_xpm) );

    ICON_UNK_FLAG = Add( wxBitmap(unknown_flag_xpm) );

    ICON_FLAGS_BASE = AddFlagImages( *this );

    ICON_EMPTY = Add( wxBitmap(empty_xpm) );

    ICON_NONE = ICON_NOSTATE = ICON_RANK_NONE = ICON_GAME_UNKNOWN = ICON_EMPTY;

    ICON_WARNING_OVERLAY = Add(charArr2wxBitmap(warning_small_png, sizeof(warning_small_png) ));

}
Exemplo n.º 9
0
void ToasterBoxWindow::DrawText()
{
	DCType dc( this );
#ifdef __WXMSW__
//	dc.SetBackground( *wxBLACK_BRUSH );
//	dc.Clear();
	dc.DrawBitmap(charArr2wxBitmap( notif_bg_png, sizeof(notif_bg_png) ), 0, 0, false);
#endif
  //width and height of text
  wxCoord w = 0, h = 0;
  //where we will set the text
  wxCoord x = 0, y = 0;
  //border from sides and top to text (in pixels)
  int border_right = 7;
  int border_left = sbm.GetBitmap().GetWidth() + 102;
  //how much space between text lines
  int textPadding = 4;
  //how much can we have on a line?
  int textColumns = 0;
  //how many lines can we fit vertically
  float textLines = 1;
  //the popupText after our transformations (if we do any)
  wxString pText = GetPopupText();
	wxFont outFont( 9, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD );
	dc.SetFont( outFont );

  dc.GetTextExtent(pText, &w, &h);

  //shrink the text to fit in the popup box
  if(shrink)
  {
	while((w +(border_right + border_left))> GetSize().GetWidth())
    {
      pText = pText.Left(pText.Length()-1);
      dc.GetTextExtent(pText, &w, &h);
    }
    textColumns = pText.Length();
    //figure out how many lines of text we have
    textLines = (GetPopupText().Length() / textColumns) +.9;
  }

  //center the text
//  if(w < GetSize().GetWidth())
//    x = (GetSize().GetWidth() - w) / 2;
//  if(h < GetSize().GetHeight())
//    y = (GetSize().GetHeight() - h) / 2;

  dc.SetTextForeground(textColor);

//  //if we have multiple lines
  if(textLines > 1)
  {
    //how many lines we can fit in the height available
    float howManyLinesFit = GetSize().GetHeight() / (h+textPadding);
    if(textLines < howManyLinesFit)
      howManyLinesFit = textLines;
    y = (GetSize().GetHeight() - ((h+textPadding) * howManyLinesFit)) / 2;
    for(int i = 0; i < howManyLinesFit; i++)
    {
	  dc.DrawText(GetPopupText().Mid((i*textColumns), textColumns), x + border_left,y);
      //move the text down a line
      y += h+textPadding;
    }
  }
  else
    dc.DrawText(pText, x,y);

}