C4StartupAboutDlg::C4StartupAboutDlg() : C4StartupDlg(LoadResStr("IDS_DLG_ABOUT")) { // ctor UpdateSize(); CStdFont &rUseFont = ::GraphicsResource.TextFont; C4Rect rcClient = GetContainedClientRect(); // bottom line buttons and copyright messages C4GUI::ComponentAligner caMain(rcClient, 0,0, true); C4GUI::ComponentAligner caButtons(caMain.GetFromBottom(caMain.GetHeight()*1/8), 0,0, false); C4GUI::CallbackButton<C4StartupAboutDlg> *btn; #if AUDIO_TK == AUDIO_TK_FMOD AddElement(new C4GUI::Label("Using FMOD Sound System, copyright (c) Firelight Technologies Pty, Ltd., 1994-2010.", caMain.GetFromBottom(rUseFont.GetLineHeight()))); #endif int32_t iButtonWidth = caButtons.GetInnerWidth() / 4; AddElement(btn = new C4GUI::CallbackButton<C4StartupAboutDlg>(LoadResStr("IDS_BTN_BACK"), caButtons.GetGridCell(0,3,0,1,iButtonWidth,C4GUI_ButtonHgt,true), &C4StartupAboutDlg::OnBackBtn)); btn->SetToolTip(LoadResStr("IDS_DLGTIP_BACKMAIN")); #ifdef WITH_AUTOMATIC_UPDATE AddElement(btn = new C4GUI::CallbackButton<C4StartupAboutDlg>(LoadResStr("IDS_BTN_CHECKFORUPDATES"), caButtons.GetGridCell(2,3,0,1,iButtonWidth,C4GUI_ButtonHgt,true), &C4StartupAboutDlg::OnUpdateBtn)); btn->SetToolTip(LoadResStr("IDS_DESC_CHECKONLINEFORNEWVERSIONS")); #endif AddElement(new C4GUI::Label("'Clonk' is a registered trademark of Matthes Bender.", caButtons.GetFromBottom(rUseFont.GetLineHeight()))); }
C4GameOptionButtons::C4GameOptionButtons(const C4Rect &rcBounds, bool fNetwork, bool fHost, bool fLobby) : C4GUI::Window(), fNetwork(fNetwork), fHost(fHost), fLobby(fLobby), fCountdown(false) { SetBounds(rcBounds); // calculate button size from area int32_t iButtonCount = fNetwork ? fHost ? 6 : 3 : 2; int32_t iIconSize = std::min<int32_t>(C4GUI_IconExHgt, rcBounds.Hgt), iIconSpacing = rcBounds.Wdt/(rcBounds.Wdt >= 400 ? 64 : 128); if ((iIconSize+iIconSpacing*2)*iButtonCount > rcBounds.Wdt) { if (iIconSize*iButtonCount <= rcBounds.Wdt) { iIconSpacing = std::max<int32_t>(0, (rcBounds.Wdt-iIconSize*iButtonCount)/(iButtonCount*2)-1); } else { iIconSpacing = 0; iIconSize = rcBounds.Wdt / iButtonCount; } } C4GUI::ComponentAligner caButtonArea(rcBounds,0,0,true); C4GUI::ComponentAligner caButtons(caButtonArea.GetCentered((iIconSize+2*iIconSpacing)*iButtonCount, iIconSize),iIconSpacing,0); // add buttons if (fNetwork && fHost) { bool fIsInternet = !!Config.Network.MasterServerSignUp, fIsDisabled = false; // league currently implies master server signup, and can thus not be turned off if (fLobby && Game.Parameters.isLeague()) { fIsInternet = true; fIsDisabled = true; } btnInternet = new C4GUI::CallbackButton<C4GameOptionButtons, C4GUI::IconButton>(fIsInternet ? C4GUI::Ico_Ex_InternetOn : C4GUI::Ico_Ex_InternetOff, caButtons.GetFromLeft(iIconSize, iIconSize), LoadResStr("IDS_DLGTIP_STARTINTERNETGAME"), &C4GameOptionButtons::OnBtnInternet, this); btnInternet->SetEnabled(!fIsDisabled); AddElement(btnInternet); } else btnInternet = nullptr; bool fIsLeague = false; // League button if (fNetwork) { C4GUI::Icons eLeagueIcon; fIsLeague = fLobby ? Game.Parameters.isLeague() : !!Config.Network.LeagueServerSignUp; eLeagueIcon = fIsLeague ? C4GUI::Ico_Ex_LeagueOn : C4GUI::Ico_Ex_LeagueOff; btnLeague = new C4GUI::CallbackButton<C4GameOptionButtons, C4GUI::IconButton>(eLeagueIcon, caButtons.GetFromLeft(iIconSize, iIconSize), LoadResStr("IDS_DLGTIP_STARTLEAGUEGAME"), &C4GameOptionButtons::OnBtnLeague, this); btnLeague->SetEnabled(fHost && !fLobby); AddElement(btnLeague); } else btnLeague=nullptr; if (fNetwork && fHost) { btnPassword = new C4GUI::CallbackButton<C4GameOptionButtons, C4GUI::IconButton>(::Network.isPassworded() ? C4GUI::Ico_Ex_Locked : C4GUI::Ico_Ex_Unlocked, caButtons.GetFromLeft(iIconSize, iIconSize), LoadResStr("IDS_NET_PASSWORD_DESC"), &C4GameOptionButtons::OnBtnPassword, this); AddElement(btnPassword); btnComment = new C4GUI::CallbackButton<C4GameOptionButtons, C4GUI::IconButton>(C4GUI::Ico_Ex_Comment, caButtons.GetFromLeft(iIconSize, iIconSize), LoadResStr("IDS_DESC_COMMENTDESCRIPTIONFORTHIS"), &C4GameOptionButtons::OnBtnComment, this); AddElement(btnComment); } else btnPassword=btnComment=nullptr; btnRecord = new C4GUI::CallbackButton<C4GameOptionButtons, C4GUI::IconButton>(Game.Record || fIsLeague ? C4GUI::Ico_Ex_RecordOn : C4GUI::Ico_Ex_RecordOff, caButtons.GetFromLeft(iIconSize, iIconSize), LoadResStr("IDS_DLGTIP_RECORD"), &C4GameOptionButtons::OnBtnRecord, this); btnRecord->SetEnabled(!fIsLeague); AddElement(btnRecord); }
C4StartupMainDlg::C4StartupMainDlg() : C4StartupDlg(NULL) // create w/o title; it is drawn in custom draw proc { // ctor fFirstShown = true; // screen calculations int iButtonPadding = 2; int iButtonHeight = C4GUI_BigButtonHgt; C4GUI::ComponentAligner caMain(rcBounds, 0,0,true); C4GUI::ComponentAligner caRightPanel(caMain.GetFromLeft(rcBounds.Wdt*2/5), rcBounds.Wdt/26, 40+rcBounds.Hgt/5); C4GUI::ComponentAligner caButtons(caRightPanel.GetAll(), 0, iButtonPadding); // main menu buttons C4GUI::CallbackButton<C4StartupMainDlg> *btn; AddElement(btn = new C4GUI::CallbackButton<C4StartupMainDlg>(LoadResStr("IDS_BTN_LOCALGAME"), caButtons.GetFromTop(iButtonHeight), &C4StartupMainDlg::OnStartBtn)); btn->SetToolTip(LoadResStr("IDS_DLGTIP_STARTGAME")); btn->SetCustomGraphics(&C4Startup::Get()->Graphics.barMainButtons, &C4Startup::Get()->Graphics.barMainButtonsDown); pStartButton = btn; AddElement(btn = new C4GUI::CallbackButton<C4StartupMainDlg>(LoadResStr("IDS_BTN_NETWORKGAME"), caButtons.GetFromTop(iButtonHeight), &C4StartupMainDlg::OnNetJoinBtn)); btn->SetToolTip(LoadResStr("IDS_DLGTIP_NETWORKGAME")); btn->SetCustomGraphics(&C4Startup::Get()->Graphics.barMainButtons, &C4Startup::Get()->Graphics.barMainButtonsDown); AddElement(btn = new C4GUI::CallbackButton<C4StartupMainDlg>(LoadResStr("IDS_DLG_PLAYERSELECTION"), caButtons.GetFromTop(iButtonHeight), &C4StartupMainDlg::OnPlayerSelectionBtn)); btn->SetToolTip(LoadResStr("IDS_DLGTIP_PLAYERSELECTION")); btn->SetCustomGraphics(&C4Startup::Get()->Graphics.barMainButtons, &C4Startup::Get()->Graphics.barMainButtonsDown); AddElement(btn = new C4GUI::CallbackButton<C4StartupMainDlg>(LoadResStr("IDS_DLG_OPTIONS"), caButtons.GetFromTop(iButtonHeight), &C4StartupMainDlg::OnOptionsBtn)); btn->SetToolTip(LoadResStr("IDS_DLGTIP_OPTIONS")); btn->SetCustomGraphics(&C4Startup::Get()->Graphics.barMainButtons, &C4Startup::Get()->Graphics.barMainButtonsDown); AddElement(btn = new C4GUI::CallbackButton<C4StartupMainDlg>(LoadResStr("IDS_DLG_ABOUT"), caButtons.GetFromTop(iButtonHeight), &C4StartupMainDlg::OnAboutBtn)); btn->SetToolTip(LoadResStr("IDS_DLGTIP_ABOUT")); btn->SetCustomGraphics(&C4Startup::Get()->Graphics.barMainButtons, &C4Startup::Get()->Graphics.barMainButtonsDown); AddElement(btn = new C4GUI::CallbackButton<C4StartupMainDlg>(LoadResStr("IDS_DLG_EXIT"), caButtons.GetFromTop(iButtonHeight), &C4StartupMainDlg::OnExitBtn)); btn->SetToolTip(LoadResStr("IDS_DLGTIP_EXIT")); btn->SetCustomGraphics(&C4Startup::Get()->Graphics.barMainButtons, &C4Startup::Get()->Graphics.barMainButtonsDown); // list of selected players AddElement(pParticipantsLbl = new C4GUI::Label("test", GetClientRect().Wdt*39/40, GetClientRect().Hgt*9/10, ARight, 0xffffffff, &::GraphicsResource.TitleFont, false)); pParticipantsLbl->SetToolTip(LoadResStr("IDS_DLGTIP_SELECTEDPLAYERS")); // player selection shortcut - to be made optional UpdateParticipants(); pParticipantsLbl->SetContextHandler(new C4GUI::CBContextHandler<C4StartupMainDlg>(this, &C4StartupMainDlg::OnPlayerSelContext)); // key bindings C4CustomKey::CodeList keys; keys.push_back(C4KeyCodeEx(K_DOWN)); keys.push_back(C4KeyCodeEx(K_RIGHT)); if (Config.Controls.GamepadGuiControl) { keys.push_back(C4KeyCodeEx(KEY_Gamepad(0, KEY_JOY_Down))); // right will be done by Dialog already } pKeyDown = new C4KeyBinding(keys, "StartupMainCtrlNext", KEYSCOPE_Gui, new C4GUI::DlgKeyCBEx<C4StartupMainDlg, bool>(*this, false, &C4StartupMainDlg::KeyAdvanceFocus), C4CustomKey::PRIO_CtrlOverride); keys.clear(); keys.push_back(C4KeyCodeEx(K_UP)); keys.push_back(C4KeyCodeEx(K_LEFT)); if (Config.Controls.GamepadGuiControl) { keys.push_back(C4KeyCodeEx(KEY_Gamepad(0, KEY_JOY_Up))); // left will be done by Dialog already } pKeyUp = new C4KeyBinding(keys, "StartupMainCtrlPrev", KEYSCOPE_Gui, new C4GUI::DlgKeyCBEx<C4StartupMainDlg, bool>(*this, true, &C4StartupMainDlg::KeyAdvanceFocus), C4CustomKey::PRIO_CtrlOverride); keys.clear(); keys.push_back(C4KeyCodeEx(K_RETURN)); pKeyEnter = new C4KeyBinding(keys, "StartupMainOK", KEYSCOPE_Gui, new C4GUI::DlgKeyCB<C4StartupMainDlg>(*this, &C4StartupMainDlg::KeyEnterDown, &C4StartupMainDlg::KeyEnterUp), C4CustomKey::PRIO_CtrlOverride); }
C4StartupNetDlg::C4StartupNetDlg() : C4StartupDlg(LoadResStr("IDS_DLG_NETSTART")) { // ctor // key bindings C4CustomKey::CodeList keys; keys.emplace_back(K_BACK); keys.emplace_back(K_LEFT); pKeyBack = new C4KeyBinding(keys, "StartupNetBack", KEYSCOPE_Gui, new C4GUI::DlgKeyCB<C4StartupNetDlg>(*this, &C4StartupNetDlg::KeyBack), C4CustomKey::PRIO_Dlg); pKeyRefresh = new C4KeyBinding(C4KeyCodeEx(K_F5), "StartupNetReload", KEYSCOPE_Gui, new C4GUI::DlgKeyCB<C4StartupNetDlg>(*this, &C4StartupNetDlg::KeyRefresh), C4CustomKey::PRIO_CtrlOverride); // screen calculations UpdateSize(); int32_t iIconSize = C4GUI_IconExWdt; int32_t iButtonWidth,iCaptionFontHgt, iSideSize = std::max<int32_t>(GetBounds().Wdt/6, iIconSize); int32_t iButtonHeight = C4GUI_ButtonHgt, iButtonIndent = GetBounds().Wdt/40; ::GraphicsResource.CaptionFont.GetTextExtent("<< BACK", iButtonWidth, iCaptionFontHgt, true); iButtonWidth *= 3; C4GUI::ComponentAligner caMain(GetClientRect(), 0,0, true); C4GUI::ComponentAligner caButtonArea(caMain.GetFromBottom(caMain.GetHeight()/7),0,0); int32_t iButtonAreaWdt = caButtonArea.GetWidth()*7/8; iButtonWidth = std::min<int32_t>(iButtonWidth, (iButtonAreaWdt - 8 * iButtonIndent)/4); iButtonIndent = (iButtonAreaWdt - 4 * iButtonWidth) / 8; C4GUI::ComponentAligner caButtons(caButtonArea.GetCentered(iButtonAreaWdt, iButtonHeight),iButtonIndent,0); C4GUI::ComponentAligner caLeftBtnArea(caMain.GetFromLeft(iSideSize), std::min<int32_t>(caMain.GetWidth()/20, (iSideSize-C4GUI_IconExWdt)/2), caMain.GetHeight()/40); C4GUI::ComponentAligner caConfigArea(caMain.GetFromRight(iSideSize), std::min<int32_t>(caMain.GetWidth()/20, (iSideSize-C4GUI_IconExWdt)/2), caMain.GetHeight()/40); // left button area: Switch between chat and game list if (C4ChatDlg::IsChatEnabled()) { btnGameList = new C4GUI::CallbackButton<C4StartupNetDlg, C4GUI::IconButton>(C4GUI::Ico_Ex_GameList, caLeftBtnArea.GetFromTop(iIconSize, iIconSize), '\0', &C4StartupNetDlg::OnBtnGameList); btnGameList->SetToolTip(LoadResStr("IDS_DESC_SHOWSAVAILABLENETWORKGAME")); btnGameList->SetText(LoadResStr("IDS_BTN_GAMES")); AddElement(btnGameList); btnChat = new C4GUI::CallbackButton<C4StartupNetDlg, C4GUI::IconButton>(C4GUI::Ico_Ex_Chat, caLeftBtnArea.GetFromTop(iIconSize, iIconSize), '\0', &C4StartupNetDlg::OnBtnChat); btnChat->SetToolTip(LoadResStr("IDS_DESC_CONNECTSTOANIRCCHATSERVER")); btnChat->SetText(LoadResStr("IDS_BTN_CHAT")); AddElement(btnChat); } else btnChat = nullptr; // main area: Tabular to switch between game list and chat pMainTabular = new C4GUI::Tabular(caMain.GetAll(), C4GUI::Tabular::tbNone); pMainTabular->SetDrawDecoration(false); pMainTabular->SetSheetMargin(0); AddElement(pMainTabular); // main area: game selection sheet C4GUI::Tabular::Sheet *pSheetGameList = pMainTabular->AddSheet(nullptr); C4GUI::ComponentAligner caGameList(pSheetGameList->GetContainedClientRect(), 0,0, false); C4GUI::WoodenLabel *pGameListLbl; int32_t iCaptHgt = C4GUI::WoodenLabel::GetDefaultHeight(&::GraphicsResource.TextFont); pGameListLbl = new C4GUI::WoodenLabel(LoadResStr("IDS_NET_GAMELIST"), caGameList.GetFromTop(iCaptHgt), C4GUI_Caption2FontClr, &::GraphicsResource.TextFont, ALeft); // search field C4GUI::WoodenLabel *pSearchLbl; const char *szSearchLblText = LoadResStr("IDS_NET_MSSEARCH"); int32_t iSearchWdt=100, iSearchHgt; ::GraphicsResource.TextFont.GetTextExtent(szSearchLblText, iSearchWdt, iSearchHgt, true); C4GUI::ComponentAligner caSearch(caGameList.GetFromTop(iSearchHgt), 0,0); pSearchLbl = new C4GUI::WoodenLabel(szSearchLblText, caSearch.GetFromLeft(iSearchWdt+10), C4GUI_Caption2FontClr, &::GraphicsResource.TextFont); const char *szSearchTip = LoadResStr("IDS_NET_MSSEARCH_DESC"); pSearchLbl->SetToolTip(szSearchTip); pSheetGameList->AddElement(pSearchLbl); pSearchFieldEdt = new C4GUI::CallbackEdit<C4StartupNetDlg>(caSearch.GetAll(), this, &C4StartupNetDlg::OnSearchFieldEnter); pSearchFieldEdt->SetToolTip(szSearchTip); pSheetGameList->AddElement(pSearchFieldEdt); pSheetGameList->AddElement(pGameListLbl); pGameSelList = new C4GUI::ListBox(caGameList.GetFromTop(caGameList.GetHeight() - iCaptHgt)); pGameSelList->SetDecoration(true, nullptr, true, true); pGameSelList->UpdateElementPositions(); pGameSelList->SetSelectionDblClickFn(new C4GUI::CallbackHandler<C4StartupNetDlg>(this, &C4StartupNetDlg::OnSelDblClick)); pGameSelList->SetSelectionChangeCallbackFn(new C4GUI::CallbackHandler<C4StartupNetDlg>(this, &C4StartupNetDlg::OnSelChange)); pSheetGameList->AddElement(pGameSelList); C4GUI::ComponentAligner caIP(caGameList.GetAll(), 0,0); C4GUI::WoodenLabel *pIPLbl; const char *szIPLblText = LoadResStr("IDS_NET_IP"); int32_t iIPWdt=100, Q; ::GraphicsResource.TextFont.GetTextExtent(szIPLblText, iIPWdt, Q, true); pIPLbl = new C4GUI::WoodenLabel(szIPLblText, caIP.GetFromLeft(iIPWdt+10), C4GUI_Caption2FontClr, &::GraphicsResource.TextFont); const char *szIPTip = LoadResStr("IDS_NET_IP_DESC"); pIPLbl->SetToolTip(szIPTip); pSheetGameList->AddElement(pIPLbl); pJoinAddressEdt = new C4GUI::CallbackEdit<C4StartupNetDlg>(caIP.GetAll(), this, &C4StartupNetDlg::OnJoinAddressEnter); pJoinAddressEdt->SetToolTip(szIPTip); pSheetGameList->AddElement(pJoinAddressEdt); // main area: chat sheet if (C4ChatDlg::IsChatEnabled()) { C4GUI::Tabular::Sheet *pSheetChat = pMainTabular->AddSheet(nullptr); C4GUI::ComponentAligner caChat(pSheetChat->GetContainedClientRect(), 0,0, false); pSheetChat->AddElement(pChatTitleLabel = new C4GUI::WoodenLabel("", caChat.GetFromTop(iCaptHgt), C4GUI_Caption2FontClr, &::GraphicsResource.TextFont, ALeft, false)); C4GUI::GroupBox *pChatGroup = new C4GUI::GroupBox(caChat.GetAll()); pChatGroup->SetColors(0u, C4GUI_CaptionFontClr, C4GUI_StandardBGColor); pChatGroup->SetMargin(2); pSheetChat->AddElement(pChatGroup); pChatCtrl = new C4ChatControl(&Application.IRCClient); pChatCtrl->SetBounds(pChatGroup->GetContainedClientRect()); pChatCtrl->SetTitleChangeCB(new C4GUI::InputCallback<C4StartupNetDlg>(this, &C4StartupNetDlg::OnChatTitleChange)); StdStrBuf sCurrTitle; sCurrTitle.Ref(pChatCtrl->GetTitle()); OnChatTitleChange(sCurrTitle); pChatGroup->AddElement(pChatCtrl); } // config area btnInternet = new C4GUI::CallbackButton<C4StartupNetDlg, C4GUI::IconButton>(Config.Network.MasterServerSignUp ? C4GUI::Ico_Ex_InternetOn : C4GUI::Ico_Ex_InternetOff, caConfigArea.GetFromTop(iIconSize, iIconSize), '\0', &C4StartupNetDlg::OnBtnInternet); btnInternet->SetToolTip(LoadResStr("IDS_DLGTIP_SEARCHINTERNETGAME")); btnInternet->SetText(LoadResStr("IDS_CTL_INETSERVER")); AddElement(btnInternet); btnRecord = new C4GUI::CallbackButton<C4StartupNetDlg, C4GUI::IconButton>(Game.Record ? C4GUI::Ico_Ex_RecordOn : C4GUI::Ico_Ex_RecordOff, caConfigArea.GetFromTop(iIconSize, iIconSize), '\0', &C4StartupNetDlg::OnBtnRecord); btnRecord->SetToolTip(LoadResStr("IDS_DLGTIP_RECORD")); btnRecord->SetText(LoadResStr("IDS_CTL_RECORD")); AddElement(btnRecord); #ifdef WITH_AUTOMATIC_UPDATE btnUpdate = new C4GUI::CallbackButton<C4StartupNetDlg, C4GUI::IconButton>(C4GUI::Ico_Ex_Update, caConfigArea.GetFromTop(iIconSize, iIconSize), '\0', &C4StartupNetDlg::OnBtnUpdate); btnUpdate->SetVisibility(false); // update only available if masterserver notifies it btnUpdate->SetToolTip(LoadResStr("IDS_DLGTIP_UPDATE")); btnUpdate->SetText(LoadResStr("IDS_CTL_UPDATE")); AddElement(btnUpdate); #endif // button area C4GUI::CallbackButton<C4StartupNetDlg> *btn; AddElement(btn = new C4GUI::CallbackButton<C4StartupNetDlg>(LoadResStr("IDS_BTN_BACK"), caButtons.GetFromLeft(iButtonWidth), &C4StartupNetDlg::OnBackBtn)); btn->SetToolTip(LoadResStr("IDS_DLGTIP_BACKMAIN")); AddElement(btnRefresh = new C4GUI::CallbackButton<C4StartupNetDlg>(LoadResStr("IDS_BTN_RELOAD"), caButtons.GetFromLeft(iButtonWidth), &C4StartupNetDlg::OnRefreshBtn)); btnRefresh->SetToolTip(LoadResStr("IDS_NET_RELOAD_DESC")); AddElement(btnJoin = new C4GUI::CallbackButton<C4StartupNetDlg>(LoadResStr("IDS_NET_JOINGAME_BTN"), caButtons.GetFromLeft(iButtonWidth), &C4StartupNetDlg::OnJoinGameBtn)); btnJoin->SetToolTip(LoadResStr("IDS_NET_JOINGAME_DESC")); AddElement(btn = new C4GUI::CallbackButton<C4StartupNetDlg>(LoadResStr("IDS_NET_NEWGAME"), caButtons.GetFromLeft(iButtonWidth), &C4StartupNetDlg::OnCreateGameBtn)); btn->SetToolTip(LoadResStr("IDS_NET_NEWGAME_DESC")); // initial dlg mode UpdateDlgMode(); // initial focus SetFocus(GetDlgModeFocusControl(), false); // initialize discovery DiscoverClient.Init(Config.Network.PortDiscovery); DiscoverClient.StartDiscovery(); iGameDiscoverInterval = C4NetGameDiscoveryInterval; // register timer Application.Add(this); // register as receiver of reference notifies Application.InteractiveThread.SetCallback(Ev_HTTP_Response, this); }
C4StartupAboutDlg::C4StartupAboutDlg() : C4StartupDlg("") { // ctor UpdateSize(); // key bindings: No longer back on any key pKeyBack = NULL; //C4CustomKey::CodeList keys; //keys.push_back(C4KeyCodeEx(KEY_Any)); keys.push_back(C4KeyCodeEx(KEY_JOY_AnyButton)); //pKeyBack = new C4KeyBinding(keys, "StartupAboutBack", KEYSCOPE_Gui, // new C4GUI::DlgKeyCB<C4StartupAboutDlg>(*this, &C4StartupAboutDlg::KeyBack), C4CustomKey::PRIO_Dlg); // version and registration info in topright corner C4Rect rcClient = GetContainedClientRect(); StdStrBuf sVersion; sVersion.Format(LoadResStr("IDS_DLG_VERSION"), C4VERSION); CStdFont &rUseFont = C4GUI::GetRes()->TextFont; int32_t iInfoWdt = Min<int32_t>(rcClient.Wdt/2, rUseFont.GetTextWidth("General info text width")*2); C4GUI::ComponentAligner caInfo(C4Rect(rcClient.x + rcClient.Wdt - iInfoWdt, rcClient.y, iInfoWdt, rcClient.Hgt/8), 0,0, false); AddElement(new C4GUI::Label(sVersion.getData(), caInfo.GetGridCell(0,1,0,4), ARight)); StdStrBuf sRegStr, sKeyFile; if (Config.Registered()) { StdStrBuf sRegName, sFirstName, sLastName, sNick; sFirstName.Copy(Config.GetRegistrationData("FirstName")); sLastName.Copy(Config.GetRegistrationData("LastName")); sNick.Copy(Config.GetRegistrationData("Nick")); sRegName.Format("%s %s (%s)", sFirstName.getData(), sLastName.getData(), sNick.getData()); sRegStr.Format(LoadResStr("IDS_PRC_REG"), sRegName.getData()); sKeyFile.Format(LoadResStr("IDS_CTL_KEYFILE")); sKeyFile+=" "; sKeyFile+=Config.GetKeyFilename(); C4GUI::Label *pLbl; AddElement(pLbl = new C4GUI::Label(sRegStr.getData(), caInfo.GetGridCell(0,1,1,4), ARight)); pLbl->SetToolTip(sKeyFile.getData()); AddElement(pLbl = new C4GUI::Label(FormatString("%s %s", LoadResStr("IDS_CTL_CUID"), Config.GetRegistrationData("Cuid")).getData(), caInfo.GetGridCell(0,1,2,4), ARight)); pLbl->SetToolTip(sKeyFile.getData()); AddElement(pWebCodeLbl = new C4GUI::Label("", caInfo.GetGridCell(0,1,3,4), ARight)); pWebCodeLbl ->SetToolTip(sKeyFile.getData()); } else { /*AddElement(new C4GUI::Label(FormatString("%s - %s", "FREEWARE", LoadResStr("IDS_CTL_UNREGISTERED")).getData(), caInfo.GetGridCell(0,1,1,4), ARight));*/ AddElement(new C4GUI::Label("FREEWARE", caInfo.GetGridCell(0,1,1,4), ARight)); AddElement(new C4GUI::Label(Config.GetRegistrationError(), caInfo.GetGridCell(0,1,2,4), ARight)); pWebCodeLbl = NULL; } // webcode-display timer iWebCodeTimer = C4AboutWebCodeShowTime + 1; pSec1Timer = new C4Sec1TimerCallback<C4StartupAboutDlg>(this); OnSec1Timer(); // bottom line buttons C4GUI::ComponentAligner caMain(rcClient, 0,0, true); C4GUI::ComponentAligner caButtons(caMain.GetFromBottom(caMain.GetHeight()*1/8), 0,0, false); C4GUI::CallbackButton<C4StartupAboutDlg> *btn; int32_t iButtonWidth = caButtons.GetInnerWidth() / 4; AddElement(btn = new C4GUI::CallbackButton<C4StartupAboutDlg>(LoadResStr("IDS_BTN_BACK"), caButtons.GetGridCell(0,3,0,1,iButtonWidth,C4GUI_ButtonHgt,true), &C4StartupAboutDlg::OnBackBtn)); btn->SetToolTip(LoadResStr("IDS_DLGTIP_BACKMAIN")); /*if (!Config.Registered()) { AddElement(btn = new C4GUI::CallbackButton<C4StartupAboutDlg>(LoadResStr("IDS_BTN_REGISTERNOW"), caButtons.GetGridCell(1,3,0,1,iButtonWidth,C4GUI_ButtonHgt,true), &C4StartupAboutDlg::OnRegisterBtn)); btn->SetToolTip(LoadResStr("IDS_DESC_GOTOTHEONLINEREGISTRATION")); }*/ #ifdef NETWORK AddElement(btn = new C4GUI::CallbackButton<C4StartupAboutDlg>(LoadResStr("IDS_BTN_CHECKFORUPDATES"), caButtons.GetGridCell(2,3,0,1,iButtonWidth,C4GUI_ButtonHgt,true), &C4StartupAboutDlg::OnUpdateBtn)); btn->SetToolTip(LoadResStr("IDS_DESC_CHECKONLINEFORNEWVERSIONS")); #endif }