예제 #1
0
settings_frame::settings_frame(wxWindow *parent, const wxString &title, wxWindowID id)
	: wxFrame(parent, id, title ),
	WindowAttributesPickle( _T("SETTINGSFRAME"), this, wxSize( DEFSETT_SW_WIDTH, DEFSETT_SW_HEIGHT ) ),
	simpleTab(0),
	uiTab(0),
	audioTab(0),
	detailTab(0),
	qualityTab(0),
	hotkeyTab(0),
	settingsIcon( new wxIcon(springsettings_xpm) ),
	m_has_focus(true)
{
	SetIcons( SLcustomizations().GetAppIconBundle() );

	alreadyCalled = false;
	parentWindow = parent;

	if ( !usync().IsLoaded() )
        usync().ReloadUnitSyncLib();

	notebook = new wxNotebook(this, ID_OPTIONS);
//	notebook->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, _T("Tahoma")));


    if (abstract_panel::loadValuesIntoMap())
	{
		CreateGUIControls();
		initMenuBar();
	}
	else
	{
		notebook->AddPage(new PathOptionPanel(notebook,this),_("Error!"));
	}

     Layout();
     Center();

     if ( !parentWindow ) 	UpdateMainAppHasFocus(m_has_focus); // only do if not being a slave of main SL app
}
예제 #2
0
파일: frame.cpp 프로젝트: abma/springlobby
settings_frame::settings_frame(wxWindow* parent, const wxString& title, wxWindowID id)
    : wxFrame(parent, id, title)
    , WindowAttributesPickle(_T("SETTINGSFRAME"), this, wxSize(DEFSETT_SW_WIDTH, DEFSETT_SW_HEIGHT))
    , simpleTab(0)
    , uiTab(0)
    , audioTab(0)
    , detailTab(0)
    , qualityTab(0)
    ,
    //	hotkeyTab(0),
    settingsIcon(new wxIcon(springsettings_xpm))
    , m_has_focus(true)
{
	SetMinSize(wxSize(DEFSETT_SW_WIDTH, DEFSETT_SW_HEIGHT));

	alreadyCalled = false;
	parentWindow = parent;

	notebook = new wxNotebook(this, ID_OPTIONS);
	//	notebook->SetFont(wxFont(8, wxSWISS, wxNORMAL,wxNORMAL, false, _T("Tahoma")));


	if (abstract_panel::loadValuesIntoMap()) {
		CreateGUIControls();
		initMenuBar();
	}

	//Dialog just created, no setting were changed yet
	abstract_panel::settingsChanged = false;

	Layout();
	Center();

	if (!parentWindow)
		UpdateMainAppHasFocus(m_has_focus); // only do if not being a slave of main SL app
}
예제 #3
0
void MainWindow::OnKillFocus(wxFocusEvent&)
{
	m_has_focus = false;
	UpdateMainAppHasFocus(m_has_focus);
}
예제 #4
0
void MainWindow::OnSetFocus(wxFocusEvent&)
{
	m_has_focus = true;
	UpdateMainAppHasFocus(m_has_focus);
}
예제 #5
0
MainWindow::MainWindow()
    : wxFrame(NULL, -1, TowxString(getSpringlobbyName()))
    , WindowAttributesPickle(_T("MAINWINDOW"), this, wxSize(720, 576))
    , m_opts_dialog(NULL)
    , m_autojoin_dialog(NULL)
    , se_frame(NULL)
    , m_channel_chooser(NULL)
    , m_log_win(NULL)
    , m_has_focus(true)
{
	SetMinSize(wxSize(720, 576));

	m_tab_names.Add(_("Chat"));
	m_tab_names.Add(_("Battlelist"));
	m_tab_names.Add(_("Battleroom"));
	m_tab_names.Add(_("Singleplayer"));
	//	m_tab_names.Add( _("Savegames") );
	m_tab_names.Add(_("Replays"));
	m_tab_names.Add(_("Downloads"));

	SetIcon(icons().GetIcon(icons().ICON_SPRINGLOBBY));

	GetAui().manager = new wxAuiManager(this);

	wxMenu* menuServer = new wxMenu;
	menuServer->Append(MENU_CONNECT, _("&Connect..."));
	menuServer->Append(MENU_DISCONNECT, _("&Disconnect"));
	menuServer->Append(MENU_SERVER_TAB, _("&Reopen server panel"));
	menuServer->AppendSeparator();
#ifndef NDEBUG
	//this is a prime spot to add experimental stuff, or stubs used to test things not really meant to be in mainwindow
	menuServer->Append(MENU_SAVE_OPTIONS, _("&Save options"));
	menuServer->AppendSeparator();
#endif
	menuServer->Append(MENU_QUIT, _("&Quit"));

	m_menuEdit = new wxMenu;
	m_menuEdit->Append(MENU_AUTOJOIN_CHANNELS, _("&Autojoin channels"));
	m_menuEdit->Append(MENU_PREFERENCES, _("&Preferences"));
	m_menuEdit->Append(MENU_SELECT_LOCALE, _("&Change language"));
	m_settings_menu = new wxMenuItem(m_menuEdit, MENU_SETTINGSPP, _("&Spring settings"), wxEmptyString, wxITEM_NORMAL);
	m_menuEdit->Append(MENU_RESET_LAYOUT, _("&Reset layout"));
	m_menuEdit->Append(m_settings_menu);

	m_menuEdit->Enable(MENU_SETTINGSPP, LSL::usync().IsLoaded()); //unitsync isn't loaded yet, disable menu entry

	m_menuTools = new wxMenu;
	m_menuTools->Append(MENU_JOIN, _("&Join channel..."));
	m_menuTools->Append(MENU_CHANNELCHOOSER, _("Channel &list"));
	m_menuTools->Append(MENU_CHAT, _("Open private &chat..."));
	m_menuTools->Append(MENU_SHOWWRITEABLEDIR, _("&Open Spring DataDir"));
	m_menuTools->AppendSeparator();
	m_menuTools->Append(MENU_DOWNLOAD, _("&Download Archives"));
	m_menuTools->AppendSeparator();
	m_menuTools->Append(MENU_USYNC, _("&Reload maps/games"));
	m_menuTools->AppendSeparator();
	m_menuTools->Append(MENU_VERSION, _("Check for new Version"));

	wxMenu* menuHelp = new wxMenu;
	menuHelp->Append(MENU_GENERAL_HELP, _("&Help, tutorial and FAQ"));
	menuHelp->Append(MENU_ABOUT, _("&About"));
	menuHelp->Append(MENU_PATHINFO, _("&System Info"));
	menuHelp->Append(MENU_TRAC, _("&Report a bug..."));
	menuHelp->Append(MENU_DOC, _("&Documentation"));

	m_menubar = new wxMenuBar;
	m_menubar->Append(menuServer, _("&Server"));
	m_menubar->Append(m_menuEdit, _("&Edit"));

	m_menubar->Append(m_menuTools, _("&Tools"));
	m_menubar->Append(menuHelp, _("&Help"));
	SetMenuBar(m_menubar);

	m_main_sizer = new wxBoxSizer(wxHORIZONTAL);
	m_func_tabs = new SLNotebook(this, _T("mainfunctabs"), MAIN_TABS, wxDefaultPosition, wxDefaultSize,
				     wxAUI_NB_WINDOWLIST_BUTTON | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE | wxAUI_NB_TAB_EXTERNAL_MOVE | wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_LEFT);
	m_func_tabs->SetArtProvider(new wxAuiDefaultTabArt);

	//IMPORTANT: event handling needs to be disabled while constructing, otherwise deadlock occurs
	SetEvtHandlerEnabled(false);

	m_chat_tab = new MainChatTab(m_func_tabs);
	m_list_tab = new BattleListTab(m_func_tabs);
	m_join_tab = new MainJoinBattleTab(m_func_tabs);
	m_sp_tab = new MainSinglePlayerTab(m_func_tabs);
	//	m_savegame_tab = new SavegameTab( m_func_tabs );
	m_replay_tab = new PlaybackTab(m_func_tabs, true);
	m_torrent_tab = new MainDownloadTab(m_func_tabs);

	//use Insert so no Changepage events are triggered
	m_func_tabs->InsertPage(PAGE_CHAT, m_chat_tab, m_tab_names[PAGE_CHAT], true);
	m_func_tabs->InsertPage(PAGE_LIST, m_list_tab, m_tab_names[PAGE_LIST], false);
	m_func_tabs->InsertPage(PAGE_JOIN, m_join_tab, m_tab_names[PAGE_JOIN], false);
	m_func_tabs->InsertPage(PAGE_SINGLE, m_sp_tab, m_tab_names[PAGE_SINGLE], false);
	//    m_func_tabs->InsertPage( PAGE_SAVEGAME, m_savegame_tab, m_tab_names[PAGE_SAVEGAME], false );
	m_func_tabs->InsertPage(PAGE_REPLAY, m_replay_tab, m_tab_names[PAGE_REPLAY], false);
	m_func_tabs->InsertPage(PAGE_TORRENT, m_torrent_tab, m_tab_names[PAGE_TORRENT], false);

	LoadPerspectives();
	SetTabIcons();
	m_main_sizer->Add(m_func_tabs, 1, wxEXPAND | wxALL, 0);

	SetSizer(m_main_sizer);

	Layout();

	se_frame_active = false;

	wxToolTip::Enable(sett().GetShowTooltips());

	m_channel_chooser = new ChannelChooserDialog(this, -1, _("Choose channels to join"));

	m_statusbar = new Statusbar(this);
	SetStatusBar(m_statusbar);
	// re-enable eventhandling
	SetEvtHandlerEnabled(true);

	UpdateMainAppHasFocus(m_has_focus);
	Connect(MainwindowMessageEvent, wxCommandEventHandler(MainWindow::OnMessage), NULL, this);

	//this should take off the firstload time considerably *ie nil it :P )
	mapSelectDialog(true, this);
	Logger::ShowDebugWindow(true);
	//	Logger::ShowDebugWindow(cfg().ReadBool(_T("/debug")));
}
예제 #6
0
파일: frame.cpp 프로젝트: abma/springlobby
void settings_frame::OnSetFocus(wxFocusEvent&)
{
	m_has_focus = true;
	UpdateMainAppHasFocus(m_has_focus);
}
예제 #7
0
파일: frame.cpp 프로젝트: abma/springlobby
void settings_frame::OnKillFocus(wxFocusEvent&)
{
	m_has_focus = false;
	UpdateMainAppHasFocus(m_has_focus);
}