Skip to content

Commit

Permalink
MeOS version 3.8.1306
Browse files Browse the repository at this point in the history
  • Loading branch information
erikmelin committed Mar 27, 2022
1 parent 207af5f commit efa06c0
Show file tree
Hide file tree
Showing 32 changed files with 1,512 additions and 1,205 deletions.
2 changes: 2 additions & 0 deletions code/SportIdent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,8 @@ void SportIdent::getSI9DataExt(HANDLE hComm)
double voltage = 1.9 + (battVoltageRow * 0.09);
miliVolt = int(1000 * voltage);

if (miliVolt > 5000)
miliVolt = 900; // Not allowed
/*char xx[30];
sprintf_s(xx, "V = %f\n\n", voltage);
OutputDebugStringA(xx);*/
Expand Down
6 changes: 3 additions & 3 deletions code/TabAuto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ bool TabAuto::loadPage(gdioutput &gdi, bool showSettingsLast)

if (sm.size() > 0) {
gdi.dropLine();
gdi.addString("", fontMediumPlus, "Sparade automater").setColor(colorDarkBlue);
gdi.addStringUT(fontMediumPlus, lang.tl(L"Sparade automater", true)).setColor(colorDarkBlue);
gdi.dropLine(0.3);
gdi.fillRight();

Expand All @@ -610,7 +610,7 @@ bool TabAuto::loadPage(gdioutput &gdi, bool showSettingsLast)
}

gdi.dropLine();
gdi.addString("", fontMediumPlus, "Tillgängliga automater").setColor(colorDarkBlue);
gdi.addStringUT(fontMediumPlus, lang.tl(L"Tillgängliga automater", true)).setColor(colorDarkBlue);
gdi.dropLine(0.3);
gdi.fillRight();
gdi.addButton("Result", AutoMachine::getDescription(Machines::mPrintResultsMachine), AutomaticCB, "tooltip:resultprint");
Expand All @@ -631,7 +631,7 @@ bool TabAuto::loadPage(gdioutput &gdi, bool showSettingsLast)
gdi.popX();

if (!machines.empty()) {
gdi.addString("", fontMediumPlus, "Startade automater").setColor(colorDarkBlue);
gdi.addStringUT(fontMediumPlus, lang.tl(L"Startade automater", true)).setColor(colorDarkBlue);
list<AutoMachine *>::iterator it;

int baseX = gdi.getCX();
Expand Down
70 changes: 51 additions & 19 deletions code/TabCompetition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1762,11 +1762,14 @@ int TabCompetition::competitionCB(gdioutput &gdi, int type, void *data)
if (save.empty())
throw meosException("Filnamn kan inte vara tomt");

oe->setProperty("ExpStaFilename", save);
bool individual = !gdi.hasWidget("ExportTeam") || gdi.isChecked("ExportTeam");

bool includeStage = true;
if (gdi.hasWidget("IncludeRaceNumber"))
if (gdi.hasWidget("IncludeRaceNumber")) {
includeStage = gdi.isChecked("IncludeRaceNumber");
oe->setProperty("ExpWithRaceNo", includeStage);
}

gdi.getSelection("ClassNewEntries", allTransfer);
ImportFormats::ExportFormats filterIndex = ImportFormats::setExportFormat(*oe, gdi.getSelectedItem("Type").first);
Expand Down Expand Up @@ -1806,7 +1809,7 @@ int TabCompetition::competitionCB(gdioutput &gdi, int type, void *data)
if (save.empty())
throw meosException("Filnamn kan inte vara tomt");

//bool individual = !gdi.hasWidget("ExportTeam") || gdi.isChecked("ExportTeam");
oe->setProperty("ExpResFilename", save);
gdi.getSelection("ClassNewEntries", allTransfer);

checkReadyForResultExport(gdi, allTransfer);
Expand All @@ -1816,9 +1819,15 @@ int TabCompetition::competitionCB(gdioutput &gdi, int type, void *data)
bool includeSplits = gdi.isChecked("ExportSplitTimes");

bool unroll = gdi.isChecked("UnrollLoops"); // If not applicable, field does not exist.
if (gdi.hasWidget("UnrollLoops")) {
oe->setProperty("ExpUnroll", unroll);
}

bool includeStage = true;
if (gdi.hasWidget("IncludeRaceNumber"))
if (gdi.hasWidget("IncludeRaceNumber")) {
includeStage = gdi.isChecked("IncludeRaceNumber");
oe->setProperty("ExpWithRaceNo", includeStage);
}

gdi.setWaitCursor(true);
if (filterIndex == ImportFormats::IOF30 || filterIndex == ImportFormats::IOF203) {
Expand All @@ -1827,13 +1836,14 @@ int TabCompetition::competitionCB(gdioutput &gdi, int type, void *data)
oe->getClassConfigurationInfo(cnf);
bool useUTC = oe->getDCI().getInt("UTC") != 0;

if (!cnf.hasTeamClass()) {
if (!gdi.hasWidget("LegType")) {
oe->exportIOFSplits(ver, save.c_str(), true, useUTC,
allTransfer, -1, false, unroll, includeStage, false);
}
else {
ListBoxInfo leglbi;
gdi.getSelectedItem("LegType", leglbi);
oe->setProperty("ExpTypeIOF", leglbi.data);
wstring file = save;
if (leglbi.data == 2) {
wstring fileBase;
Expand Down Expand Up @@ -3791,18 +3801,22 @@ void TabCompetition::selectStartlistOptions(gdioutput &gdi) {
if (oe->hasTeam()) {
gdi.addCheckbox("ExportTeam", "Exportera individuella lopp istället för lag", 0, false);
}

if (oe->hasMultiRunner() || oe->getStageNumber() > 0)
gdi.addCheckbox("IncludeRaceNumber", "Inkludera information om flera lopp per löpare", 0, true);
gdi.addCheckbox("IncludeRaceNumber", "Inkludera information om flera lopp per löpare", nullptr,
oe->getPropertyInt("ExpWithRaceNo", true) != 0);

wstring fn = oe->getPropertyString("ExpStaFilename", L"");
gdi.addInput("Filename", fn,
48, CompetitionCB, L"Filnamn:").setExtra(L"DoSaveStartlist");
setExportOptionsStatus(gdi, format);

gdi.addInput("Filename", L"", 48, CompetitionCB, L"Filnamn:").setExtra(L"DoSaveStartlist");
gdi.fillRight();
gdi.dropLine();
gdi.addButton("BrowseExport", "Bläddra...", CompetitionCB);
gdi.addButton("DoSaveStartlist", "Exportera", CompetitionCB).setDefault();
gdi.addButton("Cancel", "Avbryt", CompetitionCB).setCancel();
gdi.disableInput("DoSaveStartlist");
gdi.setInputStatus("DoSaveStartlist", !fn.empty());
gdi.refresh();
}

Expand All @@ -3826,14 +3840,14 @@ void TabCompetition::selectExportSplitOptions(gdioutput &gdi) {
gdi.pushX();
gdi.addSelection("Type", 250, 200, CompetitionCB, L"Exporttyp:");

vector< pair<wstring, size_t> > types;
vector<pair<wstring, size_t>> types;
ImportFormats::getExportFormats(types, true);

gdi.addItem("Type", types);
ImportFormats::ExportFormats format = ImportFormats::getDefaultExportFormat(*oe);
gdi.selectItemByData("Type", format);

vector< pair<wstring, size_t> > typeLanguages;
vector<pair<wstring, size_t>> typeLanguages;
ImportFormats::getOECSVLanguage(typeLanguages);

gdi.addSelection("LanguageType", 250, 200, CompetitionCB, L"Export language:");
Expand All @@ -3846,16 +3860,19 @@ void TabCompetition::selectExportSplitOptions(gdioutput &gdi) {
ClassConfigInfo cnf;
oe->getClassConfigurationInfo(cnf);

if (oe->hasTeam()) {
if (cnf.hasTeamClass() || cnf.hasQualificationFinal()) {
gdi.addSelection("LegType", 300, 100, 0, L"Exportval, IOF-XML");
gdi.addItem("LegType", lang.tl("Totalresultat"), 1);
gdi.addItem("LegType", lang.tl("Alla lopp som individuella"), 3);
gdi.addItem("LegType", lang.tl("Alla sträckor/lopp i separata filer"), 2);
int legMax = cnf.getNumLegsTotal();
for (int k = 0; k<legMax; k++) {
gdi.addItem("LegType", lang.tl("Sträcka X#" + itos(k+1)), k+10);
if (cnf.hasTeamClass()) {
gdi.addItem("LegType", lang.tl("Alla sträckor/lopp i separata filer"), 2);
int legMax = cnf.getNumLegsTotal();
for (int k = 0; k < legMax; k++) {
gdi.addItem("LegType", lang.tl("Sträcka X#" + itos(k + 1)), k + 10);
}
}
gdi.selectFirstItem("LegType");
if (!gdi.selectItemByData("LegType", oe->getPropertyInt("ExpTypeIOF", 1)))
gdi.selectFirstItem("LegType");
}

bool hasLoops = false;
Expand All @@ -3866,20 +3883,23 @@ void TabCompetition::selectExportSplitOptions(gdioutput &gdi) {
hasLoops = true;
}
if (hasLoops)
gdi.addCheckbox("UnrollLoops", "Unroll split times for loop courses", 0, true);
gdi.addCheckbox("UnrollLoops", "Unroll split times for loop courses", 0, oe->getPropertyInt("ExpUnroll", true) != 0);

if (oe->hasMultiRunner() || oe->getStageNumber() > 0)
gdi.addCheckbox("IncludeRaceNumber", "Inkludera information om flera lopp per löpare", 0, true);
gdi.addCheckbox("IncludeRaceNumber", "Inkludera information om flera lopp per löpare", 0,
oe->getPropertyInt("ExpWithRaceNo", true) != 0);

wstring fn = oe->getPropertyString("ExpResFilename", L"");
gdi.addInput("Filename", fn, 48, CompetitionCB, L"Filnamn:").setExtra(L"DoSaveSplits");
setExportOptionsStatus(gdi, format);
gdi.addInput("Filename", L"", 48, CompetitionCB, L"Filnamn:").setExtra(L"DoSaveSplits");

gdi.fillRight();
gdi.dropLine();
gdi.addButton("BrowseExportResult", "Bläddra...", CompetitionCB);
gdi.addButton("DoSaveSplits", "Exportera", CompetitionCB).setDefault();
gdi.addButton("Cancel", "Avbryt", CompetitionCB).setCancel();

gdi.disableInput("DoSaveSplits");
gdi.setInputStatus("DoSaveSplits", !fn.empty());
gdi.refresh();
}

Expand All @@ -3902,6 +3922,18 @@ void TabCompetition::setExportOptionsStatus(gdioutput &gdi, int format) const {
}

gdi.setInputStatus("LanguageType", format == ImportFormats::OE);

if (gdi.hasWidget("Filename")) {
wstring fn = gdi.getText("Filename");
if (!fn.empty()) {
size_t ldot = fn.find_last_of(L".");
if (ldot != wstring::npos && ldot > fn.length() - 8 && ldot < fn.length() - 2) {
fn = fn.substr(0, ldot+1);
fn += ImportFormats::getExtension(ImportFormats::ExportFormats(format));
gdi.setText("Filename", fn);
}
}
}
}

void TabCompetition::clearCompetitionData() {
Expand Down
9 changes: 6 additions & 3 deletions code/TabCourse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void TabCourse::selectCourse(gdioutput &gdi, pCourse pc)
gdi.enableEditControls(false);
}
gdi.refreshFast();
gdi.setInputStatus("DrawCourse", pc != 0);
gdi.setInputStatus("DrawCourse", pc != 0, true);
}

int CourseCB(gdioutput *gdi, int type, void *data) {
Expand Down Expand Up @@ -764,8 +764,11 @@ bool TabCourse::loadPage(gdioutput &gdi) {
gdi.addButton("ExportCourses", "Exportera...", CourseCB);
gdi.popX();
gdi.dropLine(2.5);
gdi.addButton("DrawCourse", "Lotta starttider..", CourseCB);
gdi.disableInput("DrawCourse");

if (oe->getMeOSFeatures().hasFeature(MeOSFeatures::DrawStartList)) {
gdi.addButton("DrawCourse", "Lotta starttider..", CourseCB);
gdi.disableInput("DrawCourse");
}
gdi.newColumn();
gdi.fillDown();

Expand Down
6 changes: 5 additions & 1 deletion code/classconfiginfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ bool ClassConfigInfo::hasTeamClass() const {
return !relay.empty() || !patrol.empty() || !raceNRes.empty();
}

bool ClassConfigInfo::hasQualificationFinal() const {
return !knockout.empty();
}

void ClassConfigInfo::getPatrol(set<int> &sel) const {
sel.insert(patrol.begin(), patrol.end());
}
Expand Down Expand Up @@ -141,7 +145,7 @@ void oEvent::getClassConfigurationInfo(ClassConfigInfo &cnf) const
if (Courses.empty() || (it->getCourse(false) == nullptr && it->getCourse(0,0, false) == nullptr) ||
(it->getCourse(false) && it->getCourse(false)->getNumControls() == 0)) {

if (!it->isQualificationFinalBaseClass()) {
if (!it->isQualificationFinalBaseClass() && !it->isQualificationFinalClass()) {
// No course.
if (runnerPerClass.empty()) {
for (auto &r : Runners) {
Expand Down
1 change: 1 addition & 0 deletions code/classconfiginfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class ClassConfigInfo {
void getRogainingTeam(set<int> &sel) const;

bool hasTeamClass() const;
bool hasQualificationFinal() const;

void getRaceNStart(int race, set<int> &sel) const;
void getLegNStart(int leg, set<int> &sel) const;
Expand Down
Loading

0 comments on commit efa06c0

Please sign in to comment.