/*************************************<->************************************* * * PlaceWindowInteractively(pcd) * * * Description: * ----------- * Gets the clients size and position information interactively from the * user. * * * Inputs: * ------ * pcd - pointer to client data * * * Outputs: * ------- * * * Comments: * -------- * *************************************<->***********************************/ void PlaceWindowInteractively (ClientData *pcd) { unsigned int gmask; gmask = (wmGD.freezeOnConfig)? PGRAB_MASK : NOFRZ_PGRAB_MASK; /* * Return if config is in progress or if grabs fail */ if (!DoGrabs (ACTIVE_ROOT, wmGD.movePlacementCursor, gmask, CurrentTime, pcd, True)) { return; } /* * Get the size and position of the window from the user. * Do our own event processing until a button-up event occurs */ DoPlacement(pcd); /* * Finish up and return the data */ UndoGrabs(); wmGD.preMove = FALSE; }
void C4ScoreboardDlg::Update() { // counts int32_t iRowCount = pBrd->iRows; int32_t iColCount = pBrd->iCols; delete [] piColWidths; piColWidths = nullptr; // invalid board - scipters can create those, but there's no reason why the engine // should display something pretty then; just keep dialog defaults if (!iRowCount || !iColCount) return; // calc sizes as max col widths plus some indent pixels piColWidths = new int32_t[iColCount]; int32_t iWdt=XMargin*2, iHgt=YMargin*2; for (int32_t iCol = 0; iCol < iColCount; ++iCol) { piColWidths[iCol] = XIndent; for (int32_t iRow = 0; iRow < iRowCount; ++iRow) { C4Scoreboard::Entry *pCell = pBrd->GetCell(iCol, iRow); if ((iRow || iCol) && !pCell->Text.isNull()) piColWidths[iCol] = std::max<int32_t>(piColWidths[iCol], ::GraphicsResource.FontRegular.GetTextWidth(pCell->Text.getData()) + XIndent); } iWdt += piColWidths[iCol]; } iHgt += iRowCount * (::GraphicsResource.FontRegular.GetLineHeight() + YIndent); const char *szTitle = pBrd->GetCell(0,0)->Text.getData(); if (szTitle) iWdt = std::max<int32_t>(iWdt, ::GraphicsResource.FontRegular.GetTextWidth(szTitle) + 40); if (!pTitle != !szTitle) SetTitle(szTitle); // needed for title margin... iWdt += GetMarginLeft() + GetMarginRight(); iHgt += GetMarginTop() + GetMarginBottom(); // update dialog SetBounds(C4Rect(rcBounds.x, rcBounds.y, iWdt, iHgt)); SetTitle(szTitle); if (szTitle && pTitle) pTitle->SetIcon(C4GUI::Icon::GetIconFacet(C4GUI::Ico_Player)); // realign C4GUI::Screen *pScr = GetScreen(); if (pScr) DoPlacement(pScr, pScr->GetPreferredDlgRect()); }