• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Return-To-The-Roots / s25client / 9321419711

31 May 2024 04:36PM UTC coverage: 50.4% (+0.1%) from 50.304%
9321419711

push

github

Flamefire
Add map selection control for campaigns including test

83 of 108 new or added lines in 4 files covered. (76.85%)

2 existing lines in 2 files now uncovered.

22012 of 43675 relevant lines covered (50.4%)

32124.06 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

74.41
/libs/s25main/Window.cpp
1
// Copyright (C) 2005 - 2021 Settlers Freaks (sf-team at siedler25.org)
2
//
3
// SPDX-License-Identifier: GPL-2.0-or-later
4

5
#include "Window.h"
6
#include "CollisionDetection.h"
7
#include "Loader.h"
8
#include "RescaleWindowProp.h"
9
#include "commonDefines.h"
10
#include "controls/controls.h"
11
#include "driver/MouseCoords.h"
12
#include "drivers/ScreenResizeEvent.h"
13
#include "drivers/VideoDriverWrapper.h"
14
#include "ogl/IRenderer.h"
15
#include <boost/range/adaptor/map.hpp>
16
#include <boost/range/adaptor/reversed.hpp>
17
#include <cstdarg>
18

19
Window::Window(Window* parent, unsigned id, const DrawPoint& pos, const Extent& size)
1,172✔
20
    : parent_(parent), id_(id), pos_(pos), size_(size), active_(false), visible_(true), scale_(false),
21
      isInMouseRelay(false), animations_(this)
1,172✔
22
{}
1,172✔
23

24
Window::~Window()
1,172✔
25
{
26
    RTTR_Assert(!isInMouseRelay);
1,172✔
27
    // Steuerelemente aufräumen
28
    for(Window* ctrl : childIdToWnd_ | boost::adaptors::map_values)
2,193✔
29
        delete ctrl;
1,021✔
30
}
1,172✔
31

32
/**
33
 *  zeichnet das Fenster.
34
 */
35
void Window::Draw()
340✔
36
{
37
    if(visible_)
340✔
38
        Draw_();
333✔
39
}
340✔
40

41
DrawPoint Window::GetPos() const
496✔
42
{
43
    return pos_;
496✔
44
}
45

46
DrawPoint Window::GetDrawPos() const
937✔
47
{
48
    DrawPoint result = pos_;
937✔
49
    const Window* temp = this;
937✔
50

51
    // Relative Koordinaten in absolute umrechnen
52
    // ( d.h. Koordinaten von allen Eltern zusammenaddieren )
53
    while(temp->parent_)
2,133✔
54
    {
55
        temp = temp->parent_;
1,196✔
56
        result += temp->pos_;
1,196✔
57
    }
58

59
    return result;
937✔
60
}
61

62
Extent Window::GetSize() const
5,127✔
63
{
64
    return size_;
5,127✔
65
}
66

67
Rect Window::GetDrawRect() const
560✔
68
{
69
    return Rect(GetDrawPos(), GetSize());
560✔
70
}
71

72
Rect Window::GetBoundaryRect() const
18✔
73
{
74
    // Default to draw rect
75
    return GetDrawRect();
18✔
76
}
77

78
/**
79
 *  Sendet eine Fensternachricht an die Steuerelemente.
80
 *
81
 *  @param[in] msg   Die Nachricht.
82
 *  @param[in] id    Die ID des Quellsteuerelements.
83
 *  @param[in] param Ein nachrichtenspezifischer Parameter.
84
 */
85
bool Window::RelayKeyboardMessage(KeyboardMsgHandler msg, const KeyEvent& ke)
2✔
86
{
87
    // Abgeleitete Klassen fragen, ob das Weiterleiten von Nachrichten erlaubt ist
88
    // (IngameFenster könnten ja z.B. minimiert sein)
89
    if(!IsMessageRelayAllowed())
2✔
90
        return false;
×
91

92
    // Alle Controls durchgehen
93
    // Falls das Fenster dann plötzlich nich mehr aktiv ist (z.b. neues Fenster geöffnet, sofort abbrechen!)
94
    for(Window* wnd : childIdToWnd_ | boost::adaptors::map_values)
14✔
95
    {
96
        if(wnd->visible_ && wnd->active_ && CALL_MEMBER_FN(*wnd, msg)(ke))
12✔
97
            return true;
×
98
    }
99

100
    return false;
2✔
101
}
102

103
bool Window::RelayMouseMessage(MouseMsgHandler msg, const MouseCoords& mc)
94✔
104
{
105
    // Abgeleitete Klassen fragen, ob das Weiterleiten von Mausnachrichten erlaubt ist
106
    // (IngameFenster könnten ja z.B. minimiert sein)
107
    if(!IsMessageRelayAllowed())
94✔
108
        return false;
×
109

110
    bool processed = false;
94✔
111
    isInMouseRelay = true;
94✔
112

113
    // Alle Controls durchgehen
114
    // Use reverse iterator because the topmost (=last elements) should receive the messages first!
115
    for(Window* wnd : childIdToWnd_ | boost::adaptors::map_values | boost::adaptors::reversed)
417✔
116
    {
117
        if(!lockedAreas_.empty() && IsInLockedRegion(mc.GetPos(), wnd))
323✔
118
            continue;
×
119

120
        if(wnd->visible_ && wnd->active_ && CALL_MEMBER_FN(*wnd, msg)(mc))
323✔
121
            processed = true;
1✔
122
    }
123

124
    for(auto* tofreeArea : tofreeAreas_)
94✔
125
        lockedAreas_.erase(tofreeArea);
×
126
    tofreeAreas_.clear();
94✔
127
    isInMouseRelay = false;
94✔
128

129
    return processed;
94✔
130
}
131

132
/**
133
 *  aktiviert das Fenster.
134
 *
135
 *  @param[in] activate Fenster aktivieren?
136
 */
137
void Window::SetActive(bool activate)
2,293✔
138
{
139
    this->active_ = activate;
2,293✔
140
    ActivateControls(activate);
2,293✔
141
}
2,293✔
142

143
/**
144
 *  aktiviert die Steuerelemente des Fensters.
145
 *
146
 *  @param[in] activate Steuerelemente aktivieren?
147
 */
148
void Window::ActivateControls(bool activate)
2,293✔
149
{
150
    for(auto& it : childIdToWnd_)
3,337✔
151
        it.second->SetActive(activate);
1,044✔
152
}
2,293✔
153

154
/**
155
 *  sperrt eine Region eines Fensters.
156
 *
157
 *  @param[in] window das Fenster, welches die Region sperrt.
158
 *  @param[in] rect   das Rechteck, welches die Region beschreibt.
159
 */
160
void Window::LockRegion(Window* window, const Rect& rect)
×
161
{
162
    lockedAreas_[window] = rect;
×
163
    auto it = std::find(tofreeAreas_.begin(), tofreeAreas_.end(), window);
×
164
    if(it != tofreeAreas_.end())
×
165
        tofreeAreas_.erase(it);
×
166

167
    // Also lock the region for all parents
168
    if(GetParent())
×
169
        GetParent()->LockRegion(this, rect);
×
170
}
×
171

172
/**
173
 *  Gibt eine gesperrte Region wieder frei.
174
 *
175
 *  @param[in] window das Fenster, welches die Region sperrt.
176
 */
177
void Window::FreeRegion(Window* window)
×
178
{
179
    // We need to keep all locked areas otherwise a closed dropdown will enable "click-through" to below control
180
    if(isInMouseRelay)
×
181
        tofreeAreas_.push_back(window);
×
182
    else
183
        lockedAreas_.erase(window);
×
184

185
    // Also free the locked region for all parents
186
    if(GetParent())
×
187
        GetParent()->FreeRegion(this);
×
188
}
×
189

190
void Window::SetPos(const DrawPoint& newPos)
1,317✔
191
{
192
    pos_ = newPos;
1,317✔
193
}
1,317✔
194

195
/// Weiterleitung von Nachrichten von abgeleiteten Klassen erlaubt oder nicht?
196
bool Window::IsMessageRelayAllowed() const
93✔
197
{
198
    return true;
93✔
199
}
200

201
void Window::DeleteCtrl(unsigned id)
2✔
202
{
203
    auto it = childIdToWnd_.find(id);
2✔
204

205
    if(it == childIdToWnd_.end())
2✔
206
        return;
2✔
207

208
    delete it->second;
×
209

210
    childIdToWnd_.erase(it);
×
211
}
212

213
ctrlBuildingIcon* Window::AddBuildingIcon(unsigned id, const DrawPoint& pos, BuildingType type, const Nation nation,
26✔
214
                                          unsigned short size, const std::string& tooltip)
215
{
216
    return AddCtrl(new ctrlBuildingIcon(this, id, ScaleIf(pos), type, nation, ScaleIf(Extent(size, 0)).x, tooltip));
26✔
217
}
218

219
ctrlButton* Window::AddTextButton(unsigned id, const DrawPoint& pos, const Extent& size, const TextureColor tc,
80✔
220
                                  const std::string& text, const glFont* font, const std::string& tooltip)
221
{
222
    return AddCtrl(new ctrlTextButton(this, id, ScaleIf(pos), ScaleIf(size), tc, text, font, tooltip));
80✔
223
}
224

225
ctrlButton* Window::AddColorButton(unsigned id, const DrawPoint& pos, const Extent& size, const TextureColor tc,
1✔
226
                                   const unsigned fillColor, const std::string& tooltip)
227
{
228
    return AddCtrl(new ctrlColorButton(this, id, ScaleIf(pos), ScaleIf(size), tc, fillColor, tooltip));
1✔
229
}
230

231
ctrlButton* Window::AddImageButton(unsigned id, const DrawPoint& pos, const Extent& size, const TextureColor tc,
333✔
232
                                   ITexture* const image, const std::string& tooltip)
233
{
234
    return AddCtrl(new ctrlImageButton(this, id, ScaleIf(pos), ScaleIf(size), tc, image, tooltip));
333✔
235
}
236

237
ctrlButton* Window::AddImageButton(unsigned id, const DrawPoint& pos, const Extent& size, const TextureColor tc,
333✔
238
                                   glArchivItem_Bitmap* const image, const std::string& tooltip)
239
{
240
    return AddImageButton(id, pos, size, tc, static_cast<ITexture*>(image), tooltip);
333✔
241
}
242

243
ctrlChat* Window::AddChatCtrl(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc,
2✔
244
                              const glFont* font)
245
{
246
    return AddCtrl(new ctrlChat(this, id, ScaleIf(pos), ScaleIf(size), tc, font));
2✔
247
}
248

249
ctrlCheck* Window::AddCheckBox(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc,
43✔
250
                               const std::string& text, const glFont* font, bool readonly)
251
{
252
    return AddCtrl(new ctrlCheck(this, id, ScaleIf(pos), ScaleIf(size), tc, text, font, readonly));
43✔
253
}
254

255
ctrlComboBox* Window::AddComboBox(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc,
53✔
256
                                  const glFont* font, unsigned short max_list_height, bool readonly)
257
{
258
    return AddCtrl(new ctrlComboBox(this, id, ScaleIf(pos), ScaleIf(size), tc, font, max_list_height, readonly));
53✔
259
}
260

261
ctrlDeepening* Window::AddTextDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc,
7✔
262
                                        const std::string& text, const glFont* font, unsigned color, FontStyle style)
263
{
264
    return AddCtrl(new ctrlTextDeepening(this, id, ScaleIf(pos), ScaleIf(size), tc, text, font, color, style));
7✔
265
}
266

267
ctrlDeepening* Window::AddColorDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc,
×
268
                                         unsigned fillColor)
269
{
270
    return AddCtrl(new ctrlColorDeepening(this, id, ScaleIf(pos), ScaleIf(size), tc, fillColor));
×
271
}
272

273
ctrlEdit* Window::AddEdit(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font,
4✔
274
                          unsigned short maxlength, bool password, bool disabled, bool notify)
275
{
276
    return AddCtrl(
4✔
277
      new ctrlEdit(this, id, ScaleIf(pos), ScaleIf(size), tc, font, maxlength, password, disabled, notify));
8✔
278
}
279

280
ctrlGroup* Window::AddGroup(unsigned id)
93✔
281
{
282
    return AddCtrl(new ctrlGroup(this, id));
93✔
283
}
284

285
ctrlImage* Window::AddImage(unsigned id, const DrawPoint& pos, ITexture* image, const std::string& tooltip)
50✔
286
{
287
    return AddCtrl(new ctrlImage(this, id, ScaleIf(pos), image, tooltip));
50✔
288
}
289

290
ctrlImage* Window::AddImage(unsigned id, const DrawPoint& pos, glArchivItem_Bitmap* image, const std::string& tooltip)
50✔
291
{
292
    return AddImage(id, pos, static_cast<ITexture*>(image), tooltip);
50✔
293
}
294

295
ctrlList* Window::AddList(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font)
55✔
296
{
297
    return AddCtrl(new ctrlList(this, id, ScaleIf(pos), ScaleIf(size), tc, font));
55✔
298
}
299

300
ctrlMultiline* Window::AddMultiline(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc,
13✔
301
                                    const glFont* font, FontStyle format)
302
{
303
    return AddCtrl(new ctrlMultiline(this, id, ScaleIf(pos), ScaleIf(size), tc, font, format));
13✔
304
}
305

306
/**
307
 *  fügt ein OptionenGruppe hinzu.
308
 *
309
 *  @param[in] id          ID des Steuerelements
310
 *  @param[in] select_type Typ der Auswahl
311
 *
312
 *  @return Instanz das Steuerelement.
313
 */
314
ctrlOptionGroup* Window::AddOptionGroup(unsigned id, GroupSelectType select_type)
4✔
315
{
316
    return AddCtrl(new ctrlOptionGroup(this, id, select_type));
4✔
317
}
318

319
/**
320
 *  fügt ein MultiSelectGruppe hinzu.
321
 *
322
 *  @param[in] id          ID des Steuerelements
323
 *  @param[in] select_type Typ der Auswahl
324
 *
325
 *  @return Instanz das Steuerelement.
326
 */
327
ctrlMultiSelectGroup* Window::AddMultiSelectGroup(unsigned id, GroupSelectType select_type)
×
328
{
329
    return AddCtrl(new ctrlMultiSelectGroup(this, id, select_type));
×
330
}
331

332
ctrlPercent* Window::AddPercent(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc,
3✔
333
                                unsigned text_color, const glFont* font, const unsigned short* percentage)
334
{
335
    return AddCtrl(new ctrlPercent(this, id, ScaleIf(pos), ScaleIf(size), tc, text_color, font, percentage));
3✔
336
}
337

338
ctrlProgress* Window::AddProgress(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc,
7✔
339
                                  unsigned short button_minus, unsigned short button_plus, unsigned short maximum,
340
                                  const std::string& tooltip, const Extent& padding, unsigned force_color,
341
                                  const std::string& button_minus_tooltip, const std::string& button_plus_tooltip)
342
{
343
    return AddCtrl(new ctrlProgress(this, id, ScaleIf(pos), ScaleIf(size), tc, button_minus, button_plus, maximum,
21✔
344
                                    padding, force_color, tooltip, button_minus_tooltip, button_plus_tooltip));
21✔
345
}
346

347
ctrlScrollBar* Window::AddScrollBar(unsigned id, const DrawPoint& pos, const Extent& size, unsigned short button_height,
74✔
348
                                    TextureColor tc, unsigned short page_size)
349
{
350
    button_height = ScaleIf(Extent(0, button_height)).y;
74✔
351

352
    return AddCtrl(new ctrlScrollBar(this, id, ScaleIf(pos), ScaleIf(size), button_height, tc, page_size));
74✔
353
}
354

355
ctrlTab* Window::AddTabCtrl(unsigned id, const DrawPoint& pos, unsigned short width)
3✔
356
{
357
    return AddCtrl(new ctrlTab(this, id, ScaleIf(pos), ScaleIf(Extent(width, 0)).x));
3✔
358
}
359

360
/**
361
 *  fügt eine Tabelle hinzu.
362
 *  ... sollte eine Menge von const char*, int und SortType sein
363
 */
364
ctrlTable* Window::AddTable(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc, const glFont* font,
×
365
                            std::vector<TableColumn> columns)
366
{
367
    return AddCtrl(new ctrlTable(this, id, ScaleIf(pos), ScaleIf(size), tc, font, std::move(columns)));
×
368
}
369

370
ctrlTimer* Window::AddTimer(unsigned id, std::chrono::milliseconds timeout)
5✔
371
{
372
    return AddCtrl(new ctrlTimer(this, id, timeout));
5✔
373
}
374

375
/**
376
 *  fügt ein TextCtrl hinzu.
377
 *
378
 *  @param[in] x      X-Koordinate des Steuerelements
379
 *  @param[in] y      Y-Koordinate des Steuerelements
380
 *  @param[in] text   Text
381
 *  @param[in] color  Textfarbe
382
 *  @param[in] format Formatierung des Textes
383
 *                      @p FontStyle::LEFT    - Text links ( standard )
384
 *                      @p FontStyle::CENTER  - Text mittig
385
 *                      @p FontStyle::RIGHT   - Text rechts
386
 *                      @p FontStyle::TOP     - Text oben ( standard )
387
 *                      @p FontStyle::VCENTER - Text vertikal zentriert
388
 *                      @p FontStyle::BOTTOM  - Text unten
389
 *  @param[in] font   Schriftart
390
 */
391
ctrlText* Window::AddText(unsigned id, const DrawPoint& pos, const std::string& text, unsigned color, FontStyle format,
152✔
392
                          const glFont* font)
393
{
394
    return AddCtrl(new ctrlText(this, id, ScaleIf(pos), text, color, format, font));
152✔
395
}
396

NEW
397
ctrlMapSelection* Window::AddMapSelection(unsigned id, const DrawPoint& pos, const Extent& size,
×
398
                                          const SelectionMapInputData& inputData)
399
{
NEW
400
    return AddCtrl(new ctrlMapSelection(this, id, ScaleIf(pos), ScaleIf(size), inputData));
×
401
}
402

UNCOV
403
TextFormatSetter Window::AddFormattedText(unsigned id, const DrawPoint& pos, const std::string& text, unsigned color,
×
404
                                          FontStyle format, const glFont* font)
405
{
406
    return AddText(id, pos, text, color, format, font);
×
407
}
408

409
ctrlVarDeepening* Window::AddVarDeepening(unsigned id, const DrawPoint& pos, const Extent& size, TextureColor tc,
1✔
410
                                          const std::string& formatstr, const glFont* font, unsigned color,
411
                                          unsigned parameters, ...)
412
{
413
    va_list liste;
414
    va_start(liste, parameters);
1✔
415

416
    auto* ctrl =
417
      new ctrlVarDeepening(this, id, ScaleIf(pos), ScaleIf(size), tc, formatstr, font, color, parameters, liste);
1✔
418

419
    va_end(liste);
1✔
420

421
    return AddCtrl(ctrl);
2✔
422
}
423

424
/**
425
 *  fügt ein variables TextCtrl hinzu.
426
 *
427
 *  @param[in] x          X-Koordinate des Steuerelements
428
 *  @param[in] y          Y-Koordinate des Steuerelements
429
 *  @param[in] formatstr  Der Formatstring des Steuerelements
430
 *  @param[in] color      Textfarbe
431
 *  @param[in] format     Formatierung des Textes
432
 *                          @p FontStyle::LEFT    - Text links ( standard )
433
 *                          @p FontStyle::CENTER  - Text mittig
434
 *                          @p FontStyle::RIGHT   - Text rechts
435
 *                          @p FontStyle::TOP     - Text oben ( standard )
436
 *                          @p FontStyle::VCENTER - Text vertikal zentriert
437
 *                          @p FontStyle::BOTTOM  - Text unten
438
 *  @param[in] font       Schriftart
439
 *  @param[in] parameters Anzahl der nachfolgenden Parameter
440
 *  @param[in] ...        die variablen Parameter
441
 */
442
ctrlVarText* Window::AddVarText(unsigned id, const DrawPoint& pos, const std::string& formatstr, unsigned color,
×
443
                                FontStyle format, const glFont* font, unsigned parameters, ...)
444
{
445
    va_list liste;
446
    va_start(liste, parameters);
×
447

448
    auto* ctrl = new ctrlVarText(this, id, ScaleIf(pos), formatstr, color, format, font, parameters, liste);
×
449

450
    va_end(liste);
×
451

452
    return AddCtrl(ctrl);
×
453
}
454

455
ctrlPreviewMinimap* Window::AddPreviewMinimap(const unsigned id, const DrawPoint& pos, const Extent& size,
×
456
                                              libsiedler2::ArchivItem_Map* const map)
457
{
458
    return AddCtrl(new ctrlPreviewMinimap(this, id, ScaleIf(pos), ScaleIf(size), map));
×
459
}
460

461
void Window::Draw3D(const Rect& rect, TextureColor tc, bool elevated, bool highlighted, bool illuminated,
31✔
462
                    unsigned contentColor)
463
{
464
    const Extent rectSize = rect.getSize();
31✔
465
    if(rectSize.x < 4 || rectSize.y < 4)
31✔
466
        return;
×
467
    Draw3DBorder(rect, tc, elevated);
31✔
468
    // Move content inside border
469
    Rect contentRect(rect.getOrigin() + Position(2, 2), rectSize - Extent(4, 4));
31✔
470
    Draw3DContent(contentRect, tc, elevated, highlighted, illuminated, contentColor);
31✔
471
}
472

473
void Window::Draw3DBorder(const Rect& rect, TextureColor tc, bool elevated)
31✔
474
{
475
    if(tc == TextureColor::Invisible)
31✔
476
        return;
×
477
    glArchivItem_Bitmap* borderImg = LOADER.GetImageN("io", 12 + rttr::enum_cast(tc));
62✔
478
    VIDEODRIVER.GetRenderer()->Draw3DBorder(rect, elevated, *borderImg);
31✔
479
}
480

481
void Window::Draw3DContent(const Rect& rect, TextureColor tc, bool elevated, bool highlighted, bool illuminated,
59✔
482
                           unsigned contentColor)
483
{
484
    if(tc == TextureColor::Invisible)
59✔
485
        return;
×
486
    glArchivItem_Bitmap* contentImg = LOADER.GetImageN("io", rttr::enum_cast(tc) * 2 + (highlighted ? 0 : 1));
118✔
487
    VIDEODRIVER.GetRenderer()->Draw3DContent(rect, elevated, *contentImg, illuminated, contentColor);
59✔
488
}
489

490
void Window::DrawRectangle(const Rect& rect, unsigned color)
10✔
491
{
492
    VIDEODRIVER.GetRenderer()->DrawRect(rect, color);
10✔
493
}
10✔
494

495
void Window::DrawLine(DrawPoint pt1, DrawPoint pt2, unsigned short width, unsigned color)
×
496
{
497
    VIDEODRIVER.GetRenderer()->DrawLine(pt1, pt2, width, color);
×
498
}
×
499

500
void Window::Msg_PaintBefore()
300✔
501
{
502
    animations_.update(VIDEODRIVER.GetTickCount());
300✔
503
    for(Window* control : childIdToWnd_ | boost::adaptors::map_values)
471✔
504
        control->Msg_PaintBefore();
171✔
505
}
300✔
506

507
void Window::Msg_PaintAfter()
346✔
508
{
509
    for(Window* control : childIdToWnd_ | boost::adaptors::map_values)
536✔
510
        control->Msg_PaintAfter();
190✔
511
}
346✔
512

513
void Window::Draw_()
90✔
514
{
515
    for(Window* control : childIdToWnd_ | boost::adaptors::map_values)
264✔
516
        control->Draw();
174✔
517
}
90✔
518

519
void Window::Msg_ScreenResize(const ScreenResizeEvent& sr)
18✔
520
{
521
    // If the window elements don't get scaled there is nothing to do
522
    if(!scale_)
18✔
523
        return;
×
524
    RescaleWindowProp rescale(sr.oldSize, sr.newSize);
18✔
525
    for(Window* ctrl : childIdToWnd_ | boost::adaptors::map_values)
28✔
526
    {
527
        if(!ctrl)
10✔
528
            continue;
×
529
        // Save new size (could otherwise be changed(?) in Msg_ScreenResize)
530
        Extent newSize = rescale(ctrl->GetSize());
10✔
531
        ctrl->SetPos(rescale(ctrl->GetPos()));
10✔
532
        ctrl->Msg_ScreenResize(sr);
10✔
533
        ctrl->Resize(newSize);
10✔
534
    }
535
    animations_.onRescale(sr);
18✔
536
}
537

538
template<class T_Pt>
539
T_Pt Window::Scale(const T_Pt& pt)
171✔
540
{
541
    return ScaleWindowPropUp::scale(pt, VIDEODRIVER.GetRenderSize());
171✔
542
}
543

544
template<class T_Pt>
545
T_Pt Window::ScaleIf(const T_Pt& pt) const
2,551✔
546
{
547
    return scale_ ? Scale(pt) : pt;
2,551✔
548
}
549

550
// Inlining removes those. so add it here
551
template DrawPoint Window::ScaleIf(const DrawPoint&) const;
552
template Extent Window::ScaleIf(const Extent&) const;
553

554
bool Window::IsInLockedRegion(const Position& pos, const Window* exception) const
×
555
{
556
    for(const auto& lockEntry : lockedAreas_)
×
557
    {
558
        // Ignore exception
559
        if(lockEntry.first == exception)
×
560
            continue;
×
561
        if(IsPointInRect(pos, lockEntry.second))
×
562
            return true;
×
563
    }
564
    return false;
×
565
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc