43 int iHours = iSeconds / 3600; iSeconds -= 3600*iHours;
44 int iMinutes = iSeconds / 60; iSeconds -= 60*iMinutes;
45 return FormatString(
"%02d:%02d:%02d",iHours,iMinutes,iSeconds);
52 struct tm *pLocalTime;
53 pLocalTime=localtime(&tTime);
57 pLocalTime->tm_year+1900,
65 :
Control(
C4Rect(0,0,0,0)), pCheck(nullptr), pNameLabel(nullptr), pPlrSelDlg(pForDlg), pIcon(nullptr)
69 int32_t iHeight = rUseFont.
GetLineHeight() + 2 * IconLabelSpacing;
77 pNameLabel->SetAutosize(
false);
79 SetBounds(pIcon->GetBounds());
82 AddElement(pIcon); AddElement(pNameLabel);
86 C4Rect rcNameLabelBounds = pNameLabel->GetBounds();
87 rcNameLabelBounds.
Wdt = GetClientRect().Wdt - rcNameLabelBounds.
x - IconLabelSpacing;
88 pNameLabel->SetBounds(rcNameLabelBounds);
93 C4StartupPlrSelDlg::ListItem::~ListItem()
98 const char *C4StartupPlrSelDlg::ListItem::GetName()
const
101 return pNameLabel->GetText();
104 void C4StartupPlrSelDlg::ListItem::SetName(
const char *szNewName)
107 pNameLabel->SetText(szNewName);
109 SetToolTip(szNewName);
112 void C4StartupPlrSelDlg::ListItem::GrabIcon(
C4FacetSurface &rFromFacet)
117 pIcon->GetMFacet().GrabFrom(rFromFacet);
123 pIcon->GetMFacet().Clear();
127 void C4StartupPlrSelDlg::ListItem::SetIcon(
C4GUI::Icons icoNew)
129 pIcon->SetIcon(icoNew);
132 void C4StartupPlrSelDlg::ListItem::UpdateOwnPos()
136 ParentClass::UpdateOwnPos();
142 void C4StartupPlrSelDlg::ListItem::SetFilename(
const StdStrBuf &sNewFN)
145 Filename.Copy(sNewFN);
148 bool C4StartupPlrSelDlg::ListItem::CheckNameHotkey(
const char * c)
153 if (!pNameLabel)
return false;
154 const char *szName = pNameLabel->GetText();
155 return szName && (toupper(*szName) == toupper(c[0]));
162 : ListItem(pForDlg, pForListBox, pInsertBeforeElement, fActivated), fHasCustomIcon(false)
170 SetFilename(rsFilename);
175 if (!Core.Load(PlrGroup))
180 fHasCustomIcon =
true;
184 fctIcon.
Create(iHeight,iHeight);
189 if (!PlrGroup.
Close())
193 SetName(Core.PrefName);
199 pPlrSelDlg->SetSelection(
this);
210 fHasCustomIcon = !!fctGrabFrom.
Surface;
212 GrabIcon(fctGrabFrom);
219 || !NewCore.
Save(PlrGroup)
220 || !PlrGroup.
Close())
226 SetName(Core.PrefName);
230 fHasCustomIcon =
false;
238 if (pDlg && pDlg->
GetSelection() ==
this) pDlg->UpdateSelection();
246 pSelectionInfo->
AddTextLine(
FormatString(
LoadResStr(
"IDS_DESC_PLAYER"), (
int)Core.TotalScore, (
int)Core.Rounds, (
int)Core.RoundsWon, (
int)Core.RoundsLost,
TimeString(Core.TotalPlayingTime).
getData(), Core.Comment).
getData(), &
C4Startup::Get()->
Graphics.
BookFont,
ClrPlayerItem,
false,
false);
247 if (Core.LastRound.Title[0])
256 int32_t iPlrTime = Core.TotalPlayingTime;
257 if (iPlrTime > 60*60*10)
271 PathTo.
Append(szToFilename);
283 :
ListItem(pForDlg, pForListBox, nullptr, false), fLoaded(false), dwPlrClr(dwPlrClr), pParentGrp(nullptr)
288 void C4StartupPlrSelDlg::CrewListItem::UpdateClonkEnabled()
290 if (!fLoaded)
return;
291 Core.Participation = pCheck->GetChecked();
296 void C4StartupPlrSelDlg::CrewListItem::Load(
C4Group &rGrp,
const StdStrBuf &rsFilename)
299 SetFilename(rsFilename);
303 throw LoadError(
FormatString(
"Error loading crew file from %s in %s: Error opening group: %s",
305 if (!Core.Load(CrewGroup))
306 throw LoadError(
FormatString(
"Error loading crew file from %s: Core data invalid or missing (Group: %s)!",
308 ListItem::SetName(Core.Name);
309 pCheck->SetChecked(!!Core.Participation);
331 pPlrSelDlg->SetSelection(
this);
340 void C4StartupPlrSelDlg::CrewListItem::OnDeathMessageCtx(
C4GUI::Element *el)
349 void C4StartupPlrSelDlg::CrewListItem::OnDeathMessageSet(
const StdStrBuf &rsNewMessage)
359 void C4StartupPlrSelDlg::CrewListItem::RewriteCore()
361 if (!fLoaded)
return;
364 || !Core.Save(CrewGroup,
nullptr)
365 || !CrewGroup.
Close() || !pParentGrp->Save(
true))
372 bool C4StartupPlrSelDlg::CrewListItem::SetName(
const char *szNewName)
374 if (!fLoaded)
return false;
376 if (!szNewName || !*szNewName)
return false;
377 if (
SEqual(szNewName, Core.Name))
return true;
382 if (!*fn)
return false;
388 if (pParentGrp->FindEntry(fn))
395 if (!pParentGrp->Rename(
GetFilename().getData(), fn) || !pParentGrp->Save(
true))
401 const char *szConstFn = fn;
405 ListItem::SetName(szNewName);
411 void C4StartupPlrSelDlg::CrewListItem::SetSelectionInfo(
C4GUI::TextWindow *pSelectionInfo)
417 int32_t iNextRankExp;
StdStrBuf sNextRankName;
418 if (Core.GetNextRankInfo(::
DefaultRanks, &iNextRankExp, &sNextRankName))
423 Core.TypeName, Core.Experience, Core.Rounds, Core.DeathCount,
429 StdStrBuf C4StartupPlrSelDlg::CrewListItem::GetDelWarning()
433 Core.sRankName.getData(), Core.Name,
GetFilename().getData());
434 int32_t iPlrTime = Core.TotalPlayingTime;
435 if (iPlrTime > 60*60*10)
440 void C4StartupPlrSelDlg::CrewListItem::CrewRename()
442 if (pPlrSelDlg->pRenameEdit)
return;
447 void C4StartupPlrSelDlg::CrewListItem::AbortRenaming(RenameParams par)
450 pPlrSelDlg->pRenameEdit =
nullptr;
457 pPlrSelDlg->pRenameEdit =
nullptr;
460 if (pDlg && pDlg->
GetSelection() ==
this) pDlg->UpdateSelection();
477 int iButtonCount = 6;
481 iBottomButtonWidth = (caButtonArea.
GetWidth() - iButtonXSpacing * (iButtonCount-1)) / iButtonCount;
492 AddElement(pSelectionInfo =
new C4GUI::TextWindow(rcInfoWindow,0,0,0,100,4096,
" ",
false,
nullptr,0,
true));
497 C4Rect rcDefault(0,0,10,10);
511 if (!pPlrListBox->
GetFirst()) UpdateSelection();
518 keys.emplace_back(K_BACK);
519 keys.emplace_back(K_LEFT);
520 keys.emplace_back(K_ESCAPE);
541 delete pKeyProperties;
555 Base::DrawElement(cgo);
558 void C4StartupPlrSelDlg::UpdateBottomButtons()
600 void C4StartupPlrSelDlg::UpdatePlayerList()
607 while ((pEl = pPlrListBox->
GetFirst()))
delete pEl;
609 UpdateBottomButtons();
619 PlayerListItem *pFirstActivatedPlrItem=
nullptr, *pFirstDeactivatedPlrItem=
nullptr, *pPlrItem=
nullptr;
626 pPlrItem =
new PlayerListItem(
this, pPlrListBox,
nullptr, fIsParticipating);
631 catch (ListItem::LoadError & e)
638 if (fIsParticipating)
640 if (!pFirstActivatedPlrItem) pFirstActivatedPlrItem = pPlrItem;
642 else if (!pFirstDeactivatedPlrItem) pFirstDeactivatedPlrItem = pPlrItem;
645 if (!(pPlrItem = pFirstActivatedPlrItem))
646 pPlrItem = pFirstDeactivatedPlrItem;
650 UpdateActivatedPlayers();
664 pCrewItem->Load(CurrPlayer.Grp,
StdStrBuf(szFn));
666 catch (ListItem::LoadError & e)
694 void C4StartupPlrSelDlg::UpdateSelection()
701 if (pSel && pSel->IsActivated())
719 pSel->SetSelectionInfo(pSelectionInfo);
729 if (pCheckBox && pEl != pCheckBox->
GetParent())
730 pEl->SetActivated(
false);
732 UpdateActivatedPlayers();
743 void C4StartupPlrSelDlg::UpdateActivatedPlayers()
745 assert(eMode == PSDM_Player);
748 for (
ListItem *pPlrItem =
static_cast<ListItem *
>(pPlrListBox->
GetFirst()); pPlrItem; pPlrItem = pPlrItem->GetNext())
749 if (pPlrItem->IsActivated())
751 const char *szAddFilename = pPlrItem->GetFilename().getData();
756 pPlrItem->SetActivated(
false);
768 pSel->SetActivated(!pSel->IsActivated());
793 if (eMode != PSDM_Player)
return;
808 Filename.
Copy(Playername);
838 if (eMode != PSDM_Player)
return;
844 void C4StartupPlrSelDlg::SetPlayerMode()
849 LastPlrFilename.
Copy(
static_cast<const StdStrBuf &
>(CurrPlayer.Grp.GetFullName()));
850 CurrPlayer.Grp.Close();
853 SelectItem(LastPlrFilename,
false);
857 void C4StartupPlrSelDlg::SetCrewMode(PlayerListItem *pSel)
860 CurrPlayer.Core = pSel->GetCore();
864 Path.Append(pSel->GetFilename());
866 if (!CurrPlayer.Grp.Open(Path.getData()))
return;
872 CurrPlayer.Core.PrefName).
getData(),
902 Path.
Append(pSel->GetFilename());
911 if (!CurrPlayer.Grp.DeleteEntry(pSel->GetFilename().getData()))
922 void C4StartupPlrSelDlg::SelectItem(
const StdStrBuf &Filename,
bool fActivate)
925 for (
ListItem *pPlrItem =
static_cast<ListItem *
>(pPlrListBox->
GetFirst()); pPlrItem; pPlrItem = pPlrItem->GetNext())
933 pPlrItem->SetActivated(
true);
993 const auto *pItem1 =
static_cast<const CrewListItem *
>(pEl1);
994 const auto *pItem2 =
static_cast<const CrewListItem *
>(pEl2);
1001 if (i == rSortData.end())
return -1;
else if (j == rSortData.end())
return +1;
1002 return (*i).iMaxExp - (*j).iMaxExp;
1005 return pItem1->GetCore().Experience - pItem2->GetCore().Experience;
1008 void C4StartupPlrSelDlg::ResortCrew()
1010 assert(eMode == PSDM_Crew);
1016 if (i == SortData.end())
1017 SortData.emplace_back(pCrewItem->GetCore().Experience, pCrewItem->GetCore().id);
1019 (*i).iMaxExp = std::max<int32_t>((*i).iMaxExp, pCrewItem->GetCore().Experience);
1033 void OnClosed(
bool commit)
override;
1039 Picker(
const C4Rect &bounds);
1042 void SetColor(uint32_t rgb);
1043 uint32_t GetColor()
const;
1052 static const unsigned int HSPickerCursorSize = 5;
1053 static const unsigned int VPickerCursorSize = 7;
1055 C4Rect hsPickerRect, vPickerRect;
1065 bool HandleMouseDown(int32_t x, int32_t y);
1066 void UpdateVFacet(uint32_t h, uint32_t
s);
1067 void UpdatePreview();
1073 static uint32_t HSV2RGB(uint32_t hsv)
1079 float chroma =
s * v;
1080 float x = chroma * (1.f - std::abs(std::fmod(h, 2.f) - 1.f));
1086 switch (
static_cast<int>(h))
1089 r = chroma; g = x;
break;
1091 r = x; g = chroma;
break;
1093 g = chroma;
b = x;
break;
1095 g = x;
b = chroma;
break;
1097 b = chroma; r = x;
break;
1099 b = x; r = chroma;
break;
1105 return RGBA(r * 255.f, g * 255.f,
b * 255.f, hsv >> 24);
1107 static uint32_t RGB2HSV(uint32_t rgb)
1113 float min = std::min(r, std::min(g,
b));
1114 float max = std::max(r, std::max(g,
b));
1116 float chroma = max - min;
1120 hue = std::fmod((g-
b) / chroma, 6.f);
1122 hue = (
b-r) / chroma + 2.f;
1124 hue = (r-g) / chroma + 4.f;
1126 float h = hue / 6.f;
1127 float s = max == 0 ? 0.f : chroma / max;
1130 return RGBA(h * 255.f,
s * 255.f, v * 255.f, rgb >> 24);
1159 C4StartupPlrColorPickerDlg::Picker::Picker(
const C4Rect &bounds)
1160 :
Control(bounds), state(PS_Idle)
1163 caMain.ExpandBottom(-(caMain.GetInnerHeight() - 256));
1164 hsPickerRect = caMain.GetFromLeft(256);
1165 vPickerRect = caMain.GetFromLeft(16 + VPickerCursorSize);
1169 int preview_width = std::min<int>(flagPreviewPic.
Wdt, caMain.GetInnerWidth());
1171 flagPreview->SetFacet(flagPreviewPic);
1175 preview_width = std::min<int>(crewPreviewPic.
Wdt, caMain.GetInnerWidth());
1177 crewPreview->SetFacet(crewPreviewPic);
1181 hsFacet.Create(hsPickerRect.Wdt, hsPickerRect.Hgt);
1182 hsFacet.Surface->Lock();
1183 for (
int y = 0; y < hsFacet.Hgt; ++y)
1184 for (
int x = 0; x < hsFacet.Wdt; ++x)
1185 hsFacet.Surface->SetPixDw(x, y, HSV2RGB(
C4RGB(x, 255-y, 255)));
1186 hsFacet.Surface->Unlock();
1188 vFacet.Create(vPickerRect.Wdt - VPickerCursorSize, vPickerRect.Hgt);
1189 UpdateVFacet(255, 255);
1192 void C4StartupPlrColorPickerDlg::Picker::UpdateVFacet(uint32_t h, uint32_t
s)
1195 vFacet.Surface->Lock();
1196 for (
int y = 0; y < vPickerRect.Hgt; ++y)
1197 for (
int x = 0; x < vFacet.Wdt; ++x)
1198 vFacet.Surface->SetPixDw(x, y, HSV2RGB(
C4RGB(h,
s, 255-y)));
1199 vFacet.Surface->Unlock();
1202 void C4StartupPlrColorPickerDlg::Picker::UpdatePreview()
1204 flagPreview->SetDrawColor(HSV2RGB(hsv));
1205 crewPreview->SetDrawColor(HSV2RGB(hsv));
1208 void C4StartupPlrColorPickerDlg::Picker::SetColor(uint32_t rgb)
1215 uint32_t C4StartupPlrColorPickerDlg::Picker::GetColor()
const
1217 return HSV2RGB(hsv);
1220 void C4StartupPlrColorPickerDlg::Picker::DrawElement(
C4TargetFacet &cgo)
1224 hsFacet.Draw(cgoPicker.Surface, cgoPicker.X, cgoPicker.Y);
1226 cgoPicker.Wdt = cgoPicker.Hgt = HSPickerCursorSize;
1227 cgoPicker.X +=
GetRedValue(hsv) - cgoPicker.Wdt / 2;
1228 cgoPicker.Y += 255 -
GetGreenValue(hsv) - cgoPicker.Hgt / 2;
1229 pDraw->
DrawLineDw(cgoPicker.Surface, cgoPicker.X, cgoPicker.Y, cgoPicker.X + cgoPicker.Wdt, cgoPicker.Y + cgoPicker.Hgt,
C4RGB(0, 0, 0));
1230 pDraw->
DrawLineDw(cgoPicker.Surface, cgoPicker.X + cgoPicker.Wdt, cgoPicker.Y, cgoPicker.X, cgoPicker.Y + cgoPicker.Hgt,
C4RGB(0, 0, 0));
1233 cgoPicker.Set(cgo.
Surface, cgo.
TargetX + vPickerRect.x + VPickerCursorSize, cgo.
TargetY + vPickerRect.y, vPickerRect.Wdt - VPickerCursorSize, vPickerRect.Hgt);
1234 vFacet.Draw(cgoPicker.Surface, cgoPicker.X, cgoPicker.Y);
1236 cgoPicker.Wdt = cgoPicker.Hgt = VPickerCursorSize;
1237 cgoPicker.X -= cgoPicker.Wdt / 2 + 1;
1238 cgoPicker.Y += 255 -
GetBlueValue(hsv) - cgoPicker.Hgt / 2;
1239 for (
int i = 0; i < cgoPicker.Hgt / 2 + 1; ++i)
1240 pDraw->
DrawLineDw(cgoPicker.Surface, cgoPicker.X + i, cgoPicker.Y + i, cgoPicker.X + i, cgoPicker.Y + cgoPicker.Hgt - i,
C4RGB(255, 255, 255));
1243 bool C4StartupPlrColorPickerDlg::Picker::HandleMouseDown(int32_t x, int32_t y)
1245 if (state == PS_IdleDragging)
1251 else if (state == PS_DragHS || (state == PS_Idle && hsPickerRect.Contains(x, y)))
1253 int h =
Clamp(x - hsPickerRect.x, 0, hsPickerRect.Wdt - 1);
1254 assert(
Inside(h, 0, 255));
1255 int s = 255 -
Clamp(y - hsPickerRect.y, 0, hsPickerRect.Hgt - 1);
1263 else if (state == PS_DragV || (state == PS_Idle && vPickerRect.Contains(x, y)))
1265 int v = 255 -
Clamp(y - vPickerRect.y, 0, vPickerRect.Hgt - 1);
1266 assert(
Inside(v, 0, 255));
1267 hsv = (hsv & 0xFFFFFF00) | v;
1275 state = PS_IdleDragging;
1280 void C4StartupPlrColorPickerDlg::Picker::MouseInput(
C4GUI::CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY,
DWORD dwKeyParam)
1282 Control::MouseInput(rMouse, iButton, iX, iY, dwKeyParam);
1284 if (!rMouse.
IsLDown()) state = PS_Idle;
1288 if (HandleMouseDown(iX, iY))
1300 void C4StartupPlrColorPickerDlg::Picker::DoDragging(
C4GUI::CMouse &rMouse, int32_t iX, int32_t iY,
DWORD dwKeyParam)
1302 HandleMouseDown(iX, iY);
1308 : Dialog(
C4Startup::Get()->Graphics.fctPlrPropBG.Wdt,
C4Startup::Get()->Graphics.fctPlrPropBG.Hgt,
"", false), pMainDlg(pParentDlg), pForPlayer(pForPlayer), fClearBigIcon(false)
1328 const int32_t BetweenElementDist = 2;
1337 const char *szTitle;
1369 caColorArea.
ExpandTop(-BetweenElementDist);
1372 caPictureArea.
ExpandTop(-BetweenElementDist);
1375 szTip =
LoadResStr(
"IDS_DLGTIP_PLAYERCOLORS");
1389 UpdatePlayerColor(
true);
1395 caControlArea.
ExpandTop(-BetweenElementDist);
1398 caSkinArea.
ExpandTop(-BetweenElementDist);
1401 szTip =
LoadResStr(
"IDS_DLGTIP_PLAYERCONTROL");
1414 UpdatePlayerControl();
1417 szTip =
LoadResStr(
"IDS_DLGTIP_PLAYERCREWSKIN");
1449 void C4StartupPlrPropertiesDlg::UpdatePlayerColor(
bool fUpdateSliders)
1461 UpdatePlayerColor(
true);
1466 UpdatePlayerColor(
true);
1474 UpdatePlayerColor(
true);
1477 void C4StartupPlrPropertiesDlg::UpdatePlayerControl()
1483 if (control_set) fctCtrlPic = control_set->
GetPicture();
1496 if (index < 0) index = 0;
1500 UpdatePlayerControl();
1508 if (index < 0) index = 0;
1512 UpdatePlayerControl();
1515 void C4StartupPlrPropertiesDlg::UpdatePlayerSkin()
1543 if (control_set && control_set->
HasGamepad())
1580 if (PlrGroup.
Close()) fSucc =
true;
1607 if (PlrGroup.
Close()) fSucc=
true;
1612 pMainDlg->SelectItem(Filename,
true);
1626 Dialog::OnClosed(
fOK);
1629 bool C4StartupPlrPropertiesDlg::SetNewPicture(
C4Surface &srcSfc,
C4FacetSurface *trgFct, int32_t iMaxSize,
bool fColorize)
1643 void C4StartupPlrPropertiesDlg::SetNewPicture(
const char *szFromFilename)
1645 if (!szFromFilename)
1661 if (sfcNewPic.
Load(SrcGrp,
GetFilename(szFromFilename),
false,
false, 0))
1682 SetNewPicture(sNewPic.
getData());
1686 void C4StartupPlrPropertiesDlg::UpdateBigIcon()
1689 bool fHasIcon =
false;
#define C4CFN_PlayerInfoCore
#define C4CFN_PlayerFiles
#define C4CFN_ObjectInfoFiles
const int C4MaxControlSet
const int C4MaxBigIconSize
C4GraphicsResource GraphicsResource
bool C4Group_DeleteItem(const char *item_name, bool do_recycle)
#define C4GUI_ButtonAreaHgt
const int32_t C4MaxDeathMsg
const char * LoadResStrNoAmp(const char *id)
const char * LoadResStr(const char *id)
bool DebugLog(const char *strMessage)
uint32_t UnsyncedRandom()
C4RankSystem DefaultRanks
const int32_t C4StartupEditBorderColor
const int32_t C4StartupEditBGColor
const int32_t C4StartupFontClr
StdStrBuf DateString(int iTime)
StdStrBuf TimeString(int iSeconds)
const uint32_t PlayerColorValueLowBound
std::vector< C4StartupPlrSelDlg_CrewSortDataEntry > C4StartupPlrSelDlg_CrewSortData
bool IsColorConflict(DWORD dwClr1, DWORD dwClr2)
const uint32_t ClrPlayerItem
void SReplaceChar(char *str, char fc, char tc)
bool SIsModule(const char *szList, const char *szString, int *ipIndex, bool fCaseSensitive)
void SCopy(const char *szSource, char *sTarget, size_t iMaxL)
bool SAddModule(char *szList, const char *szModule, bool fCaseSensitive)
void SAppend(const char *szSource, char *szTarget, int iMaxL)
T Clamp(T bval, T lbound, T rbound)
bool SEqual(const char *szStr1, const char *szStr2)
bool Inside(T ival, U lbound, V rbound)
StdStrBuf FormatString(const char *szFmt,...)
uint32_t RGBA(uint32_t r, uint32_t g, uint32_t b, uint32_t a)
#define GetGreenValue(rgb)
#define GetBlueValue(rgb)
bool GetParentPath(const char *szFilename, char *szBuffer)
bool WildcardMatch(const char *szWildcard, const char *szString)
const char * GetFilenameOnly(const char *strFilename)
bool ItemIdentical(const char *szFilename1, const char *szFilename2)
void MakeFilenameFromTitle(char *szTitle)
char * GetFilename(char *szPath)
bool MoveItem(const char *szSource, const char *szTarget)
bool ItemExists(const char *szItemName)
int32_t GamepadGuiControl
char Participants[CFG_MaxString+1]
char UserDataPath[CFG_MaxString+1]
const char * AtRelativePath(const char *filename)
const char * AtUserDataPath(const char *filename)
C4ConfigControls Controls
std::vector< C4KeyCodeEx > CodeList
void DrawLineDw(C4Surface *sfcTarget, float x1, float y1, float x2, float y2, DWORD dwClr, float width=1.0f)
C4Facet GetPhase(int iPhaseX=0, int iPhaseY=0)
void DrawClr(C4Facet &cgo, bool fAspect=true, DWORD dwClr=0)
void Draw(C4Facet &cgo, bool fAspect=true, int32_t iPhaseX=0, int32_t iPhaseY=0, bool fTransparent=true)
int32_t GetWidthByHeight(int32_t iHeight)
int32_t GetHeightByWidth(int32_t iWidth)
bool Load(C4Group &hGroup, const char *szName, int iWdt, int iHgt, bool fNoErrIfNotFound, int iFlags)
bool Create(int iWdt, int iHgt, int iWdt2=C4FCT_Full, int iHgt2=C4FCT_Full)
bool CopyFromSfcMaxSize(C4Surface &srcSfc, int32_t iMaxSize, uint32_t dwColor=0u)
bool GetFromLeft(int32_t iWdt, int32_t iHgt, C4Rect &rcOut)
void ExpandLeft(int32_t iByWdt)
bool GetCentered(int32_t iWdt, int32_t iHgt, C4Rect &rcOut)
int32_t GetHeight() const
bool GetFromRight(int32_t iWdt, int32_t iHgt, C4Rect &rcOut)
void ExpandBottom(int32_t iByHgt)
void ExpandTop(int32_t iByHgt)
bool GetFromTop(int32_t iHgt, int32_t iWdt, C4Rect &rcOut)
void GetAll(C4Rect &rcOut)
bool GetFromBottom(int32_t iHgt, int32_t iWdt, C4Rect &rcOut)
void AddElement(Element *pChild)
void SetVisibility(bool fToValue) override
void SetFocus(Control *pCtrl, bool fByMouse)
void SetDelOnClose(bool fToVal=true)
void MouseInput(CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam) override
void UpdateSize() override
Dialog * GetDlg() override
void DrawElement(C4TargetFacet &cgo) override
static int32_t GetCustomEditHeight(CStdFont *pUseFont)
void SetMaxText(int32_t iTo)
void SetFont(CStdFont *pToFont)
bool InsertText(const char *szText, bool fUser)
void SetColors(uint32_t dwNewBGClr, uint32_t dwNewFontClr, uint32_t dwNewBorderColor)
virtual Screen * GetScreen()
Element * GetNext() const
void SetBounds(const C4Rect &rcNewBound)
void SetToolTip(const char *szNewTooltip, bool is_immediate=false)
virtual void DoDragging(CMouse &rMouse, int32_t iX, int32_t iY, DWORD dwKeyParam)
void SetTitle(const char *szToTitle)
void SetText(const char *szToText, bool fAllowHotkey=true)
Element * GetSelectedItem()
bool InsertElement(Element *pChild, Element *pInsertBefore, int32_t iIndent=0)
void SetSelectionDblClickFn(BaseCallbackHandler *pToHandler)
void SetSelectionChangeCallbackFn(BaseCallbackHandler *pToHandler)
void SelectFirstEntry(bool fByUser)
void UpdateElementPositions()
void SetDecoration(bool fDrawBG, ScrollBarFacets *pToGfx, bool fAutoScroll, bool fDrawBorder=false)
void SortElements(SortFunction SortFunc, void *par)
void SelectEntry(Element *pNewSel, bool fByUser)
void SetFacet(const C4Facet &fct)
bool ShowModalDlg(Dialog *pDlg, bool fDestruct=true)
static Screen * GetScreenS()
bool ShowErrorMessage(const char *szMessage)
bool ShowRemoveDlg(Dialog *pDlg)
bool ShowMessageModal(const char *szMessage, const char *szCaption, DWORD dwButtons, Icons icoIcon, int32_t *piConfigDontShowAgainSetting=nullptr)
bool ShowMessage(const char *szMessage, const char *szCaption, Icons icoIcon, int32_t *piConfigDontShowAgainSetting=nullptr)
void SetDecoration(bool fDrawBG, bool fDrawFrame, ScrollBarFacets *pToGfx, bool fAutoScroll)
void ClearText(bool fDoUpdate)
void AddTextLine(const char *szText, CStdFont *pFont, DWORD dwClr, bool fDoUpdate, bool fMakeReadableOnBlack, CStdFont *pCaptionFont=nullptr)
void SetPos(int32_t iXPos, int32_t iYPos)
C4Rect & GetClientRect() override
C4PlayerControlAssignmentSets PlayerControlUserAssignmentSets
StdStrBuf GetFullName() const
bool OpenAsChild(C4Group *mother, const char *entry_name, bool is_exclusive=false, bool do_create=false)
bool Delete(const char *files, bool recursive=false)
bool FindEntry(const char *wildcard, StdStrBuf *filename=nullptr, size_t *size=nullptr)
bool Open(const char *group_name, bool do_create=false)
const char * GetGUIName() const
C4Facet GetPicture() const
const char * GetName() const
C4PlayerControlAssignmentSet * GetDefaultSet()
C4PlayerControlAssignmentSet * GetSetByName(const char *szName)
int32_t GetSetIndex(const C4PlayerControlAssignmentSet *set) const
size_t GetSetCount() const
C4PlayerControlAssignmentSet * GetSetByIndex(int32_t index)
char Comment[C4MaxComment+1]
StdCopyStrBuf PrefControl
int32_t OldPrefControlStyle
static DWORD GetPrefColorValue(int32_t iPrefColor)
int32_t OldPrefAutoContextMenu
void Default(C4RankSystem *pRanks=nullptr)
char PrefName[C4MaxName+1]
bool Save(C4Group &hGroup)
static bool SelectPortrait(C4GUI::Screen *pOnScreen, StdStrBuf *pSelection)
static bool DrawRankSymbol(C4FacetSurface *fctSymbol, int32_t iRank, C4Facet *pfctRankSymbols, int32_t iRankSymbolCount, bool fOwnSurface, int32_t iXOff=0, C4Facet *cgoDrawDirect=nullptr)
class C4StartupDlg * SwitchDialog(DialogID eToDlg, bool fFade=true, const char *szSubDialog=nullptr)
C4StartupGraphics Graphics
C4StartupPlrColorPickerDlg(C4PlayerInfoCore *plrcore)
void OnClosed(bool commit) override
C4GUI::IconButton * pClrPreview
void OnClrChangeLeft(C4GUI::Control *pBtn)
C4GUI::Label * ctrl_name_lbl
void OnSkinChangeRight(C4GUI::Control *pBtn)
void OnClrChangeRight(C4GUI::Control *pBtn)
C4StartupPlrSelDlg::PlayerListItem * pForPlayer
C4FacetSurface fctOldBigIcon
void OnClrChangeCustom(C4GUI::Control *pBtn)
C4StartupPlrPropertiesDlg(C4StartupPlrSelDlg::PlayerListItem *pForPlayer, C4StartupPlrSelDlg *pMainDlg)
void OnCtrlChangeLeft(C4GUI::Control *pBtn)
C4FacetSurface fctNewBigIcon
void OnClosed(bool fOK) override
C4GUI::IconButton * pPictureBtn
void OnPictureBtn(C4GUI::Control *pBtn)
void OnCtrlChangeRight(C4GUI::Control *pBtn)
C4StartupPlrSelDlg * pMainDlg
void UserClose(bool fOK) override
int32_t GetMarginLeft() override
int32_t GetMarginTop() override
void DrawElement(C4TargetFacet &cgo) override
C4GUI::Picture * pSkinImg
void OnSkinChangeLeft(C4GUI::Control *pBtn)
C4GUI::Picture * pCtrlImg
const C4PlayerInfoCore & GetCore() const
void GrabCustomIcon(C4FacetSurface &fctGrabFrom)
bool MoveFilename(const char *szToFilename)
StdStrBuf GetDelWarning() override
void SetSelectionInfo(C4GUI::TextWindow *pSelectionInfo) override
void UpdateCore(C4PlayerInfoCore &NewCore)
PlayerListItem(C4StartupPlrSelDlg *pForDlg, C4GUI::ListBox *pForListBox, C4GUI::Element *pInsertBeforeElement=nullptr, bool fActivated=false)
C4GUI::ContextMenu * ContextMenu() override
void Load(const StdStrBuf &rsFilename)
bool operator()(C4StartupPlrSelDlg_CrewSortDataEntry Check)
C4StartupPlrSelDlg_CrewSortDataMatchType(C4ID idType)
ListItem * GetSelection()
void OnDelCtx(C4GUI::Element *el)
void OnActivateBtn(C4GUI::Control *btn)
void OnDelBtnConfirm(ListItem *pSel)
friend class C4StartupPlrPropertiesDlg
friend class CrewListItem
void OnItemCheckChange(C4GUI::Element *pCheckBox)
~C4StartupPlrSelDlg() override
void OnPropertyBtn(C4GUI::Control *btn)
static bool CheckPlayerName(const StdStrBuf &Playername, StdStrBuf &Filename, const StdStrBuf *pPrevFilename, bool fWarnEmpty)
C4GUI::RenameEdit * pRenameEdit
friend class PlayerListItem
void DrawElement(C4TargetFacet &cgo) override
void SetSelection(ListItem *pNewItem)
void OnDelBtn(C4GUI::Control *btn)
void OnBackBtn(C4GUI::Control *btn)
void OnNewBtn(C4GUI::Control *btn)
void OnCrewBtn(C4GUI::Control *btn)
void OnPropertyCtx(C4GUI::Element *el)
bool CreateColorByOwner(C4Surface *pBySurface)
bool Load(C4Group &hGroup, const char *szFilename, bool fOwnPal, bool fNoErrIfNotFound, int iFlags)
bool SavePNG(C4Group &hGroup, const char *szFilename, bool fSaveAlpha=true, bool fSaveOverlayOnly=false)
int GetLineHeight() const
const char * getData() const
void Append(const char *pnData, size_t iChars)
void Format(const char *szFmt,...) GNUC_FORMAT_ATTRIBUTE_O
void GUISound(const char *szSound)
C4StartupPlrSelDlg_CrewSortDataEntry(int32_t iMaxExp, C4ID idType)