GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — meos/code/TabControl.cpp at master · croister/meos

Expand file tree

/

TabControl.cpp

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
720 lines (593 loc) · 23.1 KB
/

TabControl.cpp

Copy path

File metadata and controls

720 lines (593 loc) · 23.1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
/************************************************************************
MeOS - Orienteering Software
Copyright (C) 2009-2026 Melin Software HB
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Melin Software HB - [email protected] - www.melin.nu
Eksoppsvägen 16, SE-75646 UPPSALA, Sweden
************************************************************************/
#include "stdafx.h"
#include <algorithm>
#include "oEvent.h"
#include "gdioutput.h"
#include "meos_util.h"
#include "table.h"
#include <cassert>
#include "maprenderer.h"
#include "MeOSFeatures.h"
#include "meosexception.h"
#include "TabControl.h"
TabControl::TabControl(oEvent *poe):TabBase(poe) {
clearCompetitionData();
}
TabControl::~TabControl(void) = default;
void TabControl::selectControl(gdioutput &gdi, pControl pc)
{
if (pc) {
pc->synchronize();
if (oControl::isSpecialControl(pc->getStatus())) {
gdi.selectItemByData("Controls", pc->getId());
gdi.selectItemByData("Status", int(oControl::ControlStatus::StatusOK));
gdi.setText("ControlID", makeDash(L"-"), true);
gdi.setText("Code", L"");
gdi.setText("Name", pc->getName());
gdi.setText("TimeAdjust", pc->getTimeAdjustS());
gdi.setText("MinTime", makeDash(L"-"));
gdi.setText("Point", L"");
gdi.disableInput("Visitors");
if (pc->isAddedToEvent())
gdi.enableInput("Map", true);
else
gdi.disableInput("Map", true);
gdi.disableInput("Courses");
controlId = pc->getId();
gdi.enableInput("Remove");
gdi.enableInput("Save");
gdi.enableEditControls(false);
gdi.enableInput("Name");
if (pc->getUnitCode() > 0) {
gdi.setText("Code", itow(pc->getUnitCode()));
gdi.enableInput("TimeAdjust");
gdi.setText("Info", lang.tl("Du kan justera tiden för en viss enhet"), true);
}
else {
gdi.setText("Info", L"", true);
}
}
else {
gdi.selectItemByData("Controls", pc->getId());
gdi.selectItemByData("Status", int(pc->getStatus()));
const int numVisit = pc->getNumVisitors(true);
const int numVisitExp = pc->getNumVisitors(false);
wstring info;
if (numVisit > 0) {
info = L"Antal besökare X, genomsnittlig bomtid Y, största bomtid Z#" +
itow(numVisit) + L" (" + itow(numVisitExp) + L")#" + formatTimeMS(pc->getMissedTimeTotal() / numVisit, false, SubSecond::Off) +
L"#" + formatTimeMS(pc->getMissedTimeMax(), false, SubSecond::Off);
}
else if (numVisitExp > 0) {
info = L"Förväntat antal besökare: X#" + itow(numVisitExp);
}
gdi.setText("ControlID", itow(pc->getId()), true);
wstring winfo = lang.tl(info);
gdi.setText("Info", winfo, true);
gdi.setText("Code", pc->codeNumbers());
gdi.setText("Name", pc->getName());
gdi.setText("TimeAdjust", pc->getTimeAdjustS());
gdi.setText("MinTime", pc->getMinTimeS());
if (gdi.hasWidget("Point"))
gdi.setText("Point", pc->getRogainingPointsS());
controlId = pc->getId();
gdi.enableInput("Remove");
gdi.enableInput("Save");
gdi.enableInput("Visitors");
gdi.enableInput("Map", true);
gdi.enableInput("Courses");
gdi.enableEditControls(true);
oControl::ControlStatus st = pc->getStatus();
if (st == oControl::ControlStatus::StatusRogaining || st == oControl::ControlStatus::StatusRogainingRequired ||
st == oControl::ControlStatus::StatusNoTiming || st == oControl::ControlStatus::StatusBadNoTiming)
gdi.disableInput("MinTime");
if (st == oControl::ControlStatus::StatusNoTiming || st == oControl::ControlStatus::StatusBadNoTiming)
gdi.disableInput("TimeAdjust");
if (gdi.hasWidget("Point") && st != oControl::ControlStatus::StatusRogaining && st != oControl::ControlStatus::StatusRogainingRequired)
gdi.disableInput("Point");
}
}
else {
gdi.selectItemByData("Controls", -1);
gdi.selectItemByData("Status", int(oControl::ControlStatus::StatusOK));
gdi.setText("Code", L"");
gdi.setText("Name", L"");
controlId = 0;
gdi.setText("ControlID", makeDash(L"-"), true);
gdi.setText("TimeAdjust", L"00:00");
if (gdi.hasWidget("Point"))
gdi.setText("Point", L"");
gdi.disableInput("Remove");
gdi.disableInput("Save");
gdi.disableInput("Visitors");
gdi.disableInput("Courses");
gdi.disableInput("Map", true);
gdi.enableEditControls(false);
}
}
int ControlsCB(gdioutput *gdi, GuiEventType type, BaseInfo* data) {
TabControl &tc = dynamic_cast<TabControl &>(*gdi->getTabs().get(TControlTab));
return tc.controlCB(*gdi, type, data);
}
void TabControl::save(gdioutput &gdi) {
if (controlId==0)
return;
pControl pc = oe->getControl(controlId, false, true);
if (!pc)
throw std::exception("Internal error");
if (!pc->isAddedToEvent()) {
if (gdi.getText("TimeAdjust") == pc->getTimeAdjustS()
&& gdi.getText("Name") == pc->getName())
return; // Virtual control with no change.
oe->synchronizeList(oListId::oLControlId);
pc = oe->getControl(controlId, false, true);
if (!pc->isAddedToEvent())
pc = oe->addControl(*pc);
if (!pc)
throw std::exception("Internal error");
}
bool defaultName = false;
if (!oControl::isSpecialControl(pc->getStatus())) {
int oldFirst = pc->getFirstNumber();
if (!pc->setNumbers(gdi.getText("Code")))
gdi.alert("Kodsiffran måste vara ett heltal. Flera kodsiffror måste separeras med komma.");
int newFirst = pc->getFirstNumber();
if (oldFirst != newFirst && pc->getId() == oldFirst) {
// Update id if possible (make new control and remove old)
if (!oe->isControlUsed(pc->getId()) && oe->getControl(newFirst) == nullptr) {
pc->setName(gdi.getText("Name"));
if (!pc->hasName())
defaultName = true;
pc = oe->addControl(newFirst, newFirst, L"");
pc->synchronize();
controlId = pc->getId();
pc->setNumbers(gdi.getText("Code"));
oe->removeControl(oldFirst);
}
}
pc->setStatus(oControl::ControlStatus(gdi.getSelectedItem("Status").first));
pc->setTimeAdjust(gdi.getText("TimeAdjust"));
if (pc->getStatus() != oControl::ControlStatus::StatusRogaining && pc->getStatus() != oControl::ControlStatus::StatusRogainingRequired) {
if (pc->getStatus() != oControl::ControlStatus::StatusNoTiming && pc->getStatus() != oControl::ControlStatus::StatusBadNoTiming)
pc->setMinTime(gdi.getText("MinTime"));
pc->setRogainingPoints(0);
}
else {
if (gdi.hasWidget("Point")) {
pc->setMinTime(0);
pc->setRogainingPoints(gdi.getText("Point"));
}
}
}
else if (pc->isUnit()) {
// Ensure cache is up-to-date
auto type = pc->getUnitType();
int oldAdjust = oe->getUnitAdjustment(type, pc->getUnitCode());
if (pc->setTimeAdjust(gdi.getText("TimeAdjust"))) {
// Cache is not updated. No new adjustment applied
assert(oldAdjust == oe->getUnitAdjustment(type, pc->getUnitCode()));
vector<pair<pRunner, pFreePunch>> adjustList;
if (type == oPunch::SpecialPunch::PunchStart) {
auto pList = oe->getPunchesByType(type, pc->getUnitCode());
for (auto p : pList) {
pRunner r = oe->getRunnerByCardNo(p->getCardNo(), p->getTimeInt(), oEvent::CardLookupProperty::Any);
if (r && !r->getCard() && r->getStartTime() == p->getTimeInt()) {
// Need not adjust runners with card.
adjustList.emplace_back(r, p);
}
}
}
else if (type == oPunch::SpecialPunch::PunchFinish) {
auto pList = oe->getPunchesByType(type, pc->getUnitCode());
for (auto p : pList) {
pRunner r = oe->getRunnerByCardNo(p->getCardNo(), p->getTimeInt(), oEvent::CardLookupProperty::Any);
if (r && !r->getCard() && r->getFinishTime() == p->getTimeInt()) {
// Need not adjust runners with card.
adjustList.emplace_back(r, p);
}
}
}
// Clear cache to make sure adjustment takes effect
pc->clearCache();
oe->clearUnitAdjustmentCache();
// With new adjustment applied
assert(oldAdjust != oe->getUnitAdjustment(type, pc->getUnitCode()));
for (auto& rp : adjustList) {
if (type == oPunch::SpecialPunch::PunchStart) {
rp.first->setStartTime(rp.second->getTimeInt(), true, oBase::ChangeType::Update, true);
}
else if (type == oPunch::SpecialPunch::PunchFinish) {
rp.first->setFinishTime(rp.second->getTimeInt());
}
rp.first->synchronize(true);
}
}
}
if (!defaultName)
pc->setName(gdi.getText("Name"));
pc->synchronize();
vector<pair<wstring, size_t>> d;
oe->fillControls(d, oEvent::ControlType::All);
gdi.setItems("Controls", d);
oe->reEvaluateAll(set<int>(), true);
selectControl(gdi, pc);
}
static void visitorTable(Table &table, void *ptr) {
TabControl *view = (TabControl *)ptr;
view->visitorTable(table);
}
static void courseTable(Table &table, void *ptr) {
TabControl *view = (TabControl *)ptr;
view->courseTable(table);
}
void TabControl::courseTable(Table &table) const {
vector<pRunner> r;
oe->getRunners(0, 0, r, false);
map<int, int> runnersPerCourse;
for (size_t k = 0; k < r.size(); k++) {
pCourse c = r[k]->getCourse(false);
int id = c != 0 ? c->getId() : 0;
++runnersPerCourse[id];
}
vector<pCourse> crs;
oe->getCourses(crs);
int ix = 1;
for (size_t k = 0; k < crs.size(); k++) {
vector<pControl> pc;
crs[k]->getControls(pc);
int used = 0;
for (size_t j = 0; j < pc.size(); j++) {
if (pc[j]->getId() == controlId) {
used++;
}
}
oCourse &it = *crs[k];
if (used > 0) {
table.addRow(ix++, &it);
int row = 0;
table.set(row++, it, TID_ID, itow(it.getId()), false);
table.set(row++, it, TID_MODIFIED, it.getTimeStamp(), false);
table.set(row++, it, TID_COURSE, crs[k]->getName(), false);
table.set(row++, it, TID_INDEX, itow(used), false);
table.set(row++, it, TID_RUNNER, itow(runnersPerCourse[crs[k]->getId()]), false);
}
}
}
void TabControl::visitorTable(Table &table) const {
vector<pCard> c;
oe->getCards(c, true, false);
pControl pc = oe->getControl(controlId, false, true);
if (!pc)
return;
vector<int> n;
pc->getNumbers(n);
struct PI {
PI(int c, int type, int t) : card(c), code(type), time(t) {}
int card;
int code;
int time;
bool operator<(const PI&c) const {
if (card != c.card)
return card < c.card;
else if (code != c.code)
return code < c.code;
else
return time < c.time;
}
bool operator==(const PI&c) const {
return c.card == card && c.code == code && c.time == time;
}
};
set<PI> registeredPunches;
vector<pPunch> p;
int ix=1;
for (size_t k = 0; k< c.size(); k++) {
oCard &it = *c[k];
it.getPunches(p);
//oPunch *punch = it.getPunchByType(pc->getFirstNumber()); //XXX
for (size_t j = 0; j < p.size(); j++) {
vector<int>::iterator res = find(n.begin(), n.end(), p[j]->getTypeCode());
if (res != n.end()) {
oPunch *punch = p[j];
registeredPunches.insert(PI(it.getCardNo(), p[j]->getTypeCode(), p[j]->getAdjustedTime()));
table.addRow(ix++, &it);
int row = 0;
table.set(row++, it, TID_ID, itow(it.getId()), false);
table.set(row++, it, TID_MODIFIED, it.getTimeStamp(), false);
pRunner r = it.getOwner();
if (r) {
table.set(row++, it, TID_RUNNER, r->getName(), false);
table.set(row++, it, TID_COURSE, r->getCourseName(), false);
}
else {
table.set(row++, it, TID_RUNNER, L"-", false);
table.set(row++, it, TID_COURSE, L"-", false);
}
table.set(row++, it, TID_FEE, punch->isUsedInCourse() ?
lang.tl("Ja") : lang.tl("Nej"), false);
table.set(row++, it, TID_CARD, it.getCardNoString(), false);
table.set(row++, it, TID_STATUS, punch->getTime(false, SubSecond::Auto), false);
table.set(row++, it, TID_CONTROL, punch->getType(nullptr), false);
table.set(row++, it, TID_CODES, j>0 ? p[j-1]->getType(nullptr) : L"-", true);
}
}
}
}
int TabControl::controlCB(gdioutput &gdi, GuiEventType type, BaseInfo* data) {
if (type == GUI_BUTTON) {
ButtonInfo bi = *(ButtonInfo*)data;
if (bi.id == "Save")
save(gdi);
else if (bi.id == "Add") {
bool rogaining = false;
if (controlId > 0) {
save(gdi);
pControl pc = oe->getControl(controlId, false, true);
rogaining = pc && (pc->getStatus() == oControl::ControlStatus::StatusRogaining || pc->getStatus() == oControl::ControlStatus::StatusRogainingRequired);
}
int nextCtrl = oe->getNextControlNumber();
int nextId = nextCtrl;
if (oe->getControl(nextId)) {
nextId += 1000;
if (oe->getControl(nextId))
nextId = 0; // Use default
}
pControl pc = oe->addControl(nextId, nextCtrl, L"");
if (rogaining)
pc->setStatus(oControl::ControlStatus::StatusRogaining);
pc->synchronize();
vector< pair<wstring, size_t> > d;
oe->fillControls(d, oEvent::ControlType::All);
gdi.setItems("Controls", d);
selectControl(gdi, pc);
}
else if (bi.id == "Remove") {
DWORD cid = controlId;
if (cid == 0) {
gdi.alert("Ingen kontroll vald vald.");
return 0;
}
if (oe->isControlUsed(cid))
gdi.alert("Kontrollen används och kan inte tas bort.");
else
oe->removeControl(cid);
vector< pair<wstring, size_t> > d;
oe->fillControls(d, oEvent::ControlType::All);
gdi.setItems("Controls", d);
selectControl(gdi, 0);
}
else if (bi.id == "SwitchMode") {
if (!tableMode)
save(gdi);
tableMode = !tableMode;
loadPage(gdi);
}
else if (bi.id == "Map") {
pControl ctrl = oe->getControl(controlId);
if (!ctrl || !oe->getRenderMaps())
return 0;
if (!oe->getRenderMaps()->validCoordinates(*ctrl))
throw meosException("Kontrollen saknar giltiga koordinater");
gdioutput* mapWindow = getExtraWindow("mapwindow", true);
bool created = false;
if (mapWindow == nullptr) {
mapWindow = createExtraWindow("mapwindow", lang.tl("Karta"), gdi.scaleLength(400), gdi.scaleLength(350), true);
created = true;
}
mapWindow->clearPage(false);
mapWindow->hideBackground(true);
auto& renderMaps = *oe->getRenderMaps();
mapWindow->fillDown();
wstring name;
wstring cid;
if (!oControl::isSpecialControl(ctrl->getStatus())) {
if (ctrl->hasName())
name = L" (" + ctrl->getName() + L")";
cid = itow(controlId);
name = L"Kontroll X#" + cid + name;
}
else if (ctrl->hasName()) {
name = ctrl->getName();
cid = name.substr(0, 1);
if (name.length() > 1)
cid += name.substr(name.length() - 1, 1);
}
else {
name = ctrl->getName();
cid = itow(controlId);
}
mapWindow->addString("", boldLarge, name);
mapWindow->dropLine();
int ypMap = mapWindow->getCY();
auto [xpmap, ymap_b] = renderMaps.render(*oe, *mapWindow, gdi.scaleLength(40), ypMap, {make_tuple(ctrl, cid, RenderCType::CorrectControl)});
int dimx, dimy, xp, yp;
if (renderMaps.getCoordinatePosition(*ctrl, dimx, dimy, xp, yp)) {
int maxside = max(dimx, dimy);
double scale = double(gdi.scaleLength(200)) / double(maxside);
RECT rcMap;
int xpMap = xpmap + gdi.scaleLength(20);
rcMap.top = ypMap;
rcMap.bottom = ypMap + int(scale * dimy);
rcMap.left = xpMap;
rcMap.right = xpMap + int(scale * dimx);
if (created) {
RECT rc;
mapWindow->getWindowsPosition(rc);
rc.right = rc.left + rcMap.right + gdi.scaleLength(50);
rc.bottom = rc.top + max<int>(rcMap.bottom, ymap_b) + gdi.scaleLength(80);
mapWindow->setWindowsPosition(rc);
}
RECT rcSubMap;
int cx = xpMap + int(scale * xp);
int cy = ypMap + int(scale * yp);
int siz = gdi.scaleLength(10);
rcSubMap.left = std::max<int>(cx - siz, rcMap.left);
rcSubMap.right = std::min<int>(cx + siz, rcMap.right);
rcSubMap.top = std::max<int>(cy - siz, rcMap.top);
rcSubMap.bottom = std::min<int>(cy + siz, rcMap.bottom);
mapWindow->addRectangle(rcMap, GDICOLOR::colorGreyBlue);
mapWindow->addRectangle(rcSubMap, GDICOLOR::colorLightBlue);
}
mapWindow->refresh();
}
else if (bi.id=="Visitors") {
save(gdi);
shared_ptr<Table> table=make_shared<Table>(oe, 20, L"Kontroll X#" + itow(controlId), "controlvisitor");
table->addColumn("Id", 70, true, true);
table->addColumn("Ändrad", 70, false);
table->addColumn("Namn", 150, false);
table->addColumn("Bana", 70, false);
table->addColumn("På banan", 70, false);
table->addColumn("Bricka", 70, true, true);
table->addColumn("Tidpunkt", 70, false);
table->addColumn("Stämpelkod", 70, true);
table->addColumn("Föregående kontroll", 70, false);
table->setGenerator(::visitorTable, this);
table->setTableProp(0);
table->update();
gdi.clearPage(false);
int xp=gdi.getCX();
gdi.fillDown();
gdi.addButton("Show", "Återgå", ControlsCB);
gdi.addTable(table, xp, gdi.getCY());
gdi.refresh();
}
else if (bi.id=="Courses") {
auto table=make_shared<Table>(oe, 20, L"Kontroll X#" + itow(controlId), "controlcourse");
table->addColumn("Id", 70, true, true);
table->addColumn("Ändrad", 70, false);
table->addColumn("Bana", 70, false, true);
table->addColumn("Förekomst", 70, true, true);
table->addColumn("Antal deltagare", 70, true, true);
table->setGenerator(::courseTable, this);
table->setTableProp(0);
table->update();
gdi.clearPage(false);
int xp=gdi.getCX();
gdi.fillDown();
gdi.addButton("Show", "Återgå", ControlsCB);
gdi.addTable(table, xp, gdi.getCY());
gdi.refresh();
}
else if (bi.id=="Show") {
loadPage(gdi);
}
}
else if (type==GUI_LISTBOX){
ListBoxInfo bi=*(ListBoxInfo *)data;
if (bi.id=="Controls") {
if (gdi.isInputChanged(""))
save(gdi);
pControl pc=oe->getControl(bi.data, false, true);
if (!pc)
throw std::exception("Internal error");
selectControl(gdi, pc);
}
else if (bi.id == "Status" ) {
oControl::ControlStatus st = (oControl::ControlStatus)bi.data;
gdi.setInputStatus("MinTime", st != oControl::ControlStatus::StatusRogaining && st != oControl::ControlStatus::StatusRogainingRequired && st != oControl::ControlStatus::StatusNoTiming && st != oControl::ControlStatus::StatusBadNoTiming, true);
gdi.setInputStatus("Point", st == oControl::ControlStatus::StatusRogaining || st != oControl::ControlStatus::StatusRogainingRequired, true);
gdi.setInputStatus("TimeAdjust", st != oControl::ControlStatus::StatusNoTiming && st != oControl::ControlStatus::StatusBadNoTiming, true);
}
}
else if (type==GUI_CLEAR) {
if (controlId>0)
save(gdi);
return true;
}
return 0;
}
bool TabControl::loadPage(gdioutput &gdi)
{
oe->checkDB();
gdi.selectTab(tabId);
gdi.clearPage(false);
int xp=gdi.getCX();
const int button_w=gdi.scaleLength(90);
string switchMode;
switchMode=tableMode ? "Formulärläge" : "Tabelläge";
gdi.addButton(2, 2, button_w, "SwitchMode", switchMode,
ControlsCB, "Välj vy", false, false).fixedCorner();
if (tableMode) {
gdi.addTable(oControl::getTable(oe), xp, gdi.scaleLength(30));
return true;
}
gdi.fillDown();
gdi.addString("", boldLarge, "Kontroller");
gdi.pushY();
gdi.addListBox("Controls", 250, 530, ControlsCB).isEdit(false).ignore(true);
gdi.setTabStops("Controls", 44, 160);
vector< pair<wstring, size_t> > d;
oe->fillControls(d, oEvent::ControlType::All);
gdi.setItems("Controls", d);
gdi.newColumn();
gdi.fillDown();
gdi.popY();
gdi.pushX();
gdi.fillRight();
gdi.addString("", 1, "Kontrollens ID-nummer:");
gdi.fillDown();
gdi.addString("ControlID", 1, "#-").setColor(colorGreen);
gdi.popX();
gdi.fillRight();
gdi.addInput("Name", L"", 16, 0, L"Kontrollnamn:");
gdi.addSelection("Status", 150, 100, ControlsCB, L"Status:", L"Ange om kontrollen fungerar och hur den ska användas.");
oe->fillControlStatus(gdi, "Status");
gdi.addInput("TimeAdjust", L"", 6, 0, L"Tidsjustering:");
gdi.fillDown();
gdi.addInput("MinTime", L"", 6, 0, L"Minsta sträcktid:");
gdi.popX();
gdi.dropLine(0.5);
gdi.addString("", 10, "help:9373");
gdi.fillRight();
gdi.dropLine(0.5);
gdi.addInput("Code", L"", 16, 0, L"Stämpelkod(er):");
if (oe->getMeOSFeatures().hasFeature(MeOSFeatures::Rogaining)) {
gdi.addInput("Point", L"", 6, 0, L"Rogaining-poäng:");
}
gdi.popX();
gdi.dropLine(3.5);
gdi.fillRight();
gdi.addButton("Save", "Spara", ControlsCB, "help:save");
gdi.disableInput("Save");
gdi.addButton("Remove", "Radera", ControlsCB);
gdi.disableInput("Remove");
gdi.addButton("Courses", "Banor...", ControlsCB);
gdi.addButton("Visitors", "Besökare...", ControlsCB);
if (oe->getRenderMaps())
gdi.addButton("Map", "Karta", ControlsCB);
gdi.addButton("Add", "Ny kontroll", ControlsCB);
gdi.dropLine(2.5);
gdi.popX();
gdi.fillDown();
gdi.addString("Info", 0, "").setColor(colorGreen);
gdi.dropLine(1.5);
gdi.addString("", 10, "help:89064");
selectControl(gdi, oe->getControl(controlId, false, true));
gdi.setOnClearCb("controls", ControlsCB);
gdi.refresh();
return true;
}
void TabControl::clearCompetitionData() {
tableMode = false;
controlId = 0;
}
void TabControl::showTable(gdioutput& gdi) {
tableMode = true;
loadPage(gdi);
}
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.